mirror of https://github.com/calzoneman/sync.git
Merge branch 'master' of https://github.com/calzoneman/sync into refactoring
This commit is contained in:
commit
6877b103f2
12
channel.js
12
channel.js
|
@ -128,6 +128,11 @@ Channel.prototype.loadMysql = function() {
|
|||
Logger.syslog.log("Channel " + this.name + " is unregistered.");
|
||||
return;
|
||||
}
|
||||
// [](/picard) I didn't realize that MySQL wasn't case sensitive.
|
||||
// My bad.
|
||||
else if(rows[0].name != this.name) {
|
||||
this.name = rows[0].name;
|
||||
}
|
||||
this.registered = true;
|
||||
|
||||
// Load library
|
||||
|
@ -674,12 +679,13 @@ Channel.prototype.unqueue = function(data) {
|
|||
pos: data.pos
|
||||
});
|
||||
|
||||
if(data.pos < this.currentPosition) {
|
||||
this.currentPosition--;
|
||||
}
|
||||
if(data.pos == this.currentPosition) {
|
||||
this.currentPosition--;
|
||||
this.playNext();
|
||||
return;
|
||||
}
|
||||
if(data.pos < this.currentPosition) {
|
||||
this.currentPosition--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
5
user.js
5
user.js
|
@ -252,7 +252,12 @@ User.prototype.initCallbacks = function() {
|
|||
this.socket.on("chatFilter", function(data) {
|
||||
if(Rank.hasPermission(this, "chatFilter")) {
|
||||
if(data.cmd && data.cmd == "update" && this.channel != null) {
|
||||
try {
|
||||
data.filter[0] = new RegExp(data.filter[0], "g");
|
||||
}
|
||||
catch(e) {
|
||||
return;
|
||||
}
|
||||
this.channel.updateFilter(data.filter);
|
||||
}
|
||||
else if(data.cmd && data.cmd == "remove" && this.channel != null) {
|
||||
|
|
|
@ -484,6 +484,7 @@ function removeCurrentPlayer(){
|
|||
}
|
||||
|
||||
function parseVideoURL(url){
|
||||
url = url.trim()
|
||||
if(typeof(url) != "string")
|
||||
return null;
|
||||
if(url.indexOf("youtu.be") != -1 || url.indexOf("youtube.com") != -1) {
|
||||
|
@ -505,21 +506,18 @@ function parseVideoURL(url){
|
|||
}
|
||||
|
||||
function parseYTURL(url) {
|
||||
url = url.replace("feature=player_embedded&", "");
|
||||
if(url.indexOf("&list=") != -1)
|
||||
url = url.substring(0, url.indexOf("&list="));
|
||||
var m = url.match(/youtube\.com\/watch\?v=([^&]+)/);
|
||||
var m = url.match(/v=([^&#]+)/);
|
||||
if(m) {
|
||||
// Extract ID
|
||||
return m[1];
|
||||
}
|
||||
var m = url.match(/youtu\.be\/([^&]+)/);
|
||||
var m = url.match(/youtu\.be\/([^&#]+)/);
|
||||
if(m) {
|
||||
// Extract ID
|
||||
return m[1];
|
||||
}
|
||||
// Final try
|
||||
var m = url.match(/v=([^&]*)/);
|
||||
var m = url.match(/([^&#]*)/);
|
||||
if(m) {
|
||||
// Extract ID
|
||||
return m[1];
|
||||
|
@ -727,6 +725,12 @@ function updateChatFilters(entries) {
|
|||
.appendTo($("<td/>").appendTo(newfilt));
|
||||
var cback = (function(regex, replace) { return function() {
|
||||
if(regex.val() && replace.val()) {
|
||||
try {
|
||||
var dummy = new RegExp(regex.val(), "g");
|
||||
}
|
||||
catch(e) {
|
||||
alert("Invalid regex: " + e);
|
||||
}
|
||||
socket.emit("chatFilter", {
|
||||
cmd: "update",
|
||||
filter: [regex.val(), replace.val(), true]
|
||||
|
|
Loading…
Reference in New Issue