vendor: 5,854 bytes, lines 1-41
1; 2/* 3 * DnnSF (DNN Sharp Foundation) 4 */ 5(function (window) { 6 try { 7 new MouseEvent('test'); 8 return false; // No need to polyfill 9 } catch (e) { 10 // Need to polyfill - fall through 11 var MouseEvent = function (eventType, params) { 12 params = params || { bubbles: false, cancelable: false }; 13 var mouseEvent = document.createEvent('MouseEvent'); 14 mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 15 return mouseEvent; 16 } 17 MouseEvent.prototype = Event.prototype; 18 window.MouseEvent = MouseEvent; 19 } 20 // Polyfills DOM4 MouseEvent 21 })(window); 22 23if (typeof (dnnsfjQuery) == 'undefined') dnnsfjQuery = jQuery || $; 24 25/*yepnope1.5.x|WTFPL*/ 26(function (a, b, c) { function d(a) { return "[object Function]" == o.call(a) } function e(a) { return "string" == typeof a } function f() { } function g(a) { return !a || "loaded" == a || "complete" == a || "uninitialized" == a } function h() { var a = p.shift(); q = 1, a ? a.t ? m(function () { ("c" == a.t ? B.injectCss : B.injectJs)(a.s, 0, a.a, a.x, a.e, 1) }, 0) : (a(), h()) : q = 0 } function i(a, c, d, e, f, i, j) { function k(b) { if (!o && g(l.readyState) && (u.r = o = 1, !q && h(), l.onload = l.onreadystatechange = null, b)) { "img" != a && m(function () { t.removeChild(l) }, 50); for (var d in y[c]) y[c].hasOwnProperty(d) && y[c][d].onload() } } var j = j || B.errorTimeout, l = b.createElement(a), o = 0, r = 0, u = { t: d, s: c, e: f, a: i, x: j }; 1 === y[c] && (r = 1, y[c] = []), "object" == a ? l.data = c : (l.src = c, l.type = a), l.width = l.height = "0", l.onerror = l.onload = l.onreadystatechange = function () { k.call(this, r) }, p.splice(e, 0, u), "img" != a && (r || 2 === y[c] ? (t.insertBefore(l, s ? null : n), m(k, j)) : y[c].push(l)) } function j(a, b, c, d, f) { return q = 0, b = b || "j", e(a) ? i("c" == b ? v : u, a, b, this.i++, c, d, f) : (p.splice(this.i++, 0, a), 1 == p.length && h()), this } function k() { var a = B; return a.loader = { load: j, i: 0 }, a } var l = b.documentElement, m = a.setTimeout, n = b.getElementsByTagName("script")[0], o = {}.toString, p = [], q = 0, r = "MozAppearance" in l.style, s = r && !!b.createRange().compareNode, t = s ? l : n.parentNode, l = a.opera && "[object Opera]" == o.call(a.opera), l = !!b.attachEvent && !l, u = r ? "object" : l ? "script" : "img", v = l ? "script" : u, w = Array.isArray || function (a) { return "[object Array]" == o.call(a) }, x = [], y = {}, z = { timeout: function (a, b) { return b.length && (a.timeout = b[0]), a } }, A, B; B = function (a) { function b(a) { var a = a.split("!"), b = x.length, c = a.pop(), d = a.length, c = { url: c, origUrl: c, prefixes: a }, e, f, g; for (f = 0; f < d; f++) g = a[f].split("="), (e = z[g.shift()]) && (c = e(c, g)); for (f = 0; f < b; f++) c = x[f](c); return c } function g(a, e, f, g, h) { var i = b(a), j = i.autoCallback; i.url.split(".").pop().split("?").shift(), i.bypass || (e && (e = d(e) ? e : e[a] || e[g] || e[a.split("/").pop().split("?")[0]]), i.instead ? i.instead(a, e, f, g, h) : (y[i.url] ? i.noexec = !0 : y[i.url] = 1, f.load(i.url, i.forceCSS || !i.forceJS && "css" == i.url.split(".").pop().split("?").shift() ? "c" : c, i.noexec, i.attrs, i.timeout), (d(e) || d(j)) && f.load(function () { k(), e && e(i.origUrl, h, g), j && j(i.origUrl, h, g), y[i.url] = 2 }))) } function h(a, b) { function c(a, c) { if (a) { if (e(a)) c || (j = function () { var a = [].slice.call(arguments); k.apply(this, a), l() }), g(a, j, b, 0, h); else if (Object(a) === a) for (n in m = function () { var b = 0, c; for (c in a) a.hasOwnProperty(c) && b++; return b }(), a) a.hasOwnProperty(n) && (!c && !--m && (d(j) ? j = function () { var a = [].slice.call(arguments); k.apply(this, a), l() } : j[n] = function (a) { return function () { var b = [].slice.call(arguments); a && a.apply(this, b), l() } }(k[n])), g(a[n], j, b, n, h)) } else !c && l() } var h = !!a.test, i = a.load || a.both, j = a.callback || f, k = j, l = a.complete || f, m, n; c(h ? a.yep : a.nope, !!i), i && c(i) } var i, j, l = this.yepnope.loader; if (e(a)) g(a, 0, l, 0); else if (w(a)) for (i = 0; i < a.length; i++) j = a[i], e(j) ? g(j, 0, l, 0) : w(j) ? B(j) : Object(j) === j && h(j, l); else Object(a) === a && h(a, l) }, B.addPrefix = function (a, b) { z[a] = b }, B.addFilter = function (a) { x.push(a) }, B.errorTimeout = 1e4, null == b.readyState && b.addEventListener && (b.readyState = "loading", b.addEventListener("DOMContentLoaded", A = function () { b.removeEventListener("DOMContentLoaded", A, 0), b.readyState = "complete" }, 0)), a.yepnope = k(), a.yepnope.executeStack = h, a.yepnope.injectJs = function (a, c, d, e, i, j) { var k = b.createElement("script"), l, o, e = e || B.errorTimeout; k.src = a; for (o in d) k.setAttribute(o, d[o]); c = j ? h : c || f, k.onreadystatechange = k.onload = function () { !l && g(k.readyState) && (l = 1, c(), k.onload = k.onreadystatechange = null) }, m(function () { l || (l = 1, c(1)) }, e), i ? k.onload() : n.parentNode.insertBefore(k, n) }, a.yepnope.injectCss = function (a, c, d, e, g, i) { var e = b.createElement("link"), j, c = i ? h : c || f; e.href = a, e.rel = "stylesheet", e.type = "text/css"; for (j in d) e.setAttribute(j, d[j]); g || (n.parentNode.insertBefore(e, n), m(c, 0)) } })(this, document); 27 28// fix IE console issues 29if (!window.console) window.console = {}; 30if (!window.console.log) window.console.log = function () { }; 31 32var dnnsf = dnnsf || {}; 33 34// copy state into dnnsf 35if (typeof g_dnnsfState != 'undefined') 36 for (var key in g_dnnsfState) 37 dnnsf[key] = g_dnnsfState[key]; 38 39// extend with common functions 40dnnsf.init = function ($, appState) { 41 // save dnnsfjQuery object for future use
42 dnnsf.$ = $; 43 if (!window.dnnsfjQuery) 44 window.dnnsfjQuery = $; 45 if (!window.jQuery) 46 window.jQuery = $; 47 48 // execute the initialization code when done loading 49 (function (fn) { 50 if ($.isReady) fn(); else $(fn); 51 })(function () { 52 53 // media query support in IE7&8 54 yepnope({ 55 test: $.support.opacity == false, 56 yep: [ 57 appState.appUrl + '/static/html5/html5shiv.js', 58 appState.appUrl + '/static/html5/respond.min.js' 59 ] 60 }); 61 62 // if we're in an iframe, hide the scrollbar of current window and rely on auto-height featre 63 if (window.top != window && window.location.href.indexOf('isAdminIframe=true') != -1) { 64 $('body').css('overflow', 'hidden').attr('scroll', 'no'); 65 } 66 67 }); 68}; 69 70// returns a query string parameter by name 71dnnsf.urlParam = function (name) { 72 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(decodeURIComponent(window.location.href)); 73 if (!results) { return 0; } 74 return results[1] || 0; 75}; 76 77dnnsf.parseQueryString = function (queryString) { 78 var qs = {}, 79 match, 80 pl = /\+/g, // Regex for replacing addition symbol with a space 81 search = /([^&=]+)=?([^&]*)/g, 82 decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, 83 query = (queryString.indexOf('?') == 0 ? queryString.substring(1) : queryString); 84 85 if (query.indexOf('#') != -1) 86 query = query.substring(0, query.indexOf('#')); 87 while (match = search.exec(query)) 88 qs[decode(match[1])] = decode(match[2]); 89 return qs; 90}; 91 92dnnsf.updateQueryStringParam = function (key, value) { 93 var baseUrl = [location.protocol, '//', location.host, location.pathname].join(''), 94 urlQueryString = document.location.search, 95 newParam = key + '=' + value, 96 params = '?' + newParam; 97 98 // If the "search" string exists, then build params from it 99 if (urlQueryString) { 100 keyRegex = new RegExp('([\?&])' + key + '[^&]*'); 101 102 // If param exists already, update it 103 if (urlQueryString.match(keyRegex) !== null) { 104 params = urlQueryString.replace(keyRegex, "$1" + newParam); 105 } else { // Otherwise, add it to end of query string 106 params = urlQueryString + '&' + newParam; 107 } 108 } 109 history.replaceState({}, "", baseUrl + params); 110}; 111 112dnnsf.urlParams = {}; 113(window.onpopstate = function () { 114 dnnsf.urlParams = dnnsf.parseQueryString(window.location.search); 115})(); 116 117 118dnnsf.getUrlParts = function (url) { 119 var a = document.createElement('a'); 120 a.href = url; 121 var path = a.pathname || '/'; 122 if (path[0] != '/') 123 path = '/' + path; 124 125 return { 126 href: a.href, 127 host: a.host, 128 hostname: a.hostname, 129 port: a.port, 130 pathname: path, 131 protocol: a.protocol, 132 hash: a.hash, 133 search: a.search, 134 query: dnnsf.parseQueryString(a.search), 135 relativeUrl: path + a.search + a.hash, 136 137 getUrl: function () { 138 return this.pathname + ($.isEmptyObject(this.query) ? '' : '?' + $.param(this.query)) + this.hash; 139 } 140 }; 141} 142 143// this scrolls the page to given scroll, taking into account offset and iframe communication when applicable 144dnnsf.scrollTo = function (scroll) { 145 146 if (isNaN(scroll)) 147 return; 148 149 if (window.top != window) { 150 // post to top window 151 window.top.postMessage(JSON.stringify({ 152 type: dnnsf.urlParam('comm-prefix') + "-scroll", 153 offset: scroll 154 }), "*"); 155 } else { 156 // scroll this window 157 $('html, body').animate({ 158 scrollTop: scroll 159 }, 500); 160 } 161 162}; 163 164// always use this logging function since it will take care of disabling the logging on production 165// and also it measures execution time (not very precisely though) 166dnnsf.log = function () { 167 if (!this.isDebug || !window.console || !console.log) 168 return; 169 170 // append timestamp to list of arguments 171 var args = Array.prototype.slice.call(arguments); 172 args.push(new Date().getTime() - this.start); 173 174 // call the broser logging function 175 // TODO: in IE objects are no expanded, instead IE will show [Object object] string 176 // it would be useful to do a JSON.stringify on IE 177 Function.apply.call(console.log, console, args); 178}; 179 180dnnsf.canAccessIFrame = function (iframe) { 181 var html = null; 182 try { 183 html = $(iframe).contents(); 184 } catch (err) { 185 // do nothing 186 } 187 188 return (html ? true : false); 189} 190 191dnnsf.adminApi = function (method, args, options, isWebApi) { 192 options = options || {}; 193 options.apiUrl = options.apiUrl || g_dnnsfState.adminApi; 194 options.moduleId = options.moduleId || g_dnnsfState.moduleId || -1; 195 options.tabId = options.tabId || g_dnnsfState.tabId; 196 options.apiVersion = options.apiVersion || g_dnnsfState.apiVersion; 197 options.alias = options.alias || dnnsf.alias || g_dnnsfState.alias; 198 // if webApi is true then it builds the url for webApi with slahes, else it builds the normal URL 199 if (isWebApi) { 200 url = options.apiUrl + "/" + method + '?_alias=' + options.alias // options here is the URL string (e.g. Api/Admin) 201 } 202 else { 203 url = options.apiUrl + '?method=' + method + 204 (options.apiVersion == '2.0' 205 ? 206 ('&_alias=' + options.alias + '&_mid=' + options.moduleId + '&_tabid=' + options.tabId) 207 : 208 ('&alias=' + options.alias + '&mid=' + options.moduleId + '&tabid=' + options.tabId)) 209 } 210 211 if (!args) 212 return url; 213 214 for (var name in args) { 215 if (args.hasOwnProperty(name)) 216 url += '&' + name + '=' + encodeURIComponent(args[name]); 217 } 218 return url; 219}; 220 221dnnsf.parseCssBlock = function (styleContent) { 222 223 var rules = {}; 224 dnnsf.$.each(styleContent.split(';'), function (i, part) { 225 var isep = part.indexOf(':'); 226 if (isep == -1) 227 return; // ? 228 rules[dnnsf.$.trim(part.substr(0, isep))] = dnnsf.$.trim(part.substr(isep + 1)); 229 });
230 231 return rules; 232}; 233 234dnnsf.stackTrace = function () { 235 236 //return ''; 237 //var e = new Error('dummy'); 238 //var stack = e.stack.replace(/^[^\(]+?[\n$]/gm, '') 239 // .replace(/^\s+at\s+/gm, '') 240 // .replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') 241 // .split('\n'); 242 //// remove the call to this function 243 //stack.splice(0, 1); 244 //return stack; 245}; 246 247// this function tries to guess if a string is an object or array 248dnnsf.eval = function (obj) { 249 250 if (typeof (obj) != 'string') 251 return obj; 252 253 if (!isNaN(parseInt(obj))) 254 return parseInt(obj); 255 256 if (!isNaN(parseFloat(obj))) 257 return parseFloat(obj); 258 259 // TODO: find a better way to determine json arrays and objects - for example with a regex 260 if (obj[0] == '[' || obj[0] == '{') 261 return eval(obj); 262 263 if (obj == "false") 264 return false; 265 266 if (obj == "true") 267 return true; 268 269 // just return it as string 270 return obj; 271}; 272 273// if object is array, return it, otheriwse return a new array with only this item 274dnnsf.toArray = function (obj) { 275 if (!obj) return []; 276 if (!$.isArray(obj)) 277 obj = [obj]; 278 return obj; 279}; 280 281dnnsf.tryParseBool = function (o) { 282 // JSON values aren't necessary strings 283 if (typeof (o) !== 'string') 284 return o; 285 286 if (o.toLowerCase() == 'true') 287 return true; 288 289 if (o.toLowerCase() == 'false') 290 return false; 291 292 return o; 293}; 294 295dnnsf.stringToBool = function (input) { 296 return typeof input === 'boolean' && input || (input ? JSON.parse(input.toLowerCase()) : false); 297} 298 299// returns baseId + altId if altId exists, otherwise generates an unique string 300dnnsf.uniqueId = function (baseId, altId) { 301 if (!altId || altId == -1) 302 return baseId + new Date().getTime() + Math.floor(Math.random() * 10000); 303 return baseId + altId; 304} 305 306dnnsf.randomString = function (length) { 307 var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 308 var result = ''; 309 for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))]; 310 return result; 311} 312 313dnnsf.initParameters = function (def, field, ensureItSupportsExpressions) { 314 if (!def || def.Parameters == undefined || !field) 315 return; 316 317 for (var i = 0; i < def.Parameters.length; i++) { 318 319 var p = def.Parameters[i]; 320 if (ensureItSupportsExpressions && (p.Type == 'Select' || p.Type == 'FieldSelect') 321 && ($.type(field.Parameters[p.Id]) != "object" || (!field.Parameters[p.Id].hasOwnProperty('Value') && !field.Parameters[p.Id].hasOwnProperty('IsExpression')))) 322 field.Parameters[p.Id] = { Value: field.Parameters[p.Id], IsExpression: false, Expression: '' }; 323 324 // action list need to be initialized to empty arrays 325 if (p.Type == 'ActionList' && !field.Parameters[p.Id]) { 326 field.Parameters[p.Id] = []; 327 } else if (p.Type == 'ActionList' && field.Parameters[p.Id]) { 328 field.Parameters[p.Id] = $.grep(field.Parameters[p.Id], function (e) { return !e.IsDeleted }); 329 } 330 331 // check either this parameter already has a value 332 if (typeof field.Parameters[p.Id] != 'undefined') 333 continue; 334 if (p.Id != 'DataSource') { 335 if (typeof field.Parameters[p.Id] != 'undefined') 336 continue; 337 if (p.Type == 'Select' || p.Type == 'FieldSelect' || p.Type == 'MultipleFieldSelect') 338 field.Parameters[p.Id] = { 339 Expression: '', 340 Value: p.DefaultValue ? g_localizeMaybeJson(p.DefaultValue) : '', 341 IsExpression: false 342 }; 343 else field.Parameters[p.Id] = p.DefaultValue ? g_localizeMaybeJson(p.DefaultValue) : ''; 344 } else { 345 // check either this parameter already has a value 346 if (typeof field.Parameters[p.Id] != 'undefined') { 347 // try to convert to object format 348 if (!field.Parameters[p.Id].hasOwnProperty('SupportsExpressions')) { 349 // if already an object with IsExpression 350 if (field.Parameters[p.Id].hasOwnProperty('IsExpression')) { 351 field.Parameters[p.Id].SupportsExpressions = true; 352 } 353 else { 354 field.Parameters[p.Id] = { 355 SupportsExpressions: false, 356 Expression: '', 357 Value: field.Parameters[p.Id], 358 IsExpression: false, 359 Parameters: {} 360 } 361 362 } 363 } 364 continue; 365 } 366 367 field.Parameters[p.Id] = p.DefaultValue ? g_localizeMaybeJson(p.DefaultValue) : ({ 368 SupportsExpressions: p.Settings && p.Settings['SupportsExpressions'] == 'true', 369 Expression: '', 370 Value: '', 371 IsExpression: false, 372 Parameters: {} 373 }); 374 } 375 // maybe we have non-localized default settings 376 if (!field.Parameters[p.Id] && !p.DefaultValue && p.Settings && p.Settings['Defaults']) { 377 var val = p.Settings['Defaults']; 378 // also see g_localizeMaybeJson; it will throw exception if not json 379 if (val && (val[0] == '[' || val[0] == '{')) { 380 var processBool = (val[0] != '['); 381 val = $.parseJSON(val); 382 // we only can have arrays of bools ? 383 if (!processBool) { 384 field.Parameters[p.Id] = {}; 385 for (var j = 0; val.length > j; ++j) 386 field.Parameters[p.Id][val[j]] = true; 387 return; 388 } 389 } 390 field.Parameters[p.Id] = val; 391 } 392 393 // booleans will come as strings, convert them to true bool 394 if (typeof (field.Parameters[p.Id]) === 'object') { 395 $.each(field.Parameters[p.Id], function (key, value) { 396 field.Parameters[p.Id][key] = dnnsf.tryParseBool(value); 397 }); 398 } else { 399 field.Parameters[p.Id] = dnnsf.tryParseBool(field.Parameters[p.Id]); 400 } 401 402 } 403 404} 405 406dnnsf.includeJs = function (window, file, callback) { 407 var head = window.document.getElementsByTagName('head')[0]; 408 var script = window.document.createElement('script'); 409 script.type = 'text/javascript'; 410 script.src = file; 411 script.onload = script.onreadystatechange = function () { 412 // execute dependent code 413 if (callback) callback(); 414 // prevent memory leak in IE 415 head.removeChild(script); 416 script.onload = null; 417 }; 418 head.appendChild(script); 419} 420 421dnnsf.asQueryString = function (obj) { 422 var qs = ''; 423 for (var k in obj) { 424 if (!obj.hasOwnProperty(k)) 425 continue; 426 qs += encodeURIComponent(k) + '=' + encodeURIComponent(obj[k]) + '&'; 427 } 428 if (qs.length) 429 qs = qs.substring(0, qs.length - 1) 430 return qs; 431} 432 433dnnsf.appendQueryToUrl = function (url, query) { 434 435 if (url[url.length - 1] == '?' || url[url.length - 1] == '&') 436 url = url.substr(0, url.length - 1); 437 438 var sep = url.indexOf('?') == -1 ? '?' : '&'; 439
440 if ("string" == typeof query) 441 url += sep + query; 442 else for (var k in query) { 443 if (!query.hasOwnProperty(k)) 444 continue; 445 url += sep + encodeURIComponent(k) + '=' + encodeURIComponent(query[k]); 446 sep = '&'; 447 } 448 449 return url; 450}; 451 452dnnsf.getTimezoneOffset = function () { 453 function pad(num) { 454 var norm = Math.abs(Math.floor(num)); 455 return (norm < 10 ? '0' : '') + norm; 456 } 457 458 var local = new Date(); 459 var tzo = -local.getTimezoneOffset(); 460 var sign = tzo >= 0 ? '+' : '-'; 461 return sign + pad(tzo / 60) 462 + ':' + pad(tzo % 60); 463}; 464 465dnnsf.loadJsFromHtml = function (html) { 466 var scripts = $(html).find('script'); 467 if (scripts.length <= 0) 468 return; 469 var filesToLoad = []; 470 $.each(scripts, function (i, v) { 471 if ($(v).attr('src') != undefined) 472 filesToLoad.push({ src: $(v).attr('src') }) 473 else 474 filesToLoad.push({ toEval: $(v).text() }) 475 }); 476 loadJs(filesToLoad[0]); 477 478 function loadJs(js) { 479 if (js.toEval) { 480 eval(js.toEval) 481 filesToLoad.shift(); 482 filesToLoad.length && loadJs(filesToLoad[0]); 483 } else { 484 filesToLoad.shift(); 485 $.ajax({
486 cache: true, 487 url: js.src, 488 dataType: "script", 489 success: function () { 490 if (filesToLoad.length && filesToLoad[0].toEval) { 491 eval(filesToLoad[0].toEval); 492 filesToLoad.shift(); 493 } 494 filesToLoad.length && loadJs(filesToLoad[0]); 495 } 496 }); 497 } 498 } 499} 500 501dnnsf.events = { 502 503 _listeners: {}, 504 505 listen: function (messageType, mid, fn) { 506 if (!dnnsf.events._listeners[messageType]) 507 dnnsf.events._listeners[messageType] = {}; 508 dnnsf.events._listeners[messageType]['mid' + mid] = fn; 509 }, 510 511 broadcast: function (messageType, data, fnDone) { 512 if (!dnnsf.events._listeners[messageType]) { 513 fnDone && fnDone(); 514 return; 515 } 516 var listenerCount = Object.keys(dnnsf.events._listeners[messageType]).length; 517 var listenerResponses = []; 518 $.each(dnnsf.events._listeners[messageType], function (i, fn) { 519 var fnHandleResponse = function (response) { 520 response && listenerResponses.push(response); 521 listenerCount--; 522 if (listenerCount == 0) 523 fnDone(listenerResponses); 524 }; 525 526 fn(data, fnHandleResponse); 527 }); 528 529 }, 530 emittedEvents: [], 531 on: function (event, fn) { 532 if (this.emittedEvents[event] == null) { 533 this.emittedEvents[event] = []; 534 } 535 var id = dnnsf.uniqueId('event'); 536 this.emittedEvents[event][id] = { 537 id: id, 538 callback: typeof fn === "function" ? fn : function () { console.log(this); console.error('dnnsfEvents: ' + event + ': Check the callBack function') } 539 } 540 return id; 541 }, 542 emit: function (event, data) { 543 if (this.emittedEvents[event] != null) { 544 for (id in this.emittedEvents[event]) { 545 if (this.emittedEvents[event].hasOwnProperty(id)) 546 this.emittedEvents[event][id].callback.call(data || {}); 547 } 548 } 549 }, 550 unbind: function (event, id) { 551 if (this.emittedEvents[event] != null && this.emittedEvents[event][id] != null) { 552 delete this.emittedEvents[event][id]; 553 } 554 } 555/* 556var eventId = dnnsf.events.on('aaa', function () { console.log(this //will log {date:11111}) }) 557dnnsf.events.emit('aaa', { date: 11111 }) 558dnnsf.events.unbind('aaa', eventId); 559*/ 560} 561 562 563 564dnnsf.hasProps = function (obj) { 565 for (var k in obj) 566 if (obj.hasOwnProperty(k)) 567 return true; 568 return false; 569}; 570 571 572dnnsf.api = dnnsf.api || {}; 573 574var initDnnsf = function (angular) { 575 var module = angular.module('dnnsf', []).service('dnnsf', ['$timeout', function ($timeout) { 576 577 this.env = dnnsf; 578 this.start = new Date().getTime(); 579 580 // copy everything in dnnsf 581 for (var key in dnnsf) 582 this[key] = dnnsf[key]; 583 }]); 584 585 module.factory('myInterceptor', ['$log', '$q', function ($log, $q) { 586 var myInterceptor = { 587 'response': function (response) { 588 if (response.status == 200 && response.data && response.data.error) { 589 console.log("App HTTP error", response); 590 // if (response.data.redirect) { 591 // window.top.location = response.data.redirect; 592 // return; 593 // } 594 // alert('Error getting response from ' + response.config.url + '.\n\nError: ' + response.data.error); 595 } 596 return response; 597 }, 598 'responseError': function (rejection) { 599 if (rejection.status && rejection.status != 404 && !rejection.config.ignoreInterceptor) { 600 // status:0 means an unitialized ajax request, 601 // it happens for example the page is refreshed before the ajax request gets the chance to make connection 602 console.log("HTTP error", rejection); 603 // alert('error' + rejection); 604 } 605 return $q.reject(rejection); 606 } 607 }; 608 609 return myInterceptor; 610 }]); 611 612 module.config(['$httpProvider', function ($httpProvider) { 613 $httpProvider.interceptors.push('myInterceptor'); 614 }]); 615} 616window.angular ? initDnnsf(angular) : '';
617window.dnnsfAngular15 ? initDnnsf(dnnsfAngular15) : ''; 618
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.