(function() { if (document.domain.match(/\./g).length > 1) document.domain = document.domain.replace(/^.*\.([^\.]*)(\.co\.uk|\.com|\.de)$/, "$1$2"); if (!window.$TORA) { $TORA={};(function(){$TORA=function e(){return $TORA._$public.apply(this,arguments)};$TORA._$config={BASE_PKG_LOCATION:"/resources/static/libtora/packages/",BASE_RES_LOCATION:"/resources/static/libtora/resources/"};var d=[],f=[];var i={};$TORA._$tmp={};var n=false;$TORA._$public=function(){return l(arguments[0])};d.push(function(){$TORA.whenReady=function(q){if(n){q()}else{if(q){f.push(q)}}};i.common.dom.addEventListener.call(document,"DOMContentLoaded",function(){n=true;for(var r=0,q;(q=f[r]);r++){q()}})});var l,j,h={};d.push(function(){var q=i.common.object;l=q.Registry(h);l.add("DEFAULTS",q.Registry(null,true));j={get:function(){return l.lookup.apply(l,arguments)},add:function(){return l.add.apply(l,arguments)}};g()});function g(){$TORA.registry=function(){return j}}var b,a,m={};d.push(function(){var r=$TORA._$config,t=i.packaging;b=t.PackageRegistry(r.BASE_PKG_LOCATION);a=t.PackageRepository(b,m);l.extend(($TORA.packages=m));$TORA.addPackages=function q(u){a.registerPackages(u)};$TORA.initModule=$TORA.initCoreModule=function s(u,v){return a.insert(u,v({resourceLocation:r.BASE_RES_LOCATION,windowObject:window,packageRoot:a.getPackageRoot(),Error:Error}))};$TORA.Requirement=function(){function u(H,G,F){var A={},z=[];this._$config={packageStatus:A,executionQueue:z};this._$config.onComplete=v(this);var y,J,K=((typeof(F)!=="undefined")?(arg2target=H,y=F,G):H),B=(typeof(K)!=="string")?K.length:(K=[K],1);var E={constructor:arguments.callee,prototype:arguments.callee.prototype};if(J){var I;if(I=J.initRequirements){z.push(function(){I()})}}if((B)&&(B>0)){for(var D=B-1,C;C=K[D];D--){A[C]=false;this.loadFeaturePath(C,y)}}}u.prototype.execute=function(y){if(this.checkStatus()){y()}else{this._$config.executionQueue.push(y)}};u.prototype.getRequiredPackages=$TORA.Requirement.resolve;u.prototype.loadFeaturePath=function(z,y){if(n||((!y)&&(!n))){a.loadFeature(z,this._$config.onComplete)}else{a.loadFeature(z,this._$config.onComplete,true)}};u.prototype.checkStatus=function(){var D,B=this._$config;for(var C in (D=B.packageStatus)){if(!D[C]){return false}}var y=B.executionQueue,z=y.length;B.executionQueue=[];if(z>0){for(var C=0,A;A=y[C];C++){A()}}return true};function v(z){var y=z._$config.packageStatus;return function(A){y[A]=true;z.checkStatus()}}function x(B,A,z,y){return w(new u(B,A,z))}function w(z){function y(A){z.execute(A)}y.constructor=u;y.instance=z;return y}$TORA.Requirement=function(){return x.apply(this,arguments)};$TORA.Requirement.resolve=u.prototype.getRequiredPackages;return x.apply(this,arguments)};$TORA.Requirement.resolve=function(v,u){return a.resolveFeaturePath(v,u)}});$TORA.initCoreModule=function(q,r){k[q]=r;o()};var k={"common-core":false,packaging:false};function o(){var r=$TORA._$config;for(var s in k){if(!k[s]){return}}$TORA._$tmp.CORE_RES=i;for(var s in k){var t=k[s]({resourceLocation:r.BASE_RES_LOCATION,windowObject:window,packageRoot:i,Error:Error});for(var q in t){i[q]=t[q]}}p()}function p(){for(var r=0,q;q=d[r];r++){q()}c();delete $TORA._$tmp;delete $TORA.initCoreModule;o=i=k=d=p=null}function c(){var r=[];for(var q in k){a.insert(q,i)}}})(); $TORA.initCoreModule("common-core",function(){var $package={};var $lib={common:$package};var $moduleObject=($package.object={}),$moduleString=($package.string={}),$moduleHTML=($package.html={}),$moduleDOM=($package.dom={}),$moduleXHR=($package.xhr={});$moduleObject.cloneObject=function cloneObject(o){if(typeof(o)!="object"){return o}if(o==null){return o}var newO=new o.constructor();for(var i in o){newO[i]=$moduleObject.cloneObject(o[i])}return newO};$moduleObject.each=function each(obj,process,arraysForward){if(obj){var arrLen;if((arrLen=obj.length)){if(arrLen>0){if(!arraysForward){for(var i=arrLen-1;i>=0;i--){process.call(obj[i],i)}}else{for(var i=0,k=arrLen;i0){for(var i=0,k;k=obj[i];i++){returnValue.push(k)}}}else{returnValue.push(obj)}}else{if(!useValues){for(var i in obj){returnValue.push(i)}}else{for(var i in obj){returnValue.push(obj[i])}}}}return returnValue};$moduleObject.mergeObjects=function mergeObjects(object,mergeArray,config){var p,merge=$moduleObject.mergeObjects;if(config){var cloneFn=(!(p=config.noClone)&&(typeof(p)!=="undefined"))?$moduleObject.cloneObject:null;var shallow=config.shallow||false;var clobber=config.clobber||false;var ignoreFalse=config.ignoreFalse||false}var clone=cloneFn||function(t){return t};$moduleObject.each(mergeArray,function(){for(var i in this){if(object[i]){var val=object[i],thisVal=this[i],type=val.constructor;switch(type){case Object:if((!shallow)&&(object[i])){object[i]=merge(val,[thisVal],config)}else{if((!clobber)&&(ignoreFalse)&&(thisVal==false)){continue}else{object[i]=clone(thisVal)}}break;case Array:object[i]=val.concat(thisVal);break;case String||Number||Array:if((clobber)||!((this[i]==false)&&(ignoreFalse))){object[i]=thisVal}break;default:continue}}else{object[i]=clone(this[i])}}});return object};$moduleObject.Registry=function Registry(objects,noLookupWrapper){function Registry(objects){var members=[];this._$members=members;if(!objects){var objects={}}if(!objects.length>0){members.push(objects)}else{$moduleObject.each(objects,function(){this.extend(objects)})}this._$ready=true}Registry.prototype.add=function(key,value){var returnValue,obj=this._$members[0];if(!obj[key]){obj[key]=value;returnValue=true}else{returnValue=false}return returnValue};Registry.prototype.lookup=function(prop){var e,members=this._$members;for(var i=0,k;k=members[i];i++){if((e=k[prop])!=undefined){return e}}return undefined};Registry.prototype.extend=function(object){this._$members.push(object)};Registry.prototype._$getMembers=function(){return this._$members};return($moduleObject.Registry=function(objects,noLookupWrapper){var returnValue,inst=new Registry(objects);if(!noLookupWrapper){returnValue=function registry(prop){return inst.lookup(prop)};returnValue=$moduleObject.mergeObjects(returnValue,[inst],{noClone:true})}else{returnValue=inst}return returnValue})(objects,noLookupWrapper)};$moduleObject.Mixin=function Mixin(){if(arguments.length>0){switch(arguments.length){case 2:return arguments.callee.mix(arguments[0],arguments[1]);case 1:return arguments[0];default:return arguments.callee.mix(arguments[0],Array.prototype.slice.call(arguments).slice(1))}}else{return{}}};$moduleObject.Mixin.mix=function(target,mixins){var options={noClone:true};for(var i=mixins.length-1,k;k=mixins[i];i--){for(var p in k){var e,l;if(!(e=target[p])){target[p]=k[p]}else{if(typeof((l=k[p]))=="object"){target[p]=$moduleObject.mergeObjects(e,[l],options)}}}}};$moduleObject.Config=function Config(target){function ConfigInstance(target){this._$targetList=[target];this._$defaults={};this._$properties={}}ConfigInstance.prototype.update=function(properties){$moduleObject.mergeObjects(this._$properties,[properties])};ConfigInstance.prototype.setDefaults=function(properties){$moduleObject.mergeObjects(this._$defaults,[properties])};ConfigInstance.prototype.prepare=function(target){if(target){var targetList=this._$targetList;targetList.push(target);if(target==targetList[0]){var config={},defaults=this._$defaults,properties=this._$properties;for(var i in defaults){if(!properties[i]){config[i]=defaults[i]}}for(var i in properties){config[i]=properties[i]}this._$executeOnTargets("_$checkConfig",[config]);for(var i in config){if(!target[i]){target["_$"+i]=config[i]}}this._$executeOnTargets("_$configReady")}}};ConfigInstance.prototype._$executeOnTargets=function(methodName,args){var args=args||[],targetList=this._$targetList,target=targetList[0];for(var i=1,k,m;(k=targetList[i]);i++){if((m=k[methodName])){m.apply(target,args)}}if((m=target[m])){m.apply(target,args)}};return($moduleObject.Config=function(target){return new ConfigInstance(target)})(target)};$moduleString.buildURL=function buildURL(url,data,noescape){var _URL_PARTS=/([^\?]*)(\?|)([^#]*)/;return($moduleString.buildURL=function buildUrl(url,data,noescape){var params="";for(var i in data){params+=i+"="+(!noescape?escape(data[i]):data[i])+"&"}var urlParts=url.match(_URL_PARTS);var start=(urlParts[2]!=="?")?"?":"&";return urlParts[1]+start+params.slice(0,params.length-1)+urlParts[3]})(url,data,noescape)};$moduleString.toObject=function toObject(str){var finalFunction=function toObject(str){return eval("("+str+")")};return($moduleString.toObject=function toObject(str){var returnValue;try{returnValue=finalFunction(str)}catch(e){returnValue=null}return returnValue})(str)};$moduleDOM.getElementsByClassName=function getElementsByClassName(strClassName){var arrReturnElements=[];if(this.getElementsByClassName){arrReturnElements=this.getElementsByClassName(strClassName);if(arrReturnElements){arrReturnElements=Array.prototype.slice.call(arrReturnElements)}else{arrReturnElements=[]}return arrReturnElements}else{var strTagName="*";var arrElements=(strTagName=="*"&&this.all)?this.all:this.getElementsByTagName(strTagName);if(arrElements){strClassName=strClassName.replace(/\-/g,"\\-");var oRegExp=new RegExp("(^|\\s)"+strClassName+"(\\s|$)");var oElement;for(var i=0;i0){for(var i=0,k;k=dLoadedHdlrs[i];i++){k(event)}dLoadedHdlrs=[]}}}function listenDLoaded(envType){switch(envType){case 1:window.addEventListener("DOMContentLoaded",executeDHdlrs,false);window.addEventListener("load",executeDHdlrs,false);break;case 2:ie_interval=window.setInterval(function(){try{document.documentElement.doScroll("left")}catch(e){return}executeDHdlrs(true)},100);break;case 0:finalFunction.call(window,"load",executeDHdlrs)}}return($moduleDOM.addEventListener=finalFunction)(event,listener)}).call(window,"fakeEvent",function(){});$moduleXHR.XMLHttpRequest=function(){if(window.ActiveXObject){return($moduleXHR.XMLHttpRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")})()}else{return($moduleXHR.XMLHttpRequest=function(){return new XMLHttpRequest()})()}};$moduleXHR.httpGet=function httpGet(url,callback,isSync){var xhr=$moduleXHR.XMLHttpRequest();function checkStatus(){if((xhr.readyState==4)&&(callback)){callback(xhr)}}if(!isSync){xhr.open("GET",url,true);xhr.onreadystatechange=checkStatus;xhr.send(null)}else{xhr.open("GET",url,false);xhr.send(null);checkStatus()}};return $lib}); $TORA.initCoreModule("packaging",function(c){var e={};var f={packaging:e};var d=c.packageRoot.common,a=d.object,k=a.each,g=a.toArray,l=a.cloneObject,j=a.mergeObjects,i=a.Mixin;e.PackageRegistry=function h(n){function o(r){this._$pkgdb={packageInfo:{},packageStruct:{}};this._$config={baseLocation:r}}o.prototype.registerPackages=function q(r){var s=p(this);this.registerPackages=function(t){k(t,s)};k(r,s)};o.prototype.resolvePackages=function(B,y,t,A){var r,x,v,u,w=this._$pkgdb,s=w.packageInfo;if((u=w.packageStruct[B])){if((y)&&(x=u[y])){if((t)&&(v=x[t])){u=v}else{if(x.ASSOC_PKG.length>0){u=x}}}}if(u){var z;k(u.ASSOC_PKG,function(){if((!z)&&(!s[this])){z=true}});if(!z){if(A){if(u.ASSOC_PKG.length>0){r={};k(u.ASSOC_PKG,function(){r[this]=l(w.packageInfo[this])})}else{r=null}}else{r=Array.prototype.slice.call(u.ASSOC_PKG)}}}return r||[]};o.prototype.resolveDependencies=function(s,u){var w,r,t,v=this._$pkgdb.packageInfo;if((w=v[s])){w=w.depends}else{return[]}t={};k(w,function(){var x;r=true;if((x=v[this])){t[this]=x}});return r?t:null};function p(r){function t(w,z,v){var x,y=(x=z[v])?x:(z[v]={ASSOC_PKG:[]}),u=y.ASSOC_PKG;if(w!=null){if(!w.length){u.push(w)}else{y.ASSOC_PKG=u.concat(w)}}return y}var s=r._$config.baseLocation;return function(){var u=this["direct-name"],G=this["provides-package"],w=this["file-path"],D=r._$pkgdb,v=D.packageInfo,C=D.packageStruct,F=null,x=this["provides-modules"];if(x){for(var A in x){if(typeof x[A]=="object"){F=true}break}}if((w)&&((u&&G)||(u=G))&&(!v[u])){var B,z=[u];var E=!F?z:null;v[u]=this;this["depends"]=g(this["depends"]);if((w.charAt(0)!=="/")&&(w.indexOf("http")<0)){this["file-path"]=s+w}var y=t(E,C,G);k(x,function(I){var H=t(E,y,I);k(this,function(){t(z,H,this)})})}}}e.PackageRegistry=function(r){return new o(r)};return new o(n)};e.ScriptResourceLoader=function b(n,p,r){var q=document.createElement("script");q.type="text/javascript";q.language="Javascript";function o(s,t,u){this._$config={container:document.getElementsByTagName("head")[0],location:s,type:t,lang:u}}o.prototype.getLocation=function(){return this._$config.location};o.prototype.load=function(v){var x,u=this._$config,t=q.cloneNode(false);t.src=u.location;if((x=u.lang)){t.language=x}if((x=u.type)){t.type=x}if(!v){var s=this._$config.container;s.appendChild(t)}else{var w=document.createElement("div");w.appendChild(t);document.write(w.innerHTML)}};return(e.ScriptResourceLoader=function(s,t,u){return new o(s,t,u)})(n,p,r)};e.PackageRepository=function m(o,u){function t(v,x,w){this._$config={waiting:{},packageRoot:x||{},isRequested:{},isLoaded:{}};i(this,[v])}t.prototype.loadFeature=function(C,D,x){var E=this,B,w=this._$config,v=s();var y=this._$parseFeaturePath(C);y.push(true);var A=this.resolvePackages.apply(this,y);for(var z in A){this._$loadPackages({pkgInfo:A,request:y,callback:D,now:x,rawRequest:C,additionalInfo:true});break}};t.prototype._$loadDependencies=function(D){var z=D.pkgInfo;if(z){var A=D.aditionalInfo,B=D.callback;function v(E){var F=C.resolveDependencies(E,true);if((F)&&(y=true)){j(w,[F],{shallow:true})}}var C=this,w={},y;if(A){for(var x in z){v(x)}}else{k(z,v)}if(y){this._$loadPackages({pkgInfo:w,callback:B,now:D.now})}else{B()}}};t.prototype._$loadPackages=function(E){var y=this._$config,w=E.pkgInfo,D=g(w),x=y.isRequested,v=y.isLoaded,z=y.now,A=E.request,C=this;this._$loadDependencies({pkgInfo:w,additionalInfo:true,callback:B});function B(){if((D)&&(D.length>0)){var F,G=(G=E.rawRequest)?[G]:null;(F=n(D,v,E.callback,G))();k(w,function(H){C._$monitorStatus(H,A,F);if((!v[H])&&(!x[H])){x[H]=true;r(this["file-path"],z)}},true)}else{E.callback(E.rawRequest)}}};t.prototype._$monitorStatus=function(x,z,v){var w=this._$config.packageRoot,y=((z)&&(z[2]))?true:false;this._$waitPackage(x,function(A){if((!z)||(q(w,z))){v(x,y)}})};t.prototype._$waitPackage=function(w,x){var y=this._$config.waiting,v=y[w];if(!v){if(typeof v=="undefined"){y[w]=v=[]}else{if(v==null){x(w)}return}}v.push(x)};t.prototype._$parseFeaturePath=function(x){var v=".",w="::";return(t.prototype._$parseFeaturePath=function(B){var y=B.split(v),A=y.length-1,C,z=y[A].split(w);if(z.length>0){C=z[1];y[A]=z[0]}while(y.length<2){y.push(null)}y.push(C||null);return y})(x)};t.prototype.resolveFeaturePath=function(x,w){var v=(x?this._$parseFeaturePath(x):[]);v.push(w||false);v=this.resolvePackages.apply(this,v);return v};t.prototype.insert=function(w,x){var v=this._$config;j(v.packageRoot,[x]);p(this,w);v.isLoaded[w]=true};t.prototype.getPackageRoot=function(){return this._$config.packageRoot};function r(w,v){e.ScriptResourceLoader(s()+w).load(v)}function s(){var v,w;if((w=$TORA("PAGE"))){v="http://"+w.getSiteDomain()}else{v=""}return(x=function x(){return v})()}function n(x,y,w,v){return function(C,B){if(C){y[C]=true}if(!B){for(var A=x.length-1,z;(z=x[A]);A--){if(!y[z]){return}}}w.apply(this,v||[])}}function q(x,z){var y,w=z[1],v=z[2],A=x[z[0]];if(A){if(!w){if(!v||A[v]){y=true}}else{if((A=A[w])){if((v)&&!(A=A[v])){y=false}else{y=true}}else{y=false}}}else{y=false}return y}function p(w,v){var y=w._$config.waiting,x;if((x=y[v])){delete y[v];x=x.slice();y[v]=null;k(x,function(){this(v)},true)}}e.PackageRepository=function(v,w){return new t(v,w)};return new t(o,u)};return f}); /** * TORA Library: Core Resources - Base Packages * * @author alucas Anthony_Lucas@discovery-europe.com * @projectDescription Basic package definitions * @version 0.0.1a */ $TORA.addPackages([ { //'description': "Provides user, page, and site information.", 'file-path': "environment.js", 'provides-package': "environment" }, /* COMMON PACKAGES */ { //'description': "Provides common utility methods and types.", 'direct-name': "common-core", 'file-path': "common/common_core.js", 'provides-package': "common" }, { //'description': "Provides non-core extra utility methods and types.", 'direct-name': "common-extras", 'file-path': "common/common_extras.js", 'provides-package': "common", 'provides-modules': { "object": [ "Iterator" ], "type": [ "EventObject", "EventManager" ] } }, { //'description': "Provides common AJAX components.", 'direct-name': "common-ajax", 'file-path': "common/common-type_ajax.js", 'depends': "common-core", 'provides-package': "common", 'provides-modules': { "type": [ "StateMachine", "SimpleWidget", "DataProvider" ] } }, /* EXTERNAL PACKAGES */ { //'description': "Provides a base for interaction with external sources.", 'direct-name': "external-core", 'file-path': "external/external_core.js", 'provides-package': "external", 'depends': "common-extras" }, { //'description': "Provides various interfaces for interaction with external sources.", 'direct-name': "external-interfaces", 'file-path': "external/external_interfaces.js", 'provides-package': "external", 'depends': "external-core" }, { //'description': "Provides basic advertising interfaces for site interaction.", 'direct-name': "external-advertising", 'file-path': "external/external_ads.js", 'provides-package': "external", 'provides-modules': { "advertising": [ "BasicAdvert", "USFormatAdapter" ]}, 'depends': "external-core" }, /* USER AUTHENTICATION PACKAGES */ { 'direct-name': "authentication-core", 'file-path': "/resources/ua/js/authentication.js", 'depends': "environment", 'provides-package': "authentication", 'provides-modules': { "core": true } }, { 'direct-name': "authentication-fb", 'file-path': "/resources/ua/js/authentication-fb.js", 'depends': "authentication-core", 'provides-package': "authentication", 'provides-modules': { "fb": true } }, /* PAGE REPORTING PACKAGES */ { 'direct-name': "reporting-core", 'file-path': "reporting/reporting_core.js", 'provides-package': "reporting" }, { 'direct-name': "reporting-basic", 'file-path': "reporting/reporting_basic.js", 'depends': "reporting-core", 'provides-package': "reporting", 'provides-modules': { "processors": [ "NetworkInfoProcessor", "ComscoreProcessor", "OmnitureProcessor" ], "dispatchers": [ "ComscoreDispatcher", "OmnitureDispatcher" ] } }, /* PHOTO GALLERY PACKAGES */ { 'direct-name': "photogallery-core", 'file-path': "/resources/photogallery/js/photogallery_core.js", 'depends': "common-extras", 'provides-package': "photogallery", 'provides-modules': { "ui": true, "data": true } }, { 'direct-name': "photogallery-hp", 'file-path': "/resources/photogallery/js/photogallery_hp.js", 'depends': [ "photogallery-core", "common-ajax", "ui-core", "thirdparty-addthis" ], 'provides-package': "photogallery", 'provides-modules': { "ui": [ "LightGalleryWidget" ] } }, /* VIDEO PACKAGES */ { 'direct-name': "video", 'file-path': "/resources/video/js/video-package.js", 'depends': "common-extras", 'provides-package': "video" }, /* INTERESTGROUPS PACKAGES */ { 'direct-name': "games-scores", 'file-path': "/resources/igroups/js/games/games-scores.js", 'depends': "common-ajax", 'provides-package': "games", 'provides-modules': { "scores": true } }, { 'file-path': "/resources/igroups/js/shuffle/shuffle.js", 'depends': [ "common-ajax", "thirdparty-addthis" ], 'provides-package': "shuffle" }, /* UTILITY PACKAGES */ { 'direct-name': "content-common", 'file-path': "content-common.js", 'provides-package': "content", 'provides-modules': { "common": true } }, { 'direct-name': "content-frames", 'file-path': "content-frames.js", 'depends': "external-interfaces", 'provides-package': "content", 'provides-modules': { "frames": true } }, { 'direct-name': "advertising", 'file-path': "advertising.js", 'provides-package': "advertising" }, { // 'description': "Provides a core UI framework", 'direct-name': "ui-core", 'file-path': "ui/ui_core.js", 'provides-package': "ui", 'provides-modules': { "control": true, "animation": true } }, { // 'description': "Provides common UI widget types", 'direct-name': "ui-widget", 'file-path': "ui/ui-widget.js", 'provides-package': "ui", 'provides-modules': { "widget": true } }, { 'file-path': "/resources/feedback/js/feedback.js", 'provides-package': "validation" }, /* THIRD PARTY PACKAGES */ { 'direct-name': "thirdparty-addthis", 'file-path': "thirdparty/addthis/thirdparty-addthis.js", 'provides-package': "3rdparty.AddThis" }, { 'direct-name': "thirdparty-omniture", 'file-path': "thirdparty/omniture/thirdparty-omniture.js", 'provides-package': "3rdparty", 'provides-modules': { "omniture": true } } ]); } })(); if (!$TORA.configured) { $TORA.configured = true; (function() { /** * $Id$ * * Project: DNI Javascript Site Configuration: * Discovery Kids Brasil * Version: 0.0.2 * Author: alucas * */ //#SET SITE DEFAULTS //#SITE INITIALISATION $TORA.Requirement(null, [ "environment::PageContext", "authentication"], true); if (window.$TORA) { var sc = "(none)"; if (sc == "(none)") sc = ""; $TORA.registry().add("siteCode", sc); } })(); }