Get computed font-family in JavaScript

This is a followup to this question. I am working on a component for the CKEditor, a tweaked version of the font drop-down menus that always display the currently selected font family / size values, no matter where they were defined, using computedStyle and consorts. As you can see in the other question, determining the […]

Strongloop app does not load local datasource

I want to use different environment specific datasource configurations in a Strongloop app. I saw at https://docs.strongloop.com/display/public/LB/Environment-specific+configuration that the priority of configurations are: Environment-specific configuration, based on the value of NODE_ENV; for example, server/config.staging.json. Local configuration file; for example, server/config.local.json. Default configuration file; for example, server/config.json. I have declared three datasource conf files: datasources.json: {} […]

Submit pdf form fields to a HTTP POST request

I’ve made a pdf form in Adobe Acrobat. Now I want to make a button that submits the form to a HTTP POST request. I have searched for about 4 hours, but I have not found an example to do this. Here I read that it is possible to send the pdf form fields with […]

How to captured Selected Text Range in iOS after text selection expansion

I’m working on a web app that allows a user to select some text, click a button, and save the highlighted text. This works great in desktop browsers, (chrome for this example), but in iOS I’m having issues with the native text selection, where the user can change the selected text. Here is the JsFiddle […]

attachEvent / addEventListener to Window onload / load – preferred way

I have a script that starts when the page loads and I had been using this code below to start it: if (window.addEventListener) { window.addEventListener(‘load’, otherRelatedParts, false); } else if (window.attachEvent) { window.attachEvent(‘onload’, otherRelatedParts ); } but today I tried with a self invoking function like this: (function() { otherRelatedParts(); }()) It seems to work, […]

Fire Javascript Event When a DIV is in View

Is it possible to fire a specific javascript event when a certain DIV comes into view on the page? Say, for example, I have a very large page, like 2500×2500 and I have a 40×40 div that sits at position 1980×1250. The div is not necessarily manually positioned, it could be there due to the […]

MVC4 Bundle minification doesn't work with javascript reserved words

Using the latest version of MVC4 I can’t minify javascript when it contains reserved words as key names! See the error below with the valid javascript that should have been minified. Does anyone know how to fix this short of rewriting the javascript to use [“”] notation? PS The code in question is a few […]

Eclipse Syntax Highlighting for HTML Files with <script type=“tmpl_handlebars”>

Currently I’m working on a Project with Handlebars (JS Template Engine) and I’m using eclipse for development. The problem is, that eclipse doesn’t offer syntax highlighting for my Handlebars-Templates. My Templates are enclosed in tags. Syntax highlighting in works as expected. Screenshot: Is it possible, that Eclipse also highlights this code (at the best with […]

Rails+javascript – image preview before upload

I want to show an image preview before upload, for that I am using the code given below. It works with firefox, but doesn’t work with IE8 <%= image_tag @image, :id=>”preview-photo” %> <%= file_field ‘image’,’photo’, :onchange => “preview(this);” %> function preview(this) { document.getElementById(“preview-photo”).src = this.value; return; } Is there any solution to preview the image […]

Locate each alphabet to each answer container but not to add new answer container – drag and drop using AngularJs

I need to put each alphabet to each answer container not to add new answer container. See my snippet. How I can do that? var myApp = angular.module(‘myApp’,[‘ngDragDrop’]).controller(‘QuestionDetailsCtrl’, function ($scope) { //Scrabble word $scope.ObjListAlphabet = [{alphabet: “J”},{alphabet: “L”},{alphabet: “W”},{alphabet: “E”},{alphabet: “B”},{alphabet: “A”},{alphabet: “T”},{alphabet: “U”}]; $scope.ObjAnswerList = [ {alphabet: “”}, {alphabet: “”}, {alphabet: “”}, {alphabet: “”}, […]