1/** 2 * jQuery.FormNavigate.js 3 * jQuery Form onChange Navigate Confirmation plugin 4 * Browser Compatibility : IE 6.0, 7.0, 8.0; Firefox 2.0+; Safari 3+; Opera 9+; Chrome 1+; 5 * 6 * Copyright (c) 2009 Law Ding Yong 7 * 8 * Licensed under the MIT license: 9 * http://www.opensource.org/licenses/mit-license.php 10 * 11 * See the file license.txt for copying permission. 12 */ 13 14 /** 15 * Documentation : 16 * ================== 17 * 18 * How to Use: 19 * $("YourForm").FormNavigate("YourMessage"); 20 * -- "YourForm" as Your Form ID $("#form") or any method to grab your form 21 * -- "YourMessage" as Your onBeforeUnload Prompt Message Here 22 * 23 * This plugin handles onchange of input type of text, textarea, password, radio, checkbox, select and file to toggle on and off of window.onbeforeunload event. 24 * Users are able to configure the custom onBeforeUnload message. 25 */ 26var global_formNavigate = true; // Js Global Variable for onChange Flag 27(function($){ 28 $.fn.FormNavigate = function(message, force) { 29 window.onbeforeunload = function confirmExit( event ) { 30 if (global_formNavigate == true) { 31 event.cancelBubble = true; 32 } else { 33 return message; 34 } 35 } 36 if (force) { 37 global_formNavigate = false; 38 } 39 $("input[type=text], input[type='textarea'], input[type='password'], input[type='radio'], input[type='checkbox'], input[type='file'], select").change(function(){ 40 global_formNavigate = false; 41 }); 42 //to handle back button 43 $("input[type='textarea']").keyup(function(){ 44 global_formNavigate = false; 45 }); 46 $("input[type='submit']").click(function(){ 47 global_formNavigate = true; 48 }); 49 $(".token-input-list-facebook").bind( "DOMNodeRemoved DOMNodeInserted", function(){ 50 global_formNavigate = false; 51 }); 52 } 53})(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.