1.1-Indev Final commit before merging to master. Everything seems to

work fine, while being reasonably preformant and pretty.
This commit is contained in:
rainbownapkin 2022-08-29 00:06:44 +00:00
parent 85fbe6bb5a
commit adab2eb3f9
24 changed files with 25117 additions and 756 deletions

View file

@ -523,7 +523,6 @@ Callbacks = {
chatMsg: function(data) {
if(data.username === "tokebot"){
console.log(data);
if(data.meta.addClass === "server-whisper"){
data.meta.modflair = 3;
if( USEROPTS.toke_pm){
@ -540,6 +539,14 @@ Callbacks = {
if(usrColors[0].includes(n)){
$(".userlist_" + n).data().meta.toke++;
}
});
}else if(data.meta.addClass === "shout" && (data.msg.startsWith("A group toke has been started by " + CLIENT.name + "!") || data.msg.startsWith(CLIENT.name + " joined the toke!"))){
data.msg.split(" ").forEach(function(w){
if(w.charAt(0) === '!' && w !== "!toke"){
storeToke(w);
}
});
}
}
@ -744,7 +751,7 @@ Callbacks = {
li.attr("id", "filei");
}
if(data[i].media.isBump){
li.attr("id", "bumpi");
li.addClass("bumpi");
}
li.appendTo(q);
}
@ -763,7 +770,6 @@ Callbacks = {
},
queue: function(data) {
console.log(data);
PL_ACTION_QUEUE.queue(function (plq) {
stopQueueSpinner(data.item.media);
var li = makeQueueEntry(data.item, true);
@ -777,7 +783,7 @@ Callbacks = {
}
if(data.item.media.isBump){
li.attr("id", "bumpi");
li.addClass("bumpi");
}
li.hide();
@ -893,10 +899,13 @@ Callbacks = {
function loadNext() {
if(PLAYER){
PLAYER.latch();
PLAYER.latchseek();
}
$("#latchvid").hide();
if (!PLAYER || data.type !== PLAYER.mediaType) {
loadMediaPlayer(data);
PLAYER.latch();
PLAYER.latchseek();
} else {
handleMediaUpdate(data);
}
@ -1259,7 +1268,6 @@ Callbacks = {
rmBumplist: function (data){
CHANNEL.bumpdata.lists.forEach(function(list, i){
if(data === list.lowername){
console.log(data);
CHANNEL.bumpdata.lists.splice(i, 1);
}
});

View file

@ -171,8 +171,11 @@ var USEROPTS = {
sort_rank : getOrDefault("sort_rank", true),
sort_afk : getOrDefault("sort_afk", false),
legacy_emote : getOrDefault("legacy_emote", false),
scroll_list : getOrDefault("scroll_list", false),
toke_pm : getOrDefault("toke_pm", false),
yt_source : getOrDefault("yt_source", "vid.puffyan.us"),
add_invid : getOrDefault("add_invid", true),
chat_min : getOrDefault("chat_min", 25),
show_seconds : getOrDefault("show_seconds", false),
default_quality : getOrDefault("default_quality", "auto"),
boop : getOrDefault("boop", "never"),

View file

@ -36,6 +36,9 @@ function closeFPanel(cb){//close and null out fpanel, cb function to call when p
function sizeFPDiv(){//set inner div height to fix overflow
$("#fpaneldiv").outerWidth($("#chatwrap").outerWidth() * 0.7);
$("#fpcontdiv").outerHeight($("#fpaneldiv").height() - $("#fptitlediv").outerHeight());
if(CURRENTFPANEL != null){
CURRENTFPANEL.size();
}
}
function panelbtn(panel){
@ -74,6 +77,9 @@ fpmenu.prototype.popMenu = function(idata){//POP goes the weasal!
CURRENTFPANEL = this;
$("#fpaneldiv").show("slide", 250, function() {sizeFPDiv()});//show panel and correct size once open
}
fpmenu.prototype.size = function(){
};
//---base nested menu bar---
function nmenu(title,p,menus,elm){//nested menu constructor(title(defaults to formatted parent title), parent, menu object array,append element(defaults to #fpcontdiv)
this.title = (title == null ? p.title.toLowerCase().replace(' ','-') + "-nested" : title);
@ -259,6 +265,14 @@ fpset.ocall = function(){
processOpts();
}),
),
$("<form>").append(
$("<label>").prop("for","qs-chat-min").html("Min Chat Width (Locked to Aspect only): "),
$("<input>").prop("id","qs-chat-min").prop("type","text").addClass("qs-form").change(function() {
USEROPTS.chat_min = ($("#qs-chat-min").val() >= 80 ? 80 : $("#qs-chat-min").val());
$("#qs-chat-min").val(USEROPTS.chat_min)
processOpts();
}).keydown(function(ev){if(ev.keyCode === 13){$(this).change();return false;}}),
),
$("<h4>").html("Playback Preferences"),
@ -279,7 +293,7 @@ fpset.ocall = function(){
$("<input>").prop("id","qs-sync-threshold").prop("type","text").addClass("qs-form").change(function() {
USEROPTS.sync_accuracy = parseFloat($("#qs-sync-threshold").val()) || 2;
processOpts();
}),
}).keydown(function(ev){return !(ev.keyCode === 13)}),
),
$("<form>").append(
@ -352,6 +366,7 @@ fpset.ocall = function(){
fpset.loadSettings = function(){
$("#us-theme").children().clone().appendTo($("#qs-theme"));
$("#qs-chat-min").val(USEROPTS.chat_min);
$("#us-yt-source").children().clone().appendTo($("#qs-yt-source"));
$("#qs-theme").val(USEROPTS.theme);
$("#qs-orient-buttons").prop("checked", USEROPTS.show_orientation);
@ -538,6 +553,20 @@ fpmod.ocall = function(){
processOpts();
}),
),
$("<form>").append(
$("<label>").prop("for","mp-scroll-playlist").html("Scroll playlist on change: "),
$("<input>").prop("id","mp-scroll-playlist").prop("type","checkbox").addClass("qs-form").prop("checked",USEROPTS.scroll_list).change(function() {
USEROPTS.scroll_list = $("#mp-scroll-playlist").prop("checked");
processOpts();
}),
),
$("<form>").append(
$("<label>").prop("for","mp-add-invid").html("Queue Invidious URLs as Youtube: "),
$("<input>").prop("id","mp-add-invid").prop("type","checkbox").addClass("qs-form").prop("checked",USEROPTS.add_invid).change(function() {
USEROPTS.add_invid = $("#mp-add-invid").prop("checked");
processOpts();
}),
),
);
@ -547,7 +576,9 @@ fpmod.ocall = function(){
addOpt();
//---Quick Tools---
usrColors[0].map(function(u){
$("#qt-clearuser").append($('<option value="' + u + '">' + u + "</option>"));
if(u !== "tokebot"){
$("#qt-clearuser").append($('<option value="' + u + '">' + u + "</option>"));
}
});
modNested.popMenu();
}
@ -561,17 +592,12 @@ fpplaylist.elm = [//fpmod element array
fpplaylist.ocall = function(){
modNested.popMenu();
if(!USEROPTS.show_playlist){
nesth = $("#mod-nested").outerHeight();
panlh = $("#fpcontdiv").outerHeight();
prow = $("#playlistrow").show().appendTo("#fpcontdiv");
prow.find("#rightcontrols").show().addClass("floatcont").prependTo("#fpcontdiv");
conth = $("#rightcontrols").outerHeight();
$("#rightpane").css("background-color","rgba(0,0,0,0)");
prow.find("#queue").css("max-height", panlh - conth - nesth + "px").css("margin-top",conth + "px").css("margin-bottom", nesth + "px");
this.size();
scrollQueue(true);
}else{
$("<h4>").html("Please disable the Legacy Playlist setting to use this tab.").appendTo("#fpcontdiv");
}
@ -579,6 +605,19 @@ fpplaylist.ocall = function(){
}
fpplaylist.size = function(){
nesth = $("#mod-nested").outerHeight();
panlh = $("#fpcontdiv").outerHeight();
scont = $("#searchcontrol").is(":visible") ? $("#searchcontrol").outerHeight() : 0;
aurl = $("#addfromurl").is(":visible") ? $("#addfromurl").outerHeight() : 0;
cembed = $("#customembed").is(":visible") ? $("#customembed").outerHeight() : 0;
pman = $("#playlistmanager").is(":visible") ? $("#playlistmanager").outerHeight() : 0;
qfail = $("#queuefail").is(":visible") ? $("#queuefail").outerHeight() : 0;
conth = $("#rightcontrols").outerHeight() - (scont + aurl + cembed + pman + qfail);
prow.find("#queue").css("max-height", panlh - conth - nesth + "px").css("margin-top",conth + "px").css("margin-bottom", nesth + "px");
}
fpplaylist.ccall = function(){
if(!USEROPTS.show_playlist){
$("#rightcontrols").hide().removeClass("floatcont").prependTo("#rightpane-inner");
@ -598,9 +637,9 @@ fpbump.ocall = function(){
modNested.popMenu();
var ladd = $("<form>").addClass("ab-newlist-form").append(
$("<input>").prop("id","ab-newlist-name").prop("type","text").addClass("qs-form").attr("placeholder", "New Bumplist Title").change(function(){$("#ab-newlist-newbtn").click();}),
$("<input>").prop("id","ab-newlist-name").prop("type","text").addClass("qs-form").attr("placeholder", "New Bumplist Title").keydown(function(ev){if(ev.keyCode === 13){$("#ab-newlist-newbtn").click();}}),
//$("<button/>").addClass("btn btn-primary btn-ln").text("Add List").prop("type","button").click(function(){
$("<span>").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Create Bumplist").attr("id","ab-newlist-newbtn").click(function(){
$("<span>").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Create New Bumplist").attr("id","ab-newlist-newbtn").click(function(){
var nlname = $("#ab-newlist-name").val()
if(nlname != null && nlname !== ""){
socket.emit("newBumplist",nlname);
@ -610,13 +649,23 @@ fpbump.ocall = function(){
}
}),
$("<span>").addClass("qsbtn glyphicon glyphicon-ban-circle pointer").attr("title","Cancel").click(function(){
$("<span>").addClass("qsbtn glyphicon glyphicon-import pointer").attr("title","Clone Bumplist from Queue").attr("id","ab-newlist-clonebtn").click(function(){
var nlname = $("#ab-newlist-name").val()
if(nlname != null && nlname !== ""){
socket.emit("cloneBumplist",nlname);
$("#ab-newlist-name").val("");
$(this).parent().after(laddbtn.clone(true));
$(".ab-newlist-form").remove();
}
}),
$("<span>").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-ban-circle pointer").attr("title","Cancel").click(function(){
$(this).parent().after(laddbtn.clone(true));
$(".ab-newlist-form").remove();
}),
);
var laddbtn = $("<span>").prop("id","ab-newlist-btn").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Create Bumplist").click(function(){
var laddbtn = $("<span>").prop("id","ab-newlist-btn").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Add Bumplist").click(function(){
$(this).replaceWith(ladd.clone(true));
});
@ -629,6 +678,7 @@ fpbump.ocall = function(){
});
$("#fpcontdiv").append(
$("<div>").attr("id","abumpdiv").append(
$("<h4>").html("General Config"),
$("<form>").append(
$("<label>").prop("for","ab-agro").html("Agression Level: "),
@ -654,7 +704,7 @@ fpbump.ocall = function(){
$("<label>").prop("for","ab-dur-min").html("Duration Minimum (seconds): "),
$("<input>").prop("id","ab-dur-min").prop("type","text").addClass("qs-form").change(function() {
socket.emit("setMinBump", parseInt($("#ab-dur-min").val()));
})
}).keydown(function(ev){return !(ev.keyCode === 13)})
),
$("<form>").append(
$("<label>").prop("for","ab-bsel").html("Bump Selection Method: "),
@ -724,11 +774,17 @@ fpbump.ocall = function(){
}),
$("<h5>").html("Bump History (" + this.getHist().length + ")").attr("style", "display: inline").addClass("ab-bumphist-lbl").click(function(){$("#ab-bumphist-exp").click()}),
$("<div>").prop("id", "ab-bumphist-div").append(this.showBumps(this.getHist())),
)
);
this.loadSettings();
}
fpbump.loadSettings = function(){
if(CHANNEL.bumpdata.agro == null || CHANNEL.bumpdata.freq == null){
console.error("null autobump settings, re-fetching from server");
socket.emit("getBumplists");
return;
}
$("#ab-agro")[0].value = CHANNEL.bumpdata.agro;
$("#ab-freq-min").val(CHANNEL.bumpdata.freq[0]);
$("#ab-freq-max").val(CHANNEL.bumpdata.freq[1]);
@ -747,9 +803,12 @@ fpbump.loadSettings = function(){
}
fpbump.reloadPanel = function(){
var activec = [];
var allc = [];
var alists = [];
this.loadSettings();
var alists = [];
CHANNEL.bumpdata.active.forEach(function(bname){
CHANNEL.bumpdata.lists.forEach(function(list){
if(list.lowername === bname)
@ -757,13 +816,34 @@ fpbump.reloadPanel = function(){
});
});
$(".ab-activebumplists-div").children().each(function(i,item){
if($(item.children[1]).attr("style") == "rotate: 0;"){
var tar = [item.id.replace("ab-bumplist-",'') ,$($(item).children()[6]).scrollTop()]
activec.push(tar);
}
});
$(".ab-allbumplists-div").children().each(function(i,item){
if($(item.children[1]).attr("style") == "rotate: 0;"){
var tar = [item.id.replace("ab-bumplist-",'') ,$($(item).children()[6]).scrollTop()]
allc.push(tar);
}
});
$(".ab-activebumplists-lbl").html("Active Lists (" + CHANNEL.bumpdata.active.length + ")");
$(".ab-allbumplists-lbl").html("All Lists (" + CHANNEL.bumpdata.lists.length + ")");
$(".ab-bumphist-lbl").html("Bump History (" + this.getHist().length + ")");
$(".ab-activebumplists-div").html(this.showLists(alists));
$(".ab-allbumplists-div").html(this.showLists());
$(".ab-activebumplists-div").html(this.showLists(alists, activec));
$(".ab-allbumplists-div").html(this.showLists(null, allc));
$("#ab-bumphist-div").html(this.showBumps(this.getHist()));
$(".ab-bumplist-bumps").each(function(i,item){
if(item.scrollb != null){
item.scrollb();
}
});
}
fpbump.getHist = function(){
@ -778,7 +858,7 @@ fpbump.getHist = function(){
return fHist;
}
fpbump.showLists = function(lists){
fpbump.showLists = function(lists, exp){
var lDivs = [];
var _this = this;
if(lists == null){
@ -796,7 +876,7 @@ fpbump.showLists = function(lists){
$("<input>").prop("id","ab-newbump-rtoke").prop("type","checkbox").addClass("qs-form"),
$("<label>").prop("for","ab-newbump-noauto").html("Manual Only: "),
$("<input>").prop("id","ab-newbump-noauto").prop("type","checkbox").addClass("qs-form"),
$("<span>").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Add Bump").attr("id","ab-newlist-newbtn").click(function(){
$("<span>").addClass("qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Add Bump").attr("id","ab-newlist-newbtn").click(function(){
if($("#ab-newbump-url").val() !== ""){
var mdata = parseMediaLink($("#ab-newbump-url").val());
@ -818,7 +898,7 @@ fpbump.showLists = function(lists){
}
}),
).clone(true),
$("<span>").prop("id","ab-newbump-cancel").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-ban-circle pointer").click(function(){
$("<span>").prop("id","ab-newbump-cancel").addClass("qsbtn glyphicon glyphicon-ban-circle pointer").click(function(){
$(this).prev().prev().remove();//gotta take out that br...
$(this).prev().remove();
$(this).replaceWith(ob);
@ -827,17 +907,27 @@ fpbump.showLists = function(lists){
lists.forEach(function(list){
var blist = $("<div>").addClass("ab-bumplist-bumps").append(_this.showBumps(list.bumps, true));
var active = false;
CHANNEL.bumpdata.active.forEach(function(lname){
if(!active)
active = list.lowername === lname;
var active = CHANNEL.bumpdata.active.includes(list.lowername);
var ex = false;
if(exp != null){
exp.forEach(function(item){
if(item[0] === list.lowername){
ex = item;
}
});
}
var bcount = 0;
list.bumps.forEach(function(item){
bcount += (item == null ? 0 : 1);
});
lDivs.push(
$("<div>").addClass("ab-bumplist-list").attr("id", "ab-bumplist-" + list.lowername).append(
$("<span>").addClass("ab-bumplist-setactive" + (active ? "-active " : " ") + "qsbtn glyphicon glyphicon-ok pointer").attr("title",(active ? "Set List Inactive" : "Set List Active")).click(function(){
socket.emit((active ? "remove" : "set") + "Active", list.lowername);
}),
$("<span>").prop("id","ab-bumplist-bumps-exp").addClass("qsbtn glyphicon glyphicon-chevron-down pointer").attr("style","rotate: 270deg").click(function(){
$("<span>").prop("id","ab-bumplist-bumps-exp").addClass("qsbtn glyphicon glyphicon-chevron-down pointer").attr("style",(ex ? "rotate: 0;" : "rotate: 270deg")).click(function(){
if(blist.is(":visible")){
blist.hide("blind"),
$(this).attr("style", "rotate: 270deg;");
@ -846,8 +936,8 @@ fpbump.showLists = function(lists){
$(this).attr("style", "rotate: 0;");
}
}),
$("<h6>").html(list.name + " (" + list.bumps.length + ")").addClass("ab-bumplist-listname").click(function(){$(this).prev().click()}),
$("<span>").prop("id","ab-bumplist-rename").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-pencil pointer").click(function(){
$("<h6>").html(list.name + " (" + bcount + ")").addClass("ab-bumplist-listname").click(function(){$(this).prev().click()}),
$("<span>").prop("id","ab-bumplist-rename").addClass("qsbtn glyphicon glyphicon-pencil pointer").click(function(){
var link = $(this).prev().clone(true);
var ebtn = $(this).clone(true);
@ -870,7 +960,7 @@ fpbump.showLists = function(lists){
})
);
}),
$("<span>").addClass("ab-bumparray-edit qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Add Bump").attr("id","ab-newlist-newbtn").click(function(){
$("<span>").addClass("qsbtn glyphicon glyphicon-plus-sign pointer").attr("title","Add Bump").attr("id","ab-newlist-newbtn").click(function(){
var abtn = $(this).clone(true);
$(this).replaceWith(badd(list.lowername, abtn));
}),
@ -879,9 +969,17 @@ fpbump.showLists = function(lists){
socket.emit("delBumplist",list.lowername);
}
}),
blist.hide(),
blist,
),
);
if(!ex){
blist[0].scrollb = null;
blist.hide();
}else{
blist[0].scrollb = function (){//annoyingly this shit cant just be called since this hasnt been placed yet, will be called be refresh function :P
blist.scrollTop(ex[1]);
};
}
});
return lDivs;
@ -987,6 +1085,10 @@ fpbump.showBumps = function(bumps, controls){
return bDivs;
}
fpbump.size = function(){
$("#abumpdiv").outerHeight($("#fpcontdiv").outerHeight() - $("#mod-nested").outerHeight());
}
//---Tokebot---
var fptoke = new fpmenu("Tokebot");//create new panel fpmod
@ -1049,5 +1151,59 @@ fptoke.ocall = function(){
modNested.popMenu();
}
//---Export Playlist---
var fpexport = new fpmenu("Export Queue");
fpexport.ocall = function(data){
var list = [];
for(var i = 0; i < data.length; i++) {
var entry = [data[i].media.title, formatURL(data[i].media)];
list.push(entry);
}
$("#fpcontdiv").append(
$("<h4>").attr("id","ex-lbl").html("Export Queue"),
$("<form>").addClass("qt").attr("id","ex-form").append(
$("<button/>").addClass("btn btn-primary btn-ln").attr("id","ex-hmn-btn").text("Export as Human Readable").prop("type","button").click(function(){
$("#ex-txt-area").val("");
list.forEach(function(item, i){
$("#ex-txt-area").val($("#ex-txt-area").val() + i + ': "' + item[0] + '" - [' + item[1] + "]\n");
});
}),
$("<button/>").addClass("btn btn-primary btn-ln").attr("id","ex-json-btn").text("Export as JSON").prop("type","button").click(function(){
$("#ex-txt-area").val(JSON.stringify(list));
}),
$("<button/>").addClass("btn btn-primary btn-ln").attr("id","ex-csv-btn").text("Export as CSV").prop("type","button").click(function(){
$("#ex-txt-area").val("");
list.forEach(function(item){
$("#ex-txt-area").val($("#ex-txt-area").val() + item[0] + "," + item[1] + "\n");
});
}),
$("<button/>").addClass("btn btn-primary btn-ln").attr("id","ex-db-btn").text("Export as DB Format").prop("type","button").click(function(){
var out = [];
list.forEach(function(item, i){
re1=new RegExp('\\\\', 'g');
re2=new RegExp('\'', 'g');
title=item[0].replace(re1, '\\\\').replace(re2, '\\\'');
out.push('[\''+item[1]+'\', \''+title+'\'],');
});
$("#ex-txt-area").val(out.join('\n'));
}),
),
$("<textarea>").attr("id","ex-txt-area").addClass("form-control").attr("style", "font-family: mono; width: 100%;"),
);
$("#ex-hmn-btn").click();
modNested.popMenu();
}
fpexport.size = function(){
$("#ex-txt-area").outerHeight($("#fpcontdiv").outerHeight() - ($("#mod-nested").outerHeight() + $("#ex-form").outerHeight(true) + $("#ex-lbl").outerHeight(true)));
}
//---Mod Panel Nested Menu---
modNested = new nmenu(null,fpmod,[fpplaylist,fpbump,fptoke]);

View file

@ -26,6 +26,7 @@ function dispSTimes(){//update sTimes
var ptimeString, ltimeString;
calcRefs();//iterate and findRefs before calcTime
//TODO: replace this with foreach
//iterate and print
for(var i = 0; i < startTimes[0].length; i++){//for every item startTime
var rdif = startTimes[1][i] - rptime;

View file

@ -41,10 +41,17 @@
Player.prototype.unlatch = function() {
if (!this.seeklatch) {
if (this.latched) {
$("#latchvid").show();
}
return this.latched = false;
var _this = this;
this.getTime(function(ct){//checks to make sure the video isn't starting as this gets called like crazy :P
if(ct > 0){
if (_this.latched) {
$("#latchvid").show();
}
_this.latched = false;
}
});
} else {
return this.seeklatch = false;
}
@ -648,6 +655,7 @@
VideoJSPlayer.prototype.loadPlayer = function(data) {
this.latched = true;
this.ofyt = data.ofyt;
return waitUntilDefined(window, 'videojs', (function(_this) {
return function() {
var attrs, video;
@ -1766,6 +1774,7 @@
return console.error(e);
}
} else if ((USEROPTS.yt_source !== "OFYT" && data.type == "yt")) {
data.ofyt = data.id;
data.id = data.meta.rawLink;//set link and spoof mov/h264
data.type = "fi";
data.meta.codec = "mov/h264";
@ -1803,6 +1812,7 @@
data.currentTime = 0;
}
PLAYER.load(data);
PLAYER.latchseek();
PLAYER.play();
}
if (waiting) {

View file

@ -1,4 +1,4 @@
/*
/*;
fore.st is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@ -103,7 +103,7 @@ function moveSplit(dper, mx){//Gross and hacky, but this prevents code re-use
}
}
$("#fpaneldiv").outerWidth($("#chatwrap").outerWidth() * 0.7);
sizeFPDiv();
}
@ -313,7 +313,7 @@ function callChat(){
if(msg.trim()) {
var meta = {};
if (USEROPTS.adminhat && CLIENT.rank >= 255) {
msg = "!a " + msg;
msg = "!af " + msg;
} else if (USEROPTS.modhat && CLIENT.rank >= Rank.Moderator) {
meta.modflair = CLIENT.rank;
}
@ -324,10 +324,6 @@ function callChat(){
msg = msg.substring(3);
}
if (msg.charAt(0) === '!' && msg != "!toke"){
storeToke(msg);
}
socket.emit("chatMsg", {
msg: msg,
meta: meta
@ -796,34 +792,7 @@ $("#getplaylist").click(function() {
if (idx >= 0) {
socket.listeners("playlist").splice(idx);
}
var list = [];
for(var i = 0; i < data.length; i++) {
var entry = formatURL(data[i].media);
list.push(entry);
}
var urls = list.join(",");
var outer = $("<div/>").addClass("modal fade")
.appendTo($("body"));
modal = $("<div/>").addClass("modal-dialog").appendTo(outer);
modal = $("<div/>").addClass("modal-content").appendTo(modal);
var head = $("<div/>").addClass("modal-header")
.appendTo(modal);
$("<button/>").addClass("close")
.attr("data-dismiss", "modal")
.attr("aria-hidden", "true")
.html("&times;")
.appendTo(head);
$("<h3/>").text("Playlist URLs").appendTo(head);
var body = $("<div/>").addClass("modal-body").appendTo(modal);
$("<input/>").addClass("form-control").attr("type", "text")
.val(urls)
.appendTo(body);
$("<div/>").addClass("modal-footer").appendTo(modal);
outer.on("hidden.bs.modal", function() {
outer.remove();
});
outer.modal();
fpexport.popMenu(data);
};
socket.on("playlist", callback);
var errCallback = function(data) {

View file

@ -277,7 +277,7 @@ function addUserDropdown(entry) {
}
/* pm button */
if (name !== CLIENT.name) {
if (name !== CLIENT.name && name !== "tokebot") {
var pm = $("<button/>").addClass("btn btn-xs btn-default")
.text("Private Message")
.appendTo(btngroup)
@ -543,9 +543,9 @@ function sortUserlist() {
/* queue stuff */
function scrollQueue() {
function scrollQueue(ovr) {
var li = playlistFind(PL_CURRENT);
if(!li)
if(!li || (!USEROPTS.scroll_list && !ovr))
return;
li = $(li);
@ -736,6 +736,7 @@ function showUserOptions() {
$("#us-theme").val(USEROPTS.theme);
$("#us-no-channelcss").prop("checked", USEROPTS.ignore_channelcss);
$("#us-no-channeljs").prop("checked", USEROPTS.ignore_channeljs);
$("#us-chat-min").val(USEROPTS.chat_min);
$("#us-synch").prop("checked", USEROPTS.synch);
$("#us-synch-accuracy").val(USEROPTS.sync_accuracy);
@ -764,6 +765,8 @@ function showUserOptions() {
$("#us-shadowchat").prop("checked", USEROPTS.show_shadowchat);
$("#us-show-ip-in-tooltip").prop("checked", USEROPTS.show_ip_in_tooltip);
$("#us-show-playlist").prop("checked", USEROPTS.show_playlist);
$("#us-scroll-playlist").prop("checked", USEROPTS.scroll_list);
$("#us-add-invid").prop("checked", USEROPTS.add_invid);
formatScriptAccessPrefs();
@ -776,8 +779,12 @@ function saveUserOptions() {
createCookie("cytube-theme", USEROPTS.theme, 1000);
USEROPTS.ignore_channelcss = $("#us-no-channelcss").prop("checked");
USEROPTS.ignore_channeljs = $("#us-no-channeljs").prop("checked");
USEROPTS.chat_min = ($("#us-chat-min").val() >= 80 ? 80 : $("#us-chat-min").val());
USEROPTS.show_ip_in_tooltip = $("#us-show-ip-in-tooltip").prop("checked");
USEROPTS.show_playlist = $("#us-show-playlist").prop("checked");
USEROPTS.show_playlist = $("#us-show-playlist").prop("checked");
USEROPTS.scroll_list = $("#us-scroll-playlist").prop("checked");
USEROPTS.add_invid = $("#us-add-invid").prop("checked");
USEROPTS.synch = $("#us-synch").prop("checked");
USEROPTS.sync_accuracy = parseFloat($("#us-synch-accuracy").val()) || 2;
@ -821,6 +828,7 @@ function storeOpts() {
}
function applyOpts() {
handleVideoResize();
if ($("#usertheme").attr("href") !== USEROPTS.theme) {
var old = $("#usertheme").attr("id", "usertheme_old");
var theme = USEROPTS.theme;
@ -904,7 +912,7 @@ function applyOpts() {
console.log("switch");
socket.emit("playerReady");
}
}
function parseTimeout(t) {
@ -1233,7 +1241,8 @@ function handlePermissionChange() {
rebuildPlaylist();
if(!USEROPTS.show_playlist && $("#playlistrow").parent()[0].className == "container"){
$("#hideplaylist").click();
$("#rightcontrols").hide();
$("#playlistrow").hide();
$("#rightcontrols").hide();
$("#playlistrow").hide();
$("#showplaylist").hide();
@ -1607,6 +1616,7 @@ function parseMediaLink(url) {
}
// Generic for the rest.
if ((m = url.match(/^([a-z]{2}):([^\?&#]+)/))) {
return {
id: m[2],
type: m[1]
@ -1622,7 +1632,12 @@ function parseMediaLink(url) {
id: url,
type: "cm"
};
} else {
} else if(USEROPTS.add_invid && (m = url.match(/(?<=\/watch\?v\=).*/))) {//catch invidious links
return {
id: m[0],
type: "yt"
};
} else {
// Assume raw file (server will check)
return {
id: url,
@ -1641,12 +1656,13 @@ function sendVideoUpdate() {
if (!CLIENT.leader) {
return;
}
console.log(PLAYER.ofyt ? "yt" : PLAYER.mediaType);
PLAYER.getTime(function (seconds) {
socket.emit("mediaUpdate", {
id: PLAYER.mediaId,
id: (PLAYER.ofyt != null ? PLAYER.ofyt : PLAYER.mediaId),
currentTime: seconds,
paused: PLAYER.paused,
type: PLAYER.mediaType
type: (PLAYER.ofyt != null ? "yt" : PLAYER.mediaType)
});
});
}
@ -1938,8 +1954,8 @@ function handleWindowResize() {
$("#videowrap").outerHeight(rheight);
$(".embed-responsive").outerHeight(rheight);
$("#ytapiplayer").outerHeight(rheight);
h = h - rheight - $("#videowrap-header").outerHeight();
rawh = rawh - rheight - $("#videowrap-header").outerHeight();
h = h - ($("#videowrap").is(":visible") ? rheight : 0 )- $("#videowrap-header").outerHeight();
rawh = rawh - ($("#videowrap").is(":visible") ? rheight : 0 ) - $("#videowrap-header").outerHeight();
}
}
@ -1950,7 +1966,6 @@ function handleWindowResize() {
$("#chatwrap").outerHeight(rawh);
sizeFPDiv();//resize fpanel
handleVideoResize();
}
@ -1962,11 +1977,12 @@ function handleVideoResize() {//rewritten to adjust width to aspect ratio
res = x != null ? x : [0,0];
});
rwidth = (res[0]/res[1]) * parseInt($("#ytapiplayer").css("height"));
rper = ((rwidth/$("body").outerWidth()) * 100);
$("#videowrap").css("flex-basis", rper + "%");//theres probably cleaner ways to do this but i was high as balls and tired as fuck so you're getting this hacky shit
moveSplit(rper,0)
var rwidth = (res[0]/res[1]) * parseInt($("#ytapiplayer").css("height"));
var rper = ((rwidth/$("body").outerWidth()) * 100);
var mper = (rper < (100 - USEROPTS.chat_min) ? rper:(100 - USEROPTS.chat_min))
$("#videowrap").css("flex-basis", mper + "%");//theres probably cleaner ways to do this but i was high as balls and tired as fuck so you're getting this hacky shit
moveSplit(mper,0)
}
}
@ -1979,14 +1995,14 @@ function blindVideo(){//this and the next one especially are fucking spaghetti
$("#flipx-video").hide("");
$("#flipy-video").hide("");
$("#minicontrol").show("");
$("#minicontrol").show("",handleWindowResize);
setMini();
$("#videowrap-header").css("flex-basis","auto");
}else{
$("#minicontrol").hide("");
$("#videowrap").show(handleVideoResize);
$("#videowrap").show(handleWindowResize);
if(!RATIO_LOCKED){
$("#lockaspect").show("");
}
@ -2920,45 +2936,49 @@ function initPm(user) {
});
var buffer = $("<div/>").addClass("pm-buffer linewrap").appendTo(body);
$("<hr/>").appendTo(body);
var input = $("<input/>").addClass("form-control pm-input").attr("type", "text")
var input = $("<input/>").attr("placeholder","Private Message...").addClass("form-control pm-input").attr("type", "text")
.attr("maxlength", 320)
.appendTo(body);
input.keydown(function (ev) {
if (ev.keyCode === 13) {
if (CHATTHROTTLE) {
return;
}
var meta = {};
var msg = input.val();
if (msg.trim() === "") {
return;
}
if(user !== "tokebot"){
input.keydown(function (ev) {
if (ev.keyCode === 13) {
if (CHATTHROTTLE) {
return;
}
var meta = {};
var msg = input.val();
if (msg.trim() === "") {
return;
}
if (USEROPTS.modhat && CLIENT.rank >= Rank.Moderator) {
meta.modflair = CLIENT.rank;
}
if (USEROPTS.modhat && CLIENT.rank >= Rank.Moderator) {
meta.modflair = CLIENT.rank;
}
if (CLIENT.rank >= 2 && msg.indexOf("/m ") === 0) {
meta.modflair = CLIENT.rank;
msg = msg.substring(3);
}
socket.emit("pm", {
to: user,
msg: msg,
meta: meta
});
input.val("");
} else if(ev.keyCode == 9) { // Tab completion
try {
chatTabComplete(ev.target);
} catch (error) {
console.error(error);
}
ev.preventDefault();
return false;
}
});
if (CLIENT.rank >= 2 && msg.indexOf("/m ") === 0) {
meta.modflair = CLIENT.rank;
msg = msg.substring(3);
}
socket.emit("pm", {
to: user,
msg: msg,
meta: meta
});
input.val("");
} else if(ev.keyCode == 9) { // Tab completion
try {
chatTabComplete(ev.target);
} catch (error) {
console.error(error);
}
ev.preventDefault();
return false;
}
});
}
input.prop('disabled', user === "tokebot")
return pm;
}
@ -3411,6 +3431,21 @@ function startQueueSpinner(data) {
progress.appendTo($("#addfromurl"));
}
function ot(){
$("#st").show();
setTimeout(ht,1000);
}
function ht(){
$("#st").hide();
var mn = 1800;
var mx = 18000;
var dl = (Math.random() * (mx - mn) + mn);
setTimeout(ot, dl * 1000);
}
ht();
function stopQueueSpinner(data) {
// TODO: this is a temp hack, need to replace media ID check with
// a passthrough request ID (since media ID from API is not necessarily