1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/** 11 * Yii JavaScript module. 12 * 13 * @link http://www.yiiframework.com/ 14 * @copyright Copyright (c) 2008 Yii Software LLC 15 * @license http://www.yiiframework.com/license/ 16 * @author Qiang Xue <[email protected]> 17 * @since 2.0 18 */ 19 20/** 21 * yii is the root module for all Yii JavaScript modules. 22 * It implements a mechanism of organizing JavaScript code in modules through the function "yii.initModule()". 23 * 24 * Each module should be named as "x.y.z", where "x" stands for the root module (for the Yii core code, this is "yii"). 25 * 26 * A module may be structured as follows: 27 * 28 * ```javascript 29 * window.yii.sample = (function($) { 30 * var pub = { 31 * // whether this module is currently active. If false, init() will not be called for this module 32 * // it will also not be called for all its child modules. If this property is undefined, it means true. 33 * isActive: true, 34 * init: function() { 35 * // ... module initialization code goes here ... 36 * }, 37 * 38 * // ... other public functions and properties go here ... 39 * }; 40 * 41 * // ... private functions and properties go here ... 42 * 43 * return pub; 44 * })(window.jQuery); 45 * ``` 46 * 47 * Using this structure, you can define public and private functions/properties for a module. 48 * Private functions/properties are only visible within the module, while public functions/properties 49 * may be accessed outside of the module. For example, you can access "yii.sample.isActive". 50 * 51 * You must call "yii.initModule()" once for the root module of all your modules. 52 */ 53window.yii = (function ($) { 54 var pub = { 55 /** 56 * List of JS or CSS URLs that can be loaded multiple times via AJAX requests. 57 * Each item may be represented as either an absolute URL or a relative one. 58 * Each item may contain a wildcard matching character `*`, that means one or more 59 * any characters on the position. For example: 60 * - `/css/*.css` will match any file ending with `.css` in the `css` directory of the current web site 61 * - `http*://cdn.example.com/*` will match any files on domain `cdn.example.com`, loaded with HTTP or HTTPS 62 * - `/js/myCustomScript.js?realm=*` will match file `/js/myCustomScript.js` with defined `realm` parameter 63 */ 64 reloadableScripts: [], 65 /** 66 * The selector for clickable elements that need to support confirmation and form submission. 67 */ 68 clickableSelector: 'a, button, input[type="submit"], input[type="button"], input[type="reset"], ' + 69 'input[type="image"]', 70 /** 71 * The selector for changeable elements that need to support confirmation and form submission. 72 */ 73 changeableSelector: 'select, input, textarea', 74 75 /** 76 * @return string|undefined the CSRF parameter name. Undefined is returned if CSRF validation is not enabled. 77 */
78 getCsrfParam: function () { 79 return $('meta[name=csrf-param]').attr('content'); 80 }, 81 82 /** 83 * @return string|undefined the CSRF token. Undefined is returned if CSRF validation is not enabled. 84 */ 85 getCsrfToken: function () { 86 return $('meta[name=csrf-token]').attr('content'); 87 }, 88 89 /** 90 * Sets the CSRF token in the meta elements. 91 * This method is provided so that you can update the CSRF token with the latest one you obtain from the server. 92 * @param name the CSRF token name 93 * @param value the CSRF token value 94 */ 95 setCsrfToken: function (name, value) { 96 $('meta[name=csrf-param]').attr('content', name); 97 $('meta[name=csrf-token]').attr('content', value); 98 }, 99 100 /** 101 * Updates all form CSRF input fields with the latest CSRF token. 102 * This method is provided to avoid cached forms containing outdated CSRF tokens. 103 */ 104 refreshCsrfToken: function () { 105 var token = pub.getCsrfToken(); 106 if (token) { 107 $('form input[name="' + pub.getCsrfParam() + '"]').val(token); 108 } 109 }, 110 111 /** 112 * Displays a confirmation dialog. 113 * The default implementation simply displays a js confirmation dialog. 114 * You may override this by setting `yii.confirm`. 115 * @param message the confirmation message. 116 * @param ok a callback to be called when the user confirms the message 117 * @param cancel a callback to be called when the user cancels the confirmation 118 */ 119 confirm: function (message, ok, cancel) { 120 if (window.confirm(message)) { 121 !ok || ok(); 122 } else { 123 !cancel || cancel(); 124 } 125 }, 126 127 /** 128 * Handles the action triggered by user. 129 * This method recognizes the `data-method` attribute of the element. If the attribute exists, 130 * the method will submit the form containing this element. If there is no containing form, a form 131 * will be created and submitted using the method given by this attribute value (e.g. "post", "put"). 132 * For hyperlinks, the form action will take the value of the "href" attribute of the link. 133 * For other elements, either the containing form action or the current page URL will be used 134 * as the form action URL. 135 * 136 * If the `data-method` attribute is not defined, the `href` attribute (if any) of the element 137 * will be assigned to `window.location`. 138 * 139 * Starting from version 2.0.3, the `data-params` attribute is also recognized when you specify 140 * `data-method`. The value of `data-params` should be a JSON representation of the data (name-value pairs) 141 * that should be submitted as hidden inputs. For example, you may use the following code to generate 142 * such a link: 143 * 144 * ```php 145 * use yii\helpers\Html; 146 * use yii\helpers\Json; 147 * 148 * echo Html::a('submit', ['site/foobar'], [ 149 * 'data' => [ 150 * 'method' => 'post', 151 * 'params' => [ 152 * 'name1' => 'value1', 153 * 'name2' => 'value2', 154 * ], 155 * ], 156 * ]); 157 * ``` 158 * 159 * @param $e the jQuery representation of the element 160 * @param event Related event 161 */ 162 handleAction: function ($e, event) { 163 var $form = $e.attr('data-form') ? $('#' + $e.attr('data-form')) : $e.closest('form'), 164 method = !$e.data('method') && $form ? $form.attr('method') : $e.data('method'), 165 action = $e.attr('href'), 166 isValidAction = action && action !== '#', 167 params = $e.data('params'), 168 areValidParams = params && $.isPlainObject(params), 169 pjax = $e.data('pjax'), 170 usePjax = pjax !== undefined && pjax !== 0 && $.support.pjax, 171 pjaxContainer, 172 pjaxOptions = {}; 173 174 if (usePjax) { 175 pjaxContainer = $e.data('pjax-container') || $e.closest('[data-pjax-container]'); 176 if (!pjaxContainer.length) { 177 pjaxContainer = $('body'); 178 } 179 pjaxOptions = { 180 container: pjaxContainer, 181 push: !!$e.data('pjax-push-state'), 182 replace: !!$e.data('pjax-replace-state'), 183 scrollTo: $e.data('pjax-scrollto'), 184 pushRedirect: $e.data('pjax-push-redirect'), 185 replaceRedirect: $e.data('pjax-replace-redirect'), 186 skipOuterContainers: $e.data('pjax-skip-outer-containers'), 187 timeout: $e.data('pjax-timeout'), 188 originalEvent: event, 189 originalTarget: $e 190 }; 191 } 192 193 if (method === undefined) { 194 if (isValidAction) { 195 usePjax ? $.pjax.click(event, pjaxOptions) : window.location.assign(action); 196 } else if ($e.is(':submit') && $form.length) { 197 if (usePjax) { 198 $form.on('submit', function (e) { 199 $.pjax.submit(e, pjaxOptions); 200 }); 201 } 202 $form.trigger('submit'); 203 } 204 return; 205 } 206 207 var oldMethod, 208 oldAction, 209 newForm = !$form.length; 210 if (!newForm) { 211 oldMethod = $form.attr('method'); 212 $form.attr('method', method); 213 if (isValidAction) { 214 oldAction = $form.attr('action'); 215 $form.attr('action', action); 216 } 217 } else { 218 if (!isValidAction) { 219 action = pub.getCurrentUrl(); 220 } 221 $form = $('<form/>', {method: method, action: action}); 222 var target = $e.attr('target'); 223 if (target) { 224 $form.attr('target', target); 225 } 226 if (!/(get|post)/i.test(method)) { 227 $form.append($('<input/>', {name: '_method', value: method, type: 'hidden'})); 228 method = 'post'; 229 $form.attr('method', method); 230 } 231 if (/post/i.test(method)) { 232 var csrfParam = pub.getCsrfParam(); 233 if (csrfParam) { 234 $form.append($('<input/>', {name: csrfParam, value: pub.getCsrfToken(), type: 'hidden'})); 235 } 236 } 237 $form.hide().appendTo('body'); 238 } 239 240 var activeFormData = $form.data('yiiActiveForm'); 241 if (activeFormData) { 242 // Remember the element triggered the form submission. This is used by yii.activeForm.js. 243 activeFormData.submitObject = $e; 244 } 245 246 if (areValidParams) { 247 $.each(params, function (name, value) { 248 $form.append($('<input/>').attr({name: name, value: value, type: 'hidden'})); 249 }); 250 } 251 252 if (usePjax) { 253 $form.on('submit', function (e) { 254 $.pjax.submit(e, pjaxOptions); 255 }); 256 } 257 258 $form.trigger('submit'); 259 260 $.when($form.data('yiiSubmitFinalizePromise')).then(function () { 261 if (newForm) { 262 $form.remove(); 263 return; 264 } 265 266 if (oldAction !== undefined) { 267 $form.attr('action', oldAction); 268 } 269 $form.attr('method', oldMethod); 270 271 if (areValidParams) { 272 $.each(params, function (name) { 273 $('input[name="' + name + '"]', $form).remove(); 274 }); 275 } 276 }); 277 }, 278 279 getQueryParams: function (url) { 280 var pos = url.indexOf('?'); 281 if (pos < 0) { 282 return {}; 283 } 284 285 var pairs = url.substring(pos + 1).split('#')[0].split('&'), 286 params = {}; 287 288 for (var i = 0, len = pairs.length; i < len; i++) { 289 var pair = pairs[i].split('='); 290 var name = decodeURIComponent(pair[0].replace(/\+/g, '%20')); 291 var value = decodeURIComponent(pair[1].replace(/\+/g, '%20')); 292 if (!name.length) { 293 continue; 294 } 295 if (params[name] === undefined) { 296 params[name] = value || ''; 297 } else { 298 if (!$.isArray(params[name])) { 299 params[name] = [params[name]]; 300 } 301 params[name].push(value || ''); 302 } 303 } 304 return params; 305 }, 306 307 initModule: function (module) { 308 if (module.isActive !== undefined && !module.isActive) { 309 return; 310 } 311 if ($.isFunction(module.init)) {
312 module.init(); 313 } 314 $.each(module, function () { 315 if ($.isPlainObject(this)) { 316 pub.initModule(this); 317 } 318 }); 319 }, 320 321 init: function () { 322 initCsrfHandler(); 323 initRedirectHandler(); 324 initAssetFilters(); 325 initDataMethods(); 326 }, 327 328 /** 329 * Returns the URL of the current page without params and trailing slash. Separated and made public for testing. 330 * @returns {string} 331 */ 332 getBaseCurrentUrl: function () { 333 return window.location.protocol + '//' + window.location.host; 334 }, 335 336 /** 337 * Returns the URL of the current page. Used for testing, you can always call `window.location.href` manually 338 * instead. 339 * @returns {string} 340 */ 341 getCurrentUrl: function () { 342 return window.location.href; 343 } 344 }; 345 346 function initCsrfHandler() { 347 // automatically send CSRF token for all AJAX requests 348 $.ajaxPrefilter(function (options, originalOptions, xhr) { 349 if (!options.crossDomain && pub.getCsrfParam()) { 350 xhr.setRequestHeader('X-CSRF-Token', pub.getCsrfToken()); 351 } 352 }); 353 pub.refreshCsrfToken(); 354 } 355 356 function initRedirectHandler() { 357 // handle AJAX redirection 358 $(document).ajaxComplete(function (event, xhr) { 359 var url = xhr && xhr.getResponseHeader('X-Redirect'); 360 if (url) { 361 window.location.assign(url); 362 } 363 }); 364 } 365 366 function initAssetFilters() { 367 /** 368 * Used for storing loaded scripts and information about loading each script if it's in the process of loading. 369 * A single script can have one of the following values: 370 * 371 * - `undefined` - script was not loaded at all before or was loaded with error last time. 372 * - `true` (boolean) - script was successfully loaded. 373 * - object - script is currently loading. 374 * 375 * In case of a value being an object the properties are: 376 * - `xhrList` - represents a queue of XHR requests sent to the same URL (related with this script) in the same 377 * small period of time. 378 * - `xhrDone` - boolean, acts like a locking mechanism. When one of the XHR requests in the queue is 379 * successfully completed, it will abort the rest of concurrent requests to the same URL until cleanup is done 380 * to prevent possible errors and race conditions. 381 * @type {{}} 382 */ 383 var loadedScripts = {}; 384 385 $('script[src]').each(function () { 386 var url = getAbsoluteUrl(this.src); 387 loadedScripts[url] = true; 388 }); 389 390 $.ajaxPrefilter('script', function (options, originalOptions, xhr) { 391 if (options.dataType == 'jsonp') { 392 return; 393 } 394 395 var url = getAbsoluteUrl(options.url), 396 forbiddenRepeatedLoad = loadedScripts[url] === true && !isReloadableAsset(url), 397 cleanupRunning = loadedScripts[url] !== undefined && loadedScripts[url]['xhrDone'] === true; 398 399 if (forbiddenRepeatedLoad || cleanupRunning) { 400 xhr.abort(); 401 return; 402 } 403 404 if (loadedScripts[url] === undefined || loadedScripts[url] === true) { 405 loadedScripts[url] = { 406 xhrList: [], 407 xhrDone: false 408 }; 409 } 410 411 xhr.done(function (data, textStatus, jqXHR) { 412 // If multiple requests were successfully loaded, perform cleanup only once 413 if (loadedScripts[jqXHR.yiiUrl]['xhrDone'] === true) { 414 return; 415 } 416 417 loadedScripts[jqXHR.yiiUrl]['xhrDone'] = true; 418 419 for (var i = 0, len = loadedScripts[jqXHR.yiiUrl]['xhrList'].length; i < len; i++) { 420 var singleXhr = loadedScripts[jqXHR.yiiUrl]['xhrList'][i]; 421 if (singleXhr && singleXhr.readyState !== XMLHttpRequest.DONE) { 422 singleXhr.abort(); 423 } 424 } 425 426 loadedScripts[jqXHR.yiiUrl] = true; 427 }).fail(function (jqXHR, textStatus) { 428 if (textStatus === 'abort') { 429 return; 430 } 431 432 delete loadedScripts[jqXHR.yiiUrl]['xhrList'][jqXHR.yiiIndex]; 433 434 var allFailed = true; 435 for (var i = 0, len = loadedScripts[jqXHR.yiiUrl]['xhrList'].length; i < len; i++) { 436 if (loadedScripts[jqXHR.yiiUrl]['xhrList'][i]) { 437 allFailed = false;
438 } 439 } 440 441 if (allFailed) { 442 delete loadedScripts[jqXHR.yiiUrl]; 443 } 444 }); 445 // Use prefix for custom XHR properties to avoid possible conflicts with existing properties 446 xhr.yiiIndex = loadedScripts[url]['xhrList'].length; 447 xhr.yiiUrl = url; 448 449 loadedScripts[url]['xhrList'][xhr.yiiIndex] = xhr; 450 }); 451 452 $(document).ajaxComplete(function () { 453 var styleSheets = []; 454 $('link[rel=stylesheet]').each(function () { 455 var url = getAbsoluteUrl(this.href); 456 if (isReloadableAsset(url)) { 457 return; 458 } 459 460 $.inArray(url, styleSheets) === -1 ? styleSheets.push(url) : $(this).remove(); 461 }); 462 }); 463 } 464 465 function initDataMethods() { 466 var handler = function (event) { 467 var $this = $(this), 468 method = $this.data('method'), 469 message = $this.data('confirm'), 470 form = $this.data('form'); 471 472 if (method === undefined && message === undefined && form === undefined) { 473 return true; 474 } 475 476 if (message !== undefined) { 477 $.proxy(pub.confirm, this)(message, function () { 478 pub.handleAction($this, event); 479 }); 480 } else { 481 pub.handleAction($this, event); 482 } 483 event.stopImmediatePropagation(); 484 return false; 485 }; 486 487 // handle data-confirm and data-method for clickable and changeable elements 488 $(document).on('click.yii', pub.clickableSelector, handler) 489 .on('change.yii', pub.changeableSelector, handler); 490 } 491 492 function isReloadableAsset(url) { 493 for (var i = 0; i < pub.reloadableScripts.length; i++) { 494 var rule = getAbsoluteUrl(pub.reloadableScripts[i]); 495 var match = new RegExp("^" + escapeRegExp(rule).split('\\*').join('.*') + "$").test(url); 496 if (match === true) { 497 return true; 498 } 499 } 500 501 return false; 502 } 503 504 // http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex 505 function escapeRegExp(str) { 506 return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 507 } 508 509 /** 510 * Returns absolute URL based on the given URL 511 * @param {string} url Initial URL 512 * @returns {string} 513 */ 514 function getAbsoluteUrl(url) { 515 return url.charAt(0) === '/' ? pub.getBaseCurrentUrl() + url : url; 516 } 517 518 return pub; 519})(window.jQuery); 520 521window.jQuery(function () { 522 window.yii.initModule(window.yii); 523}); 524 525}
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.