From 256f3d2262c47601da510d0989302ab0f5425e22 Mon Sep 17 00:00:00 2001 From: Laurent Goderre Date: Fri, 22 Jun 2012 17:33:02 -0400 Subject: [PATCH] Moved the loading of jQuery mobile. Resolves problem of it only partially loading sometimes. --- build/js/pe-ap-min.js | 2 +- src/js/pe-ap.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/js/pe-ap-min.js b/build/js/pe-ap-min.js index 6a6e62fe6be..4ee4d07aaea 100644 --- a/build/js/pe-ap-min.js +++ b/build/js/pe-ap-min.js @@ -2,4 +2,4 @@ * Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW) * www.tbs.gc.ca/ws-nw/wet-boew/terms / www.sct.gc.ca/ws-nw/wet-boew/conditions */ -(function(c){var a,b;a=(typeof window.pe!=="undefined"&&window.pe!==null)?window.pe:{fn:{}};b={language:(c("html").attr("lang").length>0?c("html").attr("lang"):"en"),touchscreen:"ontouchstart" in document.documentElement,theme:"",suffix:c('body script[src*="/pe-ap-min.js"]').length>0?"-min":"",header:c("#wb-head"),menubar:c(".wet-boew-menubar"),secnav:c("#wb-sec"),footer:c("#wb-foot"),html5:(function(){var d=false,e=/\s+(X?HTML)\s+([\d\.]+)\s*([^\/]+)*\//gi;if(typeof document.namespaces!=="undefined"){d=(document.all[0].nodeType===8)?e.test(document.all[0].nodeValue):false}else{d=(document.doctype!==null)?e.test(document.doctype.publicId):false}return(d)?false:true}()),ie:c.browser.msie?c.browser.version:0,_init:function(){var e,d;c("html").removeClass("no-js").addClass(a.theme+((a.touchscreen)?" touchscreen":""));if(a.mobilecheck()){a.mobile=true;c("body > div").attr("data-role","page")}c.when.apply(c,c.map(c("*[data-ajax-replace], *[data-ajax-append]"),function(h){d=c(h);var g=false,f;if(d.attr("data-ajax-replace")!==undefined){g=true;f=d.attr("data-ajax-replace")}else{if(d.attr("data-ajax-append")!==undefined){f=d.attr("data-ajax-append")}}return c.get(f,function(i){if(g){d.empty()}d.append(c(i))},"html")})).always(function(){c(document).bind("languageloaded",function(){if(wet_boew_theme!==null){wet_boew_theme.init();if(a.mobile===true){if(wet_boew_theme!==null){wet_boew_theme.mobileview()}c(document).on("mobileinit",function(){c.mobile.ajaxEnabled=false;c.mobile.pushStateEnabled=false});c(document).on("pageinit",function(){})}}a.dance()});a.add.language(a.language)});a.polyfills()},depends:{_ind:[],is:function(d){return -1!==c.inArray(d,a.depends._ind)},put:function(d){a.depends._ind[a.depends._ind.length]=d},on:(function(){c(document).on("wet-boew-dependency-loaded",function(){var e,f;for(e=0,f=a.depends.on.length;e0&&a.ie<9))},pagecontainer:function(){return c("#wb-body-sec-sup,#wb-body-sec,#wb-body").add("body").eq(0)},parameter:function(d,e){return(a.html5)?e.data(d):e.attr("class").replace("/.*"+d+"-([a-z0-9_]+).*/i","$1")},resize:function(d){ResizeEvents.initialise();ResizeEvents.eventElement.bind("x-text-resize x-zoom-resize x-window-resize",function(){d()});return},url:function(e){var d;d=document.createElement("a");d.href=e;return{source:d.href,protocol:d.protocol.replace(":",""),host:d.hostname,port:d.port==="0"?"80":d.port,query:d.search,params:(function(){var i,h,j,g,k,f;h={};g=d.search.replace(/^\?/,"").split("&");for(k=0,f=g.length;k'+((e.length>25)?e.substr(0,24)+"...":e)+""})},at:function(d){return d.replace(/(^|[^\w]+)\@([a-zA-Z0-9_]{1,15}(\/[a-zA-Z0-9-_]+)*)/g,function(e,g,f){return g+'@'+f+""})},hash:function(d){return d.replace(/(^|[^&\w'"]+)\#([a-zA-Z0-9_]+)/g,function(e,g,f){return g+'#'+f+""})},clean:function(d){return this.hash(this.at(this.link(d)))}}}()),pad:function(e,d){var f;f=String(e);while(f.lengthd)-(e'),g=(typeof d.jquery!=="undefined"?d:c(d)).find("> div, > ul, h"+m),i,f,l,k;if(g.first().is("ul")){e.append(c('
    ').append(g.first().children("li")))}else{g.each(function(n){var o=c(this);if(o.is("h"+m)){l=o.children("a");f=c('
    "+o.text()+"
    ");if(j){o=o.parent().find("a").eq(1).closest("ul, div, h"+m+1).first();i=o}else{i=o.next()}if(i.is("ul")){if(!j){i.prepend(c("
  • ").append(o.children("a").html(l.html()+" - "+a.dic.get("%home"))))}k=i.find("li ul");k.each(function(p){var q=c(this);l=q.prev("a");if((m+1+p)<7){q.attr("data-role","listview").attr("data-theme",h).wrap('
    ');q.parent().prepend(""+l.html()+"");q.prepend('
  • '+l.html()+" - "+a.dic.get("%home")+"
  • ");l.remove()}else{q.attr("data-role","listview").attr("data-theme",h)}});f.append(c('
      ').append(i.children("li")));f.find("ul").wrap('
      '+(k.length>0?'
      ':"")+"
      ")}else{f.append(a.menu.buildmobile(o.parent(),m+1,h));if(!j){f.find('div[data-role="collapsible-set"]').eq(0).prepend(o.children("a").html(l.html()+" - "+a.dic.get("%home")).attr("data-role","button").attr("data-theme",h).attr("data-icon","arrow-r").attr("data-iconpos","right"))}}e.append(f)}else{if(o.is("div")){e.append(o.children("a").attr("data-role","button").attr("data-theme",h).attr("data-icon","arrow-r").attr("data-iconpos","right"))}}});e.children().wrapAll('
      ')}return e},expandmobile:function(e,d){c((typeof e.jquery!=="undefined"?e:c(e))).find((typeof d==="undefined")?".nav-current":d).parents('div[data-role="collapsible"]').attr("data-collapsed","false")},correctmobile:function(d){c((typeof d.jquery!=="undefined"?d:c(d))).find(".ui-collapsible-set").each(function(){var e=c(this);if(e.find("> ul .ui-collapsible").length>0){e=e.children("ul")}e.children().each(function(){var g=c(this),f=g.is("a")?g:g.find("a").first();if(g.prev().length>0){f.removeClass("ui-corner-top")}if(g.next().length>0){f.removeClass("ui-corner-bottom")}})})}},polyfills:function(){var e=a.add.liblocation,d=(function(j){var h=j.createElement("details"),g,f,i;if(typeof h.open==="undefined"){return false}f=j.body||(function(){var k=j.documentElement;g=true;return k.insertBefore(j.createElement("body"),k.firstElementChild||k.firstChild)}());h.innerHTML="ab";h.style.display="block";f.appendChild(h);i=h.offsetHeight;h.open=true;i=i!==h.offsetHeight;f.removeChild(h);if(g){f.parentNode.removeChild(f)}return i}(document));if(!window.localStorage){a.add._load(e+"polyfills/localstorage"+a.suffix+".js")}if(typeof document.createElement("progress").position==="undefined"){a.add._load(e+"polyfills/progress"+a.suffix+".js")}if(!d){a.add._load(e+"polyfills/detailsummary"+a.suffix+".js")}},add:(function(){return{head:document.head||document.getElementsByTagName("head"),liblocation:(function(){var d=c('body script[src*="/pe-ap"]').attr("src");return d.substr(0,d.lastIndexOf("/")+1)}()),themecsslocation:(function(){var d=c('head link[rel="stylesheet"][href*="'+wet_boew_theme.themename()+'"]');return d.length>0?d.attr("href").substr(0,d.attr("href").lastIndexOf("/")+1):"theme-not-found/"}()),staged:[],_load:function(e){var d=a.add.head;if(c.inArray(e,this.staged)>-1){return this}setTimeout(function(){if(typeof d.item!=="undefined"){if(!d[0]){setTimeout(arguments.callee,25);return}d=d[0]}var f=document.createElement("script"),g=false;a.add.set(f,"async","async");f.onload=f.onreadystatechange=function(){if((f.readyState&&f.readyState!=="complete"&&f.readyState!=="loaded")||g){return false}f.onload=f.onreadystatechange=null;g=true;a.depends.put(e);c(document).trigger({type:"wet-boew-dependency-loaded",js:e})};f.src=e;if((a.ie>0&&a.ie<9)||!d.insertBefore){c(f).appendTo(c(d)).delay(100)}else{d.insertBefore(f,d.firstChild)}},0);this.staged[this.staged.length]=e;return this},set:function(f,d,e){f.setAttribute(d,e);return this},css:function(f){var e=a.add.head,d=document.createElement("link");a.add.set(d,"rel","stylesheet").set(d,"href",f);if((a.ie>0&&a.ie<10)||!e.insertBefore){c(d).appendTo(c(e)).attr("href",f)}else{e.insertBefore(d,e.firstChild)}return this},depends:function(g){var f=a.add.liblocation,e=c.map(g,function(d){return(/^http(s)?/i.test(d))?d:f+"dependencies/"+d+a.suffix+".js"});return e},language:function(e){var d=a.add.liblocation+"i18n/"+e+a.suffix+".js";a.add._load(d)},js:function(f,e){var d;f=a.add.depends(f);for(d=0;d'+pe.dic.get("%archived-page")+"");b(window).on("scroll",function(){if(b(this).scrollTop()>10){c.fadeIn("normal").attr("aria-hidden","false")}else{c.fadeOut("normal").attr("aria-hidden","true")}});if(b(window).scrollTop()<10||b(window).scrollTop()==="undefined"){c.fadeOut("normal").attr("aria-hidden","true")}else{c.fadeIn("normal").attr("aria-hidden","false")}pe.pagecontainer().append(c)}};window.pe=a;return a}(jQuery));(function(b){var a=window.pe||{fn:{}};a.fn.charts={type:"plugin",depends:["excanvas","flot"],_exec:function(i){var d,h,g,f,e,c;d=b(i);e=d.find(".chart-canvas");if(!e.hasClass("fixed-size")){e.height(Math.round(e.width()/1.61663))}c=b(i).find("table").eq(0);g=[];h=f=[];c.find("thead td, thead th").each(function(){return h.push(b(this).text())});c.find("tbody tr").each(function(){var j;j={label:"",data:[]};j.label=b(this).find("th").eq(0).text();b(this).find("td").each(function(k){return j.data.push([h[k+1],b(this).text()])});return g.push(j)});b.plot(e,g,{xaxis:{tickDecimals:0}})}};window.pe=a;return a}(jQuery));(function(b){var a=window.pe||{fn:{}};a.fn.feedback={type:"plugin",depends:[],_exec:function(i){var d=i.find("#feedback"),h=i.find("#web"),g=h.find("#access"),c=h.find("#mobile"),j=h.find("#computer"),l=i.find("#contact-coord"),m=l.find("#contact1"),k=l.find("#contact2"),f=l.find("#info"),e=document.referrer,n;d.attr("aria-controls","web").on("keyup click load",function(o){n=(o.type==="load");if(!n&&b(this).val()==="web"){h.attr("aria-hidden","false").show("slow")}else{h.attr("aria-hidden","true").hide((n?"":"slow"))}});d.find('option[value="'+pe.url(document.location).params.feedback+'"]').attr("selected","selected");d.trigger("load");g.attr("aria-controls","mobile computer").on("keyup click load",function(o){n=(o.type==="load");if(!n&&g.val()==="mobile"){c.attr("aria-hidden","false").show("slow");j.attr("aria-hidden","true").hide("slow")}else{j.attr("aria-hidden","false").show((n?"":"slow"));c.attr("aria-hidden","true").hide((n?"":"slow"))}}).trigger("load");m.on("keyup click load",function(o){n=(o.type==="load");if(!n&&b(this).val()==="yes"){f.attr("aria-hidden","false").show("slow")}else{if(n||((b(this).val()==="no"||b(this).val()===null)&&(k.val()==="no"||k.val()===null))){f.attr("aria-hidden","true").hide((n?"":"slow"))}}}).trigger("click");k.on("keyup click load",function(o){n=(o.type==="load");if(!n&&b(this).val()==="yes"){f.attr("aria-hidden","false").show("slow")}else{if(n||((b(this).val()==="no"||b(this).val()===null)&&(m.val()==="no"||m.val()===null))){f.attr("aria-hidden","true").hide((n?"":"slow"))}}}).trigger("load");h.find("#page").attr("value",e);i.find("input[type=reset]").on("click",function(){d.trigger("load");g.trigger("load");m.trigger("load");k.trigger("load")});return i}};window.pe=a;return a}(jQuery));(function(b){var a=window.pe||{fn:{}};a.fn.formvalid={type:"plugin",depends:["validate","validateAdditional","metadata"],_exec:function(f){var e=f.find("form"),c=false,d;if(pe.language!=="en"){pe.add._load(pe.add.liblocation+"i18n/formvalid/messages_"+pe.language+pe.suffix+".js")}if(pe.language==="de"||pe.language==="nl"||pe.language==="pt"){pe.add._load(pe.add.liblocation+"i18n/formvalid/methods_"+pe.language+pe.suffix+".js")}if(pe.ie>0&&pe.ie<8){e.find(".required").attr("aria-required","true").attr("required","required")}else{e.find(".required").attr("aria-required","true")}if(pe.mobile){e.attr("data-ajax","false").find("input:checkbox").closest("fieldset").attr("data-role","controlgroup")}d=e.validate({meta:"validate",focusInvalid:false,errorElement:"strong",errorPlacement:function(g,h){g.appendTo(e.find('label[for="'+b(h).attr("id")+'"]'))},showErrors:function(i,k){this.defaultShowErrors();var l=e.find("strong.error:not(:hidden)"),j="errors-"+e.attr("id"),h=e.find("#"+j),g;if(l.length>0){if(h.length===0){h=b('");b(window).on("scroll",function(){if(b(this).scrollTop()>10){c.fadeIn("normal").attr("aria-hidden","false")}else{c.fadeOut("normal").attr("aria-hidden","true")}});if(b(window).scrollTop()<10||b(window).scrollTop()==="undefined"){c.fadeOut("normal").attr("aria-hidden","true")}else{c.fadeIn("normal").attr("aria-hidden","false")}pe.pagecontainer().append(c)}};window.pe=a;return a}(jQuery));(function(b){var a=window.pe||{fn:{}};a.fn.charts={type:"plugin",depends:["excanvas","flot"],_exec:function(i){var d,h,g,f,e,c;d=b(i);e=d.find(".chart-canvas");if(!e.hasClass("fixed-size")){e.height(Math.round(e.width()/1.61663))}c=b(i).find("table").eq(0);g=[];h=f=[];c.find("thead td, thead th").each(function(){return h.push(b(this).text())});c.find("tbody tr").each(function(){var j;j={label:"",data:[]};j.label=b(this).find("th").eq(0).text();b(this).find("td").each(function(k){return j.data.push([h[k+1],b(this).text()])});return g.push(j)});b.plot(e,g,{xaxis:{tickDecimals:0}})}};window.pe=a;return a}(jQuery));(function(b){var a=window.pe||{fn:{}};a.fn.feedback={type:"plugin",depends:[],_exec:function(i){var d=i.find("#feedback"),h=i.find("#web"),g=h.find("#access"),c=h.find("#mobile"),j=h.find("#computer"),l=i.find("#contact-coord"),m=l.find("#contact1"),k=l.find("#contact2"),f=l.find("#info"),e=document.referrer,n;d.attr("aria-controls","web").on("keyup click load",function(o){n=(o.type==="load");if(!n&&b(this).val()==="web"){h.attr("aria-hidden","false").show("slow")}else{h.attr("aria-hidden","true").hide((n?"":"slow"))}});d.find('option[value="'+pe.url(document.location).params.feedback+'"]').attr("selected","selected");d.trigger("load");g.attr("aria-controls","mobile computer").on("keyup click load",function(o){n=(o.type==="load");if(!n&&g.val()==="mobile"){c.attr("aria-hidden","false").show("slow");j.attr("aria-hidden","true").hide("slow")}else{j.attr("aria-hidden","false").show((n?"":"slow"));c.attr("aria-hidden","true").hide((n?"":"slow"))}}).trigger("load");m.on("keyup click load",function(o){n=(o.type==="load");if(!n&&b(this).val()==="yes"){f.attr("aria-hidden","false").show("slow")}else{if(n||((b(this).val()==="no"||b(this).val()===null)&&(k.val()==="no"||k.val()===null))){f.attr("aria-hidden","true").hide((n?"":"slow"))}}}).trigger("click");k.on("keyup click load",function(o){n=(o.type==="load");if(!n&&b(this).val()==="yes"){f.attr("aria-hidden","false").show("slow")}else{if(n||((b(this).val()==="no"||b(this).val()===null)&&(m.val()==="no"||m.val()===null))){f.attr("aria-hidden","true").hide((n?"":"slow"))}}}).trigger("load");h.find("#page").attr("value",e);i.find("input[type=reset]").on("click",function(){d.trigger("load");g.trigger("load");m.trigger("load");k.trigger("load")});return i}};window.pe=a;return a}(jQuery));(function(b){var a=window.pe||{fn:{}};a.fn.formvalid={type:"plugin",depends:["validate","validateAdditional","metadata"],_exec:function(f){var e=f.find("form"),c=false,d;if(pe.language!=="en"){pe.add._load(pe.add.liblocation+"i18n/formvalid/messages_"+pe.language+pe.suffix+".js")}if(pe.language==="de"||pe.language==="nl"||pe.language==="pt"){pe.add._load(pe.add.liblocation+"i18n/formvalid/methods_"+pe.language+pe.suffix+".js")}if(pe.ie>0&&pe.ie<8){e.find(".required").attr("aria-required","true").attr("required","required")}else{e.find(".required").attr("aria-required","true")}if(pe.mobile){e.attr("data-ajax","false").find("input:checkbox").closest("fieldset").attr("data-role","controlgroup")}d=e.validate({meta:"validate",focusInvalid:false,errorElement:"strong",errorPlacement:function(g,h){g.appendTo(e.find('label[for="'+b(h).attr("id")+'"]'))},showErrors:function(i,k){this.defaultShowErrors();var l=e.find("strong.error:not(:hidden)"),j="errors-"+e.attr("id"),h=e.find("#"+j),g;if(l.length>0){if(h.length===0){h=b('