1/* 2* Jssor.Core 16.0 3* http://www.jssor.com/ 4* 5* TERMS OF USE - Jssor.Core 6* 7* Copyright 2014 Jssor 8* 9* Permission is hereby granted, free of charge, to any person obtaining 10* a copy of this software and associated documentation files (the 11* "Software"), to deal in the Software without restriction, including 12* without limitation the rights to use, copy, modify, merge, publish, 13* distribute, sublicense, and/or sell copies of the Software, and to 14* permit persons to whom the Software is furnished to do so, subject to 15* the following conditions: 16* 17* The above copyright notice and this permission notice shall be 18* included in all copies or substantial portions of the Software. 19* 20* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 23* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 24* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 25* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 26* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27*/ 28 29/*! Jssor */ 30$Jssor$ = window.$Jssor$ = window.$Jssor$ || {}; 31 32 33//$JssorDebug$ 34var $JssorDebug$ = new function () { 35 36 this.$DebugMode = true; 37 38 // Methods 39 40 this.$Log = function (msg, important) { 41 var console = window.console || {}; 42 var debug = this.$DebugMode; 43 44 if (debug && console.log) { 45 console.log(msg); 46 } else if (debug && important) { 47 alert(msg); 48 } 49 }; 50 51 this.$Error = function (msg, e) { 52 var console = window.console || {}; 53 var debug = this.$DebugMode; 54 55 if (debug && console.error) { 56 console.error(msg); 57 } else if (debug) { 58 alert(msg); 59 } 60 61 if (debug) { 62 // since we're debugging, fail fast by crashing 63 throw e || new Error(msg); 64 } 65 }; 66 67 this.$Fail = function (msg) { 68 throw new Error(msg); 69 }; 70 71 this.$Assert = function (value, msg) { 72 var debug = this.$DebugMode; 73 if (debug) { 74 if (!value) 75 throw new Error("Assert failed " + msg || ""); 76 } 77 }; 78 79 this.$Trace = function (msg) { 80 var console = window.console || {}; 81 var debug = this.$DebugMode; 82 83 if (debug && console.log) { 84 console.log(msg); 85 } 86 }; 87 88 this.$Execute = function (func) { 89 var debug = this.$DebugMode; 90 if (debug) 91 func(); 92 }; 93 94 this.$LiveStamp = function (obj, id) { 95 var stamp = document.createElement("DIV"); 96 stamp.setAttribute("id", id); 97 98 obj.$Live = stamp; 99 }; 100};
101 102 103//$JssorEventManager$ 104var $JssorEventManager$ = function () { 105 var self = this; 106 // Fields 107 108 var listeners = {}; // dictionary of eventName --> array of handlers 109 110 // Methods 111 112 self.$On = self.addEventListener = function (eventName, handler) { 113 if (typeof (handler) != "function") { 114 return; 115 } 116 117 if (!listeners[eventName]) { 118 listeners[eventName] = []; 119 } 120 121 listeners[eventName].push(handler); 122 }; 123 124 self.$Off = self.removeEventListener = function (eventName, handler) { 125 var handlers = listeners[eventName]; 126 127 if (typeof (handler) != "function") { 128 return; 129 } else if (!handlers) { 130 return; 131 } 132 133 for (var i = 0; i < handlers.length; i++) { 134 if (handler == handlers[i]) { 135 handlers.splice(i, 1); 136 return; 137 } 138 } 139 }; 140 141 self.$ClearEventListeners = function (eventName) { 142 if (listeners[eventName]) { 143 delete listeners[eventName]; 144 } 145 }; 146 147 self.$TriggerEvent = function (eventName) { 148 var handlers = listeners[eventName]; 149 var args = []; 150 151 if (!handlers) { 152 return; 153 } 154 155 for (var i = 1; i < arguments.length; i++) { 156 args.push(arguments[i]); 157 } 158 159 for (var i = 0; i < handlers.length; i++) { 160 try { 161 handlers[i].apply(window, args); 162 } catch (e) { 163 // handler threw an error, ignore, go on to next one 164 $JssorDebug$.$Error(e.name + " while executing " + eventName + 165 " handler: " + e.message, e); 166 } 167 } 168 }; 169};
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.