1var pljssglobal = []; 2var pljssglobalid; 3function Playerjs(options) { 4 var v = { 5 log: 0, 6 logout: 0, 7 lang: "ru", 8 screencolor: "#000000", 9 bgcolor: "#ffffff", 10 rounding: 0, 11 nativecontrols: 0, 12 toolbar: { 13 color: "000000", 14 a: "0.4", 15 h: 34, 16 stretchonfullscreen: 1, 17 hide: 1, 18 hidewithoutmoving: 1, 19 leftandrightpadding: 3, 20 animation: "none", 21 paddingtop: 0 22 }, 23 hotkey: { 24 f: 1, 25 r: 1, 26 m: 1, 27 seek: 5, 28 leftright: "seek", 29 space: 1, 30 updown: "volume" 31 }, 32 volume: 0.8, 33 volumestore: 1, 34 mute: 0, 35 preload: 0, 36 autoplay: 0, 37 file_separator: ',', 38 poster_scale: 'auto', 39 d: location.hostname, 40 href: location.href, 41 https: location.href.indexOf("https") == 0, 42 vast_pauseonclick: 1, 43 alerts: 1, 44 rightclick: 0, 45 playersize: { 46 aspect: '16x9' 47 }, 48 hlschangequality: 'next', 49 hlsdebug: 0, 50 dashdebug: 0, 51 nameofhlsquality: 0, 52 nameofyoutubequality: 0, 53 nameofdashquality: 0, 54 eventstracker: 0, 55 events: "PlayerjsEvents", 56 errortimeout: 5000, 57 container_h_procent: '100%' 58 }; 59 var o = { 60 play: 0, 61 playerid: 'bxrglkmzqw7p', 62 default_w: 640, 63 default_h: 360, 64 version: '2.13', 65 compilation: ['HLS', '', 'VAST'], 66 compilations: '', 67 fullscreen: false, 68 u: '#1fZxnM3xmaK5kc2YWdjw6wkoXAroXAqwTwOFWc2YjMLwjCOTjM29Tc3wjCjwXAroXArojzqxPbKFmwkPYzqxXMKFlbK5Oeu9XwkPZAqXja3xiaummcOEjCksTwNsjCkoVCqXjd3FZaLFkbu9VaOJTcvBkdNJmcjw6Av0TwNBWcOFZc2Ygeum0cuIjCOTjc3xlaLwjCksTwN9VwkPYzqxiM3FQc24jCjx0bLFTaGwTwOF5duIjCjx0aLi0wjXjdu9nbLFQc24jCjx0c3oUcuJNeqwTwNBT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9XwkQ7wN9ZauJZwkPYAjXjc24jCkoTwNmkc24jCjw8an48dNJkeqpPaKmObvE9xnsZxZp3bKF0br0OAHwOwvl9xnEOwvh9xnEOwuaQcuX9xZBNaNaNaNMOzn48z2d#wjXjMKB0bK9VwkPjd3FWdqwTwOF5duIjCjxneNdjzqxjaZw6Av0TwOBmevFQcNenwkQ7wNxOM29Tc3wjCjwXAroXArojzqxja2BWcu9Zc3amdjw6wkI1BHI1BGwTwNxOMGw6Aq42zqxja2tWeNJZwkPUAGXjdu9nbLFQc24jCjxjc3F0c20UdNmObvEjzqxUMLxObK4jCjwXwrohAqoXwjXjdutlaumVaZw6wkdhAHIhBZoYBGwTwNBWcu9ZwkPjaNaNaNaNwjXjaN9VevBQfNIjCksZzqx2MKY1aKaWcOFnbLQmwkPYAqXjeum0cuJkc2YWdjw6wNaNaNaNajwTwOaicvJmM29Tc3wjCjxNaNFlAKMjzqxiwkPYzqxic3amdjw6zHt9zqxTMK5OwkPjdOIjzqxXdNJTc2tlwkPYzqxieLFWduYifGw6AqXjeNtneqw6AGXjdvxmdN9Tcqw6wjwTwNYWaZw6AGXjduYifKJZd2m6aGw6fZxid3pmM3EjCjw0frAjgGXjeNtnet9XMLJnaK9VM2YQM2TjCkoTwOaWcvJUaGw6wkoVBGwTwNiWeuUmfGw6fZxWcjw6AGXjd3piM2IjCkp9gE==', 69 y: 'xx??x?=xx????=', 70 isflash: 0, 71 motions: [], 72 files_quality: [], 73 files_audiotrack: [], 74 rightclick: 0 75 }; 76 var default_style = { 77 but: { 78 "w": 20, 79 "h": 20, 80 "action": "-", 81 "action_back": "-", 82 "a": 1, 83 "aover": -1, 84 "color": "ffffff", 85 "type": "", 86 "scale": 1, 87 "scaleover": -1, 88 "rotation": 0, 89 "tip": 1, 90 "icon": "", 91 "text": "", 92 "font": "Verdana", 93 "fontsize": 12, 94 "letterspacing": 0, 95 "position": "controls", 96 "margin": "0 3 0 3", 97 "click": 1, 98 "hand": 1, 99 "bg": 0, 100 "bgo": 0, 101 "bga": 1, 102 "bgaover": -1, 103 "bgcolor": "000000", 104 "bgpadding": "0 0 0 0", 105 "iconscolor": -1, 106 "animation": "none", 107 "target": "_blank", 108 "tip": 0, 109 "tipbgcolor": "000000", 110 "tipbga": 0.7, 111 "tipbgrounding": 0, 112 "tipcolor": "ffffff", 113 "tippadding": "5 5 5 5", 114 "tipa": 1, 115 "tipfont": "arial, helvetica, sans-serif", 116 "tipfontsize": 10, 117 "tiptext": "", 118 "afterclick": { 119 "normalscreen": 1, 120 "toggle": "", 121 "remove": 0, 122 "removealso": "" 123 }, 124 "hidden": 0, 125 "shadow": { 126 "on": 0, 127 "inner": 0, 128 "blur": 2, 129 "angle": 90, 130 "distance": 1, 131 "color": "000000", 132 "a": 0.3 133 }, 134 "stripsw": 2, 135 "stripsspace": 2, 136 "linespeed1": 0.2, 137 "linespeed2": 0, 138 "linespeed3": 0.1, 139 "rounding": 0, 140 "handle": 0, 141 "handleicon": "<g><ellipse ry='5' rx='5' cy='10' cx='10' fill='#fff'/></g>", 142 "handlea": 1, 143 "handleaover": -1, 144 "handlehide": 0, 145 "handlescale": 1, 146 "handlecolor": -1, 147 "slidespeed": 0.1 148 } 149 };
150 var VastLoader = function() { 151 var vast = []; 152 var vastType = ''; 153 var vastUrl; 154 var die_error = false; 155 vast.events = []; 156 //eval(decode('#1euiQdZ5Ac2tlwr0haOJVM3FQc24PfqY5yLU2MLB0JvmXaGo9wvl7eNtZwvPhDGoOduYifKJZbOAVM29UzvF2bnMVdOIOC3aidjp6fjo9wvPVd3pTbLEPxZXOyHU2MLwhaZo9wvMVaq5QcNFmfs9NyqdVxZl9DG0YwvY8wvMVaq5nduYQeqhOzjdQDH00C3MVaqo9DGoOxn9Owr0haNtTd2I6xZd7fOPVaN9ZFKtkbqiNeK5keumWcjilyLUQajoPaq5QcNFmfs9NyqdVxZl#AqoNxjpVaLdhINJOFLiXyuEhyZoOxqdTwqeQxZlVeuJneqi2zNEQyLUOwr0hevx1aHUZaLF1dN47gL0QC2mNyqtOyLUTc2dPx1apI1EhFu9UMKmVdZptdOxWdjdQC28VMKB0bK9VdZ5KMLB0FLxZc3wPyHU9aKYnaLUAc2tlKu1TyvhQC319CX==')); 157 this.Load = function(x,y){ 158 vastType = y; 159 var z = 'playerjs.com,tvknews.ru'; 160 var zz = z.split(','); 161 var g = v.d.indexOf('.')==-1 || v.d.split('.')==4; 162 v.d == ''?g = false:''; 163 zz.forEach(function(d){ 164 if (d.indexOf('.')>0 && new RegExp(d + '$', 'i').test(v.d)){ 165 g = true; 166 return; 167 } 168 }); 169 if(!g){ 170 log('VAST Domains Error'); 171 o.actions.VastError(); 172 }else{ 173 LoadXml(x); 174 } 175 }; 176 function LoadXml(x) { 177 x = vastURL(x); 178 vastUrl = x; 179 var XHR = ("onload"in new XMLHttpRequest()) ? XMLHttpRequest : XDomainRequest; 180 var xhr = new XHR(); 181 xhr.open('GET', x, true); 182 xhr.onload = function() { 183 Parsing(this) 184 } 185 ; 186 xhr.onerror = function(e) { 187 ErrorLoad() 188 } 189 ; 190 xhr.send() 191 } 192 function ErrorLoad() { 193 log("VAST Loading Error"); 194 !die_error ? o.actions.VastError() : ''; 195 die_error = true 196 } 197 function ErrorParsing() { 198 log("VAST Parsing Error"); 199 !die_error ? o.actions.VastError() : ''; 200 die_error = true 201 } 202 function Parsing(x) { 203 if (x.responseXML == null || vastType == '') { 204 ErrorLoad() 205 } else { 206 var xml = x.responseXML; 207 var ad = g("InLine", g("Ad", xml)); 208 var wrapper = g("Wrapper", g("Ad", xml)); 209 vast.isWrapper = false;
210 vast.isVpaid = false; 211 if (wrapper) { 212 vast.isWrapper = true; 213 ad = wrapper; 214 vast.wrapper = t("VASTAdTagURI", ad) 215 } 216 if (ad) { 217 vast.adsystem = t("AdSystem", ad); 218 _Event("Impression", ad); 219 _Event("Error", ad); 220 var creatives = g("Creatives", ad); 221 if (creatives) { 222 var creative = g("Linear", g("Creative", creatives)); 223 if (creative) { 224 if (t("Duration", creative) != "") { 225 vast.duration = seconds(t("Duration", creative)) 226 } 227 if (t("AdParameters", creative) != "") { 228 vast.adparameters = t("AdParameters", creative); 229 try { 230 vast.adparametersjson = JSON.parse(vast.adparameters) 231 } catch (e) {} 232 } 233 if (g("MediaFiles", creative)) { 234 vast.file = _Media("MediaFile", g("MediaFiles", creative)) 235 } 236 if (g("TrackingEvents", creative)) { 237 _Tracking("Tracking", "event", g("TrackingEvents", creative)) 238 } 239 var clicks = g("VideoClicks", creative); 240 if (clicks) { 241 vast.click = t("ClickThrough", clicks); 242 _Tracking("ClickTracking", "id", clicks) 243 } 244 } 245 } 246 vast.extensions = []; 247 var extensions = g("Extensions", ad); 248 if (creative) { 249 var skipoffset = creative.getAttribute("skipoffset"); 250 if (skipoffset) { 251 vast.extensions.skipTime = seconds(skipoffset) 252 } 253 } 254 if (extensions) { 255 _Extensions(extensions) 256 } 257 } 258 } 259 if (vast.isWrapper) { 260 log("Wrapper", vast.wrapper); 261 LoadXml(vast.wrapper) 262 } else { 263 if (exist(vast.file)) { 264 o.actions.VastReady(vast) 265 } else { 266 if (g("nobanner", xml)) {} else { 267 Event("Error") 268 } 269 !die_error ? o.actions.VastError() : ''; 270 die_error = true 271 } 272 } 273 } 274 function g(x, xml) { 275 if (exist(xml)) { 276 return xml.getElementsByTagName(x)[0] 277 } else { 278 return null 279 } 280 } 281 function t(x, xml) { 282 if (exist(xml.getElementsByTagName(x)[0])) { 283 if (exist(xml.getElementsByTagName(x)[0].childNodes[0])) { 284 return xml.getElementsByTagName(x)[0].childNodes[0].wholeText.trim() 285 } else { 286 return "" 287 } 288 } else { 289 return "" 290 } 291 } 292 function _Event(x, xml) { 293 if (!exist(vast.events[x])) { 294 vast.events[x] = [] 295 } 296 if (exist(xml.getElementsByTagName(x)[0])) { 297 for (var i = 0; i < xml.getElementsByTagName(x).length; i++) { 298 var y = xml.getElementsByTagName(x)[i].childNodes; 299 for (var j = 0; j < y.length; j++) { 300 var z = y[j].textContent.replace(/\s+/g, ' ').trim(); 301 if (z != '') { 302 vast.events[x].push(z) 303 } 304 } 305 } 306 } 307 } 308 function _Tracking(x, x2, xml) { 309 if (exist(xml.getElementsByTagName(x)[0])) { 310 for (var i = 0; i < xml.getElementsByTagName(x).length; i++) { 311 var y = xml.getElementsByTagName(x)[i].getAttribute(x2); 312 if (y) { 313 if (x == "ClickTracking" && y != "skipAd") { 314 y = "click" 315 } 316 var n = xml.getElementsByTagName(x)[i].childNodes; 317 if (n.length > 0) { 318 var z = xml.getElementsByTagName(x)[i].childNodes[0].textContent.replace(/\s+/g, ' ').trim(); 319 if (!exist(vast.events[y])) { 320 vast.events[y] = [] 321 } 322 vast.events[y].push(z) 323 } 324 } 325 } 326 } 327 } 328 function _Extensions(xml) { 329 if (exist(xml.getElementsByTagName("Extension")[0])) { 330 for (var i = 0; i < xml.getElementsByTagName("Extension").length; i++) { 331 var y = xml.getElementsByTagName("Extension")[i].getAttribute("type"); 332 if (y) { 333 var z = xml.getElementsByTagName("Extension")[i].childNodes[0].textContent.replace(/\s+/g, ' ').trim(); 334 if (y == "Allowblock" && (o.media.duration() > 120 || o.media.duration() == 0)) { 335 if (z == '1') { 336 if (vastType == "preroll") { 337 vastUrl.indexOf("vr=1") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=1", "vr=5")) : ''; 338 vastUrl.indexOf("vr=5") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=5", "vr=9")) : '' 339 } 340 if (vastType == "midroll") { 341 vastUrl.indexOf("vr=2") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=2", "vr=6")) : ''; 342 vastUrl.indexOf("vr=6") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=6", "vr=10")) : '' 343 } 344 if (vastType == "pauseroll") { 345 vastUrl.indexOf("vr=3") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=3", "vr=7")) : ''; 346 vastUrl.indexOf("vr=7") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=7", "vr=11")) : '' 347 } 348 if (vastType == "postroll") { 349 vastUrl.indexOf("vr=4") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=4", "vr=8")) : ''; 350 vastUrl.indexOf("vr=8") > 0 ? o.actions.VastInsertAnd(vastUrl.replace("vr=8", "vr=12")) : '' 351 } 352 } 353 } else { 354 if (y == "skipAd" || y == "addClick") { 355 if (!exist(vast.events[y])) { 356 vast.events[y] = [] 357 } 358 vast.events[y].push(z) 359 } else { 360 if (y.indexOf("Time") > -1) { 361 z = seconds(z) 362 } 363 if (y.indexOf("Txt") > -1) { 364 z = decodeHtml(z) 365 } 366 vast.extensions[y] = z 367 } 368 } 369 } 370 } 371 } 372 } 373 function _Media(x, xml) { 374 var r = ""; 375 if (exist(xml.getElementsByTagName(x)[0])) { 376 for (var i = 0; i < xml.getElementsByTagName(x).length; i++) { 377 var y = xml.getElementsByTagName(x)[i]; 378 var type = y.getAttribute("type"); 379 var api = y.getAttribute("apiFramework"); 380 r = y.textContent.replace(/\s+/g, ' ').trim(); 381 if (type.indexOf("javascript") > -1 && api == "VPAID") { 382 vast.isVpaid = true; 383 break 384 } 385 if (type.indexOf("mp4") > -1) { 386 break 387 } 388 } 389 } 390 return r 391 } 392 function vastURL(x) { 393 x = x.replace(/\(referer\)/g, encodeURIComponent(location.href)); 394 x = x.replace(/\(random\)/g, Math.random()); 395 if (v.https) { 396 x = x.replace("http:", "https:") 397 } 398 return x 399 } 400 function seconds(x) { 401 if (x.split(":").length == 2) { 402 x = "00:" + x 403 } 404 var y = Date.parse("Thu, 01 Jan 1970 " + x + " GMT"); 405 if (y > 0) { 406 return new Date(y).getSeconds() 407 } else { 408 return 0 409 } 410 } 411 function decodeHtml(x) { 412 var div; 413 if (x) { 414 div = createElement('div'); 415 div.innerHTML = x; 416 return decodeURIComponent(div.textContent) 417 } else { 418 return void 0 419 } 420 } 421 function Event(x) { 422 if (exist(vast.events[x])) { 423 for (var i = 0; i < vast.events[x].length; i++) { 424 var gif = document.createElement("img"); 425 gif.setAttribute('src', vast.events[x][i]); 426 gif.setAttribute('height', '1px'); 427 gif.setAttribute('width', '1px'); 428 o.frame.appendChild(gif); 429 gif.style.display = "none" 430 } 431 } 432 } 433 };
434 var VastVideo = function() { 435 var vast; 436 o.vastcontainer = createElement("div"); 437 css(o.vastcontainer, { 438 "position": "absolute", 439 "width": "100%", 440 "height": "100%", 441 "background-color": "#000000" 442 }); 443 o.frame.appendChild(o.vastcontainer); 444 var tag = createElement("video"); 445 o.vastcontainer.appendChild(tag); 446 hide(o.vastcontainer); 447 css(tag, { 448 'autoplay': 1, 449 'width': '100%', 450 'height': '100%', 451 'object-fit': 'contain' 452 }); 453 attr(tag, { 454 'preload': 'auto', 455 'x-webkit-airplay': 'allow', 456 'webkit-playsinline': true, 457 'cursor': 'pointer' 458 }); 459 var duration; 460 var paused; 461 var controls; 462 var uiplay, uiplay2; 463 var uibuffer; 464 var uibuffer_style; 465 var uit; 466 var uitxt; 467 var uitbg; 468 var uimute; 469 var uiunmute; 470 var uimutebg; 471 var uiprogress; 472 var uix; 473 var uiskip; 474 var vpaidframe; 475 var vpaidslot; 476 var vpaid; 477 var vpaidinterval; 478 var vpaidvolume; 479 var vpaidvolume2; 480 var vpaidstopped = false; 481 var vpaidskipped = false; 482 tag.play(); 483 this.Go = function(x) { 484 tag.volume = 0.4; 485 duration = 0; 486 paused = false; 487 controls = true; 488 vast = x; 489 show(o.vastcontainer); 490 if (exist(vast.extensions.controls)) { 491 if (vast.extensions.controls == 0) { 492 controls = false 493 } 494 } 495 if (vast.isVpaid) { 496 vpaidslot = createElement("div"); 497 o.vastcontainer.appendChild(vpaidslot); 498 css(vpaidslot, { 499 "position": "absolute", 500 "top": "0", 501 "left": "0", 502 "width": "100%", 503 "height": "100%" 504 }) 505 } 506 tag.removeEventListener("click", onScreenClick); 507 if (exist(vast.extensions.isClickable)) { 508 if (vast.extensions.isClickable == 1) { 509 tag.addEventListener("click", onScreenClick) 510 } 511 } else { 512 tag.addEventListener("click", onScreenClick) 513 } 514 RemoveInterface(); 515 uiplay = createElement("div"); 516 css(uiplay, { 517 "position": "absolute", 518 "top": "0", 519 "left": "0", 520 "width": "100%", 521 "height": "100%", 522 "display": "none", 523 "cursor": "pointer" 524 }); 525 o.vastcontainer.appendChild(uiplay); 526 uiplay2 = createElement("div"); 527 css(uiplay2, { 528 "position": "absolute", 529 "top": "50%", 530 "left": "50%", 531 "margin-left": -10, 532 "margin-top": -10, 533 "cursor": "pointer", 534 "transform": "scale(3)", 535 "background": "#000", 536 "border-radius": 20, 537 "width": 20, 538 "height": 20, 539 "padding": "3px 2px 3px 4px" 540 }); 541 uiplay2.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g><path d='m4.59375,3.48438l-0.03125,13.03125l10.875,-6.51563l-10.84375,-6.51562z' fill='#ffffff'/></g></svg>"; 542 uiplay.appendChild(uiplay2); 543 uiplay.onclick = onScreenClick; 544 uibuffer = createElement("div"); 545 css(uibuffer, { 546 "position": "absolute", 547 "top": "50%", 548 "left": "50%", 549 "margin-left": -30, 550 "margin-top": -30, 551 "pointerEvents": "none" 552 }); 553 uibuffer.innerHTML = "<div class='loader_pljsvast'><svg class='circular_pljsvast' viewBox='25 25 50 50'><circle class='path_pljsvast' stroke='#fff' cx='50' cy='50' r='20' fill='none' stroke-width='2' stroke-miterlimit='10'/></svg></div>"; 554 var uibuffercss = ".loader_pljsvast {position: relative;margin: 0 auto;width: 50px;}.loader_pljsvast:before {content: '';display: block;padding-top: 100%;}.circular_pljsvast {-webkit-animation: rotate 2s linear infinite;animation: rotate 2s linear infinite;height: 100%;-webkit-transform-origin: center center;transform-origin: center center;width: 100%;position: absolute;top: 0;bottom: 0;left: 0;right: 0;margin: auto;}.path_pljsvast {stroke-dasharray: 1, 200;stroke-dashoffset: 0;-webkit-animation: dash 1.5s ease-in-out infinite;animation: dash 1.5s ease-in-out infinite;}@-webkit-keyframes rotate {100% {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}@keyframes rotate {100% {-webkit-transform: rotate(360deg);transform: rotate(360deg);}}@-webkit-keyframes dash {0% {stroke-dasharray: 1, 200;stroke-dashoffset: 0;}50% {stroke-dasharray: 89, 200;stroke-dashoffset: -35px;}100% {stroke-dasharray: 89, 200;stroke-dashoffset: -124px;}}@keyframes dash {0% {stroke-dasharray: 1, 200;stroke-dashoffset: 0;}50% {stroke-dasharray: 89, 200;stroke-dashoffset: -35px;}100% {stroke-dasharray: 89, 200;stroke-dashoffset: -124px;}}"; 555 uibuffer_style = document.createElement('style'); 556 uibuffer_style.type = 'text/css'; 557 if (uibuffer_style.styleSheet) { 558 uibuffer_style.styleSheet.cssText = uibuffercss 559 } else { 560 uibuffer_style.appendChild(document.createTextNode(uibuffercss)) 561 } 562 o.vastcontainer.appendChild(uibuffer_style); 563 o.vastcontainer.appendChild(uibuffer);
564 if (controls) { 565 if (!exist(uitbg)) { 566 uitbg = createElement("div"); 567 css(uitbg, { 568 "position": "absolute", 569 "top": 0, 570 "left": 0, 571 "width": "100%", 572 "height": 19, 573 "background-color": "#000000", 574 "opacity": 0.4, 575 "transition": "height 0.1s linear" 576 }); 577 o.vastcontainer.appendChild(uitbg) 578 } else { 579 css(uitbg, { 580 "height": 19 581 }) 582 } 583 if (!exist(uit)) { 584 uit = createElement("div"); 585 css(uit, { 586 "position": "absolute", 587 "top": 5, 588 "left": 8, 589 "text-transform": "uppercase", 590 "letter-spacing": 2, 591 "font-size": 9, 592 "color": "#fff" 593 }); 594 uit.innerHTML = Lang("advertising"); 595 o.vastcontainer.appendChild(uit) 596 } 597 if (exist(vast.extensions.linkTxt)) { 598 if (!exist(uitxt)) { 599 uitxt = createElement("div"); 600 css(uitxt, { 601 "background": "#2fd565", 602 "padding": "7px 10px", 603 "position": "absolute", 604 "bottom": 50, 605 "margin-left": "auto", 606 "margin-right": "auto", 607 "left": 0, 608 "right": 0, 609 "font-size": "14px", 610 "color": "#000", 611 "border-radius": 3, 612 "display": "table", 613 "width": "50%", 614 "text-align": "center", 615 "cursor": "pointer" 616 }); 617 uitxt.innerHTML = vast.extensions.linkTxt; 618 o.vastcontainer.appendChild(uitxt); 619 uitxt.onclick = onInvite 620 } else { 621 show2(uitxt); 622 uitxt.innerHTML = vast.extensions.linkTxt 623 } 624 } else { 625 if (exist(uitxt)) { 626 hide2(uitxt) 627 } 628 } 629 if (!o.system.mobile) { 630 uimutebg = createElement("div"); 631 o.vastcontainer.appendChild(uimutebg); 632 css(uimutebg, { 633 "position": "absolute", 634 "bottom": 10, 635 "right": 10, 636 "background": "#000000", 637 "border-radius": 30, 638 "height": 30, 639 "width": 30 640 }); 641 uimute = createElement("div"); 642 css(uimute, { 643 "position": "absolute", 644 "bottom": 11, 645 "right": 15, 646 "text-align": "center", 647 "cursor": "pointer", 648 "transform": "scale(1)" 649 }); 650 uimute.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g><path fill='#fff' stroke='#000' stroke-width='0' d='m2.49931,6.8746l0,6.25079l3.10029,0l4.64114,4.37461l0.00276,-15l-4.64182,4.37461l-3.10237,0l0,-0.00001zm10.44167,-0.75275c-0.26762,-0.30766 -0.69733,-0.30766 -0.96359,0.00158c-0.26557,0.30925 -0.26557,0.80989 0.00136,1.11992l0,-0.00157c0.58769,0.68334 0.94997,1.62056 0.94997,2.66218c0,1.04083 -0.3616,1.97489 -0.94861,2.65823c-0.2683,0.30766 -0.2683,0.8083 -0.00136,1.11912c0.13279,0.15423 0.30713,0.23173 0.48146,0.23173c0.17501,0 0.34934,-0.0775 0.48213,-0.23173c0.83216,-0.9649 1.34835,-2.30548 1.34767,-3.77735c0.00068,-1.47504 -0.51755,-2.8172 -1.34903,-3.7821l0,-0.00001zm1.55246,-1.75907c-0.27124,0.30979 -0.27124,0.81211 0,1.12031c1.00334,1.14962 1.62195,2.73104 1.62195,4.4852c0,1.75256 -0.61861,3.3332 -1.62056,4.48361c-0.27125,0.30899 -0.27125,0.81053 0,1.12031c0.13493,0.1545 0.31208,0.23214 0.48991,0.23214c0.17713,0 0.35428,-0.07764 0.48921,-0.23214c1.25105,-1.43327 2.02674,-3.41876 2.02536,-5.60392c0.00069,-2.18675 -0.775,-4.17383 -2.02813,-5.60551c-0.27194,-0.30979 -0.70857,-0.30979 -0.97774,0z'/></g></svg>"; 651 uiunmute = createElement("div"); 652 css(uiunmute, { 653 "position": "absolute", 654 "bottom": 11, 655 "right": 15, 656 "text-align": "center",
657 "cursor": "pointer", 658 "transform": "scale(1)", 659 "display": "none" 660 }); 661 uiunmute.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'><g><path fill='#fff' stroke='#000' stroke-width='0' d='m2.49931,6.8746l0,6.25079l3.10029,0l4.64114,4.37461l0.00276,-15l-4.64182,4.37461l-3.10237,0l0,-0.00001z'/><path d='m18.125,12.20836l-2.20816,-2.20816l2.20776,-2.20816l-1.13498,-1.13579l-2.20816,2.20816l-2.20816,-2.20816l-1.13498,1.13579l2.20776,2.20816l-2.20816,2.20816l1.13579,1.13539l2.20776,-2.20816l2.20776,2.20816' fill-opacity='null' stroke-opacity='null' stroke-width='0' stroke='#000' fill='#fff'/></g></svg>"; 662 o.vastcontainer.appendChild(uimute); 663 o.vastcontainer.appendChild(uiunmute); 664 uimute.onclick = onMute; 665 uiunmute.onclick = onUnmute 666 } 667 uiprogress = createElement("div"); 668 o.vastcontainer.appendChild(uiprogress); 669 uiprogress.innerHTML = '<svg id="pljsvastprogress" width="20" height="20" viewPort="0 0 10 10" version="1.1" xmlns="http://www.w3.org/2000/svg"><circle r="9" cx="10" cy="10" fill="transparent" stroke-dasharray="56.48" stroke-dashoffset="0" stroke-width="2" style="stroke:#666;"></circle><circle id="pljsvastprogressbar" r="9" cx="10" cy="10" fill="transparent" stroke-dasharray="56.48" stroke-dashoffset="0" stroke-width="2" style="stroke:#fff;opacity:0"></circle>'; 670 css(uiprogress, { 671 "background": "#000000", 672 "border-radius": 30, 673 "padding": 5, 674 "height": 20, 675 "font-color": "#fff", 676 "position": "absolute", 677 "bottom": 10, 678 "left": 10, 679 "transform": "rotate(-90deg)" 680 }); 681 uix = createElement("div"); 682 css(uix, { 683 "position": "absolute", 684 "top": -100, 685 "right": 9, 686 "font-size": "25px", 687 "color": "#fff", 688 "opacity": 0, 689 "visibilty": "hidden", 690 "transition": "opacity 0.2s linear", 691 "cursor": "pointer" 692 }); 693 uix.innerHTML = 'â'; 694 o.vastcontainer.appendChild(uix); 695 uix.onclick = onClose; 696 uiskip = createElement("div"); 697 css(uiskip, { 698 "background": "#000000", 699 "padding": "5px 10px", 700 "position": "absolute", 701 "bottom": -100, 702 "left": 50, 703 "font-size": "16px", 704 "color": "#fff", 705 "visibilty": "hidden", 706 "opacity": 0, 707 "transition": "opacity 0.2s linear", 708 "border-radius": 3 709 }); 710 uiskip.innerHTML = Lang("skip"); 711 o.vastcontainer.appendChild(uiskip); 712 if (exist(vast.extensions)) { 713 if (exist(vast.extensions.skipTime)) { 714 if (vast.extensions.skipTime > 0) { 715 uiskip.innerHTML = Lang("skipfrom") + vast.extensions.skipTime; 716 css(uiskip, { 717 "bottom": 15, 718 "border": "0", 719 "cursor": "default", 720 "font-size": "10px", 721 "visibility": "visible", 722 "opacity": 1, 723 "display": "block" 724 }) 725 } 726 } 727 } 728 } 729 if (vast.isVpaid) { 730 vpaidframe = document.createElement('iframe'); 731 vpaidframe.id = "pljsvpaid"; 732 vpaidframe.src = ""; 733 css(vpaidframe, { 734 "width": 0, 735 "height": 0 736 }); 737 o.vastcontainer.appendChild(vpaidframe);
738 vpaidframe.contentWindow.document.write('<script type="text/javascript" src="' + vast.file + '"></script>'); 739 vpaidframe.contentWindow.document.close(); 740 var vpaidtimer = 0; 741 vpaidstopped = false; 742 vpaidskipped = false; 743 vpaidinterval = setInterval(function() { 744 vpaidtimer++; 745 var fn = vpaidframe.contentWindow['getVPAIDAd']; 746 if (fn && typeof fn == 'function') { 747 vpaid = fn(); 748 clearInterval(vpaidinterval); 749 Vpaid() 750 } else { 751 if (vpaidtimer > 10) { 752 clearInterval(vpaidinterval); 753 onError() 754 } 755 } 756 }, 300) 757 } else { 758 tag.addEventListener('loadstart', onLoadStart); 759 tag.addEventListener('error', onError); 760 tag.addEventListener('ended', onEnded); 761 tag.addEventListener('play', onPlay); 762 tag.addEventListener('pause', onPause); 763 tag.addEventListener('timeupdate', onTimeupdate); 764 tag.addEventListener('seeking', onSeeking); 765 tag.addEventListener('seeked', onSeeked); 766 tag.addEventListener('loadedmetadata', onMeta); 767 tag.addEventListener('volumechange', onVolume); 768 tag.addEventListener('waiting', onWaiting); 769 tag.addEventListener('durationchange', onDuration); 770 tag.addEventListener('progress', onProgress); 771 attr(tag, { 772 'src': x.file 773 }); 774 tag.play() 775 } 776 } 777 ; 778 function onLoadStart() {} 779 var die_error = false; 780 function onError() { 781 if (!die_error) { 782 die_error = true; 783 log("VAST video playing error"); 784 Event("Error", true); 785 o.actions.VastError() 786 } 787 } 788 function onEnded() { 789 Event("complete", true); 790 o.actions.VastRemoveAndPlay() 791 } 792 function onClose() { 793 Event("close", true); 794 o.actions.VastRemoveAndPlay() 795 } 796 function onSkip() { 797 if (!vpaidskipped && vpaid && vast.isVpaid) { 798 vpaid.skipAd() 799 } else { 800 Event("skipAd", true); 801 o.actions.VastRemoveAndPlay() 802 } 803 } 804 function onInvite() { 805 Event("addClick"); 806 onClick() 807 } 808 function onMute() { 809 var stop = false; 810 if (!vast.isVpaid) { 811 Event("mute"); 812 tag.muted = true 813 } else { 814 if (vpaid) { 815 vpaidvolume = vpaid.getAdVolume(); 816 vpaid.setAdVolume(0) 817 } else { 818 stop = true 819 } 820 } 821 if (!stop) { 822 hide2(uimute); 823 show2(uiunmute) 824 } 825 } 826 function onUnmute() { 827 var stop = false; 828 if (!vast.isVpaid) { 829 tag.muted = false; 830 Event("unmute") 831 } else { 832 if (vpaid) { 833 vpaid.setAdVolume(vpaidvolume) 834 } else { 835 stop = true 836 } 837 } 838 if (!stop) { 839 hide2(uiunmute); 840 show2(uimute) 841 } 842 } 843 function onScreenClick() { 844 if (paused) { 845 if (vast.isVpaid) { 846 if (vpaid) { 847 vpaid.resumeAd(); 848 hide2(uiplay); 849 paused = false 850 } 851 } else { 852 tag.play(); 853 Event("resume"); 854 hide2(uiplay); 855 paused = false 856 } 857 } else { 858 onClick() 859 } 860 } 861 function onClick() { 862 Event("click"); 863 if (exist(vast.click)) { 864 window.open(vast.click, '_blank') 865 } 866 if (v.vast_pauseonclick == 1) { 867 if (vast.isVpaid) { 868 if (vpaid) { 869 vpaid.pauseAd(); 870 show2(uiplay); 871 paused = true 872 } 873 } else { 874 tag.pause(); 875 Event("pause"); 876 show2(uiplay); 877 paused = true 878 } 879 } else { 880 o.actions.VastRemove() 881 } 882 } 883 function onPlay() { 884 Event("start", true) 885 } 886 function onPause() {} 887 function onTimeupdate() { 888 if (exist(vast.events["firstQuartile"])) { 889 if (tag.currentTime > duration / 4) { 890 Event("firstQuartile", true) 891 } 892 } 893 if (exist(vast.events["midpoint"])) { 894 if (tag.currentTime > duration / 2) { 895 Event("midpoint", true) 896 } 897 } 898 if (exist(vast.events["thirdQuartile"])) { 899 if (tag.currentTime > (duration / 4) * 3) { 900 Event("thirdQuartile", true) 901 } 902 } 903 onTimeupdateExtesions(tag.currentTime); 904 hide2(uibuffer) 905 } 906 function onTimeupdateExtesions(x) {
907 if (controls && exist(vast.extensions)) { 908 if (exist(vast.extensions.skipTime)) { 909 if (x > vast.extensions.skipTime) { 910 uiskip.innerHTML = Lang("skip"); 911 css(uiskip, { 912 "bottom": 10, 913 "border": "1px solid #333", 914 "cursor": "pointer", 915 "font-size": "16px", 916 "bottom": 10, 917 "visibility": "visible", 918 "opacity": 1, 919 "display": "block" 920 }); 921 uiskip.onclick = onSkip; 922 delete vast.extensions.skipTime 923 } else { 924 uiskip.innerHTML = Lang("skipfrom") + (Math.round(vast.extensions.skipTime - x)) 925 } 926 } 927 if (exist(vast.extensions.skipTime2)) { 928 if (x > vast.extensions.skipTime2) { 929 css(uix, { 930 "top": 3, 931 "visibility": "visible", 932 "opacity": 1, 933 "display": "block" 934 }); 935 css(uitbg, { 936 "height": 35 937 }); 938 delete vast.extensions.skipTime2 939 } 940 } 941 } 942 if (controls && duration > 0) { 943 var val = parseInt(x / duration * 100); 944 var circle = document.getElementById("pljsvastprogressbar"); 945 if (circle) { 946 if (isNaN(val)) { 947 val = 100 948 } else { 949 var r = circle.getAttribute('r'); 950 var c = Math.PI * (r * 2); 951 if (val < 0) { 952 val = 0 953 } 954 if (val > 100) { 955 val = 100 956 } 957 var pct = ((100 - val) / 100) * c; 958 css(circle, { 959 "opacity": 1, 960 "strokeDashoffset": pct 961 }) 962 } 963 } 964 } 965 } 966 function onSeeking() {} 967 function onSeeked() {} 968 function onMeta() { 969 Event("Impression", true); 970 Event("creativeView", true) 971 } 972 function onDuration() { 973 duration = tag.duration 974 } 975 function onVolume() {} 976 function onWaiting() { 977 show2(uibuffer) 978 } 979 function onProgress(event) {} 980 function Vpaid() { 981 if (vpaid.handshakeVersion && typeof vpaid.handshakeVersion == "function" && vpaid.initAd && typeof vpaid.initAd == "function" && vpaid.startAd && typeof vpaid.startAd == "function" && vpaid.stopAd && typeof vpaid.stopAd == "function" && vpaid.skipAd && typeof vpaid.skipAd == "function" && vpaid.resizeAd && typeof vpaid.resizeAd == "function" && vpaid.pauseAd && typeof vpaid.pauseAd == "function" && vpaid.resumeAd && typeof vpaid.resumeAd == "function" && vpaid.expandAd && typeof vpaid.expandAd == "function" && vpaid.collapseAd && typeof vpaid.collapseAd == "function" && vpaid.subscribe && typeof vpaid.subscribe == "function" && vpaid.unsubscribe && typeof vpaid.unsubscribe == "function") { 982 var callbacks = { 983 AdStarted: onStartAd, 984 AdStopped: onStopAd, 985 AdSkipped: onSkipAd, 986 AdLoaded: onAdLoaded, 987 AdLinearChange: onAdLinearChange, 988 AdSizeChange: onAdSizeChange, 989 AdExpandedChange: onAdExpandedChange, 990 AdSkippableStateChange: onAdSkippableStateChange, 991 AdDurationChange: onAdDurationChange, 992 AdRemainingTimeChange: onAdRemainingTimeChange, 993 AdVolumeChange: onAdVolumeChange, 994 AdImpression: onAdImpression, 995 AdClickThru: onAdClickThru, 996 AdInteraction: onAdInteraction, 997 AdVideoStart: onAdVideoStart, 998 AdVideoFirstQuartile: onAdVideoFirstQuartile, 999 AdVideoMidpoint: onAdVideoMidpoint, 1000 AdVideoThirdQuartile: onAdVideoThirdQuartile, 1001 AdVideoComplete: onAdVideoComplete, 1002 AdUserAcceptInvitation: onAdUserAcceptInvitation, 1003 AdUserMinimize: onAdUserMinimize, 1004 AdUserClose: onAdUserClose, 1005 AdPaused: onAdPaused, 1006 AdPlaying: onAdPlaying, 1007 AdError: onAdError, 1008 AdLog: onAdLog 1009 }; 1010 for (var eventName in callbacks) { 1011 vpaid.subscribe(callbacks[eventName], eventName, this) 1012 } 1013 function onAdLog(x) { 1014 log("VPAID Log: " + x) 1015 } 1016 function onAdError(x) { 1017 log("VPAID Error: " + x); 1018 onError() 1019 } 1020 function onAdLoaded() { 1021 log("VPAID Loaded"); 1022 if (vpaid.getAdLinear()) { 1023 vpaid.startAd() 1024 } 1025 } 1026 function onStartAd() { 1027 if (vpaid.getAdVolume() == 0 && controls) { 1028 hide2(uimute); 1029 show2(uiunmute) 1030 } 1031 duration = vpaid.getAdDuration();
1032 log("VPAID Started"); 1033 hide2(uibuffer); 1034 Event("Impression", true); 1035 Event("creativeView", true); 1036 Event("start", true) 1037 } 1038 function onStopAd() { 1039 log("VPAID Stoped"); 1040 vpaidstopped = true 1041 } 1042 function onSkipAd() { 1043 log("VPAID Skiped"); 1044 vpaidskipped = true; 1045 onSkip() 1046 } 1047 function onAdSizeChange() { 1048 log("VPAID SizeChanged: " + vpaid.getAdWidth() + " x " + vpaid.getAdHeight()) 1049 } 1050 function onAdExpandedChange() { 1051 log("VPAID ExpandedChange: " + vpaid.getAdExpanded()) 1052 } 1053 function onAdSkippableStateChange() { 1054 if (controls) { 1055 log("VPAID AdSkippableStateChange: " + vpaid.getAdSkippableState()); 1056 if (vpaid.getAdSkippableState()) { 1057 css(uiskip, { 1058 "bottom": 10, 1059 "border": "1px solid #333", 1060 "cursor": "pointer", 1061 "font-size": "16px", 1062 "bottom": 10, 1063 "visibility": "visible", 1064 "opacity": 1, 1065 "display": "block" 1066 }); 1067 uiskip.onclick = onSkip 1068 } else { 1069 hide(uiskip) 1070 } 1071 } 1072 } 1073 function onAdDurationChange() { 1074 duration = vpaid.getAdDuration(); 1075 log("VPAID DurationChanged: " + vpaid.getAdDuration()) 1076 } 1077 function onAdRemainingTimeChange() { 1078 if (duration > 0) { 1079 onTimeupdateExtesions(duration - vpaid.getAdRemainingTime()) 1080 } 1081 } 1082 function onAdVolumeChange() { 1083 if (vpaid.getAdVolume() == 0) { 1084 Event("mute"); 1085 vpaidvolume2 = 0 1086 } else { 1087 vpaidvolume2 == 0 ? Event("unmute") : ''; 1088 vpaidvolume2 = vpaid.getAdVolume() 1089 } 1090 log("VPAID VolumeChanged: " + vpaid.getAdVolume()) 1091 } 1092 function onAdImpression() { 1093 log("VPAID Impression") 1094 } 1095 function onAdClickThru() { 1096 log("VPAID ClickThru"); 1097 if (exist(vast.extensions.isClickable)) { 1098 if (vast.extensions.isClickable == 1) { 1099 onClick() 1100 } 1101 } else { 1102 onClick() 1103 } 1104 } 1105 function onAdInteraction() { 1106 log("VPAID Non-click Interaction") 1107 } 1108 function onAdVideoStart() { 1109 log("VPAID AdVideoStart") 1110 } 1111 function onAdVideoFirstQuartile() { 1112 log("VPAID FirstQuartile"); 1113 Event("firstQuartile", true) 1114 } 1115 function onAdVideoMidpoint() { 1116 log("VPAID Midpoint"); 1117 Event("midpoint", true) 1118 } 1119 function onAdVideoThirdQuartile() { 1120 log("VPAID ThirdQuartile"); 1121 Event("thirdQuartile", true) 1122 } 1123 function onAdVideoComplete() { 1124 log("VPAID VideoComplete"); 1125 vpaidstopped = true; 1126 onEnded() 1127 } 1128 function onAdLinearChange() { 1129 log("VPAID linear has changed: " + vpaid.getAdLinear()) 1130 } 1131 function onAdUserAcceptInvitation() { 1132 log("VPAID AcceptInvitation"); 1133 Event("acceptInvitation", true) 1134 } 1135 function onAdUserMinimize() { 1136 log("VPAID UserMinimize") 1137 } 1138 function onAdUserClose() { 1139 log("VPAID UserClose"); 1140 vpaidstopped = true; 1141 onClose() 1142 } 1143 function onAdPaused() { 1144 Event("pause"); 1145 log("VPAID AdPaused") 1146 } 1147 function onAdPlaying() { 1148 Event("resume"); 1149 log("VPAID AdPlaying") 1150 } 1151 vpaid.initAd(o.screen_w, o.screen_h, (o.fullscreen ? 'fullscreen' : 'normal'), 720, (exist(vast.adparameters) ? { 1152 "AdParameters": vast.adparameters 1153 } : ''), { 1154 "slot": vpaidslot, 1155 "videoSlot": tag, 1156 'videoSlotCanAutoPlay': true 1157 }); 1158 vpaidslot.style.zIndex = 0 1159 } else { 1160 log("VPAID incorrect"); 1161 onError() 1162 } 1163 } 1164 ;function Event(x, del) { 1165 if (exist(vast.events)) { 1166 if (exist(vast.events[x])) { 1167 for (var i = 0; i < vast.events[x].length; i++) { 1168 var gif = document.createElement("img"); 1169 gif.setAttribute('src', vast.events[x][i]); 1170 gif.setAttribute('height', '1px'); 1171 gif.setAttribute('width', '1px'); 1172 o.frame.appendChild(gif); 1173 gif.style.display = "none" 1174 } 1175 if (del) { 1176 delete vast.events[x] 1177 } 1178 } 1179 } 1180 } 1181 ;function RemoveInterface() { 1182 if (o.vastcontainer.contains(uiplay)) { 1183 o.vastcontainer.removeChild(uiplay); 1184 delete uiplay; 1185 o.vastcontainer.removeChild(uibuffer); 1186 delete uibuffer; 1187 o.vastcontainer.removeChild(uibuffer_style); 1188 delete uibuffer_style 1189 }
1190 if (controls && o.vastcontainer.contains(uitbg)) { 1191 o.vastcontainer.removeChild(uitbg); 1192 delete uitbg; 1193 o.vastcontainer.removeChild(uit); 1194 delete uit; 1195 o.vastcontainer.removeChild(uiprogress); 1196 delete uiprogress; 1197 o.vastcontainer.removeChild(uiskip); 1198 delete uiskip; 1199 o.vastcontainer.removeChild(uix); 1200 delete uix; 1201 exist(uitxt) ? o.vastcontainer.removeChild(uitxt) : ''; 1202 if (exist(uimute)) { 1203 o.vastcontainer.removeChild(uimutebg); 1204 delete uimutebg; 1205 o.vastcontainer.removeChild(uimute); 1206 delete uimute; 1207 o.vastcontainer.removeChild(uiunmute); 1208 delete uiunmute 1209 } 1210 } 1211 } 1212 ;this.RemoveForNextAd = function() { 1213 if (vast) { 1214 RemoveInterface() 1215 } 1216 if (vpaidframe) { 1217 if (exist(vpaidslot)) { 1218 if (!vpaidstopped && vpaid) { 1219 vpaid.stopAd() 1220 } 1221 if (o.vastcontainer.contains(vpaidslot)) { 1222 o.vastcontainer.removeChild(vpaidslot) 1223 } 1224 } 1225 clearInterval(vpaidinterval); 1226 try { 1227 o.vastcontainer.removeChild(vpaidframe) 1228 } catch (e) {} 1229 } 1230 } 1231 ; 1232 this.Remove = function() { 1233 if (o.vastcontainer.contains(tag)) { 1234 o.vastcontainer.removeChild(tag) 1235 } 1236 this.RemoveForNextAd(); 1237 o.frame.removeChild(o.vastcontainer) 1238 } 1239 }; 1240 var Motion = function(_o) { 1241 var _ease; 1242 var _timer; 1243 var _type; 1244 var _from; 1245 var _to; 1246 var _steps; 1247 var _step = 0; 1248 var _speed; 1249 var _stop = false; 1250 if (_o.me != undefined && _o.mc != undefined && _o.type != undefined && _o.to != undefined) { 1251 _o.time == null ? _o.time = 0.15 : ''; 1252 _ease = Ease(_o.ease); 1253 if (_o.type.indexOf("scale") == -1) { 1254 if (exist(o.motions[_o.me])) { 1255 o.motions[_o.me].TheEnd() 1256 } 1257 } 1258 if (_o.show == 1) { 1259 _o.mc.set("display", true) 1260 } 1261 _type = _o.type.split('|'); 1262 _to = String(_o.to).split('|'); 1263 _from = new Array(); 1264 for (var i = 0; i < _type.length; i++) { 1265 if (!_to[i]) { 1266 _to[i] = _to[0] 1267 } 1268 if (_type[i] == "alpha") { 1269 _from[i] = _o.mc.g("opacity") 1270 } 1271 if (_type[i] == "alpha_div") { 1272 _from[i] = _o.mc.style.opacity 1273 } 1274 if (_type[i] == "y") { 1275 _from[i] = _o.mc.g("y") 1276 } 1277 if (_type[i] == "x") { 1278 _from[i] = _o.mc.g("x") 1279 } 1280 if (_type[i] == "scale") { 1281 _from[i] = _o.mc.g("scaleX") 1282 } 1283 if (_type[i] == "scaleY") { 1284 _from[i] = _o.mc.g("scaleY") 1285 } 1286 if (_type[i] == "scaleX") { 1287 _from[i] = _o.mc.g("scaleX") 1288 } 1289 if (_type[i] == "width") { 1290 _from[i] = _o.mc.g("width") 1291 } 1292 if (_type[i] == "width_div") { 1293 _from[i] = _o.mc.offsetWidth; 1294 _to[i] = Math.floor(_to[i]); 1295 _o.me == "line_play" ? log("width", _o.me, _from[i], _to[i], _o.mc.offsetWidth) : '' 1296 } 1297 if (_type[i] == "height") { 1298 _from[i] = _o.mc.g("height") 1299 } 1300 if (_type[i] == "height_div") { 1301 _from[i] = _o.mc.offsetHeight 1302 } 1303 _to[i] = Number(_to[i]); 1304 _from[i] = Number(_from[i]) 1305 } 1306 _speed = _o.time * 1000 / _ease.length; 1307 _steps = _ease.length; 1308 if (_type.length == 1 && _from[0] == _to[0]) { 1309 End() 1310 } else { 1311 setTimeout(onStep, Math.round(_speed)) 1312 } 1313 if (_o.type.indexOf("scale") == -1) { 1314 o.motions[_o.me] = this 1315 } 1316 } 1317 function onStep() { 1318 for (var i = 0; i < _type.length; i++) { 1319 var tmp = _from[i] + (_to[i] - _from[i]) * (_ease[_step] ? _ease[_step] : 0); 1320 if (_type[i] == "alpha") { 1321 _o.mc.set("opacity", tmp) 1322 } 1323 if (_type[i] == "alpha_div") { 1324 _o.mc.style.opacity = tmp 1325 } 1326 if (_type[i] == "y") { 1327 _o.mc.set("top", tmp) 1328 } 1329 if (_type[i] == "x") { 1330 _o.mc.set("left", tmp) 1331 } 1332 if (_type[i] == "scale") { 1333 _o.mc.set("scale", tmp) 1334 } 1335 if (_type[i] == "scaleY") { 1336 _o.mc.set("scaleY", tmp) 1337 } 1338 if (_type[i] == "scaleX") { 1339 _o.mc.set("scaleX", tmp) 1340 } 1341 if (_type[i] == "width") { 1342 _o.mc.set("width", tmp) 1343 } 1344 if (_type[i] == "width_div") { 1345 css(_o.mc, { 1346 "width": tmp 1347 }) 1348 } 1349 if (_type[i] == "height") { 1350 _o.mc.set("height", tmp) 1351 } 1352 if (_type[i] == "height_div") { 1353 css(_o.mc, { 1354 "height": tmp 1355 }) 1356 } 1357 } 1358 _step++; 1359 if (!_stop) { 1360 if (_step == _steps) { 1361 End() 1362 } else { 1363 setTimeout(onStep, Math.round(_speed)) 1364 } 1365 } 1366 } 1367 function End() { 1368 _stop = true; 1369 if (_o.hide) { 1370 _o.mc.set("display", false) 1371 } 1372 if (_o.type.indexOf("scale") == -1) { 1373 o.motions[_o.mc] = null; 1374 delete o.motions[_o.mc] 1375 } 1376 } 1377 ;this.TheEnd = function() { 1378 End() 1379 } 1380 ; 1381 function Ease(str) { 1382 switch (str) { 1383 case "elastic": 1384 return [0, 0.432, 0.857, 1.275, 1.372, 1.296, 1.102, 0.957, 0.883, 0.87, 0.914, 0.992, 1.029, 1.041, 1.036, 1.019, 0.996, 0.984, 0.981, 0.988, 1.001, 1.006, 1.007, 1.006, 1.003, 0.999, 0.998, 0.998, 0.998, 0.998, 1]; 1385 break; 1386 case "cubic": 1387 return [0, 0.096, 0.185, 0.267, 0.344, 0.416, 0.483, 0.547, 0.606, 0.659, 0.705, 0.747, 0.785, 0.818, 0.848, 0.874, 0.897, 0.918, 0.935, 0.95, 0.962, 0.971, 0.979,
13870.985, 0.99, 0.994, 0.997, 0.999, 1]; 1388 break; 1389 case "back": 1390 return [0, 0.146, 0.28, 0.403, 0.513, 0.613, 0.702, 0.78, 0.848, 0.907, 0.956, 0.997, 1.029, 1.055, 1.072, 1.084, 1.092, 1.095, 1.095, 1.093, 1.088, 1.081, 1.072, 1.06, 1.046, 1.033, 1.023, 1.014, 1.007, 1.003]; 1391 break; 1392 default: 1393 return [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]; 1394 break 1395 } 1396 } 1397 }; 1398 var System = function() { 1399 var N = navigator.appName, ua = navigator.userAgent, tem; 1400 var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); 1401 if (M && (tem = ua.match(/version\/([\.\d]+)/i)) != null) 1402 M[2] = tem[1]; 1403 this.browser = M ? M[1] : N; 1404 this.version = M ? M[2] : navigator.appVersion; 1405 this.opera = this.browser == "Opera"; 1406 this.ie = this.browser == "MSIE"; 1407 this.firefox = this.browser == "Firefox"; 1408 this.safari = this.browser == "Safari"; 1409 this.win = ua.search("Windows NT") > -1; 1410 this.ios = ua.search(/(iphone|ipad|ipod)\/?\s*/i) > -1; 1411 this.iphone = ua.search(/(iphone)\/?\s*/i) > -1; 1412 this.android = ua.search(/(android)\/?\s*/i) > -1; 1413 this.mobile = this.ios || this.android || (ua.search(/(blackberry|iemobile|opera mini)\/?\s*/i) > -1); 1414 this.desktop = !this.mobile; 1415 this.fullscreen = false; 1416 if (o.frame.requestFullScreen || o.frame.requestFullscreen || o.frame.mozRequestFullScreen || o.frame.webkitRequestFullScreen || o.frame.msRequestFullscreen) { 1417 this.fullscreen = true 1418 } 1419 }; 1420 function UpdateObject(obj, obj2) { 1421 for (var s in obj2) { 1422 if (typeof (obj2[s]) == 'object') { 1423 if (s == "events" || s == "file") { 1424 obj[s] = obj2[s] 1425 } else { 1426 for (var s2 in obj2[s]) { 1427 if (!exist(obj[s])) { 1428 obj[s] = {} 1429 } 1430 if (typeof (obj2[s][s2]) == 'object') { 1431 for (var s3 in obj2[s][s2]) { 1432 if (!exist(obj[s][s2])) { 1433 obj[s][s2] = {} 1434 } 1435 if (typeof (obj2[s][s2][s3]) == 'object') { 1436 for (var s4 in obj2[s][s2][s3]) { 1437 if (!exist(obj[s][s2][s3])) { 1438 obj[s][s2][s3] = {} 1439 } 1440 obj[s][s2][s3][s4] = obj2[s][s2][s3][s4]; 1441 if (s3 == 'padding' || s3 == 'margin') { 1442 obj[s][s2][s3][s4] = parseInt(obj[s][s2][s3][s4]) 1443 } 1444 } 1445 } else { 1446 obj[s][s2][s3] = obj2[s][s2][s3]; 1447 if (s2 == 'padding' || s2 == 'margin') { 1448 obj[s][s2][s3] = parseInt(obj[s][s2][s3]) 1449 } 1450 } 1451 } 1452 } else { 1453 obj[s][s2] = obj2[s][s2]; 1454 if (s == 'padding' || s == 'margin') { 1455 obj[s][s2] = parseInt(obj[s][s2]) 1456 } 1457 } 1458 } 1459 } 1460 } else { 1461 obj[s] = SettingsParser(s, obj2[s]) 1462 } 1463 } 1464 return obj 1465 } 1466 ;var SettingsParser = function(key, value) { 1467 value = trim(value); 1468 if (key.indexOf("color") > -1 && key.indexOf("#") != 0) { 1469 value = "#" + value 1470 } 1471 return value 1472 }; 1473 function toFlash(file) { 1474 return file.search("rtmp") == 0 || file.search(".flv") > -1 || (file.search(".mp4") > -1 && o.system.desktop && ((o.system.ie && o.system.version < 9) || (o.system.opera && o.system.version < 25) || o.system.firefox)) 1475 } 1476 ;function StorageSupport(x) { 1477 if (typeof (Storage) !== "undefined") { 1478 return true 1479 } else { 1480 return false 1481 } 1482 } 1483 ;function killMotion(motion_id) { 1484 if (motion_id) { 1485 if (o.motions[motion_id]) { 1486 o.motions[motion_id].TheEnd() 1487 } 1488 } 1489 } 1490 ;var Alert = function() { 1491 var xbg = createElement("div"); 1492 o.frame.appendChild(xbg); 1493 css(xbg, { 1494 'position': 'absolute', 1495 'left': 0, 1496 'top': 0, 1497 'width': '100%', 1498 'height': 30, 1499 'background-color': "#f00", 1500 'opacity': 1, 1501 'display': 'none' 1502 }); 1503 var x = createElement("div"); 1504 o.frame.appendChild(x); 1505 css(x, { 1506 'position': 'absolute', 1507 'left': 0, 1508 'top': 0, 1509 'width': '100%', 1510 'color': '#fff', 1511 'font-size': 10, 1512 'padding': '10px 15px', 1513 'display': 'none' 1514 }); 1515 this.txt = function(text) { 1516 x.innerHTML = text; 1517 show2(x); 1518 css(xbg, { 1519 'height': x.offsetHeight, 1520 'display': 'block' 1521 }); 1522 xbg.style.zIndex = "997"; 1523 for (var i = 0; i < x.getElementsByTagName('a').length; i++) { 1524 x.getElementsByTagName('a')[i].style.color = '#fff' 1525 } 1526 x.style.zIndex = "998" 1527 } 1528 ; 1529 this.close = function() { 1530 hide2(x); 1531 hide2(xbg) 1532 } 1533 ;
1534 var _0xef8d = ["\x70\x6C\x61\x79\x65\x72\x69\x64", "\x70\x6C\x61\x79\x65\x72\x6A\x73\x2E\x63\x6F\x6D", "\x70\x72\x6F\x74\x65\x63\x74", "\x2C", "\x73\x70\x6C\x69\x74", "\x68\x6F\x73\x74\x6E\x61\x6D\x65", "\x6C\x6F\x63\x61\x6C\x68\x6F\x73\x74", "\x2E", "\x69\x6E\x64\x65\x78\x4F\x66", "\x74\x65\x73\x74", "\x24", "\x69", "\x66\x6F\x72\x45\x61\x63\x68", "\x6D\x65\x64\x69\x61\x5F\x65\x72\x72\x6F\x72", "\x3C\x61\x20\x68\x72\x65\x66\x3D\x2F\x2F", "\x3E", "\x3C\x2F\x61\x3E", "\x74\x78\x74"]; 1535 if (v[_0xef8d[0]] == _0xef8d[1]) { 1536 v[_0xef8d[2]] = _0xef8d[1] 1537 } 1538 ;if (exist(v[_0xef8d[2]])) { 1539 var xs = v[_0xef8d[2]][_0xef8d[4]](_0xef8d[3]); 1540 var xd = location[_0xef8d[5]]; 1541 var g = xd == _0xef8d[6] || xd == _0xef8d[1] || xd[_0xef8d[8]](_0xef8d[7]) == -1 || xd[_0xef8d[4]](_0xef8d[7]) == 4; 1542 xs[_0xef8d[12]](function(_0x8e38x4) { 1543 if (new RegExp(_0x8e38x4 + _0xef8d[10],_0xef8d[11])[_0xef8d[9]](xd)) { 1544 g = true; 1545 return 1546 } 1547 }); 1548 if (!g) { 1549 o[_0xef8d[13]] = true; 1550 this[_0xef8d[17]](_0xef8d[14] + xs[0] + _0xef8d[15] + xs[0] + _0xef8d[16]) 1551 } 1552 } 1553 }; 1554 var Lang = function(x) { 1555 if (x == "auto") { 1556 if (v.lang == "ru") { 1557 x = "ÐвÑо" 1558 } 1559 } 1560 if (x == "play") { 1561 if (v.lang == "ru") { 1562 x = "ÐÑÑк" 1563 } 1564 } 1565 if (x == "pause") { 1566 if (v.lang == "ru") { 1567 x = "ÐаÑза" 1568 } 1569 } 1570 if (x == "fullscreen") { 1571 if (v.lang == "ru") { 1572 x = "Ðо веÑÑ ÑкÑан" 1573 } 1574 if (v.lang == "en") { 1575 x = "Full Screen" 1576 } 1577 } 1578 if (x == "normalscreen") { 1579 if (v.lang == "ru") { 1580 x = "ÐÑйÑи из полноÑкÑанного Ñежима" 1581 } 1582 if (v.lang == "en") { 1583 x = "Exit from Full Screen" 1584 } 1585 } 1586 if (x == "stop") { 1587 if (v.lang == "ru") { 1588 x = "СÑоп" 1589 } 1590 if (v.lang == "en") { 1591 x = "Stop" 1592 } 1593 } 1594 if (x == "settings") { 1595 if (v.lang == "ru") { 1596 x = "ÐаÑÑÑойки" 1597 } 1598 if (v.lang == "en") { 1599 x = "Settings" 1600 } 1601 } 1602 if (x == "volume") { 1603 if (v.lang == "ru") { 1604 x = "ÐÑомкоÑÑÑ" 1605 } 1606 if (v.lang == "en") { 1607 x = "Volume" 1608 } 1609 } 1610 if (x == "mute") { 1611 if (v.lang == "ru") { 1612 x = "ÐÑклÑÑиÑÑ Ð·Ð²Ñк" 1613 } 1614 if (v.lang == "en") { 1615 x = "Sound off" 1616 } 1617 } 1618 if (x == "unmute") { 1619 if (v.lang == "ru") { 1620 x = "ÐклÑÑиÑÑ Ð·Ð²Ñк" 1621 } 1622 if (v.lang == "en") { 1623 x = "Sound on" 1624 } 1625 } 1626 if (x == "advertising") { 1627 if (v.lang == "ru") { 1628 x = "Реклама" 1629 } 1630 if (v.lang == "en") { 1631 x = "Ads" 1632 } 1633 } 1634 if (x == "skip") { 1635 if (v.lang == "ru") { 1636 x = "ÐÑопÑÑÑиÑÑ" 1637 } 1638 if (v.lang == "en") { 1639 x = "Skip" 1640 } 1641 } 1642 if (x == "live") { 1643 if (v.lang == "ru") { 1644 x = "ÐРЯÐÐÐ ÐФÐÐ " 1645 } 1646 if (v.lang == "en") { 1647 x = "LIVE" 1648 } 1649 } 1650 if (x == "playlist") { 1651 if (v.lang == "ru") { 1652 x = "ÐлейлиÑÑ" 1653 } 1654 if (v.lang == "en") { 1655 x = "Playlist" 1656 } 1657 } 1658 if (x == "skipfrom") { 1659 if (v.lang == "ru") { 1660 x = "ÐÑопÑÑÑиÑÑ Ð¼Ð¾Ð¶Ð½Ð¾ ÑеÑез " 1661 } 1662 if (v.lang == "en") {
1663 x = "Skip after " 1664 } 1665 } 1666 if (x == "acceptinvitation") { 1667 if (v.lang == "ru") { 1668 x = "ÐеÑейÑи на ÑÐ°Ð¹Ñ ÑекламодаÑелÑ" 1669 } 1670 if (v.lang == "en") { 1671 x = "Go to advertiser's website" 1672 } 1673 } 1674 if (x == "quality") { 1675 if (v.lang == "ru") { 1676 x = "ÐаÑеÑÑво" 1677 } 1678 if (v.lang == "en") { 1679 x = "Quality" 1680 } 1681 } 1682 if (x == "audiotrack") { 1683 if (v.lang == "ru") { 1684 x = "ÐÑдио" 1685 } 1686 if (v.lang == "en") { 1687 x = "Audio" 1688 } 1689 } 1690 if (x == "download") { 1691 if (v.lang == "ru") { 1692 x = "СкаÑаÑÑ" 1693 } 1694 if (v.lang == "en") { 1695 x = "Download" 1696 } 1697 } 1698 if (x == '160p') { 1699 if (v.lang == "ru") { 1700 x = "ÐÑÐµÐ½Ñ Ð½Ð¸Ð·ÐºÐ¾Ðµ" 1701 } 1702 if (v.lang == "en") { 1703 x = "Tiny" 1704 } 1705 } 1706 if (x == '240p') { 1707 if (v.lang == "ru") { 1708 x = "Ðизкое" 1709 } 1710 if (v.lang == "en") { 1711 x = "Small" 1712 } 1713 } 1714 if (x == '360p') { 1715 if (v.lang == "ru") { 1716 x = "СÑеднее" 1717 } 1718 if (v.lang == "en") { 1719 x = "Medium" 1720 } 1721 } 1722 if (x == '480p') { 1723 if (v.lang == "ru") { 1724 x = "ÐÑÑокое" 1725 } 1726 if (v.lang == "en") { 1727 x = "Large" 1728 } 1729 } 1730 if (x == '720p') { 1731 x = "HD" 1732 } 1733 if (x == '1080p') { 1734 x = "Full HD" 1735 } 1736 if (x == '2160p') { 1737 x = "4K" 1738 } 1739 return x 1740 }; 1741 var gaTracker = function(x) { 1742 if (!exist(o.gatracked[x]) && v.playerjscom != 1) { 1743 ga('playerjs.send', 'event', { 1744 'eventCategory': 'Video', 1745 'eventAction': x, 1746 'eventLabel': location.hostname 1747 }); 1748 if (exist(v.ga)) { 1749 ga('user.send', 'event', { 1750 'eventCategory': 'Video', 1751 'eventAction': x 1752 }) 1753 } 1754 ga(function(tracker) {}); 1755 o.gatracked[x] = true 1756 } 1757 }; 1758 var js = function(x) { 1759 if (v.eventstracker == 1) { 1760 if (typeof (v.events) == 'object') { 1761 if (exist(v.events[x])) { 1762 try { 1763 eval(v.events[x] + "('" + x + "')") 1764 } catch (e) { 1765 log(e) 1766 } 1767 } 1768 } else { 1769 if (v.events != '') { 1770 try { 1771 eval(v.events + "('" + x + "')") 1772 } catch (e) { 1773 log(e) 1774 } 1775 } 1776 } 1777 } 1778 }; 1779 this.event = function(x, y) { 1780 o.events[x] = y 1781 } 1782 ; 1783 this.api = function(x, y) { 1784 if (x == "play") { 1785 if (exist(y)) { 1786 o.actions.NewFile(y) 1787 } else { 1788 o.actions.Play() 1789 } 1790 } 1791 if (x == "pause") { 1792 o.play ? o.actions.Pause() : '' 1793 } 1794 if (x == "stop") { 1795 o.actions.Stop() 1796 } 1797 if (x == "isyoutube") { 1798 return o.file_type == "youtube" 1799 } 1800 if (x == "youtubeready") { 1801 o.media.onYoutubeReady() 1802 } 1803 if (x == "id") { 1804 return v.id 1805 } 1806 if (x == "log") { 1807 v.log = y 1808 } 1809 } 1810 ; 1811 var createElement = function(x) { 1812 x == 'div' ? x = 'pjsdiv' : ''; 1813 var x = document.createElement(x); 1814 return x 1815 }; 1816 var log = function(a, b, c, d, e, f, g) { 1817 if (v.log == 1 || v.logout == 1) { 1818 var x = a + (b != undefined ? " " + b : "") + (c != undefined ? " " + c : "") + (d != undefined ? " " + d : "") + (e != undefined ? " " + e : "") + (f != undefined ? " " + f : "") + (g != undefined ? " " + g : ""); 1819 console.log("Playerjs: " + x); 1820 if (v.logout == 1 && exist(document.getElementById("pjslog"))) { 1821 document.getElementById("pjslog").innerHTML += x + '<br/>' 1822 } 1823 } 1824 }; 1825 var css = function(e, o) { 1826 for (var key in o) { 1827 if (o[key] != 'NaNpx' && o[key] != undefined) {
1828 if (typeof o[key] == 'number' && key != 'opacity') { 1829 o[key] += 'px' 1830 } 1831 if ((key.indexOf("color") > -1 || key.indexOf("Color") > -1) && o[key].indexOf("#") == -1) { 1832 o[key] = '#' + o[key] 1833 } 1834 e.style[key] = o[key] 1835 } 1836 } 1837 }; 1838 var attr = function(e, o) { 1839 for (var key in o) { 1840 e.setAttribute(key, o[key]) 1841 } 1842 }; 1843 var destroy = function(e) { 1844 if (e) { 1845 try { 1846 e.parentNode.removeChild(e); 1847 delete e; 1848 e = null 1849 } catch (e) {} 1850 } 1851 }; 1852 var random = function(min, max) { 1853 return Math.floor(arguments.length > 1 ? (max - min + 1) * Math.random() + min : (min + 1) * Math.random()) 1854 }; 1855 var trim = function(x) { 1856 if (typeof x == "string") { 1857 return x.replace(/^\s+|\s+$/gm, '') 1858 } else { 1859 return x 1860 } 1861 }; 1862 var encode = function(x, n) { 1863 if (n == 0) { 1864 return "#0" + salt.e(x) 1865 } 1866 if (n == 1) { 1867 return "#1" + pepper(salt.e(x), 1) 1868 } 1869 }; 1870 var dechar = function(x) { 1871 return String.fromCharCode(x) 1872 }; 1873 var decode = function(x) { 1874 if (x.substr(0, 2) == "#1") { 1875 return salt.d(pepper(x.substr(2), -1)) 1876 } else if (x.substr(0, 2) == "#0") { 1877 return salt.d(x.substr(2)) 1878 } else { 1879 return x 1880 } 1881 }; 1882 var checkBase64 = function(x) { 1883 if (x.indexOf('http') == -1 && x.indexOf('.') == -1 && x.length > 100) { 1884 x = 'data:image/png;base64,' + x 1885 } 1886 return x 1887 }; 1888 var hide = function(x) { 1889 x.style.visibility = "hidden" 1890 }; 1891 var show = function(x) { 1892 x.style.visibility = "visible" 1893 }; 1894 var hide2 = function(x) { 1895 x.style.display = "none" 1896 }; 1897 var show2 = function(x) { 1898 x.style.display = "block" 1899 }; 1900 var isVisible = function(x) { 1901 return x.style.visibility != "hidden" && x.style.display != "none" 1902 }; 1903 var int = function(s) { 1904 if (typeof s == "string") { 1905 if (s.indexOf("px") > 0) { 1906 s = s.substr(0, s.indexOf("px")) 1907 } 1908 } 1909 return parseInt(s) 1910 }; 1911 var hidden = function(x) { 1912 return x.style.display == "none" 1913 }; 1914 var hexToRgb = function(hex) { 1915 var bigint = parseInt(hex, 16); 1916 var r = (bigint >> 16) & 255; 1917 var g = (bigint >> 8) & 255; 1918 var b = bigint & 255; 1919 return r + "," + g + "," + b 1920 }; 1921 var MarginPadding = function(o, x, y) { 1922 o[x + 'top'] = 0; 1923 o[x + 'right'] = 0; 1924 o[x + 'bottom'] = 0; 1925 o[x + 'left'] = 0; 1926 if (exist(o[y])) { 1927 var z = o[y].split(" "); 1928 if (z.length == 4) { 1929 o[x + 'top'] = int(z[0]); 1930 o[x + 'right'] = int(z[1]); 1931 o[x + 'bottom'] = int(z[2]); 1932 o[x + 'left'] = int(z[3]) 1933 } 1934 } 1935 return o 1936 }; 1937 var abc = String.fromCharCode(65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122); 1938 var salt = { 1939 _keyStr: abc + "0123456789+/=", 1940 e: function(e) { 1941 var t = ""; 1942 var n, r, i, s, o, u, a; 1943 var f = 0; 1944 e = salt._ue(e); 1945 while (f < e.length) { 1946 n = e.charCodeAt(f++); 1947 r = e.charCodeAt(f++); 1948 i = e.charCodeAt(f++); 1949 s = n >> 2; 1950 o = (n & 3) << 4 | r >> 4; 1951 u = (r & 15) << 2 | i >> 6; 1952 a = i & 63; 1953 if (isNaN(r)) { 1954 u = a = 64 1955 } else if (isNaN(i)) { 1956 a = 64 1957 } 1958 t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a) 1959 } 1960 return t 1961 }, 1962 d: function(e) { 1963 var t = ""; 1964 var n, r, i; 1965 var s, o, u, a; 1966 var f = 0; 1967 e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ""); 1968 while (f < e.length) { 1969 s = this._keyStr.indexOf(e.charAt(f++)); 1970 o = this._keyStr.indexOf(e.charAt(f++)); 1971 u = this._keyStr.indexOf(e.charAt(f++)); 1972 a = this._keyStr.indexOf(e.charAt(f++)); 1973 n = s << 2 | o >> 4; 1974 r = (o & 15) << 4 | u >> 2; 1975 i = (u & 3) << 6 | a; 1976 t = t + dechar(n); 1977 if (u != 64) { 1978 t = t + dechar(r) 1979 } 1980 if (a != 64) { 1981 t = t + dechar(i) 1982 } 1983 } 1984 t = salt._ud(t); 1985 return t 1986 }, 1987 _ue: function(e) { 1988 e = e.replace(/\r\n/g, "\n"); 1989 var t = ""; 1990 for (var n = 0; n < e.length; n++) { 1991 var r = e.charCodeAt(n); 1992 if (r < 128) { 1993 t += dechar(r) 1994 } else if (r > 127 && r < 2048) { 1995 t += dechar(r >> 6 | 192); 1996 t += dechar(r & 63 | 128) 1997 } else { 1998 t += dechar(r >> 12 | 224); 1999 t += dechar(r >> 6 & 63 | 128); 2000 t += dechar(r & 63 | 128) 2001 } 2002 } 2003 return t 2004 }, 2005 _ud: function(e) { 2006 var t = ""; 2007 var n = 0; 2008 var r = c1 = c2 = 0; 2009 while (n < e.length) { 2010 r = e.charCodeAt(n); 2011 if (r < 128) { 2012 t += dechar(r); 2013 n++ 2014 } else if (r > 191 && r < 224) { 2015 c2 = e.charCodeAt(n + 1); 2016 t += dechar((r & 31) << 6 | c2 & 63); 2017 n += 2 2018 } else { 2019 c2 = e.charCodeAt(n + 1); 2020 c3 = e.charCodeAt(n + 2); 2021 t += dechar((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63); 2022 n += 3 2023 } 2024 } 2025 return t 2026 } 2027 }; 2028 var pepper = function(s, n) { 2029 s = s.replace(/\+/g, "#"); 2030 s = s.replace(/#/g, "+"); 2031 var a = sugar(o.y) * n; 2032 if (n < 0) 2033 a += abc.length / 2; 2034 var r = abc.substr(a * 2) + abc.substr(0, a * 2); 2035 return s.replace(/[A-Za-z]/g, function(c) { 2036 return r.charAt(abc.indexOf(c)) 2037 }) 2038 }; 2039 var sugar = function(x) { 2040 x = x.split(dechar(61)); 2041 var result = ''; 2042 var c1 = dechar(120); 2043 for (var i in x) { 2044 var encoded = ''; 2045 for (var j in x[i]) { 2046 encoded += (x[i][j] == c1) ? dechar(49) : dechar(48) 2047 } 2048 chr = parseInt(encoded, 2); 2049 result += dechar(chr.toString(10)) 2050 } 2051 return result.substr(0, result.length - 1) 2052 }; 2053 var exist = function(x) { 2054 return typeof (x) != 'undefined' 2055 }; 2056 var int = function(x) { 2057 return parseInt(x) 2058 }; 2059 var findLeft = function(x) { 2060 var curleft = 0; 2061 if (x.offsetParent) { 2062 curleft = x.offsetLeft; 2063 while (x = x.offsetParent) { 2064 curleft += x.offsetLeft 2065 } 2066 } 2067 var body_style = window.getComputedStyle(document.body, null); 2068 var bodyleft = 0; 2069 if (body_style.position == "relative") { 2070 bodyleft = document.body.getBoundingClientRect().left 2071 } 2072 return curleft + bodyleft 2073 }; 2074 var findTop = function(x) { 2075 var curtop = 0; 2076 if (x.offsetParent) { 2077 curtop = x.offsetTop; 2078 while (x = x.offsetParent) { 2079 curtop += x.offsetTop 2080 } 2081 } 2082 return curtop 2083 }; 2084 var timeFormat = function(seconds, tip) { 2085 var seconds = Math.round(seconds); 2086 var minutes = Math.floor(seconds / 60); 2087 var hours = Math.floor(minutes / 60); 2088 minutes = Math.floor(minutes % 60); 2089 seconds = Math.floor(seconds % 60); 2090 hours > 0 && minutes < 10 ? minutes = "0" + minutes : ""; 2091 seconds = (seconds >= 10) ? seconds : "0" + seconds; 2092 var out = (hours > 0 ? hours + ":" : "") + minutes + ":" + seconds; 2093 return out 2094 }; 2095 var Actions = function() { 2096 var realfullscreen = false;
2097 var _fullscreen_start = false; 2098 var _fullscreen_end = false; 2099 if (o.system.mobile) { 2100 v.autoplay = 0 2101 } 2102 this.Title = function(x) { 2103 o.controls.title(x) 2104 } 2105 ; 2106 this.File = function(x) { 2107 if (typeof (x) == 'object') { 2108 o.playlist_dic = []; 2109 o.playlist = IndexPlaylist(x); 2110 var y = FindFileInPlaylist(); 2111 x = y.file; 2112 if (exist(y.poster)) { 2113 if (o.media) { 2114 o.media.Poster(y.poster) 2115 } 2116 } 2117 if (o.controls) { 2118 o.controls.UpdatePlaylist(o.playlist) 2119 } 2120 } 2121 if (typeof (x) == 'string') { 2122 o.files = x.split(v.file_separator); 2123 o.files_quality = Array(); 2124 o.current_file = 0; 2125 o.current_quality = 0; 2126 for (var i = 0; i < o.files.length; i++) { 2127 if (o.files[i].indexOf("[") == 0 || o.files[i].indexOf("]") > 1) { 2128 o.files_quality[i] = o.files[i].substr(o.files[i].indexOf("[") + 1, o.files[i].indexOf("]") - 1); 2129 o.files[i] = o.files[i].substr(o.files[i].indexOf("]") + 1) 2130 } else { 2131 o.files_quality[i] = i + 1 2132 } 2133 } 2134 return o.files[o.current_file] 2135 } 2136 } 2137 ; 2138 this.NewFile = function(x) { 2139 v.autoplay = 1; 2140 o.media_error = false; 2141 if (o.media.status() == "playing") { 2142 this.Stop() 2143 } 2144 x = this.File(x); 2145 o.media.File(x) 2146 } 2147 ; 2148 this.MediaReady = function() { 2149 if (v.autoplay == 1) { 2150 this.Play() 2151 } 2152 v.autoplay = 0 2153 } 2154 ; 2155 this.Metadata = function() { 2156 o.media.Volume(v.volume); 2157 if (o.muted) { 2158 o.media.Mute() 2159 } 2160 } 2161 ; 2162 this.Play = function() { 2163 if (o.media_error) {} else { 2164 StopOtherPlayer(); 2165 o.alert.close(); 2166 if (Advertising("preroll")) { 2167 js("preroll"); 2168 o.media.BeforeVast() 2169 } else { 2170 o.media.duration() > 0 ? o.controls.Duration(o.media.time(), o.media.duration()) : ''; 2171 if (Advertising("playroll")) { 2172 js("playroll") 2173 } else { 2174 if (o.controls) { 2175 if (o.controls.SettingsVisible()) { 2176 o.controls.Settings() 2177 } 2178 } 2179 if (o.media.status() != "playing") { 2180 o.media.Play(); 2181 o.controls.Play() 2182 } 2183 } 2184 } 2185 gaTracker("Play") 2186 } 2187 } 2188 ; 2189 this.Pause = function() { 2190 if (o.media.status() == "playing") { 2191 o.media.Pause(); 2192 o.controls.Pause(); 2193 js("pause"); 2194 Advertising("pauseroll") 2195 } 2196 } 2197 ; 2198 this.Mute = function() { 2199 o.media.Mute(); 2200 o.controls.Mute(); 2201 o.muted = true 2202 } 2203 ; 2204 this.Unmute = function() { 2205 o.media.Unmute(); 2206 o.controls.Unmute(); 2207 o.muted = false 2208 } 2209 ; 2210 this.Volume = function(x) { 2211 if (x == 0) { 2212 this.Mute() 2213 } else { 2214 x < 0.06 ? x = 0 : ''; 2215 x > 1 ? x = 1 : ''; 2216 if (o.muted) { 2217 this.Unmute() 2218 } 2219 v.volume = x 2220 } 2221 o.controls.Volume(x); 2222 o.media.Volume(x) 2223 } 2224 ; 2225 this.Waiting = function() { 2226 o.controls.Waiting() 2227 } 2228 ; 2229 this.StopWaiting = function() {
2230 o.controls.StopWaiting() 2231 } 2232 ; 2233 this.Progress = function() { 2234 this.StopWaiting() 2235 } 2236 ; 2237 this.Seeked = function() { 2238 this.StopWaiting() 2239 } 2240 ; 2241 this.Duration = function(time, duration) { 2242 o.controls.Duration(time, duration) 2243 } 2244 ; 2245 this.ScreenClick = function() { 2246 var x = false; 2247 if (o.controls.SettingsVisible()) { 2248 o.controls.Settings(); 2249 x = true 2250 } 2251 if (o.controls.PlaylistVisible()) { 2252 o.controls.Playlist(); 2253 x = true 2254 } 2255 if (!x) { 2256 this.Toggle() 2257 } 2258 } 2259 ; 2260 this.ControlsBgClick = function() { 2261 if (o.controls.SettingsVisible()) { 2262 o.controls.Settings() 2263 } 2264 } 2265 ; 2266 this.Toggle = function() { 2267 if (o.media.status() == "playing") { 2268 this.Pause() 2269 } else { 2270 this.Play() 2271 } 2272 } 2273 ; 2274 this.Seek = function(sec, hand) { 2275 o.media.Seek(sec); 2276 if (hand) { 2277 o.controls.Seek(sec, o.media.duration()) 2278 } 2279 o.seeking = true; 2280 o.seeking_time = o.media.time() 2281 } 2282 ; 2283 this.Open = function(url, target, endfull) { 2284 if (o.media.status() == "playing" && o.mode != 'audio') { 2285 Pause(); 2286 if (o.fullscreen && endfull) { 2287 o.controls.Normalscreen() 2288 } 2289 } 2290 window.open(url, target) 2291 } 2292 ; 2293 this.Playing = function() { 2294 var time = o.media.time(); 2295 var duration = o.media.duration(); 2296 if (!o.seeking) { 2297 o.controls.Played(time, duration) 2298 } else { 2299 o.media.time() != o.seeking_time ? o.seeking = false : '' 2300 } 2301 } 2302 ; 2303 this.Pausing = function() {} 2304 ; 2305 this.Stopped = function() { 2306 o.controls.Played(0, 0); 2307 o.controls.Loaded(0, 0); 2308 o.controls.StopWaiting() 2309 } 2310 ; 2311 this.Loading = function() { 2312 var time = o.media.loaded(); 2313 var duration = o.media.duration(); 2314 o.controls ? o.controls.Loaded(time, duration) : '' 2315 } 2316 ; 2317 this.Ended = function() { 2318 if (v.loop == 1) { 2319 if (o.file_type == "youtube") { 2320 this.Stop(); 2321 this.Play() 2322 } 2323 } else { 2324 this.Stop(); 2325 o.controls.onEnded(); 2326 Advertising("postroll") 2327 } 2328 } 2329 ; 2330 this.Fullscreen = function() { 2331 _fullscreen_start = true; 2332 if (o.frame.requestFullScreen) { 2333 o.frame.requestFullScreen(); 2334 realfullscreen = true 2335 } else if (o.frame.requestFullscreen) { 2336 o.frame.requestFullscreen(); 2337 realfullscreen = true 2338 } else if (o.frame.mozRequestFullScreen) { 2339 o.frame.mozRequestFullScreen(); 2340 realfullscreen = true 2341 } else if (o.frame.webkitRequestFullScreen) { 2342 o.frame.webkitRequestFullScreen(); 2343 realfullscreen = true 2344 } else if (o.frame.msRequestFullscreen) { 2345 o.frame.msRequestFullscreen(); 2346 realfullscreen = true 2347 } 2348 if (!realfullscreen) { 2349 this.FullscreenUI() 2350 } 2351 js("fullscreen"); 2352 log("fullscreen") 2353 } 2354 ; 2355 this.FullscreenUI = function() { 2356 if (_fullscreen_start) { 2357 o.fullscreen = true; 2358 if (!realfullscreen) { 2359 if (exist(o.parentIframe)) { 2360 try { 2361 css(o.parentIframe, { 2362 'width': '100%', 2363 'height': '100%', 2364 'position': 'fixed', 2365 'left': 0, 2366 'top': 0, 2367 'z-index': 1000 2368 }) 2369 } catch (err) {} 2370 } 2371 css(o.frame, { 2372 'width': '100%', 2373 'height': '100%', 2374 'position': 'fixed', 2375 'left': 0, 2376 'top': 0, 2377 'z-index': 1000 2378 }) 2379 } 2380 css(o.frame, { 2381 'backgroundColor': '#000000' 2382 }); 2383 o.controls.Fullscreen(); 2384 if (o.oo) { 2385 hide(o.oo) 2386 } 2387 _fullscreen_start = false 2388 } 2389 } 2390 ; 2391 this.Normalscreen = function() { 2392 _fullscreen_end = true; 2393 if (document.cancelFullScreen) { 2394 document.cancelFullScreen() 2395 } else if (document.exitFullscreen) { 2396 document.exitFullscreen() 2397 } else if (document.cancelFullscreen) { 2398 document.cancelFullscreen() 2399 } else if (document.mozCancelFullScreen) { 2400 document.mozCancelFullScreen() 2401 } else if (document.webkitCancelFullScreen) { 2402 document.webkitCancelFullScreen() 2403 } else if (document.msExitFullscreen) { 2404 document.msExitFullscreen() 2405 } 2406 if (!realfullscreen) { 2407 this.NormalscreenUI(false) 2408 } 2409 } 2410 ; 2411 this.NormalscreenUI = function(x) { 2412 if (_fullscreen_end || x) { 2413 o.fullscreen = false;
2414 if (!realfullscreen) { 2415 if (exist(o.parentIframe)) { 2416 try { 2417 css(o.parentIframe, { 2418 'position': 'static', 2419 'left': 0, 2420 'top': 0, 2421 'z-index': 'unset' 2422 }); 2423 css(o.parentIframe, o.parentIframe_style); 2424 css(o.parentIframe, { 2425 'width': o.normal_w, 2426 'height': o.normal_h 2427 }) 2428 } catch (err) {} 2429 } 2430 css(o.frame, { 2431 'width': o.normal_w, 2432 'height': o.normal_h, 2433 'position': 'absolute', 2434 'left': 0, 2435 'top': 0, 2436 'z-index': 'unset' 2437 }) 2438 } 2439 o.controls.Normalscreen(); 2440 if (o.oo) { 2441 show(o.oo) 2442 } 2443 css(o.frame, { 2444 'backgroundColor': v.screencolor 2445 }); 2446 _fullscreen_end = false; 2447 js("exitfullscreen"); 2448 log("exitfullscreen") 2449 } 2450 } 2451 ; 2452 this.Stop = function() { 2453 v.preload = 0; 2454 o.media.Stop(); 2455 o.controls.Pause(); 2456 o.actions.Stopped(); 2457 o.media.Volume(v.volume); 2458 if (o.controls.SettingsVisible()) { 2459 o.controls.Settings() 2460 } 2461 if (o.muted) { 2462 this.Mute() 2463 } 2464 js("stop") 2465 } 2466 ; 2467 this.SetQuality = function(x) { 2468 if (exist(o.current_quality)) { 2469 if (o.current_quality != x) { 2470 o.current_quality = x; 2471 o.media.SetQuality(x); 2472 o.controls.QualityChanged(x) 2473 } 2474 } 2475 } 2476 ; 2477 this.SetAudioTrack = function(x) { 2478 if (exist(o.current_audiotrack)) { 2479 if (o.current_audiotrack != x) { 2480 o.current_audiotrack = x; 2481 o.media.SetAudioTrack(x); 2482 o.controls.AudioTrackChanged(x) 2483 } 2484 } 2485 } 2486 ; 2487 var vast_and; 2488 var vast_or; 2489 var vast_type; 2490 var vasturl; 2491 function Advertising(x) { 2492 if (o.compilation.indexOf("VAST") != -1 && v.vast == 1) { 2493 if (exist(o.vast) || exist(o.vastloader)) { 2494 return true 2495 } else { 2496 if (exist(v[x])) { 2497 if (v[x].indexOf(".") > -1) { 2498 o.actions.Waiting(); 2499 Curtain(); 2500 vast_and = 0; 2501 vast_or = 0; 2502 vast_type = x; 2503 vasturl = v[x].split(" and "); 2504 for (var i = 0; i < vasturl.length; i++) { 2505 vasturl[i] = vasturl[i].split(" or ") 2506 } 2507 delete v[x]; 2508 o.vasttype = x; 2509 o.vast = new VastVideo(); 2510 o.vastloader = new VastLoader(); 2511 o.vastloader.Load(trim(vasturl[vast_and][vast_or]), x); 2512 return true 2513 } else { 2514 return false 2515 } 2516 } else { 2517 return false 2518 } 2519 } 2520 } else { 2521 return false 2522 } 2523 } 2524 ;this.VastReady = function(x) { 2525 delete o.vastloader; 2526 log("VAST ready"); 2527 o.vast.Go(x) 2528 } 2529 ; 2530 this.VastError = function() { 2531 if (vasturl.length > 0) { 2532 if (vast_or < vasturl[vast_and].length - 1) { 2533 vast_or++; 2534 o.vastloader = new VastLoader(); 2535 o.vastloader.Load(trim(vasturl[vast_and][vast_or])) 2536 } else { 2537 this.VastRemoveAndPlay() 2538 } 2539 } 2540 } 2541 ; 2542 this.VastRemove = function() { 2543 RemoveCurtain();
2544 this.StopWaiting() 2545 } 2546 ; 2547 this.VastInsertAnd = function(x) { 2548 vasturl.splice(vast_and + 1, 0, [x]) 2549 } 2550 ; 2551 this.VastRemoveAndPlay = function() { 2552 if (vasturl.length > vast_and + 1) { 2553 o.vast.RemoveForNextAd(); 2554 vast_and++; 2555 vast_or = 0; 2556 o.vastloader = new VastLoader(); 2557 o.vastloader.Load(trim(vasturl[vast_and][0]), vast_type) 2558 } else { 2559 this.VastRemove(); 2560 if (exist(o.vast)) { 2561 o.vast.Remove(); 2562 delete o.vast 2563 } 2564 delete o.vastloader; 2565 vasturl = []; 2566 vast_or = 0; 2567 vast_and = 0; 2568 vast_type = ''; 2569 if (o.vasttype == "preroll" || o.vasttype == "playroll" || o.vasttype == "midroll") { 2570 o.media.AfterVast(); 2571 this.Play() 2572 } 2573 delete o.vasttype 2574 } 2575 } 2576 ; 2577 function Curtain() { 2578 o.curtain = createElement("div"); 2579 o.frame.appendChild(o.curtain); 2580 css(o.curtain, { 2581 "width": "100%", 2582 "height": "100%", 2583 "position": "absolute", 2584 "top": 0, 2585 "left": 0, 2586 "background": "#ff0000", 2587 "opacity": 0.1 2588 }) 2589 } 2590 ;function RemoveCurtain() { 2591 if (o.curtain) { 2592 o.frame.removeChild(o.curtain); 2593 delete o.curtain 2594 } 2595 } 2596 ;function StopOtherPlayer() { 2597 for (var i = 0; i < pljssglobal.length; i++) { 2598 if (pljssglobal[i].api("id") != v.id) { 2599 pljssglobal[i].api('pause') 2600 } 2601 } 2602 pljssglobalid = v.id 2603 } 2604 function IndexPlaylist(x) { 2605 var y = Object.keys(x).length; 2606 if (y > 0) { 2607 x = IndexPlaylistProcessor(x, y, '', -1) 2608 } 2609 return x 2610 } 2611 function IndexPlaylistProcessor(x, y, p, j) { 2612 if (exist(x['playlist'])) { 2613 x = x['playlist']; 2614 y = x.length 2615 } 2616 for (var i = 0; i < y; i++) { 2617 if (!exist(x[i]['id']) || exist(o.playlist_dic[x[i]['id']])) { 2618 x[i]['id'] = "x" + random(1000000, 2000000) 2619 } 2620 x[i]['pjs_parent'] = p; 2621 x[i]['pjs_parent_i'] = j; 2622 x[i]['pjs_i'] = i; 2623 if (exist(x[i]['comment'])) { 2624 x[i]['title'] = x[i]['comment'] 2625 } 2626 o.playlist_dic[x[i]['id']] = x[i]; 2627 if (exist(x[i]['playlist'])) { 2628 x[i]['folder'] = x[i]['playlist'] 2629 } 2630 if (exist(x[i]['folder'])) { 2631 var z = Object.keys(x[i]['folder']).length; 2632 if (z > 0) { 2633 x[i]['folder'] = IndexPlaylistProcessor(x[i]['folder'], z, x[i]['id'], i) 2634 } 2635 } 2636 } 2637 return x 2638 } 2639 function FindFileInPlaylist() { 2640 var x; 2641 if (exist(v.plstart)) { 2642 x = exist(o.playlist_dic[v.plstart]) ? o.playlist_dic[v.plstart] : o.playlist[0] 2643 } else { 2644 x = o.playlist[0] 2645 } 2646 for (var i = 0; i < 10; i++) { 2647 if (exist(x['folder'])) { 2648 x = x['folder'][0] 2649 } else { 2650 break 2651 } 2652 } 2653 v.plstart = x.id; 2654 return x 2655 } 2656 }; 2657 var Media = function(url) { 2658 var url; 2659 var urls; 2660 var urls_and; 2661 var current_url; 2662 var _status = ""; 2663 var started = false; 2664 var media; 2665 var mediascale = 1; 2666 var wait; 2667 if (typeof (url) == 'string') { 2668 url = trim(url); 2669 if (url.indexOf(".txt") > 0) { 2670 var XHR = ("onload"in new XMLHttpRequest()) ? XMLHttpRequest : XDomainRequest; 2671 var xhr = new XHR(); 2672 xhr.open('GET', url, true); 2673 xhr.onload = function() { 2674 if (this.readyState == 4 && this.status == 200) { 2675 Playlist(this) 2676 } else { 2677 onError("playlist not found or access denied") 2678 } 2679 } 2680 ; 2681 xhr.onerror = function(e) { 2682 onError("playlist not found or access denied") 2683 } 2684 ; 2685 xhr.send(); 2686 wait = true 2687 } 2688 } 2689 o.mediacontainer = createElement("div"); 2690 css(o.mediacontainer, { 2691 "position": "absolute", 2692 "width": "100%", 2693 "height": "100%" 2694 }); 2695 o.frame.appendChild(o.mediacontainer); 2696 if (!wait) { 2697 Start() 2698 } 2699 function Playlist(x) { 2700 url = JSON.parse(x.responseText); 2701 Start() 2702 } 2703 function Start() { 2704 url = o.actions.File(url); 2705 File(url) 2706 } 2707 function onError(x) { 2708 log("Error: " + x); 2709 v.alerts && !o.media_error ? o.alert.txt("Error: " + x) : ''; 2710 o.media_error = true 2711 } 2712 this.onError = function() { 2713 onError(media.errorMessage()) 2714 } 2715 ; 2716 this.onEnded = function() { 2717 log("Ended"); 2718 o.actions.Ended(); 2719 js("end") 2720 } 2721 ; 2722 this.onPlay = function() { 2723 o.controls.Play() 2724 } 2725 ; 2726 this.onPause = function() { 2727 o.controls.Pause() 2728 } 2729 ; 2730 this.onTimeupdate = function() {} 2731 ; 2732 this.onSeeking = function() { 2733 log("Seeking") 2734 } 2735 ; 2736 this.onSeeked = function() { 2737 log("Seeked"); 2738 o.actions.Seeked(); 2739 js("seek") 2740 } 2741 ; 2742 this.onMeta = function() { 2743 log("Metadata"); 2744 o.actions.Metadata() 2745 } 2746 ; 2747 this.onDuration = function() { 2748 log("Duration", media.duration()); 2749 o.actions.Duration(media.time(), media.duration()); 2750 js("duration") 2751 } 2752 ; 2753 this.onVolume = function() {} 2754 ; 2755 this.onWaiting = function() { 2756 log("Waiting"); 2757 o.actions.Waiting(); 2758 js("waiting") 2759 } 2760 ; 2761 this.onProgress = function() {} 2762 ; 2763 this.onTimeupdate = function() {
2764 o.actions.StopWaiting(); 2765 js("time") 2766 } 2767 ; 2768 this.onYoutubeReady = function() { 2769 if (o.file_type == "youtube") { 2770 media.YoutubeReady() 2771 } 2772 } 2773 ; 2774 this.SetQuality = function(x) { 2775 log("Quality", x); 2776 if (o.file_type == "native" && exist(o.files[x])) { 2777 var time = this.time(); 2778 File(o.files[x]); 2779 o.actions.Play(); 2780 o.actions.Seek(time, false) 2781 } 2782 if (o.file_type == "hls") { 2783 media.setHlsQuality(x) 2784 } else if (o.file_type == "dash") { 2785 media.setDashQuality(x) 2786 } else if (o.file_type == "youtube") { 2787 media.setQuality(x) 2788 } 2789 } 2790 ; 2791 this.SetAudioTrack = function(x) { 2792 if (o.file_type == "hls") { 2793 media.setHlsAudioTrack(x) 2794 } else if (o.file_type == "dash") { 2795 media.setDashAudioTrack(x) 2796 } 2797 } 2798 ; 2799 this.getQuality = function() { 2800 var x = o.files_quality[o.current_quality]; 2801 x == undefined ? x = '' : ''; 2802 if (o.file_type == "youtube" || o.file_type == "hls" || o.file_type == "dash") { 2803 x = (media.auto() ? '' + Lang("auto") + ' ' : '') + x 2804 } 2805 return x 2806 } 2807 ; 2808 this.getAudioTrack = function() { 2809 var x = o.files_audiotrack[o.current_audiotrack]; 2810 x == undefined ? x = '' : ''; 2811 return x 2812 } 2813 ; 2814 this.autoQuality = function() { 2815 var x = false; 2816 if (o.file_type == "youtube" || o.file_type == "hls" || o.file_type == "dash") { 2817 x = media.auto() 2818 } 2819 return x 2820 } 2821 ; 2822 this.resize = function(x) { 2823 if (o.file_type == "youtube") { 2824 media.resize() 2825 } 2826 } 2827 ; 2828 if (!exist(o.poster)) { 2829 o.poster = createElement("div"); 2830 o.frame.appendChild(o.poster) 2831 } 2832 if (exist(v.poster)) { 2833 Poster(v.poster, o.poster, v.poster_scale) 2834 } 2835 function Status() { 2836 _status = media ? media.status() : '' 2837 } 2838 function ParseUrl(url) { 2839 urls = url.split(" or "); 2840 for (var i = 0; i < urls.length; i++) { 2841 if (urls[i].indexOf(" and ") > -1) { 2842 urls_and = urls[i].split(" and "); 2843 urls[i] = urls_and[random(0, urls_and.length - 1)] 2844 } 2845 } 2846 current_url = 0 2847 } 2848 function Timer() { 2849 Status(); 2850 if (_status == "playing") { 2851 o.actions.Playing() 2852 } 2853 if (_status == "paused") { 2854 o.actions.Pausing() 2855 } 2856 if (_status != "") { 2857 o.actions.Loading() 2858 } 2859 } 2860 function File(x) { 2861 RemoveMedia(); 2862 x ? ParseUrl(x) : ''; 2863 if (urls.length > 0) { 2864 CreateMedia(urls[0]) 2865 } 2866 clearInterval(timerInterval); 2867 var timerInterval = setInterval(Timer, 200) 2868 } 2869 function FileType(x) { 2870 var type = "native"; 2871 if (x.indexOf(".m3u8") > 0) { 2872 type = "hls" 2873 } else if (x.indexOf(".mpd") > 0) { 2874 type = "dash" 2875 } else if (x.indexOf('youtube.com/') > -1 || x.indexOf('youtu.be/') > -1) { 2876 type = "youtube" 2877 } 2878 return type 2879 } 2880 function CreateMedia(x) { 2881 o.file_type = FileType(x); 2882 o.reverse_quality = false; 2883 if (o.file_type == "native" || o.file_type == "hls" || o.file_type == "dash") { 2884 media = new MediaVideo(x) 2885 } 2886 if (o.file_type == "youtube") { 2887 media = new MediaYoutube(x) 2888 } 2889 } 2890 function RemoveMedia() { 2891 if (media) { 2892 media.Remove(); 2893 delete media; 2894 media = null; 2895 _status = "ended" 2896 } 2897 } 2898 this.File = function(x) { 2899 File(x) 2900 } 2901 ; 2902 this.Poster = function(x) { 2903 Poster(x, o.poster, v.poster_scale) 2904 } 2905 ; 2906 this.Play = function() { 2907 if (media) { 2908 media.Play(); 2909 exist(o.poster) ? hide(o.poster) : ''; 2910 if (!started) { 2911 js("start"); 2912 started = true 2913 } 2914 js("play") 2915 } 2916 } 2917 ; 2918 this.BeforeVast = function() { 2919 media ? media.BeforeVast() : '' 2920 } 2921 ; 2922 this.AfterVast = function() { 2923 media.AfterVast() 2924 } 2925 ; 2926 this.Pause = function() { 2927 media ? media.Pause() : '' 2928 } 2929 ; 2930 this.Stop = function() { 2931 o.actions.Seek(0, false); 2932 exist(o.poster) ? show(o.poster) : ''; 2933 File() 2934 } 2935 ; 2936 this.Toggle = function() { 2937 media ? media.Toggle() : '' 2938 } 2939 ; 2940 this.Seek = function(x) { 2941 media ? media.Seek(x) : '' 2942 } 2943 ; 2944 this.Mute = function() { 2945 media ? media.Mute() : '' 2946 } 2947 ; 2948 this.Unmute = function() { 2949 media ? media.Unmute() : '' 2950 } 2951 ; 2952 this.Volume = function(x) { 2953 media ? media.Volume(x) : '' 2954 } 2955 ; 2956 this.isPlaying = function() { 2957 return media ? media.isPlaying() : false 2958 } 2959 ; 2960 this.isLive = function() {
2961 return media ? media.isLive() : false 2962 } 2963 ; 2964 this.status = function() { 2965 return _status 2966 } 2967 ; 2968 this.started = function() { 2969 return media ? media.time() > 0 || _status == "playing" : false 2970 } 2971 ; 2972 this.time = function() { 2973 return media ? (media.time() > 0 ? media.time() : 0) : 0 2974 } 2975 ; 2976 this.duration = function() { 2977 return media ? (media.duration() > 0 ? media.duration() : 0) : 0 2978 } 2979 ; 2980 this.loaded = function() { 2981 return media ? media.loaded() : 0 2982 } 2983 ; 2984 this.scale = function(x) { 2985 mediascale += parseFloat(x); 2986 css(o.mediacontainer, { 2987 "transform": "scale(" + mediascale + ")" 2988 }) 2989 } 2990 ; 2991 this.currentFile = function() { 2992 return urls.length > 0 ? urls[current_url] : '' 2993 } 2994 }; 2995 var MediaVideo = function(url) { 2996 var tag = createElement("video"); 2997 o.mediacontainer.appendChild(tag); 2998 var hls; 2999 var is_hls = false; 3000 var dash; 3001 var is_dash = false; 3002 var is_live = false; 3003 var error; 3004 var error_time; 3005 var unmute = false; 3006 css(tag, { 3007 'width': '100%', 3008 'height': '100%', 3009 'object-fit': 'contain' 3010 }); 3011 attr(tag, { 3012 'preload': (v.preload == 1 && v.audoplay == 0 ? 'metadata' : 'none'), 3013 'src': url, 3014 'x-webkit-airplay': 'allow', 3015 'webkit-playsinline': '1' 3016 }); 3017 if (v.nativecontrols == 1) { 3018 attr(tag, { 3019 'controls': '1' 3020 }) 3021 } 3022 if (v.loop == 1) { 3023 attr(tag, { 3024 'loop': '1' 3025 }) 3026 } 3027 if (url.indexOf(".mpd") > 0 && o.compilation.indexOf("DASH") != -1) { 3028 if (MseIsSupported()) { 3029 var dash_init = false; 3030 var dash_play = false; 3031 var dash_config = { 3032 debug: (v.dashdebug == 1), 3033 autoPlay: (v.autoplay == 1), 3034 bufferLength: 60 3035 }; 3036 is_dash = true; 3037 dash = dashjs.MediaPlayer().create(); 3038 dash.getDebug().setLogToBrowserConsole(dash_config.debug); 3039 dash.initialize(tag, url, dash_config.autoPlay); 3040 dash.setFragmentLoaderRetryAttempts(6); 3041 dash.setStableBufferTime(dash_config.bufferLength); 3042 dash.setBufferTimeAtTopQualityLongForm(dash_config.bufferLength); 3043 dash.setLongFormContentDurationThreshold(dash_config.bufferLength); 3044 dash.enableLastBitrateCaching(false); 3045 dash.enableLastMediaSettingsCaching(false); 3046 dash.setFastSwitchEnabled(false); 3047 dash.setScheduleWhilePaused(false); 3048 dash.setAutoSwitchQualityFor("audio", true); 3049 dash.setAutoSwitchQualityFor("video", true); 3050 dash.on(dashjs.MediaPlayer.events.STREAM_INITIALIZED, function(data) { 3051 if (!dash_init) { 3052 log("DASH attached"); 3053 DashQualityLevels(); 3054 DashAudioTracks(); 3055 DashAudioTrack(); 3056 is_live = dash.isDynamic(); 3057 is_live ? log("Live") : ''; 3058 o.current_quality = dash.getBitrateInfoListFor("video").length - 1; 3059 o.controls.QualityChangedNoHand(o.current_quality); 3060 dash.setQualityFor("video", o.current_quality); 3061 dash.setQualityFor("audio", o.current_quality); 3062 o.actions.MediaReady(); 3063 dash_init = true 3064 } 3065 }); 3066 dash.on(dashjs.MediaPlayer.events.PLAYBACK_PLAYING, function(data) { 3067 if (!dash_play) { 3068 var track = parseInt(o.current_audiotrack); 3069 if (track > 0) { 3070 dash.setCurrentTrack(dash.getTracksFor("audio")[track]) 3071 } 3072 dash_play = true 3073 } 3074 }); 3075 dash.on(dashjs.MediaPlayer.events.PLAYBACK_TIME_UPDATED, function(data) { 3076 if (is_live) { 3077 o.actions.Duration(dash.time(), dash.duration()) 3078 } 3079 }); 3080 dash.on(dashjs.MediaPlayer.events.TEXT_TRACKS_ADDED, function(data) { 3081 dash.setTextTrack(-1) 3082 }); 3083 dash.on(dashjs.MediaPlayer.events.QUALITY_CHANGE_REQUESTED, function(data) { 3084 if (data.mediaType == "video" && data.oldQuality != data.newQuality) { 3085 o.current_quality = data.newQuality; 3086 o.controls.QualityChangedNoHand(o.current_quality); 3087 log("DASH Level " + o.current_quality) 3088 } 3089 }); 3090 dash.on(dashjs.MediaPlayer.events.ERROR, function(data) { 3091 if (data.error == "manifestError") { 3092 error = "DASH " + data.error + ": " + data.event.message + ", " + data.event.event; 3093 log(error); 3094 o.media.onError() 3095 } else if (data.error == "capability" || data.error == "mediasource") { 3096 error = "DASH " + data.error + " error: " + data.event; 3097 log(error); 3098 o.media.onError() 3099 } else if (data.error == "key_session" || data.error == "key_message") { 3100 error = "DASH " + data.error + " error: " + data.event; 3101 log(error); 3102 o.media.onError() 3103 } else if (data.error == "download") { 3104 log("DASH fatal network error encountered"); 3105 error_time = this.time; 3106 setTimeout(ErrorTimeout, v.errortimeout) 3107 } 3108 }) 3109 } else { 3110 log("DASH not supported") 3111 } 3112 } else if (url.indexOf(".m3u8") > 0 && o.compilation.indexOf("HLS") != -1) { 3113 is_hls = true; 3114 if (!Hls.isSupported() || o.system.safari) { 3115 is_hls = false 3116 } else { 3117 var hls_config = { 3118 debug: (v.hlsdebug == 1), 3119 autoStartLoad: (v.preload == 1 || v.autoplay == 1), 3120 maxBufferLength: 60, 3121 maxMaxBufferLength: 60, 3122 enableWorker: false 3123 }; 3124 hls = new Hls(hls_config); 3125 hls.loadSource(url); 3126 hls.attachMedia(tag);
3127 hls.on(Hls.Events.MEDIA_ATTACHED, function() { 3128 log("HLS attached") 3129 }); 3130 hls.on(Hls.Events.MANIFEST_PARSED, function(event, data) { 3131 o.actions.MediaReady() 3132 }); 3133 hls.on(Hls.Events.MANIFEST_LOADED, function(event, data) { 3134 HlsQualityLevels(); 3135 o.current_quality = hls.levels.length - 1; 3136 o.controls.QualityChangedNoHand(o.current_quality) 3137 }); 3138 hls.on(Hls.Events.LEVEL_SWITCH, function(event, data) { 3139 o.current_quality = hls.loadLevel; 3140 o.controls.QualityChangedNoHand(o.current_quality); 3141 log("HLS Level " + o.current_quality) 3142 }); 3143 hls.on(Hls.Events.LEVEL_LOADED, function(event, data) { 3144 is_live = data.details.live; 3145 is_live ? log("Live") : '' 3146 }); 3147 hls.on(Hls.Events.AUDIO_TRACKS_UPDATED, function(event, data) { 3148 HlsAudioTracks() 3149 }); 3150 hls.on(Hls.Events.AUDIO_TRACK_SWITCHING, function(event, data) { 3151 HlsAudioTrack() 3152 }); 3153 hls.on(Hls.Events.ERROR, function(event, data) { 3154 if (data.fatal) { 3155 switch (data.type) { 3156 case Hls.ErrorTypes.NETWORK_ERROR: 3157 log("HLS fatal network error encountered, try to recover"); 3158 hls.startLoad(); 3159 error_time = this.time; 3160 setTimeout(ErrorTimeout, v.errortimeout); 3161 break; 3162 case Hls.ErrorTypes.MEDIA_ERROR: 3163 log("HLS fatal media error encountered, try to recover"); 3164 hls.recoverMediaError(); 3165 break; 3166 default: 3167 error = "HLS fatal error, destroy"; 3168 hls.destroy(); 3169 o.media.onError(); 3170 break 3171 } 3172 } 3173 }) 3174 } 3175 } 3176 tag.addEventListener('loadstart', onLoadStart); 3177 tag.addEventListener('error', onError); 3178 tag.addEventListener('ended', onEnded); 3179 tag.addEventListener('play', onPlay); 3180 tag.addEventListener('pause', onPause); 3181 tag.addEventListener('timeupdate', onTimeupdate); 3182 tag.addEventListener('seeking', onSeeking); 3183 tag.addEventListener('seeked', onSeeked); 3184 tag.addEventListener('loadedmetadata', onMeta); 3185 tag.addEventListener('volumechange', onVolume); 3186 tag.addEventListener('waiting', onWaiting); 3187 tag.addEventListener('durationchange', onDuration); 3188 tag.addEventListener('progress', onProgress); 3189 function onLoadStart() { 3190 if (!is_hls || !is_dash) { 3191 o.actions.MediaReady() 3192 } 3193 } 3194 function onError() { 3195 if (tag.networkState == 3) { 3196 error = "video " + (url.substr(url.lastIndexOf("/") + 1)) + " not found or access denied" 3197 } 3198 if (tag.networkState == 0) { 3199 error = "network empty" 3200 } 3201 o.media.onError() 3202 } 3203 function onEnded() { 3204 o.media.onEnded() 3205 } 3206 function onPlay() { 3207 o.media.onPlay() 3208 } 3209 function onPause() { 3210 o.media.onPause() 3211 } 3212 function onTimeupdate() { 3213 o.media.onTimeupdate() 3214 } 3215 function onSeeking() { 3216 o.media.onSeeking() 3217 } 3218 function onSeeked() { 3219 o.media.onSeeked() 3220 } 3221 function onMeta() { 3222 o.media.onMeta() 3223 } 3224 function onDuration() { 3225 o.media.onDuration() 3226 } 3227 function onVolume() { 3228 o.media.onVolume() 3229 }
3230 function onWaiting() { 3231 o.media.onWaiting() 3232 } 3233 function onProgress(event) { 3234 o.media.onProgress() 3235 } 3236 function ErrorTimeout() { 3237 if (error_time == this.time) { 3238 error = "network error"; 3239 o.media.onError() 3240 } 3241 } 3242 function MseIsSupported() { 3243 return window.MediaSource && "function" == typeof window.MediaSource.isTypeSupported && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"') 3244 } 3245 function DashQualityLevels() { 3246 var x = dash.getBitrateInfoListFor("video"); 3247 if (x.length > 1) { 3248 var y = ''; 3249 for (var i = 0; i < x.length; i++) { 3250 o.files_quality[i] = exist(x[i].height) ? MseRenameQualities(x[i], v.nameofdashquality) : i; 3251 if (o.files_quality[i] == y) { 3252 y = o.files_quality[i]; 3253 if (exist(x[i].bitrate)) { 3254 o.files_quality[i] += " " + parseInt(x[i].bitrate / 1000) + 'kbps'; 3255 o.files_quality[i - 1] += " " + parseInt(x[i - 1].bitrate / 1000) + 'kbps' 3256 } 3257 } else { 3258 y = o.files_quality[i] 3259 } 3260 } 3261 o.files_quality[x.length] = Lang("auto") 3262 } 3263 o.reverse_quality = true 3264 } 3265 function DashAudioTracks() { 3266 var x = dash.getTracksFor("audio"); 3267 if (x.length > 1) { 3268 for (var i = 0; i < x.length; i++) { 3269 o.files_audiotrack[i] = i; 3270 if (exist(x[i].lang)) { 3271 o.files_audiotrack[i] = RenameTracks(x[i].lang) 3272 } else { 3273 if (exist(x[i].index)) { 3274 o.files_audiotrack[i] = Lang("audiotrack") + " " + x[i].index 3275 } 3276 } 3277 } 3278 } 3279 } 3280 function DashAudioTrack() { 3281 o.current_audiotrack = 0; 3282 log("DASH AudioTrack ", o.current_audiotrack); 3283 o.controls.AudioTrackChangedNoHand(o.current_audiotrack) 3284 } 3285 function HlsQualityLevels() { 3286 var x = hls.levels; 3287 if (x.length > 1) { 3288 for (var i = 0; i < x.length; i++) { 3289 o.files_quality[i] = exist(x[i].height) ? MseRenameQualities(x[i], v.nameofhlsquality) : i 3290 } 3291 o.files_quality[x.length] = Lang("auto") 3292 } 3293 o.reverse_quality = true 3294 } 3295 function HlsAudioTracks() { 3296 var x = hls.audioTracks; 3297 if (x.length > 1) { 3298 for (var i = 0; i < x.length; i++) { 3299 o.files_audiotrack[i] = exist(x[i].name) ? RenameTracks(x[i].name) : i 3300 } 3301 } 3302 } 3303 function HlsAudioTrack() { 3304 o.current_audiotrack = hls.audioTrack; 3305 log("HLS AudioTrack ", o.current_audiotrack); 3306 o.controls.AudioTrackChangedNoHand(o.current_audiotrack) 3307 } 3308 ;
3308function RenameTracks(x) { 3309 var r = x.toLowerCase(); 3310 if (r == "eng" || r == "en") { 3311 x = "English" 3312 } else if (r == "rus" || r == "ru") { 3313 x = "Ð ÑÑÑкий" 3314 } 3315 return x 3316 } 3317 ;function MseRenameQualities(x, y) { 3318 var r = x.height + 'p'; 3319 if (x.height < 200) { 3320 r = '160p' 3321 } else if (x.height >= 200 && x.height <= 300) { 3322 r = '240p' 3323 } else if (x.height > 300 && x.height <= 400) { 3324 r = '360p' 3325 } else if (x.height > 400 && x.height <= 600) { 3326 r = '480p' 3327 } else if (x.height > 600 && x.height <= 900) { 3328 r = '720p' 3329 } else if (x.height > 900 && x.height <= 1200) { 3330 r = '1080p' 3331 } else if (x.height > 1200 && x.height <= 1800) { 3332 r = '1440p' 3333 } else if (x.height > 1800) { 3334 r = '2160p' 3335 } 3336 if (x.width == 426 && x.height <= 240) { 3337 r = '240p' 3338 } else if (x.width == 640 && x.height <= 360) { 3339 r = '360p' 3340 } else if (x.width == 854 && x.height <= 480) { 3341 r = '480p' 3342 } else if (x.width == 1280 && x.height <= 720) { 3343 r = '720p' 3344 } else if (x.width == 1920 && x.height <= 1080) { 3345 r = '1080p' 3346 } else if (x.width == 2560 && x.height <= 1440) { 3347 r = '1440p' 3348 } else if (x.width == 3840 && x.height <= 2160) { 3349 r = '2160p' 3350 } 3351 if (y == 1) { 3352 r = Lang(r) 3353 } 3354 if (y == 2 && exist(x.bitrate)) { 3355 r = parseInt(x.bitrate / 1000) + ' kbps' 3356 } 3357 return r 3358 } 3359 ;this.Play = function() { 3360 if (is_hls) { 3361 hls.startLoad() 3362 } 3363 tag.play() 3364 } 3365 ; 3366 this.BeforeVast = function() { 3367 if (o.system.mobile) { 3368 if (!tag.muted) { 3369 tag.muted = true; 3370 unmute = true 3371 } 3372 css(tag, { 3373 "position": "absolute", 3374 "left": -2000, 3375 "top": -2000 3376 }); 3377 tag.play(); 3378 setTimeout(function() { 3379 tag.pause() 3380 }, 100) 3381 } 3382 } 3383 ; 3384 this.AfterVast = function() { 3385 if (o.system.mobile) { 3386 if (unmute) { 3387 tag.muted = false; 3388 unmute = false 3389 } 3390 css(tag, { 3391 "position": "static", 3392 "left": 0, 3393 "top": 0 3394 }) 3395 } 3396 } 3397 ; 3398 this.Pause = function() { 3399 tag.pause() 3400 } 3401 ; 3402 this.Toggle = function() { 3403 !tag.paused ? tag.pause() : tag.play() 3404 } 3405 ; 3406 this.Seek = function(x) { 3407 if (is_dash) { 3408 dash.seek(x) 3409 } else { 3410 tag.currentTime = x 3411 } 3412 } 3413 ; 3414 this.Mute = function() { 3415 tag.muted = true 3416 } 3417 ; 3418 this.Unmute = function() { 3419 tag.muted = false 3420 } 3421 ; 3422 this.Volume = function(x) { 3423 tag.volume = x 3424 } 3425 ; 3426 this.isPlaying = function() { 3427 return !tag.paused 3428 } 3429 ; 3430 this.isLive = function() { 3431 return is_live 3432 } 3433 ; 3434 this.status = function() { 3435 var state = "playing"; 3436 if (tag.paused) { 3437 state = "paused" 3438 } 3439 if (tag.ended) { 3440 state = "ended" 3441 } 3442 return state 3443 } 3444 ; 3445 this.time = function() { 3446 if (is_dash) { 3447 return dash.time() 3448 } else { 3449 return tag.currentTime 3450 } 3451 } 3452 ; 3453 this.duration = function() { 3454 var x = tag.duration; 3455 if (is_dash) { 3456 x = dash.duration() 3457 } 3458 return x != Infinity && !isNaN(x) ? x : 0 3459 } 3460 ; 3461 this.loaded = function() { 3462 var x = 0; 3463 if (tag.buffered) { 3464 if (tag.buffered.length > 0) { 3465 x = tag.buffered.end(tag.buffered.length - 1) 3466 } 3467 } 3468 return x 3469 } 3470 ; 3471 this.auto = function() { 3472 if (is_hls) { 3473 return hls ? hls.autoLevelEnabled : false 3474 } else if (is_dash) { 3475 return dash ? dash.getAutoSwitchQuality() : false 3476 } else { 3477 return false 3478 } 3479 } 3480 ; 3481 this.setDashQuality = function(x) { 3482 if (dash) { 3483 var x = parseInt(x); 3484 if (x == dash.getBitrateInfoListFor("video").length) { 3485 o.current_quality = dash.getQualityFor('video'); 3486 dash.setAutoSwitchQualityFor("audio", true); 3487 dash.setAutoSwitchQualityFor("video", true) 3488 } else { 3489 dash.setAutoSwitchQualityFor("audio", false); 3490 dash.setAutoSwitchQualityFor("video", false); 3491 dash.setQualityFor('video', x); 3492 dash.setQualityFor('audio', x) 3493 } 3494 } 3495 } 3496 ; 3497 this.setDashAudioTrack = function(x) { 3498 if (dash) { 3499 if (tag.buffered.length > 0) { 3500 dash.setCurrentTrack(dash.getTracksFor('audio')[parseInt(x)]) 3501 } 3502 } 3503 } 3504 ; 3505 this.setHlsQuality = function(x) { 3506 if (hls) { 3507 var y = parseInt(x); 3508 if (x == hls.levels.length) { 3509 y = -1 3510 } 3511 if (v.hlschangequality == "current") { 3512 setTimeout(onWaiting, 500); 3513 hls.currentLevel = y 3514 } 3515 if (v.hlschangequality == "next") { 3516 log("HLS next level " + y); 3517 hls.nextLevel = y 3518 } 3519 if (y == -1) { 3520 o.current_quality = hls.loadLevel 3521 } 3522 } 3523 } 3524 ; 3525 this.setHlsAudioTrack = function(x) { 3526 if (hls) { 3527 hls.audioTrack = parseInt(x) 3528 } 3529 } 3530 ; 3531 this.errorMessage = function() { 3532 return error 3533 } 3534 ; 3535 this.Remove = function() { 3536 hls ? hls.destroy() : ''; 3537 dash ? dash.reset() : ''; 3538 tag.removeEventListener('error', onError); 3539 tag.removeEventListener('ended', onEnded); 3540 tag.removeEventListener('play', onPlay); 3541 tag.removeEventListener('pause', onPause); 3542 tag.removeEventListener('timeupdate', onTimeupdate); 3543 tag.removeEventListener('seeking', onSeeking); 3544 tag.removeEventListener('seeked', onSeeked); 3545 tag.removeEventListener('loadedmetadata', onMeta); 3546 tag.removeEventListener('volumechange', onVolume); 3547 tag.removeEventListener('waiting', onWaiting); 3548 tag.removeEventListener('durationchange', onDuration); 3549 tag.removeEventListener('progress', onProgress); 3550 o.mediacontainer.removeChild(tag); 3551 delete tag; 3552 tag = null 3553 } 3554 }; 3555 var MediaYoutube = function(url) { 3556 var youtube_id = YoutubeID(url); 3557 var error; 3558 var player; 3559 var ready = false;
3560 var auto = true; 3561 var quality_received = false; 3562 var container_id = 'pljs_yt_' + v.id; 3563 var container = createElement('div'); 3564 container.setAttribute('id', container_id); 3565 o.mediacontainer.appendChild(container); 3566 if (!window['YT']) { 3567 window.onYouTubeIframeAPIReady = function() { 3568 YouTubeIframeAPIReady(); 3569 for (var i = 0; i < pljssglobal.length; i++) { 3570 if (pljssglobal[i].api("id") != v.id) { 3571 if (pljssglobal[i].api('isyoutube')) { 3572 pljssglobal[i].api('youtubeready') 3573 } 3574 } 3575 } 3576 } 3577 ; 3578 if (!YoutubeInserted()) { 3579 var tag = document.createElement('script'); 3580 tag.src = "https://www.youtube.com/iframe_api"; 3581 tag.name = "youtube_iframe_api"; 3582 var firstScriptTag = document.getElementsByTagName('script')[0]; 3583 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag) 3584 } 3585 } else { 3586 YouTubeIframeAPIReady() 3587 } 3588 function YoutubeInserted() { 3589 var x = false; 3590 var scripts = document.getElementsByTagName('script'); 3591 for (var i = 0; i < scripts.length; i++) { 3592 if (scripts[i].src.indexOf("youtube.com/iframe_api") > -1) { 3593 x = true 3594 } 3595 } 3596 return x 3597 } 3598 function YouTubeIframeAPIReady() { 3599 if (v.preload == 1) { 3600 Init() 3601 } else { 3602 o.actions.MediaReady() 3603 } 3604 } 3605 function Init() { 3606 player = new YT.Player(container_id,{ 3607 height: o.container_h, 3608 width: o.container_w, 3609 videoId: youtube_id, 3610 playerVars: { 3611 enablejsapi: 1, 3612 playerapiid: container_id, 3613 html5: 1, 3614 disablekb: 1, 3615 iv_load_policy: 3, 3616 controls: 0, 3617 showinfo: 0, 3618 modestbranding: 1, 3619 rel: 0, 3620 autoplay: 0, 3621 loop: 0 3622 }, 3623 events: { 3624 'onReady': onPlayerReady, 3625 'onStateChange': onPlayerStateChange, 3626 'onError': onError, 3627 'onPlaybackQualityChange': onQualityChanged 3628 } 3629 }); 3630 Resize() 3631 } 3632 function onPlayerReady() { 3633 ready = true; 3634 if (v.preload == 0) { 3635 player.playVideo() 3636 } else { 3637 o.actions.MediaReady() 3638 } 3639 o.media.onDuration(); 3640 onMeta(); 3641 Resize() 3642 } 3643 function onPlayerStateChange(event) { 3644 if (event.data == YT.PlayerState.PLAYING) { 3645 o.media.onPlay(); 3646 o.media.onTimeupdate(); 3647 Qualities() 3648 } 3649 if (event.data == YT.PlayerState.PAUSED) { 3650 o.media.onPause() 3651 } 3652 if (event.data == YT.PlayerState.ENDED) { 3653 onEnded() 3654 } 3655 if (event.data == YT.PlayerState.BUFFERING) { 3656 onWaiting() 3657 } 3658 if (event.data == YT.PlayerState.CUED) {} 3659 } 3660 function onError(event) { 3661 if (event.data == 2) { 3662 error = "wrong youtube id" 3663 } 3664 if (event.data == 5) { 3665 error = "network empty" 3666 } 3667 if (event.data == 101 || event.data == 150 || event.data == 100) { 3668 error = "this video is unavailable" 3669 } 3670 o.media.onError() 3671 } 3672 function onEnded() { 3673 o.media.onEnded() 3674 } 3675 function onPlay() { 3676 o.media.onPlay() 3677 } 3678 function onPause() { 3679 o.media.onPause() 3680 } 3681 function onTimeupdate() { 3682 o.media.onTimeupdate() 3683 } 3684 function onMeta() { 3685 o.media.onMeta() 3686 } 3687 function onDuration() { 3688 o.media.onDuration() 3689 } 3690 function onVolume() { 3691 o.media.onVolume() 3692 }
3693 function onWaiting() { 3694 o.media.onWaiting() 3695 } 3696 function onQualityChanged(event) { 3697 SetCurrentQuality(event.data) 3698 } 3699 function YoutubeID(url) { 3700 var x; 3701 if (url.indexOf('youtu.be/') > -1) { 3702 x = url.substr(url.indexOf(".be/") + 4); 3703 x.replace("/", "") 3704 } else { 3705 x = url.split(/(youtu.be\/|v\/|embed\/|watch\?|youtube.com\/user\/[^#]*#([^\/]*?\/)*)\??v?=?([^#\&\?]*)/)[3] 3706 } 3707 return x 3708 } 3709 function Qualities() { 3710 if (!quality_received) { 3711 var x = player.getAvailableQualityLevels() + ''; 3712 if (x != '' && x != undefined) { 3713 o.files_quality = x.split(','); 3714 for (var i = 0; i < o.files_quality.length; i++) { 3715 o.files_quality[i] = RenameQualities(o.files_quality[i]) 3716 } 3717 quality_received = true; 3718 SetCurrentQuality(player.getPlaybackQuality()) 3719 } 3720 } 3721 } 3722 function SetCurrentQuality(x) { 3723 o.current_quality = o.files_quality.indexOf(RenameQualities(x + '')); 3724 o.controls.QualityChanged(o.current_quality) 3725 } 3726 function Status() { 3727 var state = -1; 3728 if (ready) { 3729 state = player.getPlayerState() 3730 } 3731 var x = ''; 3732 if (state == -1) { 3733 x = "paused" 3734 } 3735 if (state == 1 || state == 3) { 3736 x = "playing" 3737 } 3738 if (state == 2) { 3739 x = "paused" 3740 } 3741 if (state == 5) { 3742 x = "paused" 3743 } 3744 if (state == 0) { 3745 x = "ended" 3746 } 3747 return x 3748 } 3749 function Resize() { 3750 player ? player.setSize(o.screen_w, o.screen_h) : '' 3751 }
3752 function RenameQualities(x) { 3753 y = x; 3754 if (x == "tiny") { 3755 y = "160p" 3756 } 3757 if (x == "small") { 3758 y = "240p" 3759 } 3760 if (x == "medium") { 3761 y = "360p" 3762 } 3763 if (x == "large") { 3764 y = "480p" 3765 } 3766 if (x == "hd720") { 3767 y = "720p" 3768 } 3769 if (x == "hd1080") { 3770 y = "1080p" 3771 } 3772 if (v.nameofyoutubequality == 1) { 3773 y = Lang(y) 3774 } 3775 if (x == "auto") { 3776 y = Lang("auto") 3777 } 3778 return y 3779 } 3780 this.YoutubeReady = function() { 3781 YouTubeIframeAPIReady() 3782 } 3783 ; 3784 this.Play = function() { 3785 if (ready) { 3786 player.playVideo() 3787 } else { 3788 Init() 3789 } 3790 } 3791 ; 3792 this.Pause = function() { 3793 if (ready) { 3794 player.pauseVideo() 3795 } 3796 } 3797 ; 3798 this.Toggle = function() { 3799 if (ready) { 3800 Status() == 'played' ? player.pauseVideo() : player.playVideo() 3801 } 3802 } 3803 ; 3804 this.Seek = function(x) { 3805 ready ? player.seekTo(x, true) : '' 3806 } 3807 ; 3808 this.Mute = function() { 3809 ready ? player.mute() : '' 3810 } 3811 ; 3812 this.Unmute = function() { 3813 ready ? player.unMute() : '' 3814 } 3815 ; 3816 this.Volume = function(x) { 3817 ready ? player.setVolume(x * 100) : '' 3818 } 3819 ; 3820 this.isPlaying = function() { 3821 return Status() == 'playing' 3822 } 3823 ; 3824 this.isLive = function() { 3825 return false 3826 } 3827 ; 3828 this.setQuality = function(x) { 3829 if (ready) { 3830 if (exist(o.files_quality[x])) { 3831 var y = o.files_quality[x]; 3832 auto = y == 'auto'; 3833 player.stopVideo(); 3834 player.setPlaybackQuality(y); 3835 player.playVideo() 3836 } 3837 } 3838 } 3839 ; 3840 this.status = function() { 3841 return Status() 3842 } 3843 ; 3844 this.time = function() { 3845 return ready ? player.getCurrentTime() : 0 3846 } 3847 ; 3848 this.duration = function() { 3849 return ready ? player.getDuration() : 0 3850 } 3851 ; 3852 this.loaded = function() { 3853 var x = 0; 3854 if (ready) { 3855 x = player.getVideoLoadedFraction() * player.getDuration() 3856 } 3857 return x 3858 } 3859 ; 3860 this.resize = function() { 3861 Resize() 3862 } 3863 ; 3864 this.errorMessage = function() { 3865 return error 3866 } 3867 ; 3868 this.auto = function() { 3869 return auto 3870 } 3871 ; 3872 this.BeforeVast = function() {} 3873 ; 3874 this.AfterVast = function() {} 3875 ; 3876 this.Remove = function() { 3877 ready ? player.destroy() : ''; 3878 ready = false; 3879 quality_received = false 3880 } 3881 }; 3882 var Controls = function() { 3883 var b = []; 3884 var butNames = []; 3885 var butPosition = []; 3886 var waiting = false; 3887 var toolbarInterval; 3888 var toolbarHidden = false; 3889 var settings; 3890 var playlist; 3891 var bg = new ControlsBg(); 3892 var settings; 3893 var order = []; 3894 for (var y in v) { 3895 if (y.indexOf("control_") == 0) { 3896 order[v[y].order] = y 3897 } 3898 } 3899 for (var i = 1; i < order.length; i++) { 3900 var y = order[i]; 3901 if (y) { 3902 if (o.system.mobile) { 3903 if (v[y].action == "volume" || (v[y].action == "fullscreen" && v.nativemobile)) { 3904 v[y].on = 0 3905 } 3906 } 3907 if (v[y].on == 1) { 3908 var action = v[y].action; 3909 if (action == "line" || action == "volume") { 3910 b[y] = new ControlLine(y,action); 3911 b[y].Resize(b[y].s("w")) 3912 } else { 3913 b[y] = new Control(y) 3914 } 3915 butNames.push(y); 3916 if (b[y].g("action") == "title") { 3917 if (b[y].s("text") == '') { 3918 if (b[y].s("var") != '') { 3919 if (!exist(v[b[y].s("var")])) { 3920 b[y].set("display", false) 3921 } 3922 } else { 3923 b[y].set("display", false) 3924 } 3925 } 3926 } 3927 } 3928 } 3929 } 3930 if (exist(v.settings)) { 3931 settings = new Settings("settings"); 3932 settings.hide() 3933 } 3934 if (exist(v.playlist)) { 3935 playlist = new Settings("playlist"); 3936 if (exist(o.playlist)) { 3937 playlist.updatePlaylist(o.playlist) 3938 } 3939 playlist.hide() 3940 } 3941 Resize(true); 3942 ShowOrHide(); 3943 function ControlX(but) { 3944 var x = 0; 3945 var to_right = false;
3946 if (but) { 3947 if (but.g("action") == 'line') { 3948 x = butPosition.left + but.s("marginleft") + but.g("width") / 2 - but.g("width") / 2; 3949 if (butPosition.rightbs != null) {} else { 3950 butPosition.rightbs = [] 3951 } 3952 } else { 3953 if (butPosition.rightbs != null) { 3954 var but_space = but.g("width") + but.s("marginright") + but.s("marginleft"); 3955 if (but.s("hidden") == 1 && !but.g("show")) { 3956 but_space = 0 3957 } 3958 if (but.s("vertical") > 0) { 3959 but_space = 0 3960 } 3961 x = bg.g("w") - v.toolbar.leftandrightpadding * 1 - but_space + but.g("width") / 2 + but.s("marginleft"); 3962 var i = 0; 3963 butPosition.right -= but_space; 3964 for (i = 0; i < butPosition.rightbs.length; i++) { 3965 var but2 = b[butPosition.rightbs[i]]; 3966 css(but2.c(), { 3967 "left": (but2.g("x") - but_space) 3968 }); 3969 but2.set("x0", but2.g("x")) 3970 } 3971 butPosition.rightbs.push(but.g("key")); 3972 but.set('rightside', 1) 3973 } else { 3974 if (but.s("hidden") == 1 && !but.g("show")) {} else { 3975 if (but.s("vertical") > 0) { 3976 x = butPosition.left + but.s("marginleft") + but.s("marginright") 3977 } else { 3978 butPosition.left += but.g("width") / 2 + but.s("marginleft"); 3979 x = butPosition.left; 3980 butPosition.left += but.g("width") / 2 + but.s("marginright") 3981 } 3982 } 3983 } 3984 } 3985 } 3986 return x 3987 } 3988 function ControlCoordinate(but) { 3989 var width = o.fullscreen && v.toolbar.stretchonfullscreen == 0 ? o.normal_w : o.screen_w; 3990 var height = o.screen_h; 3991 var but_x = 0; 3992 if (but != bg) { 3993 but_x = width / 2 + but.s("marginleft") - but.s("marginright") 3994 } 3995 var but_y = height / 2; 3996 var but_w = but.g("width"); 3997 var but_h = but.g("height"); 3998 var position = but.s("position"); 3999 if (position.indexOf("center") > -1) { 4000 but_x = o.screen_w / 2 + but.s("marginleft") - but.s("marginright") 4001 } 4002 if (position.indexOf("top") > -1) { 4003 but_y = but_h / 2 4004 } 4005 if (position.indexOf("bottom") > -1) { 4006 but_y = o.screen_h - (but == bg ? but_h : but_h / 2) 4007 } 4008 if (position.indexOf("right") > -1) { 4009 but_x = o.screen_w - but_w / 2 + but.s("marginleft") - but.s("marginright") 4010 } 4011 if (position.indexOf("left") > -1) { 4012 but_x = but_w / 2 + but.s("marginleft") - but.s("marginright") 4013 } 4014 if (position == "controls") { 4015 but_x = int(bg.c().offsetLeft) + ControlX(but); 4016 but_y = int(bg.c().offsetTop) + v.toolbar.paddingtop + v.toolbar.h / 2 4017 } 4018 return { 4019 x: but_x, 4020 y: but_y + but.s("margintop") - but.s("marginbottom") 4021 } 4022 } 4023 function Resize(all) { 4024 var w = o.fullscreen && v.toolbar.stretchonfullscreen == 0 ? o.normal_w : o.screen_w; 4025 var h = o.screen_h; 4026 css(bg.c(), { 4027 'top': o.screen_h - v.toolbar.h - v.toolbar.paddingtop 4028 }); 4029 bg.set("y0", (o.screen_h - v.toolbar.h - v.toolbar.paddingtop)); 4030 if (v.toolbar.stretchonfullscreen == 0 && bg) { 4031 css(bg.c(), { 4032 'width': w, 4033 'left': 0, 4034 'margin-left': 0 4035 }); 4036 bg.set("w", w); 4037 if (o.fullscreen) { 4038 css(bg.c(), { 4039 'left': '50%', 4040 'margin-left': -w / 2 4041 }) 4042 } 4043 } 4044 butPosition = { 4045 "left": v.toolbar.leftandrightpadding * 1, 4046 "right": (bg.g("w") - v.toolbar.leftandrightpadding * 1) 4047 }; 4048 var bg_hide = false;
4049 if (!bg.g("show")) { 4050 bg.set("display", true); 4051 bg_hide = true 4052 } 4053 var key; 4054 for (var i = 0; i < butNames.length; i++) { 4055 key = butNames[i]; 4056 if (b[key]) { 4057 b[key].set("scale", b[key].s("scale")); 4058 var cc = ControlCoordinate(b[key]); 4059 if (cc) { 4060 b[key].set("x0", cc.x); 4061 cc.y > 0 ? b[key].set("y0", cc.y) : ''; 4062 if (b[key].s("hidden") == 1 && !b[key].g("show") && !all) {} else { 4063 css(b[key].c(), { 4064 "position": "absolute", 4065 "left": b[key].g("x0"), 4066 "top": b[key].g("y0") 4067 }) 4068 } 4069 } 4070 } 4071 } 4072 if (bg_hide) { 4073 bg.set("display", false) 4074 } 4075 for (key in b) { 4076 if (b[key].g("action") == "line") { 4077 var line_width; 4078 if (b[key].s("position") == "controls") { 4079 line_width = butPosition.right - butPosition.left - b[key].s("marginleft") - b[key].s("marginright"); 4080 css(b[key].c(), { 4081 "left": (int(bg.c().offsetLeft) + butPosition.left + b[key].s("marginleft") + line_width / 2) 4082 }) 4083 } else { 4084 line_width = bg.g("w") - b[key].s("marginleft") - b[key].s("marginright"); 4085 css(b[key].c(), { 4086 "left": (int(bg.c().offsetLeft) + b[key].s("marginleft") + line_width / 2) 4087 }) 4088 } 4089 b[key].set("x0", b[key].g("x")); 4090 b[key].Resize(line_width) 4091 } 4092 } 4093 if (settings) { 4094 ResizeSettings(settings) 4095 } 4096 if (exist(v.playlist)) { 4097 ResizeSettings(playlist) 4098 } 4099 } 4100 function ResizeSettings(x) { 4101 var cc = ControlCoordinate(x); 4102 var top = -2000; 4103 if (x.g("show")) { 4104 var top = cc.y - x.g("height") / 2 - (x.s("position").indexOf("bottom") > -1 ? v.toolbar.h : 0) 4105 } 4106 if (x.s("position").indexOf("right") > -1) { 4107 css(x.c(), { 4108 "position": "absolute", 4109 "right": x.s("marginright"), 4110 "top": top, 4111 'max-height': o.screen_h - v.toolbar.h * 2 - 40 4112 }); 4113 css(x.co(), { 4114 'max-height': o.screen_h - v.toolbar.h * 2 - 40 4115 }) 4116 } else { 4117 css(x.c(), { 4118 'max-height': o.screen_h - v.toolbar.h * 2 - (o.fullscreen ? 140 : 40) 4119 }); 4120 css(x.co(), { 4121 'max-height': o.screen_h - v.toolbar.h * 2 - (o.fullscreen ? 140 : 40) 4122 }); 4123 css(x.c(), { 4124 "position": "absolute", 4125 "left": cc.x - x.g("width") / 2, 4126 "top": top 4127 }) 4128 } 4129 } 4130 ;this.ControlClick = function(key) { 4131 var but = b[key]; 4132 var action = but.g("action"); 4133 if (action) { 4134 if (action && action != "") { 4135 action = action.replace('(referer)', v.referer); 4136 action = action.replace('(link)', v.link); 4137 action = action.replace('(file)', v.file); 4138 action = action.replace('(redirect)', v.redirect); 4139 action = action.replace('(title)', encodeURIComponent(v.title)); 4140 action = action.replace('(time)', o.media.time()); 4141 if (action.indexOf('js:') == 0) { 4142 if (o.fullscreen && but.ss("afterclick", "normalscreen") == 1) {} 4143 var actions = action.substr(3).split(','); 4144 eval(actions[0] + "(" + (actions.length > 1 ? actions[1] : '') + (actions.length > 2 ? "," + actions[2] : '') + (actions.length > 3 ? "," + actions[3] : '') + ")") 4145 } else { 4146 if (action.indexOf('http://') == 0) { 4147 o.actions.Open(action, but.s("target"), but.ss("afterclick", "normalscreen")) 4148 } else { 4149 Action(but) 4150 } 4151 } 4152 if (but.ss("afterclick", "toggle") != "") { 4153 var toggle = but.ss("afterclick", "toggle").split(','); 4154 for (var x = 0; x < toggle.length; x++) { 4155 if (b[toggle[x]]) { 4156 b[toggle[x]].set("show", !b[toggle[x]].g("show")) 4157 } 4158 } 4159 } 4160 if (but.ss("afterclick", "remove") == 1) { 4161 RemoveControl(but); 4162 if (but.ss("afterclick", "removealso") != "") { 4163 var remove = but.ss("afterclick", "removealso").split(','); 4164 for (var x = 0; x < remove.length; x++) { 4165 if (b[remove[x]]) { 4166 RemoveControl(b[remove[x]]) 4167 } 4168 } 4169 } 4170 } 4171 } 4172 } 4173 } 4174 ; 4175 function Action(but) { 4176 if (but.g("action") == "play") { 4177 o.actions.Play() 4178 } else { 4179 if (but.g("action") == "pause") { 4180 o.actions.Pause() 4181 } 4182 if (but.g("action") == "stop") { 4183 o.actions.Stop() 4184 } 4185 } 4186 if (but.g("action") == "back") { 4187 o.actions.Seek(0, false) 4188 } 4189 if (but.g("action") == "fullscreen") { 4190 o.actions.Fullscreen() 4191 } else { 4192 if (but.g("action") == "normalscreen") { 4193 o.actions.Normalscreen() 4194 } 4195 } 4196 if (but.g("action") == "line") { 4197 o.actions.Seek(but.g("click") * o.media.duration(), true) 4198 } 4199 if (but.g("action") == "volume") { 4200 if (StorageSupport()) { 4201 localStorage.setItem("pljsvolume", but.g("click")) 4202 } 4203 o.actions.Volume(but.g("click")) 4204 } 4205 if (but.g("action") == "mute") { 4206 if (StorageSupport()) { 4207 localStorage.setItem("pljsmute", 1) 4208 } 4209 o.actions.Mute() 4210 } else { 4211 if (but.g("action") == "unmute") { 4212 if (StorageSupport()) { 4213 localStorage.removeItem("pljsmute") 4214 } 4215 o.actions.Unmute() 4216 } 4217 } 4218 if (but.g("action").indexOf("time") == 0) { 4219 but.isOn() ? but.Off() : but.On() 4220 } 4221 if (but.g("action") == "rotate") { 4222 o.media.Rotate() 4223 } 4224 if (but.g("action") == "scale+") { 4225 o.media.Scale(0.1) 4226 } 4227 if (but.g("action") == "scale-") { 4228 o.media.Scale(-0.1) 4229 } 4230 if (but.g("action") == "scale") { 4231 o.media.Scale(0) 4232 } 4233 if (but.g("action") == "quality") { 4234 o.actions.Quality(but.s("type") == "select" ? but.isSelected() : (but.isOn() ? 0 : 1)) 4235 } 4236 if (but.g("action") == "lang") { 4237 o.actions.Lang(but.s("type") == "select" ? but.isSelected : (but.isOn ? 0 : 1)) 4238 } 4239 if (but.g("action") == "settings") { 4240 if (settings) { 4241 settings.g("show") ? settings.hide() : settings.show() 4242 } 4243 } 4244 if (but.g("action") == "playlist") { 4245 if (exist(v.playlist)) { 4246 playlist.g("show") ? playlist.hide() : playlist.show() 4247 } 4248 } 4249 for (var i = 0; i < 10; i++) { 4250 if (but.g("action") == "settings#" + i) { 4251 if (settings) { 4252 if (settings.g("show")) { 4253 settings.hide() 4254 } else { 4255 settings.show(); 4256 settings.open(i) 4257 } 4258 } 4259 } 4260 } 4261 } 4262 ;this.title = function(t) { 4263 for (var x in b) { 4264 if (b[x].g("action") == "title") { 4265 if (b[x].s("var") == t) { 4266 if (v[t] != '' || b[x].s("icon") != '') { 4267 b[x].set("display", true) 4268 } else { 4269 b[x].set("display", false) 4270 } 4271 b[x].UpdateText(v[t]) 4272 } 4273 } 4274 } 4275 } 4276 ; 4277 this.resize = function() { 4278 Resize() 4279 } 4280 ; 4281 this.resizeSettings = function() { 4282 ResizeSettings(settings) 4283 } 4284 ; 4285 this.resizePlaylist = function() { 4286 ResizeSettings(playlist) 4287 } 4288 ; 4289 this.Play = function() { 4290 for (var x in b) { 4291 if (b[x].g("action") == "play") { 4292 b[x].On() 4293 } 4294 } 4295 o.play = true; 4296 ShowOrHide() 4297 } 4298 ; 4299 this.Pause = function() { 4300 for (var x in b) { 4301 if (b[x].g("action") == "pause" || b[x].g("action") == "stop") { 4302 b[x].Off() 4303 } 4304 } 4305 o.play = false;
4306 ShowOrHide() 4307 } 4308 ; 4309 this.Mute = function() { 4310 for (var x in b) { 4311 if (b[x].g("action") == "mute") { 4312 b[x].On() 4313 } 4314 this.Volume(0) 4315 } 4316 ShowOrHide() 4317 } 4318 ; 4319 this.Unmute = function() { 4320 for (var x in b) { 4321 if (b[x].g("action") == "unmute") { 4322 b[x].Off() 4323 } 4324 } 4325 this.Volume(v.volume); 4326 ShowOrHide() 4327 } 4328 ; 4329 this.Volume = function(volume) { 4330 for (var x in b) { 4331 if (b[x].g("action") == "volume") { 4332 b[x].UpdatePlay(volume, 1, true) 4333 } 4334 } 4335 ShowOrHide() 4336 } 4337 ; 4338 this.Fullscreen = function() { 4339 for (var x in b) { 4340 if (b[x].g("action") == "fullscreen") { 4341 b[x].On() 4342 } 4343 } 4344 ShowOrHide(); 4345 if (v.toolbar.hidewithoutmoving == 1) { 4346 clearInterval(toolbarInterval); 4347 toolbarInterval = setInterval(HideForce, 3000) 4348 } 4349 } 4350 ; 4351 this.Normalscreen = function() { 4352 for (var x in b) { 4353 if (b[x].g("action") == "normalscreen") { 4354 b[x].Off() 4355 } 4356 } 4357 clearInterval(toolbarInterval); 4358 ShowOrHide() 4359 } 4360 ; 4361 this.onEnded = function() { 4362 for (var x in b) { 4363 if (b[x].g("action") == "play") { 4364 b[x].ReplayIcon() 4365 } 4366 } 4367 } 4368 ; 4369 function ShowOrHide() { 4370 for (var x in b) { 4371 if (b[x].g("action") != "buffer") { 4372 ShowOrHideProcessor(b[x]) 4373 } 4374 } 4375 ShowOrHideProcessor(bg) 4376 } 4377 ;function ShowForce() { 4378 if (toolbarHidden && v.toolbar.hidewithoutmoving == 1) { 4379 for (var x in b) { 4380 if (b[x].g("action") != "buffer") { 4381 ShowOrHideProcessor(b[x], false) 4382 } 4383 } 4384 css(o.frame, { 4385 "cursor": "default" 4386 }); 4387 ShowOrHideProcessor(bg, false); 4388 toolbarHidden = false 4389 } 4390 } 4391 function HideForce() { 4392 if (o.play && v.toolbar.hidewithoutmoving == 1 && !o.mouseDown) { 4393 for (var x in b) { 4394 if (b[x].g("action") != "buffer") { 4395 ShowOrHideProcessor(b[x], true) 4396 } 4397 } 4398 css(o.frame, { 4399 "cursor": "none" 4400 }); 4401 ShowOrHideProcessor(bg, true); 4402 toolbarHidden = true 4403 } 4404 } 4405 function ShowOrHideProcessor(but, forcehide) { 4406 var hide = false;
4407 var show = false; 4408 var toolbar_hide = false; 4409 if (v.toolbar.hide == 1) { 4410 if ((!o.mouseHere && !o.fullscreen) && o.play) { 4411 hide = true; 4412 show = false; 4413 toolbar_hide = true 4414 } else { 4415 hide = false; 4416 show = true 4417 } 4418 if (exist(forcehide)) { 4419 hide = forcehide; 4420 show = !hide 4421 } 4422 } 4423 if (show) { 4424 css(o.frame, { 4425 "cursor": "default" 4426 }) 4427 } 4428 if (but.s("hide") == 1) { 4429 if (but.s("hideonplay") == 1) { 4430 if (o.play) { 4431 hide = true; 4432 show = false 4433 } else { 4434 show = true 4435 } 4436 } 4437 if (but.s("hideonpause") == 1) { 4438 if (!o.play) { 4439 hide = true 4440 } else { 4441 !hide ? show = true : '' 4442 } 4443 } 4444 if (but.s("hideuntilstarted") == 1) { 4445 if (!o.media.started()) { 4446 hide = true; 4447 show = false 4448 } else { 4449 !hide ? show = true : '' 4450 } 4451 } 4452 if (but.s("hideonvod") == 1) { 4453 if (!o.media.isLive()) { 4454 hide = true; 4455 show = false 4456 } else { 4457 !hide ? show = true : '' 4458 } 4459 } 4460 if (but.s("hideonleave") == 1) { 4461 if (!o.mouseHere) { 4462 hide = true; 4463 show = false 4464 } else { 4465 !hide ? show = true : '' 4466 } 4467 } 4468 if (but.s("hideonfullscreen") == 1) { 4469 if (o.fullscreen) { 4470 hide = true; 4471 show = false 4472 } else { 4473 !hide ? show = true : '' 4474 } 4475 } 4476 if (but.s("action") == "volume") { 4477 if (but.s("hideoutmute") == 1) { 4478 hide = true; 4479 show = false; 4480 if (!toolbar_hide && (o.hidden_volume_over || o.hidden_volume_over_process) && !forcehide) { 4481 hide = false;
4482 show = true 4483 } 4484 } 4485 } 4486 } 4487 if (but.g("settings#") && show) { 4488 if (!but.g("set#visible")) { 4489 hide = true; 4490 show = false 4491 } 4492 } 4493 if (but.g("action") == "line" || but.g("action") == "volume") { 4494 if (but.s("expand") > -1) { 4495 if (o.mouseHere) { 4496 but.Expand() 4497 } else { 4498 but.Expand(true) 4499 } 4500 } 4501 } 4502 if (but.g("action") == "title") { 4503 if (but.s("var") != '' || but.s("text") != '') { 4504 if (!exist(v[but.s("var")]) && but.s("text") == '') { 4505 show = false 4506 } 4507 } else { 4508 show = false 4509 } 4510 } 4511 if (settings) { 4512 settings.g("show") ? hide = false : '' 4513 } 4514 if (but.g("action") == "settings") { 4515 if (settings.g("empty")) { 4516 hide = true; 4517 show = false; 4518 but.set("animation", "none") 4519 } 4520 } 4521 if (but.g("action") == "playlist") { 4522 if (playlist.g("empty")) { 4523 hide = true; 4524 show = false; 4525 but.set("animation", "none") 4526 } 4527 if (hide) { 4528 playlist.g("show") ? playlist.hide() : '' 4529 } 4530 } 4531 if (v.nativecontrols == 1) { 4532 if (but.s("position") == "controls" || but.s("position").indexOf("bottom") > -1) { 4533 hide = true; 4534 show = false 4535 } 4536 } 4537 if (hide) { 4538 HideControl(but) 4539 } 4540 if (show) { 4541 ShowControl(but) 4542 } 4543 } 4544 ;function HideControl(but, quick) { 4545 if (but.g("show")) { 4546 if (but.s("animation") == "none" || (but.s("position") == "controls" && quick)) { 4547 but.set("display", false) 4548 } else { 4549 HideAnimate(but) 4550 } 4551 but.set("show", false) 4552 } 4553 } 4554 ;function ShowControl(but) { 4555 if (but.g("action") == "line") { 4556 but.s("sticking") > 0 ? but.set("show", false) : '' 4557 } 4558 if (!but.g("show")) { 4559 if (but.s("animation") == "none") { 4560 but.set("display", true) 4561 } else { 4562 ShowAnimate(but) 4563 } 4564 if (but.s("action") == "volume") { 4565 o.controls.Volume(v.volume) 4566 } 4567 but.set("show", true) 4568 } 4569 } 4570 ;function HideAnimate(but) { 4571 killMotion(but.g("key")); 4572 var m_type = "alpha|"; 4573 var m_to = "0|"; 4574 var hide = 1; 4575 if (but.s("animation") == "scale") { 4576 m_type += "scale|"; 4577 m_to += "0|" 4578 } 4579 if (but.s("animation") == "position") { 4580 if (but.s("position").indexOf("right") > -1) { 4581 m_type += "x|"; 4582 m_to += int(o.screen_w + but.g("width")) + "|" 4583 } 4584 if (but.s("position").indexOf("left") > -1) { 4585 m_type += "x|"; 4586 m_to += int(-but.g("width")) + "|" 4587 } 4588 if (but.s("position").indexOf("top") > -1) { 4589 m_type = "alpha|y|"; 4590 m_to = "0|" + (-but.g("height")) + "|" 4591 } 4592 if (but.s("position").indexOf("bottom") > -1 || but.s("position") == "controls" || but.s("position") == "line") { 4593 m_type = "y|"; 4594 m_to = int(o.screen_h + but.g("height")) + "|"; 4595 if (but.g("action") == "line") { 4596 m_to = int(o.screen_h + but.s("h") + (but.s("h") < 20 ? 20 - but.s("h") : 0)) + "|"; 4597 if (but.s("sticking") > 0) { 4598 m_to = int(o.screen_h + but.s("h") / 2 - but.s("h") * but.s("sticking")) + "|"; 4599 hide = 0 4600 } 4601 } 4602 } 4603 if (but.s("position") == "center") { 4604 m_type += "scale|"; 4605 m_to += "0|" 4606 } 4607 } 4608 var m = new Motion({ 4609 "mc": but, 4610 "me": but.g("key"), 4611 "type": m_type.substr(0, m_type.length - 1), 4612 "to": m_to.substr(0, m_to.length - 1), 4613 "hide": hide 4614 }) 4615 } 4616 ;function ShowAnimate(but) { 4617 killMotion(but.g("key")); 4618 m_type = ""; 4619 m_to = ""; 4620 if (but.g("opacity") != 1) { 4621 m_type = "alpha|"; 4622 m_to = (but.g("key") == 'bg' ? v.toolbar.a : "1") + "|" 4623 } 4624 if (but.s("animation") == "scale") { 4625 if (but.g("scaleX") != but.s("scale")) { 4626 but.set("scale", 0); 4627 m_type += "scale|"; 4628 m_to += but.s("scale") + "|" 4629 } 4630 } 4631 if (but.s("animation") == "position") { 4632 if (but.s("position") == "center") { 4633 if (but.g("scaleX") != but.s("scale")) { 4634 m_type += "scale|"; 4635 m_to += but.s("scale") + "|" 4636 } 4637 } else { 4638 if (but.s("position") == "controls") { 4639 if (but.g("y") != but.g("y0")) { 4640 m_type += "y|"; 4641 m_to += but.g("y0") + "|" 4642 } 4643 } else { 4644 if (but.g("x") != but.g("x0") || but.g("y") != but.g("y0")) { 4645 m_type += "x|y|"; 4646 m_to += but.g("x0") + "|" + but.g("y0") + "|" 4647 } 4648 } 4649 } 4650 }
4651 if (m_type != "" && m_to != "") { 4652 var m = new Motion({ 4653 mc: but, 4654 me: but.g("key"), 4655 type: m_type.substr(0, m_type.length - 1), 4656 to: m_to.substr(0, m_to.length - 1), 4657 show: 1 4658 }) 4659 } else { 4660 but.set("display", true) 4661 } 4662 } 4663 ;this.Mouse = function(key, type, quick) { 4664 var resize = false; 4665 var stop = false; 4666 var but = b[key]; 4667 var action = but.g("action"); 4668 if (type == "over") { 4669 if (o.hidden_volume) { 4670 if (action == "volume" || action == "mute" || action == "unmute") { 4671 o.hidden_volume_over = true; 4672 resize = true; 4673 ShowOrHide() 4674 } 4675 } 4676 } 4677 if (type == "out") { 4678 if (o.hidden_volume) { 4679 if (action == "volume" || action == "mute" || action == "unmute") { 4680 o.hidden_volume_over = false; 4681 o.hidden_volume_over_process = true; 4682 setTimeout(function() { 4683 if (!o.hidden_volume_over) { 4684 o.hidden_volume_over_process = false; 4685 for (var x in b) { 4686 if (b[x].g("action") == "volume") { 4687 HideControl(b[x]); 4688 Resize() 4689 } 4690 } 4691 } 4692 }, 500) 4693 } 4694 } 4695 } 4696 if (resize) { 4697 setTimeout(Resize, 10) 4698 } 4699 } 4700 ; 4701 this.StageLeave = function() { 4702 ShowOrHide() 4703 } 4704 ; 4705 this.StageOver = function() { 4706 ShowOrHide() 4707 } 4708 ; 4709 this.StageMove = function(stage_x, stage_y) { 4710 for (var x in b) { 4711 if (b[x].g("action") == "line" || b[x].g("action") == "volume") { 4712 b[x].StageMove(stage_x, stage_y) 4713 } 4714 } 4715 } 4716 ; 4717 this.StageMove2 = function() { 4718 if (v.toolbar.hide == 1) { 4719 if (!o.mouseHere && o.media.status() == "playing") { 4720 o.mouseHere = true; 4721 ShowOrHide() 4722 } 4723 if (v.toolbar.hidewithoutmoving == 1) { 4724 ShowForce(); 4725 clearInterval(toolbarInterval); 4726 toolbarInterval = setInterval(HideForce, 3000) 4727 } 4728 } 4729 } 4730 ; 4731 this.StageMouseUp = function(stage_x, stage_y) { 4732 for (var x in b) { 4733 if (b[x].g("action") == "line" || b[x].g("action") == "volume") { 4734 b[x].StageMouseUp(stage_x, stage_y) 4735 } 4736 } 4737 } 4738 ; 4739 this.Played = function(time, duration) { 4740 for (var x in b) { 4741 if (b[x].g("action") == "line") { 4742 b[x].UpdatePlay(time, duration) 4743 } 4744 if (b[x].g("action") == "time") { 4745 b[x].UpdateText(Time(b[x].s("inversetime") == "1" ? duration - time : time)) 4746 } 4747 } 4748 } 4749 ; 4750 this.Loaded = function(time, duration) { 4751 for (var x in b) { 4752 if (b[x].g("action") == "line") { 4753 b[x].UpdateLoad(time, duration) 4754 } 4755 } 4756 } 4757 ; 4758 this.Waiting = function(time, duration) { 4759 if (!waiting) { 4760 for (var x in b) { 4761 if (b[x].g("action") == "buffer") { 4762 b[x].Buffer(); 4763 waiting = true 4764 } 4765 } 4766 } 4767 } 4768 ; 4769 this.StopWaiting = function(time, duration) { 4770 if (waiting) { 4771 for (var x in b) { 4772 if (b[x].g("action") == "buffer") { 4773 b[x].BufferStop(); 4774 waiting = false 4775 } 4776 } 4777 } 4778 } 4779 ; 4780 this.Seek = function(time, duration) { 4781 for (var x in b) { 4782 if (b[x].g("action") == "line") { 4783 duration > 0 ? b[x].set("click", time / duration) : ''; 4784 b[x].UpdatePlaySeek() 4785 } 4786 if (b[x].g("action") == "time") { 4787 b[x].UpdateText(Time(b[x].s("inversetime") == "1" ? duration - time : time)) 4788 } 4789 } 4790 } 4791 ; 4792 this.Duration = function(time, duration) { 4793 for (var x in b) { 4794 if (b[x].g("action") == "duration") { 4795 b[x].UpdateText(Time(duration)) 4796 } 4797 if (b[x].g("action") == "time" && b[x].s("inversetime") == "1") { 4798 b[x].UpdateText(Time(duration)) 4799 } 4800 } 4801 } 4802 ; 4803 this.Settings = function() { 4804 settings.g("show") ? settings.hide() : settings.show() 4805 } 4806 ; 4807 this.SettingsVisible = function() { 4808 if (settings) { 4809 return settings.g("show") ? true : false 4810 } else { 4811 return false 4812 } 4813 } 4814 ; 4815 this.Playlist = function() { 4816 playlist.g("show") ? playlist.hide() : playlist.show() 4817 } 4818 ; 4819 this.PlaylistVisible = function() { 4820 if (playlist) { 4821 return playlist.g("show") ? true : false 4822 } else { 4823 return false 4824 } 4825 } 4826 ; 4827 this.UpdatePlaylist = function(x) { 4828 if (playlist) { 4829 playlist.updatePlaylist(x) 4830 } 4831 } 4832 ; 4833 this.ShowSettingsBut = function() {} 4834 ; 4835 this.QualityChanged = function(x) { 4836 if (settings) { 4837 settings.SetQuality(); 4838 settings.g("show") ? settings.hide() : '' 4839 } 4840 } 4841 ; 4842 this.QualityChangedNoHand = function(x) { 4843 if (settings) { 4844 settings.SetQuality() 4845 } 4846 } 4847 ; 4848 this.AudioTrackChanged = function(x) { 4849 if (settings) { 4850 settings.SetAudioTrack(); 4851 settings.g("show") ? settings.hide() : '' 4852 } 4853 } 4854 ; 4855 this.AudioTrackChangedNoHand = function(x) { 4856 if (settings) { 4857 settings.SetAudioTrack() 4858 } 4859 } 4860 ; 4861 this.SettingsN = function(num, display, val) { 4862 for (var x in b) { 4863 if (b[x].g("action") == "settings#" + num) { 4864 b[x].set("set#visible", display); 4865 if (b[x].g("type") == "text") { 4866 b[x].UpdateText(val) 4867 } 4868 ShowOrHideProcessor(b[x]) 4869 } 4870 } 4871 } 4872 ; 4873 function Time(time) { 4874 time < 0 ? time = 0 : ''; 4875 var full_minutes = o.media.duration >= 600 ? true : false;
4876 var full_hours = o.media.duration >= 3600 ? true : false; 4877 var minutes = Math.floor(time / 60); 4878 var seconds = int(time - minutes * 60); 4879 var hours = Math.floor(minutes / 60); 4880 minutes = minutes - hours * 60; 4881 return String((hours > 0 || full_hours ? hours + ':' : '') + ((hours > 0 || full_minutes) && minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds) 4882 } 4883 ;this.resize = function() { 4884 Resize() 4885 } 4886 ; 4887 this.refresh = function() { 4888 ShowOrHide() 4889 } 4890 ; 4891 this.KeyDown = function(event) { 4892 if (pljssglobalid == v.id) { 4893 var x = event.which; 4894 if (x == undefined) { 4895 x = event.keyCode 4896 } 4897 if (x == 57) {} 4898 if (o.fullscreen && x == 27) { 4899 o.actions.Normalscreen() 4900 } 4901 if (exist(o.vast)) { 4902 return false 4903 } 4904 if (v.hotkey.f == 1 && x == 70) { 4905 o.fullscreen ? o.actions.Normalscreen() : o.actions.Fullscreen() 4906 } 4907 if (v.hotkey.r == 1 && x == 82) {} 4908 if (v.hotkey.m == 1 && x == 77) { 4909 o.muted ? o.actions.Unmute() : o.actions.Mute() 4910 } 4911 if (v.hotkey.space == 1 && x == 32) { 4912 o.actions.Toggle(); 4913 event.preventDefault(); 4914 return false 4915 } 4916 if (x == 39) { 4917 if (v.hotkey.leftright == "seek") { 4918 if (o.media.duration() > 0) { 4919 if (o.media.time() + v.hotkey.seek < o.media.duration()) { 4920 o.actions.Seek(o.media.time() + v.hotkey.seek, true) 4921 } 4922 } 4923 } 4924 } 4925 if (x == 37) { 4926 if (v.hotkey.leftright == "seek") { 4927 if (o.media.duration() > 0 && o.media.started()) { 4928 o.actions.Seek((o.media.time() - v.hotkey.seek >= 0 ? o.media.time() - v.hotkey.seek : 0), true) 4929 } 4930 } 4931 } 4932 if (x == 38) { 4933 if (v.hotkey.updown == "volume") { 4934 o.actions.Volume(parseFloat(v.volume) + 0.2); 4935 event.preventDefault() 4936 } 4937 if (v.hotkey.updown == "scale") { 4938 o.media.scale(0.2); 4939 event.preventDefault() 4940 } 4941 } 4942 if (x == 40) { 4943 if (v.hotkey.updown == "volume") { 4944 o.actions.Volume(parseFloat(v.volume) - 0.2); 4945 event.preventDefault() 4946 } 4947 if (v.hotkey.updown == "scale") { 4948 o.media.scale(-0.2); 4949 event.preventDefault() 4950 } 4951 } 4952 } 4953 } 4954 ; 4955 this.Remove = function(event) { 4956 for (var i = 0; i < butNames.length; i++) { 4957 key = butNames[i]; 4958 if (b[key]) { 4959 b[key].Remove() 4960 } 4961 } 4962 bg.Remove() 4963 } 4964 ; 4965 this.ShowForce = function() { 4966 ShowForce() 4967 } 4968 ; 4969 this.HideForce = function() { 4970 HideForce(); 4971 ShowOrHide() 4972 } 4973 ; 4974 this.ToolbarHidden = function() { 4975 return toolbarHidden 4976 } 4977 }; 4978 var Control = function(key) { 4979 var i; 4980 var style = []; 4981 var w; 4982 var h; 4983 var bg; 4984 var bgcontainer; 4985 var visible = true; 4986 var selectOpen = false; 4987 var scaleX = 1; 4988 var scaleY = 1; 4989 var tip; 4990 var tipbg; 4991 var tiptext; 4992 var action; 4993 var x0; 4994 var y0; 4995 var on; 4996 var overInterval; 4997 var bufferInterval; 4998 var bufferDeg = 0; 4999 var rightside = 0; 5000 var settingsNumberVisible = false;
5001 style = UpdateObject(style, default_style.but); 5002 style = UpdateObject(style, v[key]); 5003 var actions = [style.action]; 5004 action = actions[0]; 5005 exist(style.action2) ? actions[1] = style.action2 : ''; 5006 exist(style.title) ? style.text = style.title : ''; 5007 if (style.tiptext == '' && action.indexOf("settings#") == 0) { 5008 style.tiptext = Lang(v.control_settings['settings' + action.substr(9) + 'action']) 5009 } 5010 var tips = style.tiptext.split("/"); 5011 var _currentIcon = 0; 5012 var icons = new Array(); 5013 var icon = new Array(); 5014 var iconsover = new Array(); 5015 var iconspress = new Array(); 5016 var iconreplay = 0; 5017 var replay; 5018 if (style.type == "text") { 5019 if (exist(style.text)) { 5020 icons[0] = trim(style.text); 5021 if (style.text.indexOf("/") == 0) { 5022 style.slashfortime = 1 5023 } 5024 if (style.inversetime == 1 && style.text.indexOf("-") == 0) { 5025 style.minusforback = 1 5026 } 5027 } 5028 } else { 5029 if (exist(style.icon)) { 5030 icons[0] = style.icon; 5031 if (exist(style.icon2)) { 5032 icons[1] = style.icon2 5033 } 5034 if (style.iconsreplay == 1) { 5035 if (exist(style.icon3)) { 5036 icons.push(style.icon3); 5037 iconreplay = icons.length - 1 5038 } 5039 } 5040 if (style.iconsover == 1) { 5041 icons.push(exist(style.iconover) ? style.iconover : icons[0]); 5042 iconsover.push(icons.length - 1); 5043 if (exist(style.icon2)) { 5044 if (exist(style.icon2over)) { 5045 icons.push(style.icon2over); 5046 iconsover.push(icons.length - 1) 5047 } 5048 } 5049 if (style.iconsreplay == 1 && exist(style.icon3)) { 5050 icons.push(exist(style.icon3over) ? style.icon3over : style.icon3); 5051 iconsover.push(icons.length - 1) 5052 } 5053 } 5054 if (style.iconspress == 1) { 5055 icons.push(exist(style.iconpress) ? style.iconpress : icons[0]); 5056 iconspress.push(icons.length - 1); 5057 if (exist(style.icon2)) { 5058 if (exist(style.icon2press)) { 5059 icons.push(style.icon2press); 5060 iconspress.push(icons.length - 1) 5061 } 5062 } 5063 if (style.iconsreplay == 1 && exist(style.icon3)) { 5064 icons.push(exist(style.icon3press) ? style.icon3press : style.icon3); 5065 iconspress.push(icons.length - 1) 5066 } 5067 } 5068 } 5069 } 5070 var control = createElement("div"); 5071 o.frame.appendChild(control); 5072 var bgcontainer = createElement("div"); 5073 control.appendChild(bgcontainer); 5074 css(control, { 5075 "position": "absolute", 5076 "left": 0, 5077 "top": 0, 5078 "opacity": 1 5079 }); 5080 if (icons.length > 0) { 5081 for (i = 0; i < icons.length; i++) { 5082 icon[i] = createElement("div"); 5083 control.appendChild(icon[i]); 5084 css(icon[i], { 5085 "position": "absolute", 5086 "top": 0, 5087 "left": 0, 5088 "pointerEvents": "none", 5089 "opacity": style.a 5090 }); 5091 if (style.type == "text") { 5092 style.tip = 0; 5093 css(icon[i], { 5094 "color": style.color, 5095 "fontFamily": style.font, 5096 "fontSize": style.fontsize, 5097 "letter-spacing": style.letterspacing + 'px', 5098 "padding": "0 3px 0 3px", 5099 "white-space": "nowrap" 5100 });
5101 icons[i] == 'live' ? icons[i] = Lang("live") : ''; 5102 icon[i].innerHTML = (style.inversetime == 1 && style.minusforback == 1 ? "-" : "") + icons[i]; 5103 style.w = icon[i].offsetWidth; 5104 style.h = icon[i].offsetHeight 5105 } 5106 if (style.type == "shape") { 5107 css(icon[i], { 5108 "width": style.w, 5109 "height": style.h, 5110 "borderRadius": style.o, 5111 "background-color": style.color 5112 }) 5113 } 5114 if (style.type == "img") { 5115 style.color = ''; 5116 style.scale = 1; 5117 url = checkBase64(icons[i]); 5118 css(icon[i], { 5119 'width': style.w, 5120 'height': style.h, 5121 'background': 'url(' + url + ') no-repeat 0 0', 5122 'background-size': 'cover' 5123 }) 5124 } 5125 if (style.type == "css") { 5126 var rand = random(100000, 1000000); 5127 icons[i] = icons[i].replace(/\(rand\)/g, rand); 5128 icons[i] = icons[i].replace(/\(color\)/g, style.color); 5129 icons[i] = icons[i].replace(/\(size\)/g, style.size); 5130 var _html = icons[i].substr(0, icons[i].indexOf('|||')); 5131 var _css = icons[i].substr(icons[i].indexOf('|||') + 3); 5132 icon[i].innerHTML = _html; 5133 var style_element = document.createElement('style'); 5134 style_element.type = 'text/css'; 5135 if (style_element.styleSheet) { 5136 style_element.styleSheet.cssText = _css 5137 } else { 5138 style_element.appendChild(document.createTextNode(_css)) 5139 } 5140 o.frame.appendChild(style_element) 5141 } 5142 if (style.type == "svg" && icons[i].toString().indexOf('<g>') > -1) { 5143 css(icon[i], { 5144 "width": 20, 5145 "height": 20 5146 }); 5147 icon[i].innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + icons[i].toString() + "</svg>"; 5148 if (style.iconscolor != -1) { 5149 var x = ["path", "rect", "ellipse"]; 5150 for (var y = 0; y < x.length; y++) { 5151 var z = icon[i].querySelectorAll("svg " + x[y]); 5152 if (z.length > 0) { 5153 for (var y2 = 0; y2 < z.length; y2++) { 5154 z[y2].style.fill = style.iconscolor 5155 } 5156 } 5157 } 5158 } 5159 } 5160 i > 0 ? hide(icon[i]) : ''; 5161 if (style.hide == 1) { 5162 icon[0] 5163 } 5164 } 5165 Background(); 5166 if (style.tip == 1) { 5167 CreateTip() 5168 } 5169 if (style.position.indexOf("right") > -1) { 5170 rightside = 1 5171 } 5172 Resize(); 5173 if (style.rotation != 0) { 5174 css(control, { 5175 "transform": "rotate(" + style.rotation + "deg)" 5176 }) 5177 } 5178 if (action == "buffer" || style.hideuntilstarted == 1) { 5179 style.scale > -1 ? css(control, { 5180 "transform": "scale(" + style.scale + ") rotate(" + style.rotation + "deg)" 5181 }) : ''; 5182 hide(control); 5183 visible = false 5184 } 5185 } 5186 function Background() { 5187 if (bg) { 5188 bg.parentNode.removeChild(bg) 5189 } 5190 bg = createElement("div"); 5191 bgcontainer.appendChild(bg); 5192 css(bg, { 5193 "position": "absolute", 5194 "top": 0, 5195 "left": 0 5196 }); 5197 w = style.w; 5198 h = style.h; 5199 if (style.type == "text" || style.type == "select") { 5200 w = icon[_currentIcon].offsetWidth 5201 } 5202 style = MarginPadding(style, 'margin', 'margin'); 5203 style = MarginPadding(style, 'bgpadding', 'bgpadding'); 5204 style = MarginPadding(style, 'iconmargin', 'iconmargin'); 5205 if (o.system.safari && o.system.desktop) { 5206 style.iconmarginleft /= style.scale; 5207 style.iconmarginright /= style.scale; 5208 style.iconmargintop /= style.scale; 5209 style.iconmarginbottom /= style.scale 5210 } 5211 h = h + style.bgpaddingtop + style.bgpaddingbottom; 5212 w = w + style.bgpaddingleft + style.bgpaddingright; 5213 style.h = h; 5214 style.w = w; 5215 if (style.bg == 1) { 5216 if (style.type == "text" || style.type == "select") { 5217 style.bgh = icon[0].offsetHeight 5218 } 5219 } else {
5220 style.bga = 0 5221 } 5222 css(bg, { 5223 "width": w, 5224 "height": h, 5225 "borderRadius": (style.bgo * h) / 2, 5226 "backgroundColor": style.bgcolor, 5227 "opacity": style.bga 5228 }); 5229 if (action.indexOf("time") == 0 && actions.length == 1) { 5230 style.click = 0 5231 } 5232 if (style.click == 1) { 5233 if (style.hand == 1) { 5234 css(bg, { 5235 "cursor": "pointer" 5236 }) 5237 } 5238 bg.onclick = onClick 5239 } else { 5240 css(bg, { 5241 "cursor": "default" 5242 }); 5243 bg.onclick = CancelBubble 5244 } 5245 if (!o.system.mobile) { 5246 bg.onmouseover = onOver; 5247 bg.onmouseout = onOut 5248 } 5249 bg.onmousedown = onDown; 5250 bg.onmouseup = onUp; 5251 style.selectbgw = bg.offsetWidth; 5252 style.selectbgh = bg.offsetHeight; 5253 if (style.hidden == 1 || style.tip == 1) { 5254 bg.onmousemove = onMove 5255 } 5256 } 5257 function Resize() { 5258 if (selectOpen) { 5259 if (style.selectdown == 1) {} else { 5260 css(bg, { 5261 "top": (-bg.offsetHeight + style.selectbgh / 2) 5262 }) 5263 } 5264 } else { 5265 css(bg, { 5266 "top": (-bg.offsetHeight / 2), 5267 "left": (-bg.offsetWidth / 2) 5268 }) 5269 } 5270 for (i = 0; i < icons.length; i++) { 5271 if (style.type == "select") {} else { 5272 if (style.type == "svg") { 5273 css(icon[i], { 5274 "top": -10, 5275 "left": -10 5276 }) 5277 } else { 5278 css(icon[i], { 5279 "top": -Math.round(icon[i].offsetHeight) / 2, 5280 "left": -icon[i].offsetWidth / 2 5281 }) 5282 } 5283 } 5284 if (bg) { 5285 css(icon[i], { 5286 "top": (int(icon[i].style.top) + style.bgpaddingtop / 2 - style.bgpaddingbottom / 2 + style.iconmargintop / 2 + style.iconmarginbottom / 2), 5287 "left": (int(icon[i].style.left) + style.bgpaddingleft / 2 - style.bgpaddingright / 2 + style.iconmarginleft / 2 + style.iconmarginright / 2) 5288 }) 5289 } 5290 } 5291 } 5292 function onOver() { 5293 var i; 5294 if (style.iconsover == 1) { 5295 if (on) { 5296 i = 1 5297 } else { 5298 i = 0 5299 } 5300 if (replay && iconsover.length > 2) { 5301 i = 2 5302 } 5303 hideAllIcons(); 5304 show(icon[iconsover[i]]) 5305 } 5306 if (style.bgaover != -1 && style.bg == 1) { 5307 var m = new Motion({ 5308 "mc": bg, 5309 "type": "alpha_div", 5310 "to": style.bgaover, 5311 "to": style.bgaover, 5312 "time": 0.1, 5313 "me": (key + "bg") 5314 }) 5315 } 5316 if (style.aover > -1 && !selectOpen) { 5317 for (i = 0; i < icons.length; i++) { 5318 if (icon[i].style.visibility != "hidden") { 5319 var m2 = new Motion({ 5320 "mc": icon[i], 5321 "type": "alpha_div", 5322 "to": style.aover, 5323 "time": 0.1, 5324 "me": (key + "icon" + i) 5325 }) 5326 } 5327 } 5328 } 5329 if (style.scaleover > -1 && !selectOpen) { 5330 scale(style.scaleover) 5331 } 5332 if (action == "settings" && o.controls.SettingsVisible()) {} else { 5333 if (style.tip == 1) { 5334 show(tip); 5335 css(tip, { 5336 "opacity": 1 5337 }) 5338 } 5339 } 5340 o.controls.Mouse(key, "over") 5341 } 5342 function onOut() { 5343 onUp(); 5344 var i; 5345 if (style.iconsover == 1) { 5346 if (on) { 5347 i = 1 5348 } else { 5349 i = 0 5350 } 5351 if (replay && iconsover.length > 2) { 5352 i = 2 5353 } 5354 hideAllIcons(); 5355 show(icon[i]) 5356 } 5357 if (style.bgaover != -1 && style.bg == 1 && !selectOpen) { 5358 var m = new Motion({ 5359 "mc": bg, 5360 "type": "alpha_div", 5361 "to": style.bga, 5362 "time": 0.5, 5363 "ease": "back", 5364 "me": (key + "bg") 5365 }) 5366 } 5367 if (style.aover > -1 && !selectOpen) { 5368 for (i = 0; i < icons.length; i++) { 5369 if (icon[i].style.visibility != "hidden") { 5370 var m2 = new Motion({ 5371 "mc": icon[i], 5372 "type": "alpha_div", 5373 "to": style.a, 5374 "time": 0.5, 5375 "ease": "back", 5376 "me": (key + "icon" + i) 5377 }) 5378 } 5379 } 5380 } 5381 if (style.scaleover > -1 && !selectOpen) { 5382 scale(style.scale) 5383 } 5384 if (style.tip == 1) { 5385 hide(tip); 5386 css(tip, { 5387 "opacity": 0 5388 }) 5389 } 5390 o.controls.Mouse(key, "out") 5391 } 5392 function OverFalse() { 5393 over = false;
5394 clearInterval(overInterval); 5395 o.controls.OverFalse(key) 5396 } 5397 function onClick(event) { 5398 event.cancelBubble = true; 5399 o.controls.ControlClick(key); 5400 if (style.tip == 1) { 5401 hide(tip); 5402 css(tip, { 5403 "opacity": 0 5404 }) 5405 } 5406 } 5407 function onDown() { 5408 var i; 5409 if (style.iconspress == 1) { 5410 if (on) { 5411 i = 1 5412 } else { 5413 i = 0 5414 } 5415 if (replay && iconspress.length > 2) { 5416 i = 2 5417 } 5418 hideAllIcons(); 5419 show(icon[iconspress[i]]); 5420 if (style.aover > -1) { 5421 css(icon[iconspress[i]], { 5422 "opacity": style.aover 5423 }) 5424 } 5425 } 5426 } 5427 function onUp() { 5428 if (style.iconspress == 1) { 5429 if (on) { 5430 i = 1 5431 } else { 5432 i = 0 5433 } 5434 if (replay && icon.length > 2) { 5435 i = 2 5436 } 5437 hideAllIcons(); 5438 show(icon[i]) 5439 } 5440 } 5441 function ReplayIcon(event) { 5442 event.cancelBubble = true; 5443 o.controls.ControlClick(key) 5444 } 5445 function hideAllIcons() { 5446 for (var i = 0; i < icons.length; i++) { 5447 if (icon[i].style.visibility != "hidden") { 5448 css(icon[i], { 5449 "opacity": style.a 5450 }); 5451 hide(icon[i]) 5452 } 5453 } 5454 } 5455 function CancelBubble(event) { 5456 event.cancelBubble = true 5457 } 5458 function onMove() { 5459 Tip() 5460 } 5461 function scale(x) { 5462 if (x > 0) { 5463 if (o.system.safari && o.system.desktop) { 5464 css(bg, { 5465 "zoom": "" + x + "" 5466 }) 5467 } else { 5468 css(bg, { 5469 "transform": "scale(" + x + ")" 5470 }) 5471 } 5472 for (i = 0; i < icons.length; i++) { 5473 if (o.system.safari && o.system.desktop) { 5474 css(icon[i], { 5475 "zoom": "" + x + "" 5476 }) 5477 } else { 5478 css(icon[i], { 5479 "transform": "scale(" + x + ")", 5480 "transition": "transform 0.1s linear" 5481 }) 5482 } 5483 } 5484 scaleX = x; 5485 scaleY = x 5486 } 5487 } 5488 function CreateTip() { 5489 tip = createElement("div"); 5490 control.appendChild(tip); 5491 css(tip, { 5492 'position': 'absolute', 5493 'left': 0, 5494 'top': 0, 5495 'height': 'auto', 5496 'overflow': 'hidden', 5497 "pointer-events": "none", 5498 "opacity": 0, 5499 "transition": "opacity 0.1s linear" 5500 }); 5501 tipbg = createElement("div"); 5502 tip.appendChild(tipbg); 5503 style = MarginPadding(style, 'tippadding', 'tippadding'); 5504 css(tipbg, { 5505 'position': 'absolute', 5506 'left': 0, 5507 'top': 0, 5508 'width': '100%', 5509 'height': 30, 5510 'background-color': style.tipbgcolor, 5511 'opacity': style.tipbga, 5512 'border-radius': style.tipbgrounding 5513 }); 5514 tiptext = createElement("div"); 5515 tip.appendChild(tiptext); 5516 css(tiptext, { 5517 'position': 'absolute', 5518 'left': style.tippaddingright, 5519 'top': style.tippaddingtop, 5520 'color': style.tipcolor, 5521 'font-family': style.tipfont, 5522 'font-size': style.tipfontsize, 5523 'opacity': style.tipa, 5524 "line-height": "1", 5525 'white-space': 'nowrap' 5526 }); 5527 tiptext.innerHTML = style.tiptext == '' ? Lang(action) : tips[0]; 5528 Tip() 5529 } 5530 function Tip() { 5531 if (style.tip == 1) { 5532 topBg = findTop(bg); 5533 leftBg = findLeft(bg); 5534 css(tip, { 5535 "top": (-h - tip.offsetHeight + 3), 5536 "left": (rightside == 1 ? -tiptext.offsetWidth : -w / 2), 5537 "height": style.tippaddingtop + style.tipfontsize + style.tippaddingbottom, 5538 "width": style.tippaddingleft + tiptext.offsetWidth + style.tippaddingright, 5539 }); 5540 css(tipbg, { 5541 'height': tip.offsetHeight 5542 }); 5543 tip.style.zIndex = "1000" 5544 } 5545 } 5546 this.c = function() { 5547 return control 5548 } 5549 ; 5550 this.s = function(x) { 5551 return style[x] 5552 } 5553 ; 5554 this.ss = function(x, x2) { 5555 return exist(style[x]) ? style[x][x2] : false 5556 } 5557 ; 5558 this.g = function(x) { 5559 switch (x) { 5560 case "width": 5561 return w; 5562 break; 5563 case "height": 5564 return h; 5565 break; 5566 case "x": 5567 return int(control.style.left); 5568 break; 5569 case "y": 5570 return int(control.style.top); 5571 break; 5572 case "opacity": 5573 return control.style.opacity; 5574 break; 5575 case "show": 5576 return visible; 5577 break; 5578 case "scaleX": 5579 return scaleX; 5580 break; 5581 case "scaleY": 5582 return scaleY; 5583 break; 5584 case "action": 5585 return action; 5586 break; 5587 case "type": 5588 return style.type; 5589 break; 5590 case "key": 5591 return key; 5592 break; 5593 case "x0": 5594 return x0; 5595 break; 5596 case "y0": 5597 return y0; 5598 break; 5599 case "over": 5600 return over; 5601 break; 5602 case "settings#": 5603 return action.indexOf("settings#") == 0; 5604 break; 5605 case "set#visible": 5606 return settingsNumberVisible; 5607 break; 5608 default: 5609 return false 5610 } 5611 } 5612 ; 5613 this.set = function(key, x) { 5614 switch (key) { 5615 case "show": 5616 visible = x; 5617 break; 5618 case "display": 5619 css(control, { 5620 "display": (x ? "block" : "none") 5621 }); 5622 visible = x; 5623 break; 5624 case "scale": 5625 scale(x); 5626 break; 5627 case "scaleX": 5628 css(control, { 5629 "transform": "scaleX(" + x + ")" 5630 }); 5631 scaleX = x; 5632 break; 5633 case "scaleY": 5634 css(control, { 5635 "transform": "scaleY(" + x + ")" 5636 }); 5637 scaleY = x; 5638 break; 5639 case "opacity": 5640 css(control, { 5641 "opacity": x 5642 }); 5643 break;
5644 case "left": 5645 css(control, { 5646 "left": x 5647 }); 5648 break; 5649 case "top": 5650 css(control, { 5651 "top": x 5652 }); 5653 break; 5654 case "width": 5655 css(control, { 5656 "width": x 5657 }); 5658 break; 5659 case "height": 5660 css(control, { 5661 "height": x 5662 }); 5663 break; 5664 case "over_final": 5665 style.over_final = x; 5666 break; 5667 case "rightside": 5668 rightside = x; 5669 break; 5670 case "set#visible": 5671 settingsNumberVisible = x; 5672 break; 5673 case "x": 5674 css(control, { 5675 "left": x 5676 }); 5677 break; 5678 case "y": 5679 css(control, { 5680 "top": x 5681 }); 5682 break; 5683 case "animation": 5684 style.animation = x; 5685 break; 5686 case "x0": 5687 x0 = x; 5688 break; 5689 case "y0": 5690 y0 = x; 5691 break; 5692 default: 5693 return false 5694 } 5695 } 5696 ; 5697 this.UpdateText = function(text) { 5698 if (style.type == "text" || style.type == "select") { 5699 text = (style.slashfortime == 1 ? '/ ' : '') + (style.inversetime == 1 && style.minusforback == 1 ? '-' : '') + text; 5700 var prevorius_default_w = icon[0].offsetWidth + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0); 5701 var prevorius_default_h = icon[0].offsetHeight + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0); 5702 icon[0].innerHTML = text; 5703 style.w = icon[0].offsetWidth + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0); 5704 icon[0].offsetWidth; 5705 style.h = icon[0].offsetHeight + (style.bg == 1 ? style.bgpaddingtop + style.bgpaddingbottom : 0); 5706 if (prevorius_default_w != style.w || prevorius_default_h != style.h) { 5707 if (style.type != "select") { 5708 style.w = icon[0].offsetWidth; 5709 style.h = icon[0].offsetHeight 5710 } 5711 Background(); 5712 Resize(); 5713 o.controls.resize() 5714 } 5715 } 5716 } 5717 ; 5718 this.On = function() { 5719 if (!on) { 5720 if (icons) { 5721 if (icons.length > 1) { 5722 hide(icon[0]); 5723 if (icons.length > 2) { 5724 hide(icon[2]) 5725 } 5726 show(icon[1]) 5727 } 5728 } 5729 if (actions.length > 1) { 5730 action = actions[1]; 5731 if (style.tip == 1) { 5732 tiptext.innerHTML = style.tiptext == '' ? Lang(actions[1]) : (tips.length > 0 ? tips[1] : tips[0]); 5733 Tip() 5734 } 5735 } 5736 on = true; 5737 replay = false 5738 } 5739 } 5740 ; 5741 this.Off = function() { 5742 if (on) { 5743 if (icons) { 5744 if (icons.length > 1) { 5745 show(icon[0]); 5746 hide(icon[1]) 5747 } 5748 } 5749 action = actions[0]; 5750 if (actions.length > 1) { 5751 if (style.tip == 1) { 5752 tiptext.innerHTML = style.tiptext == '' ? Lang(actions[0]) : tips[0]; 5753 Tip() 5754 } 5755 } 5756 on = false;
5757 replay = false 5758 } 5759 } 5760 ; 5761 this.ReplayIcon = function() { 5762 if (style.iconsreplay == 1) { 5763 hideAllIcons(); 5764 show(icon[iconreplay]); 5765 replay = true 5766 } 5767 } 5768 ; 5769 this.Buffer = function() { 5770 show(control); 5771 visible = true 5772 } 5773 ; 5774 this.BufferStop = function() { 5775 hide(control); 5776 visible = false 5777 } 5778 ; 5779 this.Remove = function() { 5780 if (icons.length > 0) { 5781 for (i = 0; i < icons.length; i++) { 5782 control.removeChild(icon[i]); 5783 delete icon[i] 5784 } 5785 } 5786 if (bg) { 5787 bg.removeAttribute("onclick"); 5788 bg.removeAttribute("onmouseover"); 5789 bg.removeAttribute("onmouseout"); 5790 bg.parentNode.removeChild(bg); 5791 delete bg 5792 } 5793 o.frame.removeChild(control); 5794 delete control 5795 } 5796 }; 5797 var ControlLine = function(key, action) { 5798 var i; 5799 var style = []; 5800 var w; 5801 var h; 5802 var bg; 5803 var visible = true; 5804 var x0; 5805 var y0; 5806 var scaleX = 1; 5807 var scaleY = 1; 5808 var topBg = 0; 5809 var leftBg = 0; 5810 var alphas; 5811 var mouseDown; 5812 var mouseUp; 5813 var click; 5814 var handle; 5815 var _duration_load; 5816 var _duration_play; 5817 var _time_load; 5818 var _time_play; 5819 var tip; 5820 var tipbg; 5821 var tiptext; 5822 var over; 5823 for (i in default_style.but) { 5824 style[i] = default_style.but[i] 5825 } 5826 var action = v[key].action; 5827 var type = v[key].type; 5828 for (i in default_style[action]) { 5829 style[i] = default_style[action][i] 5830 } 5831 for (i in v[key]) { 5832 style[i] = v[key][i] 5833 } 5834 style.w = parseInt(style.w); 5835 style.h = parseInt(style.h); 5836 style = MarginPadding(style, 'margin', 'margin'); 5837 var control = createElement("div"); 5838 o.frame.appendChild(control); 5839 css(control, { 5840 "position": "absolute", 5841 "top": 0, 5842 "left": 0, 5843 "opacity": 1 5844 }); 5845 Background(); 5846 if (style.tip == 1) { 5847 CreateTip() 5848 } 5849 var strips = String(style.strips).split("|"); 5850 if (strips.length < 1) { 5851 strips[1] = 0 5852 } 5853 if (strips.length < 2) { 5854 strips[2] = 0 5855 } 5856 var line0 = createElement("div"); 5857 css(line0, { 5858 "position": "absolute", 5859 "top": Math.round(-style.h / 2), 5860 "left": Math.round(-style.w / 2), 5861 "width": style.w, 5862 "height": style.h, 5863 "background-color": style.colorbg, 5864 "border-radius": (strips[0] == 1 ? 0 : style.rounding * style.h / 2), 5865 "opacity": style.abg, 5866 "pointer-events": "none" 5867 }); 5868 control.appendChild(line0); 5869 var line1 = createElement("div"); 5870 css(line1, { 5871 "position": "absolute", 5872 "top": Math.round(-style.h / 2), 5873 "left": Math.round(-style.w / 2), 5874 "width": style.w, 5875 "height": style.h, 5876 "background-color": style.colorload, 5877 "border-radius": (strips[1] == 1 ? 0 : style.rounding * style.h / 2), 5878 "opacity": style.aload, 5879 "width": 0, 5880 "pointer-events": "none", 5881 "transition": "width " + style.linespeed1 + "s linear" 5882 }); 5883 control.appendChild(line1); 5884 if (style.bufferline == 1) { 5885 var line_buffer = createElement("div"); 5886 control.appendChild(line_buffer); 5887 hide(line_buffer) 5888 } 5889 if (style.aover > 0) { 5890 var line2 = createElement("div"); 5891 css(line2, { 5892 "position": "absolute", 5893 "top": Math.round(-style.h / 2), 5894 "left": Math.round(-style.w / 2), 5895 "width": style.w, 5896 "height": style.h, 5897 "background-color": style.colorover, 5898 "border-radius": (strips[2] == 1 ? 0 : style.rounding * style.h / 2), 5899 "opacity": style.aover, 5900 "width": 0, 5901 "pointer-events": "none", 5902 "transition": "width " + style.linespeed2 + "s linear" 5903 }); 5904 control.appendChild(line2) 5905 } 5906 var line3 = createElement("div");
5907 css(line3, { 5908 "position": "absolute", 5909 "top": Math.round(-style.h / 2), 5910 "left": Math.round(-style.w / 2), 5911 "width": 0, 5912 "height": style.h, 5913 "background-color": style.color, 5914 "border-radius": (strips[2] == 1 ? 0 : style.rounding * style.h / 2), 5915 "opacity": style.a, 5916 "width": 0, 5917 "pointer-events": "none", 5918 "transition": "width " + style.linespeed3 + "s linear" 5919 }); 5920 control.appendChild(line3); 5921 if (style.handle == 1 && style.handleicon.toString().indexOf('<g>') > -1) { 5922 handle = createElement("div"); 5923 handle.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleicon.toString() + "</svg>"; 5924 control.appendChild(handle); 5925 style = MarginPadding(style, 'handlemargin', 'handlemargin'); 5926 css(handle, { 5927 "position": "absolute", 5928 "top": -10 + style.handlemargintop - style.handlemarginbottom, 5929 "left": -1000, 5930 "pointer-events": "none", 5931 "height": 20, 5932 "width": 20, 5933 "opacity": style.handlea 5934 }); 5935 if (style.handlehide == 1) { 5936 css(handle, { 5937 "transform": "scale(0)" 5938 }) 5939 } else { 5940 if (style.handlescale != 1) { 5941 css(handle, { 5942 "transform": "scale(" + style.handlescale + ")" 5943 }) 5944 } 5945 } 5946 if (style.handlecolor != -1) { 5947 var x = ["path", "rect", "ellipse"]; 5948 for (var y = 0; y < x.length; y++) { 5949 var z = handle.querySelectorAll("svg " + x[y]); 5950 if (z.length > 0) { 5951 for (var y2 = 0; y2 < z.length; y2++) { 5952 z[y2].style.fill = style.handlecolor 5953 } 5954 } 5955 } 5956 } 5957 } 5958 if (style.rotation != 0) { 5959 css(control, { 5960 "transform": "rotate(" + style.rotation + "deg)" 5961 }) 5962 } 5963 if (style.hidden == 1) { 5964 hide(control); 5965 visible = false 5966 } 5967 if (action == "volume") { 5968 if (style.hideoutmute == 1) { 5969 o.hidden_volume = true; 5970 style.hidden = true 5971 } else { 5972 o.hidden_volume = false 5973 } 5974 } 5975 style.vertical = 0; 5976 if (style.rotation != 0) { 5977 style.rotation2 = Math.abs(style.rotation); 5978 if (style.rotation2 > 45 && style.rotation2 < 135) { 5979 style.vertical = 90 5980 } 5981 if (style.rotation2 > 225 && style.rotation2 < 315) { 5982 style.vertical = 270 5983 } 5984 } 5985 function Background() { 5986 bg = createElement("div"); 5987 control.appendChild(bg); 5988 style = MarginPadding(style, 'bgpadding', 'bgpadding'); 5989 var bgh = style.h + style.bgpaddingtop + style.bgpaddingbottom; 5990 var bgw = style.w + style.bgpaddingleft + style.bgpaddingright; 5991 if (style.bg == 1) {} else { 5992 style.bga = 0 5993 } 5994 css(bg, { 5995 "position": "absolute", 5996 "top": 0, 5997 "left": 0, 5998 "width": bgw, 5999 "height": bgh, 6000 "borderRadius": (style.bgo * bgh) / 2, 6001 "backgroundColor": style.bgcolor, 6002 "opacity": style.bga 6003 }); 6004 if (style.expand > 0) { 6005 css(bg, { 6006 "top": -0.5 6007 }) 6008 } else { 6009 css(bg, { 6010 "top": -style.h / 2 - style.bgpaddingtop 6011 }) 6012 } 6013 if (style.click == 1) { 6014 if (style.hand == 1) { 6015 css(bg, {
6016 "cursor": "pointer" 6017 }) 6018 } 6019 bg.onclick = onClick; 6020 bg.onmouseup = onUp; 6021 bg.onmousedown = onDown; 6022 bg.onmousemove = onMove 6023 } else { 6024 css(bg, { 6025 "cursor": "default" 6026 }) 6027 } 6028 if (!o.system.mobile) { 6029 bg.onmouseover = onOver; 6030 bg.onmousemove = onMove; 6031 bg.onmouseout = onOut 6032 } 6033 css(bg, { 6034 "left": -style.w / 2 - style.bgpaddingleft 6035 }) 6036 } 6037 function Resize(width) { 6038 if (width != w) { 6039 w = width; 6040 var delta = w / line0.offsetWidth; 6041 css(bg, { 6042 "width": (w + style.bgpaddingleft + style.bgpaddingright), 6043 "left": -w / 2 - style.bgpaddingleft, 6044 }); 6045 css(line0, { 6046 "width": w, 6047 "left": -w / 2, 6048 }); 6049 killMotion("line_load"); 6050 killMotion("line_play"); 6051 css(line1, { 6052 "width": (line1.offsetWidth * delta), 6053 "left": -w / 2, 6054 }); 6055 if (line2) { 6056 css(line2, { 6057 "left": -w / 2, 6058 }) 6059 } 6060 css(line3, { 6061 "width": (line3.offsetWidth * delta), 6062 "left": -w / 2, 6063 }); 6064 if (line_buffer) { 6065 if (!hidden(line_buffer)) { 6066 Buffering() 6067 } 6068 } 6069 if (style.handle == 1) { 6070 css(handle, { 6071 "left": line3.offsetWidth * delta - w / 2 - handle.offsetWidth / 2 + style.handlemarginleft - style.handlemarginright 6072 }) 6073 } 6074 } 6075 } 6076 function onOver(event) { 6077 o.controls.Mouse(key, "over"); 6078 if (style.bgaover != -1 && style.bg == 1) { 6079 var m = new Motion({ 6080 "mc": bg, 6081 "type": "alpha_div", 6082 "to": style.bgaover, 6083 "time": 0.1, 6084 "me": (key + "bg") 6085 }) 6086 } 6087 if (style.handle == 1) { 6088 if (style.handleiconsover == 1 && exist(style.handleiconover)) { 6089 if (style.handleiconspress == 1 && mouseDown) {} else { 6090 handle.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleiconover.toString() + "</svg>" 6091 } 6092 } 6093 if (style.handlehide == 1) { 6094 css(handle, { 6095 "transform": "scale(" + style.handlescale + ")", 6096 "transition": "all " + style.slidespeed + "s linear" 6097 }) 6098 } else { 6099 if (style.handleaover != -1) { 6100 var m2 = new Motion({ 6101 "mc": handle, 6102 "type": "alpha_div", 6103 "to": style.handleaover, 6104 "time": 0.1, 6105 "me": (key + "handle") 6106 }) 6107 } 6108 } 6109 } 6110 if (style.tip == 1) { 6111 show(tip); 6112 css(tip, { 6113 "opacity": 1 6114 }) 6115 } 6116 } 6117 function onOut() { 6118 if (!mouseUp) { 6119 if (style.aover > 0) { 6120 css(line2, { 6121 "width": 0 6122 }) 6123 } 6124 if (style.bgaover != -1 && style.bg == 1) { 6125 var m = new Motion({ 6126 "mc": bg, 6127 "type": "alpha_div", 6128 "to": style.bga, 6129 "time": 0.1, 6130 "me": (key + "bg") 6131 }) 6132 } 6133 if (style.handle == 1) { 6134 if (style.handleiconsover == 1 && exist(style.handleiconover)) { 6135 if (style.handleiconspress == 1 && mouseDown) {} else { 6136 handle.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleicon.toString() + "</svg>" 6137 } 6138 } 6139 if (style.handlehide == 1) { 6140 css(handle, { 6141 "transform": "scale(0)", 6142 "transition": "all " + style.slidespeed + "s linear" 6143 }) 6144 } else { 6145 if (style.handleaover != -1) { 6146 var m2 = new Motion({ 6147 "mc": handle, 6148 "type": "alpha_div", 6149 "to": style.handlea, 6150 "time": 0.1, 6151 "me": (key + "handle") 6152 }) 6153 } 6154 } 6155 } 6156 o.controls.Mouse(key, "out") 6157 } 6158 if (style.tip == 1) { 6159 hide(tip); 6160 css(tip, { 6161 "opacity": 0 6162 }) 6163 } 6164 } 6165 function onClick(event) { 6166 event.cancelBubble = true 6167 } 6168 function CancelBubble(event) { 6169 event.cancelBubble = true 6170 } 6171 function onUp(event) { 6172 if (action == "volume") { 6173 if (o.hidden_volume_over) { 6174 mouseUp = true; 6175 setTimeout(function() { 6176 mouseUp = false 6177 }, 100) 6178 } 6179 } 6180 EndMove(); 6181 o.mouseDown = false;
6182 if (style.handle == 1) { 6183 if (style.handleiconspress == 1 && exist(style.handleiconpress)) { 6184 handle.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleicon.toString() + "</svg>" 6185 } 6186 } 6187 CalculateClick(event.clientX, event.clientY); 6188 o.controls.ControlClick(key); 6189 o.controls.StageMouseUp(event.clientX, event.clientY); 6190 event.cancelBubble = true 6191 } 6192 function onDown(event) { 6193 mouseDown = true; 6194 if (style.handle == 1) { 6195 if (style.handleiconspress == 1 && exist(style.handleiconpress)) { 6196 handle.innerHTML = "<svg width='20' height='20' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg'>" + style.handleiconpress.toString() + "</svg>" 6197 } 6198 } 6199 topBg = findTop(bg); 6200 leftBg = findLeft(bg); 6201 CalculateClick(event.clientX, event.clientY); 6202 UpdatePlay(click, 1, "no") 6203 } 6204 function CalculateClick(event_x, event_y) { 6205 var x; 6206 if (style.vertical > 0) { 6207 x = event_y - topBg + w / 2 - style.bgpaddingright; 6208 click = x / w; 6209 if (style.vertical == 270) { 6210 x = event_y - topBg + w / 2 - style.bgpaddingleft; 6211 click = x / w; 6212 click = (click - 1) * -1 6213 } 6214 } else { 6215 x = event_x - leftBg - style.bgpaddingleft; 6216 click = x / w; 6217 if (style.rotation > 134 && style.rotation < 235) { 6218 x = event_x - leftBg - style.bgpaddingright; 6219 click = x / w; 6220 click = (click - 1) * -1 6221 } 6222 } 6223 } 6224 function EndMove() { 6225 mouseDown = false; 6226 onOut() 6227 } 6228 function onMove(event) { 6229 if (style.aover > 0) { 6230 if (o.media.started() || action != 'line') { 6231 css(line2, { 6232 "width": event.clientX - leftBg 6233 }) 6234 } 6235 } 6236 if (style.tip == 1 && (o.media.duration() > 0 || action == "volume")) { 6237 if (style.tip == 1) { 6238 !isVisible(tip) ? show(tip) : '' 6239 } 6240 topBg = findTop(bg); 6241 leftBg = findLeft(bg); 6242 CalculateClick(event.clientX, event.clientY); 6243 if (action == "line") { 6244 tiptext.innerHTML = timeFormat(click * o.media.duration()) 6245 } 6246 if (action == "volume") { 6247 tiptext.innerHTML = Math.round(click * 100) 6248 } 6249 css(tip, { 6250 "top": (-tiptext.offsetHeight * 2 - 5), 6251 "left": (-w / 2 + (event.clientX - leftBg) - tip.offsetWidth / 2), 6252 "height": style.tippaddingtop + style.tipfontsize + style.tippaddingbottom, 6253 "width": style.tippaddingleft + tiptext.offsetWidth + style.tippaddingright, 6254 }); 6255 css(tipbg, { 6256 'height': tip.offsetHeight 6257 }); 6258 tip.style.zIndex = "1000" 6259 } 6260 } 6261 this.c = function() { 6262 return control 6263 } 6264 ; 6265 this.s = function(key) { 6266 return style[key] 6267 } 6268 ; 6269 this.ss = function(x, x2) { 6270 return style[x][x2] 6271 } 6272 ; 6273 this.g = function(x) { 6274 switch (x) { 6275 case "width": 6276 return w; 6277 break; 6278 case "offsetwidth": 6279 return line0.offsetWidth; 6280 break; 6281 case "height": 6282 return style.h; 6283 break; 6284 case "x": 6285 return int(control.style.left); 6286 break; 6287 case "y": 6288 return int(control.style.top); 6289 break; 6290 case "opacity": 6291 return control.style.roundingpacity; 6292 break; 6293 case "show": 6294 return visible; 6295 break; 6296 case "scaleX": 6297 return scaleX; 6298 break; 6299 case "scaleY": 6300 return scaleY; 6301 break; 6302 case "action": 6303 return action; 6304 break; 6305 case "key": 6306 return key; 6307 break; 6308 case "x0": 6309 return x0; 6310 break; 6311 case "y0": 6312 return y0; 6313 break; 6314 case "click": 6315 return click; 6316 break; 6317 default: 6318 return false 6319 } 6320 } 6321 ; 6322 this.set = function(key, x) { 6323 switch (key) { 6324 case "show": 6325 visible = x; 6326 break; 6327 case "mouseDown": 6328 mouseDown = x; 6329 break; 6330 case "display": 6331 css(control, { 6332 "display": (x ? "block" : "none") 6333 }); 6334 visible = x; 6335 break; 6336 case "scaleX": 6337 css(control, { 6338 "transform": "scaleX(" + x + ")" 6339 }); 6340 scaleX = x; 6341 break; 6342 case "scaleY": 6343 css(control, { 6344 "transform": "scaleY(" + x + ")" 6345 }); 6346 scaleY = x; 6347 break; 6348 case "opacity": 6349 css(control, { 6350 "opacity": x 6351 }); 6352 break;
6353 case "left": 6354 css(control, { 6355 "left": x 6356 }); 6357 break; 6358 case "top": 6359 css(control, { 6360 "top": x 6361 }); 6362 break; 6363 case "click": 6364 click = x; 6365 break; 6366 case "width": 6367 css(control, { 6368 "width": x 6369 }); 6370 break; 6371 case "height": 6372 css(control, { 6373 "height": x 6374 }); 6375 break; 6376 case "over_final": 6377 style.roundingver_final = x; 6378 break; 6379 case "x": 6380 css(control, { 6381 "left": x 6382 }); 6383 break; 6384 case "y": 6385 css(control, { 6386 "top": x 6387 }); 6388 break; 6389 case "x0": 6390 x0 = x; 6391 break; 6392 case "y0": 6393 y0 = x; 6394 break 6395 } 6396 } 6397 ; 6398 this.Resize = function(x) { 6399 Resize(x) 6400 } 6401 ; 6402 this.StageLeave = function(x) {} 6403 ; 6404 this.StageMove = function(stage_x, stage_y) { 6405 if (mouseDown) { 6406 if (action == "volume") { 6407 CalculateClick(stage_x, stage_y); 6408 o.controls.ControlClick(key); 6409 o.hidden_volume_over = true 6410 } 6411 CalculateClick(stage_x, stage_y); 6412 UpdatePlay(click, 1, "no") 6413 } 6414 } 6415 ; 6416 this.StageMouseUp = function(stage_x, stage_y) { 6417 if (mouseDown) { 6418 EndMove(); 6419 mouseDown = false; 6420 CalculateClick(stage_x, stage_y); 6421 o.controls.ControlClick(key); 6422 UpdatePlay(click, 1, "no") 6423 } 6424 } 6425 ; 6426 function UpdatePlay(time, duration, animate) { 6427 if (mouseDown && duration != 1) {} else { 6428 var _to; 6429 if (duration > 0 && time > 0) { 6430 if (time > duration) { 6431 time = duration 6432 } 6433 _to = line0.offsetWidth * (time / duration); 6434 if (_to == line3.offsetWidth) { 6435 _to = -1 6436 } 6437 } else { 6438 _to = 0 6439 } 6440 if (_to >= 0) { 6441 css(line3, { 6442 "width": _to, 6443 "transition": (animate != "no" ? "width " + style.slidespeed + "s linear" : "none") 6444 }); 6445 if (style.handle == 1) { 6446 css(handle, { 6447 "left": _to - w / 2 - handle.offsetWidth / 2 + style.handlemarginleft - style.handlemarginright, 6448 "transition": "none" 6449 }) 6450 } 6451 } 6452 } 6453 } 6454 ;this.UpdatePlay = function(time, duration, animate) { 6455 if (duration != _duration_play || time != _time_play) { 6456 UpdatePlay(time, duration, animate) 6457 } 6458 } 6459 ; 6460 this.UpdatePlaySeek = function() { 6461 killMotion("line_play"); 6462 click > 1 ? click = 1 : ''; 6463 click < 0 ? click = 0 : ''; 6464 css(line3, { 6465 "width": (click * w), 6466 "transition": "none" 6467 }) 6468 } 6469 ; 6470 this.UpdateLoad = function(time, duration) { 6471 if (duration > 0 && time > 0) { 6472 if (duration != _duration_load || time != _time_load) { 6473 var _to = line0.offsetWidth * (time / duration); 6474 css(line1, { 6475 "width": int(_to) 6476 }); 6477 _duration_load = duration; 6478 _time_load = time 6479 } 6480 } else { 6481 killMotion("line_load");
6482 css(line1, { 6483 "width": 0 6484 }) 6485 } 6486 } 6487 ; 6488 function CreateTip() { 6489 tip = createElement("div"); 6490 control.appendChild(tip); 6491 css(tip, { 6492 'position': 'absolute', 6493 'left': 0, 6494 'top': 0, 6495 'height': 'auto', 6496 'overflow': 'hidden', 6497 "pointer-events": "none", 6498 "opacity": 0, 6499 "transition": "opacity 0.1s linear" 6500 }); 6501 tipbg = createElement("div"); 6502 tip.appendChild(tipbg); 6503 style = MarginPadding(style, 'tippadding', 'tippadding'); 6504 css(tipbg, { 6505 'position': 'absolute', 6506 'left': 0, 6507 'top': 0, 6508 'width': '100%', 6509 'height': 30, 6510 'background-color': style.tipbgcolor, 6511 'opacity': style.tipbga, 6512 'border-radius': style.tipbgrounding 6513 }); 6514 tiptext = createElement("div"); 6515 tip.appendChild(tiptext); 6516 css(tiptext, { 6517 'position': 'absolute', 6518 'left': style.tippaddingright, 6519 'top': style.tippaddingtop, 6520 'color': style.tipcolor, 6521 'font-family': style.tipfont, 6522 'font-size': style.tipfontsize, 6523 "line-height": "1", 6524 'opacity': style.tipa 6525 }) 6526 } 6527 ;this.Remove = function() { 6528 control.removeChild(line0); 6529 control.removeChild(line1); 6530 control.removeChild(line3); 6531 if (bg) { 6532 bg.removeAttribute("onclick"); 6533 bg.removeAttribute("onmouseover"); 6534 bg.removeAttribute("onmouseout"); 6535 bg.parentNode.removeChild(bg); 6536 delete bg 6537 } 6538 o.frame.removeChild(control); 6539 delete control 6540 } 6541 }; 6542 var ControlsBg = function() { 6543 var i; 6544 var style = []; 6545 var w; 6546 var h; 6547 var visible = true; 6548 var scaleX = 1; 6549 var scaleY = 1; 6550 var x0 = 0; 6551 var y0 = 0; 6552 var motion_id = random(100000, 200000); 6553 var action, key = "bg"; 6554 var type = "shape"; 6555 style["position"] = "bottom"; 6556 for (var k in v.toolbar) { 6557 style[k] = v.toolbar[k] 6558 } 6559 style["scale"] = 1; 6560 var control = createElement("div"); 6561 o.frame.appendChild(control); 6562 css(control, { 6563 'position': 'absolute', 6564 'left': 0, 6565 'top': 0, 6566 'width': (style.stretchonfullscreen == 1 ? '100%' : o.normal_w), 6567 'height': style.h + style.paddingtop, 6568 'background-color': style.color, 6569 'opacity': style.a 6570 }); 6571 w = control.offsetWidth; 6572 control.onclick = onClick; 6573 if (style.gradient == 1) { 6574 css(control, { 6575 'background': '-moz-linear-gradient(to bottom, rgba(' + hexToRgb(style.color) + ',0), rgba(' + hexToRgb(style.color) + ',1))', 6576 'background': '-webkit-linear-gradient(to bottom, rgba(' + hexToRgb(style.color) + ',0), rgba(' + hexToRgb(style.color) + ',1))', 6577 'background': '-ms-linear-gradient(to bottom, rgba(' + hexToRgb(style.color) + ',0), rgba(' + hexToRgb(style.color) + ',1))', 6578 'background': '-o-linear-gradient(to bottom, rgba(' + hexToRgb(style.color) + ',0), rgba(' + hexToRgb(style.color) + ',1))', 6579 'background': 'linear-gradient(to bottom, rgba(' + hexToRgb(style.color) + ',0), rgba(' + hexToRgb(style.color) + ',1))' 6580 }) 6581 } 6582 function onClick() { 6583 o.actions.ControlsBgClick() 6584 } 6585 ;this.c = function() { 6586 return control 6587 } 6588 ; 6589 this.s = function(key) { 6590 return style[key] 6591 } 6592 ; 6593 this.g = function(x) { 6594 switch (x) { 6595 case "w": 6596 return control.offsetWidth > 0 ? control.offsetWidth : w; 6597 break; 6598 case "width": 6599 return control.offsetWidth; 6600 break; 6601 case "height": 6602 return control.offsetHeight; 6603 break; 6604 case "x": 6605 return int(control.style.left); 6606 break; 6607 case "y": 6608 return int(control.style.top); 6609 break; 6610 case "opacity": 6611 return control.style.opacity; 6612 break; 6613 case "show": 6614 return visible; 6615 break; 6616 case "scaleX": 6617 return scaleX; 6618 break; 6619 case "scaleY": 6620 return scaleY; 6621 break; 6622 case "action": 6623 return action; 6624 break; 6625 case "key": 6626 return key; 6627 break; 6628 case "x0": 6629 return x0; 6630 break; 6631 case "y0": 6632 return y0; 6633 break; 6634 case "motion_id": 6635 return key + motion_id; 6636 break; 6637 default: 6638 return false 6639 } 6640 } 6641 ; 6642 this.set = function(key, x) { 6643 switch (key) { 6644 case "show": 6645 visible = x; 6646 break; 6647 case "w": 6648 w = x; 6649 break; 6650 case "display": 6651 css(control, { 6652 "display": (x ? "block" : "none") 6653 }); 6654 visible = x; 6655 break; 6656 case "scale": 6657 css(control, { 6658 "transform": "scale(" + x + ")" 6659 }); 6660 scaleX = x; 6661 scaleY = x; 6662 break; 6663 case "scaleX": 6664 css(control, { 6665 "transform": "scaleX(" + x + ")" 6666 }); 6667 scaleX = x; 6668 break; 6669 case "scaleY": 6670 css(control, { 6671 "transform": "scaleY(" + x + ")" 6672 }); 6673 scaleY = x; 6674 break; 6675 case "opacity": 6676 css(control, { 6677 "opacity": x 6678 }); 6679 break;
6680 case "left": 6681 css(control, { 6682 "left": x 6683 }); 6684 break; 6685 case "top": 6686 css(control, { 6687 "top": x 6688 }); 6689 break; 6690 case "width": 6691 css(control, { 6692 "width": x 6693 }); 6694 break; 6695 case "height": 6696 css(control, { 6697 "height": x 6698 }); 6699 break; 6700 case "x": 6701 css(control, { 6702 "left": x 6703 }); 6704 break; 6705 case "y": 6706 css(control, { 6707 "top": x 6708 }); 6709 break; 6710 case "x0": 6711 x0 = x; 6712 break; 6713 case "y0": 6714 y0 = x; 6715 break 6716 } 6717 } 6718 ; 6719 this.Remove = function() { 6720 o.frame.removeChild(control); 6721 delete control 6722 } 6723 }; 6724 var Settings = function(is) { 6725 var i; 6726 var style = []; 6727 var f = []; 6728 var fbg = []; 6729 var ftitle = []; 6730 var fvalue = []; 6731 var faction = []; 6732 var f2 = []; 6733 var f2bg = []; 6734 var f2title = []; 6735 var f2value = []; 6736 var f2action = []; 6737 var is_visible = false; 6738 var open_action; 6739 var empty = true; 6740 var key = is; 6741 var playlist; 6742 var history = []; 6743 var plid = ''; 6744 var plfolder = ''; 6745 var plx = -1; 6746 style = UpdateObject(style, v[is]); 6747 style = MarginPadding(v[is], 'margin', 'margin'); 6748 style = MarginPadding(v[is], 'bgpadding', 'bgpadding'); 6749 style = MarginPadding(v[is], 'padding', 'padding'); 6750 var arrow_next = ' ã'; 6751 var arrow_prev = 'ã '; 6752 var container = createElement("div"); 6753 o.frame.appendChild(container); 6754 css(container, { 6755 'overflow': 'hidden', 6756 'display': 'block', 6757 'opacity': 0, 6758 }); 6759 var control = createElement("div"); 6760 container.appendChild(control); 6761 css(control, { 6762 'position': 'relative', 6763 'top': 0, 6764 'left': 0, 6765 'display': 'block', 6766 'overflow': 'auto', 6767 'width': '100%', 6768 'padding-top': style.bgpaddingtop, 6769 'padding-right': style.bgpaddingright + 20, 6770 'padding-bottom': style.bgpaddingbottom, 6771 'padding-left': style.bgpaddingleft, 6772 'color': style.color, 6773 'font-size': style.fontsize 6774 }); 6775 if (exist(v["control_" + is])) { 6776 if (is == "settings") { 6777 for (var i = 1; i < 11; i++) { 6778 if (exist(v["control_" + is][is + i])) { 6779 if (v["control_" + is][is + i] == 1) { 6780 CreateItem('f', i); 6781 StyleItem(f[i], fbg[i], ftitle[i], fvalue[i]); 6782 if (!exist(v["control_" + is][is + i + "title"])) { 6783 v["control_" + is][is + i + "title"] = Lang(v["control_" + is][is + i + "action"]) 6784 } 6785 ftitle[i].innerHTML = v["control_" + is][is + i + "title"]; 6786 if (exist(v["control_" + is][is + i + "action"])) { 6787 faction[i] = v["control_" + is][is + i + "action"]; 6788 Value(i) 6789 } 6790 if (o.system.mobile) { 6791 f[i].ontouchstart = onOver; 6792 f[i].ontouchend = onOut 6793 } else { 6794 f[i].onmouseover = onOver; 6795 f[i].onmouseout = onOut 6796 } 6797 f[i].onclick = onClick 6798 } 6799 } 6800 } 6801 } 6802 } 6803 function onOver(event) { 6804 var i = event.target.getAttribute('fid'); 6805 var x; 6806 if (i) { 6807 x = 'f' 6808 } else { 6809 if (event.target.getAttribute('f2id')) { 6810 i = event.target.getAttribute('f2id'); 6811 x = 'f2' 6812 } 6813 } 6814 if (i) { 6815 i = parseInt(i); 6816 if (exist(eval(x)[i])) { 6817 css(eval(x + 'bg')[i], { 6818 'backgroundColor': style.bgcolorover 6819 }); 6820 if (style.bgaover > -1) { 6821 css(eval(x + 'bg')[i], { 6822 'opacity': style.bgaover, 6823 "transition": "opacity 0.1s linear" 6824 }) 6825 } 6826 if (style.aover > -1) { 6827 css(eval(x + 'title')[i], { 6828 'opacity': style.aover, 6829 "transition": "opacity 0.1s linear" 6830 }); 6831 css(eval(x + 'value')[i], { 6832 'opacity': style.aover, 6833 "transition": "opacity 0.1s linear" 6834 }) 6835 } 6836 if (faction[i].indexOf("playlist") == 0) { 6837 var id = faction[i].substr(8); 6838 if (plid == id || plfolder == id) { 6839 css(eval(x + 'title')[i], { 6840 'color': style.valuecolor 6841 }); 6842 css(eval(x + 'value')[i], { 6843 'color': style.valuecolor 6844 }) 6845 } else { 6846 css(eval(x + 'title')[i], { 6847 'color': style.color 6848 }) 6849 } 6850 } 6851 } 6852 } 6853 } 6854 ;function onOut(event) { 6855 var i = event.target.getAttribute('fid'); 6856 var x; 6857 if (i) { 6858 x = 'f' 6859 } else { 6860 if (event.target.getAttribute('f2id')) { 6861 i = event.target.getAttribute('f2id'); 6862 x = 'f2' 6863 } 6864 } 6865 if (i) { 6866 if (exist(eval(x)[i])) { 6867 css(eval(x + 'bg')[i], { 6868 'backgroundColor': style.bgcolor 6869 }); 6870 if (style.bgaover > -1) { 6871 css(eval(x + 'bg')[i], { 6872 'opacity': style.bga, 6873 "transition": "opacity 0.1s linear" 6874 }) 6875 } 6876 if (style.aover > -1) { 6877 css(eval(x + 'title')[i], { 6878 'opacity': style.a, 6879 "transition": "opacity 0.1s linear" 6880 }); 6881 css(eval(x + 'value')[i], { 6882 'opacity': style.a, 6883 "transition": "opacity 0.1s linear" 6884 }) 6885 } 6886 if (faction[i].indexOf("playlist") == 0) { 6887 var id = faction[i].substr(8); 6888 if (plid == id || plfolder == id) { 6889 css(eval(x + 'title')[i], { 6890 'color': style.valuecolor 6891 }); 6892 css(eval(x + 'value')[i], { 6893 'color': style.valuecolor 6894 }) 6895 } else { 6896 if (exist(history[id])) { 6897 HistoryPlaylist(i) 6898 } else { 6899 css(eval(x + 'title')[i], { 6900 'color': style.color 6901 }) 6902 } 6903 } 6904 } 6905 } 6906 } 6907 } 6908 function onClick(event) { 6909 var i = event.target.getAttribute('fid'); 6910 if (i) { 6911 if (exist(f[i])) { 6912 if (exist(faction[i])) { 6913 Action(i) 6914 } 6915 } 6916 } 6917 } 6918 function onClick2(event) { 6919 var i = event.target.getAttribute('f2id'); 6920 if (i) { 6921 if (i == 0) { 6922 Home() 6923 } else { 6924 if (exist(f2action[i])) { 6925 Action2(i) 6926 } 6927 } 6928 } 6929 } 6930 function Value(i) { 6931 if (exist(faction[i])) { 6932 var _hide = false;
6933 var _show = false; 6934 var _value = ''; 6935 if (is == "settings") { 6936 if (faction[i] == "quality") { 6937 _value = o.media.getQuality(); 6938 if (o.files_quality.length < 2) { 6939 _hide = true 6940 } else { 6941 _show = true 6942 } 6943 } 6944 if (faction[i] == "audiotrack") { 6945 _value = o.media.getAudioTrack(); 6946 if (o.files_audiotrack.length < 2) { 6947 _hide = true 6948 } else { 6949 _show = true 6950 } 6951 } 6952 } 6953 if (_value != '') { 6954 fvalue[i].innerHTML = _value + arrow_next 6955 } 6956 if (_hide) { 6957 hide(f[i]); 6958 if (is == "settings") { 6959 o.controls ? o.controls.SettingsN(i, false, _value) : setTimeout(function() { 6960 o.controls.SettingsN(i, false, _value) 6961 }, 500) 6962 } 6963 css(f[i], { 6964 'position': 'absolute', 6965 'right': 0, 6966 'top': -100 6967 }) 6968 } 6969 if (_show) { 6970 show(f[i]); 6971 if (is == "settings") { 6972 o.controls ? o.controls.SettingsN(i, true, _value) : setTimeout(function() { 6973 o.controls.SettingsN(i, true, _value) 6974 }, 500) 6975 } 6976 css(f[i], { 6977 'position': 'relative', 6978 'right': 0, 6979 'top': 0 6980 }) 6981 } 6982 Resize() 6983 } 6984 for (var j = 1; j < f.length; j++) { 6985 if (f[j]) { 6986 if (isVisible(f[j])) { 6987 var refresh = false; 6988 empty ? refresh = true : ''; 6989 empty = false; 6990 refresh && o.controls ? o.controls.refresh() : '' 6991 } 6992 } 6993 } 6994 } 6995 ;function Action(i) { 6996 if (exist(faction[i])) { 6997 var x = VisibleItems(); 6998 open_action = faction[i]; 6999 if (open_action == 'quality' || open_action == 'audiotrack') { 7000 var files_query = o['files_' + open_action]; 7001 var current = o['current_' + open_action]; 7002 var pressed = o['pressed_' + open_action]; 7003 for (var j = 1; j < f.length; j++) { 7004 f[j].style.display = "none" 7005 } 7006 f2 = []; 7007 CreateItem('f2', 0); 7008 StyleItem(f2[0], f2bg[0], f2title[0], f2value[0]); 7009 css(f2[0], { 7010 "border-bottom": "1px solid rgba(100,100,100,0.7)" 7011 }); 7012 f2title[0].innerHTML = (x[0] > 1 ? arrow_prev : ' ') + v["control_" + is][is + i + "title"]; 7013 css(f2title[0], { 7014 'color': style.titlecolor, 7015 'padding-left': style.paddingleft - 7 7016 }); 7017 f2action[0] = "home"; 7018 if (x[0] > 1) { 7019 if (o.system.mobile) { 7020 f2[0].ontouchstart = onOver; 7021 f2[0].ontouchend = onOut 7022 } else { 7023 f2[0].onmouseover = onOver; 7024 f2[0].onmouseout = onOut 7025 } 7026 f2[0].onclick = onClick2 7027 } else { 7028 css(f2[0], { 7029 "cursor": 'default' 7030 }) 7031 } 7032 if (exist(files_query)) { 7033 for (j = 0; j < files_query.length; j++) { 7034 var y = j + 1; 7035 var totheend = false;
7036 if (open_action == 'quality') { 7037 if (files_query[j] == Lang("auto")) { 7038 totheend = true 7039 } 7040 } 7041 CreateItem('f2', y, totheend); 7042 StyleItem(f2[y], f2bg[y], f2title[y], f2value[y]); 7043 f2title[y].innerHTML = files_query[j]; 7044 f2action[y] = open_action + j; 7045 if (current == j || pressed == j) { 7046 f2value[y].innerHTML = current == j ? 'â ' : 'â '; 7047 current == j ? css(f2title[y], { 7048 'color': style.valuecolor 7049 }) : '' 7050 } 7051 if (open_action == 'quality') { 7052 if (files_query[j] == Lang("auto") && o.media.autoQuality()) { 7053 css(f2title[y], { 7054 'color': style.valuecolor 7055 }) 7056 } 7057 } 7058 if (o.system.mobile) { 7059 f2[y].ontouchstart = onOver; 7060 f2[y].ontouchend = onOut 7061 } else { 7062 f2[y].onmouseover = onOver; 7063 f2[y].onmouseout = onOut 7064 } 7065 f2[y].onclick = onClick2 7066 } 7067 } 7068 Resize() 7069 } 7070 if (faction[i] == 'download') { 7071 var x = o.media.currentFile(); 7072 if (exist(v.download)) { 7073 x = v.download 7074 } 7075 if (x != '') { 7076 var win = window.open(x, '_blank'); 7077 win.focus() 7078 } 7079 } 7080 if (faction[i].indexOf('playlist') > -1) { 7081 var id = faction[i].substr(8); 7082 if (exist(o.playlist_dic[id])) { 7083 if (exist(o.playlist_dic[id]['file'])) { 7084 o.actions.NewFile(o.playlist_dic[id]['file']); 7085 ActionPlaylist(i); 7086 HideControl() 7087 } else { 7088 if (exist(o.playlist_dic[id]['folder'])) { 7089 UpdatePlaylist(o.playlist_dic[id]) 7090 } 7091 } 7092 } 7093 } 7094 } 7095 } 7096 ;function ActionPlaylist(x) { 7097 if (plx > -1) { 7098 HistoryPlaylist(plx) 7099 } 7100 var id = faction[x].substr(8); 7101 fvalue[x].innerHTML = 'â '; 7102 css(ftitle[x], { 7103 'color': style.valuecolor, 7104 'text-decoration': 'none', 7105 'opacity': style.a 7106 }); 7107 plx = x; 7108 plid != '' ? history[plid] = true : ''; 7109 plid = id; 7110 plfolder = o.playlist_dic[id]['pjs_parent'] 7111 } 7112 function UpdatePlaylist(x) { 7113 for (var i = 0; i < f.length; i++) { 7114 control.removeChild(f[i]); 7115 delete f[i] 7116 } 7117 f = []; 7118 plx = -1; 7119 if (exist(x['folder'])) { 7120 var y = Object.keys(x['folder']).length; 7121 CreateItem('f', y); 7122 faction[y] = "playlistfolder"; 7123 StyleItem(f[y], fbg[y], ftitle[y], fvalue[y]); 7124 if (style.borderbottom == 1) { 7125 css(f[y], { 7126 "borderBottom": "1px solid #" + style.bordercolor 7127 }) 7128 } 7129 ftitle[y].innerHTML = arrow_prev + x.title; 7130 css(ftitle[y], { 7131 'margin-left': -7 7132 }); 7133 if (o.system.mobile) { 7134 f[y].ontouchstart = onOver; 7135 f[y].ontouchend = onOut 7136 } else { 7137 f[y].onmouseover = onOver; 7138 f[y].onmouseout = onOut 7139 } 7140 var p = x['pjs_parent']; 7141 f[y].onclick = function() { 7142 PlaylistBack(p) 7143 } 7144 ; 7145 x = x['folder'] 7146 } 7147 var y = Object.keys(x).length; 7148 for (var i = 0; i < y; i++) { 7149 CreateItem('f', i); 7150 faction[i] = "playlist" + x[i].id; 7151 StyleItem(f[i], fbg[i], ftitle[i], fvalue[i]); 7152 if (style.borderbottom == 1 && i < y - 1) { 7153 css(f[i], { 7154 "borderBottom": "1px solid #" + style.bordercolor 7155 }) 7156 } 7157 ftitle[i].innerHTML = x[i].title; 7158 if (exist(x[i].folder)) { 7159 fvalue[i].innerHTML = 'ã'; 7160 css(fvalue[i], { 7161 "color": style.color, 7162 'margin-right': -2 7163 }) 7164 } 7165 if (o.system.mobile) { 7166 f[i].ontouchstart = onOver; 7167 f[i].ontouchend = onOut 7168 } else { 7169 f[i].onmouseover = onOver; 7170 f[i].onmouseout = onOut 7171 } 7172 f[i].onclick = onClick; 7173 if (exist(history[x[i].id])) { 7174 HistoryPlaylist(i) 7175 } 7176 if (plid == x[i].id) { 7177 ActionPlaylist(i) 7178 } 7179 if (plfolder == x[i].id) { 7180 css(ftitle[i], { 7181 'color': style.valuecolor 7182 }); 7183 css(fvalue[i], { 7184 'color': style.valuecolor 7185 }) 7186 } 7187 Resize() 7188 } 7189 empty = false;
7190 o.controls ? o.controls.refresh() : '' 7191 } 7192 function PlaylistBack(x) { 7193 if (x == '') { 7194 UpdatePlaylist(o.playlist) 7195 } else { 7196 if (exist(o.playlist_dic[x])) { 7197 UpdatePlaylist(o.playlist_dic[x]) 7198 } 7199 } 7200 } 7201 function HistoryPlaylist(x) { 7202 fvalue[x].innerHTML = ''; 7203 css(ftitle[x], { 7204 'color': style.historycolor 7205 }); 7206 if (style.historytitlestrike == 1) { 7207 css(ftitle[x], { 7208 'text-decoration': 'line-through' 7209 }) 7210 } 7211 if (style.historytitlea > -1) { 7212 css(ftitle[x], { 7213 'opacity': style.historytitlea 7214 }) 7215 } 7216 css(fbg[x], { 7217 'backgroundColor': style.historybgcolor 7218 }); 7219 if (style.historybga > -1) { 7220 css(fbg[x], { 7221 'opacity': style.historybga 7222 }) 7223 } 7224 } 7225 function Action2(i) { 7226 if (exist(f2action[i])) { 7227 if (f2action[i].indexOf("quality") == 0) { 7228 o.actions.SetQuality(f2action[i].substr(7)); 7229 quality_pressed = i - 1 7230 } 7231 if (f2action[i].indexOf("audiotrack") == 0) { 7232 o.actions.SetAudioTrack(f2action[i].substr(10)); 7233 quality_pressed = i - 1 7234 } 7235 } 7236 } 7237 ;function CreateItem(x, i, totheend) { 7238 if (exist(eval(x))) { 7239 eval(x)[i] = createElement("div"); 7240 if (i < 2 || x == "f" || open_action != 'quality' || totheend) { 7241 control.appendChild(eval(x)[i]) 7242 } else { 7243 control.insertBefore(eval(x)[i], eval(x)[i - 1]) 7244 } 7245 if (x == 'f') { 7246 attr(eval(x)[i], { 7247 'fid': i 7248 }) 7249 } 7250 if (x == 'f2') { 7251 attr(eval(x)[i], { 7252 'f2id': i 7253 }) 7254 } 7255 eval(x + 'bg')[i] = createElement("div"); 7256 eval(x)[i].appendChild(eval(x + 'bg')[i]); 7257 eval(x + 'title')[i] = createElement("div"); 7258 eval(x)[i].appendChild(eval(x + 'title')[i]); 7259 eval(x + 'value')[i] = createElement("div"); 7260 eval(x)[i].appendChild(eval(x + 'value')[i]) 7261 } 7262 } 7263 ;function StyleItem(x, xbg, xtitle, xvalue) { 7264 css(x, { 7265 'position': 'relative', 7266 'right': 0, 7267 'top': 0, 7268 'cursor': 'pointer', 7269 'height': 'auto', 7270 'overflow': 'hidden', 7271 'width': '100%', 7272 'display': 'block' 7273 }); 7274 css(xbg, { 7275 'position': 'absolute', 7276 'right': 0, 7277 'top': 0, 7278 'width': '100%', 7279 'height': '100%', 7280 'backgroundColor': style.bgcolor, 7281 'opacity': style.bga, 7282 'pointerEvents': 'none' 7283 }); 7284 css(xtitle, { 7285 'position': 'relative', 7286 'right': 0, 7287 'top': 0, 7288 'float': 'left', 7289 'padding-top': style.paddingtop, 7290 'padding-right': style.paddingright, 7291 'padding-bottom': style.paddingbottom, 7292 'padding-left': style.paddingleft, 7293 'pointerEvents': 'none', 7294 'opacity': style.a, 7295 'white-space': 'nowrap' 7296 }); 7297 css(xvalue, { 7298 'position': 'relative', 7299 'right': 0, 7300 'top': 0, 7301 'float': 'right', 7302 'padding-top': style.paddingtop + 1, 7303 'padding-right': style.paddingright - 7, 7304 'padding-bottom': style.paddingbottom, 7305 'padding-left': style.paddingleft, 7306 'pointerEvents': 'none', 7307 'font-size': style.valuefontsize, 7308 'opacity': style.a, 7309 'color': style.valuecolor, 7310 'white-space': 'nowrap' 7311 }) 7312 } 7313 function Home() { 7314 for (var i = 1; i < f.length; i++) { 7315 if (exist(f[i])) { 7316 f[i].style.display = "block" 7317 } 7318 } 7319 Remove2(); 7320 Resize(); 7321 open_action = '' 7322 } 7323 ;function Remove2() { 7324 for (var j = 0; j < f2.length; j++) { 7325 control.removeChild(f2[j]); 7326 delete f2[j] 7327 } 7328 f2 = [] 7329 } 7330 function Width() { 7331 return control.offsetWidth 7332 } 7333 ;function Resize() { 7334 if (is == "settings") { 7335 o.controls ? o.controls.resizeSettings() : '' 7336 } 7337 if (is == "playlist") { 7338 o.controls ? o.controls.resizePlaylist() : '' 7339 } 7340 } 7341 ;function VisibleItems() { 7342 var x = 0; 7343 var y = 0; 7344 var z = ''; 7345 for (var i = 1; i < f.length; i++) { 7346 if (exist(f[i])) { 7347 if (isVisible(f[i])) { 7348 x++; 7349 y = i; 7350 z = faction[i] 7351 } 7352 } 7353 } 7354 return [x, y, z] 7355 } 7356 function HideControl() { 7357 css(container, { 7358 "visibility": "hidden", 7359 "opacity": 0, 7360 "top": -2000 7361 }); 7362 is_visible = false 7363 } 7364 this.c = function() { 7365 return container 7366 } 7367 ; 7368 this.co = function() { 7369 return control 7370 } 7371 ; 7372 this.s = function(key) { 7373 return style[key] 7374 } 7375 ; 7376 this.show = function() { 7377 Home(); 7378 css(container, { 7379 "visibility": "visible", 7380 "opacity": 1, 7381 "transition": "opacity 0.2s linear" 7382 }); 7383 is_visible = true; 7384 var x = VisibleItems(); 7385 if (x[0] == 1) { 7386 if (x[2] == "quality" || x[2] == "audiotrack") { 7387 Action(x[1]) 7388 } 7389 } 7390 if (o.controls) { 7391 is == 'settings' ? o.controls.resizeSettings() : ''; 7392 is == 'playlist' ? o.controls.resizePlaylist() : '' 7393 } 7394 } 7395 ; 7396 this.open = function(i) { 7397 Action(i) 7398 } 7399 ; 7400 this.hide = function() { 7401 HideControl() 7402 } 7403 ; 7404 this.SetQuality = function() { 7405 for (var i = 0; i < faction.length; i++) { 7406 if (faction[i] == "quality") { 7407 Value(i); 7408 if (o.files_quality.length > 1) { 7409 show(f[i]) 7410 } 7411 if (open_action == 'quality') { 7412 Remove2(); 7413 Action(i) 7414 } 7415 } 7416 } 7417 } 7418 ; 7419 this.SetAudioTrack = function() { 7420 for (var i = 0; i < faction.length; i++) { 7421 if (faction[i] == "audiotrack") { 7422 Value(i); 7423 if (o.files_audiotrack.length > 1) { 7424 show(f[i]) 7425 } 7426 if (open_action == 'audiotrack') { 7427 Remove2(); 7428 Action(i) 7429 } 7430 } 7431 } 7432 } 7433 ; 7434 this.updatePlaylist = function(x) { 7435 UpdatePlaylist(x); 7436 if (exist(v.plstart)) { 7437 if (exist(o.playlist_dic[v.plstart])) { 7438 FindPlStart(o.playlist_dic[v.plstart]); 7439 ActionPlaylist(o.playlist_dic[v.plstart]['pjs_i']) 7440 } else { 7441 ActionPlaylist(0) 7442 } 7443 } else { 7444 ActionPlaylist(0) 7445 } 7446 } 7447 ; 7448 function FindPlStart(x) { 7449 if (x['pjs_parent_i'] != -1) { 7450 FindPlStart(o.playlist_dic[x['pjs_parent']]); 7451 UpdatePlaylist(o.playlist_dic[x['pjs_parent']]) 7452 } 7453 } 7454 this.g = function(x) { 7455 switch (x) { 7456 case "width": 7457 return Width(); 7458 break; 7459 case "height": 7460 return container.offsetHeight; 7461 break; 7462 case "x": 7463 return int(container.style.left); 7464 break; 7465 case "y": 7466 return int(container.style.top); 7467 break; 7468 case "opacity": 7469 return container.style.opacity; 7470 break; 7471 case "show": 7472 return is_visible; 7473 break; 7474 case "action": 7475 return action; 7476 break; 7477 case "key": 7478 return key; 7479 break; 7480 case "motion_id": 7481 return key + motion_id; 7482 break; 7483 case "empty": 7484 return empty; 7485 break 7486 } 7487 } 7488 ; 7489 this.Remove = function() { 7490 o.frame.removeChild(control); 7491 delete control 7492 } 7493 }; 7494 if (options.id) { 7495 if (document.getElementById(options.id)) { 7496 for (var i = 0; i < pljssglobal.length; i++) { 7497 if (pljssglobal[i].api("id") == options.id) { 7498 pljssglobal[i].api('stop') 7499 } 7500 } 7501 pljssglobal.push(this); 7502 VisibleCheck() 7503 } else { 7504 document.addEventListener('DOMContentLoaded', Init) 7505 } 7506 } 7507 function VisibleCheck() { 7508 if (exist(options.id)) { 7509 if (!isHidden(document.getElementById(options.id))) { 7510 Init() 7511 } else { 7512 setTimeout(VisibleCheck, 500) 7513 } 7514 } 7515 } 7516 function Init() { 7517 if (o.u != '') { 7518 v = UpdateObject(v, JSON.parse(decode(o.u))) 7519 } 7520 v = UpdateObject(v, options); 7521 for (var key in o.compilation) { 7522 o.compilation[key] != '' ? o.compilations += o.compilation[key] + ' ' : '' 7523 } 7524 log(o.version + ' ' + o.compilations); 7525 pljssglobalid = v.id; 7526 (function(i, s, o, g, r, a, m) { 7527 i['GoogleAnalyticsObject'] = r; 7528 i[r] = i[r] || function() { 7529 (i[r].q = i[r].q || []).push(arguments) 7530 } 7531 , 7532 i[r].l = 1 * new Date(); 7533 a = s.createElement(o), 7534 m = s.getElementsByTagName(o)[0]; 7535 a.async = 1; 7536 a.src = g; 7537 m.parentNode.insertBefore(a, m) 7538 } 7539 )(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 7540 v.d = location.hostname; 7541 ga('create', 'UA-88484718-2', 'playerjs.com'); 7542 o.gatracked = []; 7543 if (v.playerjscom != 1) { 7544 ga('playerjs.set', 'appVersion', o.version); 7545 ga('playerjs.set', 'forceSSL', true); 7546 ga('playerjs.send', 'pageview', v.d); 7547 if (exist(v.ga)) { 7548 if (v.ga.indexOf("UA") == 0) { 7549 ga('create', v.ga, { 7550 'name': 'user' 7551 }) 7552 } 7553 } 7554 gaTracker("Init") 7555 } 7556 o.container = document.getElementById(v.id); 7557 css(o.container, { 7558 'padding': 0 7559 }); 7560 o.container_h = o.container.offsetHeight; 7561 o.container_w = o.container.offsetWidth; 7562 if (o.container.style.height.indexOf("%") > -1) { 7563 v.playersize.aspect = "%"; 7564 o.container_h_procent = o.container.style.height; 7565 o.container_h = 0 7566 } 7567 if (o.container_w == 0) { 7568 if (o.container.style.width.indexOf("px") > 0) { 7569 o.container_w = parseInt(o.container.style.width) 7570 } else { 7571 if (o.container.parentNode.style.width.indexOf("px") > 0) { 7572 o.container_w = parseInt(o.container.parentNode.style.width) 7573 } else { 7574 if (o.container.parentNode.parentNode.style.width.indexOf("px") > 0) { 7575 o.container_w = parseInt(o.container.parentNode.parentNode.style.width) 7576 } 7577 } 7578 } 7579 } 7580 if (v.playersize.aspect.indexOf("x") > 0) { 7581 o.aspect = v.playersize.aspect.split("x")[0] / v.playersize.aspect.split("x")[1]; 7582 if (o.container_h == 0) { 7583 o.container_h = o.container_w / o.aspect 7584 } 7585 } else { 7586 o.aspect = 0 7587 } 7588 css(o.container, { 7589 'position': 'relative', 7590 'box-sizing': 'content-box', 7591 'text-align': 'left',
7592 '-webkit-user-select': 'none', 7593 'overflow': 'hidden', 7594 'fontFamily': 'sans-serif' 7595 }); 7596 if (o.aspect > 0) { 7597 css(o.container, { 7598 'height': o.container_h 7599 }) 7600 } else { 7601 css(o.container, { 7602 'height': o.container_h == 0 ? o.container_h_procent : o.container_h 7603 }) 7604 } 7605 o.frame = createElement("div"); 7606 css(o.frame, { 7607 'position': 'absolute', 7608 'box-sizing': 'content-box', 7609 'backgroundColor': v.screencolor, 7610 'width': '100%', 7611 'height': '100%', 7612 'left': 0, 7613 'top': 0 7614 }); 7615 o.container.appendChild(o.frame); 7616 o.frameresize = createElement('iframe'); 7617 attr(o.frameresize, { 7618 "scrolling": "no", 7619 "allowfullscreen": "true", 7620 "allowtransparency": "true" 7621 }); 7622 css(o.frameresize, { 7623 'position': 'absolute', 7624 'width': '100%', 7625 'height': '100%', 7626 'border': 0, 7627 }); 7628 o.frame.appendChild(o.frameresize); 7629 o.container.oncontextmenu = function ContextMenu(e) { 7630 o.rightclick++; 7631 if (o.rightclick == 5) { 7632 v.log = 1; 7633 log(o.version + ' ' + o.compilations + ' ' + o.playerid) 7634 } 7635 if (v.rightclick == 0) { 7636 if (!e) 7637 var e = window.event; 7638 e.cancelBubble = true; 7639 if (e.stopPropagation) 7640 e.stopPropagation(); 7641 return false 7642 } 7643 } 7644 ; 7645 o.system = new System(); 7646 if (parent) { 7647 var exception = false; 7648 try { 7649 while (parent.document !== document) { 7650 if (parent.document) { 7651 var frames = parent.document.getElementsByTagName("IFRAME"); 7652 for (var i = 0; i < frames.length; i++) { 7653 if (frames[i].contentWindow === window) { 7654 o.parentIframe = frames[i]; 7655 css(o.parentIframe, { 7656 "border": "none" 7657 }); 7658 o.parentIframe_style = o.parentIframe.style 7659 } 7660 } 7661 } else { 7662 exception = true; 7663 break 7664 } 7665 } 7666 } catch (err) { 7667 exception = true 7668 } 7669 if (exception) { 7670 log("Crossdomain issue", o.system.fullscreen); 7671 !o.system.fullscreen ? v.nativecontrols = 1 : '' 7672 } 7673 } 7674 Ready() 7675 } 7676 function Ready() { 7677 o.actions = new Actions(); 7678 if (!v.file) { 7679 v.file = "?" 7680 } 7681 o.media = new Media(v.file); 7682 o.frame.addEventListener("mouseenter", function() { 7683 o.mouseHere = true; 7684 o.controls ? o.controls.StageOver() : '' 7685 }); 7686 o.frame.addEventListener("mouseleave", function() { 7687 if (!o.mouseDown) { 7688 o.mouseHere = false; 7689 o.controls ? o.controls.StageLeave() : '' 7690 } 7691 }); 7692 o.frame.addEventListener("touchstart", function(event) { 7693 o.mouseDown = true; 7694 o.mouseHere = true 7695 }); 7696 o.frame.addEventListener("touchend", function(event) { 7697 o.mouseDown = false; 7698 o.mouseHere = false; 7699 if (o.system.mobile && o.controls.ToolbarHidden()) { 7700 o.controls.ShowForce() 7701 } else { 7702 o.controls ? o.controls.StageMouseUp(event.clientX, event.clientY) : '' 7703 } 7704 }); 7705 o.frame.addEventListener("mousedown", function(event) { 7706 o.mouseDown = true 7707 }); 7708 o.frame.addEventListener("mouseup", function(event) { 7709 o.mouseDown = false; 7710 if (o.system.mobile && o.controls.ToolbarHidden()) { 7711 o.controls.ShowForce() 7712 } else { 7713 o.controls ? o.controls.StageMouseUp(event.clientX, event.clientY) : '' 7714 } 7715 }); 7716 try { 7717 window.document.addEventListener("mouseup", function(event) { 7718 if (o.mouseDown && o.controls) { 7719 o.mouseDown = false;
7720 o.controls.StageMouseUp(event.clientX, event.clientY); 7721 o.controls.StageLeave() 7722 } 7723 }) 7724 } catch (err) {} 7725 o.frame.addEventListener("mousemove", function(event) { 7726 o.controls && o.mouseDown ? o.controls.StageMove(event.clientX, event.clientY) : o.controls.StageMove2() 7727 }); 7728 window.document.addEventListener("mousemove", function(event) { 7729 o.controls && o.mouseDown ? o.controls.StageMove(event.clientX, event.clientY) : '' 7730 }); 7731 window.document.addEventListener("keydown", function(event) { 7732 var x = event.target.tagName.toLowerCase(); 7733 if (x == 'input' || x == 'textarea') { 7734 return 7735 } else { 7736 o.controls ? o.controls.KeyDown(event) : '' 7737 } 7738 }); 7739 document.addEventListener("fullscreenchange", FullscreenChange, false); 7740 document.addEventListener("mozfullscreenchange", FullscreenChange, false); 7741 document.addEventListener("webkitfullscreenchange", FullscreenChange, false); 7742 document.addEventListener("msfullscreenchange", FullscreenChange, false); 7743 o.frameresize.contentWindow.addEventListener('resize', Resize); 7744 o.mediacontainer.addEventListener("click", CheckClick, false); 7745 UpdateSize(); 7746 o.controls = new Controls(); 7747 Title(); 7748 Resize(); 7749 if (StorageSupport()) { 7750 if (localStorage.getItem("pljsvolume") != null) { 7751 v.volume = localStorage.getItem("pljsvolume") 7752 } 7753 if (localStorage.getItem("pljsmute") == 1) { 7754 v.mute = 1 7755 } 7756 } 7757 o.actions.Volume(v.volume); 7758 if (v.mute == 1) { 7759 o.actions.Mute() 7760 } 7761 o.alert = new Alert(); 7762 if (v.rounding > 0) { 7763 PlayerRadius() 7764 } 7765 js("init") 7766 } 7767 function CheckClick() { 7768 if (o.system.mobile) { 7769 o.actions.ScreenClick() 7770 } else { 7771 if (o.mediacontainer.getAttribute("data-dblclick") == null) { 7772 o.mediacontainer.setAttribute("data-dblclick", 1); 7773 setTimeout(function() { 7774 if (o.mediacontainer.getAttribute("data-dblclick") == 1) { 7775 o.actions.ScreenClick() 7776 } 7777 o.mediacontainer.removeAttribute("data-dblclick") 7778 }, 300) 7779 } else { 7780 o.mediacontainer.removeAttribute("data-dblclick"); 7781 o.fullscreen ? o.actions.Normalscreen() : o.actions.Fullscreen() 7782 } 7783 } 7784 } 7785 function Resize() { 7786 UpdateSize(); 7787 o.controls.resize(); 7788 o.media.resize() 7789 } 7790 function UpdateSize() { 7791 var xw = o.frame.offsetWidth; 7792 var xh = o.frame.offsetHeight; 7793 if (o.aspect > 0 && !o.fullscreen) { 7794 xh = xw / o.aspect; 7795 css(o.container, { 7796 "height": xh 7797 }) 7798 } 7799 if (!o.fullscreen) { 7800 o.normal_w = xw; 7801 o.normal_h = xh 7802 } 7803 o.screen_w = xw; 7804 o.screen_h = xh 7805 } 7806 function Title() { 7807 for (var x in v) { 7808 if (x.indexOf("title") == 0) { 7809 o.actions.Title(x) 7810 } 7811 } 7812 } 7813 function Poster(url, container, scale) { 7814 if (url != '') { 7815 if (url.indexOf("http") == -1 && url.indexOf("//") == -1) { 7816 url = '//' + url 7817 } 7818 url = checkBase64(url); 7819 var s = "contain"; 7820 if (scale == "fill") { 7821 s = "cover" 7822 } 7823 if (scale == "none") { 7824 s = "auto" 7825 } 7826 if (scale == "stretch") { 7827 s = "100% 100%" 7828 } 7829 css(container, { 7830 'position': 'absolute', 7831 'left': 0, 7832 'top': 0, 7833 'width': '100%', 7834 'height': '100%', 7835 'background': 'url(' + url + ') no-repeat center center', 7836 'background-size': s 7837 }); 7838 show(container) 7839 } 7840 } 7841 ;function PlayerRadius() { 7842 o.oo = createElement("div"); 7843 var r = 2; 7844 var o11 = createElement('canvas'); 7845 var ctx = o11.getContext("2d"); 7846 o11.height = v.rounding * r; 7847 o11.width = v.rounding * r; 7848 ctx.fillStyle = v.bgcolor; 7849 ctx.beginPath(); 7850 ctx.scale(r, r); 7851 ctx.moveTo(0, 0); 7852 ctx.lineTo(v.rounding, 0); 7853 ctx.quadraticCurveTo(0, 0, 0, v.rounding); 7854 ctx.closePath(); 7855 ctx.fill(); 7856 o.oo.appendChild(o11); 7857 var o12 = createElement('canvas'); 7858 var ctx = o12.getContext("2d"); 7859 o12.height = v.rounding * r; 7860 o12.width = v.rounding * r; 7861 ctx.fillStyle = v.bgcolor; 7862 ctx.beginPath(); 7863 ctx.scale(r, r); 7864 ctx.moveTo(0, 0); 7865 ctx.quadraticCurveTo(v.rounding, 0, v.rounding, v.rounding); 7866 ctx.lineTo(v.rounding, 0); 7867 ctx.closePath(); 7868 ctx.fill(); 7869 o.oo.appendChild(o12); 7870 var o22 = createElement('canvas'); 7871 var ctx = o22.getContext("2d"); 7872 o22.height = v.rounding * r; 7873 o22.width = v.rounding * r; 7874 ctx.fillStyle = v.bgcolor; 7875 ctx.beginPath(); 7876 ctx.scale(r, r); 7877 ctx.moveTo(v.rounding, 0); 7878 ctx.quadraticCurveTo(v.rounding, v.rounding, 0, v.rounding); 7879 ctx.lineTo(v.rounding, v.rounding); 7880 ctx.closePath(); 7881 ctx.fill(); 7882 o.oo.appendChild(o22); 7883 o21 = createElement('canvas'); 7884 var ctx = o21.getContext("2d"); 7885 o21.height = v.rounding * r; 7886 o21.width = v.rounding * r; 7887 ctx.fillStyle = v.bgcolor; 7888 ctx.beginPath(); 7889 ctx.scale(r, r); 7890 ctx.moveTo(0, 0); 7891 ctx.quadraticCurveTo(0, v.rounding, v.rounding, v.rounding); 7892 ctx.lineTo(0, v.rounding); 7893 ctx.closePath(); 7894 ctx.fill(); 7895 o.oo.appendChild(o21); 7896 o.container.appendChild(o.oo); 7897 css(o.oo, { 7898 'position': 'absolute', 7899 'top': 0, 7900 'left': 0, 7901 'pointer-events': 'none', 7902 'height': 'auto', 7903 'overflow': 'hidden', 7904 'width': '100%', 7905 'height': '100%' 7906 }); 7907 css(o11, { 7908 'position': 'absolute', 7909 'top': 0, 7910 'left': 0, 7911 'width': v.rounding / r, 7912 'height': v.rounding / r 7913 }); 7914 css(o12, { 7915 'position': 'absolute', 7916 'top': 0, 7917 'right': 0, 7918 'width': v.rounding / r, 7919 'height': v.rounding / r 7920 }); 7921 css(o22, { 7922 'position': 'absolute', 7923 'bottom': 0, 7924 'right': 0, 7925 'width': v.rounding / r, 7926 'height': v.rounding / r 7927 }); 7928 css(o21, { 7929 'position': 'absolute', 7930 'bottom': 0, 7931 'left': 0, 7932 'width': v.rounding / r, 7933 'height': v.rounding / r 7934 }) 7935 } 7936 function FullscreenChange() { 7937 log("FullscreenChange", o.fullscreen); 7938 if (o.fullscreen) { 7939 o.actions.NormalscreenUI(true) 7940 } else { 7941 o.actions.FullscreenUI() 7942 } 7943 } 7944 function isHidden(x) { 7945 return x.offsetWidth == 0 && x.offsetHeight == 0 7946 } 7947}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.