From d88e6d0f80211b2ace5595af9931b997eb4c6bc4 Mon Sep 17 00:00:00 2001 From: Austin Riddell <53499821+aus-tin@users.noreply.github.com> Date: Tue, 19 May 2020 10:37:35 -0500 Subject: Major frontend redesign (#5) * Major frontend redesign * Some improvements Co-authored-by: RblSb --- res/client.js | 929 ++++++++++++++++++++++++---------------------------------- 1 file changed, 385 insertions(+), 544 deletions(-) (limited to 'res/client.js') diff --git a/res/client.js b/res/client.js index cecba6b..f7cf45c 100644 --- a/res/client.js +++ b/res/client.js @@ -1,4 +1,4 @@ -// Generated by Haxe 4.0.5 +// Generated by Haxe 4.1.0+9cbc59342 (function ($hx_exports, $global) { "use strict"; $hx_exports["client"] = $hx_exports["client"] || {}; $hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {}; @@ -78,7 +78,7 @@ EReg.prototype = { if(this.r.m != null && n >= 0 && n < this.r.m.length) { return this.r.m[n]; } else { - throw new js__$Boot_HaxeError("EReg::matched"); + throw haxe_Exception.thrown("EReg::matched"); } } }; @@ -112,12 +112,8 @@ HxOverrides.remove = function(a,obj) { a.splice(i,1); return true; }; -HxOverrides.iter = function(a) { - return { cur : 0, arr : a, hasNext : function() { - return this.cur < this.arr.length; - }, next : function() { - return this.arr[this.cur++]; - }}; +HxOverrides.now = function() { + return Date.now(); }; var Lambda = function() { }; Lambda.__name__ = true; @@ -139,24 +135,9 @@ Lambda.find = function(it,f) { return null; }; var haxe_ds_StringMap = function() { - this.h = { }; + this.h = Object.create(null); }; haxe_ds_StringMap.__name__ = true; -haxe_ds_StringMap.prototype = { - setReserved: function(key,value) { - if(this.rh == null) { - this.rh = { }; - } - this.rh["$" + key] = value; - } - ,getReserved: function(key) { - if(this.rh == null) { - return null; - } else { - return this.rh["$" + key]; - } - } -}; var Lang = function() { }; Lang.__name__ = true; Lang.request = function(path,callback) { @@ -176,57 +157,39 @@ Lang.init = function(folderPath,callback) { } } Lang.ids = _g; - var _this1 = Lang.langs; - _this1.h = { }; - _this1.rh = null; + Lang.langs.h = Object.create(null); var count = 0; - var _g2 = 0; - var _g11 = Lang.ids; - while(_g2 < _g11.length) { - var name = [_g11[_g2]]; - ++_g2; - Lang.request("" + folderPath + "/" + name[0] + ".json",(function(name1) { + var _g = 0; + var _g1 = Lang.ids; + while(_g < _g1.length) { + var name = [_g1[_g]]; + ++_g; + Lang.request("" + folderPath + "/" + name[0] + ".json",(function(name) { return function(data) { var data1 = JSON.parse(data); var lang = new haxe_ds_StringMap(); - var _g3 = 0; - var _g12 = Reflect.fields(data1); - while(_g3 < _g12.length) { - var key = _g12[_g3]; - ++_g3; - var v1 = Reflect.field(data1,key); - if(__map_reserved[key] != null) { - lang.setReserved(key,v1); - } else { - lang.h[key] = v1; - } - } - var id = haxe_io_Path.withoutExtension(name1[0]); - var _this2 = Lang.langs; - if(__map_reserved[id] != null) { - _this2.setReserved(id,lang); - } else { - _this2.h[id] = lang; + var _g = 0; + var _g1 = Reflect.fields(data1); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + lang.h[key] = Reflect.field(data1,key); } + var id = haxe_io_Path.withoutExtension(name[0]); + Lang.langs.h[id] = lang; count += 1; if(count == Lang.ids.length && callback != null) { callback(); } - return; }; })(name)); } }; Lang.get = function(key) { - var key1 = Lang.lang; - var _this = Lang.langs; - if((__map_reserved[key1] != null ? _this.getReserved(key1) : _this.h[key1]) == null) { + if(Lang.langs.h[Lang.lang] == null) { Lang.lang = "en"; } - var key2 = Lang.lang; - var _this1 = Lang.langs; - var _this2 = __map_reserved[key2] != null ? _this1.getReserved(key2) : _this1.h[key2]; - var text = __map_reserved[key] != null ? _this2.getReserved(key) : _this2.h[key]; + var text = Lang.langs.h[Lang.lang].h[key]; if(text == null) { return key; } else { @@ -239,7 +202,7 @@ Reflect.__name__ = true; Reflect.field = function(o,field) { try { return o[field]; - } catch( e ) { + } catch( _g ) { return null; } }; @@ -288,7 +251,8 @@ Std.parseInt = function(x) { var i = _g++; var c = x.charCodeAt(i); if(c <= 8 || c >= 14 && c != 32 && c != 45) { - var v = parseInt(x, (x[(i + 1)]=="x" || x[(i + 1)]=="X") ? 16 : 10); + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); if(isNaN(v)) { return null; } else { @@ -306,11 +270,11 @@ StringTools.htmlEscape = function(s,quotes) { var _g_offset = 0; var _g_s = s; while(_g_offset < _g_s.length) { - var s1 = _g_s; + var s = _g_s; var index = _g_offset++; - var c = s1.charCodeAt(index); + var c = s.charCodeAt(index); if(c >= 55296 && c <= 56319) { - c = c - 55232 << 10 | s1.charCodeAt(index + 1) & 1023; + c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; } var c1 = c; if(c1 >= 65536) { @@ -380,12 +344,11 @@ StringTools.hex = function(n,digits) { } return s; }; -var _$VideoList_VideoList_$Impl_$ = {}; -_$VideoList_VideoList_$Impl_$.__name__ = true; -_$VideoList_VideoList_$Impl_$._new = function() { +var VideoList = {}; +VideoList._new = function() { return []; }; -_$VideoList_VideoList_$Impl_$.findIndex = function(this1,f) { +VideoList.findIndex = function(this1,f) { var i = 0; var _g = 0; while(_g < this1.length) { @@ -396,14 +359,14 @@ _$VideoList_VideoList_$Impl_$.findIndex = function(this1,f) { } return -1; }; -_$VideoList_VideoList_$Impl_$.addItem = function(this1,item,atEnd,itemPos) { +VideoList.addItem = function(this1,item,atEnd,itemPos) { if(atEnd) { this1.push(item); } else { this1.splice(itemPos + 1,0,item); } }; -_$VideoList_VideoList_$Impl_$.setNextItem = function(this1,pos,itemPos) { +VideoList.setNextItem = function(this1,pos,itemPos) { var next = this1[pos]; HxOverrides.remove(this1,next); if(pos < itemPos) { @@ -412,10 +375,10 @@ _$VideoList_VideoList_$Impl_$.setNextItem = function(this1,pos,itemPos) { this1.splice(itemPos + 1,0,next); return itemPos; }; -_$VideoList_VideoList_$Impl_$.toggleItemType = function(this1,pos) { +VideoList.toggleItemType = function(this1,pos) { this1[pos].isTemp = !this1[pos].isTemp; }; -_$VideoList_VideoList_$Impl_$.removeItem = function(this1,index,itemPos) { +VideoList.removeItem = function(this1,index,itemPos) { if(index < itemPos) { --itemPos; } @@ -425,7 +388,7 @@ _$VideoList_VideoList_$Impl_$.removeItem = function(this1,index,itemPos) { } return itemPos; }; -_$VideoList_VideoList_$Impl_$.skipItem = function(this1,itemPos) { +VideoList.skipItem = function(this1,itemPos) { var item = this1[itemPos]; if(!item.isTemp) { ++itemPos; @@ -441,29 +404,33 @@ var client_Buttons = function() { }; client_Buttons.__name__ = true; client_Buttons.init = function(main) { client_Buttons.settings = main.settings; - window.onresize = client_Buttons.onVideoResize; + if(client_Buttons.settings.isSwapped) { + window.document.body.classList.add("swap"); + } client_Buttons.initSplit(); + client_Buttons.setSplitSize(client_Buttons.settings.playerSize,client_Buttons.settings.chatSize); client_Buttons.initChatInput(main); - client_Buttons.initNavBar(main); var passIcon = window.document.querySelector("#guestpass_icon"); passIcon.onclick = function(e) { - var isOpen = passIcon.classList.toggle("glyphicon-eye-open"); - passIcon.classList.toggle("glyphicon-eye-close"); + var icon = passIcon.firstElementChild; + var isOpen = icon.getAttribute("name") == "eye-off"; var pass = window.document.querySelector("#guestpass"); if(isOpen) { - return pass.type = "password"; + pass.type = "password"; + icon.setAttribute("name","eye"); } else { - return pass.type = "text"; + pass.type = "text"; + icon.setAttribute("name","eye-off"); } }; var smilesBtn = window.document.querySelector("#smilesbtn"); - smilesBtn.onclick = function(e1) { + smilesBtn.onclick = function(e) { var smilesWrap = window.document.querySelector("#smileswrap"); if(smilesWrap.children.length == 0) { return; } if(smilesBtn.classList.toggle("active")) { - smilesWrap.style.display = "block"; + smilesWrap.style.display = "grid"; } else { smilesWrap.style.display = "none"; } @@ -478,20 +445,18 @@ client_Buttons.init = function(main) { child.src = child.dataset.src; child.removeAttribute("data-src"); } - return; }; - window.document.querySelector("#clearchatbtn").onclick = function(e2) { + window.document.querySelector("#clearchatbtn").onclick = function(e) { if((main.personal.group & 4) != 0) { main.send({ type : "ClearChat"}); } - return; }; var userList = window.document.querySelector("#userlist"); - userList.onclick = function(e3) { - if((main.personal.group & 4) == 0) { + userList.onclick = function(e) { + if(!((main.personal.group & 4) != 0)) { return; } - var el = e3.target; + var el = e.target; if(userList == el) { return; } @@ -503,46 +468,29 @@ client_Buttons.init = function(main) { name = el.lastElementChild.innerText; } main.send({ type : "SetLeader", setLeader : { clientName : name}}); - return; }; var userlistToggle = window.document.querySelector("#userlisttoggle"); - userlistToggle.onclick = function(e4) { - var isHidden = userlistToggle.classList.toggle("glyphicon-chevron-right"); - userlistToggle.classList.toggle("glyphicon-chevron-down"); + userlistToggle.onclick = function(e) { + var icon = userlistToggle.firstElementChild; + var isHidden = userlistToggle.classList.toggle("chevron-right"); + userlistToggle.classList.toggle("chevron-down"); var style = window.document.querySelector("#userlist").style; if(isHidden) { style.display = "none"; + icon.setAttribute("name","chevron-forward"); } else { style.display = "block"; + icon.setAttribute("name","chevron-down"); } client_Buttons.settings.isUserListHidden = isHidden; client_Settings.write(client_Buttons.settings); - return; }; window.document.querySelector("#usercount").onclick = userlistToggle.onclick; if(client_Buttons.settings.isUserListHidden) { userlistToggle.onclick(); } - var extendPlayer = window.document.querySelector("#extendplayer"); - extendPlayer.onclick = function(e5) { - var isExtended = extendPlayer.classList.toggle("active"); - var sizes = isExtended ? [20,80] : [40,60]; - window.document.querySelector("#userlist").style.width = isExtended ? "80px" : "90px"; - if(client_Buttons.settings.isSwapped) { - sizes.reverse(); - } - client_Buttons.split.setSizes(sizes); - client_Buttons.settings.isExtendedPlayer = isExtended; - client_Buttons.writeSplitSize(); - window.dispatchEvent(new Event("resize")); - main.scrollChatToEnd(); - return; - }; - if(client_Buttons.settings.isExtendedPlayer) { - extendPlayer.onclick(); - } var toggleSynch = window.document.querySelector("#togglesynch"); - toggleSynch.onclick = function(e6) { + toggleSynch.onclick = function(e) { var icon = toggleSynch.firstElementChild; if(main.isSyncActive) { if(!window.confirm(Lang.get("toggleSynchConfirm"))) { @@ -550,71 +498,81 @@ client_Buttons.init = function(main) { } main.isSyncActive = false; icon.style.color = "rgba(238, 72, 67, 0.75)"; - icon.classList.add("glyphicon-pause"); - icon.classList.remove("glyphicon-play"); + icon.setAttribute("name","pause"); } else { main.isSyncActive = true; icon.style.color = ""; - icon.classList.add("glyphicon-play"); - icon.classList.remove("glyphicon-pause"); + icon.setAttribute("name","play"); main.send({ type : "UpdatePlaylist"}); } - return; }; - window.document.querySelector("#mediarefresh").onclick = function(e7) { + window.document.querySelector("#mediarefresh").onclick = function(e) { main.refreshPlayer(); - return; }; - window.document.querySelector("#fullscreenbtn").onclick = function(e8) { + window.document.querySelector("#fullscreenbtn").onclick = function(e) { return client_Utils.toggleFullScreen(window.document.querySelector("#ytapiplayer")); }; var getPlaylist = window.document.querySelector("#getplaylist"); - getPlaylist.onclick = function(e9) { + getPlaylist.onclick = function(e) { client_Utils.copyToClipboard(main.getPlaylistLinks().join(",")); - var icon1 = getPlaylist.firstElementChild; - icon1.classList.remove("glyphicon-link"); - icon1.classList.add("glyphicon-ok"); + var icon = getPlaylist.firstElementChild; + icon.setAttribute("name","checkmark"); return haxe_Timer.delay(function() { - icon1.classList.add("glyphicon-link"); - icon1.classList.remove("glyphicon-ok"); - return; + icon.setAttribute("name","link"); },2000); }; - window.document.querySelector("#clearplaylist").onclick = function(e10) { + window.document.querySelector("#clearplaylist").onclick = function(e) { if(!window.confirm(Lang.get("clearPlaylistConfirm"))) { return; } main.send({ type : "ClearPlaylist"}); - return; }; - window.document.querySelector("#shuffleplaylist").onclick = function(e11) { + window.document.querySelector("#shuffleplaylist").onclick = function(e) { if(!window.confirm(Lang.get("shufflePlaylistConfirm"))) { return; } main.send({ type : "ShufflePlaylist"}); - return; }; - window.document.querySelector("#lockplaylist").onclick = function(e12) { + window.document.querySelector("#lockplaylist").onclick = function(e) { if((main.personal.group & 4) != 0) { main.send({ type : "TogglePlaylistLock"}); } - return; }; var showMediaUrl = window.document.querySelector("#showmediaurl"); - showMediaUrl.onclick = function(e13) { + showMediaUrl.onclick = function(e) { client_Buttons.showPlayerGroup(showMediaUrl); - return; }; var showCustomEmbed = window.document.querySelector("#showcustomembed"); - showCustomEmbed.onclick = function(e14) { + showCustomEmbed.onclick = function(e) { client_Buttons.showPlayerGroup(showCustomEmbed); - return; }; - window.document.querySelector("#insert_template").onclick = function(e15) { + window.document.querySelector("#insert_template").onclick = function(e) { var input = window.document.querySelector("#mediaurl"); input.value = main.getTemplateUrl(); input.focus(); - return; + }; + var showOptions = window.document.querySelector("#showoptions"); + showOptions.onclick = function(e) { + var isActive = client_Buttons.toggleGroup(showOptions); + window.document.querySelector("#messagebuffer").style.display = isActive ? "none" : "block"; + window.document.querySelector("#chatbox").style.display = isActive ? "none" : "flex"; + window.document.querySelector("#userlisttoggle").style.display = isActive ? "none" : "inline-flex"; + return window.document.querySelector("#optionsTitle").style.display = isActive ? "inline-flex" : "none"; + }; + window.document.querySelector("#exitBtn").onclick = function(e) { + if((main.personal.group & 1) != 0) { + main.send({ type : "Logout"}); + } else { + window.document.querySelector("#guestname").focus(); + } + return client_Buttons.toggleGroup(showOptions); + }; + window.document.querySelector("#swapLayoutBtn").onclick = function(e) { + client_Buttons.settings.isSwapped = window.document.querySelector("body").classList.toggle("swap"); + var sizes = window.document.body.style.gridTemplateColumns.split(" "); + sizes.reverse(); + window.document.body.style.gridTemplateColumns = sizes.join(" "); + client_Settings.write(client_Buttons.settings); }; }; client_Buttons.showPlayerGroup = function(el) { @@ -626,163 +584,65 @@ client_Buttons.showPlayerGroup = function(el) { if(el == group) { continue; } - group.classList.add("collapsed"); - group.classList.remove("active"); - window.document.querySelector(group.dataset.target).classList.add("collapse"); + if(group.classList.contains("collapsed")) { + continue; + } + client_Buttons.toggleGroup(group); } + client_Buttons.toggleGroup(el); +}; +client_Buttons.toggleGroup = function(el) { el.classList.toggle("collapsed"); - el.classList.toggle("active"); - window.document.querySelector(el.dataset.target).classList.toggle("collapse"); + var id = el.dataset.target; + window.document.querySelector(id).classList.toggle("collapse"); + return el.classList.toggle("active"); }; client_Buttons.initSplit = function() { if(client_Buttons.split != null) { client_Buttons.split.destroy(); } - var divs = ["#chatwrap","#videowrap"]; - var sizes = [client_Buttons.settings.chatSize,client_Buttons.settings.playerSize]; - if(client_Buttons.settings.isSwapped) { - divs.reverse(); - sizes.reverse(); - } - client_Buttons.split = new Split(divs,{ sizes : sizes, onDragEnd : function() { - window.dispatchEvent(new Event("resize")); - client_Buttons.writeSplitSize(); - return; - }, minSize : 185, snapOffset : 0}); - window.dispatchEvent(new Event("resize")); + client_Buttons.split = new Split({ columnGutters : [{ element : window.document.querySelector(".gutter"), track : 1}], minSize : 200, snapOffset : 0, onDragEnd : client_Buttons.saveSplitSize}); +}; +client_Buttons.setSplitSize = function(playerSize,chatSize) { + var sizes = window.document.body.style.gridTemplateColumns.split(" "); + sizes[client_Buttons.settings.isSwapped ? sizes.length - 1 : 0] = "" + playerSize + "fr"; + sizes[client_Buttons.settings.isSwapped ? 0 : sizes.length - 1] = "" + chatSize + "fr"; + window.document.body.style.gridTemplateColumns = sizes.join(" "); }; -client_Buttons.writeSplitSize = function() { - var sizes = client_Buttons.split.getSizes(); +client_Buttons.saveSplitSize = function() { + var sizes = window.document.body.style.gridTemplateColumns.split(" "); if(client_Buttons.settings.isSwapped) { sizes.reverse(); } - client_Buttons.settings.chatSize = sizes[0]; - client_Buttons.settings.playerSize = sizes[1]; + client_Buttons.settings.playerSize = parseFloat(sizes[0]); + var tmp = parseFloat(sizes[sizes.length - 1]); + client_Buttons.settings.chatSize = tmp; client_Settings.write(client_Buttons.settings); }; -client_Buttons.onVideoResize = function() { - var height = window.document.querySelector("#ytapiplayer").offsetHeight - window.document.querySelector("#chatline").offsetHeight; - window.document.querySelector("#messagebuffer").style.height = "" + height + "px"; - window.document.querySelector("#userlist").style.height = "" + height + "px"; -}; -client_Buttons.onClick = function(el,func) { - if(!client_Utils.isTouch()) { - el.onclick = func; - } else { - el.ontouchend = func; - } -}; -client_Buttons.initNavBar = function(main) { - var onclick = function(e) { - return window.document.querySelector("#nav-collapsible").classList.toggle("in"); - }; - client_Buttons.onClick(window.document.querySelector("#toggleMenu"),onclick); - var classes = window.document.querySelectorAll(".dropdown-toggle"); - var _g = 0; - while(_g < classes.length) { - var klass = [classes[_g]]; - ++_g; - klass[0].onclick = (function(klass1) { - return function(e1) { - var isActive = klass1[0].classList.toggle("focus"); - client_Buttons.hideMenus(); - var menu = klass1[0].parentElement.querySelector(".dropdown-menu"); - if(isActive) { - return menu.style.display = "block"; - } else { - return menu.style.display = "none"; - } - }; - })(klass); - klass[0].onmouseover = klass[0].onclick; - } - var classes1 = window.document.querySelectorAll(".dropdown"); - var _g1 = 0; - while(_g1 < classes1.length) { - var klass2 = [classes1[_g1]]; - ++_g1; - klass2[0].onmouseleave = (function(klass3) { - return function(e2) { - var toggle = klass3[0].querySelector(".dropdown-toggle"); - toggle.classList.remove("focus"); - toggle.blur(); - return klass3[0].querySelector(".dropdown-menu").style.display = ""; - }; - })(klass2); - } - var exitBtn = window.document.querySelector("#exitBtn"); - exitBtn.onclick = function(e3) { - if((main.personal.group & 1) != 0) { - main.send({ type : "Logout"}); - } else { - window.document.querySelector("#guestname").focus(); - } - exitBtn.blur(); - client_Buttons.hideMenus(); - return; - }; - var swapLayoutBtn = window.document.querySelector("#swapLayoutBtn"); - swapLayoutBtn.onclick = function(e4) { - var p = window.document.querySelector("#main"); - if(window.document.querySelector("#main").firstElementChild == window.document.querySelector("#chatwrap")) { - p.appendChild(p.removeChild(p.children[1])); - p.appendChild(p.removeChild(p.children[0])); - p.appendChild(p.removeChild(p.children[1])); - } else { - p.insertBefore(p.children[2],p.children[0]); - p.insertBefore(p.children[2],p.children[1]); - } - var p1 = window.document.querySelector("#controlsrow"); - p1.insertBefore(p1.children[1],p1.children[0]); - var p2 = window.document.querySelector("#playlistrow"); - p2.insertBefore(p2.children[1],p2.children[0]); - var tmp = window.document.querySelector("#main").firstElementChild; - var tmp1 = window.document.querySelector("#videowrap"); - client_Buttons.settings.isSwapped = tmp == tmp1; - client_Settings.write(client_Buttons.settings); - client_Buttons.initSplit(); - swapLayoutBtn.blur(); - client_Buttons.hideMenus(); - main.scrollChatToEnd(); - return; - }; - if(client_Buttons.settings.isSwapped) { - swapLayoutBtn.onclick(); - } - var removeBtn = window.document.querySelector("#removeVideoBtn"); - removeBtn.onclick = function(e5) { - if(main.toggleVideoElement() || main.isListEmpty()) { - removeBtn.innerText = Lang.get("removeVideo"); - } else { - removeBtn.innerText = Lang.get("addVideo"); - } - removeBtn.blur(); - client_Buttons.hideMenus(); - return; - }; -}; client_Buttons.initTextButtons = function(main) { - var synchThresholdBtn = window.document.querySelector("#synchThresholdBtn"); - synchThresholdBtn.onclick = function(e) { + window.document.querySelector("#synchThresholdBtn").onclick = function(e) { var secs = client_Buttons.settings.synchThreshold + 1; if(secs > 5) { secs = 1; } main.setSynchThreshold(secs); client_Buttons.updateSynchThresholdBtn(); - synchThresholdBtn.blur(); - return; }; client_Buttons.updateSynchThresholdBtn(); - var hotkeysBtn = window.document.querySelector("#hotkeysBtn"); - hotkeysBtn.onclick = function(e1) { + window.document.querySelector("#hotkeysBtn").onclick = function(e) { client_Buttons.settings.hotkeysEnabled = !client_Buttons.settings.hotkeysEnabled; client_Settings.write(client_Buttons.settings); client_Buttons.updateHotkeysBtn(); - hotkeysBtn.blur(); - return; }; client_Buttons.updateHotkeysBtn(); + var removeBtn = window.document.querySelector("#removeVideoBtn"); + removeBtn.onclick = function(e) { + if(main.toggleVideoElement() || main.isListEmpty()) { + return removeBtn.innerText = Lang.get("removeVideo"); + } else { + return removeBtn.innerText = Lang.get("addVideo"); + } + }; }; client_Buttons.initHotkeys = function(main,player) { window.document.querySelector("#mediarefresh").title += " (Alt-R)"; @@ -820,10 +680,9 @@ client_Buttons.initHotkeys = function(main,player) { window.document.querySelector("#leader_btn").onclick(); break; case 80: - if((main.personal.group & 2) == 0) { + if(!((main.personal.group & 2) != 0)) { haxe_Timer.delay(function() { player.pause(); - return; },500); } window.document.querySelector("#leader_btn").onclick(); @@ -840,11 +699,6 @@ client_Buttons.initHotkeys = function(main,player) { e.preventDefault(); }; }; -client_Buttons.hideMenus = function() { - var menus = window.document.querySelectorAll(".dropdown-menu"); - var _g = 0; - while(_g < menus.length) menus[_g++].style.display = ""; -}; client_Buttons.updateSynchThresholdBtn = function() { var tmp = "" + Lang.get("synchThreshold") + ": " + client_Buttons.settings.synchThreshold; window.document.querySelector("#synchThresholdBtn").innerText = tmp + "s"; @@ -860,15 +714,13 @@ client_Buttons.initChatInput = function(main) { if(e.keyCode == 13) { main.guestLogin(guestName.value); } - return; }; var guestPass = window.document.querySelector("#guestpass"); - guestPass.onkeydown = function(e1) { - if(e1.keyCode == 13) { + guestPass.onkeydown = function(e) { + if(e.keyCode == 13) { main.userLogin(guestName.value,guestPass.value); guestPass.value = ""; } - return; }; new client_InputWithHistory(window.document.querySelector("#chatline"),null,50,function(value) { main.send({ type : "Message", message : { clientName : "", text : value}}); @@ -945,7 +797,6 @@ client_JsApi.addPlugin = $hx_exports["client"]["JsApi"]["addPlugin"] = function( onLoaded(); } } - return; }); }; client_JsApi.initPluginsSpace = function() { @@ -1005,19 +856,19 @@ var client_Main = function(host,port) { var _gthis = this; this.player = new client_Player(this); if(host == null) { - host = window.location.hostname; + host = $global.location.hostname; } if(host == "") { host = "localhost"; } this.host = host; if(port == null) { - port = window.location.port; + port = $global.location.port; } if(port == "") { port = "80"; } - client_Settings.init({ version : 2, name : "", hash : "", isExtendedPlayer : false, chatSize : 40, playerSize : 60, synchThreshold : 2, isSwapped : false, isUserListHidden : false, latestLinks : [], hotkeysEnabled : true},$bind(this,this.settingsPatcher)); + client_Settings.init({ version : 2, name : "", hash : "", isExtendedPlayer : false, playerSize : 70, chatSize : 30, synchThreshold : 2, isSwapped : false, isUserListHidden : true, latestLinks : [], hotkeysEnabled : true},$bind(this,this.settingsPatcher)); this.settings = client_Settings.read(); this.initListeners(); this.onTimeGet = new haxe_Timer(this.settings.synchThreshold * 1000); @@ -1028,13 +879,11 @@ var client_Main = function(host,port) { _gthis.onBlinkTab.stop(); _gthis.onBlinkTab = null; } - return; }; Lang.init("langs",function() { client_Buttons.initTextButtons(_gthis); client_Buttons.initHotkeys(_gthis,_gthis.player); _gthis.openWebSocket(host,port); - return; }); }; client_Main.__name__ = true; @@ -1048,9 +897,9 @@ client_Main.prototype = { data.hotkeysEnabled = true; break; case 2: - throw new js__$Boot_HaxeError("skipped version " + version); + throw haxe_Exception.thrown("skipped version " + version); default: - throw new js__$Boot_HaxeError("skipped version " + version); + throw haxe_Exception.thrown("skipped version " + version); } return data; } @@ -1066,7 +915,7 @@ client_Main.prototype = { ,openWebSocket: function(host,port) { var _gthis = this; var protocol = "ws:"; - if(window.location.protocol == "https:") { + if($global.location.protocol == "https:") { protocol = "wss:"; } this.ws = new WebSocket("" + protocol + "//" + host + ":" + port); @@ -1083,55 +932,48 @@ client_Main.prototype = { _gthis.player.pause(); return haxe_Timer.delay(function() { _gthis.openWebSocket(host,port); - return; },2000); }; } ,initListeners: function() { var _gthis = this; client_Buttons.init(this); - client_MobileView.init(); window.document.querySelector("#leader_btn").onclick = function(e) { - _gthis.setLeaderButton((_gthis.personal.group & 2) == 0); + _gthis.setLeaderButton(!((_gthis.personal.group & 2) != 0)); _gthis.send({ type : "SetLeader", setLeader : { clientName : (_gthis.personal.group & 2) != 0 ? "" : _gthis.personal.name}}); - return; }; - window.document.querySelector("#voteskip").onclick = function(e1) { + window.document.querySelector("#voteskip").onclick = function(e) { if(client_Utils.isTouch() && !window.confirm(Lang.get("skipItemConfirm"))) { return; } if(_gthis.player.isListEmpty()) { return; } - _gthis.send({ type : "SkipVideo", skipVideo : { url : _gthis.player.getItems()[_gthis.player.getItemPos()].url}}); - return; + var items = _gthis.player.getItems(); + var pos = _gthis.player.getItemPos(); + _gthis.send({ type : "SkipVideo", skipVideo : { url : items[pos].url}}); }; - window.document.querySelector("#queue_next").onclick = function(e2) { + window.document.querySelector("#queue_next").onclick = function(e) { _gthis.addVideoUrl(false); - return; }; - window.document.querySelector("#queue_end").onclick = function(e3) { + window.document.querySelector("#queue_end").onclick = function(e) { _gthis.addVideoUrl(true); - return; }; new client_InputWithHistory(window.document.querySelector("#mediaurl"),this.settings.latestLinks,10,function(value) { _gthis.addVideoUrl(true); return false; }); - window.document.querySelector("#ce_queue_next").onclick = function(e4) { + window.document.querySelector("#ce_queue_next").onclick = function(e) { _gthis.addIframe(false); - return; }; - window.document.querySelector("#ce_queue_end").onclick = function(e5) { + window.document.querySelector("#ce_queue_end").onclick = function(e) { _gthis.addIframe(true); - return; }; - window.document.querySelector("#customembed-title").onkeydown = function(e6) { - if(e6.keyCode == 13) { + window.document.querySelector("#customembed-title").onkeydown = function(e) { + if(e.keyCode == 13) { _gthis.addIframe(true); - e6.preventDefault(); + e.preventDefault(); } - return; }; window.document.querySelector("#customembed-content").onkeydown = window.document.querySelector("#customembed-title").onkeydown; } @@ -1190,22 +1032,20 @@ client_Main.prototype = { } this.addVideo(links.shift(),atEnd,isTemp,function() { _gthis.addVideoArray(links,atEnd,isTemp); - return; }); } ,addVideo: function(url,atEnd,isTemp,callback) { var _gthis = this; - var protocol = window.location.protocol; + var protocol = $global.location.protocol; if(StringTools.startsWith(url,"/")) { - url = "" + protocol + "//" + window.location.hostname + ":" + window.location.port + url; + url = "" + protocol + "//" + $global.location.hostname + ":" + $global.location.port + url; } if(!StringTools.startsWith(url,"http")) { url = "" + protocol + "//" + url; } this.player.getVideoData(url,function(data) { if(data.duration == 0) { - var tmp = Lang.get("addVideoError"); - _gthis.serverMessage(4,tmp); + _gthis.serverMessage(4,Lang.get("addVideoError")); return; } if(data.title == null) { @@ -1216,7 +1056,6 @@ client_Main.prototype = { } _gthis.send({ type : "AddVideo", addVideo : { item : { url : data.url, title : data.title, author : _gthis.personal.name, duration : data.duration, isTemp : isTemp, isIframe : data.isIframe == true}, atEnd : atEnd}}); callback(); - return; }); } ,addIframe: function(atEnd) { @@ -1233,8 +1072,7 @@ client_Main.prototype = { var isTemp = window.document.querySelector("#customembed").querySelector(".add-temp").checked; this.player.getIframeData(iframe,function(data) { if(data.duration == 0) { - var tmp = Lang.get("addVideoError"); - _gthis.serverMessage(4,tmp); + _gthis.serverMessage(4,Lang.get("addVideoError")); return; } if(title.length > 0) { @@ -1247,7 +1085,6 @@ client_Main.prototype = { data.url = iframe; } _gthis.send({ type : "AddVideo", addVideo : { item : { url : data.url, title : data.title, author : _gthis.personal.name, duration : data.duration, isTemp : isTemp, isIframe : true}, atEnd : atEnd}}); - return; }); } ,toggleVideoElement: function() { @@ -1281,7 +1118,7 @@ client_Main.prototype = { var data = JSON.parse(e.data); var t = data.type; var t1 = t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null); - haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 325, className : "client.Main", methodName : "onMessage", customParams : [data[t1]]}); + haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 324, className : "client.Main", methodName : "onMessage", customParams : [data[t1]]}); switch(data.type) { case "AddVideo": this.player.addVideoItem(data.addVideo.item,data.addVideo.atEnd); @@ -1410,13 +1247,13 @@ client_Main.prototype = { this.player.setPlaybackRate(data.setRate.rate); break; case "SetTime": - var synchThreshold1 = this.settings.synchThreshold; - var newTime1 = data.setTime.time; - var time1 = this.player.getTime(); - if(Math.abs(time1 - newTime1) < synchThreshold1) { + var synchThreshold = this.settings.synchThreshold; + var newTime = data.setTime.time; + var time = this.player.getTime(); + if(Math.abs(time - newTime) < synchThreshold) { return; } - this.player.setTime(newTime1); + this.player.setTime(newTime); break; case "ShufflePlaylist": break; @@ -1522,11 +1359,11 @@ client_Main.prototype = { ++_g; this.filters.push({ regex : new EReg(filter.regex,filter.flags), replace : filter.replace}); } - var _g2 = 0; - var _g3 = config.emotes; - while(_g2 < _g3.length) { - var emote = _g3[_g2]; - ++_g2; + var _g = 0; + var _g1 = config.emotes; + while(_g < _g1.length) { + var emote = _g1[_g]; + ++_g; var tag = StringTools.endsWith(emote.image,"mp4") ? "video autoplay=\"\" loop=\"\" muted=\"\"" : "img"; this.filters.push({ regex : new EReg("(^| )" + this.escapeRegExp(emote.name) + "(?!\\S)","g"), replace : "$1<" + tag + " class=\"channel-emote\" src=\"" + emote.image + "\" title=\"" + emote.name + "\"/>"}); } @@ -1538,20 +1375,19 @@ client_Main.prototype = { var form = window.document.querySelector("#chatline"); form.value += " " + el.title; form.focus(); - return; }; smilesWrap.textContent = ""; - var _g4 = 0; - var _g5 = config.emotes; - while(_g4 < _g5.length) { - var emote1 = _g5[_g4]; - ++_g4; - var tag1 = StringTools.endsWith(emote1.image,"mp4") ? "video" : "img"; - var el1 = window.document.createElement(tag1); - el1.className = "smile-preview"; - el1.dataset.src = emote1.image; - el1.title = emote1.name; - smilesWrap.appendChild(el1); + var _g = 0; + var _g1 = config.emotes; + while(_g < _g1.length) { + var emote = _g1[_g]; + ++_g; + var tag = StringTools.endsWith(emote.image,"mp4") ? "video" : "img"; + var el = window.document.createElement(tag); + el.className = "smile-preview"; + el.dataset.src = emote.image; + el.title = emote.name; + smilesWrap.appendChild(el); } } ,onLogin: function(data,clientName) { @@ -1564,16 +1400,16 @@ client_Main.prototype = { this.hideGuestLoginPanel(); } ,showGuestLoginPanel: function() { - window.document.querySelector("#guestlogin").style.display = "block"; + window.document.querySelector("#guestlogin").style.display = "flex"; window.document.querySelector("#guestpassword").style.display = "none"; - window.document.querySelector("#chatline").style.display = "none"; + window.document.querySelector("#chatbox").style.display = "none"; window.document.querySelector("#exitBtn").textContent = Lang.get("login"); window.dispatchEvent(new Event("resize")); } ,hideGuestLoginPanel: function() { window.document.querySelector("#guestlogin").style.display = "none"; window.document.querySelector("#guestpassword").style.display = "none"; - window.document.querySelector("#chatline").style.display = "block"; + window.document.querySelector("#chatbox").style.display = "flex"; window.document.querySelector("#exitBtn").textContent = Lang.get("exit"); if((this.personal.group & 4) != 0) { window.document.querySelector("#clearchatbtn").style.display = "inline-block"; @@ -1582,11 +1418,10 @@ client_Main.prototype = { } ,showGuestPasswordPanel: function() { window.document.querySelector("#guestlogin").style.display = "none"; - window.document.querySelector("#chatline").style.display = "none"; - window.document.querySelector("#guestpassword").style.display = "block"; + window.document.querySelector("#chatbox").style.display = "none"; + window.document.querySelector("#guestpassword").style.display = "flex"; window.document.querySelector("#guestpass").type = "password"; - window.document.querySelector("#guestpass_icon").classList.add("glyphicon-eye-open"); - window.document.querySelector("#guestpass_icon").classList.remove("glyphicon-eye-close"); + window.document.querySelector("#guestpass_icon").setAttribute("name","eye"); } ,updateClients: function(newClients) { this.clients.length = 0; @@ -1606,7 +1441,7 @@ client_Main.prototype = { } var msgBuf = window.document.querySelector("#messagebuffer"); var div = window.document.createElement("div"); - var time = "[" + HxOverrides.dateStr(new Date()).split(" ")[1] + "] "; + var time = HxOverrides.dateStr(new Date()).split(" ")[1]; switch(type) { case 1: div.className = "server-msg-reconnect"; @@ -1622,10 +1457,12 @@ client_Main.prototype = { break; case 4: div.className = "server-whisper"; + div.innerHTML = "
\n\t\t\t\t\t
\n\t\t\t\t\t" + time + "\n\t\t\t\t
"; + var textDiv = div.querySelector(".server-whisper"); if(isText) { - div.textContent = time + text; + textDiv.textContent = text; } else { - div.innerHTML = time + text; + textDiv.innerHTML = text; } break; default: @@ -1640,13 +1477,13 @@ client_Main.prototype = { var _g = 0; var _g1 = this.clients; while(_g < _g1.length) { - var client1 = _g1[_g]; + var client = _g1[_g]; ++_g; list_b += "
"; - if((client1.group & 2) != 0) { - list_b += ""; + if((client.group & 2) != 0) { + list_b += ""; } - list_b += Std.string("" + client1.name + "
"); + list_b += Std.string("" + client.name + ""); } window.document.querySelector("#userlist").innerHTML = list_b; } @@ -1660,16 +1497,19 @@ client_Main.prototype = { var msgBuf = window.document.querySelector("#messagebuffer"); var userDiv = window.document.createElement("div"); userDiv.className = "chat-msg-" + name; + var headDiv = window.document.createElement("div"); + headDiv.className = "head"; var tstamp = window.document.createElement("span"); tstamp.className = "timestamp"; if(time == null) { - time = "[" + HxOverrides.dateStr(new Date()).split(" ")[1] + "] "; + time = HxOverrides.dateStr(new Date()).split(" ")[1]; } tstamp.textContent = time; var nameDiv = window.document.createElement("strong"); nameDiv.className = "username"; - nameDiv.textContent = name + ": "; - var textDiv = window.document.createElement("span"); + nameDiv.textContent = name; + var textDiv = window.document.createElement("div"); + textDiv.className = "text"; text = StringTools.htmlEscape(text); if(StringTools.startsWith(text,"/")) { if(name == this.personal.name) { @@ -1687,15 +1527,16 @@ client_Main.prototype = { textDiv.innerHTML = text; var isInChatEnd = msgBuf.scrollTop + msgBuf.clientHeight >= msgBuf.scrollHeight - 1; if(isInChatEnd) { - var _g2 = 0; - var _g11 = textDiv.getElementsByTagName("img"); - while(_g2 < _g11.length) _g11[_g2++].onload = $bind(this,this.onChatImageLoaded); - var _g21 = 0; - var _g3 = textDiv.getElementsByTagName("video"); - while(_g21 < _g3.length) _g3[_g21++].onloadedmetadata = $bind(this,this.onChatVideoLoaded); - } - userDiv.appendChild(tstamp); - userDiv.appendChild(nameDiv); + var _g = 0; + var _g1 = textDiv.getElementsByTagName("img"); + while(_g < _g1.length) _g1[_g++].onload = $bind(this,this.onChatImageLoaded); + var _g = 0; + var _g1 = textDiv.getElementsByTagName("video"); + while(_g < _g1.length) _g1[_g++].onloadedmetadata = $bind(this,this.onChatVideoLoaded); + } + userDiv.appendChild(headDiv); + headDiv.appendChild(nameDiv); + headDiv.appendChild(tstamp); userDiv.appendChild(textDiv); msgBuf.appendChild(userDiv); if(isInChatEnd) { @@ -1749,20 +1590,16 @@ client_Main.prototype = { } this.onBlinkTab = new haxe_Timer(1000); this.onBlinkTab.run = function() { - if(StringTools.startsWith(window.document.title,_gthis.pageTitle)) { - return window.document.title = title; - } else { - return window.document.title = _gthis.getPageTitle(); - } + window.document.title = StringTools.startsWith(window.document.title,_gthis.pageTitle) ? title : _gthis.getPageTitle(); }; this.onBlinkTab.run(); } ,setLeaderButton: function(flag) { var leaderBtn = window.document.querySelector("#leader_btn"); if(flag) { - leaderBtn.classList.add("label-success"); + leaderBtn.classList.add("success-bg"); } else { - leaderBtn.classList.remove("label-success"); + leaderBtn.classList.remove("success-bg"); } } ,setPlaylistLock: function(isOpen) { @@ -1771,15 +1608,15 @@ client_Main.prototype = { if(isOpen) { lockPlaylist.title = Lang.get("playlistOpen"); lockPlaylist.classList.add("btn-success"); - lockPlaylist.classList.remove("btn-danger"); - icon.classList.add("glyphicon-ok"); - icon.classList.remove("glyphicon-lock"); + lockPlaylist.classList.add("success"); + lockPlaylist.classList.remove("danger"); + icon.setAttribute("name","lock-open"); } else { lockPlaylist.title = Lang.get("playlistLocked"); lockPlaylist.classList.add("btn-danger"); - lockPlaylist.classList.remove("btn-success"); - icon.classList.add("glyphicon-lock"); - icon.classList.remove("glyphicon-ok"); + lockPlaylist.classList.add("danger"); + lockPlaylist.classList.remove("success"); + icon.setAttribute("name","lock-closed"); } } ,setSynchThreshold: function(s) { @@ -1800,29 +1637,6 @@ client_Main.prototype = { return regex.replace(_this_r,"\\$1"); } }; -var client_MobileView = function() { }; -client_MobileView.__name__ = true; -client_MobileView.init = function() { - var mvbtn = window.document.querySelector("#mv_btn"); - mvbtn.onclick = function(e) { - var hasMobileView = client_Utils.toggleFullScreen(window.document.documentElement); - var vwrap = window.document.querySelector("#videowrap"); - if(hasMobileView) { - window.document.body.classList.add("mobile-view"); - mvbtn.classList.add("active"); - if(vwrap.children[0].id == "currenttitle") { - vwrap.appendChild(vwrap.children[0]); - } - } else { - window.document.body.classList.remove("mobile-view"); - mvbtn.classList.remove("active"); - if(vwrap.children[0].id != "currenttitle") { - vwrap.insertBefore(vwrap.children[1],vwrap.children[0]); - } - } - return; - }; -}; var client_Player = function(main) { this.skipSetRate = false; this.skipSetTime = false; @@ -1830,7 +1644,7 @@ var client_Player = function(main) { this.itemPos = 0; this.playerEl = window.document.querySelector("#ytapiplayer"); this.videoItemsEl = window.document.querySelector("#queue"); - this.items = _$VideoList_VideoList_$Impl_$._new(); + this.items = VideoList._new(); this.main = main; this.players = [new client_players_Youtube(main,this)]; this.iframePlayer = new client_players_Iframe(main,this); @@ -1857,17 +1671,16 @@ client_Player.prototype = { if(btn.classList.contains("qbtn-delete")) { _gthis.main.send({ type : "RemoveVideo", removeVideo : { url : item.querySelector(".qe_title").getAttribute("href")}}); } - return; }; } ,setNextItem: function(pos) { - this.itemPos = _$VideoList_VideoList_$Impl_$.setNextItem(this.items,pos,this.itemPos); + this.itemPos = VideoList.setNextItem(this.items,pos,this.itemPos); var next = this.videoItemsEl.children[pos]; this.videoItemsEl.removeChild(next); client_Utils.insertAtIndex(this.videoItemsEl,next,this.itemPos + 1); } ,toggleItemType: function(pos) { - _$VideoList_VideoList_$Impl_$.toggleItemType(this.items,pos); + VideoList.toggleItemType(this.items,pos); this.setItemElementType(this.videoItemsEl.children[pos],this.items[pos].isTemp); } ,setPlayer: function(newPlayer) { @@ -1881,8 +1694,8 @@ client_Player.prototype = { this.player = newPlayer; } ,getVideoData: function(url,callback) { - var player = Lambda.find(this.players,function(player1) { - return player1.isSupportedLink(url); + var player = Lambda.find(this.players,function(player) { + return player.isSupportedLink(url); }); if(player == null) { player = this.rawPlayer; @@ -1930,13 +1743,13 @@ client_Player.prototype = { this.isLoaded = true; } ,onPlay: function() { - if((this.main.personal.group & 2) == 0) { + if(!((this.main.personal.group & 2) != 0)) { return; } this.main.send({ type : "Play", play : { time : this.getTime()}}); } ,onPause: function() { - if((this.main.personal.group & 2) == 0) { + if(!((this.main.personal.group & 2) != 0)) { return; } this.main.send({ type : "Pause", pause : { time : this.getTime()}}); @@ -1946,7 +1759,7 @@ client_Player.prototype = { this.skipSetTime = false; return; } - if((this.main.personal.group & 2) == 0) { + if(!((this.main.personal.group & 2) != 0)) { return; } this.main.send({ type : "SetTime", setTime : { time : this.getTime()}}); @@ -1956,15 +1769,15 @@ client_Player.prototype = { this.skipSetRate = false; return; } - if((this.main.personal.group & 2) == 0) { + if(!((this.main.personal.group & 2) != 0)) { return; } this.main.send({ type : "SetRate", setRate : { rate : this.getPlaybackRate()}}); } ,addVideoItem: function(item,atEnd) { var url = StringTools.htmlEscape(item.url,true); - var itemEl = client_Utils.nodeFromString("
  • \n\t\t\t\t" + StringTools.htmlEscape(item.title) + "\n\t\t\t\t" + this.duration(item.duration) + "\n\t\t\t\t
    \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
  • "); - _$VideoList_VideoList_$Impl_$.addItem(this.items,item,atEnd,this.itemPos); + var itemEl = client_Utils.nodeFromString("
  • \n\t\t\t\t
    \n\t\t\t\t\t" + this.duration(item.duration) + "\n\t\t\t\t\t

    " + StringTools.htmlEscape(item.title) + "

    \n\t\t\t\t
    \n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
  • "); + VideoList.addItem(this.items,item,atEnd,this.itemPos); this.setItemElementType(itemEl,item.isTemp); if(atEnd) { this.videoItemsEl.appendChild(itemEl); @@ -1974,8 +1787,9 @@ client_Player.prototype = { this.updateCounters(); } ,setItemElementType: function(item,isTemp) { - var text = isTemp ? Lang.get("makePermanent") : Lang.get("makeTemporary"); - item.querySelector(".qbtn-tmp").innerHTML = "" + text; + var btn = item.querySelector(".qbtn-tmp"); + btn.title = isTemp ? Lang.get("makePermanent") : Lang.get("makeTemporary"); + btn.firstElementChild.setAttribute("name",isTemp ? "lock-open" : "lock-closed"); if(isTemp) { item.classList.add("queue_temp"); } else { @@ -1984,14 +1798,14 @@ client_Player.prototype = { } ,removeItem: function(url) { this.removeElementItem(url); - var index = _$VideoList_VideoList_$Impl_$.findIndex(this.items,function(item) { + var index = VideoList.findIndex(this.items,function(item) { return item.url == url; }); if(index == -1) { return; } var isCurrent = this.items[this.itemPos].url == url; - this.itemPos = _$VideoList_VideoList_$Impl_$.removeItem(this.items,index,this.itemPos); + this.itemPos = VideoList.removeItem(this.items,index,this.itemPos); this.updateCounters(); if(isCurrent && this.items.length > 0) { this.setVideo(this.itemPos); @@ -2010,7 +1824,7 @@ client_Player.prototype = { } } ,skipItem: function(url) { - var index = _$VideoList_VideoList_$Impl_$.findIndex(this.items,function(item) { + var index = VideoList.findIndex(this.items,function(item) { return item.url == url; }); if(index == -1) { @@ -2019,7 +1833,7 @@ client_Player.prototype = { if(this.items[index].isTemp) { this.removeElementItem(url); } - index = _$VideoList_VideoList_$Impl_$.skipItem(this.items,index); + index = VideoList.skipItem(this.items,index); this.updateCounters(); if(this.items.length == 0) { return; @@ -2073,18 +1887,18 @@ client_Player.prototype = { var h = time / 60 / 60 | 0; var m = (time / 60 | 0) - h * 60; var s = time % 60 | 0; - var time1 = "" + m + ":"; + var time = "" + m + ":"; if(m < 10) { - time1 = "0" + time1; + time = "0" + time; } if(h > 0) { - time1 = "" + h + ":" + time1; + time = "" + h + ":" + time; } if(s < 10) { - time1 += "0"; + time += "0"; } - time1 += s; - return time1; + time += s; + return time; } ,totalDuration: function() { var time = 0.0; @@ -2205,7 +2019,7 @@ client_Settings.read = function() { }; client_Settings.checkData = function(data) { if(client_Settings.defaults == null) { - throw new js__$Boot_HaxeError("read: default data is null"); + throw haxe_Exception.thrown("read: default data is null"); } if(data == null) { return client_Settings.defaults; @@ -2214,10 +2028,10 @@ client_Settings.checkData = function(data) { return data; } if(data.version > client_Settings.defaults.version) { - throw new js__$Boot_HaxeError("read: current data version is larger than default data version"); + throw haxe_Exception.thrown("read: current data version is larger than default data version"); } if(client_Settings.updater == null) { - throw new js__$Boot_HaxeError("read: updater function is null"); + throw haxe_Exception.thrown("read: updater function is null"); } while(data.version < client_Settings.defaults.version) { data = client_Settings.updater(data,data.version); @@ -2392,8 +2206,7 @@ client_players_Raw.prototype = { } ,getVideoData: function(url,callback) { var _gthis = this; - var pos = url.lastIndexOf("/") + 1; - var title = HxOverrides.substr(url,pos,null); + var title = HxOverrides.substr(url,url.lastIndexOf("/") + 1,null); if(this.matchName.match(title)) { title = this.matchName.matched(1); } else { @@ -2403,7 +2216,6 @@ client_players_Raw.prototype = { if(isHls && !this.isHlsLoaded) { this.loadHlsPlugin(function() { _gthis.getVideoData(url,callback); - return; }); return; } @@ -2414,14 +2226,12 @@ client_players_Raw.prototype = { _gthis.playerEl.removeChild(video); } callback({ duration : 0}); - return; }; video.onloadedmetadata = function() { if(_gthis.playerEl.contains(video)) { _gthis.playerEl.removeChild(video); } callback({ duration : video.duration, title : title}); - return; }; client_Utils.prepend(this.playerEl,video); if(isHls) { @@ -2433,7 +2243,6 @@ client_players_Raw.prototype = { client_JsApi.addScriptToHead("https://cdn.jsdelivr.net/npm/hls.js@latest",function() { _gthis.isHlsLoaded = true; callback(); - return; }); } ,initHlsSource: function(video,url) { @@ -2451,7 +2260,6 @@ client_players_Raw.prototype = { if(isHls && !this.isHlsLoaded) { this.loadHlsPlugin(function() { _gthis.loadVideo(item); - return; }); return; } @@ -2472,7 +2280,6 @@ client_players_Raw.prototype = { this.video.onplay = function(e) { _gthis.playAllowed = true; _gthis.player.onPlay(); - return; }; this.video.onpause = ($_=this.player,$bind($_,$_.onPause)); this.video.onratechange = ($_=this.player,$bind($_,$_.onRateChange)); @@ -2491,7 +2298,7 @@ client_players_Raw.prototype = { this.controlsHider.stop(); } this.controlsHider = haxe_Timer.delay(function() { - return _gthis.video.controls = false; + _gthis.video.controls = false; },3000); this.video.onmousemove = function(e) { if(_gthis.controlsHider != null) { @@ -2637,11 +2444,9 @@ client_players_Youtube.prototype = { } callback({ duration : duration, title : title, url : url}); } - return; }; http.onError = function(msg) { _gthis.getRemoteDataFallback(url,callback); - return; }; http.request(); } @@ -2663,21 +2468,18 @@ client_players_Youtube.prototype = { } var loadNextItem = null; loadNextItem = function() { - var loadNextItem1 = "youtu.be/" + items.shift().snippet.resourceId.videoId; - _gthis.getVideoData(loadNextItem1,function(data1) { - callback(data1); + var id = items.shift().snippet.resourceId.videoId; + _gthis.getVideoData("youtu.be/" + id,function(data) { + callback(data); if(items.length > 0) { loadNextItem(); } - return; }); }; loadNextItem(); - return; }; http.onError = function(msg) { callback({ duration : 0}); - return; }; http.request(); } @@ -2689,7 +2491,6 @@ client_players_Youtube.prototype = { if(!js_youtube_Youtube.isLoadedAPI) { js_youtube_Youtube.init(function() { _gthis.getRemoteDataFallback(url,callback); - return; }); return; } @@ -2700,16 +2501,13 @@ client_players_Youtube.prototype = { if(_gthis.playerEl.contains(video)) { _gthis.playerEl.removeChild(video); } - var tmp = _gthis.tempYoutube.getDuration(); - callback({ duration : tmp}); - return; - }, onError : function(e1) { - haxe_Log.trace("Error " + e1.data,{ fileName : "src/client/players/Youtube.hx", lineNumber : 183, className : "client.players.Youtube", methodName : "getRemoteDataFallback"}); + callback({ duration : _gthis.tempYoutube.getDuration()}); + }, onError : function(e) { + haxe_Log.trace("Error " + e.data,{ fileName : "src/client/players/Youtube.hx", lineNumber : 183, className : "client.players.Youtube", methodName : "getRemoteDataFallback"}); if(_gthis.playerEl.contains(video)) { _gthis.playerEl.removeChild(video); } callback({ duration : 0}); - return; }}}); } ,loadVideo: function(item) { @@ -2717,7 +2515,6 @@ client_players_Youtube.prototype = { if(!js_youtube_Youtube.isLoadedAPI) { js_youtube_Youtube.init(function() { _gthis.loadVideo(item); - return; }); return; } @@ -2732,9 +2529,8 @@ client_players_Youtube.prototype = { this.youtube = new YT.Player(this.video.id,{ videoId : this.extractVideoId(item.url), playerVars : { autoplay : 1, modestbranding : 1, rel : 0, showinfo : 0}, events : { onReady : function(e) { _gthis.isLoaded = true; _gthis.youtube.pauseVideo(); - return; - }, onStateChange : function(e1) { - switch(e1.data) { + }, onStateChange : function(e) { + switch(e.data) { case -1: _gthis.player.onCanBePlayed(); break; @@ -2752,10 +2548,8 @@ client_players_Youtube.prototype = { case 5: break; } - return; - }, onPlaybackRateChange : function(e2) { + }, onPlaybackRateChange : function(e) { _gthis.player.onRateChange(); - return; }}}); } ,removeVideo: function() { @@ -2792,6 +2586,41 @@ client_players_Youtube.prototype = { this.youtube.setPlaybackRate(rate); } }; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } +}); var haxe_Log = function() { }; haxe_Log.__name__ = true; haxe_Log.formatOutput = function(v,infos) { @@ -2839,6 +2668,17 @@ haxe_Timer.prototype = { ,run: function() { } }; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); var haxe_crypto_Sha256 = function() { }; haxe_crypto_Sha256.__name__ = true; @@ -2853,14 +2693,14 @@ haxe_crypto_Sha256.str2blks = function(s) { var _g = 0; var _g1 = nblk * 16; while(_g < _g1) blks[_g++] = 0; - var _g2 = 0; - var _g3 = s1.length; - while(_g2 < _g3) { - var i = _g2++; + var _g = 0; + var _g1 = s1.length; + while(_g < _g1) { + var i = _g++; blks[i >> 2] |= s1.b[i] << 24 - ((i & 3) << 3); } - var i1 = s1.length; - blks[i1 >> 2] |= 128 << 24 - ((i1 & 3) << 3); + var i = s1.length; + blks[i >> 2] |= 128 << 24 - ((i & 3) << 3); blks[nblk * 16 - 1] = s1.length * 8; return blks; }; @@ -3027,11 +2867,11 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{ var s; try { s = r.status; - } catch( e ) { + } catch( _g ) { s = null; } - if(s == 0 && typeof(window) != "undefined") { - var protocol = window.location.protocol.toLowerCase(); + if(s == 0 && typeof(window) != "undefined" && $global.location != null) { + var protocol = $global.location.protocol.toLowerCase(); if(new EReg("^(?:about|app|app-storage|.+-extension|file|res|widget):$","").match(protocol)) { s = r.response != null ? 200 : 404; } @@ -3044,14 +2884,14 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{ } if(s != null && s >= 200 && s < 400) { _gthis.req = null; - var onreadystatechange1 = haxe_io_Bytes.ofData(r.response); - _gthis.success(onreadystatechange1); - } else if(s == null) { + _gthis.success(haxe_io_Bytes.ofData(r.response)); + } else if(s == null || s == 0 && r.response == null) { _gthis.req = null; _gthis.onError("Failed to connect or resolve host"); } else if(s == null) { _gthis.req = null; - _gthis.responseBytes = haxe_io_Bytes.ofData(r.response); + var onreadystatechange = r.response != null ? haxe_io_Bytes.ofData(r.response) : null; + _gthis.responseBytes = onreadystatechange; _gthis.onError("Http Error #" + r.status); } else { switch(s) { @@ -3065,7 +2905,8 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{ break; default: _gthis.req = null; - _gthis.responseBytes = haxe_io_Bytes.ofData(r.response); + var onreadystatechange = r.response != null ? haxe_io_Bytes.ofData(r.response) : null; + _gthis.responseBytes = onreadystatechange; _gthis.onError("Http Error #" + r.status); } } @@ -3079,36 +2920,36 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{ if(uri != null) { post = true; } else { - var _g2 = 0; - var _g3 = this.params; - while(_g2 < _g3.length) { - var p = _g3[_g2]; - ++_g2; + var _g = 0; + var _g1 = this.params; + while(_g < _g1.length) { + var p = _g1[_g]; + ++_g; if(uri == null) { uri = ""; } else { - uri = Std.string(uri) + "&"; + uri = (uri == null ? "null" : Std.string(uri)) + "&"; } - var s1 = p.name; - var value = Std.string(uri) + encodeURIComponent(s1) + "="; - var s2 = p.value; - uri = value + encodeURIComponent(s2); + var s = p.name; + var value = (uri == null ? "null" : Std.string(uri)) + encodeURIComponent(s) + "="; + var s1 = p.value; + uri = value + encodeURIComponent(s1); } } try { if(post) { r.open("POST",this.url,this.async); } else if(uri != null) { - r.open("GET",this.url + (this.url.split("?").length <= 1 ? "?" : "&") + Std.string(uri),this.async); + r.open("GET",this.url + (this.url.split("?").length <= 1 ? "?" : "&") + (uri == null ? "null" : Std.string(uri)),this.async); uri = null; } else { r.open("GET",this.url,this.async); } r.responseType = "arraybuffer"; - } catch( e1 ) { - var e2 = ((e1) instanceof js__$Boot_HaxeError) ? e1.val : e1; + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); this.req = null; - this.onError(e2.toString()); + this.onError(_g1.toString()); return; } r.withCredentials = this.withCredentials; @@ -3117,12 +2958,12 @@ haxe_http_HttpJs.prototype = $extend(haxe_http_HttpBase.prototype,{ }) && post && this.postData == null) { r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); } - var _g21 = 0; - var _g31 = this.headers; - while(_g21 < _g31.length) { - var h1 = _g31[_g21]; - ++_g21; - r.setRequestHeader(h1.name,h1.value); + var _g = 0; + var _g1 = this.headers; + while(_g < _g1.length) { + var h = _g1[_g]; + ++_g; + r.setRequestHeader(h.name,h.value); } r.send(uri); if(!this.async) { @@ -3152,26 +2993,26 @@ haxe_io_Bytes.ofString = function(s,encoding) { return new haxe_io_Bytes(buf.buffer); } var a = []; - var i1 = 0; - while(i1 < s.length) { - var c1 = s.charCodeAt(i1++); - if(55296 <= c1 && c1 <= 56319) { - c1 = c1 - 55232 << 10 | s.charCodeAt(i1++) & 1023; - } - if(c1 <= 127) { - a.push(c1); - } else if(c1 <= 2047) { - a.push(192 | c1 >> 6); - a.push(128 | c1 & 63); - } else if(c1 <= 65535) { - a.push(224 | c1 >> 12); - a.push(128 | c1 >> 6 & 63); - a.push(128 | c1 & 63); + var i = 0; + while(i < s.length) { + var c = s.charCodeAt(i++); + if(55296 <= c && c <= 56319) { + c = c - 55232 << 10 | s.charCodeAt(i++) & 1023; + } + if(c <= 127) { + a.push(c); + } else if(c <= 2047) { + a.push(192 | c >> 6); + a.push(128 | c & 63); + } else if(c <= 65535) { + a.push(224 | c >> 12); + a.push(128 | c >> 6 & 63); + a.push(128 | c & 63); } else { - a.push(240 | c1 >> 18); - a.push(128 | c1 >> 12 & 63); - a.push(128 | c1 >> 6 & 63); - a.push(128 | c1 & 63); + a.push(240 | c >> 18); + a.push(128 | c >> 12 & 63); + a.push(128 | c >> 6 & 63); + a.push(128 | c & 63); } } return new haxe_io_Bytes(new Uint8Array(a).buffer); @@ -3186,7 +3027,7 @@ haxe_io_Bytes.ofData = function(b) { haxe_io_Bytes.prototype = { getString: function(pos,len,encoding) { if(pos < 0 || len < 0 || pos + len > this.length) { - throw new js__$Boot_HaxeError(haxe_io_Error.OutsideBounds); + throw haxe_Exception.thrown(haxe_io_Error.OutsideBounds); } if(encoding == null) { encoding = haxe_io_Encoding.UTF8; @@ -3218,8 +3059,8 @@ haxe_io_Bytes.prototype = { break; case 1: while(i < max) { - var c1 = b[i++] | b[i++] << 8; - s += String.fromCodePoint(c1); + var c = b[i++] | b[i++] << 8; + s += String.fromCodePoint(c); } break; } @@ -3275,17 +3116,19 @@ haxe_io_Path.prototype = { return (this.dir == null ? "" : this.dir + (this.backslash ? "\\" : "/")) + this.file + (this.ext == null ? "" : "." + this.ext); } }; -var js__$Boot_HaxeError = function(val) { - Error.call(this); - this.val = val; - if(Error.captureStackTrace) { - Error.captureStackTrace(this,js__$Boot_HaxeError); +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; } }; -js__$Boot_HaxeError.__name__ = true; -js__$Boot_HaxeError.__super__ = Error; -js__$Boot_HaxeError.prototype = $extend(Error.prototype,{ -}); var js_Boot = function() { }; js_Boot.__name__ = true; js_Boot.__string_rec = function(o,s) { @@ -3334,10 +3177,10 @@ js_Boot.__string_rec = function(o,s) { if(((o) instanceof Array)) { var str = "["; s += "\t"; - var _g3 = 0; - var _g11 = o.length; - while(_g3 < _g11) { - var i = _g3++; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); } str += "]"; @@ -3346,8 +3189,7 @@ js_Boot.__string_rec = function(o,s) { var tostr; try { tostr = o.toString; - } catch( e1 ) { - var e2 = ((e1) instanceof js__$Boot_HaxeError) ? e1.val : e1; + } catch( _g ) { return "???"; } if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { @@ -3356,7 +3198,7 @@ js_Boot.__string_rec = function(o,s) { return s2; } } - var str1 = "{\n"; + var str = "{\n"; s += "\t"; var hasp = o.hasOwnProperty != null; var k = null; @@ -3367,14 +3209,14 @@ js_Boot.__string_rec = function(o,s) { if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { continue; } - if(str1.length != 2) { - str1 += ", \n"; + if(str.length != 2) { + str += ", \n"; } - str1 += s + k + " : " + js_Boot.__string_rec(o[k],s); + str += s + k + " : " + js_Boot.__string_rec(o[k],s); } s = s.substring(1); - str1 += "\n" + s + "}"; - return str1; + str += "\n" + s + "}"; + return str; case "string": return o; default: @@ -3393,7 +3235,7 @@ js_Browser.getLocalStorage = function() { s.removeItem(key); } return s; - } catch( e ) { + } catch( _g ) { return null; } }; @@ -3404,7 +3246,7 @@ js_Browser.createXMLHttpRequest = function() { if(typeof ActiveXObject != "undefined") { return new ActiveXObject("Microsoft.XMLHTTP"); } - throw new js__$Boot_HaxeError("Unable to create XMLHttpRequest object."); + throw haxe_Exception.thrown("Unable to create XMLHttpRequest object."); }; var js_hlsjs_HlsConfig = function() { }; js_hlsjs_HlsConfig.__name__ = true; @@ -3422,21 +3264,20 @@ js_youtube_Youtube.init = function(onAPIReady) { } }; }; -function $getIterator(o) { if( o instanceof Array ) return HxOverrides.iter(o); else return o.iterator(); } +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } $global.$haxeUID |= 0; -var __map_reserved = {}; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } String.__name__ = true; Array.__name__ = true; Date.__name__ = "Date"; -Object.defineProperty(js__$Boot_HaxeError.prototype,"message",{ get : function() { - return String(this.val); -}}); js_Boot.__toStr = ({ }).toString; Lang.langs = new haxe_ds_StringMap(); Lang.ids = ["en","ru"]; -Lang.lang = HxOverrides.substr(window.navigator.language,0,2).toLowerCase(); +Lang.lang = HxOverrides.substr($global.navigator.language,0,2).toLowerCase(); client_JsApi.videoChange = []; client_JsApi.videoRemove = []; client_Settings.isSupported = false; -- cgit v1.2.3