magcore-osd-tv
Version:
TV app notification osd.
2 lines • 10.8 kB
JavaScript
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=3)}([function(t,e,i){"use strict";var n=i(1),s=i(6).parse,o=new n;o.query=s(document.location.search.substring(1)),o.config=i(7),o.activePage=null,o.route=function(t,e){var i,n=o.activePage;return!(!t||t.active)&&(t.name,t.id,t.name,t.id,(i=o.activePage)&&i.active&&(i.$node.classList.remove("active"),i.active=!1,o.activePage=null,i.name,i.id,i.name,i.id,i.events["hide"]&&i.emit("hide")),function(t,e){!t||t.active||(t.$node.classList.add("active"),t.active=!0,o.activePage=t,t.name,t.id,t.name,t.id,t.events["show"]&&t.emit("show",{data:e}))}(t,e),this.events["route"]&&this.emit("route",{from:n,to:t}),!0)},t.exports=o},function(t,e,i){"use strict";function n(){this.events={}}n.prototype={addListener:function(t,e){this.events[t]=this.events[t]||[],this.events[t].push(e)},once:function(t,e){var i=this;this.events[t]=this.events[t]||[],this.events[t].push(function n(){i.removeListener(t,n),e.apply(i,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,i=this.events[t];if(i)for(e=0;e<i.length;e++)i[e].apply(this,Array.prototype.slice.call(arguments,1))}},n.prototype.constructor=n,t.exports=n},function(t,e,i){"use strict";var n=i(0);t.exports=function(t){var e=document.createElement("link");e.rel="stylesheet",e.href="css/"+t+"."+n.metrics.height+".css",document.head.appendChild(e)}},function(t,e,i){"use strict";var n=i(4);n.addListeners({load:function(){n.pages={main:i(13)},n.ready(),n.route(n.pages.main)}})},function(t,e,i){"use strict";var n=i(5);t.exports=n},function(t,e,i){"use strict";var n=i(0),s=i(8);window.core=window.parent.getCoreInstance(window,n),i(9),i(10),i(2)("sdk"),i(12),i(2)("app"),n.platform="mag",n.ready=function(){window.core.call("app:ready")},n.exit=function(){n.events["exit"]&&n.emit("exit"),core.call("exit")},s.load=function(t){document.body.setAttribute("platform",n.platform),core.ready?n.events["load"]&&n.emit("load",{}):core.once("load",function(){n.events[t.type]&&n.emit(t.type,t)})},s.contextmenu=function(t){t.preventDefault()},Object.keys(s).forEach(function(t){window.addEventListener(t,s[t])}),t.exports=n},function(t,e,i){"use strict";t.exports={parse:function(t){var e={};return t.split("&").forEach(function(t){2===(t=t.split("=")).length&&(e[t[0]]=decodeURIComponent(t[1]))}),e},stringify:function(t){var e=[];return Object.keys(t).forEach(function(i){e.push(i+"="+encodeURIComponent(t[i]))}),e.join("&")}}},function(t,e,i){"use strict";t.exports={}},function(t,e,i){"use strict";var n=i(0);t.exports={DOMContentLoaded:function(t){n.events["dom"]&&n.emit("dom",t)},load:function(t){n.events[t.type]&&n.emit(t.type,t)},unload:function(t){n.events[t.type]&&n.emit(t.type,t)},error:function(t){},keydown:function(t){var e,i=n.activePage,s={code:t.keyCode,stop:!1};t.ctrlKey&&(s.code+="c"),t.altKey&&(s.code+="a"),t.shiftKey&&(s.code+="s"),(e=i.activeComponent)&&e!==i&&(e.events[t.type]&&e.emit(t.type,s,t),!s.stop&&e.propagate&&e.parent&&e.parent.events[t.type]&&e.parent.emit(t.type,s,t)),s.stop||(i.events[t.type]&&i.emit(t.type,s,t),t.stop||n.events[t.type]&&n.emit(t.type,s,t))},keypress:function(t){var e=n.activePage;e.activeComponent&&e.activeComponent!==e&&e.activeComponent.events[t.type]&&e.activeComponent.emit(t.type,t)},mousewheel:function(t){var e=n.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,i){"use strict";if(!document.documentElement.classList){var n=Array.prototype,s=n.indexOf,o=n.slice,a=n.push,c=n.splice,r=n.join;window.DOMTokenList=function(t){if(this._element=t,t.className!==this._classCache){if(this._classCache=t.className,!this._classCache)return;var e,i=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(e=0;e<i.length;e++)a.call(this,i[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-1!==s.call(this,t)},item:function(t){return this[t]||null},remove:function(t){var e=s.call(this,t);-1!==e&&(c.call(this,e,1),this._element.className=o.call(this,0).join(" "))},toString:function(){return r.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,i){"use strict";var n=i(0),s=i(11);n.metrics=s[n.query.screenHeight]||s[screen.height]||s[720],n.metrics.availHeight=n.metrics.height-(n.metrics.availTop+n.metrics.availBottom),n.metrics.availWidth=n.metrics.width-(n.metrics.availLeft+n.metrics.availRight)},function(t,e,i){"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,i){"use strict";var n,s=i(0);(n=document.createElement("link")).rel="stylesheet",n.href=window.core.theme.path+s.metrics.height+".css",document.head.appendChild(n),t.exports=n},function(t,e,i){"use strict";var n,s=new(i(14))({$node:document.getElementById("pageMain")}),o=document.getElementById("time"),a=document.getElementById("number"),c=document.getElementById("title"),r={favorite:document.getElementById("icon-favorite"),ts:document.getElementById("icon-ts"),pvr:document.getElementById("icon-pvr"),censored:document.getElementById("icon-censored")},d=!1;function h(){var t=new Date;o.innerText=("0"+t.getHours()).slice(-2)+":"+("0"+t.getMinutes()).slice(-2)}core.addListener("intent",function(t,e){switch(t.addListener("close",function(){setTimeout(function(){core.call("hide")},0)}),t.action){case"osd-tv":!function(t,e){a.innerText=t.number||"",c.innerText=t.name||"",t.favorite?r.favorite.classList.remove("hidden"):r.favorite.classList.add("hidden"),t.timeshift?r.ts.classList.remove("hidden"):r.ts.classList.add("hidden"),t.pvr?r.pvr.classList.remove("hidden"):r.pvr.classList.add("hidden"),t.censored?r.censored.classList.remove("hidden"):r.censored.classList.add("hidden"),clearTimeout(n),t.attach?d?(d=!1,e(!1,{}),setTimeout(function(){core.call("hide")},0)):d=!0:(d=!0,n=setTimeout(function(){core.applicationState.visible&&core.call("hide"),d=!1},5e3)),core.call("show"),e(!1,{})}(t.data,e)}}),h(),setInterval(h,35e3),window.core.addListener("hide",function(){window.core.call("hide")}),t.exports=s},function(t,e,i){"use strict";t.exports=i(15),t.exports.prototype.name="stb-component-page"},function(t,e,i){"use strict";var n=i(16);function s(t){t=t||{},this.active=!1,this.activeComponent=null,n.call(this,t),this.active=this.$node.classList.contains("active"),null===this.$node.parentNode&&document.body.appendChild(this.$node),this.page=this}s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.prototype.name="spa-component-page",t.exports=s},function(t,e,i){"use strict";var n=i(0),s=i(1),o=0;function a(t){var e,i=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,s.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"+o++,t.parent&&t.parent.add(this),!1===t.visible&&this.hide(),!1===t.focusable&&(this.focusable=!1),this.defaultEvents)for(e in t.events=t.events||{},this.defaultEvents)t.events[e]=t.events[e]||this.defaultEvents[e];t.events&&Object.keys(t.events).forEach(function(e){i.addListener(e,t.events[e])}),t.children&&this.add.apply(this,t.children),this.$node.addEventListener("click",function(t){i.focus(),i.events["click"]&&i.emit("click",t),t.stopPropagation()}),this.name,this.id,this.name,this.id}a.prototype=Object.create(s.prototype),a.prototype.constructor=a,a.prototype.defaultEvents=null,a.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),t.name,t.id,this.name,this.id,this.name,this.id,t.name,t.id,this.events["add"]&&this.emit("add",{item:t})},a.prototype.remove=function(){this.parent&&(n.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.$node.parentNode.removeChild(this.$node),this.events["remove"]&&this.emit("remove"),this.events={},this.name,this.id,this.name,this.id},a.prototype.focus=function(t){var e=n.activePage,i=e.activeComponent;return!(!this.focusable||this===i)&&(i&&i.blur(),e.activeComponent=i=this,i.$node.classList.add("focus"),this.name,this.id,this.name,this.id,i.events["focus"]&&i.emit("focus",t),!0)},a.prototype.blur=function(){var t=n.activePage,e=t.activeComponent;return this.$node.classList.remove("focus"),this===e?(t.activeComponent=null,this.name,this.id,this.name,this.id,this.events["blur"]&&this.emit("blur"),!0):(this.name,this.id,this.name,this.id,!1)},a.prototype.show=function(t,e){return!this.visible&&(this.$node.classList.remove("hidden"),this.visible=!0,this.name,this.id,this.name,this.id,this.events["show"]&&this.emit("show",t),"function"==typeof e&&setTimeout(e),!0)},a.prototype.hide=function(t){return!!this.visible&&(this.$node.classList.add("hidden"),this.visible=!1,this.name,this.id,this.name,this.id,this.events["hide"]&&this.emit("hide"),"function"==typeof t&&setTimeout(t),!0)},t.exports=a}]);
//# sourceMappingURL=main.js.map