aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
Diffstat (limited to 'res')
-rw-r--r--res/client.js59
-rw-r--r--res/langs/en.json1
-rw-r--r--res/langs/ru.json1
3 files changed, 35 insertions, 26 deletions
diff --git a/res/client.js b/res/client.js
index 2f73059..d15aea4 100644
--- a/res/client.js
+++ b/res/client.js
@@ -1,4 +1,3 @@
-// Generated by Haxe 4.2.2
(function ($hx_exports, $global) { "use strict";
$hx_exports["client"] = $hx_exports["client"] || {};
$hx_exports["client"]["JsApi"] = $hx_exports["client"]["JsApi"] || {};
@@ -29,7 +28,22 @@ Client.fromData = function(data) {
return new Client(data.name,data.group);
};
Client.prototype = {
- setGroupFlag: function(type,flag) {
+ hasPermission: function(permission,permissions) {
+ if((this.group & 1) != 0) {
+ return permissions.banned.indexOf(permission) != -1;
+ }
+ if((this.group & 8) != 0) {
+ return permissions.admin.indexOf(permission) != -1;
+ }
+ if((this.group & 4) != 0) {
+ return permissions.leader.indexOf(permission) != -1;
+ }
+ if((this.group & 2) != 0) {
+ return permissions.user.indexOf(permission) != -1;
+ }
+ return permissions.guest.indexOf(permission) != -1;
+ }
+ ,setGroupFlag: function(type,flag) {
if(flag) {
this.group |= 1 << type._hx_index;
} else {
@@ -70,21 +84,6 @@ ClientTools.getByName = function(clients,name,def) {
}
return def;
};
-ClientTools.hasPermission = function(client,permission,permissions) {
- if((client.group & 1) != 0) {
- return permissions.banned.indexOf(permission) != -1;
- }
- if((client.group & 8) != 0) {
- return permissions.admin.indexOf(permission) != -1;
- }
- if((client.group & 4) != 0) {
- return permissions.leader.indexOf(permission) != -1;
- }
- if((client.group & 2) != 0) {
- return permissions.user.indexOf(permission) != -1;
- }
- return permissions.guest.indexOf(permission) != -1;
-};
var EReg = function(r,opt) {
this.r = new RegExp(r,opt.split("u").join(""));
};
@@ -639,9 +638,15 @@ client_Buttons.init = function(main) {
main.send({ type : "ShufflePlaylist"});
};
window.document.querySelector("#lockplaylist").onclick = function(e) {
- if((main.personal.group & 8) != 0) {
- main.send({ type : "TogglePlaylistLock"});
+ if(!main.hasPermission("lockPlaylist")) {
+ return;
+ }
+ if(main.isPlaylistOpen) {
+ if(!window.confirm(Lang.get("lockPlaylistConfirm"))) {
+ return;
+ }
}
+ main.send({ type : "TogglePlaylistLock"});
};
var showMediaUrl = window.document.querySelector("#showmediaurl");
showMediaUrl.onclick = function(e) {
@@ -1127,6 +1132,7 @@ var client_Main = function() {
this.filters = [];
this.pageTitle = window.document.title;
this.clients = [];
+ this.isPlaylistOpen = true;
this.globalIp = "";
this.forceSyncNextTick = false;
this.isSyncActive = true;
@@ -1294,6 +1300,9 @@ client_Main.prototype = {
};
window.document.querySelector("#customembed-content").onkeydown = window.document.querySelector("#customembed-title").onkeydown;
}
+ ,hasPermission: function(permission) {
+ return this.personal.hasPermission(permission,this.config.permissions);
+ }
,handleUrlMasks: function(links) {
var _g = 0;
while(_g < links.length) {
@@ -1463,7 +1472,7 @@ client_Main.prototype = {
var data = JSON.parse(e.data);
if(this.config != null && this.config.isVerbose) {
var t = data.type;
- haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 380, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]});
+ haxe_Log.trace("Event: " + data.type,{ fileName : "src/client/Main.hx", lineNumber : 384, className : "client.Main", methodName : "onMessage", customParams : [Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))]});
}
client_JsApi.fireOnceEvent(data);
switch(data.type) {
@@ -1697,7 +1706,7 @@ client_Main.prototype = {
}
,onUserGroupChanged: function() {
var button = window.document.querySelector("#queue_next");
- if(ClientTools.hasPermission(this.personal,"changeOrder",this.config.permissions)) {
+ if(this.personal.hasPermission("changeOrder",this.config.permissions)) {
button.disabled = false;
} else {
button.disabled = true;
@@ -2036,6 +2045,7 @@ client_Main.prototype = {
}
}
,setPlaylistLock: function(isOpen) {
+ this.isPlaylistOpen = isOpen;
var lockPlaylist = window.document.querySelector("#lockplaylist");
var icon = lockPlaylist.firstElementChild;
if(isOpen) {
@@ -2059,9 +2069,6 @@ client_Main.prototype = {
this.settings.synchThreshold = s;
client_Settings.write(this.settings);
}
- ,hasPermission: function(group,permission) {
- return Reflect.field(this.config.permissions,$hxEnums[group.__enum__].__constructs__[group._hx_index]._hx_name.toLowerCase()).indexOf(permission) != -1;
- }
,toggleLeader: function() {
this.setLeaderButton((this.personal.group & 4) == 0);
this.send({ type : "SetLeader", setLeader : { clientName : (this.personal.group & 4) != 0 ? "" : this.personal.name}});
@@ -2132,7 +2139,7 @@ client_Player.prototype = {
}
,toggleItemType: function(pos) {
this.videoList.toggleItemType(pos);
- this.setItemElementType(this.videoItemsEl.children[pos],this.videoList.items[this.videoList.pos].isTemp);
+ this.setItemElementType(this.videoItemsEl.children[pos],this.videoList.items[pos].isTemp);
}
,setPlayer: function(newPlayer) {
if(this.player != newPlayer) {
@@ -2226,7 +2233,7 @@ client_Player.prototype = {
}
this.main.send({ type : "Play", play : { time : this.getTime()}});
if(this.main.hasLeaderOnPauseRequest() && this.videoList.items.length > 0) {
- if(this.main.hasPermission((this.main.personal.group & 8) != 0 ? ClientGroup.Admin : ClientGroup.User,"requestLeader")) {
+ if(this.main.hasPermission("requestLeader")) {
this.main.toggleLeader();
}
}
diff --git a/res/langs/en.json b/res/langs/en.json
index 692f816..e7ea8f4 100644
--- a/res/langs/en.json
+++ b/res/langs/en.json
@@ -81,6 +81,7 @@
"skipItemConfirm": "Are you sure you want to skip current video?",
"clearPlaylistConfirm": "Are you sure you want to clear the playlist?",
"shufflePlaylistConfirm": "Are you sure you want to shuffle the playlist?",
+ "lockPlaylistConfirm": "Are you sure you want to lock the playlist?",
"yes": "Yes",
"no": "No",
diff --git a/res/langs/ru.json b/res/langs/ru.json
index 77b1cb1..637e883 100644
--- a/res/langs/ru.json
+++ b/res/langs/ru.json
@@ -81,6 +81,7 @@
"skipItemConfirm": "Вы уверены что хотите пропустить текущее видео?",
"clearPlaylistConfirm": "Вы уверены что хотите очистить плейлист?",
"shufflePlaylistConfirm": "Вы уверены что хотите перемешать плейлист?",
+ "lockPlaylistConfirm": "Вы уверены что хотите заблокировать плейлист?",
"yes": "Да",
"no": "Нет",
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage