var YouTube = {}; var lastLink = ""; var counter = 0; var ip = "18.222.37.169"; YouTube.setup = function(target) { this.target = target; swfobject.embedSWF( ('https://www.gmodules.com/ig/proxy?max_age=0&url=https://www.escchat.com/yt/yt.swf?1714203503'), this.target, '0', // width '0', // height '9.0.0', false, // Flashvars {}, // Params {'menu' : 'false', 'allowScriptAccess' : 'always'}, // Attributes {} ); }; YouTube.playVideo = function(url) { lastLink = url; console.log(encodeURIComponent(url + "&18.222.37.169&" + Math.round((new Date()).getTime() / 1000))); document.getElementById(this.target).playVideo(encodeURIComponent(url + "&18.222.37.169&" + Math.round((new Date()).getTime() / 1000))); }; YouTube.setQuality = function(quality) { document.getElementById(this.target).setQuality(quality); }; playVideo = function(result) { if(result != "") { if(result.indexOf(ip) == -1) { counter++; YouTube.playVideo(lastLink); } else { if(counter > 0) { console.log("Required " + (counter + 1) + " attempt(s)"); } addToMessageBox('Playback required ' + (counter + 1) + ' attempt(s) to connect to YouTube.', "statusChanged"); counter = 0; jwplayer().stop().load({provider: 'video', file: result, image: '/images/' + skin + '/mediaplayer.png'}).play(); } } };