vendor: 3,981 bytes, lines 1-118
1 /*! 2 * HeadJS The only script in your <HEAD> 3 * Author Tero Piirainen (tipiirai) 4 * Maintainer Robert Hoffmann (itechnology) 5 * License MIT / http://bit.ly/mit-license 6 * 7 * Version 0.99 8 * http://headjs.com 9 */ 10 /* modify : head ==> Wind */ 11; (function (win, undefined) { 12 "use strict"; 13 14 var doc = win.document, 15 domWaiters = [], 16 queue = [], // waiters for the "head ready" event 17 handlers = {}, // user functions waiting for events 18 assets = {}, // loadable items in various states 19 isAsync = "async" in doc.createElement("script") || "MozAppearance" in doc.documentElement.style || win.opera, 20 isHeadReady, 21 isDomReady, 22 23 /*** public API ***/ 24 headVar = win.head_conf && win.head_conf.head || "Wind", 25 api = win[headVar] = (win[headVar] || function () { api.ready.apply(null, arguments); }), 26 27 // states 28 PRELOADING = 1, 29 PRELOADED = 2, 30 LOADING = 3, 31 LOADED = 4; 32 33 // Method 1: simply load and let browser take care of ordering 34 if (isAsync) { 35 api.load = function () { 36 ///<summary> 37 /// INFO: use cases 38 /// head.load("http://domain.com/file.js","http://domain.com/file.js", callBack) 39 /// head.load({ label1: "http://domain.com/file.js" }, { label2: "http://domain.com/file.js" }, callBack) 40 ///</summary> 41 var args = arguments, 42 callback = args[args.length - 1], 43 items = {}; 44 45 if (!isFunction(callback)) { 46 callback = null; 47 } 48 49 each(args, function (item, i) { 50 if (item !== callback) { 51 item = getAsset(item); 52 items[item.name] = item; 53 54 load(item, callback && i === args.length - 2 ? function () { 55 if (allLoaded(items)) { 56 one(callback); 57 } 58 59 } : null); 60 } 61 }); 62 63 return api; 64 }; 65 66 67 // Method 2: preload with text/cache hack 68 } else { 69 api.load = function () { 70 var args = arguments, 71 rest = [].slice.call(args, 1), 72 next = rest[0]; 73 74 // wait for a while. immediate execution causes some browsers to ignore caching 75 if (!isHeadReady) { 76 queue.push(function () { 77 api.load.apply(null, args); 78 }); 79 80 return api; 81 } 82 83 // multiple arguments 84 if (!!next) { 85 /* Preload with text/cache hack (not good!) 86 * http://blog.getify.com/on-script-loaders/ 87 * http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/ 88 * If caching is not configured correctly on the server, then items could load twice ! 89 *************************************************************************************/ 90 each(rest, function (item) { 91 if (!isFunction(item)) { 92 preLoad(getAsset(item)); 93 } 94 }); 95 96 // execute 97 load(getAsset(args[0]), isFunction(next) ? next : function () { 98 api.load.apply(null, rest); 99 }); 100 } 101 else { 102 // single item 103 load(getAsset(args[0])); 104 } 105 106 return api; 107 }; 108 } 109 110 // INFO: for retro compatibility 111 api.js = api.load; 112 113 api.test = function (test, success, failure, callback) { 114 ///<summary> 115 /// INFO: use cases: 116 /// head.test(condition, null , "file.NOk" , callback); 117 /// head.test(condition, "fileOk.js", null , callback); 118
vendor: 6,100 bytes, lines 119-339
119 120 /// head.test(condition, "fileOk.js", "file.NOk" , callback); 121 /// head.test(condition, "fileOk.js", ["file.NOk", "file.NOk"], callback); 122 /// head.test({ 123 /// test : condition, 124 /// success : [{ label1: "file1Ok.js" }, { label2: "file2Ok.js" }], 125 /// failure : [{ label1: "file1NOk.js" }, { label2: "file2NOk.js" }], 126 /// callback: callback 127 /// ); 128 /// head.test({ 129 /// test : condition, 130 /// success : ["file1Ok.js" , "file2Ok.js"], 131 /// failure : ["file1NOk.js", "file2NOk.js"], 132 /// callback: callback 133 /// ); 134 ///</summary> 135 var obj = (typeof test === 'object') ? test : { 136 test: test, 137 success: !!success ? isArray(success) ? success : [success] : false, 138 failure: !!failure ? isArray(failure) ? failure : [failure] : false, 139 callback: callback || noop 140 }; 141 142 // Test Passed ? 143 var passed = !!obj.test; 144 145 // Do we have a success case 146 if (passed && !!obj.success) { 147 obj.success.push(obj.callback); 148 api.load.apply(null, obj.success); 149 } 150 // Do we have a fail case 151 else if (!passed && !!obj.failure) { 152 obj.failure.push(obj.callback); 153 api.load.apply(null, obj.failure); 154 } 155 else { 156 callback(); 157 } 158 159 return api; 160 }; 161 162 api.ready = function (key, callback) { 163 ///<summary> 164 /// INFO: use cases: 165 /// head.ready(callBack) 166 /// head.ready(document , callBack) 167 /// head.ready("file.js", callBack); 168 /// head.ready("label" , callBack); 169 ///</summary> 170 171 // DOM ready check: head.ready(document, function() { }); 172 if (key === doc) { 173 if (isDomReady) { 174 one(callback); 175 } 176 else { 177 domWaiters.push(callback); 178 } 179 180 return api; 181 } 182 183 // shift arguments 184 if (isFunction(key)) { 185 callback = key; 186 key = "ALL"; 187 } 188 189 // make sure arguments are sane 190 if (typeof key !== 'string' || !isFunction(callback)) { 191 return api; 192 } 193 194 // This can also be called when we trigger events based on filenames & labels 195 var asset = assets[key]; 196 197 // item already loaded --> execute and return 198 if (asset && asset.state === LOADED || key === 'ALL' && allLoaded() && isDomReady) { 199 one(callback); 200 return api; 201 } 202 203 var arr = handlers[key]; 204 if (!arr) { 205 arr = handlers[key] = [callback]; 206 } 207 else { 208 arr.push(callback); 209 } 210 211 return api; 212 }; 213 214 215 // perform this when DOM is ready 216 api.ready(doc, function () { 217 218 if (allLoaded()) { 219 each(handlers.ALL, function (callback) { 220 one(callback); 221 }); 222 } 223 224 if (api.feature) { 225 api.feature("domloaded", true); 226 } 227 }); 228 229 230 /* private functions 231 *********************/ 232 function noop() { 233 // does nothing 234 } 235 236 function each(arr, callback) { 237 if (!arr) { 238 return; 239 } 240 241 // arguments special type 242 if (typeof arr === 'object') { 243 arr = [].slice.call(arr); 244 } 245 246 // do the job 247 for (var i = 0, l = arr.length; i < l; i++) { 248 callback.call(arr, arr[i], i); 249 } 250 } 251 252 /* A must read: http://bonsaiden.github.com/JavaScript-Garden 253 ************************************************************/ 254 function is(type, obj) { 255 var clas = Object.prototype.toString.call(obj).slice(8, -1); 256 return obj !== undefined && obj !== null && clas === type; 257 } 258 259 function isFunction(item) { 260 return is("Function", item); 261 } 262 263 function isArray(item) { 264 return is("Array", item); 265 } 266 267 function toLabel(url) { 268 ///<summary>Converts a url to a file label</summary> 269 var items = url.split("/"), 270 name = items[items.length - 1], 271 i = name.indexOf("?"); 272 273 return i !== -1 ? name.substring(0, i) : name; 274 } 275 276 // INFO: this look like a "im triggering callbacks all over the place, but only wanna run it one time function" ..should try to make everything work without it if possible 277 // INFO: Even better. Look into promises/defered's like jQuery is doing 278 function one(callback) { 279 ///<summary>Execute a callback only once</summary> 280 callback = callback || noop; 281 282 if (callback._done) { 283 return; 284 } 285 286 callback(); 287 callback._done = 1; 288 } 289 290 function getAsset(item) { 291 ///<summary> 292 /// Assets are in the form of 293 /// { 294 /// name : label, 295 /// url : url, 296 /// state: state 297 /// } 298 ///</summary> 299 var asset = {}; 300 301 if (typeof item === 'object') { 302 for (var label in item) { 303 if (!!item[label]) { 304 asset = { 305 name: label, 306 url : item[label] 307 }; 308 } 309 } 310 } 311 else { 312 asset = { 313 name: toLabel(item), 314 url : item 315 }; 316 } 317 318 // is the item already existant 319 var existing = assets[asset.name]; 320 if (existing && existing.url === asset.url) { 321 return existing; 322 } 323 324 assets[asset.name] = asset; 325 return asset; 326 } 327 328 function allLoaded(items) { 329 items = items || assets; 330 331 for (var name in items) { 332 if (items.hasOwnProperty(name) && items[name].state !== LOADED) { 333 return false; 334 } 335 } 336 337 return true; 338 } 339
vendor: 8,471 bytes, lines 340-577
340 341 function onPreload(asset) { 342 asset.state = PRELOADED; 343 344 each(asset.onpreload, function (afterPreload) { 345 afterPreload.call(); 346 }); 347 } 348 349 function preLoad(asset, callback) { 350 if (asset.state === undefined) { 351 352 asset.state = PRELOADING; 353 asset.onpreload = []; 354 355 loadAsset({ url: asset.url, type: 'cache' }, function () { 356 onPreload(asset); 357 }); 358 } 359 } 360 361 function load(asset, callback) { 362 ///<summary>Used with normal loading logic</summary> 363 callback = callback || noop; 364 365 if (asset.state === LOADED) { 366 callback(); 367 return; 368 } 369 370 // INFO: why would we trigger a ready event when its not really loaded yet ? 371 if (asset.state === LOADING) { 372 api.ready(asset.name, callback); 373 return; 374 } 375 376 if (asset.state === PRELOADING) { 377 asset.onpreload.push(function () { 378 load(asset, callback); 379 }); 380 return; 381 } 382 383 asset.state = LOADING; 384 385 loadAsset(asset, function () { 386 asset.state = LOADED; 387 callback(); 388 389 // handlers for this asset 390 each(handlers[asset.name], function (fn) { 391 one(fn); 392 }); 393 394 // dom is ready & no assets are queued for loading 395 // INFO: shouldn't we be doing the same test above ? 396 if (isDomReady && allLoaded()) { 397 each(handlers.ALL, function (fn) { 398 one(fn); 399 }); 400 } 401 }); 402 } 403 404 /* Parts inspired from: https://github.com/cujojs/curl 405 ******************************************************/ 406 function loadAsset(asset, callback) { 407 callback = callback || noop; 408 409 var ele; 410 if (/\.css[^\.]*$/.test(asset.url)) { 411 ele = doc.createElement('link'); 412 ele.type = 'text/' + (asset.type || 'css'); 413 ele.rel = 'stylesheet'; 414 ele.href = asset.url; 415 } 416 else { 417 ele = doc.createElement('script'); 418 ele.type = 'text/' + (asset.type || 'javascript'); 419 ele.src = asset.url; 420 } 421 422 ele.onload = ele.onreadystatechange = process; 423 ele.onerror = error; 424 425 /* Good read, but doesn't give much hope ! 426 * http://blog.getify.com/on-script-loaders/ 427 * http://www.nczonline.net/blog/2010/12/21/thoughts-on-script-loaders/ 428 * https://hacks.mozilla.org/2009/06/defer/ 429 */ 430 431 // ASYNC: load in parellel and execute as soon as possible 432 ele.async = false; 433 // DEFER: load in parallel but maintain execution order 434 ele.defer = false; 435 436 function error(event) { 437 event = event || win.event; 438 439 // need some more detailed error handling here 440 441 // release event listeners 442 ele.onload = ele.onreadystatechange = ele.onerror = null; 443 444 // do callback 445 callback(); 446 } 447 448 function process(event) { 449 event = event || win.event; 450 451 // IE 7/8 (2 events on 1st load) 452 // 1) event.type = readystatechange, s.readyState = loading 453 // 2) event.type = readystatechange, s.readyState = loaded 454 455 // IE 7/8 (1 event on reload) 456 // 1) event.type = readystatechange, s.readyState = complete 457 458 // event.type === 'readystatechange' && /loaded|complete/.test(s.readyState) 459 460 // IE 9 (3 events on 1st load) 461 // 1) event.type = readystatechange, s.readyState = loading 462 // 2) event.type = readystatechange, s.readyState = loaded 463 // 3) event.type = load , s.readyState = loaded 464 465 // IE 9 (2 events on reload) 466 // 1) event.type = readystatechange, s.readyState = complete 467 // 2) event.type = load , s.readyState = complete 468 469 // event.type === 'load' && /loaded|complete/.test(s.readyState) 470 // event.type === 'readystatechange' && /loaded|complete/.test(s.readyState) 471 472 // IE 10 (3 events on 1st load) 473 // 1) event.type = readystatechange, s.readyState = loading 474 // 2) event.type = load , s.readyState = complete 475 // 3) event.type = readystatechange, s.readyState = loaded 476 477 // IE 10 (3 events on reload) 478 // 1) event.type = readystatechange, s.readyState = loaded 479 // 2) event.type = load , s.readyState = complete 480 // 3) event.type = readystatechange, s.readyState = complete 481 482 // event.type === 'load' && /loaded|complete/.test(s.readyState) 483 // event.type === 'readystatechange' && /complete/.test(s.readyState) 484 485 // Other Browsers (1 event on 1st load) 486 // 1) event.type = load, s.readyState = undefined 487 488 // Other Browsers (1 event on reload) 489 // 1) event.type = load, s.readyState = undefined 490 491 // event.type == 'load' && s.readyState = undefined 492 493 494 // !doc.documentMode is for IE6/7, IE8+ have documentMode 495 if (event.type === 'load' || (/loaded|complete/.test(ele.readyState) && (!doc.documentMode || doc.documentMode < 9))) { 496 // release event listeners 497 ele.onload = ele.onreadystatechange = ele.onerror = null; 498 499 // do callback 500 callback(); 501 } 502 503 // emulates error on browsers that don't create an exception 504 // INFO: timeout not clearing ..why ? 505 //asset.timeout = win.setTimeout(function () { 506 // error({ type: "timeout" }); 507 //}, 3000); 508 } 509 510 // use insertBefore to keep IE from throwing Operation Aborted (thx Bryan Forbes!) 511 var head = doc['head'] || doc.getElementsByTagName('head')[0]; 512 // but insert at end of head, because otherwise if it is a stylesheet, it will not ovverride values 513 head.insertBefore(ele, head.lastChild); 514 } 515 516 /* Mix of stuff from jQuery & IEContentLoaded 517 * http://dev.w3.org/html5/spec/the-end.html#the-end 518 ***************************************************/ 519 function domReady() { 520 // Make sure body exists, at least, in case IE gets a little overzealous (jQuery ticket #5443). 521 if (!doc.body) { 522 // let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued) 523 win.clearTimeout(api.readyTimeout); 524 api.readyTimeout = win.setTimeout(domReady, 3000); 525 return; 526 } 527 528 if (!isDomReady) { 529 isDomReady = true; 530 each(domWaiters, function (fn) { 531 one(fn); 532 }); 533 } 534 } 535 536 function domContentLoaded() { 537 // W3C 538 if (doc.addEventListener) { 539 doc.removeEventListener("DOMContentLoaded", domContentLoaded, false); 540 domReady(); 541 } 542 543 // IE 544 else if (doc.readyState === "complete") { 545 // we're here because readyState === "complete" in oldIE 546 // which is good enough for us to call the dom ready! 547 doc.detachEvent("onreadystatechange", domContentLoaded); 548 domReady(); 549 } 550 }; 551 552 // Catch cases where ready() is called after the browser event has already occurred. 553 // we once tried to use readyState "interactive" here, but it caused issues like the one 554 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 555 if (doc.readyState === "complete") { 556 domReady(); 557 } 558 559 // W3C 560 else if (doc.addEventListener) { 561 doc.addEventListener("DOMContentLoaded", domContentLoaded, false); 562 563 // A fallback to window.onload, that will always work 564 win.addEventListener("load", domReady, false); 565 } 566 567 // IE 568 else { 569 // Ensure firing before onload, maybe late but safe also for iframes 570 doc.attachEvent("onreadystatechange", domContentLoaded); 571 572 // A fallback to window.onload, that will always work 573 win.attachEvent("onload", domReady); 574 575 // If IE and not a frame 576 // continually check to see if the document is ready 577 var top = false;
578 579 try { 580 top = win.frameElement == null && doc.documentElement; 581 } catch (e) { } 582 583 if (top && top.doScroll) { 584 (function doScrollCheck() { 585 if (!isDomReady) { 586 try { 587 // Use the trick by Diego Perini 588 // http://javascript.nwbox.com/IEContentLoaded/ 589 top.doScroll("left"); 590 } catch (error) { 591 // let's not get nasty by setting a timeout too small.. (loop mania guaranteed if assets are queued) 592 win.clearTimeout(api.readyTimeout); 593 api.readyTimeout = win.setTimeout(doScrollCheck, 3000); 594 return; 595 } 596 597 // and execute any waiting functions 598 domReady(); 599 } 600 })(); 601 } 602 } 603 604 /* 605 We wait for 300 ms before asset loading starts. for some reason this is needed 606 to make sure assets are cached. Not sure why this happens yet. A case study: 607 608 https://github.com/headjs/headjs/issues/closed#issue/83 609 */ 610 setTimeout(function () { 611 isHeadReady = true; 612 each(queue, function (fn) { 613 fn(); 614 }); 615 616 }, 3000); 617 618 // browser type & version 619 var ua = navigator.userAgent.toLowerCase(); 620 621 ua = /(webkit)[ \/]([\w.]+)/.exec( ua ) || 622 /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || 623 /(msie) ([\w.]+)/.exec( ua ) || 624 !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || []; 625 626 627 if (ua[1] == 'msie') { 628 ua[1] = 'ie'; 629 ua[2] = document.documentMode || ua[2]; 630 } 631 632 api.browser = { version: ua[2] }; 633 api.browser[ua[1]] = true; 634 635 // IE specific 636 if (api.browser.ie) { 637 // HTML5 support 638 each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function(el) { 639 doc.createElement(el); 640 }); 641 } 642 643})(window); 644 645/*********Wind JS*********/ 646/* 647 * YaoZH JS core 648 * @Copyright : Copyright 2013, yaozh.com 649 * @Descript : YaoZHæ ¸å¿JS 650 * @Author : [email protected] 651 * @Thanks : head.js (http://headjs.com) 652 * $Id: yaozh.js 23158 2013-10-15 11:47:46Z kai.wu $ : 653 */ 654 655 656/* 657 * 鲿¢æµè§å¨ä¸æ¯æconsoleæ¥é 658 */ 659if(!window.console) { 660 window.console = {}; 661 var funs = ["profiles", "memory", "_commandLineAPI", "debug", "error", "info", "log", "warn", "dir", "dirxml", "trace", "assert", "count", "markTimeline", "profile", "profileEnd", "time", "timeEnd", "timeStamp", "group", "groupCollapsed", "groupEnd"]; 662 for(var i = 0;i < funs.length; i++) { 663 console[funs[i]] = function() {}; 664 } 665} 666 667/* 668*è§£å³ie6ä¸ä¸æ¯æèæ¯ç¼å 669*/ 670Wind.ready(function() { 671 if (!+'\v1' && !('maxHeight' in document.body.style)) { 672 try{ 673 document.execCommand("BackgroundImageCache", false, true); 674 }catch(e){} 675 } 676}); 677 678/* 679*wind core 680*/ 681(function(win) { 682 var root = win.GV.JS_ROOT || location.origin + '/js/dev/', //å¨yaozh.jså è½½ä¹åå®ä¹GV.JS_ROOT 683 ver = win.GV.JS_VERSION.replace(/(\s)/g, '_') || '3.0', 684 //å®ä¹å¸¸ç¨JSç»ä»¶å«åï¼ä½¿ç¨å«åå è½½ 685 alias = { 686 global : 'common/global', 687 jquery : 'jquery', 688 dialog : 'libs/dialog/dialog', 689 tabs : 'libs/tabs/tabs', 690 input : 'libs/input', 691 underscore : 'libs/underscore', 692 ueditor : 'libs/ueditor/1.4.3/ueditor.all.min', 693 ueditorconf : 'libs/ueditor/1.4.3/ueditor.config', 694 ueditorlang : 'libs/ueditor/1.4.3/lang/zh-cn/zh-cn', 695 //jquery util plugs 696 ajaxForm : 'libs/ajaxForm', 697 slides : 'libs/slides', 698 dateSelect : 'libs/dateSelect', 699 pwd : 'libs/pwd', 700 jQselect : 'libs/jQselect', 701 jQscroll : 'libs/jQscroll', 702 switchable : 'libs/switchable', 703 draggable : 'libs/draggable', 704 dragsort : 'libs/dragsort', 705 dragUpload : 'libs/dragUpload', 706 emailAutoMatch : 'libs/emailAutoMatch', 707 validate : 'libs/validate', 708 wkendtime : 'libs/wkendtime', 709 kindeditor : 'kindeditor/kindeditor', 710 xheditor : 'xheditor/xheditor', 711 datepicker : 'libs/datepicker', 712 timeTo : 'libs/timeTo', 713 jqueryjson : 'libs/jquery.json.min', 714
715 initcount : 'libs/initcount', 716 717 //native js util plugs 718 swfupload : 'libs/swfupload/swfupload' 719 }, 720 alias_css = { 721 colorPicker : 'ui_libs/colorPicker/style', 722 datePicker : 'ui_libs/datePicker/style', 723 chosen : 'ui_libs/chosen/chosen' 724 }; 725 726 //add suffix and version 727 for(var i in alias) { 728 if (alias.hasOwnProperty(i)) { 729 alias[i] = root + alias[i] +'.js?v=' + ver; 730 } 731 } 732 733 for(var i in alias_css) { 734 if (alias_css.hasOwnProperty(i)) { 735 alias_css[i] = root + alias_css[i] +'.css?v=' + ver; 736 } 737 } 738 739 //css loader 740 win.Wind = win.Wind || {}; 741 //!TODO old webkit and old firefox does not support 742 Wind.css = function(alias/*alias or path*/,callback) { 743 var url = alias_css[alias] ? alias_css[alias] : alias 744 var link = document.createElement('link'); 745 link.rel = 'stylesheet'; 746 link.href = url; 747 link.onload = link.onreadystatechange = function() {//chrome linkæ onloadäºä»¶ 748 var state = link.readyState; 749 if (callback && !callback.done && (!state || /loaded|complete/.test(state))) { 750 callback.done = true; 751 callback(); 752 } 753 } 754 document.getElementsByTagName('head')[0].appendChild(link); 755 }; 756 757 //Using the alias to load the script file 758 Wind.use = function() { 759 var args = arguments,len = args.length; 760 for( var i = 0;i < len;i++ ) { 761 if(typeof args[i] === 'string' && alias[args[i]]) { 762 args[i] = alias[args[i]]; 763 } 764 } 765 Wind.js.apply(null,args); 766 }; 767 768 //Wind javascript template (author: John Resig http://ejohn.org/blog/javascript-micro-templating/) 769 var cache = {}; 770 Wind.tmpl = function (str, data) { 771 var fn = !/\W/.test(str) ? cache[str] = cache[str] || tmpl(str) : 772 new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + 773 "with(obj){p.push('" + 774 str.replace(/[\r\t\n]/g, " ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g, "$1\r").replace(/\t=(.*?)%>/g, "',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'") + "');}return p.join('');"); 775 return data ? fn(data) : fn; 776 }; 777 //Windå ¨å±åè½å½æ°å½åç©ºé´ 778 Wind.Util = {} 779})(window);
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.