mirror of https://github.com/calzoneman/sync.git
Merge branch 'master' into dev
This commit is contained in:
commit
ca3bf07d91
|
@ -965,7 +965,7 @@ Channel.prototype.broadcastChatFilters = function() {
|
||||||
Channel.prototype.broadcastVoteskipUpdate = function() {
|
Channel.prototype.broadcastVoteskipUpdate = function() {
|
||||||
var amt = this.voteskip ? this.voteskip.counts[0] : 0;
|
var amt = this.voteskip ? this.voteskip.counts[0] : 0;
|
||||||
var count = this.users.length - this.afkers.length;
|
var count = this.users.length - this.afkers.length;
|
||||||
var need = this.voteskip ? parseInt(count * this.opts.voteskip_ratio) : 0;
|
var need = this.voteskip ? Math.ceil(count * this.opts.voteskip_ratio) : 0;
|
||||||
for(var i = 0; i < this.users.length; i++) {
|
for(var i = 0; i < this.users.length; i++) {
|
||||||
if(Rank.hasPermission(this.users[i], "seeVoteskip") ||
|
if(Rank.hasPermission(this.users[i], "seeVoteskip") ||
|
||||||
this.leader == this.users[i]) {
|
this.leader == this.users[i]) {
|
||||||
|
@ -1563,7 +1563,7 @@ Channel.prototype.checkVoteskipPass = function () {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var count = this.users.length - this.afkers.length;
|
var count = this.users.length - this.afkers.length;
|
||||||
var need = parseInt(count * this.opts.voteskip_ratio);
|
var need = Math.ceil(count * this.opts.voteskip_ratio);
|
||||||
if(this.server.cfg["debug"]) {
|
if(this.server.cfg["debug"]) {
|
||||||
console.log("afkers=", this.afkers.length);
|
console.log("afkers=", this.afkers.length);
|
||||||
console.log("users =", this.users.length);
|
console.log("users =", this.users.length);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "2.2.2",
|
"version": "2.2.3",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,7 +6,7 @@ var Logger = require("./logger");
|
||||||
var Channel = require("./channel");
|
var Channel = require("./channel");
|
||||||
var User = require("./user");
|
var User = require("./user");
|
||||||
|
|
||||||
const VERSION = "2.2.2";
|
const VERSION = "2.2.3";
|
||||||
|
|
||||||
function getIP(req) {
|
function getIP(req) {
|
||||||
var raw = req.connection.remoteAddress;
|
var raw = req.connection.remoteAddress;
|
||||||
|
|
9
user.js
9
user.js
|
@ -83,7 +83,8 @@ User.prototype.noflood = function(name, hz) {
|
||||||
User.prototype.setAFK = function (afk) {
|
User.prototype.setAFK = function (afk) {
|
||||||
if(this.channel === null)
|
if(this.channel === null)
|
||||||
return;
|
return;
|
||||||
var changed = this.meta.afk != afk;
|
if(this.meta.afk === afk)
|
||||||
|
return;
|
||||||
var chan = this.channel;
|
var chan = this.channel;
|
||||||
this.meta.afk = afk;
|
this.meta.afk = afk;
|
||||||
if(afk) {
|
if(afk) {
|
||||||
|
@ -96,7 +97,10 @@ User.prototype.setAFK = function (afk) {
|
||||||
this.autoAFK();
|
this.autoAFK();
|
||||||
}
|
}
|
||||||
chan.checkVoteskipPass();
|
chan.checkVoteskipPass();
|
||||||
chan.broadcastUserUpdate(this);
|
chan.sendAll("setAFK", {
|
||||||
|
name: this.name,
|
||||||
|
afk: afk
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
User.prototype.autoAFK = function () {
|
User.prototype.autoAFK = function () {
|
||||||
|
@ -113,6 +117,7 @@ User.prototype.autoAFK = function () {
|
||||||
|
|
||||||
User.prototype.initCallbacks = function() {
|
User.prototype.initCallbacks = function() {
|
||||||
this.socket.on("disconnect", function() {
|
this.socket.on("disconnect", function() {
|
||||||
|
this.awaytimer && clearTimeout(this.awaytimer);
|
||||||
if(this.channel != null)
|
if(this.channel != null)
|
||||||
this.channel.userLeave(this);
|
this.channel.userLeave(this);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
|
@ -660,6 +660,24 @@ Callbacks = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setAFK: function (data) {
|
||||||
|
var users = $("#userlist").children();
|
||||||
|
for(var i = 0; i < users.length; i++) {
|
||||||
|
var name = users[i].children[1].innerHTML;
|
||||||
|
// Reformat user
|
||||||
|
if(name == data.name) {
|
||||||
|
var u = $(users[i]);
|
||||||
|
u.find(".icon-time").remove();
|
||||||
|
$(users[i].children[1]).css("font-style", "");
|
||||||
|
if(data.afk) {
|
||||||
|
$("<i/>").addClass("icon-time")
|
||||||
|
.appendTo(users[i].children[0]);
|
||||||
|
$(users[i].children[1]).css("font-style", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
userLeave: function(data) {
|
userLeave: function(data) {
|
||||||
var users = $("#userlist").children();
|
var users = $("#userlist").children();
|
||||||
for(var i = 0; i < users.length; i++) {
|
for(var i = 0; i < users.length; i++) {
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
return;
|
return;
|
||||||
var ul = $("<ul/>").appendTo(this.paginator);
|
var ul = $("<ul/>").appendTo(this.paginator);
|
||||||
var s = p - parseInt(this.opts.maxPages / 2);
|
var s = p - parseInt(this.opts.maxPages / 2);
|
||||||
s = s < 0 ? 0 : s;
|
|
||||||
s = s + this.opts.maxPages < pages ? s : pages - this.opts.maxPages;
|
s = s + this.opts.maxPages < pages ? s : pages - this.opts.maxPages;
|
||||||
|
s = s < 0 ? 0 : s;
|
||||||
if(endcaps) {
|
if(endcaps) {
|
||||||
var li = $("<li/>").appendTo(ul);
|
var li = $("<li/>").appendTo(ul);
|
||||||
$("<a/>").attr("href", "javascript:void(0)")
|
$("<a/>").attr("href", "javascript:void(0)")
|
||||||
|
|
Loading…
Reference in New Issue