mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed error with undefined in ids
This commit is contained in:
@@ -79,7 +79,6 @@ io.on('connection', function(socket){
|
|||||||
var short_id = uniqueID(socket.id,4);
|
var short_id = uniqueID(socket.id,4);
|
||||||
unique_ids.push(short_id);
|
unique_ids.push(short_id);
|
||||||
|
|
||||||
|
|
||||||
socket.on('namechange', function(data)
|
socket.on('namechange', function(data)
|
||||||
{
|
{
|
||||||
if(name.length < 9 && name.indexOf(" ") == -1)
|
if(name.length < 9 && name.indexOf(" ") == -1)
|
||||||
@@ -740,7 +739,7 @@ function contains(a, obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function rndName(seed, len) {
|
function rndName(seed, len) {
|
||||||
var vowels = ['a', 'e', 'i', 'o', 'u'];
|
var vowels = ['a', 'e', 'i', 'o', 'u', 'aa', 'ae', 'oe'];
|
||||||
consts = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'tt', 'ch', 'sh'];
|
consts = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'tt', 'ch', 'sh'];
|
||||||
//len = 8;
|
//len = 8;
|
||||||
len = Math.floor(len);
|
len = Math.floor(len);
|
||||||
@@ -758,7 +757,7 @@ function rndName(seed, len) {
|
|||||||
|
|
||||||
function uniqueID(seed, minlen){
|
function uniqueID(seed, minlen){
|
||||||
var len = minlen;
|
var len = minlen;
|
||||||
var id = rndName(seed, len);
|
var id = rndName(seed, minlen);
|
||||||
|
|
||||||
while( contains(unique_ids, id) && len<=8){
|
while( contains(unique_ids, id) && len<=8){
|
||||||
id = rndName(String(len)+id, len);
|
id = rndName(String(len)+id, len);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ var Youtube = {
|
|||||||
|| newState.data == 101 || newState.data == 150)
|
|| newState.data == 101 || newState.data == 150)
|
||||||
socket.emit("skip", newState.data);
|
socket.emit("skip", newState.data);
|
||||||
else if(video_id !== undefined)
|
else if(video_id !== undefined)
|
||||||
ytplayer.loadVideoById(video_id);
|
ytplayer.loadVideoById(video_id);
|
||||||
},
|
},
|
||||||
|
|
||||||
onPlayerReady: function(event) {
|
onPlayerReady: function(event) {
|
||||||
@@ -147,7 +147,7 @@ var Youtube = {
|
|||||||
|
|
||||||
var colorThief = new ColorThief();
|
var colorThief = new ColorThief();
|
||||||
var color = colorThief.getColor(img);
|
var color = colorThief.getColor(img);
|
||||||
|
|
||||||
document.getElementsByTagName("body")[0].style.backgroundColor = Helper.rgbToHsl(color);
|
document.getElementsByTagName("body")[0].style.backgroundColor = Helper.rgbToHsl(color);
|
||||||
console.log(colorThief.getColor(img));
|
console.log(colorThief.getColor(img));
|
||||||
$("meta[name=theme-color]").attr("content", Helper.rgbToHex(color[0], color[1], color[2]));
|
$("meta[name=theme-color]").attr("content", Helper.rgbToHex(color[0], color[1], color[2]));
|
||||||
|
|||||||
Reference in New Issue
Block a user