|
1 |
| -// Grab jQuery for use in any of the below |
2 |
| -var $djdtjq = jQuery.noConflict(true); |
3 |
| - |
4 |
| -window.djdt = (function(window, document, jQuery) { |
5 |
| - jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = $.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; |
| 1 | +(function (factory) { |
| 2 | + if (typeof define === 'function' && define.amd) { |
| 3 | + // AMD. Register as anonymous module. |
| 4 | + define(['jquery', 'jquery.cookie'], factory); |
| 5 | + } else { |
| 6 | + // Browser globals. |
| 7 | + window.djdt = factory(jQuery); |
| 8 | + } |
| 9 | +}(function (jQuery) { |
6 | 10 | var $ = jQuery;
|
7 | 11 | var COOKIE_NAME = 'djdt';
|
8 | 12 | var djdt = {
|
@@ -232,15 +236,8 @@ window.djdt = (function(window, document, jQuery) {
|
232 | 236 | }
|
233 | 237 | }
|
234 | 238 | };
|
235 |
| - $(document).ready(function() { |
236 |
| - djdt.init(); |
237 |
| - }); |
238 |
| - return djdt; |
239 |
| -}(window, document, $djdtjq)); |
240 |
| - |
241 | 239 |
|
242 |
| -(function(window, document, $) { |
243 |
| - function _renderPerf() { |
| 240 | + function renderPerf() { |
244 | 241 | // Browser timing remains hidden unless we can successfully access the performance object
|
245 | 242 | var perf = window.performance || window.msPerformance ||
|
246 | 243 | window.webkitPerformance || window.mozPerformance;
|
@@ -288,10 +285,12 @@ window.djdt = (function(window, document, jQuery) {
|
288 | 285 | }
|
289 | 286 | }
|
290 | 287 |
|
291 |
| - function renderPerf() { |
292 |
| - setTimeout(_renderPerf, 0); |
293 |
| - } |
294 |
| - |
295 |
| - $(window).bind('load', renderPerf); |
| 288 | + $(window).bind('load', function() { |
| 289 | + setTimeout(renderPerf, 0); |
| 290 | + }); |
| 291 | + $(document).ready(function() { |
| 292 | + djdt.init(); |
| 293 | + }); |
296 | 294 |
|
297 |
| -}(window, document, $djdtjq)); |
| 295 | + return djdt; |
| 296 | +})); |
0 commit comments