Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function QS2Hash() {
- var q = {};
- var qs = window.location.search.substring(1)
- qs && qs.split('&').forEach(function(i) {
- q[i.split('=')[0]] = i.split('=')[1];
- });
- return q
- }
- //Query string params
- var params = QS2Hash()
- function includeJs(filename, cb) {
- var head = document.getElementsByTagName('head')[0]
- var script = document.createElement('script')
- script.src = filename
- script.type = 'text/javascript'
- script.onload = cb
- head.appendChild(script)
- }
- function O_assign(dest, tpl, custom) {
- Object.keys(tpl).forEach(function(k) {
- dest[k] = tpl[k]
- })
- Object.keys(custom).forEach(function(k) {
- dest[k] = custom[k]
- })
- return dest
- }
- function isFlashPlayerSupported(){
- var isFlashInstalled = (function(){
- var b=new function(){var n=this;n.c=!1;var a="ShockwaveFlash.ShockwaveFlash",r=[{name:a+".7",version:function(n){return e(n)}},{name:a+".6",version:function(n){var a="6,0,21";try{n.AllowScriptAccess="always",a=e(n)}catch(r){}return a}},{name:a,version:function(n){return e(n)}}],e=function(n){var a=-1;try{a=n.GetVariable("$version")}catch(r){}return a},i=function(n){var a=-1;try{a=new ActiveXObject(n)}catch(r){a={activeXError:!0}}return a};n.b=function(){if(navigator.plugins&&navigator.plugins.length>0){var a="application/x-shockwave-flash",e=navigator.mimeTypes;e&&e[a]&&e[a].enabledPlugin&&e[a].enabledPlugin.description&&(n.c=!0)}else if(-1==navigator.appVersion.indexOf("Mac")&&window.execScript)for(var t=-1,c=0;c<r.length&&-1==t;c++){var o=i(r[c].name);o.activeXError||(n.c=!0)}}()};
- return b.c;
- })();
- if(isFlashInstalled){
- return true
- }else{
- return false
- }
- }
- function i18nText(identifier){
- var texts = {
- es: {
- ads: {
- skipmessage: 'Saltar en xx',
- skiptext: 'Saltar',
- admessage: 'El anuncio se cerrará en xx segundos...',
- cuetext: 'Publicidad'
- },
- sharing: {
- heading: 'Compartir Video',
- },
- player: {
- title: 'Reproducir video',
- live: 'En vivo'
- },
- related: {
- heading: 'Videos Relacionados',
- autoplaymessage: '__title__ se reproducirá en xx segundos'
- },
- flash:{
- message: 'Debes tener instalado Flash Player para reproducir el contenido.',
- linkText: 'Haz click aquà para ir a la página de descarga'
- }
- },
- en: {
- ads: {
- skipmessage: 'Skip in xx',
- skiptext: 'Skip',
- admessage: 'Skip ad in xx seconds...',
- cuetext: 'Advertising'
- },
- sharing: {
- heading: 'Share Video',
- },
- player: {
- title: 'Play Video',
- live: 'Live Broadcast'
- },
- related: {
- heading: 'Related Videos',
- autoplaymessage: '__title__ will reproduce in xx seconds'
- },
- flash: {
- message: 'You must have Flash Player installed ir order to play this content',
- linkText: 'Go to download page...'
- }
- }
- }
- return texts[identifier.toLowerCase()] || texts['es'];
- }
- function buildAdvertising(opts) {
- var tag = opts.adsTag
- var adsTagRaw = opts.adsTagRaw
- var adsClient = opts.adsClient || 'vast' //Por defecto que sea vast por el momento. Con richard vamos a ver si lo cambiamos a ima.
- var adBreaks = opts.adBreaks || [{offset: 'pre'}, {offset: 3 * 60}, {offset: 'post'}]
- var description_url = opts.canonical_url
- ? encodeURIComponent(opts.canonical_url)
- : encodeURIComponent(location.protocol + '//' + location.hostname + location.pathname);
- var duration = 3 * 60;
- var ord = Number(ord) || Math.floor(Math.random()*10e12);
- var lang = opts.lang || 'es'
- var adTag = adsTagRaw ? adsTagRaw : 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480|300x250|320x50|300x600|960x90&iu=' + tag + '&ciu_szs=300x250,320x50,728x90,970x90&impl=s&gdfp_req=1&env=vp&output=xml_vast2&unviewed_position_start=1&url=[referrer_url]&description_url=' + description_url + '&correlator=' + ord;
- var breaks = adBreaks.map(function(i) {
- return O_assign({}, {type: 'linear', tag: adTag}, i)
- })
- // //Echate el postroll para los live streams
- // //Esto se hizo, para el patchUefa, cosa que el postroll del bumper no vaya y por lo tanto no se repita 3 veces la publicidad...
- // if (opts.file && opts.file.indexOf('m3u8') > -1)
- // breaks = breaks.filter(function(i) {return i.offset !== 'post'})
- var schedule = breaks.reduce(function(prev, curr, idx){
- prev['adbreak' + (idx+1)] = curr
- return prev
- }, {})
- return {
- autoplayadsmuted: true, //autoplay for ads
- client: adsClient,
- skipmessage: i18nText(lang).ads.skipmessage,
- skiptext: i18nText(lang).ads.skiptext,
- admessage: i18nText(lang).ads.admessage,
- cuetext: i18nText(lang).ads.cuetext,
- schedule: schedule
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement