From 03d02b3282e950e77a3959277c93d554c23b8e60 Mon Sep 17 00:00:00 2001 From: RblSb Date: Thu, 17 Dec 2020 21:37:20 +0300 Subject: youtubePlaylistLimit setting closes #12 --- res/client.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'res') diff --git a/res/client.js b/res/client.js index c3e9d60..5e4f8b3 100644 --- a/res/client.js +++ b/res/client.js @@ -1,4 +1,4 @@ -// Generated by Haxe 4.1.1 +// Generated by Haxe 4.1.4 (function ($hx_exports, $global) { "use strict"; $hx_exports["client"] = $hx_exports["client"] || {}; $hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {}; @@ -453,7 +453,7 @@ client_Buttons.init = function(main) { }; var userList = window.document.querySelector("#userlist"); userList.onclick = function(e) { - if(!((main.personal.group & 4) != 0)) { + if((main.personal.group & 4) == 0) { return; } var el = e.target; @@ -684,7 +684,7 @@ 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) { client_JsApi.once("SetLeader",function(event) { if(event.setLeader.clientName == main.personal.name) { player.pause(); @@ -1003,7 +1003,7 @@ client_Main.prototype = { var _gthis = this; client_Buttons.init(this); 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}}); }; window.document.querySelector("#voteskip").onclick = function(e) { @@ -1670,7 +1670,11 @@ client_Main.prototype = { } this.onBlinkTab = new haxe_Timer(1000); this.onBlinkTab.run = function() { - window.document.title = StringTools.startsWith(window.document.title,_gthis.pageTitle) ? title : _gthis.getPageTitle(); + if(StringTools.startsWith(window.document.title,_gthis.pageTitle)) { + window.document.title = title; + } else { + window.document.title = _gthis.getPageTitle(); + } }; this.onBlinkTab.run(); } @@ -1712,6 +1716,9 @@ client_Main.prototype = { ,getYoutubeApiKey: function() { return this.config.youtubeApiKey; } + ,getYoutubePlaylistLimit: function() { + return this.config.youtubePlaylistLimit; + } ,isVerbose: function() { return this.config.isVerbose; } @@ -1848,13 +1855,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()}}); @@ -1864,7 +1871,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()}}); @@ -1874,7 +1881,7 @@ 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()}}); @@ -2571,7 +2578,8 @@ client_players_Youtube.prototype = { ,getPlaylistVideoData: function(data,callback) { var _gthis = this; var id = this.extractPlaylistId(data.url); - var http = new haxe_http_HttpJs("" + this.playlistUrl + this.urlVideoId + "&maxResults=50&playlistId=" + id + "&key=" + this.apiKey); + var maxResults = this.main.getYoutubePlaylistLimit(); + var http = new haxe_http_HttpJs("" + this.playlistUrl + this.urlVideoId + "&maxResults=" + maxResults + "&playlistId=" + id + "&key=" + this.apiKey); http.onData = function(text) { var json = JSON.parse(text); if(json.error != null) { @@ -2624,7 +2632,7 @@ client_players_Youtube.prototype = { } callback({ duration : _gthis.tempYoutube.getDuration()}); }, onError : function(e) { - haxe_Log.trace("Error " + e.data,{ fileName : "src/client/players/Youtube.hx", lineNumber : 191, className : "client.players.Youtube", methodName : "getRemoteDataFallback"}); + haxe_Log.trace("Error " + e.data,{ fileName : "src/client/players/Youtube.hx", lineNumber : 192, className : "client.players.Youtube", methodName : "getRemoteDataFallback"}); if(_gthis.playerEl.contains(video)) { _gthis.playerEl.removeChild(video); } -- cgit v1.2.3