JAVASCRIPT   30

common.js

Guest on 4th August 2021 02:32:17 PM

  1. var SINGLE_CLICK="singleClick",DOUBLE_CLICK="doubleClick",WAIT_FOR_DOUBLE_CLICK_TIMEOUT=250,MS_CLICKED_ONCE="clickedOnce";
  2. function setClickEvents(a,c,b){function d(a,c,b){c.changedTouches&&(c=c.changedTouches[0]);a.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,c.ctrlKey,c.altKey,c.shiftKey,c.metaKey,0,null)}var b=b?b:!1,e=!1,f=!1;if(!0===c||!1===c)j=c;else var j=c?-1!=c.indexOf("d"):!1,h=c?-1!=c.indexOf("m"):!1,e=c?-1!=c.indexOf("s"):!1,f=c?-1!=c.indexOf("p"):!1;a.ondblclick=function(a){a.preventDefault();return!1};var m=function(c){function p(){a.removeEventListener(r,u,b);a.removeEventListener(k,
  3. o,b);a.removeEventListener("touchcancel",t)}var r;if(!c.ctrlKey&&!c.altKey&&!c.shiftKey){if("touchstart"==c.type){a.removeEventListener("mousedown",m,b);var k="touchend";r="touchmove"}else k="mouseup",r="mousemove",a.removeEventListener("touchstart",m,b);if(a.mstate==MS_CLICKED_ONCE){window.clearTimeout(a.resetClickTimeout);a.mstate="";var l=function(c){var h=document.createEvent("MouseEvent");d(h,c,DOUBLE_CLICK);a.dispatchEvent(h);a.removeEventListener(k,l,b);p();f&&c.preventDefault();if(e)return c.stopPropagation(),
  4. !1};j&&a.addEventListener(k,l,b);f&&c.preventDefault()}else{var o=function(c){a.removeEventListener(k,o,b);var h=document.createEvent("MouseEvent");d(h,c,SINGLE_CLICK);j?(a.mstate=MS_CLICKED_ONCE,a.resetClickTimeout=setTimeout(function(){a.dispatchEvent(h);p();a.mstate=""},WAIT_FOR_DOUBLE_CLICK_TIMEOUT)):(a.dispatchEvent(h),p(),a.mstate="");if(e)return c.stopPropagation(),!1};a.addEventListener(k,o,b);a.addEventListener("touchcancel",t,!1);var t=function(){p();a.mstate=""};if(h){if(!Modernizr.touch)var q=
  5. c.clientX,s=c.clientY;var u=function(c){if(Modernizr.touch||q!=c.clientX||s!=c.clientY)p(),a.mstate=""};a.addEventListener(r,u,b)}}if(e)return c.stopPropagation(),!1}};a.addEventListener(DOWN_EVENT,m,b)}
  6. function mouseHandler(a){var c="";switch(a.type){case "mousedown":c="touchstart";break;case "mousemove":c="touchmove";break;case "mouseup":c="touchend";break;default:return}var b=[{screenX:a.screenX,screenY:a.screenY,clientX:a.clientX,clientY:a.clientY}],d=document.createEvent("MouseEvent");d.initMouseEvent(c,!0,!0,window,1,a.screenX,a.screenY,a.clientX,a.clientY,!1,!1,!1,!1,1,null);d.simulated=!0;d.touches=b;d.targetTouches=b;d.changedTouches=b;a.target.dispatchEvent(d);a.preventDefault();a.stopPropagation();
  7. return!1}function redirectGlobalEvents(){}
  8. function testCrossEvents(){redirectGlobalEvents();setClickEvents(document.getElementById("test"),!1);setClickEvents(document.getElementById("Div2"),!0);document.getElementById("Div2").addEventListener(DOUBLE_CLICK,function(a){document.getElementById("log").innerHTML+="btn"+a.type+a.screenX+a.currentTarget.id+"<br>";return!1});document.getElementById("test").addEventListener(SINGLE_CLICK,function(a){document.getElementById("log").innerHTML+="div"+a.type+a.screenX+"<br>";return!1});document.getElementById("test").addEventListener("touchstart",
  9. function(a){document.getElementById("log").innerHTML+="touch "+a.touches+"<br>";return!1})}function initCrossEvents(){if(Modernizr){var a=Modernizr.touch;DOWN_EVENT=a?"touchstart":"mousedown";UP_EVENT=a?"touchend":"mouseup";MOVE_EVENT=a?"touchmove":"mousemove"}else console.log("Modernizr is undefined");window.fconsole=new FBConsole;window.showConsole=function(){window.fconsole.append()};fconsole.log("display:",window.DISPLAY_SIZE)}
  10. var browser={name:"",version:"",platform:"",publisher:"",scale:1,detect:function(){var a=navigator.userAgent.toLowerCase(),c=navigator.platform.toLowerCase(),b=a.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/)||[null,"unknown",0],d="ie"==b[1]&&document.documentMode;browser.name="version"==b[1]?b[3]:b[1];browser.version=d||parseFloat("opera"==b[1]&&b[4]?b[4]:b[2]);browser.platform={name:a.match(/ip(?:ad|od|hone)/)?"ios":a.match(/(?:msie 9)/)?"wphone":
  11. (a.match(/(?:webos|android|bada|symbian|palm|blackberry)/)||c.match(/mac|win|linux/)||["other"])[0]};browser.device=a.match(/ipad/)?"iPad":a.match(/iphone/)?"iPhone":a.match(/android/)?"android":!1;browser.publisher={};try{browser.publisher.deviceName=preview.get_Type(),browser.publisher.orientation=preview.get_Orientation(),browser.publisher.isOn=!0}catch(e){}browser[browser.name]=!0;browser[browser.name+parseInt(browser.version,10)]=!0;browser.platform[browser.platform.name]=!0}};ADD_BM="addBm";
  12. REMOVE_BM="removeBm";START_SEARCH="startSearch";CANCEL_SEARCH="cancelSearch";SHOW_SEARCH_RESULTS="showSearchResults";ZOOMIN_FROM_WORKSPACE="zoomInFromWorkspace";ZOOMOUT_FROM_WORKSPACE="zoomOutFromWorkspace";BOOK_FLIPPING_START="bookFlippingStart";BOOK_FLIPPING_END="bookFlippingEnd";CHANGE_BOOK_TYPE="changeBookType";SLIDER_TO_PAGER_CHANGE_LABEL="sliderToPagerChangeLabel";ROTATE_DEVICE="rotateDevice";DOUBLE_TAP_FROM_WORKSPACE="double_tap_from_workspace";IOS_LOAD_PAGE_START="iOSLoadPageStart";
  13. IOS_LOAD_VECTOR_END="iOSLoadVectorEnd";IOS_LOAD_BITMAP_END="iOSLoadBitmapEnd";IOS_FULLSCREEN="iOSFullScreen";ANDROID_PAGE_CONTENT_LOAD_COMPLETE="ANDROID_PAGE_CONTENT_LOAD_COMPLETE";ANDROID_PAGE_PREPARED="ANDROID_PAGE_PREPARED";ZOOM_ANIMATION_START="zoom_animation_start";ZOOM_ANIMATION_END="zoom_animation_end";ZOOM_ANIMATION_END_TO_ONE="zoom_animation_end_to_one";ZOOM_ANIMATION_END_TO_TWO="zoom_animation_end_to_two";ZOOM_ZOOM_ANIMATION_END="ZOOM_ZOOM_ANIMATION_END";START_ZOOM_PRELOADER="startZoomPreloader";
  14. STOP_ZOOM_PRELOADER="stopZoomPreloader";ZOOM_LEVEL_CHANGED_FOR_WORKSPACE="zoom_level_changed_for_workspace";SEND_STATISTICS="send_statistics";PAGE_CONTENT_DISPLAYED="page_content_displayed";function CustomEvents(){this._listeners={}}
  15. CustomEvents.prototype={addEvent:function(){throw Error("obsolete function");},removeEvent:function(){throw Error("obsolete function");},addListener:function(a,c){void 0==this._listeners[a]&&(this._listeners[a]=[]);this._listeners[a].push(c);return!0},removeListener:function(a,c){if(void 0==this._listeners[a])return!1;var b=this._listeners[a].indexOf(c);if(-1!=b)this._listeners[a].splice(b,1);else return!1;return!0},fireEvent:function(a,c){if(void 0!=this._listeners[a])for(var b=0,d=this._listeners[a].length;b<
  16. d;b++)void 0!=this._listeners[a][b]&&this._listeners[a][b].call(this,{type:a,data:c})}};customEvents=new CustomEvents;
  17. var sendPage=function(){var a=window.location.hash.replace("#",""),c=window.location.hostname+window.location.pathname;GAEnable&&PUBL&&_trackPageview(c+"-"+pageTable.getUserIDFromFileID(a))},sendZoomIn=function(){var a=window.location.hash.replace("#",""),c=window.location.hostname+window.location.pathname;sendPage();GAEnable&&PUBL&&_trackEvent(c+"","Zooming","page"+a)},sendZoomOut=function(){var a=window.location.hash.replace("#",""),c=window.location.hostname+window.location.pathname;sendPage();
  18. GAEnable&&PUBL&&_trackEvent(c+"","Zooming out","page"+a)};customEvents.addListener(BOOK_FLIPPING_END,sendPage);customEvents.addListener(ZOOM_ANIMATION_END,sendZoomIn);customEvents.addListener(ZOOM_ANIMATION_END_TO_ONE,sendZoomOut);customEvents.addListener(ZOOM_ANIMATION_END_TO_TWO,sendZoomOut);customEvents.addListener(ANDROID_PAGE_PREPARED,sendPage);customEvents.addListener(ZOOMIN_FROM_WORKSPACE,sendZoomIn);customEvents.addListener(ZOOMOUT_FROM_WORKSPACE,sendZoomOut);
  19. customEvents.addListener(DOUBLE_TAP_FROM_WORKSPACE,sendZoomIn);
  20. var device={width:function(){return window.innerWidth},height:function(){return"iPhone"==this.name()?416==window.innerHeight&&"portrait"==orientationObserver.getOrientation()?window.innerHeight:416>window.innerHeight&&"portrait"==orientationObserver.getOrientation()?window.innerHeight+60:250<window.innerHeight&&"landscape"==orientationObserver.getOrientation()?window.innerHeight:250>window.innerHeight&&"landscape"==orientationObserver.getOrientation()?window.innerHeight+60:window.innerHeight:window.innerHeight},
  21. proportions:function(){return(this.width()/this.height()).toFixed(2)},name:function(){var a="other",a=browser.platform.ios&&"iPad"===browser.device?"iPad":"iPhone",a=!0==browser.platform.android?"android":a,a=!0==browser.platform.wphone?"wphone":a;return browser.publisher.isOn?browser.publisher.device:a}};function createDiv(a,c){var b=document.createElement("div");b.setAttribute("id",a);b.style.position="absolute";if(c)b.style.overflow="hidden";return b}var FCONSOLE_MAX_ROWS=33,LINE_BR="<br />";
  22. function FBConsole(){function a(a){for(var c="",b=0;b<a.length;b++){switch(typeof a[b]){case "number":c+=d(Math.round(1E4*a[b])/1E4,"blue");break;default:c+=a[b]}b<a.length-1&&(c+=" ")}return c}function c(){b.innerHTML=j+(h?"":LINE_BR+LINE_BR+f)}var b=createDiv("fconsole"),d=function(a,c){return'<font color="'+c+'">'+a+"</font>"};b.style.left="0px";b.style.top="0px";b.style.width="100";b.style.height="100";b.style.opacity="0.7";b.style.backgroundColor="#e0efee";b.style.color="#11111f";b.style.fontSize=
  23. "14px";b.style.zIndex=100;b.style.webkitTransform="translate3d(0px,0px,500px)";b.addEventListener(UP_EVENT,function(){h?(h=!1,c()):(f=[],c(),h=!0)},!1);var e=[],f=[],j="",h,m=!1;this.append=function(){m=!0;document.body.appendChild(b);c()};this.update=function(a,b){for(var h,f=0;f<e.length;f++)e[f].name==a&&(h=e[f]);"number"==typeof b&&(b=Math.round(1E4*b)/1E4);h?h.value=b:e.push({name:a,value:b});j="";for(f=0;f<e.length;f++)j+=d(e[f].name,"green")+": "+d(e[f].value,"blue")+(f==e.length-1?"":LINE_BR);
  24. m&&c()};this.log=function(b){f.length>FCONSOLE_MAX_ROWS-1&&f.shift();var d=a(arguments);f.push(d+LINE_BR);m&&c()};this.logAdd=function(b){var d=a(arguments);f[f.length-1]+=" "+d;m&&c()}}function HighlightItem(a,c,b,d){var e="R"==a[1],f,j,h;e?(f=a[2]/10,j=a[3]/10,h=a[4]/1E3,a=a[5]/10):(f=a[1]/10,j=a[2]/10,h=a[3]/1E3,a=a[4]/10);var m=0===b?0:c[b-1]/10,c=c[b+(d-1)]/10-m;this.y=j;this.x=f+m-(e?c:0);this.width=c;this.height=a;this.angle=h}
  25. var highlight={getFillStyle:function(){return"rgba("+fbUtils.hexToRGB(publicationData.search.color)+",0.4)"},active:!1,init:function(){var a=this;customEvents.addListener(SHOW_SEARCH_RESULTS,function(){a.show()});customEvents.addListener(CANCEL_SEARCH,function(){a.hide()})},show:function(a,c){a=a||-10;if(search.active&&search.pages[a]){if(-10==a)a=pageMediator.page;c=c||el.id("highlightCanvas"+a);this.process(function(){highlight.light.apply(this,arguments)},a,c);this.active=!0}publicationData.page[a].videos&&
  26. video.inject(c,a)},hide:function(a,c){a=a||-10;-10==a?this.active=!1:this.claerPage(a,c);search.stop()},claerPage:function(a,c){c=c||el.id("highlightCanvas"+a);c.getContext("2d").clearRect(0,0,c.width,c.height);this.active=!1},process:function(a,c,b,d){b&&this.claerPage(c,b);var e=function(){for(var f=this.responseText.split("\n"),h=search.query.toLowerCase()||"",h=fbUtils.split(h,0),e=1;e<f.length;e++){word=f[e];for(var n=0,p=0;p<h.length;p++){var r=h[p],k=word.split(String.fromCharCode(2));if(r.length<
  27. publicationData.search.lim){var l=void 0!=f[e-1]?f[e-1].split(String.fromCharCode(2))[0]:"",n=f[e].split(String.fromCharCode(2))[0]||"",o=void 0!=f[e+1]?f[e+1].split(String.fromCharCode(2))[0]:"",l=l+" "+n,n=n+" "+o,o=h[p-1]||"",t=h[p],q=h[p+1]||"",s=o+" "+t,u=t+" "+q,t=!1;""!=o&&-1!=l.toLowerCase().indexOf(s)&&(t=!0);""!=q&&-1!=n.toLowerCase().indexOf(u)&&(t=!0)}else t=!0;if(-1!=(n=k[0].toLowerCase().indexOf(r))&&t)if(o=word.split(String.fromCharCode(4)),1<o.length){k=[];l=[];for(q=0;q<o.length;q++)k[q]=
  28. o[q].split(String.fromCharCode(2)),0<q&&k[q].unshift(k[0][0]),l[q]=k[q][5].split(String.fromCharCode(3));o=n;r=n+r.length;for(n=0;n<k.length;n++)l[n].length<=o?(o-=l[n].length,r-=l[n].length):(r>l[n].length?(q=l[n].length,r-=l[n].length):(q=r,r=0),0<o&&(q-=o),q=new HighlightItem(k[n],l[n],o,q),o=0,a(q,b,c))}else l="R"==k[1]?k[6].split(String.fromCharCode(3)):k[5].split(String.fromCharCode(3)),q=new HighlightItem(k,l,n,r.length),a(q,b,c)}}d&&d()};if(PUBL)publ.getData(ASSETS_FOLDER+"/search/search"+
  29. fbUtils.getNum(c)+".xml",e);else{var f=new XMLHttpRequest;f.open("GET",ASSETS_FOLDER+"/search/search"+fbUtils.getNum(c)+".xml");f.onload=e;f.onerror=function(){};f.send();delete f}},light:function(a,c,b){var d=c.getContext("2d");d.fillStyle=window.highlight.getFillStyle();var c=c.width/(publicationData.page[b].width||publicationData.page.defaults.width),b=a.x,e=a.y,f=a.width,j=a.height;d.save();d.scale(c,c);d.translate(b,e);d.rotate(a.angle);d.clearRect(0,0,f,j);d.fillRect(0,0,f,j);d.restore();delete null},
  30. getHighlights:function(a,c){var b=[];this.process(function(a){b.push(a)},a,null,function(){c(b)})}},HTML5lib={init:function(){switch(system.browser.name){case "safari":this.browserPrefix="webkit";break;case "firefox":this.browserPrefix="Moz";break;case "opera":this.browserPrefix="O";break;case "ie":this.browserPrefix="ms";break;case "chrome":this.browserPrefix="webkit"}},translate:function(a,c,b,d){c=c||0;b=b||0;a.style[this.browserPrefix+"Transform"]=Modernizr.csstransforms3d?"translate3d("+c+"px,"+
  31. b+"px,"+(d||0)+"px)":"translate("+c+"px,"+b+"px)"},duration:function(a,c){a.style[this.browserPrefix+"TransitionDuration"]=c+"ms"},perspective:function(a,c){a.style[this.browserPrefix+"Transform"]="perspective("+c+")"},scale:function(a,c,b){a=a||0;c=c||0;el.style[this.browserPrefix+"Transform"]=Modernizr.csstransforms3d?"scale3d("+a+","+c+","+(b||0)+")":"scale("+a+","+c+")"},rotate:function(a,c,b){b=b||0;a.style[this.browserPrefix+"Transform"]=Modernizr.csstransforms3d?"rotate3d("+b+","+b+","+b+","+
  32. c+"deg)":"rotate("+c+"deg)"},backfaceVisibility:function(a,c){a.style[this.browserPrefix+"BackfaceVisibility"]=c},boxShadow:function(a,c){a.style[this.browserPrefix+"BoxShadow"]=c},getTransform:function(a){return a.style[this.browserPrefix+"Transform"]},transform:function(a,c,b){a.style[this.browserPrefix+"TransformOrigin"]="0px 0px";a.style[this.browserPrefix+"Transform"]="translate3d("+c+"px,"+b+"px,0px)"},getParseTranslate:function(a){a=a.style[this.browserPrefix+"Transform"].match(/-*\d+(?=px)|\d+\%/ig);
  33. null==a&&(a=[0,0,0]);return{x:a[0],y:a[1],z:a[2]}},changeOnlyScale:function(a,c,b,d){re=/translate3d\([A-Za-z0-9_, ]*\)/i;var e=a.style[this.browserPrefix+"Transform"].match(re);null===e&&(e="");a.style[this.browserPrefix+"Transform"]=e+" scale3d("+c+","+b+","+d+")"}};
  34. (function(a,c){function b(a){if(""===f)return a;a=a.charAt(0).toUpperCase()+a.substr(1);return f+a}var d=Math,e=c.createElement("div").style,f=function(){for(var a="t,webkitT,MozT,msT,OT".split(","),g,c=0,b=a.length;c<b;c++)if(g=a[c]+"ransform",g in e)return a[c].substr(0,a[c].length-1);return!1}(),j=f?"-"+f.toLowerCase()+"-":"",h=b("transform"),m=b("transitionProperty"),n=b("transitionDuration"),p=b("transformOrigin"),r=b("transitionTimingFunction"),k=b("transitionDelay"),l=/android/gi.test(navigator.appVersion),
  35. o=/iphone|ipad/gi.test(navigator.appVersion),t=/hp-tablet/gi.test(navigator.appVersion),q=b("perspective")in e,s="ontouchstart"in a&&!t,u=!!f,H=b("transition")in e,C="onorientationchange"in a?"orientationchange":"resize",E=s?"touchstart":"mousedown",z=s?"touchmove":"mousemove",A=s?"touchend":"mouseup",B=s?"touchcancel":"mouseup",F="Moz"==f?"DOMMouseScroll":"mousewheel",w;w=!1===f?!1:{"":"transitionend",webkit:"webkitTransitionEnd",Moz:"transitionend",O:"oTransitionEnd",ms:"MSTransitionEnd"}[f];var I=
  36. function(){return a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(a){return setTimeout(a,1)}}(),G=a.cancelRequestAnimationFrame||a.webkitCancelAnimationFrame||a.webkitCancelRequestAnimationFrame||a.mozCancelRequestAnimationFrame||a.oCancelRequestAnimationFrame||a.msCancelRequestAnimationFrame||clearTimeout,v=q?" translateZ(0)":"",t=function(D,g){var b=this,d;b.wrapper="object"==typeof D?D:c.getElementById(D);
  37. b.wrapper.style.overflow="hidden";b.scroller=b.wrapper.children[0];b.options={hScroll:!0,vScroll:!0,x:0,y:0,bounce:!0,bounceLock:!1,momentum:!0,lockDirection:!0,useTransform:!0,useTransition:!1,topOffset:0,checkDOMChanges:!1,handleClick:!0,hScrollbar:!0,vScrollbar:!0,fixedScrollbar:l,hideScrollbar:o,fadeScrollbar:o&&q,scrollbarClass:"",zoom:!1,zoomMin:1,zoomMax:4,doubleTapZoom:2,wheelAction:"scroll",snap:!1,snapThreshold:1,onRefresh:null,onBeforeScrollStart:function(a){a.preventDefault()},onScrollStart:null,
  38. onBeforeScrollMove:null,onScrollMove:null,onBeforeScrollEnd:null,onScrollEnd:null,onTouchEnd:null,onDestroy:null,onZoomStart:null,onZoom:null,onZoomEnd:null};for(d in g)b.options[d]=g[d];b.x=b.options.x;b.y=b.options.y;b.options.useTransform=u&&b.options.useTransform;b.options.hScrollbar=b.options.hScroll&&b.options.hScrollbar;b.options.vScrollbar=b.options.vScroll&&b.options.vScrollbar;b.options.zoom=b.options.useTransform&&b.options.zoom;b.options.useTransition=H&&b.options.useTransition;b.options.zoom&&
  39. l&&(v="");b.scroller.style[m]=b.options.useTransform?j+"transform":"top left";b.scroller.style[n]="0";b.scroller.style[p]="0 0";b.options.useTransition&&(b.scroller.style[r]="cubic-bezier(0.33,0.66,0.66,1)");b.options.useTransform?b.scroller.style[h]="translate("+b.x+"px,"+b.y+"px)"+v:b.scroller.style.cssText+=";position:absolute;top:"+b.y+"px;left:"+b.x+"px";if(b.options.useTransition)b.options.fixedScrollbar=!0;b.refresh();b._bind(C,a);b._bind(E);s||"none"!=b.options.wheelAction&&b._bind(F);if(b.options.checkDOMChanges)b.checkDOMTime=
  40. setInterval(function(){b._checkDOMChanges()},500)};t.prototype={enabled:!0,x:0,y:0,steps:[],scale:1,currPageX:0,currPageY:0,pagesX:[],pagesY:[],aniTime:null,wheelZoomCount:0,handleEvent:function(a){switch(a.type){case E:if(!s&&0!==a.button)break;this._start(a);break;case z:this._move(a);break;case A:case B:this._end(a);break;case C:this._resize();break;case F:this._wheel(a);break;case w:this._transitionEnd(a)}},_checkDOMChanges:function(){!this.moved&&!this.zoomed&&!(this.animating||this.scrollerW==
  41. this.scroller.offsetWidth*this.scale&&this.scrollerH==this.scroller.offsetHeight*this.scale)&&this.refresh()},_scrollbar:function(a){var g;if(this[a+"Scrollbar"]){if(!this[a+"ScrollbarWrapper"]){g=c.createElement("div");this.options.scrollbarClass?g.className=this.options.scrollbarClass+a.toUpperCase():g.style.cssText="position:absolute;z-index:100;"+("h"==a?"height:7px;bottom:1px;left:2px;right:"+(this.vScrollbar?"7":"2")+"px":"width:7px;bottom:"+(this.hScrollbar?"7":"2")+"px;top:2px;right:1px");
  42. g.style.cssText+=";pointer-events:none;"+j+"transition-property:opacity;"+j+"transition-duration:"+(this.options.fadeScrollbar?"350ms":"0")+";overflow:hidden;opacity:"+(this.options.hideScrollbar?"0":"1");this.wrapper.appendChild(g);this[a+"ScrollbarWrapper"]=g;g=c.createElement("div");if(!this.options.scrollbarClass)g.style.cssText="position:absolute;z-index:100;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);"+j+"background-clip:padding-box;"+j+"box-sizing:border-box;"+("h"==a?
  43. "height:100%":"width:100%")+";"+j+"border-radius:3px;border-radius:3px";g.style.cssText+=";pointer-events:none;"+j+"transition-property:"+j+"transform;"+j+"transition-timing-function:cubic-bezier(0.33,0.66,0.66,1);"+j+"transition-duration:0;"+j+"transform: translate(0,0)"+v;this.options.useTransition&&(g.style.cssText+=";"+j+"transition-timing-function:cubic-bezier(0.33,0.66,0.66,1)");this[a+"ScrollbarWrapper"].appendChild(g);this[a+"ScrollbarIndicator"]=g}"h"==a?(this.hScrollbarSize=this.hScrollbarWrapper.clientWidth,
  44. this.hScrollbarIndicatorSize=d.max(d.round(this.hScrollbarSize*this.hScrollbarSize/this.scrollerW),8),this.hScrollbarIndicator.style.width=this.hScrollbarIndicatorSize+"px",this.hScrollbarMaxScroll=this.hScrollbarSize-this.hScrollbarIndicatorSize,this.hScrollbarProp=this.hScrollbarMaxScroll/this.maxScrollX):(this.vScrollbarSize=this.vScrollbarWrapper.clientHeight,this.vScrollbarIndicatorSize=d.max(d.round(this.vScrollbarSize*this.vScrollbarSize/this.scrollerH),8),this.vScrollbarIndicator.style.height=
  45. this.vScrollbarIndicatorSize+"px",this.vScrollbarMaxScroll=this.vScrollbarSize-this.vScrollbarIndicatorSize,this.vScrollbarProp=this.vScrollbarMaxScroll/this.maxScrollY);this._scrollbarPos(a,!0)}else this[a+"ScrollbarWrapper"]&&(u&&(this[a+"ScrollbarIndicator"].style[h]=""),this[a+"ScrollbarWrapper"].parentNode.removeChild(this[a+"ScrollbarWrapper"]),this[a+"ScrollbarWrapper"]=null,this[a+"ScrollbarIndicator"]=null)},_resize:function(){var a=this;setTimeout(function(){a.refresh()},l?200:0)},_pos:function(a,
  46. g){if(!this.zoomed)a=this.hScroll?a:0,g=this.vScroll?g:0,this.options.useTransform?this.scroller.style[h]="translate("+a+"px,"+g+"px) scale("+this.scale+")"+v:(a=d.round(a),g=d.round(g),this.scroller.style.left=a+"px",this.scroller.style.top=g+"px"),this.x=a,this.y=g,this._scrollbarPos("h"),this._scrollbarPos("v")},_scrollbarPos:function(a,g){var b="h"==a?this.x:this.y;if(this[a+"Scrollbar"])b*=this[a+"ScrollbarProp"],0>b?(this.options.fixedScrollbar||(b=this[a+"ScrollbarIndicatorSize"]+d.round(3*
  47. b),8>b&&(b=8),this[a+"ScrollbarIndicator"].style["h"==a?"width":"height"]=b+"px"),b=0):b>this[a+"ScrollbarMaxScroll"]&&(this.options.fixedScrollbar?b=this[a+"ScrollbarMaxScroll"]:(b=this[a+"ScrollbarIndicatorSize"]-d.round(3*(b-this[a+"ScrollbarMaxScroll"])),8>b&&(b=8),this[a+"ScrollbarIndicator"].style["h"==a?"width":"height"]=b+"px",b=this[a+"ScrollbarMaxScroll"]+(this[a+"ScrollbarIndicatorSize"]-b))),this[a+"ScrollbarWrapper"].style[k]="0",this[a+"ScrollbarWrapper"].style.opacity=g&&this.options.hideScrollbar?
  48. "0":"1",this[a+"ScrollbarIndicator"].style[h]="translate("+("h"==a?b+"px,0)":"0,"+b+"px)")+v},_start:function(b){var g=s?b.touches[0]:b,c,f;if(this.enabled){this.options.onBeforeScrollStart&&this.options.onBeforeScrollStart.call(this,b);(this.options.useTransition||this.options.zoom)&&this._transitionTime(0);this.zoomed=this.animating=this.moved=!1;this.dirY=this.dirX=this.absDistY=this.absDistX=this.distY=this.distX=0;if(this.options.zoom&&s&&1<b.touches.length)f=d.abs(b.touches[0].pageX-b.touches[1].pageX),
  49. c=d.abs(b.touches[0].pageY-b.touches[1].pageY),this.touchesDistStart=d.sqrt(f*f+c*c),this.originX=d.abs(b.touches[0].pageX+b.touches[1].pageX-2*this.wrapperOffsetLeft)/2-this.x,this.originY=d.abs(b.touches[0].pageY+b.touches[1].pageY-2*this.wrapperOffsetTop)/2-this.y,this.options.onZoomStart&&this.options.onZoomStart.call(this,b);if(this.options.momentum&&(this.options.useTransform?(c=getComputedStyle(this.scroller,null)[h].replace(/[^0-9\-.,]/g,"").split(","),f=1*c[4],c=1*c[5]):(f=1*getComputedStyle(this.scroller,
  50. null).left.replace(/[^0-9-]/g,""),c=1*getComputedStyle(this.scroller,null).top.replace(/[^0-9-]/g,"")),f!=this.x||c!=this.y))this.options.useTransition?this._unbind(w):G(this.aniTime),this.steps=[],this._pos(f,c);this.absStartX=this.x;this.absStartY=this.y;this.startX=this.x;this.startY=this.y;this.pointX=g.pageX;this.pointY=g.pageY;this.startTime=b.timeStamp||Date.now();this.options.onScrollStart&&this.options.onScrollStart.call(this,b);this._bind(z,a);this._bind(A,a);this._bind(B,a)}},_move:function(a){var b=
  51. s?a.touches[0]:a,c=b.pageX-this.pointX,f=b.pageY-this.pointY,e=this.x+c,j=this.y+f,k=a.timeStamp||Date.now();this.options.onBeforeScrollMove&&this.options.onBeforeScrollMove.call(this,a);if(this.options.zoom&&s&&1<a.touches.length)e=d.abs(a.touches[0].pageX-a.touches[1].pageX),j=d.abs(a.touches[0].pageY-a.touches[1].pageY),this.touchesDist=d.sqrt(e*e+j*j),this.zoomed=!0,b=1/this.touchesDistStart*this.touchesDist*this.scale,b<this.options.zoomMin?b=0.5*this.options.zoomMin*Math.pow(2,b/this.options.zoomMin):
  52. b>this.options.zoomMax&&(b=2*this.options.zoomMax*Math.pow(0.5,this.options.zoomMax/b)),this.lastScale=b/this.scale,e=this.originX-this.originX*this.lastScale+this.x,j=this.originY-this.originY*this.lastScale+this.y,this.scroller.style[h]="translate("+e+"px,"+j+"px) scale("+b+")"+v,this.options.onZoom&&this.options.onZoom.call(this,a);else{this.pointX=b.pageX;this.pointY=b.pageY;if(0<e||e<this.maxScrollX)e=this.options.bounce?this.x+c/2:0<=e||0<=this.maxScrollX?0:this.maxScrollX;if(j>this.minScrollY||
  53. j<this.maxScrollY)j=this.options.bounce?this.y+f/2:j>=this.minScrollY||0<=this.maxScrollY?this.minScrollY:this.maxScrollY;this.distX+=c;this.distY+=f;this.absDistX=d.abs(this.distX);this.absDistY=d.abs(this.distY);if(!(6>this.absDistX&&6>this.absDistY)){if(this.options.lockDirection)if(this.absDistX>this.absDistY+5)j=this.y,f=0;else if(this.absDistY>this.absDistX+5)e=this.x,c=0;this.moved=!0;this._pos(e,j);this.dirX=0<c?-1:0>c?1:0;this.dirY=0<f?-1:0>f?1:0;if(300<k-this.startTime)this.startTime=k,
  54. this.startX=this.x,this.startY=this.y;this.options.onScrollMove&&this.options.onScrollMove.call(this,a)}}},_end:function(b){if(!(s&&0!==b.touches.length)){var g=this,f=s?b.changedTouches[0]:b,e,j,k={dist:0,time:0},m={dist:0,time:0},p=(b.timeStamp||Date.now())-g.startTime,l=g.x,o=g.y;g._unbind(z,a);g._unbind(A,a);g._unbind(B,a);g.options.onBeforeScrollEnd&&g.options.onBeforeScrollEnd.call(g,b);if(g.zoomed)l=g.scale*g.lastScale,l=Math.max(g.options.zoomMin,l),l=Math.min(g.options.zoomMax,l),g.lastScale=
  55. l/g.scale,g.scale=l,g.x=g.originX-g.originX*g.lastScale+g.x,g.y=g.originY-g.originY*g.lastScale+g.y,g.scroller.style[n]="200ms",g.scroller.style[h]="translate("+g.x+"px,"+g.y+"px) scale("+g.scale+")"+v,g.zoomed=!1,g.refresh(),g.options.onZoomEnd&&g.options.onZoomEnd.call(g,b);else{if(g.moved){if(300>p&&g.options.momentum){k=l?g._momentum(l-g.startX,p,-g.x,g.scrollerW-g.wrapperW+g.x,g.options.bounce?g.wrapperW:0):k;m=o?g._momentum(o-g.startY,p,-g.y,0>g.maxScrollY?g.scrollerH-g.wrapperH+g.y-g.minScrollY:
  56. 0,g.options.bounce?g.wrapperH:0):m;l=g.x+k.dist;o=g.y+m.dist;if(0<g.x&&0<l||g.x<g.maxScrollX&&l<g.maxScrollX)k={dist:0,time:0};if(g.y>g.minScrollY&&o>g.minScrollY||g.y<g.maxScrollY&&o<g.maxScrollY)m={dist:0,time:0}}if(k.dist||m.dist){k=d.max(d.max(k.time,m.time),10);if(g.options.snap)m=l-g.absStartX,p=o-g.absStartY,d.abs(m)<g.options.snapThreshold&&d.abs(p)<g.options.snapThreshold?g.scrollTo(g.absStartX,g.absStartY,200):(m=g._snap(l,o),l=m.x,o=m.y,k=d.max(m.time,k));g.scrollTo(d.round(l),d.round(o),
  57. k)}else g.options.snap?(m=l-g.absStartX,p=o-g.absStartY,d.abs(m)<g.options.snapThreshold&&d.abs(p)<g.options.snapThreshold?g.scrollTo(g.absStartX,g.absStartY,200):(m=g._snap(g.x,g.y),(m.x!=g.x||m.y!=g.y)&&g.scrollTo(m.x,m.y,m.time))):g._resetPos(200)}else{if(s)if(g.doubleTapTimer&&g.options.zoom)clearTimeout(g.doubleTapTimer),g.doubleTapTimer=null,g.options.onZoomStart&&g.options.onZoomStart.call(g,b),g.zoom(g.pointX,g.pointY,1==g.scale?g.options.doubleTapZoom:1),g.options.onZoomEnd&&setTimeout(function(){g.options.onZoomEnd.call(g,
  58. b)},200);else if(this.options.handleClick)g.doubleTapTimer=setTimeout(function(){g.doubleTapTimer=null;for(e=f.target;1!=e.nodeType;)e=e.parentNode;if("SELECT"!=e.tagName&&"INPUT"!=e.tagName&&"TEXTAREA"!=e.tagName)j=c.createEvent("MouseEvents"),j.initMouseEvent("click",!0,!0,b.view,1,f.screenX,f.screenY,f.clientX,f.clientY,b.ctrlKey,b.altKey,b.shiftKey,b.metaKey,0,null),j._fake=!0,e.dispatchEvent(j)},g.options.zoom?250:0);g._resetPos(400)}g.options.onTouchEnd&&g.options.onTouchEnd.call(g,b)}}},_resetPos:function(a){var b=
  59. 0<=this.x?0:this.x<this.maxScrollX?this.maxScrollX:this.x,c=this.y>=this.minScrollY||0<this.maxScrollY?this.minScrollY:this.y<this.maxScrollY?this.maxScrollY:this.y;if(b==this.x&&c==this.y){if(this.moved)this.moved=!1,this.options.onScrollEnd&&this.options.onScrollEnd.call(this);if(this.hScrollbar&&this.options.hideScrollbar)"webkit"==f&&(this.hScrollbarWrapper.style[k]="300ms"),this.hScrollbarWrapper.style.opacity="0";if(this.vScrollbar&&this.options.hideScrollbar)"webkit"==f&&(this.vScrollbarWrapper.style[k]=
  60. "300ms"),this.vScrollbarWrapper.style.opacity="0"}else this.scrollTo(b,c,a||0)},_wheel:function(a){var b=this,c,d;if("wheelDeltaX"in a)c=a.wheelDeltaX/12,d=a.wheelDeltaY/12;else if("wheelDelta"in a)c=d=a.wheelDelta/12;else if("detail"in a)c=d=3*-a.detail;else return;if("zoom"==b.options.wheelAction){d=b.scale*Math.pow(2,1/3*(d?d/Math.abs(d):0));if(d<b.options.zoomMin)d=b.options.zoomMin;if(d>b.options.zoomMax)d=b.options.zoomMax;d!=b.scale&&(!b.wheelZoomCount&&b.options.onZoomStart&&b.options.onZoomStart.call(b,
  61. a),b.wheelZoomCount++,b.zoom(a.pageX,a.pageY,d,400),setTimeout(function(){b.wheelZoomCount--;!b.wheelZoomCount&&b.options.onZoomEnd&&b.options.onZoomEnd.call(b,a)},400))}else{c=b.x+c;d=b.y+d;if(0<c)c=0;else if(c<b.maxScrollX)c=b.maxScrollX;if(d>b.minScrollY)d=b.minScrollY;else if(d<b.maxScrollY)d=b.maxScrollY;0>b.maxScrollY&&b.scrollTo(c,d,0)}},_transitionEnd:function(a){a.target==this.scroller&&(this._unbind(w),this._startAni())},_startAni:function(){var a=this,b=a.x,c=a.y,f=Date.now(),e,h,j;if(!a.animating)if(a.steps.length){e=
  62. a.steps.shift();if(e.x==b&&e.y==c)e.time=0;a.animating=!0;a.moved=!0;a.options.useTransition?(a._transitionTime(e.time),a._pos(e.x,e.y),a.animating=!1,e.time?a._bind(w):a._resetPos(0)):(j=function(){var k=Date.now();if(k>=f+e.time)a._pos(e.x,e.y),a.animating=!1,a.options.onAnimationEnd&&a.options.onAnimationEnd.call(a),a._startAni();else if(k=(k-f)/e.time-1,h=d.sqrt(1-k*k),k=(e.x-b)*h+b,a._pos(k,(e.y-c)*h+c),a.animating)a.aniTime=I(j)},j())}else a._resetPos(400)},_transitionTime:function(a){a+="ms";
  63. this.scroller.style[n]=a;this.hScrollbar&&(this.hScrollbarIndicator.style[n]=a);this.vScrollbar&&(this.vScrollbarIndicator.style[n]=a)},_momentum:function(a,b,c,e,f){var b=d.abs(a)/b,h=b*b/0.0012,j=0,j=0;0<a&&h>c?(c+=f/(6/(6.0E-4*(h/b))),b=b*c/h,h=c):0>a&&h>e&&(e+=f/(6/(6.0E-4*(h/b))),b=b*e/h,h=e);return{dist:h*(0>a?-1:1),time:d.round(b/6.0E-4)}},_offset:function(a){for(var b=-a.offsetLeft,c=-a.offsetTop;a=a.offsetParent;)b-=a.offsetLeft,c-=a.offsetTop;a!=this.wrapper&&(b*=this.scale,c*=this.scale);
  64. return{left:b,top:c}},_snap:function(a,b){var c,e,f;f=this.pagesX.length-1;for(c=0,e=this.pagesX.length;c<e;c++)if(a>=this.pagesX[c]){f=c;break}f==this.currPageX&&0<f&&0>this.dirX&&f--;a=this.pagesX[f];e=(e=d.abs(a-this.pagesX[this.currPageX]))?500*(d.abs(this.x-a)/e):0;this.currPageX=f;f=this.pagesY.length-1;for(c=0;c<f;c++)if(b>=this.pagesY[c]){f=c;break}f==this.currPageY&&0<f&&0>this.dirY&&f--;b=this.pagesY[f];c=(c=d.abs(b-this.pagesY[this.currPageY]))?500*(d.abs(this.y-b)/c):0;this.currPageY=
  65. f;f=d.round(d.max(e,c))||200;return{x:a,y:b,time:f}},_bind:function(a,b,c){(b||this.scroller).addEventListener(a,this,!!c)},_unbind:function(a,b,c){(b||this.scroller).removeEventListener(a,this,!!c)},destroy:function(){this.scroller.style[h]="";this.vScrollbar=this.hScrollbar=!1;this._scrollbar("h");this._scrollbar("v");this._unbind(C,a);this._unbind(E);this._unbind(z,a);this._unbind(A,a);this._unbind(B,a);this.options.hasTouch||this._unbind(F);this.options.useTransition&&this._unbind(w);this.options.checkDOMChanges&&
  66. clearInterval(this.checkDOMTime);this.options.onDestroy&&this.options.onDestroy.call(this)},refresh:function(){var a,b,c,f=0;b=0;if(this.scale<this.options.zoomMin)this.scale=this.options.zoomMin;this.wrapperW=this.wrapper.clientWidth||1;this.wrapperH=this.wrapper.clientHeight||1;this.minScrollY=-this.options.topOffset||0;this.scrollerW=d.round(this.scroller.offsetWidth*this.scale);this.scrollerH=d.round((this.scroller.offsetHeight+this.minScrollY)*this.scale);this.maxScrollX=this.wrapperW-this.scrollerW;
  67. this.maxScrollY=this.wrapperH-this.scrollerH+this.minScrollY;this.dirY=this.dirX=0;this.options.onRefresh&&this.options.onRefresh.call(this);this.hScroll=this.options.hScroll&&0>this.maxScrollX;this.vScroll=this.options.vScroll&&(!this.options.bounceLock&&!this.hScroll||this.scrollerH>this.wrapperH);this.hScrollbar=this.hScroll&&this.options.hScrollbar;this.vScrollbar=this.vScroll&&this.options.vScrollbar&&this.scrollerH>this.wrapperH;a=this._offset(this.wrapper);this.wrapperOffsetLeft=-a.left;this.wrapperOffsetTop=
  68. -a.top;if("string"==typeof this.options.snap){this.pagesX=[];this.pagesY=[];c=this.scroller.querySelectorAll(this.options.snap);for(a=0,b=c.length;a<b;a++)f=this._offset(c[a]),f.left+=this.wrapperOffsetLeft,f.top+=this.wrapperOffsetTop,this.pagesX[a]=f.left<this.maxScrollX?this.maxScrollX:f.left*this.scale,this.pagesY[a]=f.top<this.maxScrollY?this.maxScrollY:f.top*this.scale}else if(this.options.snap){for(this.pagesX=[];f>=this.maxScrollX;)this.pagesX[b]=f,f-=this.wrapperW,b++;this.maxScrollX%this.wrapperW&&
  69. (this.pagesX[this.pagesX.length]=this.maxScrollX-this.pagesX[this.pagesX.length-1]+this.pagesX[this.pagesX.length-1]);b=f=0;for(this.pagesY=[];f>=this.maxScrollY;)this.pagesY[b]=f,f-=this.wrapperH,b++;this.maxScrollY%this.wrapperH&&(this.pagesY[this.pagesY.length]=this.maxScrollY-this.pagesY[this.pagesY.length-1]+this.pagesY[this.pagesY.length-1])}this._scrollbar("h");this._scrollbar("v");this.zoomed||(this.scroller.style[n]="0",this._resetPos(400))},scrollTo:function(a,b,c,d){var f=a;this.stop();
  70. f.length||(f=[{x:a,y:b,time:c,relative:d}]);for(a=0,b=f.length;a<b;a++){if(f[a].relative)f[a].x=this.x-f[a].x,f[a].y=this.y-f[a].y;this.steps.push({x:f[a].x,y:f[a].y,time:f[a].time||0})}this._startAni()},scrollToElement:function(a,b){var c;if(a=a.nodeType?a:this.scroller.querySelector(a))c=this._offset(a),c.left+=this.wrapperOffsetLeft,c.top+=this.wrapperOffsetTop,c.left=0<c.left?0:c.left<this.maxScrollX?this.maxScrollX:c.left,c.top=c.top>this.minScrollY?this.minScrollY:c.top<this.maxScrollY?this.maxScrollY:
  71. c.top,b=void 0===b?d.max(2*d.abs(c.left),2*d.abs(c.top)):b,this.scrollTo(c.left,c.top,b)},scrollToPage:function(a,b,c){c=void 0===c?400:c;this.options.onScrollStart&&this.options.onScrollStart.call(this);if(this.options.snap)a="next"==a?this.currPageX+1:"prev"==a?this.currPageX-1:a,b="next"==b?this.currPageY+1:"prev"==b?this.currPageY-1:b,a=0>a?0:a>this.pagesX.length-1?this.pagesX.length-1:a,b=0>b?0:b>this.pagesY.length-1?this.pagesY.length-1:b,this.currPageX=a,this.currPageY=b,a=this.pagesX[a],b=
  72. this.pagesY[b];else{a*=-this.wrapperW;b*=-this.wrapperH;if(a<this.maxScrollX)a=this.maxScrollX;if(b<this.maxScrollY)b=this.maxScrollY}this.scrollTo(a,b,c)},disable:function(){this.stop();this._resetPos(0);this.enabled=!1;this._unbind(z,a);this._unbind(A,a);this._unbind(B,a)},enable:function(){this.enabled=!0},stop:function(){this.options.useTransition?this._unbind(w):G(this.aniTime);this.steps=[];this.animating=this.moved=!1},zoom:function(a,b,c,f){var d=c/this.scale;if(this.options.useTransform)this.zoomed=
  73. !0,f=void 0===f?200:f,a=a-this.wrapperOffsetLeft-this.x,b=b-this.wrapperOffsetTop-this.y,this.x=a-a*d+this.x,this.y=b-b*d+this.y,this.scale=c,this.refresh(),this.x=0<this.x?0:this.x<this.maxScrollX?this.maxScrollX:this.x,this.y=this.y>this.minScrollY?this.minScrollY:this.y<this.maxScrollY?this.maxScrollY:this.y,this.scroller.style[n]=f+"ms",this.scroller.style[h]="translate("+this.x+"px,"+this.y+"px) scale("+c+")"+v,this.zoomed=!1},isReady:function(){return!this.moved&&!this.zoomed&&!this.animating}};
  74. e=null;"undefined"!==typeof exports?exports.iScroll=t:a.iScroll=t})(window,document);
  75. function LinksLayer(a,c){a.removeAllListeners&&a.removeAllListeners();this.canvas=a;this.rectStore="";this.videoLight=this.light=!1;this.activeLink={};var b=void 0==publicationData.page[c].videos?!1:!0;if(void 0!=publicationData.page[c].links||b){b=a.width/(publicationData.page[c].width||publicationData.page.defaults.width);this.links=[];this.links.active=!0;var d=0;for(i in publicationData.page[c].links){var e=publicationData.page[c].links[i];this.links[d]={};this.links[d].width=1*(e.width*b).toFixed(0);
  76. this.links[d].height=1*(e.height*b).toFixed(0);this.links[d].x=1*(e.x*b).toFixed(0);this.links[d].y=1*(e.y*b).toFixed(0);this.links[d].page=e.page||-10;this.links[d].url=e.urls?e.urls[0]:-10;this.links[d].zIndex=e.zindex;this.links[d].videoType=!1;d++}for(i in publicationData.page[c].videos)e=publicationData.page[c].videos[i],this.links[d]={},this.links[d].width=1*(e.width*b).toFixed(0),this.links[d].height=1*(e.height*b).toFixed(0),this.links[d].x=1*(e.x*b).toFixed(0),this.links[d].y=1*(e.y*b).toFixed(0),
  77. this.links[d].videoId=e.id,this.links[d].zIndex=e.zindex,this.links[d].videoType=e.type,d++;var f=this,j=function(b){var c,d;if(Modernizr.touch){var e=b.target.getBoundingClientRect();c=b.targetTouches[0].pageX-e.left;d=b.targetTouches[0].pageY-e.top;c*=a.width/e.width;d*=a.height/e.height}else c=b.offsetX,d=b.offsetY;for(li in f.links)if(e=f.links[li],c>=e.x&&c<=e.x+e.width&&d>=e.y&&d<=e.y+e.height){f.activeLink=e;e.videoType?f.videoLight=!0:(c=f.canvas.getContext("2d"),f.rectStore=c.getImageData(e.x-
  78. 2,e.y-2,e.width+4,e.height+4),f.light=!0,d=fbUtils.hexToRGB(publicationData.linkcolor||"#000000"),c.fillStyle="rgba("+d+",0.3)",c.fillRect(e.x,e.y,e.width,e.height));b.preventDefault();break}a.addEventListener(UP_EVENT,h);a.addEventListener(MOVE_EVENT,m)},h=function(){a.removeEventListener(UP_EVENT,h);a.removeEventListener(MOVE_EVENT,m);if(f.light){var b=f.canvas.getContext("2d");b.putImageData(f.rectStore,f.activeLink.x-2,f.activeLink.y-2);b=null;f.light=!1;if(-10!=f.activeLink.page)setTimeout(function(){pageMediator.goToPage(f.activeLink.page)},
  79. 1);else if(-10!=f.activeLink.url)2==window.system.device.version&&window.system.platform.android?document.location.href=f.activeLink.url:window.open(f.activeLink.url,"_blank")}else if(f.videoLight)f.videoLight=!1,video.play(f.activeLink.videoType,f.activeLink.videoId,f.activeLink.width/f.activeLink.height)},m=function(){a.removeEventListener(UP_EVENT,h);a.removeEventListener(MOVE_EVENT,m);if(f.light)f.canvas.getContext("2d").putImageData(f.rectStore,f.activeLink.x-2,f.activeLink.y-2),f.light=!1;else if(f.videoLight)f.videoLight=
  80. !1};a.addEventListener(DOWN_EVENT,j);a.removeAllListeners=function(){a.removeEventListener(DOWN_EVENT,j);a.removeEventListener(UP_EVENT,h);a.removeEventListener(MOVE_EVENT,m)};this.links.sort(function(a,b){return a.zIndex<b.zIndex?1:a.zIndex>b.zIndex?-1:0})}else this.links={},this.links.active=!1}ONLY_RASTER=!1;
  81. function LoadManager(){function a(a){if(!a.waitingForImage&&!a.waitingForVector){if(a.onAllIsComplete)a.onAllIsComplete(a.image,a.vector);customEvents.fireEvent(ANDROID_PAGE_CONTENT_LOAD_COMPLETE,{page:a.position});b.length?e():d="standby"}}function c(b,c){void 0!=window.fakeLoadComplete&&fconsole.log("error on fakeLoadComplete");window.fakeLoadComplete=function(b){window.loadBuffers[b]=window.loadBuffer;c.waitingForVector=!1;if(c.onJSLoadComplete)c.onJSLoadComplete(window.loadBuffers[b]);c.vector=
  82. window.loadBuffers[b];a(c);window.fakeLoadComplete=void 0};addScript(b)}var b=[],d="standby";window.loadBuffers=[];var e=function(){var a=b.shift();j(a)},f=[],j=function(h){function j(){h.image=l;h.waitingForImage=!1;if(h.onImageLoadComplete)h.onImageLoadComplete(l,k);a(h)}if(publicationData.getPageProperty(h.position,"stub"))console.log("loadManager error: attempt to draw stub"),b.length?e():d="standby";else{var n=h.quality,p=publicationData.getPageProperty(h.position,n?"zoomFormat":"format"),r=
  83. -1!=p.indexOf("jpg")?"jpg":"png",k=-1!=p.indexOf("js")&&!ONLY_RASTER,n=k?COMMON_FOLDER+"/page-substrates/"+("page"+fill4Zero(h.position))+"."+r:ASSETS_FOLDER+"/pages/"+("page"+fill4Zero(h.position))+(n?"_i2.":"_i1.")+r,l=h.image||new Image;h.waitingForImage=!0;l.onload=j;l.onerror=function(){h.waitingForImage=!1;var b=l.src;if(void 0!=h.onPageLoadError)h.onPageLoadError(h.position);else fconsole.log("load error ",b);a(h)};(p=h.onImageStartLoading)&&p(l);if(k)if(p=PUBL?void 0:PAGES_JS_FOLDER+"/"+("page"+
  84. fill4Zero(h.position))+".js",-1!=f.indexOf(h.position)){h.waitingForVector=!1;h.vector=window.loadBuffers[h.position];if(h.onJSLoadComplete)h.onJSLoadComplete(window.loadBuffers[h.position]);a(h)}else h.waitingForVector=!0,c(p,h);else h.waitingForVector=!1;changeUrlWhenPubl(n,function(a){l.src!=a&&l.src!=qualifyURL(a)?l.src=a:j()})}};this.addPageToQueue=function(a){b.push(a);"standby"==d?(d="loading",e()):a.skipCurrentLoading&&e()}}
  85. function escapeHTML(a){return a.split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")}function qualifyURL(a){var c=document.createElement("div");c.innerHTML='<a href="'+escapeHTML(a)+'">x</a>';return c.firstChild.href}function fill4Zero(a){return 1E3>a?Math.pow(10,4-a.toString().length).toString().slice(1)+a.toString():a.toString()}function addScript(a){var c=document.createElement("script");c.type="text/javascript";c.src=a;a=document.head;a.insertBefore(c,a.firstChild)}
  86. PT_DOCUMENT="document";PT_PHOTOALBUM="photo_album";PT_CATALOG="catalog";PT_BOOK="book";PT_MAGAZINE="magazine";BOOK_FLIP_DURATION=0.5;PATH_TO_PROPERTIES=ASSETS_FOLDER+"/";ZOOM_LOCK=!1;
  87. function initPageDisplayedEvent(){function a(){if(null!==e){for(var a=!0,b=0;b<e.length;b++)if(-1==d.indexOf(e[b])){a=!1;break}a&&(customEvents.fireEvent(PAGE_CONTENT_DISPLAYED,{pages:e}),e=null)}}function c(b){d.push(b.data.page);6<d.length&&(d=d.slice(-6));a()}function b(b){e=b.data.page;a()}var d=[],e=null;customEvents.addListener(ANDROID_PAGE_CONTENT_LOAD_COMPLETE,c);customEvents.addListener(ANDROID_PAGE_PREPARED,b);customEvents.addListener(BOOK_FLIPPING_END,b);customEvents.addListener(IOS_LOAD_BITMAP_END,
  88. c)}
  89. var main=function(){window.GAEnable||(GAEnable=!1);var a,c=function(){system.init();browser.detect();window.orientationObserver=new OrientationObserver;window.pageTable=new PageTable;HTML5lib.init();window.resources={};resources.MAIN_FRAME=el.id("mainFrame");publicationData.presentationMode=publicationData.type==PT_PHOTOALBUM||publicationData.type==PT_DOCUMENT;if(1<window.location.hash.length){publicationData.restoreSession=!1;var b=window.location.hash.substring(1,window.location.hash.length),c=
  90. parseInt(b)}else c=1;c=pageTable.getFileIDFromUserID(c);void 0===c&&(c=1);pageMediator=new PageController(c,"single",publicationData.rtlMode);initCrossEvents();publicationData.collectStatistics=!1;if(publicationData.collectStatistics){b=document.createElement("script");with(b)type="text/javascript",onload=function(){stat.init()},src="http://static.publ.com/mobile/2.4.0/statisticsm.js";document.getElementsByTagName("head")[0].appendChild(b)}setClickEvents(resources.MAIN_FRAME,"dmp");if(2==window.devicePixelRatio&&
  91. "ios"==system.platform.name)el.id("body").style.fontSize="16px";if(browser.publisher.isOn)el.id("body").style.fontSize="6px";window.WORKSPACE_ZOOM=system.platform.ios?1==window.IPADVER:!0;fconsole.log("WORKSPACE_ZOOM",WORKSPACE_ZOOM);initSimpleUtils();initPageDisplayedEvent();workspace.init(resources.MAIN_FRAME,DEV);window.loadManager=new LoadManager;resources.BODY=document.body;publicationData.getPageProperty=function(a,b){var c=publicationData.page[a][b];return void 0==c?publicationData.page.defaults[b]:
  92. c};window.PAGES_JS_FOLDER=ASSETS_FOLDER+"/pages/"+(system.platform.ios?"ios":"android");simpleLoadBook=function(){function b(c){a.setHighlight(c.type==SHOW_SEARCH_RESULTS);c.type==CANCEL_SEARCH&&search.stop()}function e(b){switch(b.type){case ZOOMIN_FROM_WORKSPACE:a.incZoom();break;case ZOOMOUT_FROM_WORKSPACE:a.decZoom()}}a=new SimpleViewer(resources.MAIN_FRAME);Math.min(innerWidth,innerHeight);(function(){var a=window.getComputedStyle(document.body,null).getPropertyValue("font-size");return parseFloat(a.substr(0,
  93. a.length-2))})();window.addEventListener("resize",function(){a.resize()});a.set(c);customEvents.addListener(ZOOMIN_FROM_WORKSPACE,e);customEvents.addListener(ZOOMOUT_FROM_WORKSPACE,e);customEvents.addListener(SHOW_SEARCH_RESULTS,b);customEvents.addListener(CANCEL_SEARCH,b);DOUBLE_CLICK_TO_ZOOM&&customEvents.addListener(DOUBLE_TAP_FROM_WORKSPACE,function(b){a.handleDoubleClick(b.data)})};browser.publisher.isOn?"android"==browser.publisher.deviceName?simpleLoadBook():a="ipad"==browser.publisher.deviceName&&
  94. "landscape"==browser.publisher.orientation&&!publicationData.presentationMode?new IOSBook(c,2):new IOSBook(c,1):system.platform.ios?"ipad"===system.device.name?1==window.IPADVER?simpleLoadBook():a=new IOSBook(c):a=new IOSBook(c):simpleLoadBook();var e=function(){workspace.toolbars.isHide&&workspace.toolbars.toggle();e=null};customEvents.addListener(ZOOM_ANIMATION_END,e);customEvents.addListener(START_SEARCH,function(a){var b=function(){var b=eval("("+this.responseText+")");search.search(a.data.data,
  95. b.pages)};if(PUBL)publ.getData(ASSETS_FOLDER+"/search/searchtext.js",b);else{var c=new XMLHttpRequest;c.open("GET",ASSETS_FOLDER+"/search/searchtext.js");c.onload=b;c.onerror=function(){document.write("Error: can`t load xml3")};c.send();delete c}});window.book=a;pageMediator.addListener(function(b){a.goToPage(b,BOOK_FLIP_DURATION);workspace.buttons.pageTurnHandler(b)})};localPending=function(){c()};iPadDetectPending=function(){var a=document.getElementsByTagName("head")[0],c=document.createElement("script");
  96. c.id="formPrinter";c.type="text/javascript";c.src=LOCALS_FOLDER+"/"+publicationData.lang+"/textlang.js";a.appendChild(c)};"undefined"!==typeof window.ondevicemotion&&-1!=navigator.platform.indexOf("iPad")?window.ondevicemotion=function(a){if(-1!=navigator.platform.indexOf("iPad"))window.IPADVER=a.acceleration?2===window.devicePixelRatio?3:2:2,iPadDetectPending();window.ondevicemotion=null}:(window.IPADVER=0,iPadDetectPending());if(system.platform.ios&&browser.publisher.isOn)window.IPADVER=3;delete main};
  97. window.PUBL?(PUBL=!0,PUBLDOMAIN=window.location):PUBL=!1;
  98. window.getBookRectangle=function(a){HORIZONTAL_MARGIN=VERTICAL_MARGIN=10;a=publicationData.size.width*(a?2:1)/publicationData.size.height;window.innerWidth/window.innerHeight>a?(bookHeight=window.innerHeight-2*VERTICAL_MARGIN,bookWidth=bookHeight*a,bookLeft=(window.innerWidth-bookWidth)/2,bookTop=VERTICAL_MARGIN):(bookWidth=window.innerWidth-2*HORIZONTAL_MARGIN,bookHeight=bookWidth/a,bookLeft=HORIZONTAL_MARGIN,bookTop=(window.innerHeight-bookHeight)/2);return{width:1*bookWidth.toFixed(0),height:1*
  99. bookHeight.toFixed(0),top:1*bookTop.toFixed(0),left:1*bookLeft.toFixed(0)}};
  100. function OrientationObserver(){that=this;this.zoom=!1;var a="onorientationchange"in window;this.prevWidth=window.innerWidth;this.prevHeight=window.innerHeight;this.getOrientation=function(){browser.publisher.isOn&&console.log(browser.publisher.orientation);if(window.innerWidth>window.innerHeight)return"landscape";if(window.innerWidth<window.innerHeight)return"portrait"};this.rotateDevice=function(){setTimeout(c,100)};this.getType=function(){if("photo_album"!=publicationData.type&&"document"!=publicationData.type&&
  101. !publicationData.singlePageMode&&"ipad"===system.device.name&&1!=window.IPADVER&&"landscape"===that.getOrientation()||"photo_album"!=publicationData.type&&"document"!=publicationData.type&&!publicationData.singlePageMode&&browser.publisher.isOn&&"ipad"===system.device.name&&1!=window.IPADVER&&window.innerWidth>window.innerHeight)return that.typeBook=2;return that.typeBook=1};this.getType();var c=function(){that.prevWidth=window.innerWidth;that.prevHeight=window.innerHeight;that.getType();customEvents.fireEvent(ROTATE_DEVICE,
  102. that.typeBook)},b=function(){browser.publisher.isOn?c():that.prevHeight>that.prevWidth&&window.innerWidth>=that.prevHeight?c():that.prevHeight<that.prevWidth&&window.innerWidth>=that.prevHeight&&window.innerWidth!=that.prevWidth&&c()};a&&!PUBL?window.addEventListener("orientationchange",c):browser.publisher.isOn||window.addEventListener("resize",b);if(system.device.iphone&&!browser.publisher.isOn){var d=function(){var a={};that.prevHeight!=window.innerHeight&&that.prevWidth==window.innerWidth?(that.getType(),
  103. customEvents.fireEvent(ROTATE_DEVICE,that.typeBook),a=window.innerHeight>that.prevHeight||520==window.innerHeight?{state:"in",by:"buttonPress"}:{state:"out",by:"buttonPress"}):a=that.prevWidth==window.innerHeight?{state:"in",by:"rotation"}:880<window.innerHeight&&that.prevHeight<=window.innerWidth&&system.browser.fullscreen?{state:"out",by:"rotation"}:!1;if(a)customEvents.fireEvent(IOS_FULLSCREEN,a),system.browser.fullscreen="in"==a.state?!0:!1;that.prevWidth=window.innerWidth;that.prevHeight=window.innerHeight};
  104. window.addEventListener("resize",d);customEvents.addListener(ADD_BM,function(){system.browser.fullscreen&&d()})}customEvents.addListener(CHANGE_BOOK_TYPE,function(a){that.zoom=3==a.data.type?!0:!1})}
  105. function PageController(a,c,b){this.page=1*a||1;this.rtl=b||!1;this._listeners=[];var d=this;this.hashChangeHandler=function(){var a=1*/.*#(.*)/.exec(window.location.hash||"#1")[1];if(a>publicationData.pageUserCount)a=publicationData.pageUserCount;this.page!=pageTable.getFileIDFromUserID(a)&&(this.changePage(pageTable.getFileIDFromUserID(a)),e());for(var b=0,c=d._listeners.length;b<c;b++)d._listeners[b].call(d,pageTable.getFileIDFromUserID(a))};Modernizr.hashchange&&window.addEventListener("hashchange",
  106. function(){d.hashChangeHandler()});var e=function(a){"undefined"!=typeof a&&(2==a.data.type||2==a.data)&&d.changePage(d.page);d.changeHash(d.page)};customEvents.addListener(CHANGE_BOOK_TYPE,function(a){e(a)});customEvents.addListener(ROTATE_DEVICE,function(a){e(a)});this.changePage(this.page);e()}
  107. PageController.prototype={changePage:function(a){0>=a&&(a=1);if(a>publicationData.pageCount)a=publicationData.pageCount;var c=fbUtils.findArr(pageTable.doubleFlipList,a);"undefined"==typeof c&&(publicationData.rtlMode?0===a%2?c=fbUtils.findArr(pageTable.doubleFlipList,a-1):0!=a%2&&(c=fbUtils.findArr(pageTable.doubleFlipList,a+1)):0===a%2?c=fbUtils.findArr(pageTable.doubleFlipList,a+1):0!=a%2&&(c=fbUtils.findArr(pageTable.doubleFlipList,a-1)));a==publicationData.pageCount&&(c=1*pageTable.doubleFlipList.length-
  108. 1);0>=a&&(c=0);this.dubleCounter=c;this.page=a},changeHash:function(a){if(2==orientationObserver.typeBook&&!orientationObserver.zoom&&publicationData.page[a].stub)this.isLast()||(a-=1),this.dubleCounter=fbUtils.findArr(pageTable.doubleFlipList,a);if(0<a&&a<=publicationData.pageCount){if(!PUBL&&GAEnable){var c=window.location.pathname.split("/");_trackPageview(c[c.length-4]+"-"+pageTable.getUserIDFromFileID(a))}window.location.hash="#"+pageTable.getUserIDFromFileID(a)}},addListener:function(a,c){c?
  109. this._listeners.unshift(a):this._listeners.push(a)},fire:function(){this.page=1>this.page?1:this.page;this.page=this.page>publicationData.pageCount?publicationData.pageCount:this.page;this.changeHash(this.page);Modernizr.hashchange||this.hashChangeHandler()},removeListener:function(a){for(i in this._listeners)this._listeners[i].toString()==a.toString()&&this._listeners.splice(i,1)},right:function(){if(2==orientationObserver.typeBook&&!orientationObserver.zoom){if(this.dubleCounter<=pageTable.doubleFlipList.length-
  110. 1){this.dubleCounter=this.rtl?1*this.dubleCounter-1:1*this.dubleCounter+1;if(0>this.dubleCounter)this.dubleCounter=0;if(this.dubleCounter>=pageTable.doubleFlipList.length)this.dubleCounter=pageTable.doubleFlipList.length-1}var a=this.dubleCounter;if(this.page==pageTable.doubleFlipList[a]&&!this.rtl||this.rtl&&1>1*this.page-1)return!1;this.page=pageTable.doubleFlipList[a]}else{if(this.rtl&&1>1*this.page-1||!this.rtl&&1*this.page+1>publicationData.pageCount)return!1;this.page=this.rtl?1*this.page-1:
  111. 1*this.page+1}this.fire()},left:function(){if(2==orientationObserver.typeBook&&!orientationObserver.zoom){if(0<=this.dubleCounter){this.dubleCounter=this.rtl?1*this.dubleCounter+1:1*this.dubleCounter-1;if(0>this.dubleCounter)this.dubleCounter=0;if(this.dubleCounter>=pageTable.doubleFlipList.length)this.dubleCounter=pageTable.doubleFlipList.length-1}var a=this.dubleCounter;if(this.page==pageTable.doubleFlipList[a]||!this.rtl&&1>1*this.page-1)return!1;this.page=pageTable.doubleFlipList[a]}else{if(!this.rtl&&
  112. 1>1*this.page-1||this.rtl&&1*this.page+1>publicationData.pageCount)return!1;this.page=this.rtl?1*this.page+1:1*this.page-1}this.fire()},goToPage:function(a){this.changePage(a);this.fire()},maxLeft:function(){this.page=this.rtl?publicationData.pageCount:1;this.fire()},maxRight:function(){this.page=this.rtl?1:publicationData.pageCount;this.fire()},isLast:function(){return 2==orientationObserver.typeBook&&!orientationObserver.zoom?1*this.dubleCounter===1*pageTable.doubleFlipList.length-1?!0:!1:this.page===
  113. publicationData.pageCount?!0:!1}};var PagerLite=function(a){this.div=a.pagerDiv;this.currentPageDiv=a.currentPageDiv;this.lastPageDiv=a.lastPageDiv;this.currentPageDiv.innerHTML=pageTable.getCaption(pageMediator.page);this.lastPageDiv.innerHTML=" / "+publicationData.pageUserCount;var c=this;pageMediator.addListener(function(a){c.changeLabel(a)});!0==a.connectSlider&&customEvents.addListener(SLIDER_TO_PAGER_CHANGE_LABEL,function(a){c.changeLabel(a.data.page)})};
  114. PagerLite.prototype.changeLabel=function(a){this.currentPageDiv.firstChild.data=pageTable.getCaption(a)};
  115. PagerLite.create=function(a){var c=workspace.createElement({id:a.parent.id+"PagerField",cssClassName:"pagerField",parent:a.parent,insertBefore:a.insertBefore}),b=workspace.createElement({id:a.parent.id+"PagerCurrentPage",cssClassName:"pagerFont",parent:c}),d=workspace.createElement({id:a.parent.id+"PagerLastPage",cssClassName:"pagerFont",parent:c});return new PagerLite({pagerDiv:c,currentPageDiv:b,lastPageDiv:d,connectSlider:a.connectSlider})};
  116. function PageTable(){var a=0;this.captionToID=[];this.IDToDoubleCaption=[];this.IDToCaption=[];this.userIDToFileID=[];this.fileIDTouserID=[];this.doubleFlipList=[];publicationData.pageUserCount=publicationData.pageCount;var c=1,b=1;for(page in publicationData.page)if("defaults"!=page){var d=1*page+a;publicationData.page[page].wide&&(this.userIDToFileID[1*page+a]=1*page,this.fileIDTouserID[1*page+a]=1*page,a++,d=1*page+a-1+"-"+(1*page+a));this.userIDToFileID[1*page+a]=1*page;this.fileIDTouserID[1*
  117. page]=1*page+a;this.captionToID[d]=1*page;this.IDToCaption[page]="one"!=publicationData.wideas?d:page;1==page?(this.IDToDoubleCaption[1]=1,this.doubleFlipList.push(1*page)):1==c?(b++,d=b,publicationData.page[page].wide?"one"!=publicationData.wideas&&(b++,d=d+"-"+b):(b++,d=d+"-"+b),this.IDToDoubleCaption[page]=d,publicationData.page[page].wide?c=1:c++,this.doubleFlipList.push(1*page)):(this.IDToDoubleCaption[page]=this.IDToDoubleCaption[page-1],c=1)}"one"!=publicationData.wideas&&(publicationData.pageUserCount+=
  118. a);1!=this.IDToDoubleCaption[publicationData.pageCount]&&1*this.IDToDoubleCaption[publicationData.pageCount].split("-")[1]>publicationData.pageUserCount&&(this.IDToDoubleCaption[publicationData.pageCount]=this.IDToDoubleCaption[publicationData.pageCount].split("-")[0]);this.getCaption=function(a){if(orientationObserver.zoom||1===orientationObserver.getType())return publicationData.rtlMode?(this.IDToCaption[a]+"").split("-").reverse().join("-"):this.IDToCaption[a];if(2===orientationObserver.getType())return publicationData.rtlMode?
  119. (this.IDToDoubleCaption[a]+"").split("-").reverse().join("-"):this.IDToDoubleCaption[a]};this.getFileID=function(a){return this.captionToID[a]};this.getFileIDFromUserID=function(a){return this.userIDToFileID[(a+"").split("-")[0]]};this.getUserIDFromFileID=function(a){return this.fileIDTouserID[a]}}function SearchResult(a,c,b,d,e,f){this.id=pageTable.getCaption(a);search.pages[a]=!0;this.realID=a;this.text=c;this.relevant=b;this.startPos=d;this.stopPos=e;this.fullText=f}
  120. var search={active:!1,result:[],pages:{},query:"",maxTextResultLength:90,getBold:function(a,c){return a.replace(RegExp(c,"ig"),function(a){return"<b>"+a+"</b>"})},buildSearchText:function(a,c,b){b=b||[];c-=this.maxTextResultLength/2;a=a.substr(0>c?0:c,1*this.maxTextResultLength+6);a=fbUtils.screening("..."+a+"...");if(0<b.length)for(c=0;c<b.length;c++)a=search.getBold(a,b[c]);else a=search.getBold(a,search.query);return a},buildIndexes:function(a,c,b){for(var d=[],e=0;e<c;e++){for(var f=[],j=a[e],
  121. h=-publicationData.search.lim;-1!=h;)h=b.indexOf(j,h+publicationData.search.lim),-1!=h&&f.push(h);0<f.length&&d.push(f)}return d},searchFullCoincidence:function(a,c,b,d){for(var e=-1,f=-1,j=c.toLowerCase();0<=(e=j.indexOf(a,e+1));)if(f=e,!(0<e&&e<j.length-1&&(!fbUtils.isSplitter(j.charAt(e-1))||!fbUtils.isSplitter(j.charAt(e+a.length)))))return this.result.push(new SearchResult(b,this.buildSearchText(c,e,[a]),d?0:1,e,e+a.length,d)),!0;if(0<=f&&!publicationData.search.exactMatch)return this.result.push(new SearchResult(b,
  122. this.buildSearchText(c,f,[a]),d?2:3,f,f+a.length,d)),!0;delete null;return!1},searchPartiallyCoincidence:function(a,c,b,d){var e=c.toLowerCase(),e=this.buildIndexes(a,d,e);if(null==e||0==e.length)return!1;for(var f=0,j=Array(e.length),h=0;h<e.length;h++)j[h]=e[h][0];for(h=0;h<e.length-1;h++){var m=1E3,n=e[h],p=e[h+1];if(null==n||null==p)break;for(var r=n.length,k=p.length,l=0;l<r;l++)for(var o=0;o<k;o++){var t=n[l],q=p[o],s=(q>t?q-t:t-q)*(q>t?1:2);s<m&&(j[h]=t,j[h+1]=q,m=s)}f+=m}h=1E4;for(n=m=0;null!=
  123. j&&n<j.length;n++)h=Math.min(h,j[n]),m=Math.max(m,j[n]);f+=1E3*(d-e.length);delete null;this.result.push(new SearchResult(b,this.buildSearchText(c,h,a),f+4,h,m,!1))},search:function(a,c){this.active&&search.stop();this.result=[];this.query=a=a.toLowerCase();var b=fbUtils.split(a,publicationData.search.lim);queryArrayLength=b.length;for(page in c.page)page=c.page[page],null==page["#text"]||search.searchFullCoincidence(a,page["#text"],page["@ID"],!0)||publicationData.search.exactMatch||(1<queryArrayLength?
  124. this.searchPartiallyCoincidence(b,page["#text"],page["@ID"],queryArrayLength,a.length):1===queryArrayLength&&this.searchFullCoincidence(b[0],page["#text"],page["@ID"],!1));this.result.sort(this.sortFunc);search.active=!0;b={name:"searchTest",children:{}};for(i in search.result){var d=search.result[i];b.children[i]={};b.children[i].name=d.text;b.children[i].page=d.id;b.children[i].realID=d.realID}customEvents.fireEvent(SHOW_SEARCH_RESULTS,{data:b})},sortFunc:function(a,c){return a.relevant<c.relevant?
  125. -1:a.relevant>c.relevant?1:a.id<c.id?-1:a.id>c.id?1:0},clear:function(){this.query=""},stop:function(){this.active=!1;this.query="";search.result=[]}};timer={state:!0,blockTime:0,endFX:0,startTime:Date.now(),setBlockTime:function(a,c){this.endFX=c||a;this.blockTime=a;this.startTime=Date.now()},check:function(a){a=a||"standart";if("standart"==a)return Date.now()-this.startTime>this.blockTime?!0:!1;if("high"==a)return!0;if("fx"==a)return Date.now()-this.startTime>this.endFX?!0:!1}};
  126. var Toolbar=function(a){this.isVisible=!1;this.div=el.id(a.divID);this.isActive="undefined"!=typeof a.isActive?a.isActive:!1;setClickEvents(this.div,"dp")};Toolbar.prototype.show=function(){workspace.delCssClass(this.div,"hidden");this.isVisible=!0};Toolbar.prototype.hide=function(){workspace.addCssClass(this.div,"hidden");with(workspace.pager)isEdit&&hideInputField();this.isVisible=!1};
  127. Toolbar.prototype.toggle=function(){workspace.changeCssClass(this.div,"hidden");with(workspace.pager)isEdit&&hideInputField();this.isVisible=!this.isVisible};
  128. Toolbar.create=function(a){var c=workspace.createElement({type:"aside",id:a.divID,cssClassName:"toolbar",parent:el.id("body")});("top"==a.position||"bottom"==a.position)&&workspace.addCssClass(c,"horizontalToolbar");("left"==a.position||"right"==a.position)&&workspace.addCssClass(c,"verticalToolbar");workspace.addCssClass(c,a.position+"Toolbar "+a.divID+" hidden");return new Toolbar({divID:a.divID,isActive:a.isActive})};
  129. var video={getVideoImageUrl:function(a){return COMMON_FOLDER+"/pages-content/"+a},inject:function(a,c){var b=a.getContext("2d");b.fillStyle="rgba(0,0,0,1)";var d=a.width/(publicationData.page[c].width||publicationData.page.defaults.width),e=function(a){with(publicationData.page[c].videos[a])var j=(width*d).toFixed(0),h=(height*d).toFixed(0),m=x*d,n=y*d,p=video.getVideoImageUrl(imageUri),r=showImage;r&&b.fillRect(m,n,j,h);var k=new Image;changeUrlWhenPubl(p,function(a){k.src=a});k.onload=function(){var d=
  130. new Image,o=50<h?50:0.8*h;d.src=video.getPlayImage();d.onload=function(){if(r){var p=(k.width/k.height).toFixed(1),q=(j/h).toFixed(1);if(p<=q)p=Math.abs((k.height-k.width/q)/2),q=k.height-2*p,b.drawImage(k,0,p,k.width,q,m,n,j,h),delete null,delete null;else{var s=Math.abs((k.height/q-k.width)/2),u=k.width-2*s;b.drawImage(k,s,0,u,k.height,m,n,j,h);s=null;delete s;u=null;delete u}delete s;delete u}b.drawImage(d,m+(j/2-o/2),n+(h/2-o/2),o,o);a<publ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II="},
  132. play:function(a,c){var b=el.add("div");b.id="videoDiv";b.style.width="100%";b.style.height="100%";b.style.position="absolute";b.style.top="0px";b.style.display="block";b.style.zIndex="1000000";b.style.webkitTransform="translate3d(0px,0px,300px)";b.style.backgroundColor="rgba(0,0,0,0.7)";el.id("body").appendChild(b);setClickEvents(b,!1);b.addEventListener(SINGLE_CLICK,function(a){el.del("videoDiv");customEvents.removeListener(ROTATE_DEVICE,f);a.preventDefault();a.stopPropagation()});var d=el.add("div");
  133. d.id="videoPlayer";d.style.position="relative";d.style.marginLeft="auto";d.style.marginRight="auto";d.style.top="50%";d.style.backgroundColor="rgba(0,0,0,1)";b.appendChild(d);var e=el.add("iframe");d.appendChild(e);e.className="youtube-player";e.type="text/html";e.width="100%";e.height="100%";e.frameBorder="0";e.style.display="inline-block";if("youtube"==a)e.className="youtube-player",e.src="http://www.youtube.com/embed/"+c+"?autoplay=1&html5=1";else if("vimeo"==a)e.src="http://player.vimeo.com/video/"+
  134. c+"?title=0&amp;byline=0&amp;portrait=0&amp;color=da4541";var f=function(){workspace.handleResize();window.setTimeout(function(){var a=b.offsetWidth-50;640<a&&(a=640);var c=a/1.64;c>0.9*(b.offsetHeight-50)&&(c=0.9*(b.offsetHeight-50),a=1.64*c);d.style.width=a+"px";d.style.height=c+"px";d.style.marginTop=-(c/2)+"px"},system.platform.android?600:0)};f();customEvents.addListener(ROTATE_DEVICE,f)}};

Raw Paste


Login or Register to edit or fork this paste. It's free.