1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-11-23 19:36:53 +00:00
not-gwent-online/assets/js/tubeplayer.js

4 lines
9.9 KiB
JavaScript
Raw Normal View History

2015-07-05 12:06:34 +00:00
/*! jQuery TubePlayer - v1.1.7 - 2013-09-24
* https://github.com/nirvanatikku/jQuery-TubePlayer-Plugin
* Copyright (c) 2013 Nirvana Tikku; Licensed MIT */
!function(a){"use strict";function b(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=0|16*Math.random(),c="x"==a?b:8|3&b;return c.toString(16)})}var c=".tubeplayer",d="jquery-youtube-tubeplayer",e="opts"+c,f={inited:!1,ytplayers:{},inits:[],iframeScriptInited:!1,State:{UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5},Error:{BAD_INIT:0,INVALID_PARAM:2,NOT_FOUND:100,NOT_EMBEDDABLE:101,CANT_PLAY:150}};a.tubeplayer={events:{},TubePlayer:f},a.tubeplayer.defaults={afterReady:function(){},stateChange:function(b){var c=this.onPlayer;return function(d){var e=a("#"+b).parent();switch("object"==typeof d&&(d=d.data),d){case f.State.UNSTARTED:return c.unstarted[b].call(e);case f.State.ENDED:return c.ended[b].call(e);case f.State.PLAYING:return c.playing[b].call(e);case f.State.PAUSED:return c.paused[b].call(e);case f.State.BUFFERING:return c.buffering[b].call(e);case f.State.CUED:return c.cued[b].call(e);default:return null}}},onError:function(b){var c=this.onErr;return function(d){var e=a("#"+b).parent();switch("object"==typeof d&&(d=d.data),d){case f.Error.BAD_INIT:case f.Error.INVALID_PARAM:return c.invalidParameter[b].call(e);case f.Error.NOT_FOUND:return c.notFound[b].call(e);case f.Error.NOT_EMBEDDABLE:case f.Error.CANT_PLAY:return c.notEmbeddable[b].call(e);default:return c.defaultError[b].call(e)}}},qualityChange:function(b){var c=this;return function(d){var e=a("#"+b).parent();return"object"==typeof d&&(d=d.data),c.onQualityChange[b].call(e,d)}},onQualityChange:{},onPlayer:{unstarted:{},ended:{},playing:{},paused:{},buffering:{},cued:{}},onErr:{defaultError:{},notFound:{},notEmbeddable:{},invalidParameter:{}}};var g={width:425,height:355,allowFullScreen:"true",initialVideo:"DkoeNLuMbcI",start:0,preferredQuality:"auto",showControls:!0,showRelated:!1,playsinline:!1,annotations:!0,autoPlay:!1,autoHide:!0,loop:0,theme:"dark",color:"red",showinfo:!1,modestbranding:!0,protocol:"http",wmode:"transparent",swfobjectURL:"ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js",loadSWFObject:!1,allowScriptAccess:"always",playerID:"tubeplayer-player-container",iframed:!0,onPlay:function(){},onPause:function(){},onStop:function(){},onSeek:function(){},onMute:function(){},onUnMute:function(){},onPlayerUnstarted:function(){},onPlayerEnded:function(){},onPlayerPlaying:function(){},onPlayerPaused:function(){},onPlayerBuffering:function(){},onPlayerCued:function(){},onQualityChange:function(){},onError:function(){},onErrorNotFound:function(){},onErrorNotEmbeddable:function(){},onErrorInvalidParameter:function(){}};a.fn.tubeplayer=function(b,d){var e=a(this),g=typeof b;return 0===arguments.length||"object"===g?e.each(function(){f.init(a(this),b)}):"string"===g?e.triggerHandler(b+c,"undefined"!=typeof d?d:null):void 0};var h=function(a){return function(b,c){var d=f.getPkg(b);if(d.ytplayer){var e=a(b,c,d);return"undefined"==typeof e&&(e=d.$player),e}return d.$player}};a.tubeplayer.getPlayers=function(){return f.ytplayers},f.init=function(h,j){if(h.hasClass(d))return h;var k=a.extend({},g,j);k.playerID+="-"+b(),h.addClass(d).data(e,k);for(var l in i)h.bind(l+c,h,i[l]);return f.initDefaults(a.tubeplayer.defaults,k),a("<div></div>").attr("id",k.playerID).appendTo(h),f.initPlayer(h,k),h},f.getPkg=function(a){var b=a.data,c=b.data(e),d=f.ytplayers[c.playerID];return{$player:b,opts:c,ytplayer:d}},f.iframeReady=function(b){return f.inits.push(function(){new YT.Player(b.playerID,{videoId:b.initialVideo,width:b.width,height:b.height,playerVars:{autoplay:b.autoPlay?1:0,autohide:b.autoHide?1:0,controls:b.showControls?1:0,loop:b.loop?1:0,playlist:b.loop?b.initialVideo:"",rel:b.showRelated?1:0,fs:b.allowFullScreen?1:0,wmode:b.wmode,showinfo:b.showinfo?1:0,modestbranding:b.modestbranding?1:0,iv_load_policy:b.annotations?1:3,start:b.start,theme:b.theme,color:b.color,playsinline:b.playsinline},events:{onReady:function(c){f.ytplayers[b.playerID]=c.target;var e=a(c.target.getIframe()).parents("."+d);a.tubeplayer.defaults.afterReady(e)},onPlaybackQualityChange:a.tubeplayer.defaults.qualityChange(b.playerID),onStateChan