1/*! 2 * jQuery stayInWebApp Plugin 3 * version: 0.4 (2012-06-19) 4 */ 5 6;(function($) { 7 //extend the jQuery object, adding $.stayInWebApp() as a function 8 $.extend({ 9 stayInWebApp: function(selector) { 10 //detect iOS full screen mode 11 if(("standalone" in window.navigator) && window.navigator.standalone) { 12 //if the selector is empty, default to all links 13 if(!selector) { 14 selector = 'a'; 15 } 16 //bind to the click event of all specified elements 17 $("body").delegate(selector,"click",function(event) { 18 //TODO: execute all other events if this element has more bound events 19 /* NEEDS TESTING 20 for(i = 0; i < $(this).data('events'); i++) { 21 console.log($(this).data('events')); 22 } 23 */ 24 25 //only stay in web app for links that are set to _self (or not set) 26 if($(this).attr("target") == undefined || $(this).attr("target") == "" || $(this).attr("target") == "_self") { 27 //get the destination of the link clicked 28 var dest = $(this).attr("href"); 29 30 //if the destination is an absolute url, ignore it 31 if(!dest.match(/^http(s?)/g)) { 32 //prevent default behavior (opening safari) 33 event.preventDefault(); 34 //update location of the web app 35 self.location = dest; 36 } 37 } 38 }); 39 } 40 } //end stayInWebApp func 41 }); 42})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.