magcore-osd-advertising
Version:
Osd to show advertising
3 lines • 16.9 kB
JavaScript
/*! magcore-osd-advertising v2.1.11 (webpack: v1.15.0) */
!function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";var i=n(1);i.addListeners({load:function(){n(13).load({name:core.environment.language||"en"},function(t){i.pages={main:n(15)},i.route(i.pages.main),i.ready()})}})},function(t,e,n){"use strict";var i=n(2);t.exports=i},function(t,e,n){"use strict";var i=n(3),o=n(7);window.core=window.parent.getCoreInstance(window,i),n(8),n(9),n(11)("sdk"),n(12),n(11)("app"),i.platform="mag",i.ready=function(){window.core.call("app:ready")},i.exit=function(){i.events["exit"]&&i.emit("exit"),core.call("exit")},o.load=function(t){document.body.setAttribute("platform",i.platform),core.ready?i.events["load"]&&i.emit("load",{}):core.once("load",function(){i.events[t.type]&&i.emit(t.type,t)})},Object.keys(o).forEach(function(t){window.addEventListener(t,o[t])}),t.exports=i},function(t,e,n){"use strict";function i(t,e){return!(!t||t.active)&&(t.$node.classList.add("active"),t.active=!0,s.activePage=t,t.events["show"]&&t.emit("show",{page:t,data:e}),!0)}function o(t){return!(!t||!t.active)&&(t.$node.classList.remove("active"),t.active=!1,s.activePage=null,t.events["hide"]&&t.emit("hide",{page:t}),!0)}var a=n(4),r=n(5).parse,s=new a;s.query=r(document.location.search.substring(1)),s.config=n(6),s.activePage=null,s.route=function(t,e){var n=s.activePage;return!(!t||t.active)&&(o(s.activePage),i(t,e),this.events["route"]&&this.emit("route",{from:n,to:t}),!0)},t.exports=s},function(t,e,n){"use strict";function i(){this.events={}}i.prototype={addListener:function(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)},once:function(t,e){var n=this;this.events[t]=this.events[t]||[],this.events[t].push(function i(){n.removeListener(t,i),e.apply(n,arguments)})},addListeners:function(t){var e;for(e in t)t.hasOwnProperty(e)&&this.addListener(e,t[e])},removeListener:function(t,e){this.events[t]&&(this.events[t]=this.events[t].filter(function(t){return t!==e}),0===this.events[t].length&&(this.events[t]=void 0))},emit:function(t){var e,n=this.events[t];if(n)for(e=0;e<n.length;e++)n[e].apply(this,Array.prototype.slice.call(arguments,1))}},i.prototype.constructor=i,t.exports=i},function(t,e){"use strict";t.exports={parse:function(t){var e={};return t.split("&").forEach(function(t){t=t.split("="),2===t.length&&(e[t[0]]=decodeURIComponent(t[1]))}),e},stringify:function(t){var e=[];return Object.keys(t).forEach(function(n){e.push(n+"="+encodeURIComponent(t[n]))}),e.join("&")}}},function(t,e){"use strict";t.exports={}},function(t,e,n){"use strict";var i=n(3);t.exports={DOMContentLoaded:function(t){i.events["dom"]&&i.emit("dom",t)},load:function(t){i.events[t.type]&&i.emit(t.type,t)},unload:function(t){i.events[t.type]&&i.emit(t.type,t)},error:function(t){},keydown:function(t){var e,n=i.activePage,o={code:t.keyCode,stop:!1};t.ctrlKey&&(o.code+="c"),t.altKey&&(o.code+="a"),t.shiftKey&&(o.code+="s"),e=n.activeComponent,e&&e!==n&&(e.events[t.type]&&e.emit(t.type,o,t),!o.stop&&e.propagate&&e.parent&&e.parent.events[t.type]&&e.parent.emit(t.type,o,t)),o.stop||(n.events[t.type]&&n.emit(t.type,o,t),t.stop||i.events[t.type]&&i.emit(t.type,o,t))},keypress:function(t){var e=i.activePage;e.activeComponent&&e.activeComponent!==e&&e.activeComponent.events[t.type]&&e.activeComponent.emit(t.type,t)},mousewheel:function(t){var e=i.activePage;e.activeComponent&&e.activeComponent!==e&&e.activeComponent.events[t.type]&&e.activeComponent.emit(t.type,t),t.stop||e.events[t.type]&&e.emit(t.type,t)}}},function(t,e){"use strict";if(!document.documentElement.classList){var n=Array.prototype,i=n.indexOf,o=n.slice,a=n.push,r=n.splice,s=n.join;window.DOMTokenList=function(t){if(this._element=t,t.className!==this._classCache){if(this._classCache=t.className,!this._classCache)return;var e,n=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(e=0;e<n.length;e++)a.call(this,n[e])}},window.DOMTokenList.prototype={add:function(t){this.contains(t)||(a.call(this,t),this._element.className=o.call(this,0).join(" "))},contains:function(t){return i.call(this,t)!==-1},item:function(t){return this[t]||null},remove:function(t){var e=i.call(this,t);e!==-1&&(r.call(this,e,1),this._element.className=o.call(this,0).join(" "))},toString:function(){return s.call(this," ")},toggle:function(t){return this.contains(t)?this.remove(t):this.add(t),this.contains(t)}},Object.defineProperty(Element.prototype,"classList",{get:function(){return new window.DOMTokenList(this)}})}},function(t,e,n){"use strict";var i=n(3),o=n(10);i.metrics=o[i.query.screenHeight]||o[screen.height]||o[720],i.metrics.availHeight=i.metrics.height-(i.metrics.availTop+i.metrics.availBottom),i.metrics.availWidth=i.metrics.width-(i.metrics.availLeft+i.metrics.availRight)},function(t,e){"use strict";t.exports={480:{height:480,width:720,availTop:24,availBottom:24,availRight:32,availLeft:48},576:{height:576,width:720,availTop:24,availBottom:24,availRight:26,availLeft:54},720:{height:720,width:1280,availTop:30,availBottom:30,availRight:40,availLeft:40},1080:{height:1080,width:1920,availTop:45,availBottom:45,availRight:60,availLeft:60}}},function(t,e,n){"use strict";var i=n(3);t.exports=function(t){var e=document.createElement("link");e.rel="stylesheet",e.href="css/release."+t+"."+i.metrics.height+".css",document.head.appendChild(e)}},function(t,e,n){"use strict";var i,o=n(3);i=document.createElement("link"),i.rel="stylesheet",i.href=window.core.theme.path+o.metrics.height+".css",document.head.appendChild(i),t.exports=i},function(t,e,n){"use strict";function i(t){var e=new a(t);return window.gettext=window._=e.gettext,window.pgettext=e.pgettext,window.ngettext=e.ngettext,e}var o=n(4),a=n(14),r=new o;r.defaultLanguage="en",r.load=function(t,e){var n;return t.ext=t.ext||"json",t.path=t.path||"lang",t.name===r.defaultLanguage?(i(),e(null),!1):(n=new XMLHttpRequest,n.onload=function(){var t;try{t=JSON.parse(n.responseText),i(t),e(null),r.events["load"]&&r.emit("load")}catch(t){n.onerror(t)}},n.ontimeout=n.onerror=function(t){i(),e(t),r.events["error"]&&r.emit("error",t)},n.open("GET",t.path+"/"+t.name+"."+t.ext,!0),n.send(null),!0)},t.exports=r},function(module,exports,__webpack_require__){"use strict";function Gettext(config){var data,meta;config=config||{},data=config.data||{},data[""]=data[""]||{},meta=config.meta,this.gettext=function(t){return data[""][t]||t},this.pgettext=function(t,e){return data[t]&&data[t][e]||e},this.ngettext=function(msgId,plural,value){var n;return data&&meta&&data[""][msgId]?data[""][msgId][eval("n = "+value+"; "+meta.plural)]:1===value?msgId:plural}}Gettext.prototype.constructor=Gettext,module.exports=Gettext},function(t,e,n){"use strict";function i(t,e){var n=t.stack[t.current];g.hide(),n.requiredPart&&(n.onRequiredWatch=function(){g.show(),g.focus(),g.once("click",function(){t.current++,t.current>=t.stack.length?(t.stack=[],t.current=0,t.lastWatch=new Date,g.hide(),m.stop(),e()):i(t,e)})}),v(t.current+1,t.stack.length),m.play(n,function(){g.hide(),t.current++,t.current>=t.stack.length?(t.stack=[],t.current=0,t.lastWatch=new Date,g.hide(),e()):i(t,e)})}function o(t,e){var n;if("play"===t.action&&e&&e.config.resource in h){if(n=h[e.config.resource],n.skipPlaybackTimes<4)return void n.skipPlaybackTimes++;if(t.pause(),n.stack.length)return core.call("show"),core.call("focus"),void i(n,function(){window.core.call("blur"),window.core.call("hide"),t.resume()});if(n.lastWatch&&new Date-n.lastWatch<60*w*1e3)return window.core.call("blur"),window.core.call("hide"),void t.resume();f.getAd(n.startCode,function(e,o){e||!o.length?(n.lastWatch=new Date,t.resume()):(core.call("show"),core.call("focus"),n.current=0,n.stack=o,i(n,function(){window.core.call("blur"),window.core.call("hide"),t.resume()}))})}}function a(t){var e;if(t.app.resource&&t.app.resource in h){if(e=h[t.app.resource],e.skipAppStartTimes<1)return e.skipAppStartTimes++,void t.done();if(e.stack.length)return core.call("show"),core.call("focus"),void i(e,function(){window.core.call("blur"),window.core.call("hide"),t.done()});if(e.lastWatch&&new Date-e.lastWatch<60*w*1e3)return window.core.call("blur"),window.core.call("hide"),void t.done();f.getAd(f.CODE_APP_START,function(n,o){n||!o.length?t.done():(core.call("show"),core.call("focus"),e.current=0,e.stack=o,i(e,function(){window.core.call("blur"),window.core.call("hide"),t.done()}))})}else t.done()}function r(){m.stop(),g.hide(),window.core.call("blur"),window.core.call("hide")}var s="pageMain",c=n(16),d=new c({$node:document.getElementById(s),focusable:!1}),l=n(19),u=n(1),p=n(22),h={video:{current:0,stack:[],lastWatch:0,startCode:202,playbackCode:203,skipPlaybackTimes:0,skipAppStartTimes:0},"tv-channel":{current:0,stack:[],lastWatch:0,startCode:204,playbackCode:205,skipPlaybackTimes:0,skipAppStartTimes:0}},f=n(23),v=n(25),m=n(27),g=new l({$node:document.getElementById("skipButton"),value:_("Skip ad"),events:{hide:function(){this.blur(),this.events.click=[]}}}),y=document.createElement("div"),w=15;y.className="theme-icon theme-icon-next",g.$node.appendChild(y),d.add(g),d.addListener("show",function(){g.hide()}),u.addListener("keydown",function(t){t.code===p.exit?(m.stop(),g.hide()):t.code===p.set&&r()}),window.parent.addIntentHook("before:play",o),window.system.addListener("run:app",a),window.core.addListener("hide",r),t.exports=d},function(t,e,n){"use strict";t.exports=n(17),t.exports.prototype.name="stb-component-page"},function(t,e,n){"use strict";function i(t){t=t||{},this.active=!1,this.activeComponent=null,o.call(this,t),this.active=this.$node.classList.contains("active"),null===this.$node.parentNode&&document.body.appendChild(this.$node),this.page=this}var o=n(18);i.prototype=Object.create(o.prototype),i.prototype.constructor=i,i.prototype.name="spa-component-page",t.exports=i},function(t,e,n){"use strict";function i(t){var e,n=this;if(t=t||{},this.visible=!0,this.focusable=!0,this.$node=null,this.$body=null,this.parent=null,this.children=[],this.propagate=!!t.propagate,a.call(this),this.$node=t.$node||document.createElement("div"),this.$body=t.$body||this.$node,this.$node.className=this.name+" "+(t.className||""),this.id=t.id||this.$node.id||"cid"+r++,t.parent&&t.parent.add(this),t.visible===!1&&this.hide(),t.focusable===!1&&(this.focusable=!1),this.defaultEvents){t.events=t.events||{};for(e in this.defaultEvents)t.events[e]=t.events[e]||this.defaultEvents[e]}t.events&&Object.keys(t.events).forEach(function(e){n.addListener(e,t.events[e])}),t.children&&this.add.apply(this,t.children),this.$node.addEventListener("click",function(t){n.focus(),n.events["click"]&&n.emit("click",t),t.stopPropagation()})}var o=n(3),a=n(4),r=0;i.prototype=Object.create(a.prototype),i.prototype.constructor=i,i.prototype.defaultEvents=null,i.prototype.add=function(t){var e;for(e=0;e<arguments.length;e++)t=arguments[e],this.children.push(t),t.parent=this,t.$node&&null===t.$node.parentNode&&this.$body.appendChild(t.$node),this.events["add"]&&this.emit("add",{item:t})},i.prototype.remove=function(){this.parent&&(o.activePage.activeComponent===this&&(this.blur(),this.parent.focus()),this.parent.children.splice(this.parent.children.indexOf(this),1)),this.children.forEach(function(t){t.remove()}),this.events={},this.$node.parentNode.removeChild(this.$node),this.events["remove"]&&this.emit("remove")},i.prototype.focus=function(t){var e=o.activePage,n=e.activeComponent;return!(!this.focusable||this===n)&&(n&&n.blur(),e.activeComponent=n=this,n.$node.classList.add("focus"),n.events["focus"]&&n.emit("focus",t),!0)},i.prototype.blur=function(){var t=o.activePage,e=t.activeComponent;return this.$node.classList.remove("focus"),this===e&&(t.activeComponent=null,this.events["blur"]&&this.emit("blur"),!0)},i.prototype.show=function(t){return!!this.visible||(this.$node.classList.remove("hidden"),this.visible=!0,this.events["show"]&&this.emit("show",t),!0)},i.prototype.hide=function(){return!this.visible||(this.$node.classList.add("hidden"),this.visible=!1,this.events["hide"]&&this.emit("hide"),!0)},t.exports=i},function(t,e,n){"use strict";t.exports=n(20),t.exports.prototype.name="stb-component-button"},function(t,e,n){"use strict";function i(t){t=t||{},o.call(this,t),t.icon&&(this.$icon=this.$body.appendChild(document.createElement("div")),this.$icon.className="icon "+t.icon),this.$text=this.$body.appendChild(document.createElement("div")),this.$text.classList.add("text"),t.value&&(this.$text.innerText=t.value)}var o=n(18),a=n(21);i.prototype=Object.create(o.prototype),i.prototype.constructor=i,i.prototype.name="spa-component-button",i.prototype.clickDuration=200,i.prototype.defaultEvents={click:function(){var t=this;this.$node.classList.add("click"),setTimeout(function(){t.$node.classList.remove("click")},this.clickDuration)},keydown:function(t){t.code===a.enter&&this.events["click"]&&this.emit("click",{event:t})}},t.exports=i},function(t,e){"use strict";t.exports={backspace:8,tab:9,enter:13,escape:27,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,del:46}},function(t,e,n){"use strict";var i=n(21);i.back=i.backspace,i.channelNext=i.tab,i.channelPrev=i.tab+"s",i.ok=i.enter,i.exit=i.escape,i.volumeUp=107,i.volumeDown=109,i.f1="112c",i.f2="113c",i.f3="114c",i.f4="115c",i.refresh="116c",i.frame="117c",i.phone="119c",i.set="120c",i.tv="121c",i.menu="122c",i.app="123c",i.rewind="66a",i.forward="70a",i.audio="71a",i.standby="74a",i.keyboard="76a",i.usbMounted="80a",i.usbUnmounted="81a",i.playPause="82a",i.play=-1,i.pause=-1,i.stop="83a",i.power="85a",i.record="87a",i.info="89a",i.mute="192a",i.digit0=48,i.digit1=49,i.digit2=50,i.digit3=51,i.digit4=52,i.digit5=53,i.digit6=54,i.digit7=55,i.digit8=56,i.digit9=57,t.exports=i},function(t,e,n){"use strict";var i,o=n(1),a=n(22),r=n(24),s={getAd:function(t,e){t=t||this.CODE_APP_START,i=window.req=window.core.backend.request("/advertising?place="+t,{onload:function(t,n){!t&&n&&n.data&&e?e(t,n.data.map(function(t){return new r(t)})):t&&e?e(t,[]):e&&e(!0,[])},onerror:function(){e&&e(!0,[])}})}};s.CODE_APP_START=201,s.CODE_VIDEO_CLUB_START_PLAYBACK=202,s.CODE_VIDEO_CLUB_DURING_PLAYBACK=203,s.CODE_TV_START_PLAYBACK=204,s.CODE_TV_DURING_PLAYBACK=205,o.addListener("keydown",function(t){t.code===a.exit&&i&&i.abort()}),t.exports=s},function(t,e){"use strict";function n(t){window.core.backend.request(t,{method:"GET"})}function i(t){t=t||{},this.tracking=t.tracking||{},this.requiredPart=t["skip_after"],this.campaign=t.campaign,this.url=t.video}i.prototype={},i.prototype.constructor=i,i.prototype.start=function(){this.tracking.start&&this.tracking.start.forEach(n)},i.prototype.quarter=function(){this.tracking.firstQuartile&&this.tracking.firstQuartile.forEach(n),this.quarter=null},i.prototype.middle=function(){this.tracking.midpoint&&this.tracking.midpoint.forEach(n),this.middle=null},i.prototype.thirdQuarter=function(){this.tracking.thirdQuartile&&this.tracking.thirdQuartile.forEach(n),this.thirdQuarter=null},i.prototype.complete=function(){this.tracking.complete&&this.tracking.complete.forEach(n)},t.exports=i},function(t,e,n){"use strict";var i=document.getElementById("title"),o=n(26);t.exports=function(t,e){i.innerText=o(_("Advertising {0} of {1}"),t,e)}},function(t,e,n){"use strict";t.exports=function(t){var e=Array.prototype.slice.call(arguments,1),n=/{(\d+)}/g;return t.replace(n,function(t,n){return void 0===e[n]?t:e[n]})}},function(t,e,n){"use strict";function i(){var t=d.GetPosPercent(),e=d.GetPosTime();o.onRequiredWatch&&e>=o.requiredPart&&(o.onRequiredWatch(),o.onRequiredWatch=null),t>=25&&o.quarter&&o.quarter(),t>=50&&o.middle&&o.middle(),t>=75&&o.thirdQuarter&&o.thirdQuarter(),c(t)}var o,a,r,s=window.parent.stbEvent,c=n(28),d=window.top.gSTB,l={};l.play=function(t,e){var n=t.url;o=t,d.SetPIG(1,0,0,0),d.Play(n),a=function(t){switch(t.code){case 7:r=setInterval(i,1e3),o.start();break;case 5:clearInterval(r),s.removeListener("media",a),c.clear(),e&&e(!1);break;case 1:o.complete(),clearInterval(r),s.removeListener("media",a),c.clear(),e&&e(!0)}},s.addListener("media",a)},l.stop=function(){s.removeListener("media",a),d.Stop(),c.clear(),clearInterval(r)},t.exports=l},function(t,e){"use strict";function n(t){a.clearRect(0,0,o.width,o.height),a.beginPath(),a.arc(r,s,70,Math.PI/180*270,Math.PI/180*630),a.strokeStyle="#b1b1b1",a.lineWidth="10",a.stroke(),a.beginPath(),a.strokeStyle=l,a.lineWidth="10",a.arc(r,s,70,Math.PI/180*270,Math.PI/180*(270+t*c)),a.stroke()}var i,o=document.getElementById("progress"),a=o.getContext("2d"),r=o.width/2,s=o.height/2,c=3.6,d=document.getElementById("hiddenBlock"),l="#b1b1b1";a.lineCap="round",i=window.getComputedStyle(d).backgroundColor,i&&(l=i),n.clear=function(){a.clearRect(0,0,o.width,o.height)},t.exports=n}]);
//# sourceMappingURL=release.map