diff options
author | Heckyel <heckyel@openmailbox.org> | 2017-01-28 19:00:18 -0500 |
---|---|---|
committer | Heckyel <heckyel@openmailbox.org> | 2017-01-28 19:00:18 -0500 |
commit | fb993840a3e016d7b3ceabdf4b65750cce9ac221 (patch) | |
tree | 919d9425fb02f60faf81508b3392c22c92155a49 /librevideojs/selector | |
parent | bb0f3e1ed8a5de942cc65e5cd50b02a9b384ae33 (diff) | |
download | librevideojs-html5-player-fb993840a3e016d7b3ceabdf4b65750cce9ac221.tar.lz librevideojs-html5-player-fb993840a3e016d7b3ceabdf4b65750cce9ac221.tar.xz librevideojs-html5-player-fb993840a3e016d7b3ceabdf4b65750cce9ac221.zip |
Optimization of code
Diffstat (limited to 'librevideojs/selector')
-rw-r--r-- | librevideojs/selector/video-quality-selector.min.css | 1 | ||||
-rw-r--r-- | librevideojs/selector/video-quality-selector.min.js | 28 |
2 files changed, 0 insertions, 29 deletions
diff --git a/librevideojs/selector/video-quality-selector.min.css b/librevideojs/selector/video-quality-selector.min.css deleted file mode 100644 index 3c092d8..0000000 --- a/librevideojs/selector/video-quality-selector.min.css +++ /dev/null @@ -1 +0,0 @@ -@charset "utf-8";.librevjs-res-button{font-weight:bold;float:right;line-height:3em}ul li.librevjs-menu-title.librevjs-res-menu-title:hover{cursor:default;background-color:transparent;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none}.librevjs-res-button .librevjs-control-text{width:auto;height:auto;clip:auto}
\ No newline at end of file diff --git a/librevideojs/selector/video-quality-selector.min.js b/librevideojs/selector/video-quality-selector.min.js deleted file mode 100644 index 19c3f47..0000000 --- a/librevideojs/selector/video-quality-selector.min.js +++ /dev/null @@ -1,28 +0,0 @@ -/*! - * @source: - * @base: https://github.com/dominic-p/videojs-resolution-selector - * - * @licstart The following is the entire license notice for the - * JavaScript code in this page. - * - * Copyleft 2016 Jesus E. M. - * - * The JavaScript code in this page is free software: you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License (GNU GPL) as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) - * any later version. The code is distributed WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. - * - * As additional permission under GNU GPL version 3 section 7, you - * may distribute non-source (e.g., minimized or compacted) forms of - * that code without the copy of the GNU GPL normally required by - * section 4, provided you include this license notice and a URL - * through which recipients can access the Corresponding Source. - * - * @licend The above is the entire license notice - * for the JavaScript code in this page. - * -*/ -(function(b){var a={extend:function(c,d){for(var e in d){if(!d.hasOwnProperty(e)){continue}if(typeof d[e]=="object"&&null!==d[e]){c[e]=a.extend(c[e]||{},d[e])}else{c[e]=d[e]}}return c},res_label:function(c){return(/^\d+$/.test(c))?c+"p":c},matchResolution:function(c,d){},buildCookiesDummy:function(){return{get:function(c){return""},set:function(c,d){return false}}}};b.ResolutionMenuItem=b.MenuItem.extend({init:function(d,c){c.label=a.res_label(c.res);c.selected=(c.res.toString()===d.getCurrentRes().toString());b.MenuItem.call(this,d,c);this.resolution=c.res;this.on("click",this.onClick);d.on("changeRes",b.bind(this,function(){if(this.resolution==d.getCurrentRes()){this.selected(true)}else{this.selected(false)}}))}});b.ResolutionMenuItem.prototype.onClick=function(){var d=this.player(),g=d.el().firstChild,h=d.currentTime(),c=d.paused(),f=d.controlBar.resolutionSelector.el().firstChild.children,e=f.length;if(d.getCurrentRes()==this.resolution){return}if("none"==g.preload){g.preload="metadata"}d.src(d.availableRes[this.resolution]).one("loadedmetadata",function(){d.currentTime(h);if(!c){d.play()}});d.currentRes=this.resolution;while(e>0){e--;if("librevjs-current-res"==f[e].className){f[e].innerHTML=a.res_label(this.resolution);break}}d.trigger("changeRes")};b.ResolutionTitleMenuItem=b.MenuItem.extend({init:function(d,c){b.MenuItem.call(this,d,c);this.off("click")}});b.ResolutionSelector=b.MenuButton.extend({init:function(d,c){d.availableRes=c.available_res;b.MenuButton.call(this,d,c)}});b.ResolutionSelector.prototype.createItems=function(){var d=this.player(),c=[],e;c.push(new b.ResolutionTitleMenuItem(d,{el:b.Component.prototype.createEl("li",{className:"librevjs-menu-title librevjs-res-menu-title",innerHTML:"Calidad"})}));for(e in d.availableRes){if("length"==e){continue}c.push(new b.ResolutionMenuItem(d,{res:e}))}c.sort(function(g,f){if(typeof g.resolution=="undefined"){return -1}else{return parseInt(f.resolution)-parseInt(g.resolution)}});return c};b.plugin("resolutionSelector",function(s){if(!this.el().firstChild.canPlayType){return}var r=this,c=r.options().sources,l=c.length,k,p,g=a.extend({default_res:"",force_types:false},s||{}),m={length:0},h,d,e=(g.default_res&&typeof g.default_res=="string")?g.default_res.split(","):[],q="cliplibrejs.resolutionSelector",f=q+".res",o=(typeof(Cookies)==="function")?Cookies:a.buildCookiesDummy();while(l>0){l--;if(!c[l]["data-res"]){continue}h=c[l]["data-res"];if(typeof m[h]!=="object"){m[h]=[];m.length++}m[h].push(c[l])}if(g.force_types){for(h in m){if("length"==h){continue}l=g.force_types.length;while(l>0){l--;k=m[h].length;found_types=0;while(k>0){k--;if(g.force_types[l]===m[h][k].type){found_types++}}if(found_types<g.force_types.length){delete m[h];m.length--;break}}}}if(m.length<2){return}var n=o.get(f);if(n){e=[n].concat(e)}for(l=0;l<e.length;l++){if(m[e[l]]){r.src(m[e[l]]);r.currentRes=e[l];break}}r.getCurrentRes=function(){if(typeof r.currentRes!=="undefined"){return r.currentRes}else{try{return res=r.options().sources[0]["data-res"]}catch(i){return""}}};h=r.getCurrentRes();if(h){h=a.res_label(h)}d=new b.ResolutionSelector(r,{el:b.Component.prototype.createEl(null,{className:"librevjs-res-button librevjs-menu-button librevjs-control",innerHTML:'<div class="librevjs-control-content"><span class="librevjs-current-res">'+(h||"Quality")+"</span></div>",role:"button","aria-live":"polite",tabIndex:0}),available_res:m});this.on("changeRes",function(){o.set(f,r.getCurrentRes())});this.one("loadedmetadata",function(){var i=o.get(f);if(i){r.src(r.availableRes[i]);r.currentRes=i;r.trigger("changeRes")}});r.controlBar.resolutionSelector=r.controlBar.addChild(d)})})(cliplibrejs);
\ No newline at end of file |