Skip to content
Browse files

Use non-debug version of LABjs as source.

  • Loading branch information...
1 parent ee20619 commit c507109646b86854cbdf7864e7bfd4b8e9c83d79 @dimkalinux dimkalinux committed
Showing with 499 additions and 3 deletions.
  1. +497 −1 include/js/LAB.src.js
  2. +2 −2 include/js/min/punbb.common.min.js
View
498 include/js/LAB.src.js
@@ -2,4 +2,500 @@
v2.0.3 (c) Kyle Simpson
MIT License
*/
-(function(o){var K=o.$LAB,y="UseLocalXHR",z="AlwaysPreserveOrder",u="AllowDuplicates",A="CacheBust",B="BasePath",C=/^[^?#]*\//.exec(location.href)[0],D=/^\w+\:\/\/\/?[^\/]+/.exec(C)[0],i=document.head||document.getElementsByTagName("head"),L=(o.opera&&Object.prototype.toString.call(o.opera)=="[object Opera]")||("MozAppearance"in document.documentElement.style),q=document.createElement("script"),E=typeof q.preload=="boolean",r=E||(q.readyState&&q.readyState=="uninitialized"),F=!r&&q.async===true,M=!r&&!F&&!L;function G(a){return Object.prototype.toString.call(a)=="[object Function]"}function H(a){return Object.prototype.toString.call(a)=="[object Array]"}function N(a,c){var b=/^\w+\:\/\//;if(/^\/\/\/?/.test(a)){a=location.protocol+a}else if(!b.test(a)&&a.charAt(0)!="/"){a=(c||"")+a}return b.test(a)?a:((a.charAt(0)=="/"?D:C)+a)}function s(a,c){for(var b in a){if(a.hasOwnProperty(b)){c[b]=a[b]}}return c}function O(a){var c=false;for(var b=0;b<a.scripts.length;b++){if(a.scripts[b].ready&&a.scripts[b].exec_trigger){c=true;a.scripts[b].exec_trigger();a.scripts[b].exec_trigger=null}}return c}function t(a,c,b,d){a.onload=a.onreadystatechange=function(){if((a.readyState&&a.readyState!="complete"&&a.readyState!="loaded")||c[b])return;a.onload=a.onreadystatechange=null;d()}}function I(a){a.ready=a.finished=true;for(var c=0;c<a.finished_listeners.length;c++){a.finished_listeners[c]()}a.ready_listeners=[];a.finished_listeners=[]}function P(d,f,e,g,h){setTimeout(function(){var a,c=f.real_src,b;if("item"in i){if(!i[0]){setTimeout(arguments.callee,25);return}i=i[0]}a=document.createElement("script");if(f.type)a.type=f.type;if(f.charset)a.charset=f.charset;if(h){if(r){e.elem=a;if(E){a.preload=true;a.onpreload=g}else{a.onreadystatechange=function(){if(a.readyState=="loaded")g()}}a.src=c}else if(h&&c.indexOf(D)==0&&d[y]){b=new XMLHttpRequest();b.onreadystatechange=function(){if(b.readyState==4){b.onreadystatechange=function(){};e.text=b.responseText+"\n//@ sourceURL="+c;g()}};b.open("GET",c);b.send()}else{a.type="text/cache-script";t(a,e,"ready",function(){i.removeChild(a);g()});a.src=c;i.insertBefore(a,i.firstChild)}}else if(F){a.async=false;t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}else{t(a,e,"finished",g);a.src=c;i.insertBefore(a,i.firstChild)}},0)}function J(){var l={},Q=r||M,n=[],p={},m;l[y]=true;l[z]=false;l[u]=false;l[A]=false;l[B]="";function R(a,c,b){var d;function f(){if(d!=null){d=null;I(b)}}if(p[c.src].finished)return;if(!a[u])p[c.src].finished=true;d=b.elem||document.createElement("script");if(c.type)d.type=c.type;if(c.charset)d.charset=c.charset;t(d,b,"finished",f);if(b.elem){b.elem=null}else if(b.text){d.onload=d.onreadystatechange=null;d.text=b.text}else{d.src=c.real_src}i.insertBefore(d,i.firstChild);if(b.text){f()}}function S(c,b,d,f){var e,g,h=function(){b.ready_cb(b,function(){R(c,b,e)})},j=function(){b.finished_cb(b,d)};b.src=N(b.src,c[B]);b.real_src=b.src+(c[A]?((/\?.*$/.test(b.src)?"&_":"?_")+~~(Math.random()*1E9)+"="):"");if(!p[b.src])p[b.src]={items:[],finished:false};g=p[b.src].items;if(c[u]||g.length==0){e=g[g.length]={ready:false,finished:false,ready_listeners:[h],finished_listeners:[j]};P(c,b,e,((f)?function(){e.ready=true;for(var a=0;a<e.ready_listeners.length;a++){e.ready_listeners[a]()}e.ready_listeners=[]}:function(){I(e)}),f)}else{e=g[0];if(e.finished){j()}else{e.finished_listeners.push(j)}}}function v(){var e,g=s(l,{}),h=[],j=0,w=false,k;function T(a,c){a.ready=true;a.exec_trigger=c;x()}function U(a,c){a.ready=a.finished=true;a.exec_trigger=null;for(var b=0;b<c.scripts.length;b++){if(!c.scripts[b].finished)return}c.finished=true;x()}function x(){while(j<h.length){if(G(h[j])){try{h[j++]()}catch(err){}continue}else if(!h[j].finished){if(O(h[j]))continue;break}j++}if(j==h.length){w=false;k=false}}function V(){if(!k||!k.scripts){h.push(k={scripts:[],finished:true})}}e={script:function(){for(var f=0;f<arguments.length;f++){(function(a,c){var b;if(!H(a)){c=[a]}for(var d=0;d<c.length;d++){V();a=c[d];if(G(a))a=a();if(!a)continue;if(H(a)){b=[].slice.call(a);b.unshift(d,1);[].splice.apply(c,b);d--;continue}if(typeof a=="string")a={src:a};a=s(a,{ready:false,ready_cb:T,finished:false,finished_cb:U});k.finished=false;k.scripts.push(a);S(g,a,k,(Q&&w));w=true;if(g[z])e.wait()}})(arguments[f],arguments[f])}return e},wait:function(){if(arguments.length>0){for(var a=0;a<arguments.length;a++){h.push(arguments[a])}k=h[h.length-1]}else k=false;x();return e}};return{script:e.script,wait:e.wait,setOptions:function(a){s(a,g);return e}}}m={setGlobalDefaults:function(a){s(a,l);return m},setOptions:function(){return v().setOptions.apply(null,arguments)},script:function(){return v().script.apply(null,arguments)},wait:function(){return v().wait.apply(null,arguments)},queueScript:function(){n[n.length]={type:"script",args:[].slice.call(arguments)};return m},queueWait:function(){n[n.length]={type:"wait",args:[].slice.call(arguments)};return m},runQueue:function(){var a=m,c=n.length,b=c,d;for(;--b>=0;){d=n.shift();a=a[d.type].apply(null,d.args)}return a},noConflict:function(){o.$LAB=K;return m},sandbox:function(){return J()}};return m}o.$LAB=J();(function(a,c,b){if(document.readyState==null&&document[a]){document.readyState="loading";document[a](c,b=function(){document.removeEventListener(c,b,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this);
+
+(function(global){
+ var _$LAB = global.$LAB,
+
+ // constants for the valid keys of the options object
+ _UseLocalXHR = "UseLocalXHR",
+ _AlwaysPreserveOrder = "AlwaysPreserveOrder",
+ _AllowDuplicates = "AllowDuplicates",
+ _CacheBust = "CacheBust",
+ _BasePath = "BasePath",
+
+ // stateless variables used across all $LAB instances
+ root_page = /^[^?#]*\//.exec(location.href)[0],
+ root_domain = /^\w+\:\/\/\/?[^\/]+/.exec(root_page)[0],
+ append_to = document.head || document.getElementsByTagName("head"),
+
+ // inferences... ick, but still necessary
+ opera_or_gecko = (global.opera && Object.prototype.toString.call(global.opera) == "[object Opera]") || ("MozAppearance" in document.documentElement.style),
+
+
+ // feature sniffs (yay!)
+ test_script_elem = document.createElement("script"),
+ explicit_preloading = typeof test_script_elem.preload == "boolean", // http://wiki.whatwg.org/wiki/Script_Execution_Control#Proposal_1_.28Nicholas_Zakas.29
+ real_preloading = explicit_preloading || (test_script_elem.readyState && test_script_elem.readyState == "uninitialized"), // will a script preload with `src` set before DOM append?
+ script_ordered_async = !real_preloading && test_script_elem.async === true, // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
+
+ // XHR preloading (same-domain) and cache-preloading (remote-domain) are the fallbacks (for some browsers)
+ xhr_or_cache_preloading = !real_preloading && !script_ordered_async && !opera_or_gecko
+ ;
+
+
+
+ // test for function
+ function is_func(func) { return Object.prototype.toString.call(func) == "[object Function]"; }
+
+ // test for array
+ function is_array(arr) { return Object.prototype.toString.call(arr) == "[object Array]"; }
+
+ // make script URL absolute/canonical
+ function canonical_uri(src,base_path) {
+ var absolute_regex = /^\w+\:\/\//;
+
+ // is `src` is protocol-relative (begins with // or ///), prepend protocol
+ if (/^\/\/\/?/.test(src)) {
+ src = location.protocol + src;
+ }
+ // is `src` page-relative? (not an absolute URL, and not a domain-relative path, beginning with /)
+ else if (!absolute_regex.test(src) && src.charAt(0) != "/") {
+ // prepend `base_path`, if any
+ src = (base_path || "") + src;
+ }
+ // make sure to return `src` as absolute
+ return absolute_regex.test(src) ? src : ((src.charAt(0) == "/" ? root_domain : root_page) + src);
+ }
+
+ // merge `source` into `target`
+ function merge_objs(source,target) {
+ for (var k in source) { if (source.hasOwnProperty(k)) {
+ target[k] = source[k]; // TODO: does this need to be recursive for our purposes?
+ }}
+ return target;
+ }
+
+ // does the chain group have any ready-to-execute scripts?
+ function check_chain_group_scripts_ready(chain_group) {
+ var any_scripts_ready = false;
+ for (var i=0; i<chain_group.scripts.length; i++) {
+ if (chain_group.scripts[i].ready && chain_group.scripts[i].exec_trigger) {
+ any_scripts_ready = true;
+ chain_group.scripts[i].exec_trigger();
+ chain_group.scripts[i].exec_trigger = null;
+ }
+ }
+ return any_scripts_ready;
+ }
+
+ // creates a script load listener
+ function create_script_load_listener(elem,registry_item,flag,onload) {
+ elem.onload = elem.onreadystatechange = function() {
+ if ((elem.readyState && elem.readyState != "complete" && elem.readyState != "loaded") || registry_item[flag]) return;
+ elem.onload = elem.onreadystatechange = null;
+ onload();
+ };
+ }
+
+ // script executed handler
+ function script_executed(registry_item) {
+ registry_item.ready = registry_item.finished = true;
+ for (var i=0; i<registry_item.finished_listeners.length; i++) {
+ registry_item.finished_listeners[i]();
+ }
+ registry_item.ready_listeners = [];
+ registry_item.finished_listeners = [];
+ }
+
+ // make the request for a scriptha
+ function request_script(chain_opts,script_obj,registry_item,onload,preload_this_script) {
+ // setTimeout() "yielding" prevents some weird race/crash conditions in older browsers
+ setTimeout(function(){
+ var script, src = script_obj.real_src, xhr;
+
+ // don't proceed until `append_to` is ready to append to
+ if ("item" in append_to) { // check if `append_to` ref is still a live node list
+ if (!append_to[0]) { // `append_to` node not yet ready
+ // try again in a little bit -- note: will re-call the anonymous function in the outer setTimeout, not the parent `request_script()`
+ setTimeout(arguments.callee,25);
+ return;
+ }
+ // reassign from live node list ref to pure node ref -- avoids nasty IE bug where changes to DOM invalidate live node lists
+ append_to = append_to[0];
+ }
+ script = document.createElement("script");
+ if (script_obj.type) script.type = script_obj.type;
+ if (script_obj.charset) script.charset = script_obj.charset;
+
+ // should preloading be used for this script?
+ if (preload_this_script) {
+ // real script preloading?
+ if (real_preloading) {
+
+ registry_item.elem = script;
+ if (explicit_preloading) { // explicit preloading (aka, Zakas' proposal)
+ script.preload = true;
+ script.onpreload = onload;
+ }
+ else {
+ script.onreadystatechange = function(){
+ if (script.readyState == "loaded") onload();
+ };
+ }
+ script.src = src;
+ // NOTE: no append to DOM yet, appending will happen when ready to execute
+ }
+ // same-domain and XHR allowed? use XHR preloading
+ else if (preload_this_script && src.indexOf(root_domain) == 0 && chain_opts[_UseLocalXHR]) {
+ xhr = new XMLHttpRequest(); // note: IE never uses XHR (it supports true preloading), so no more need for ActiveXObject fallback for IE <= 7
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ xhr.onreadystatechange = function(){}; // fix a memory leak in IE
+ registry_item.text = xhr.responseText + "\n//@ sourceURL=" + src; // http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/
+ onload();
+ }
+ };
+ xhr.open("GET",src);
+ xhr.send();
+ }
+ // as a last resort, use cache-preloading
+ else {
+
+ script.type = "text/cache-script";
+ create_script_load_listener(script,registry_item,"ready",function() {
+ append_to.removeChild(script);
+ onload();
+ });
+ script.src = src;
+ append_to.insertBefore(script,append_to.firstChild);
+ }
+ }
+ // use async=false for ordered async? parallel-load-serial-execute http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
+ else if (script_ordered_async) {
+
+ script.async = false;
+ create_script_load_listener(script,registry_item,"finished",onload);
+ script.src = src;
+ append_to.insertBefore(script,append_to.firstChild);
+ }
+ // otherwise, just a normal script element
+ else {
+
+ create_script_load_listener(script,registry_item,"finished",onload);
+ script.src = src;
+ append_to.insertBefore(script,append_to.firstChild);
+ }
+ },0);
+ }
+
+ // create a clean instance of $LAB
+ function create_sandbox() {
+ var global_defaults = {},
+ can_use_preloading = real_preloading || xhr_or_cache_preloading,
+ queue = [],
+ registry = {},
+ instanceAPI
+ ;
+
+ // global defaults
+ global_defaults[_UseLocalXHR] = true;
+ global_defaults[_AlwaysPreserveOrder] = false;
+ global_defaults[_AllowDuplicates] = false;
+ global_defaults[_CacheBust] = false;
+
+ global_defaults[_BasePath] = "";
+
+ // execute a script that has been preloaded already
+ function execute_preloaded_script(chain_opts,script_obj,registry_item) {
+ var script;
+
+ function preload_execute_finished() {
+ if (script != null) { // make sure this only ever fires once
+ script = null;
+ script_executed(registry_item);
+ }
+ }
+
+ if (registry[script_obj.src].finished) return;
+ if (!chain_opts[_AllowDuplicates]) registry[script_obj.src].finished = true;
+
+ script = registry_item.elem || document.createElement("script");
+ if (script_obj.type) script.type = script_obj.type;
+ if (script_obj.charset) script.charset = script_obj.charset;
+ create_script_load_listener(script,registry_item,"finished",preload_execute_finished);
+
+ // script elem was real-preloaded
+ if (registry_item.elem) {
+ registry_item.elem = null;
+ }
+ // script was XHR preloaded
+ else if (registry_item.text) {
+ script.onload = script.onreadystatechange = null; // script injection doesn't fire these events
+ script.text = registry_item.text;
+ }
+ // script was cache-preloaded
+ else {
+ script.src = script_obj.real_src;
+ }
+ append_to.insertBefore(script,append_to.firstChild);
+
+ // manually fire execution callback for injected scripts, since events don't fire
+ if (registry_item.text) {
+ preload_execute_finished();
+ }
+ }
+
+ // process the script request setup
+ function do_script(chain_opts,script_obj,chain_group,preload_this_script) {
+ var registry_item,
+ registry_items,
+ ready_cb = function(){ script_obj.ready_cb(script_obj,function(){ execute_preloaded_script(chain_opts,script_obj,registry_item); }); },
+ finished_cb = function(){ script_obj.finished_cb(script_obj,chain_group); }
+ ;
+
+ script_obj.src = canonical_uri(script_obj.src,chain_opts[_BasePath]);
+ script_obj.real_src = script_obj.src +
+ // append cache-bust param to URL?
+ (chain_opts[_CacheBust] ? ((/\?.*$/.test(script_obj.src) ? "&_" : "?_") + ~~(Math.random()*1E9) + "=") : "")
+ ;
+
+ if (!registry[script_obj.src]) registry[script_obj.src] = {items:[],finished:false};
+ registry_items = registry[script_obj.src].items;
+
+ // allowing duplicates, or is this the first recorded load of this script?
+ if (chain_opts[_AllowDuplicates] || registry_items.length == 0) {
+ registry_item = registry_items[registry_items.length] = {
+ ready:false,
+ finished:false,
+ ready_listeners:[ready_cb],
+ finished_listeners:[finished_cb]
+ };
+
+ request_script(chain_opts,script_obj,registry_item,
+ // which callback type to pass?
+ (
+ (preload_this_script) ? // depends on script-preloading
+ function(){
+ registry_item.ready = true;
+ for (var i=0; i<registry_item.ready_listeners.length; i++) {
+ registry_item.ready_listeners[i]();
+ }
+ registry_item.ready_listeners = [];
+ } :
+ function(){ script_executed(registry_item); }
+ ),
+ // signal if script-preloading should be used or not
+ preload_this_script
+ );
+ }
+ else {
+ registry_item = registry_items[0];
+ if (registry_item.finished) {
+ finished_cb();
+ }
+ else {
+ registry_item.finished_listeners.push(finished_cb);
+ }
+ }
+ }
+
+ // creates a closure for each separate chain spawned from this $LAB instance, to keep state cleanly separated between chains
+ function create_chain() {
+ var chainedAPI,
+ chain_opts = merge_objs(global_defaults,{}),
+ chain = [],
+ exec_cursor = 0,
+ scripts_currently_loading = false,
+ group
+ ;
+
+ // called when a script has finished preloading
+ function chain_script_ready(script_obj,exec_trigger) {
+
+ script_obj.ready = true;
+ script_obj.exec_trigger = exec_trigger;
+ advance_exec_cursor(); // will only check for 'ready' scripts to be executed
+ }
+
+ // called when a script has finished executing
+ function chain_script_executed(script_obj,chain_group) {
+
+ script_obj.ready = script_obj.finished = true;
+ script_obj.exec_trigger = null;
+ // check if chain group is all finished
+ for (var i=0; i<chain_group.scripts.length; i++) {
+ if (!chain_group.scripts[i].finished) return;
+ }
+ // chain_group is all finished if we get this far
+ chain_group.finished = true;
+ advance_exec_cursor();
+ }
+
+ // main driver for executing each part of the chain
+ function advance_exec_cursor() {
+ while (exec_cursor < chain.length) {
+ if (is_func(chain[exec_cursor])) {
+
+ try { chain[exec_cursor++](); } catch (err) {
+
+ }
+ continue;
+ }
+ else if (!chain[exec_cursor].finished) {
+ if (check_chain_group_scripts_ready(chain[exec_cursor])) continue;
+ break;
+ }
+ exec_cursor++;
+ }
+ // we've reached the end of the chain (so far)
+ if (exec_cursor == chain.length) {
+ scripts_currently_loading = false;
+ group = false;
+ }
+ }
+
+ // setup next chain script group
+ function init_script_chain_group() {
+ if (!group || !group.scripts) {
+ chain.push(group = {scripts:[],finished:true});
+ }
+ }
+
+ // API for $LAB chains
+ chainedAPI = {
+ // start loading one or more scripts
+ script:function(){
+ for (var i=0; i<arguments.length; i++) {
+ (function(script_obj,script_list){
+ var splice_args;
+
+ if (!is_array(script_obj)) {
+ script_list = [script_obj];
+ }
+ for (var j=0; j<script_list.length; j++) {
+ init_script_chain_group();
+ script_obj = script_list[j];
+
+ if (is_func(script_obj)) script_obj = script_obj();
+ if (!script_obj) continue;
+ if (is_array(script_obj)) {
+ // set up an array of arguments to pass to splice()
+ splice_args = [].slice.call(script_obj); // first include the actual array elements we want to splice in
+ splice_args.unshift(j,1); // next, put the `index` and `howMany` parameters onto the beginning of the splice-arguments array
+ [].splice.apply(script_list,splice_args); // use the splice-arguments array as arguments for splice()
+ j--; // adjust `j` to account for the loop's subsequent `j++`, so that the next loop iteration uses the same `j` index value
+ continue;
+ }
+ if (typeof script_obj == "string") script_obj = {src:script_obj};
+ script_obj = merge_objs(script_obj,{
+ ready:false,
+ ready_cb:chain_script_ready,
+ finished:false,
+ finished_cb:chain_script_executed
+ });
+ group.finished = false;
+ group.scripts.push(script_obj);
+
+ do_script(chain_opts,script_obj,group,(can_use_preloading && scripts_currently_loading));
+ scripts_currently_loading = true;
+
+ if (chain_opts[_AlwaysPreserveOrder]) chainedAPI.wait();
+ }
+ })(arguments[i],arguments[i]);
+ }
+ return chainedAPI;
+ },
+ // force LABjs to pause in execution at this point in the chain, until the execution thus far finishes, before proceeding
+ wait:function(){
+ if (arguments.length > 0) {
+ for (var i=0; i<arguments.length; i++) {
+ chain.push(arguments[i]);
+ }
+ group = chain[chain.length-1];
+ }
+ else group = false;
+
+ advance_exec_cursor();
+
+ return chainedAPI;
+ }
+ };
+
+ // the first chain link API (includes `setOptions` only this first time)
+ return {
+ script:chainedAPI.script,
+ wait:chainedAPI.wait,
+ setOptions:function(opts){
+ merge_objs(opts,chain_opts);
+ return chainedAPI;
+ }
+ };
+ }
+
+ // API for each initial $LAB instance (before chaining starts)
+ instanceAPI = {
+ // main API functions
+ setGlobalDefaults:function(opts){
+ merge_objs(opts,global_defaults);
+ return instanceAPI;
+ },
+ setOptions:function(){
+ return create_chain().setOptions.apply(null,arguments);
+ },
+ script:function(){
+ return create_chain().script.apply(null,arguments);
+ },
+ wait:function(){
+ return create_chain().wait.apply(null,arguments);
+ },
+
+ // built-in queuing for $LAB `script()` and `wait()` calls
+ // useful for building up a chain programmatically across various script locations, and simulating
+ // execution of the chain
+ queueScript:function(){
+ queue[queue.length] = {type:"script", args:[].slice.call(arguments)};
+ return instanceAPI;
+ },
+ queueWait:function(){
+ queue[queue.length] = {type:"wait", args:[].slice.call(arguments)};
+ return instanceAPI;
+ },
+ runQueue:function(){
+ var $L = instanceAPI, len=queue.length, i=len, val;
+ for (;--i>=0;) {
+ val = queue.shift();
+ $L = $L[val.type].apply(null,val.args);
+ }
+ return $L;
+ },
+
+ // rollback `[global].$LAB` to what it was before this file was loaded, the return this current instance of $LAB
+ noConflict:function(){
+ global.$LAB = _$LAB;
+ return instanceAPI;
+ },
+
+ // create another clean instance of $LAB
+ sandbox:function(){
+ return create_sandbox();
+ }
+ };
+
+ return instanceAPI;
+ }
+
+ // create the main instance of $LAB
+ global.$LAB = create_sandbox();
+
+
+ /* The following "hack" was suggested by Andrea Giammarchi and adapted from: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html
+ NOTE: this hack only operates in FF and then only in versions where document.readyState is not present (FF < 3.6?).
+
+ The hack essentially "patches" the **page** that LABjs is loaded onto so that it has a proper conforming document.readyState, so that if a script which does
+ proper and safe dom-ready detection is loaded onto a page, after dom-ready has passed, it will still be able to detect this state, by inspecting the now hacked
+ document.readyState property. The loaded script in question can then immediately trigger any queued code executions that were waiting for the DOM to be ready.
+ For instance, jQuery 1.4+ has been patched to take advantage of document.readyState, which is enabled by this hack. But 1.3.2 and before are **not** safe or
+ fixed by this hack, and should therefore **not** be lazy-loaded by script loader tools such as LABjs.
+ */
+ (function(addEvent,domLoaded,handler){
+ if (document.readyState == null && document[addEvent]){
+ document.readyState = "loading";
+ document[addEvent](domLoaded,handler = function(){
+ document.removeEventListener(domLoaded,handler,false);
+ document.readyState = "complete";
+ },false);
+ }
+ })("addEventListener","DOMContentLoaded");
+
+})(this);
View
4 include/js/min/punbb.common.min.js
@@ -2,6 +2,6 @@
v2.0.3 (c) Kyle Simpson
MIT License
*/
-(function(W){var f=W.$LAB,j="UseLocalXHR",g="AlwaysPreserveOrder",p="AllowDuplicates",V="CacheBust",T="BasePath",R=/^[^?#]*\//.exec(location.href)[0],Q=/^\w+\:\/\/\/?[^\/]+/.exec(R)[0],X=document.head||document.getElementsByTagName("head"),e=(W.opera&&Object.prototype.toString.call(W.opera)=="[object Opera]")||("MozAppearance" in document.documentElement.style),U=document.createElement("script"),w=typeof U.preload=="boolean",S=w||(U.readyState&&U.readyState=="uninitialized"),n=!S&&U.async===true,d=!S&&!n&&!e;function m(i){return Object.prototype.toString.call(i)=="[object Function]";}function l(i){return Object.prototype.toString.call(i)=="[object Array]";}function c(o,q){var i=/^\w+\:\/\//;if(/^\/\/\/?/.test(o)){o=location.protocol+o;}else{if(!i.test(o)&&o.charAt(0)!="/"){o=(q||"")+o;}}return i.test(o)?o:((o.charAt(0)=="/"?Q:R)+o);}function x(o,q){for(var i in o){if(o.hasOwnProperty(i)){q[i]=o[i];}}return q;}function b(o){var q=false;for(var i=0;i<o.scripts.length;i++){if(o.scripts[i].ready&&o.scripts[i].exec_trigger){q=true;o.scripts[i].exec_trigger();o.scripts[i].exec_trigger=null;}}return q;}function v(o,r,i,q){o.onload=o.onreadystatechange=function(){if((o.readyState&&o.readyState!="complete"&&o.readyState!="loaded")||r[i]){return;}o.onload=o.onreadystatechange=null;q();};}function k(i){i.ready=i.finished=true;for(var o=0;o<i.finished_listeners.length;o++){i.finished_listeners[o]();}i.ready_listeners=[];i.finished_listeners=[];}function a(s,q,r,o,i){setTimeout(function(){var u,y=q.real_src,t;if("item" in X){if(!X[0]){setTimeout(arguments.callee,25);return;}X=X[0];}u=document.createElement("script");if(q.type){u.type=q.type;}if(q.charset){u.charset=q.charset;}if(i){if(S){r.elem=u;if(w){u.preload=true;u.onpreload=o;}else{u.onreadystatechange=function(){if(u.readyState=="loaded"){o();}};}u.src=y;}else{if(i&&y.indexOf(Q)==0&&s[j]){t=new XMLHttpRequest();t.onreadystatechange=function(){if(t.readyState==4){t.onreadystatechange=function(){};r.text=t.responseText+"\n//@ sourceURL="+y;o();}};t.open("GET",y);t.send();}else{u.type="text/cache-script";v(u,r,"ready",function(){X.removeChild(u);o();});u.src=y;X.insertBefore(u,X.firstChild);}}}else{if(n){u.async=false;v(u,r,"finished",o);u.src=y;X.insertBefore(u,X.firstChild);}else{v(u,r,"finished",o);u.src=y;X.insertBefore(u,X.firstChild);}}},0);}function h(){var o={},t=S||d,y=[],u={},i;o[j]=true;o[g]=false;o[p]=false;o[V]=false;o[T]="";function s(A,D,z){var C;function B(){if(C!=null){C=null;k(z);}}if(u[D.src].finished){return;}if(!A[p]){u[D.src].finished=true;}C=z.elem||document.createElement("script");if(D.type){C.type=D.type;}if(D.charset){C.charset=D.charset;}v(C,z,"finished",B);if(z.elem){z.elem=null;}else{if(z.text){C.onload=C.onreadystatechange=null;C.text=z.text;}else{C.src=D.real_src;}}X.insertBefore(C,X.firstChild);if(z.text){B();}}function r(G,z,F,D){var E,C,B=function(){z.ready_cb(z,function(){s(G,z,E);});},A=function(){z.finished_cb(z,F);};z.src=c(z.src,G[T]);z.real_src=z.src+(G[V]?((/\?.*$/.test(z.src)?"&_":"?_")+~~(Math.random()*1000000000)+"="):"");if(!u[z.src]){u[z.src]={items:[],finished:false};}C=u[z.src].items;if(G[p]||C.length==0){E=C[C.length]={ready:false,finished:false,ready_listeners:[B],finished_listeners:[A]};a(G,z,E,((D)?function(){E.ready=true;for(var H=0;H<E.ready_listeners.length;H++){E.ready_listeners[H]();}E.ready_listeners=[];}:function(){k(E);}),D);}else{E=C[0];if(E.finished){A();}else{E.finished_listeners.push(A);}}}function q(){var G,F=x(o,{}),E=[],D=0,I=false,C;function B(J,K){J.ready=true;J.exec_trigger=K;H();}function A(K,L){K.ready=K.finished=true;K.exec_trigger=null;for(var J=0;J<L.scripts.length;J++){if(!L.scripts[J].finished){return;}}L.finished=true;H();}function H(){while(D<E.length){if(m(E[D])){try{E[D++]();}catch(J){}continue;}else{if(!E[D].finished){if(b(E[D])){continue;}break;}}D++;}if(D==E.length){I=false;C=false;}}function z(){if(!C||!C.scripts){E.push(C={scripts:[],finished:true});}}G={script:function(){for(var J=0;J<arguments.length;J++){(function(L,N){var K;if(!l(L)){N=[L];}for(var M=0;M<N.length;M++){z();L=N[M];if(m(L)){L=L();}if(!L){continue;}if(l(L)){K=[].slice.call(L);K.unshift(M,1);[].splice.apply(N,K);M--;continue;}if(typeof L=="string"){L={src:L};}L=x(L,{ready:false,ready_cb:B,finished:false,finished_cb:A});C.finished=false;C.scripts.push(L);r(F,L,C,(t&&I));I=true;if(F[g]){G.wait();}}})(arguments[J],arguments[J]);}return G;},wait:function(){if(arguments.length>0){for(var J=0;J<arguments.length;J++){E.push(arguments[J]);}C=E[E.length-1];}else{C=false;}H();return G;}};return{script:G.script,wait:G.wait,setOptions:function(J){x(J,F);return G;}};}i={setGlobalDefaults:function(z){x(z,o);return i;},setOptions:function(){return q().setOptions.apply(null,arguments);},script:function(){return q().script.apply(null,arguments);},wait:function(){return q().wait.apply(null,arguments);},queueScript:function(){y[y.length]={type:"script",args:[].slice.call(arguments)};
-return i;},queueWait:function(){y[y.length]={type:"wait",args:[].slice.call(arguments)};return i;},runQueue:function(){var A=i,C=y.length,z=C,B;for(;--z>=0;){B=y.shift();A=A[B.type].apply(null,B.args);}return A;},noConflict:function(){W.$LAB=f;return i;},sandbox:function(){return h();}};return i;}W.$LAB=h();(function(o,q,i){if(document.readyState==null&&document[o]){document.readyState="loading";document[o](q,i=function(){document.removeEventListener(q,i,false);document.readyState="complete";},false);}})("addEventListener","DOMContentLoaded");})(this);if(typeof PUNBB==="undefined"||!PUNBB){var PUNBB={};}PUNBB.common=(function(){var e=document.documentElement,d=false,a=false;function b(f){return document.getElementById(f);}function c(f,h){if(f&&h){if(f.value.length===0&&h.value.length===0){return;}if(f.value===h.value){return;}var g=parseInt(h.getAttribute("maxlength"),10)||0;if(g>0){h.value=f.value.replace(/@.*/,"").replace(/\s/g,"").substr(0,g);}else{h.value=f.value.replace(/@.*/,"").replace(/\s/g,"");}}}return{on_domready_init:function(){d=true;PUNBB.common.addClass(e,"js");PUNBB.common.attachWindowOpen();PUNBB.common.autoFocus();PUNBB.common.attachCtrlEnterForm();PUNBB.common.attachUsernameFromEmail();PUNBB.common.attachEmailFieldFixer();if(!PUNBB.common.input_support_attr("required")){PUNBB.common.attachValidateForm();}var f=b("brd-messages");if(f){setTimeout(function(){f.style.visibility="hidden";},3500);}},on_load_init:function(){a=true;},addLoadEvent:function(g){if(a===true){g();}else{var f=window.onload;window.onload=(f&&typeof f==="function")?function(){f();g();}:g;}},addDOMReadyEvent:function(h){var f=false;if(d===true){h();return;}if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){h();f=true;},false);window.addEventListener("load",function(){if(!f){h();}},false);}else{if(window.attachEvent){if(window.ActiveXObject&&window===window.top){g();}else{window.attachEvent("onload",h);}}else{PUNBB.common.addLoadEvent(h);}}function g(){try{e.doScroll("left");}catch(i){setTimeout(g,0);return;}h();}},hasClass:function(g,f){return(new RegExp("\\b"+f+"\\b")).test(g.className);},addClass:function(g,f){if(PUNBB.common.hasClass(g,f)){return false;}else{g.className+=" "+f;}return true;},removeClass:function(g,f){if(!PUNBB.common.hasClass(g,f)){return false;}f=new RegExp("\\s*\\b"+f+"\\b","g");g.className=g.className.replace(f,"");return true;},blink:function(h,g){if(typeof g===undefined){g=2;}var f=h.style.visibility;if(g&&f!=="hidden"){h.style.visibility="hidden";setTimeout(function(){h.style.visibility=f;},200);setTimeout(function(){PUNBB.common.blink(h,g-1);},400);}},onScreen:function(m){function j(){var n=-1;if(window.pageYOffset){n=window.pageYOffset;}else{if(e&&e.scrollTop){n=e.scrollTop;}else{if(document.body){n=document.body.scrollTop;}}}return n;}function i(){var n=-1;if(window.innerHeight){n=window.innerHeight;}else{if(e&&e.clientHeight){n=e.clientHeight;}else{if(document.body){n=document.body.clientHeight;}}}return n;}function g(p){var o=p.offsetTop;p=p.offsetParent;return p?o+=g(p):o;}var f=j(),l=f+i(),h=g(m),k=h+m.clientHeight;return h>=f&&k<l;},map:function(j,g){var h,f;for(h=0,f=g.length;h<f;h+=1){g[h]=j(g[h]);}return g;},find:function(j,g){var h,f;for(h=0,f=g.length;h<f;h+=1){if(j(g[h])){return h;}}return -1;},arrayOfMatched:function(k,h){var j,g,f=[];for(j=0,g=h.length;j<g;j+=1){if(k(h[j])){f.push(h[j]);}}return f;},flatten:function(g){var h,f,j=[];for(h=0,f=g.length;h<f;h+=1){if(typeof g[h]==="object"&&g.length){j.concat(PUNBB.common.flatten(g[h]));}else{j.push(g[h]);}}return j;},validateForm:function(h){var g=function(m){return m.name&&m.name.indexOf("req_")===0;};var j=h.elements,f=PUNBB.common.arrayOfMatched(g,j);g=function(m){return(/^\s*$/).test(m.value);};var i=PUNBB.common.find(g,f);if(i>-1){if(PUNBB.common.find(g,f)>-1){var l=b("req-msg");PUNBB.common.removeClass(l,"req-warn");var k=PUNBB.common.addClass(l,"req-error");if(!PUNBB.common.onScreen(l)){l.scrollIntoView();setTimeout(function(){PUNBB.common.blink(l);},500);}else{if(!k){PUNBB.common.blink(l);}}if(PUNBB.common.onScreen(f[i])){f[i].focus();}return false;}}return true;},doQuickjumpRedirect:function(h,g){var f=b("qjump-select")[b("qjump-select").selectedIndex].value;h=h.replace("$1",f);h=h.replace("$2",g[f]);document.location=h;return false;},attachQuickjumpRedirect:function(f,i){var h=b("qjump-select"),g=b("qjump-submit");if(h){h.onchange=function(){return PUNBB.common.doQuickjumpRedirect(f,i);};}if(g){g.onclick=function(){return PUNBB.common.doQuickjumpRedirect(f,i);};PUNBB.common.addClass(g,"visual-hidden");}},initToggleCheckboxes:function(){var k=function(i){return function(){return PUNBB.common.toggleCheckboxes(i);};};var g,f,l=document.getElementsByTagName("span");for(g=0,f=l.length;g<f;g+=1){var h=l[g];if(PUNBB.common.hasClass(h,"select-all")&&h.getAttribute("data-check-form")){var j=b(h.getAttribute("data-check-form"));if(j){h.onclick=k(j);}}}},toggleCheckboxes:function(j){if(!j){return false;
+(function(n){var q=n.$LAB,i="UseLocalXHR",m="AlwaysPreserveOrder",k="AllowDuplicates",j="CacheBust",d="BasePath",o=/^[^?#]*\//.exec(location.href)[0],y=/^\w+\:\/\/\/?[^\/]+/.exec(o)[0],e=document.head||document.getElementsByTagName("head"),g=(n.opera&&Object.prototype.toString.call(n.opera)=="[object Opera]")||("MozAppearance" in document.documentElement.style),w=document.createElement("script"),a=typeof w.preload=="boolean",t=a||(w.readyState&&w.readyState=="uninitialized"),u=!t&&w.async===true,v=!t&&!u&&!g;function r(z){return Object.prototype.toString.call(z)=="[object Function]";}function x(z){return Object.prototype.toString.call(z)=="[object Array]";}function f(B,A){var z=/^\w+\:\/\//;if(/^\/\/\/?/.test(B)){B=location.protocol+B;}else{if(!z.test(B)&&B.charAt(0)!="/"){B=(A||"")+B;}}return z.test(B)?B:((B.charAt(0)=="/"?y:o)+B);}function h(A,B){for(var z in A){if(A.hasOwnProperty(z)){B[z]=A[z];}}return B;}function b(A){var B=false;for(var z=0;z<A.scripts.length;z++){if(A.scripts[z].ready&&A.scripts[z].exec_trigger){B=true;A.scripts[z].exec_trigger();A.scripts[z].exec_trigger=null;}}return B;}function c(B,A,z,C){B.onload=B.onreadystatechange=function(){if((B.readyState&&B.readyState!="complete"&&B.readyState!="loaded")||A[z]){return;}B.onload=B.onreadystatechange=null;C();};}function s(z){z.ready=z.finished=true;for(var A=0;A<z.finished_listeners.length;A++){z.finished_listeners[A]();}z.ready_listeners=[];z.finished_listeners=[];}function p(B,C,A,D,z){setTimeout(function(){var E,G=C.real_src,F;if("item" in e){if(!e[0]){setTimeout(arguments.callee,25);return;}e=e[0];}E=document.createElement("script");if(C.type){E.type=C.type;}if(C.charset){E.charset=C.charset;}if(z){if(t){A.elem=E;if(a){E.preload=true;E.onpreload=D;}else{E.onreadystatechange=function(){if(E.readyState=="loaded"){D();}};}E.src=G;}else{if(z&&G.indexOf(y)==0&&B[i]){F=new XMLHttpRequest();F.onreadystatechange=function(){if(F.readyState==4){F.onreadystatechange=function(){};A.text=F.responseText+"\n//@ sourceURL="+G;D();}};F.open("GET",G);F.send();}else{E.type="text/cache-script";c(E,A,"ready",function(){e.removeChild(E);D();});E.src=G;e.insertBefore(E,e.firstChild);}}}else{if(u){E.async=false;c(E,A,"finished",D);E.src=G;e.insertBefore(E,e.firstChild);}else{c(E,A,"finished",D);E.src=G;e.insertBefore(E,e.firstChild);}}},0);}function l(){var B={},G=t||v,z=[],A={},D;B[i]=true;B[m]=false;B[k]=false;B[j]=false;B[d]="";function F(J,L,I){var H;function K(){if(H!=null){H=null;s(I);}}if(A[L.src].finished){return;}if(!J[k]){A[L.src].finished=true;}H=I.elem||document.createElement("script");if(L.type){H.type=L.type;}if(L.charset){H.charset=L.charset;}c(H,I,"finished",K);if(I.elem){I.elem=null;}else{if(I.text){H.onload=H.onreadystatechange=null;H.text=I.text;}else{H.src=L.real_src;}}e.insertBefore(H,e.firstChild);if(I.text){K();}}function C(J,N,M,H){var I,L,K=function(){N.ready_cb(N,function(){F(J,N,I);});},O=function(){N.finished_cb(N,M);};N.src=f(N.src,J[d]);N.real_src=N.src+(J[j]?((/\?.*$/.test(N.src)?"&_":"?_")+~~(Math.random()*1000000000)+"="):"");if(!A[N.src]){A[N.src]={items:[],finished:false};}L=A[N.src].items;if(J[k]||L.length==0){I=L[L.length]={ready:false,finished:false,ready_listeners:[K],finished_listeners:[O]};p(J,N,I,((H)?function(){I.ready=true;for(var P=0;P<I.ready_listeners.length;P++){I.ready_listeners[P]();}I.ready_listeners=[];}:function(){s(I);}),H);}else{I=L[0];if(I.finished){O();}else{I.finished_listeners.push(O);}}}function E(){var K,O=h(B,{}),H=[],J=0,L=false,N;function Q(S,R){S.ready=true;S.exec_trigger=R;I();}function P(T,S){T.ready=T.finished=true;T.exec_trigger=null;for(var R=0;R<S.scripts.length;R++){if(!S.scripts[R].finished){return;}}S.finished=true;I();}function I(){while(J<H.length){if(r(H[J])){try{H[J++]();}catch(R){}continue;}else{if(!H[J].finished){if(b(H[J])){continue;}break;}}J++;}if(J==H.length){L=false;N=false;}}function M(){if(!N||!N.scripts){H.push(N={scripts:[],finished:true});}}K={script:function(){for(var R=0;R<arguments.length;R++){(function(V,T){var U;if(!x(V)){T=[V];}for(var S=0;S<T.length;S++){M();V=T[S];if(r(V)){V=V();}if(!V){continue;}if(x(V)){U=[].slice.call(V);U.unshift(S,1);[].splice.apply(T,U);S--;continue;}if(typeof V=="string"){V={src:V};}V=h(V,{ready:false,ready_cb:Q,finished:false,finished_cb:P});N.finished=false;N.scripts.push(V);C(O,V,N,(G&&L));L=true;if(O[m]){K.wait();}}})(arguments[R],arguments[R]);}return K;},wait:function(){if(arguments.length>0){for(var R=0;R<arguments.length;R++){H.push(arguments[R]);}N=H[H.length-1];}else{N=false;}I();return K;}};return{script:K.script,wait:K.wait,setOptions:function(R){h(R,O);return K;}};}D={setGlobalDefaults:function(H){h(H,B);return D;},setOptions:function(){return E().setOptions.apply(null,arguments);},script:function(){return E().script.apply(null,arguments);},wait:function(){return E().wait.apply(null,arguments);},queueScript:function(){z[z.length]={type:"script",args:[].slice.call(arguments)};
+return D;},queueWait:function(){z[z.length]={type:"wait",args:[].slice.call(arguments)};return D;},runQueue:function(){var J=D,H=z.length,I=H,K;for(;--I>=0;){K=z.shift();J=J[K.type].apply(null,K.args);}return J;},noConflict:function(){n.$LAB=q;return D;},sandbox:function(){return l();}};return D;}n.$LAB=l();(function(B,z,A){if(document.readyState==null&&document[B]){document.readyState="loading";document[B](z,A=function(){document.removeEventListener(z,A,false);document.readyState="complete";},false);}})("addEventListener","DOMContentLoaded");})(this);if(typeof PUNBB==="undefined"||!PUNBB){var PUNBB={};}PUNBB.common=(function(){var e=document.documentElement,d=false,a=false;function b(f){return document.getElementById(f);}function c(f,h){if(f&&h){if(f.value.length===0&&h.value.length===0){return;}if(f.value===h.value){return;}var g=parseInt(h.getAttribute("maxlength"),10)||0;if(g>0){h.value=f.value.replace(/@.*/,"").replace(/\s/g,"").substr(0,g);}else{h.value=f.value.replace(/@.*/,"").replace(/\s/g,"");}}}return{on_domready_init:function(){d=true;PUNBB.common.addClass(e,"js");PUNBB.common.attachWindowOpen();PUNBB.common.autoFocus();PUNBB.common.attachCtrlEnterForm();PUNBB.common.attachUsernameFromEmail();PUNBB.common.attachEmailFieldFixer();if(!PUNBB.common.input_support_attr("required")){PUNBB.common.attachValidateForm();}var f=b("brd-messages");if(f){setTimeout(function(){f.style.visibility="hidden";},3500);}},on_load_init:function(){a=true;},addLoadEvent:function(g){if(a===true){g();}else{var f=window.onload;window.onload=(f&&typeof f==="function")?function(){f();g();}:g;}},addDOMReadyEvent:function(h){var f=false;if(d===true){h();return;}if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){h();f=true;},false);window.addEventListener("load",function(){if(!f){h();}},false);}else{if(window.attachEvent){if(window.ActiveXObject&&window===window.top){g();}else{window.attachEvent("onload",h);}}else{PUNBB.common.addLoadEvent(h);}}function g(){try{e.doScroll("left");}catch(i){setTimeout(g,0);return;}h();}},hasClass:function(g,f){return(new RegExp("\\b"+f+"\\b")).test(g.className);},addClass:function(g,f){if(PUNBB.common.hasClass(g,f)){return false;}else{g.className+=" "+f;}return true;},removeClass:function(g,f){if(!PUNBB.common.hasClass(g,f)){return false;}f=new RegExp("\\s*\\b"+f+"\\b","g");g.className=g.className.replace(f,"");return true;},blink:function(h,g){if(typeof g===undefined){g=2;}var f=h.style.visibility;if(g&&f!=="hidden"){h.style.visibility="hidden";setTimeout(function(){h.style.visibility=f;},200);setTimeout(function(){PUNBB.common.blink(h,g-1);},400);}},onScreen:function(m){function j(){var n=-1;if(window.pageYOffset){n=window.pageYOffset;}else{if(e&&e.scrollTop){n=e.scrollTop;}else{if(document.body){n=document.body.scrollTop;}}}return n;}function i(){var n=-1;if(window.innerHeight){n=window.innerHeight;}else{if(e&&e.clientHeight){n=e.clientHeight;}else{if(document.body){n=document.body.clientHeight;}}}return n;}function g(p){var o=p.offsetTop;p=p.offsetParent;return p?o+=g(p):o;}var f=j(),l=f+i(),h=g(m),k=h+m.clientHeight;return h>=f&&k<l;},map:function(j,g){var h,f;for(h=0,f=g.length;h<f;h+=1){g[h]=j(g[h]);}return g;},find:function(j,g){var h,f;for(h=0,f=g.length;h<f;h+=1){if(j(g[h])){return h;}}return -1;},arrayOfMatched:function(k,h){var j,g,f=[];for(j=0,g=h.length;j<g;j+=1){if(k(h[j])){f.push(h[j]);}}return f;},flatten:function(g){var h,f,j=[];for(h=0,f=g.length;h<f;h+=1){if(typeof g[h]==="object"&&g.length){j.concat(PUNBB.common.flatten(g[h]));}else{j.push(g[h]);}}return j;},validateForm:function(h){var g=function(m){return m.name&&m.name.indexOf("req_")===0;};var j=h.elements,f=PUNBB.common.arrayOfMatched(g,j);g=function(m){return(/^\s*$/).test(m.value);};var i=PUNBB.common.find(g,f);if(i>-1){if(PUNBB.common.find(g,f)>-1){var l=b("req-msg");PUNBB.common.removeClass(l,"req-warn");var k=PUNBB.common.addClass(l,"req-error");if(!PUNBB.common.onScreen(l)){l.scrollIntoView();setTimeout(function(){PUNBB.common.blink(l);},500);}else{if(!k){PUNBB.common.blink(l);}}if(PUNBB.common.onScreen(f[i])){f[i].focus();}return false;}}return true;},doQuickjumpRedirect:function(h,g){var f=b("qjump-select")[b("qjump-select").selectedIndex].value;h=h.replace("$1",f);h=h.replace("$2",g[f]);document.location=h;return false;},attachQuickjumpRedirect:function(f,i){var h=b("qjump-select"),g=b("qjump-submit");if(h){h.onchange=function(){return PUNBB.common.doQuickjumpRedirect(f,i);};}if(g){g.onclick=function(){return PUNBB.common.doQuickjumpRedirect(f,i);};PUNBB.common.addClass(g,"visual-hidden");}},initToggleCheckboxes:function(){var k=function(i){return function(){return PUNBB.common.toggleCheckboxes(i);};};var g,f,l=document.getElementsByTagName("span");for(g=0,f=l.length;g<f;g+=1){var h=l[g];if(PUNBB.common.hasClass(h,"select-all")&&h.getAttribute("data-check-form")){var j=b(h.getAttribute("data-check-form"));if(j){h.onclick=k(j);}}}},toggleCheckboxes:function(j){if(!j){return false;
}var g,f,k=j.getElementsByTagName("input");for(g=0,f=k.length;g<f;g+=1){var h=k[g];if(h.getAttribute("data-no-select-all")){continue;}if(h.getAttribute("type")=="checkbox"&&h.disabled===false){h.checked=!h.checked;}}return false;},attachCtrlEnterForm:function(){var r=function(f){return function(j){j=j||window.event;var i=j.keyCode||j.which;if(((i==13)||(i==10))&&(j.ctrlKey===true)){return f.submit();}};};var n=function(f){return f.tagName.toUpperCase()=="TEXTAREA";};var m,q,h=document.forms;for(m=0,q=h.length;m<q;m+=1){var p=h[m];if(!PUNBB.common.hasClass(p,"frm-ctrl-submit")){continue;}var l,o,g=p.elements,k=PUNBB.common.arrayOfMatched(n,g);for(l=0,o=k.length;l<o;l+=1){k[l].onkeypress=r(p);}}},attachValidateForm:function(){var o=function(i){return i.name&&i.name.indexOf("req_")===0;};var l=function(i){return i.type&&(i.type=="submit"&&i.name!="cancel");};var m=function(i){return function(){return PUNBB.common.validateForm(i);};};var k,n,g=document.forms;for(k=0,n=g.length;k<n;k+=1){var f=g[k].elements;if(PUNBB.common.find(o,f)>-1){var h=PUNBB.common.arrayOfMatched(l,f),j=g[k];h=PUNBB.common.map(function(i){i.onclick=m(j);},h);}}},attachWindowOpen:function(){if(!document.getElementsByTagName){return;}var h=function(){return function(){window.open(this.href);return false;};};var g,f=document.getElementsByTagName("a");for(g=0;g<f.length;g+=1){if(PUNBB.common.hasClass(f[g],"exthelp")){f[g].onclick=h();}}},autoFocus:function(){var g=function(i){return i.offsetWidth>0&&(i.tagName.toUpperCase()=="TEXTAREA"||(i.tagName.toUpperCase()=="INPUT"&&(i.type=="text")||(i.type=="password")||(i.type=="email")||(i.type=="url")||(i.type=="number")));};var f=b("afocus");if(!f||window.location.hash.replace(/#/g,"")){return;}f=f.all||f.getElementsByTagName("*");var h=PUNBB.common.find(g,f);if(h>-1){f[h].focus();}},input_support_attr:function(f){var g=document.createElement("input");if(!f){return false;}return !!(f in g);},attachUsernameFromEmail:function(){var m=function(f){return(f.tagName.toUpperCase()=="INPUT"&&f.type=="email"&&f.getAttribute("data-suggest-role")==="email");};var p=function(f){return(f.tagName.toUpperCase()=="INPUT"&&f.type=="text"&&f.getAttribute("data-suggest-role")==="username");};var j,n,g=document.forms;for(j=0,n=g.length;j<n;j+=1){var l=g[j],k=-1,h=-1;if(!PUNBB.common.hasClass(l,"frm-suggest-username")){continue;}k=PUNBB.common.find(m,l.elements);h=PUNBB.common.find(p,l.elements);if(k>0&&h>0){var o=function(f){return function(i){c(this,f);};};l.elements[k].onkeyup=o(l.elements[h]);}}},attachEmailFieldFixer:function(){var n=function(i){return(i.tagName.toUpperCase()=="INPUT"&&i.type=="email");};var p=function(){var i=this;if(i&&i.value.length>0){i.value=i.value.replace(/\s/g,"");}};var l,o,g=document.forms;for(l=0,o=g.length;l<o;l+=1){var k,m,f=g[l].elements,h=PUNBB.common.arrayOfMatched(n,f);for(k=0,m=h.length;k<m;k+=1){h[k].onblur=p;}}}};}());PUNBB.common.addDOMReadyEvent(PUNBB.common.on_domready_init);PUNBB.common.addLoadEvent(PUNBB.common.on_load_init);

0 comments on commit c507109

Please sign in to comment.
Something went wrong with that request. Please try again.