1/* 2* Jssor.Core 14.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//$Jssor$.$Ready = function () { 33// //Logic borrowed from http://www.jquery.com 34 35// var readyBound = false, 36// readyList = [], 37// DOMContentLoaded; 38 39// if (document.addEventListener) { 40// DOMContentLoaded = function() { 41// document.removeEventListener('DOMContentLoaded', DOMContentLoaded, false); 42// ready();
43// }; 44 45// } else if (document.attachEvent) { 46// DOMContentLoaded = function() { 47// if (document.readyState === 'complete') { 48// document.detachEvent('onreadystatechange', DOMContentLoaded); 49// ready(); 50// } 51// }; 52// } 53 54// function ready() { 55// if (!ready.$IsReady) { 56// ready.$IsReady = true; 57// for (var i = 0, j = readyList.length; i < j; i++) { 58// try { 59// readyList[i](); 60// } 61// catch (e) { } 62// } 63// } 64// } 65 66// function doScrollCheck() { 67// try { 68// document.documentElement.doScroll("left"); 69// } catch (e) { 70// setTimeout(doScrollCheck, 1); 71// return; 72// } 73// ready(); 74// } 75 76// function bindReady() { 77// if (readyBound) { 78// return; 79// } 80// readyBound = true; 81 82// if (document.readyState === 'complete') { 83// ready.$IsReady = true; 84// } else { 85// if (document.addEventListener) { 86// document.addEventListener('DOMContentLoaded', DOMContentLoaded, false); 87// window.addEventListener('load', ready, false); 88// } else if (document.attachEvent) { 89// document.attachEvent('onreadystatechange', DOMContentLoaded); 90// window.attachEvent('onload', ready); 91 92// var toplevel = false; 93 94// try { 95// toplevel = window.frameElement == null; 96// } catch (e) { } 97 98// if (document.documentElement.doScroll && toplevel) { 99// doScrollCheck(); 100// } 101// } 102// } 103// } 104// bindReady(); 105 106// return function(callback) { 107// ready.$IsReady ? callback() : readyList.push(callback); 108// }; 109//}(); 110 111 112//$JssorDebug$ 113var $JssorDebug$ = new function () { 114 115 this.$DebugMode = true; 116 117 // Methods 118 119 this.$Log = function (msg, important) { 120 var console = window.console || {}; 121 var debug = this.$DebugMode; 122 123 if (debug && console.log) { 124 console.log(msg); 125 } else if (debug && important) { 126 alert(msg); 127 } 128 }; 129 130 this.$Error = function (msg, e) { 131 var console = window.console || {}; 132 var debug = this.$DebugMode; 133 134 if (debug && console.error) { 135 console.error(msg); 136 } else if (debug) { 137 alert(msg); 138 } 139 140 if (debug) { 141 // since we're debugging, fail fast by crashing 142 throw e || new Error(msg); 143 } 144 }; 145 146 this.$Fail = function (msg) { 147 throw new Error(msg); 148 }; 149 150 this.$Assert = function (value, msg) { 151 var debug = this.$DebugMode; 152 if (debug) { 153 if (!value) 154 throw new Error("Assert failed " + msg || ""); 155 } 156 }; 157 158 this.$Trace = function (msg) { 159 var console = window.console || {}; 160 var debug = this.$DebugMode; 161 162 if (debug && console.log) { 163 console.log(msg); 164 } 165 }; 166 167 this.$Execute = function (func) { 168 var debug = this.$DebugMode; 169 if (debug) 170 func(); 171 }; 172 173 this.$LiveStamp = function (obj, id) { 174 var stamp = document.createElement("DIV"); 175 stamp.setAttribute("id", id); 176 177 obj.$Live = stamp; 178 }; 179};
180 181 182//$JssorEventManager$ 183var $JssorEventManager$ = function () { 184 var self = this; 185 // Fields 186 187 var listeners = {}; // dictionary of eventName --> array of handlers 188 189 // Methods 190 191 self.$On = self.addEventListener = function (eventName, handler) { 192 if (typeof (handler) != "function") { 193 return; 194 } 195 196 if (!listeners[eventName]) { 197 listeners[eventName] = []; 198 } 199 200 listeners[eventName].push(handler); 201 }; 202 203 self.$Off = self.removeEventListener = function (eventName, handler) { 204 var handlers = listeners[eventName]; 205 206 if (typeof (handler) != "function") { 207 return; 208 } else if (!handlers) { 209 return; 210 } 211 212 for (var i = 0; i < handlers.length; i++) { 213 if (handler == handlers[i]) { 214 handlers.splice(i, 1); 215 return; 216 } 217 } 218 }; 219 220 self.$ClearEventListeners = function (eventName) { 221 if (listeners[eventName]) { 222 delete listeners[eventName]; 223 } 224 }; 225 226 self.$TriggerEvent = function (eventName) { 227 var handlers = listeners[eventName]; 228 var args = []; 229 230 if (!handlers) { 231 return; 232 } 233 234 for (var i = 1; i < arguments.length; i++) { 235 args.push(arguments[i]); 236 } 237 238 for (var i = 0; i < handlers.length; i++) { 239 try { 240 handlers[i].apply(window, args); 241 } catch (e) { 242 // handler threw an error, ignore, go on to next one 243 $JssorDebug$.$Error(e.name + " while executing " + eventName + 244 " handler: " + e.message, e); 245 } 246 } 247 }; 248};
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.