Javascript

Detect if user "leaves" webpage

Before marking this question as duplicate READ THIS QUESTION I’m searching for a way that when a visiter leaves my webpage, he is redirected to another page. (He shouldn’t close the page) Some examples: I got the page open and I open another tab in my browser, then the person should be redirected to the other page, because he left…
Read more

Stop working javascript syntax hightlighter in vs2013

After installing vs2015 stop working javascript syntax hightlighter in vs2013 and vs2015. I tried to reset environment settings, but got an error: Your settings were reset, but there were some errors. Error 1: Failed to export settings for ‘JavaScript Specific’ [code 7284] Error 2: An error occurred while importing settings for ‘JavaScript Specific’ [code 5455]. Source: javascript

Rails 4 weird behaviour of pop-up

In my CoffeeScript, I am POSTing data via $.ajax, in the success callback I am hide()ing the modal display in my HTML, and showing a new pop-up but it doesn’t show until I open the first modal again. How would this be caused? ready = -> modal = $(‘#contact_form’) thanks = $(‘#thanks’) modal.hide() thanks.hide() contact.on “click”, (event) -> event.preventDefault() modal.show()…
Read more

Getting Google map objects programatically

I am running a webpage which has Google map in it. So far everything works fine but google likes to play w/ developers because Google periodically change va method in obj.__gm.va.id Is there any method or function to detect method name when google change it. Regards Source: javascript

How can I update a trackEvent in popcorn webmaker?

How can I update a trackEvent in popcorn webmaker? I am sharing my code that is as follows:- _this.addTrackEvent(importTrackEvents[i]); importTrackEvents[i] is equals to:- track.js:158 Object {id: “0”, name: “TrackEvent0”, order: 0, snap: false, trackEvents: [0: {id: “0” name: “TrackEvent0” order: 0 snap: false trackEvents: Array[1]0: Objectid: “0”name: “TrackEvent0″order: 0popcornOptions: ObjectcontentType: “”denied: falseduration: 296end: 296fallback: “”from: 0height: 100hidden: falseid: “0”left: 0linkback:…
Read more

jQuery fadein image on link hover

I’m trying to create a simple menu, where hovering over different elements fades in a different image over the menu. My best guest was to create a jQuery, but it does not seem to work. Here is the script: $(document).ready(function() { $(“#pau”).mouseover(function(){ $(“#paup”).show.fadeIn(600); $(“#pau”).mouseout(function(){ $(“#paup”).fadeOut(600); }); }); #pau div only defines the text part, over which an image should be…
Read more

Chrome app – FileSystem Access

I’m creating a simple eBook reader as a chrome packaged app. So I want to download ePub files from a remote server and keep it in a private place and from there I’ll parse the ePub file. Is that possible? Which are the chrome APIs I need to use? Source: javascript

Abort ajax request in a promise

I’m building a form validation and to learn promises I decided to implement asynchronous validation functions using promise pattern: var validateAjax = function(value) { return new Promise(function(resolve, reject) { $.ajax(‘data.json’, {data: {value: value}}).success(function(data, status, xhr) { if (data.valid) { resolve(xhr) } else { reject(data.message) } }).error(function(xhr, textStatus) { reject(textStatus) }) }) } //… var validators = [validateAjax]; $(‘body’).delegate(‘.validate’, ‘keyup’, function()…
Read more