6 lines
172 KiB
JavaScript
6 lines
172 KiB
JavaScript
|
var App=App||{};App.i18n=App.i18n||{};(function(){App.getParam=function(name){var regex=new RegExp("[?|&]"+name+"="+"([^&;]+?)(&|#|;|$)"),parentWindow=window.parent===window.top?window.parent:window.parent.parent,results=null;try{results=regex.exec(parentWindow.location.search)}catch(e){}if(results&&results[1]){return decodeURIComponent(results[1])}return null};App.flow=function(state,data,topFrame){var flowEngineUrl=App.frontEndBucket.protocol+"://flow."+App.brand.domain+"/"+state;$.ajax(flowEngineUrl,{async:true,data:data,dataType:"jsonp",success:function(response){var redirectUrl=response.url;if(topFrame){window.top.location.href=redirectUrl;return}window.location.href=redirectUrl}})};App.t=function(key,fallback){var $lib=$||bk$,translateIt=App.getParam("translate"),base=fallback||"",parts,section,args,translated,values="DEFAULT",keypart,thisTrans;if(key){parts=key.split(".");section=parts.shift();keypart=parts.join(".")}if(typeof App.i18n[section]!=="undefined"&&typeof App.i18n[section][keypart]!=="undefined"){if(App.i18n[section][keypart].length>0){base=App.i18n[section][keypart]}}args=[].slice.call(arguments,1);args=$lib.map(args,function(n){return n});translated=base.replace(/%([0-9]+)/g,function(match,found,offset,original){return args[found]!==undefined?args[found]:""});if(translateIt==="debugvalues"){thisTrans=App.i18n[section]!==undefined&&App.i18n[section][keypart]!==undefined?App.i18n[section][keypart]:undefined;if(thisTrans===""){values="MASTER"}else if(thisTrans){values="TRANSLATED"}return values}else if(translateIt==="debugkeys"){return key}return translated};App.formatUrl=function(string){if(typeof string==="string"){string=string.replace(/[^a-zA-Z0-9 -]/g,"").replace(/\s+/g,"-").toLowerCase();return string.charAt(string.length-1)==="-"?string.substring(0,string.length-1):string}};App.formatBlogDate=function(iso_date,lang){var locale=lang||App.user.languageCode,formatted;if(typeof iso_date!=="string"){return false}formatted=moment(iso_date).lang(locale).format("DD MMMM YYYY");return formatted};App.getPHPDate=function(format,date){var d=new Date(date);if(typeof format!=="string"){format="c"}return d.format(format)};App.render=function(templateName,callback){var constructor=window[templateName];if(typeof constructor==="function"){callback(generateTemplateCallbackClosure(constructor))}else{loadTemplateFromServer(templateName,function(constructor){if(typeof constructor!=="function"){throw new Error("Failed to load template: "+templateName)}callback(generateTemplateCallbackClosure(constructor))})}};App.templateQueues={};function generateTemplateCallbackClosure(templateConstructor){return function(parameters){return Twig.render(templateConstructor,parameters)}}function loadTemplateFromServer(templateName,callback){if(typeof App.templateQueues[templateName]==="undefined"){App.templateQueues[templateName]=[callback];sendTemplateRequest(templateName)}else{App.templateQueues[templateName].push(callback)}}function sendTemplateRequest(templateName){var templateUrl=App.assetBaseUrl()+"/twig-templates/"+templateName;$.ajax({url:templateUrl,cache:false,dataType:"script",success:function(){processTemplateQueue(templateName)}})}function processTemplateQueue(templateName){var constructor=window[templateName];while(App.templateQueues[templateName].length>0){App.templateQueues[templateName].shift()(constructor)}}App.getErrorsFromResponse=function(response){var phraseAppNameSpace="global_v7.errors.",errorMessages=[],responseObj;if(response.responseText){responseObj=jQuery.parseJSON(response.responseText);if(responseObj.messageTemplates){$.each(responseObj.messageTemplates,function(field,errorTemplates){$.each(errorTemplates.templates,function(type,template){var replacements=[],args=[phraseAppNameSpace+type,template],message,messageObj={};if(errorTemplates.values){$.each(errorTemplates.values[type],function(i,stringValue){replacements.push(stringValue)})}args=args.concat(replacements);message=App.t.apply(App,args);messageObj.field=field;messageObj.message=message;errorMessages.push(messageObj)})})}}return errorMessages};App.
|
||
|
var ae=U(j.body);if(ae!==Z){Z=ae;ab.push(ac={el:ae,out:[]})}ac.out.push(af)};E.onLoad(function(){var ah,ak,af,aj,ai;Q=G(Q);ai=Q.done;Q.done=function(){j.write=aa;j.writeln=ad;if(ai){ai()}};for(var ag=0,ae=ab.length;ag<ae;ag++){ah=ab[ag].el;ak=j.createElement("div");ah.parentNode.insertBefore(ak,ah.nextSibling);af=ab[ag].out.join("");aj=ae-ag===1?R(af,Q):R(af);E.replaceWith(ak,aj)}})}var t="writeCapture";var o=a[t]={_original:a[t],fixUrls:function(Q){return Q.replace(/&/g,"&")},noConflict:function(){a[t]=this._original;return this},debug:y,proxyGetElementById:false,_forTest:{Q:i,GLOBAL_Q:z,$:E,matchAttr:k,slice:u,capture:x,uncapture:V,captureWrite:S},replaceWith:function(Q,aa,Z){E.replaceWith(Q,R(aa,Z))},html:function(Q,ab,Z){var aa=E.$(Q);aa.innerHTML="<span/>";E.replaceWith(aa.firstChild,R(ab,Z))},load:function(Q,aa,Z){E.ajax({url:aa,dataType:"text",type:"GET",success:function(ab){o.html(Q,ab,Z)}})},autoAsync:h,sanitize:R,sanitizeSerial:F}})(this.writeCaptureSupport,this);(function(g,d,n){var c={html:h};g.each(["append","prepend","after","before","wrap","wrapAll","replaceWith","wrapInner"],function(){c[this]=i(this)});function a(q){return Object.prototype.toString.call(q)=="[object String]"}function p(u,t,s,r){if(arguments.length==0){return o.call(this)}var q=c[u];if(u=="load"){return l.call(this,t,s,r)}if(!q){j(u)}return b.call(this,t,s,q)}g.fn.writeCapture=p;var k="__writeCaptureJsProxied-fghebd__";function o(){if(this[k]){return this}var r=this;function q(){var t=this,s=false;this[k]=true;g.each(c,function(v){var u=r[v];if(!u){return}t[v]=function(y,x,w){if(!s&&a(y)){try{s=true;return p.call(t,v,y,x,w)}finally{s=false}}return u.apply(t,arguments)}});this.pushStack=function(){return o.call(r.pushStack.apply(t,arguments))};this.endCapture=function(){return r}}q.prototype=r;return new q}function b(t,s,u){var q,r=this;if(s&&s.done){q=s.done;delete s.done}else{if(g.isFunction(s)){q=s;s=null}}d.sanitizeSerial(g.map(this,function(v){return{html:t,options:s,action:function(w){u.call(v,w)}}}),q&&function(){q.call(r)}||q);return this}function h(q){g(this).html(q)}function i(q){return function(r){g(this)[q](r)}}function l(t,s,v){var r=this,q,u=t.indexOf(" ");if(u>=0){q=t.slice(u,t.length);t=t.slice(0,u)}if(g.isFunction(v)){s=s||{};s.done=v}return g.ajax({url:t,type:s&&s.type||"GET",dataType:"html",data:s&&s.params,complete:f(r,s,q)})}function f(r,s,q){return function(u,t){if(t=="success"||t=="notmodified"){var v=m(u.responseText,q);b.call(r,v,s,h)}}}var e=/jquery-writeCapture-script-placeholder-(\d+)-wc/g;function m(s,r){if(!r||!s){return s}var t=0,q={};return g("<div/>").append(s.replace(/<script(.|\s)*?\/script>/g,function(u){q[t]=u;return"jquery-writeCapture-script-placeholder-"+t++ +"-wc"})).find(r).html().replace(e,function(u,v){return q[v]})}function j(q){throw"invalid method parameter "+q}g.writeCapture=d})(jQuery,writeCapture.noConflict());(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r
|
||
|
document.cookie="bk-cookie-warning=true; max-age=315360000";var cookieWarningContainer=document.createElement("div"),cookieWarningParagraph=document.createElement("p"),cookieWarningLink=document.createElement("a"),cookieWarningCloseButton=document.createElement("a"),removeWarning=function(e){e.preventDefault();cookieWarningContainer.parentNode.removeChild(cookieWarningContainer)},clickWarning=function(e){removeWarning(e);window.open(cookieWarningUrl)};cookieWarningLink.href=cookieWarningUrl;setText(cookieWarningLink,App.t("cookie.link_text","Find out more."));if(cookieWarningLink.addEventListener){cookieWarningLink.addEventListener("click",clickWarning,false)}else{cookieWarningLink.attachEvent("onclick",clickWarning)}cookieWarningCloseButton.className="bk-cookie-close-button";cookieWarningCloseButton.innerHTML="✕";cookieWarningCloseButton.href="#null";if(cookieWarningCloseButton.addEventListener){cookieWarningCloseButton.addEventListener("click",removeWarning,false)}else{cookieWarningCloseButton.attachEvent("onclick",removeWarning)}setText(cookieWarningParagraph,App.t("cookie.warning_text","This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies."));cookieWarningParagraph.innerHTML+=" ";cookieWarningParagraph.appendChild(cookieWarningLink);cookieWarningContainer.className="bk-cookie-container";cookieWarningContainer.appendChild(cookieWarningParagraph);cookieWarningContainer.appendChild(cookieWarningCloseButton);document.body.appendChild(cookieWarningContainer)}})(App,Server.cookieWarningUrl);(function(){bk$.fn.extend({getParentId:function(){var self=bk$(this),parentId=self.parent().attr("id");return parentId},getRect:function(){var el=bk$(this).first(),rect=null;if(!el.is(":visible")){return null}rect=el.offset();rect.right=rect.left+el.outerWidth();rect.bottom=rect.top+el.outerHeight();return rect},compare:function(selector){return bk$(this).get(0)===bk$(selector).get(0)}})})();(function(){BaseKit.Component=function(scope,args,options){$lib=typeof bk$==="function"?bk$:$;if(options===null){return scope}scope.self=scope.el=$lib(args[0]);scope.scope=scope;$lib.extend(true,scope,{renderTemplate:function(templateId,values,postRender,doRender,callback,doEvents){var content=null,templateName=null;if(typeof templateId!=="string"){throw new Error("renderTemplate first parameter error: expecting twig template name")}if(typeof values!=="object"){throw new Error("renderTemplate second parameter error: expecting object")}postRender=typeof postRender==="boolean"&&postRender===true?true:false;doRender=typeof doRender==="boolean"&&doRender===false?false:true;doEvents=typeof doEvents==="boolean"&&doEvents===false?false:true;if(typeof App==="object"&&typeof App.render==="function"){templateName=templateId.replace(/\./g,"_");App.render(templateName,function(tpl){if(typeof tpl==="function"){if(values!==null&&typeof values==="object"){content=tpl(values)}else if(typeof values==="boolean"){postRender=values;content=tpl()}else{content=tpl()}if(doRender===true){$lib(scope.el).html(content)}if(postRender===true&&typeof scope.postRender==="function"){scope.postRender(content)}if(doEvents===true&&typeof scope.attachEvents==="function"){scope.attachEvents()}if(callback&&typeof callback==="function"){callback.call(scope,content)}}return content})}}});$lib.extend(true,scope,{postRender:function(content){if(typeof this.renderFinish==="function"){var that=this,lastLength=0,strikes=0;BaseKit.Util.waitsFor(function(){var loadingHTML=$lib(scope.el).html(),expectedHTML=typeof content==="object"?$lib(content).html().toString():content,loadingLength=0,expectedLength=0;if(loadingHTML===null||loadingHTML.replace===undefined){return false}loadingLength=loadingHTML.replace(/\s/g,"").length;expectedLength=expectedHTML.replace(/\s/g,"").length;if(loadingLength!==expectedLength){if(loadingLength===lastLength){strikes+=1}lastLength=loadingLength;if(strikes===3){return true}return false}else{return true}},function(){lastLength=0;strikes=0;that.renderFinish(content)},function(){lastLength=0;strikes=0;throw new Error("Ed
|
||
|
if(link===undefined||link.length===0){alert(App.t("widgets.dropbox.no_file_added","No file added"))}else{window.open(link)}})}};BaseKit.Widget.Dropbox=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.DropboxProperties,methods:BaseKit.Widget.DropboxMethods})};bk$.fn.basekitWidgetDropbox=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Dropbox(el,options))})}})();(function(){BaseKit.Widget.Ecombasket=null;BaseKit.Widget.EcombasketProperties={};BaseKit.Widget.EcombasketMethods={construct:function(el,options){this.options=options;if(!Server.plugins.ecommerce){return}this.load()},load:function(){var that=this;Globals.addHook("ecom.basket.changed",this,function(cart){that.updateBasket(cart)});this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el);thisEl.find(".js-pull").on("click",function(){thisEl.toggleClass("show-content");bk$(document).on("click.ecombasket",function(evt){if(!bk$(evt.target).closest(".ecombasket").length){thisEl.toggleClass("show-content");bk$(document).off("click.ecombasket")}})});thisEl.find(".js-remove").on("click",function(e){that.removeItem(bk$(e.target).attr("data-ref"))})},updateBasket:function(cart){this.set("items",cart.items,true);this.set("itemCount",cart.itemCount,true);this.set("subTotal",cart.subTotal,true);this.set("subTotalInclTax",cart.subTotalInclTax,true);this.rerender()},removeItem:function(ref){bk$.ajax({method:"POST",url:"/store/cart/remove-item",data:{productVariantRef:ref}}).done(function(response){Globals.notifyHooks("ecom.basket.changed",response)})}};BaseKit.Widget.Ecombasket=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcombasketProperties,methods:BaseKit.Widget.EcombasketMethods})};bk$.fn.basekitWidgetEcombasket=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecombasket(el,options))})}})();(function(){BaseKit.Widget.Ecombasketsummary=null;BaseKit.Widget.EcombasketsummaryProperties={sitePrimaryDomain:Server.app.mode!=="edit"?Server.desktopSite.getPrimaryDomain():null};BaseKit.Widget.EcombasketsummaryMethods={construct:function(el,options){this.options=options;if(!Server.plugins.ecommerce){return}this.load()},load:function(){var that=this;Globals.addHook("ecom.basket.changed",this,function(cart){that.updateBasketSummary(cart)});this.attachEvents();this.set("emptyItems",this.getEmptyItems(Server.plugins.ecommerce.cart.items),true)},attachEvents:function(){var that=this;bk$(this.el).find(".js-add").off("click").on("click",function(e){that.addItem(bk$(this).data("ref"))});bk$(this.el).find(".js-remove").off("click").on("click",function(e){that.removeItem(bk$(this).data("ref"))})},updateBasketSummary:function(cart){cart.items=_.union(cart.items,this.get("emptyItems"));this.set("items",cart.items,true);this.set("itemCount",cart.itemCount,true);this.set("subTotal",cart.subTotal,true);this.set("subTotalInclTax",cart.subTotalInclTax,true);this.rerender()},removeItem:function(ref){var that=this;bk$.ajax({method:"POST",url:"/store/cart/remove-item",data:{productVariantRef:ref}}).done(function(response){that.removeEmptyItem(ref);Globals.notifyHooks("ecom.basket.changed",response)})},addItem:function(ref){bk$(this.el).find(".js-add").attr("disabled",true);bk$.ajax({method:"POST",url:"/store/cart/add-item",data:{productVariantRef:ref}}).done(function(response){Globals.notifyHooks("ecom.basket.changed",response)})},removeEmptyItem:function(ref){var emptyItems=_.filter(this.get("emptyItems"),function(item){return item.ref!==ref});this.set("emptyItems",emptyItems,true)},getEmptyItems:function(items){return _.filter(items,function(item){return item.quantity===0})}};BaseKit.Widget.Ecombasketsummary=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcombasketsummaryProperties,methods:BaseKit.Widget.EcombasketsummaryMethods})};bk$.fn.basekitWidgetEcombasketsummary=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecombasketsummary(el,options))})}})();(function(){Base
|
||
|
methods:BaseKit.Widget.LinkedinprofileMethods})};bk$.fn.basekitWidgetLinkedinprofile=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Linkedinprofile(el,options))})}})();(function(){BaseKit.Widget.Logo=null;BaseKit.Widget.LogoProperties={};BaseKit.Widget.LogoMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Logo=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.LogoProperties,methods:BaseKit.Widget.LogoMethods})};bk$.fn.basekitWidgetLogo=function(options){this.each(function(index,el){var obj=null;obj=new BaseKit.Widget.Logo(el,options);bk$(el).data("bkob",obj)})}})();(function(){BaseKit.Widget.Map={};BaseKit.Widget.MapProperties={zoom:12,zoomControl:true,height:150,address:"profile",markerPath:"/apps/images/mobile/map-marker.png"};BaseKit.Widget.MapMethods={construct:function(el,options){this.gmap=null;this.marker=null;if(window.mapReady===undefined){window.mapReady=function(){Site.Page.Globals.mapsAPILoaded=true}}if(Site.Page.Globals.mapsAPILoaded===undefined||Site.Page.Globals.mapsAPILoaded===null){Site.Page.Globals.mapsAPILoaded=false}this.load()},load:function(){var t=false,that=this,script;this.onResize=function(){if(t!==false){clearTimeout(t)}t=setTimeout(function(){that.resetMap()},300)};bk$(window).on("resize.map",this.onResize);if(Site.Page.Globals.mapsAPILoaded===false&&bk$("#gmaps-widget-script").length===0){script=document.createElement("script");script.type="text/javascript";script.id="gmaps-widget-script";script.src="https://maps.google.com/maps/api/js?sensor=false&callback=mapReady&language="+App.session.get("languageCode");document.body.appendChild(script)}this.isMapReady()},getProfileAddress:function(){return[Profile.get("address"),Profile.get("address1"),Profile.get("address2"),Profile.get("postalcode")].filter(function(element,index){if(typeof element==="string"){return!!element.trim()}return false}).join(", ")},isMapReady:function(){var that=this;if(Site.Page.Globals.mapsAPILoaded===false){setTimeout(function(){that.isMapReady()},100)}else{this.findAndSetAddress({source:"profile",value:this.getProfileAddress()},this.setupMap,this)}},setupMap:function(){var mapOptions={zoom:parseInt(this.get("zoom"),10),center:new google.maps.LatLng(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10)),scaleControl:false,mapTypeControl:false,overviewMapControl:false,zoomControl:!!this.get("zoomControl"),zoomControlOptions:{style:google.maps.ZoomControlStyle.DEFAULT},panControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP};bk$(this.el).find(".js-map").height(this.get("height"));this.gmap=new google.maps.Map(bk$(this.el).find(".js-map").get(0),mapOptions);this.resetMap()},resetMap:function(){if(this.gmap!==null&&Site.Page.Globals.mapsAPILoaded===true){if(this.get("mapLatitude")===null||this.get("mapLongitude")===null){this.findAndSetAddress({source:"profile",value:this.getProfileAddress()},this.loadMap,this)}else{this.loadMap()}}},loadMap:function(){var newCenter=null;bk$(this.el).find(".js-map").height(this.get("height"));newCenter=new google.maps.LatLng(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10));this.gmap.setZoom(parseInt(this.get("zoom"),10));this.gmap.setCenter(newCenter);this.createMapMarker(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10),false)},createMapMarker:function(latitude,longitude,draggable){var icon=new google.maps.MarkerImage(App.session.get("assetBaseUrl")+this.get("markerPath"),new google.maps.Size(32,32),null,new google.maps.Point(16,32),new google.maps.Size(32,32));if(this.marker===null){this.marker=new google.maps.Marker({icon:icon,bouncy:true,draggable:false,autoPan:true,position:new google.maps.LatLng(latitude,longitude)});this.marker.setMap(this.gmap)}else{this.marker.setMap(null);this.marker.draggable=draggable||false;this.marker.setPosition(new google.maps.LatLng(latitude,longitude));this.marker.setMap(this.gmap)}},findAndSetAddress:function(address,callback,scope){if(typeof a
|
||
|
})};bk$.fn.basekitWidgetSoundcloud=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Soundcloud(el,options))})}})();(function(){BaseKit.Widget.Space={};BaseKit.Widget.SpaceProperties={height:"50"};BaseKit.Widget.SpaceMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Space=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.SpaceProperties,methods:BaseKit.Widget.SpaceMethods})};bk$.fn.basekitWidgetSpace=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Space(el,options))})}})();(function(){BaseKit.Widget.Tweet=null;BaseKit.Widget.TweetProperties={linkText:App.t("widgets.tweet.default_link_text","Tweet"),align:""};BaseKit.Widget.TweetMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Tweet=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.TweetProperties,methods:BaseKit.Widget.TweetMethods})};bk$.fn.basekitWidgetTweet=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Tweet(el,options))})}})();(function(){BaseKit.Widget.Twitter=null;BaseKit.Widget.TwitterProperties={count:"3",refreshTime:"1800000",includeRts:"1",searchKey:"profile",searchType:"username",defaultSearchKey:"basekit"};BaseKit.Widget.TwitterMethods={construct:function(){this.refreshInterval="";this.load()},load:function(){this.refreshTimeline();this.getUpdateTwitterFeed()},refreshTimeline:function(){var that=this,refreshTime=this.get("refreshTime")>0?parseInt(this.get("refreshTime"),10):18e5;if(this.refreshInterval!==""){window.clearInterval(this.refreshInterval);this.refreshInterval=""}this.refreshInterval=window.setInterval(function(){try{that.getUpdateTwitterFeed()}catch(err){clearInterval(that.refreshInterval);console.log(err)}},refreshTime)},getUpdateTwitterFeed:function(){var that=this,url="/_bk/fetch-feed",createdDate=null,tweetData=[],data={count:this.get("count")>0?this.get("count"):3,includeRts:this.get("includeRts")!==null?this.get("includeRts"):true,searchKey:this.get("searchType")==="username"?Profile.get("twitter"):this.get("searchKey"),searchType:this.get("searchType")};if(this.get("searchKey")==="profile"&&(Profile.get("twitter")===null||Profile.get("twitter").length===0)||(this.get("searchKey")===null||this.get("searchKey").length===0)){data.searchKey=this.get("defaultSearchKey")}bk$.ajax({url:url,type:"POST",data:data,beforeSend:function(){that.el.find(".js-twitter").html("<li>"+App.t("widgets.twitter.retrieving_tweets","Retrieving Tweets")+"</li>")}}).done(function(response,status){bk$.each(response,function(){createdDate=this.created_at;createdDate=createdDate.split(" ");tweetData.push({screenName:this.user.screen_name,createdAt:createdDate[2]+" "+createdDate[1]+" "+createdDate[5],fullName:this.user.name,imageUrl:this.user.profile_image_url,source:this.source,text:this.text,retweetUser:this.retweetUser})});that.set("tweets",tweetData,true);that.rerender()}).fail(function(){that.set("tweets",[],true);that.rerender()})}};BaseKit.Widget.Twitter=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.TwitterProperties,methods:BaseKit.Widget.TwitterMethods})};bk$.fn.basekitWidgetTwitter=function(options){this.each(function(){bk$(this).data("bkob",new BaseKit.Widget.Twitter(this,options))})}})();(function(){BaseKit.Widget.Userlogin=null;BaseKit.Widget.UserloginProperties={align:"",email:"profile",text:App.t("widgets.userlogin.default_button_text","Login"),allowPersistentLogin:true};BaseKit.Widget.UserloginMethods={construct:function(el,options){this.load()},load:function(){var persist=window.localStorage.getItem("bk.widgets.login.persist");if(bk$(this.el).find(".js-persist-login").length&&persist==="false"){bk$(this.el).find(".js-persist-login").prop("checked",false)}this.attachEvents()},showOverlay:function(message){message=message||"message";var thisEl=bk$(this.el),overlayEl=thisEl.find(".js-overlay");overlayEl.find(".message").html(message
|