This repository has been archived by the owner on Jul 12, 2021. It is now read-only.
/
epg.min.js
2 lines (2 loc) · 14.7 KB
/
epg.min.js
1
2
/*! epg-1.0.0.js create by Ian Lew 2018-04-07 */
(function(h,g,c){var t,e,i,n;t=function(){var t=[];var i={};var n=t.push;var s=t.indexOf;var e=i.toString;var r=i.hasOwnProperty;var f=function(){return new f.fn.init};f.fn=f.prototype={constructor:f,each:function(t){return f.each(this,t)}};f.extend=f.fn.extend=function(){var t,e,i,n,s,r,o=arguments[0]||{},a=1,l=arguments.length,h;if(typeof o==="boolean"){h=o;o=arguments[a]||{};a++}if(typeof o!=="object"&&!f.isFunction(o)){o={}}if(a===l){o=this;a--}for(;a<l;a++){if((t=arguments[a])!=null){for(e in t){i=o[e];n=t[e];if(o===n){continue}if(h&&n&&(f.isPlainObject(n)||(s=f.isArray(n)))){if(s){s=false;r=i&&f.isArray(i)?i:[]}else{r=i&&f.isPlainObject(i)?i:{}}o[e]=f.extend(h,r,n)}else if(n!==c){o[e]=n}}}}return o};f.extend({isNumeric:function(t){var e=t&&t.toString();return!f.isArray(t)&&e-parseFloat(e)+1>=0},isEmptyObject:function(t){for(var e in t){return false}return true},isArray:Array.isArray,isPlainObject:function(t){var e;if(f.type(t)!=="object"||t.nodeType||f.isWindow(t)){return false}if(t.constructor&&!r.call(t,"constructor")&&!r.call(t.constructor.prototype||{},"isPrototypeOf")){return false}for(e in t){}return e===c||r.call(t,e)},isFunction:function(t){return f.type(t)==="function"},isWindow:function(t){return t!=null&&t===t.window},type:function(t){if(t==null){return t+""}return typeof t==="object"||typeof t==="function"?i[e.call(t)]||"object":typeof t},makeArray:function(t,e){var i=e||[];if(t!=null){if(l(Object(t))){f.merge(i,typeof t==="string"?[t]:t)}else{n.call(i,t)}}return i},merge:function(t,e){var i=t.length;for(var n=0;n<e.length;n++){t[i++]=e[n]}t.length=i;return t},grep:function(t,e,i){var n,s=[],r=0,o=t,a=!i;for(;r<o;r++){n=!e(t[r],r);if(n!==a){s.push(t[r])}}return s},each:function(t,e){var i=0;if(l(t)){var n=t.length;for(;i<n;i++){if(e.call(t[i],i,t[i])===false){break}}}else{for(i in t){if(e.call(t[i],i,t[i])===false){break}}}return t},inArray:function(t,e,i){return e==null?-1:s.call(e,t,i)},visible:function(t){var e=h.getComputedStyle(t,null);if(e.visibility==="hidden"||e.display==="none"||e.opacity==="0"){return false}else{var i=t.parentNode,n;while(true){n=h.getComputedStyle(i,null);if(n.visibility==="hidden"||n.display==="none"||n.opacity==="0"){return false}if(i.localName==="body"){return true}i=i.parentNode}return true}},contains:function(t,e,i,n){return (e-t)+(n-i)>=Math.max(t,e,i,n)-Math.min(t,e,i,n)},distance:function(t,e,i,n){return parseInt(Math.sqrt(Math.pow(t-i,2)+Math.pow(e-n,2)))}});var o;var a=f.fn.init=function(t){if(t===c){t=o;return this}return f.makeArray(null,this)};a.prototype=f.fn;o=f();f.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){i["[object "+e+"]"]=e.toLowerCase()});function l(t){var e=!!t&&"length"in t&&t.length,i=f.type(t);if(i==="function"||f.isWindow(t)){return false}return i==="array"||e===0||typeof e==="number"&&e>0&&e-1 in t}return f}();e=function(u){function t(t){this.sign=t.sign;this.rim=t.rim;this.border=t.border;this.shadow=t.shadow;this.effect=t.effect;this.pointer=t.first;this.setRim()}t.prototype={left:function(){if(arguments.length){this.move(arguments[0])}else{this.move("left")}},right:function(){if(arguments.length){this.move(arguments[0])}else{this.move("right")}},up:function(){if(arguments.length){this.move(arguments[0])}else{this.move("up")}},down:function(){if(arguments.length){this.move(arguments[0])}else{this.move("down")}},move:function(t){var e,i=u.type(t);if(i==="object"&&t.nodeType){e=t}else if(/up|down|right|left/gi.test(t)){e=this.pointer&&this.next(t)}if(e){if(u.type(this.effect)==="number"){if(this.effect>1&&this.effect<5){this.pointer.style.cssText=""}else if(this.effect>500&&this.effect<2e3){if(this.twinkleTimer){clearInterval(this.twinkleTimer);this.twinkleTimer=null}}}this.pointer=e;this.setRim()}},parent:function(t,e){if(u.type(t)==="string"){t=g.querySelector(t)}if(u.type(e)==="string"){e=g.querySelector(e)}if(u.type(t)==="object"&&t.nodeType){var i=e?e.parentNode:this.pointer.parentNode;while(true){if(i.localName==="body"){if(t.isSameNode(i)){return true}else{return false}}else if(t.isSameNode(i)){return true}else{i=i.parentNode}}}return false},index:function(t,e){e=e||this.pointer;var i;if(u.type(t)==="string"){i=g.querySelectorAll(t+" .link")}else if(u.type(t)==="string"){i=t.querySelectorAll(".link")}for(var n=0,s=i.length;n<s;n++){if(e.isSameNode(i[n])){return n}}return-1},next:function(t){var e=this.pointer,i=p(e);var n,s,r,o,a;var l=g.querySelectorAll(this.sign);for(var h=0,f=l.length;h<f;h++){if(!l[h].isSameNode(e)){n=p(l[h],t);if(u.visible(l[h])){var c=d(i,n,s,r,t);s=c.pDvalue;r=c.mDvalue;c.pref&&(o=l[h]);c.min&&(a=l[h])}}}if(t==="left"||t==="right"){return o}else if(t==="up"||t==="down"){return o||a}},setRim:function(){if(this.pointer){if(!this.box){this.box=g.createElement("div");this.box.className+=this.rim.replace(/^\./g,"");g.body.appendChild(this.box)}var t=h.getComputedStyle(this.pointer,null);var e=parseInt(t.borderRadius);var i=parseInt(t.borderWidth);var n=this.pointer.getBoundingClientRect();var s=h.getComputedStyle(this.box,null);var r=parseInt(this.border?this.border.match(/\d+(px)$/gi)[0]:s.borderWidth);if(this.border&&this.shadow){this.box.style.cssText="width:"+n.width+"px;height:"+n.height+"px;border:"+this.border+";border-radius:"+(e+r)+"px;position:absolute;top:"+(n.top-r)+"px;left:"+(n.left-r)+"px;z-index: 9999;box-shadow:"+this.shadow+";-webkit-box-shadow:"+this.shadow+";-moz-box-shadow:"+this.shadow+";-ms-box-shadow:"+this.shadow+";-o-box-shadow:"+this.shadow+";"}else{this.box.style.cssText="width:"+n.width+"px;height:"+n.height+"px;border-radius:"+(e+r)+"px;position:absolute;top:"+(n.top-r)+"px;left:"+(n.left-r)+"px;z-index: 9999;"}if(u.type(this.effect)==="number"){if(this.effect>1&&this.effect<5){var o=(n.width-i*2)*this.effect+i*2,a=(n.height-i*2)*this.effect+i*2;this.pointer.style.cssText="transform:scale("+this.effect+","+this.effect+");-webkit-transform:scale("+this.effect+","+this.effect+");-moz-transform:scale("+this.effect+","+this.effect+");-ms-transform:scale("+this.effect+","+this.effect+");-o-transform:scale("+this.effect+","+this.effect+");";this.box.style.cssText="width:"+o+"px;height:"+a+"px;border:"+this.border+";border-radius:"+(e*this.effect+r)+"px;position:absolute;top:"+(n.top-(o-n.width)/2-r)+"px;left:"+(n.left-(a-n.width)/2-r)+"px;z-index: 9999;box-shadow:"+this.shadow+";-webkit-box-shadow:"+this.shadow+";-moz-box-shadow:"+this.shadow+";-ms-box-shadow:"+this.shadow+";-o-box-shadow:"+this.shadow+";"}else if(this.effect>500&&this.effect<2e3){var l=this;this.twinkleTimer=setInterval(function(){s=h.getComputedStyle(l.box,null);if(s.visibility==="visible"){l.box.style.visibility="hidden"}else{l.box.style.visibility="visible"}},l.effect)}}}}};function p(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.left+e.width,up:e.top,down:e.top+e.height}}function d(t,e,i,n,s){var r,o,a;if(s==="up"){if(t.up>e.down){r=u.distance(e.left,e.down,t.left,t.up);(!n||r<n)&&(n=r,a=true);(!i||u.contains(e.left,e.right,t.left,t.right)&&r<i)&&(i=r,o=true)}}else if(s==="down"){if(t.down<e.up){r=u.distance(e.left,e.up,t.left,t.down);(!n||r<n)&&(n=r,a=true);(!i||u.contains(e.left,e.right,t.left,t.right)&&r<i)&&(i=r,o=true)}}else if(s==="left"){if(t.left>e.right){r=u.distance(e.right,e.up,t.left,t.up);(!n||r<n)&&(n=r,a=true);(!i||u.contains(e.up,e.down,t.up,t.down)&&r<i)&&(i=r,o=true)}}else if(s==="right"){if(t.right<e.left){r=u.distance(e.left,e.up,t.right,t.up);(!n||r<n)&&(n=r,a=true);(!i||u.contains(e.up,e.down,t.up,t.down)&&r<i)&&(i=r,o=true)}}return{pDvalue:i,mDvalue:n,pref:o,min:a}}return t}(t);i=function(h){function t(t){var e={mode:"none",container:".swiper-container",wrapper:".swiper-wrapper",pagination:{wrapper:".swiper-pagination",tagName:"span",normal:".swiper-pagination-normal",active:".swiper-pagination-active"},prevButton:".swiper-button-prev",nextButton:".swiper-button-next",direction:"horizontal",autoPlay:5e3,distance:0};var i=h.extend(true,e,t);this.container=g.querySelector(i.container);this.wrapper=this.container.querySelector(i.wrapper);this.prevButton=this.container.querySelector(i.prevButton);this.nextButton=this.container.querySelector(i.nextButton);this.items=this.container.querySelectorAll(i.wrapper+" > *");this.itemNums=this.items.length;this.config={};if(i.mode==="none"&&this.itemNums){if(this.items[0].offsetWidth===this.wrapper.parentNode.offsetWidth){i.mode="slide"}else if(this.wrapper.offsetWidth>this.wrapper.parentNode.offsetWidth||this.items[0].offsetWidth<this.wrapper.parentNode.offsetWidth){i.mode="list"}}if(i.mode==="list"){for(var n in i){if(!/autoPlay|speed|loop|pagination/gi.test(n)){this.config[n]=i[n]}}if(this.config.direction==="horizontal"){this.pageNum=Math.ceil(this.wrapper.offsetWidth/this.wrapper.parentNode.offsetWidth);this.scrollWidth=this.wrapper.offsetWidth-this.wrapper.parentNode.offsetWidth;this.distance=i.distance?i.distance:this.wrapper.parentNode.offsetWidth}else if(this.config.direction==="vertical"){this.pageNum=Math.ceil(this.wrapper.offsetHeight/this.wrapper.parentNode.offsetHeight);this.scrollWidth=this.wrapper.offsetHeight-this.wrapper.parentNode.offsetHeight;this.distance=i.distance?i.distance:this.wrapper.parentNode.offsetHeight}this.currentPage=1}else if(i.mode==="slide"){for(var s in i){if(!/scrollbar|distance/gi.test(s)){this.config[s]=i[s]}}this.pagination=this.container.querySelector(this.config.pagination.wrapper);this.currentIdx=0;if(this.itemNums){var r="",o=this.config.pagination.normal.replace(/^\./g,""),a=this.config.pagination.active.replace(/^\./g,"");for(var l=0;l<this.itemNums;l++){if(l===this.currentIdx){this.pagination&&(r+="<"+this.config.pagination.tagName+' class="'+o+" "+a+'"></'+this.config.pagination.tagName+">");this.items[l].style.zIndex=2}else{this.pagination&&(r+="<"+this.config.pagination.tagName+' class="'+o+'"></'+this.config.pagination.tagName+">");this.items[l].style.zIndex=1}}if(this.pagination){this.pagination.innerHTML=r;this.allPagination=this.pagination.querySelectorAll(this.config.pagination.normal);this.currPagination=this.pagination.querySelector(this.config.pagination.active)}}this.config.autoPlay&&this.autoPlay()}(this.prevButton||this.nextButton)&&this.contrls()}t.prototype={left:function(){this.move("left",arguments[0])},right:function(){this.move("right",arguments[0])},up:function(){this.move("up",arguments[0])},down:function(){this.move("down",arguments[0])},move:function(t,e){if(this.config.mode==="slide"){if(!e){var i=this;this.delayTimer&&clearTimeout(this.delayTimer);this.slideTimer&&clearInterval(this.slideTimer);this.delayTimer=null,this.slideTimer=null;this.delayTimer=setTimeout(function(){i.autoPlay()},i.config.autoPlay)}this.items[this.currentIdx].style.zIndex=1;this.allPagination&&this.allPagination[this.currentIdx].classList.remove(this.config.pagination.active.replace(/^\./g,""));if(this.config.direction==="horizontal"){if(t==="left"){this.currentIdx=this.currentIdx>0?this.currentIdx-1:this.itemNums-1}else if(t==="right"){this.currentIdx=(this.currentIdx+1)%this.itemNums}}else if(this.config.direction==="vertical"){if(t==="up"){this.currentIdx=this.currentIdx>0?this.currentIdx-1:this.itemNums-1}else if(t==="down"){this.currentIdx=(this.currentIdx+1)%this.itemNums}}this.items[this.currentIdx].style.zIndex=2;this.allPagination&&this.allPagination[this.currentIdx].classList.add(this.config.pagination.active.replace(/^\./g,""))}else if(this.config.mode==="list"){if(this.config.direction==="horizontal"){if(t==="left"){if(this.currentPage>1){this.wrapper.style.left=this.wrapper.offsetLeft+this.distance+"px";--this.currentPage}}else if(t==="right"){if(this.currentPage<this.pageNum){this.wrapper.style.left=this.wrapper.offsetLeft-this.distance+"px";++this.currentPage}}}else if(this.config.direction==="vertical"){if(t==="up"){if(this.currentPage>1){this.wrapper.style.top=this.wrapper.offsetTop+this.distance+"px";--this.currentPage}}else if(t==="down"){if(this.currentPage<this.pageNum){this.wrapper.style.top=this.wrapper.offsetTop-this.distance+"px";++this.currentPage}}}}(this.prevButton||this.nextButton)&&this.contrls()},contrls:function(){if(this.config.mode==="slide"){if(this.config.autoPlay){this.prevButton.style.display="block";this.nextButton.style.display="block"}else{if(this.itemNums>1){if(this.currentIdx>0&&this.currentIdx<this.itemNums-1){this.prevButton.style.display="block";this.nextButton.style.display="block"}else if(this.currentIdx===0){this.prevButton.style.display="none";this.nextButton.style.display="block"}else if(this.currentIdx===this.itemNums-1){this.prevButton.style.display="block";this.nextButton.style.display="none"}}else{this.prevButton.style.display="none";this.nextButton.style.display="none"}}}else if(this.config.mode==="list"){if(this.scrollWidth>0){var t;if(this.config.direction==="horizontal"){t=this.wrapper.offsetLeft}else if(this.config.direction==="vertical"){t=this.wrapper.offsetTop}if(t<0&&Math.abs(t)<this.scrollWidth){this.prevButton.style.display="block";this.nextButton.style.display="block"}else if(t===0){this.prevButton.style.display="none";this.nextButton.style.display="block"}else if(Math.abs(t)>=this.scrollWidth){this.prevButton.style.display="block";this.nextButton.style.display="none"}}else{this.prevButton.style.display="none";this.nextButton.style.display="none"}}else{this.prevButton.style.display="none";this.nextButton.style.display="none"}},autoPlay:function(){var t=this;if(this.slideTimer){if(this.config.direction==="horizontal"){this.slideTimer=setInterval(function(){t.right(true)},t.config.autoPlay)}else if(this.config.direction==="vertical"){this.slideTimer=setInterval(function(){t.down(true)},t.config.autoPlay)}}}};return t}(t);n=function(r,o,t){r.extend({init:function(t){var e={controller:{},cursor:{sign:".link",first:g.querySelector(".link"),rim:".pseudo",mode:"outer",border:"#ffde00 solid 2px",shadow:"0 0 8px 1px #000",effect:null}};var i=r.extend(true,e,t);if(!t||t.mode==="inline"){r.cursor=new o(i.cursor)}else{var n={};for(var s in i.cursor){if(!/border|shadow/gi.test(s)){n[s]=i.cursor[s]}}r.cursor=new o(n)}r.left=i.controller.left;r.right=i.controller.right;r.up=i.controller.up;r.down=i.controller.down;r.enter=i.controller.enter;r.back=i.controller.back;r.state="initialization"},swiper:t});if(typeof Navigation!=="undefined"){Navigation.disableDefaultNavigation();Navigation.disableHighlight()}function n(t){if(t===37||t===97){r.left?r.left():r.cursor.left()}else if(t===38||t===119){r.up?r.up():r.cursor.up()}else if(t===39||t===100){r.right?r.right():r.cursor.right()}else if(t===40||t===115){r.down?r.down():r.cursor.down()}else if(t===13){r.enter&&r.enter()}else if(t===98||t===8){r.back&&r.back()}}function e(t){t=t||h.event;var e=t.which||t.keyCode;if(e===768){if(typeof Utility!=="undefined"){var i=Utility.getEvent();r.state&&n(i.type,true)}}else{r.state&&n(e)}}g.onsystemevent=e;g.onkeypress=e;g.onirkeypress=e;return r}(t,e,i);h.epg=n})(window,document);