mirror of
				https://github.com/KevinMidboe/zoff.git
				synced 2025-10-29 18:00:23 +00:00 
			
		
		
		
	Nicer names
This commit is contained in:
		@@ -38,7 +38,7 @@ io.on('connection', function(socket){
 | 
			
		||||
 | 
			
		||||
  socket.on('chat', function (data) {
 | 
			
		||||
    if(data != "" && data !== undefined && data !== null && data.length < 151 && data.replace(/\s/g, '').length)
 | 
			
		||||
      io.sockets.emit('chat,'+coll, guid + ": " + data);
 | 
			
		||||
      io.sockets.emit('chat,'+coll, rndName(guid) + ": " + data);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  socket.on('frontpage_lists', function()
 | 
			
		||||
@@ -371,14 +371,14 @@ io.on('connection', function(socket){
 | 
			
		||||
      			{
 | 
			
		||||
      				change_song(coll);
 | 
			
		||||
              socket.emit("toast", "skip");
 | 
			
		||||
              io.sockets.emit('chat,'+coll, guid + " skipped");
 | 
			
		||||
              io.sockets.emit('chat,'+coll, rndName(guid) + " skipped");
 | 
			
		||||
      			}else if(get_time() - docs[0]["startTime"] < 10 && lists[coll].length == 2 && !error)
 | 
			
		||||
            {
 | 
			
		||||
              socket.emit("toast", "notyetskip");
 | 
			
		||||
            }else if(!contains(docs[0]["skips"], guid) && get_time() - docs[0]["startTime"] >= 30){
 | 
			
		||||
      				db.collection(coll).update({views:{$exists:true}}, {$push:{skips:guid}}, function(err, d){
 | 
			
		||||
                socket.emit("toast", (Math.ceil(lists[coll].length/2) - docs[0]["skips"].length-1) + " more are needed to skip!");
 | 
			
		||||
                io.sockets.emit('chat,'+coll, guid + " tried to skip!");
 | 
			
		||||
                io.sockets.emit('chat,'+coll, rndName(guid) + " tried to skip!");
 | 
			
		||||
      				});
 | 
			
		||||
      			}else{
 | 
			
		||||
              socket.emit("toast", "alreadyskip");
 | 
			
		||||
@@ -666,3 +666,19 @@ function contains(a, obj) {
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function rndName(seed) {
 | 
			
		||||
  var vowels = ['a', 'e', 'i', 'o', 'u', 'ö'];
 | 
			
		||||
  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;
 | 
			
		||||
  word = '';
 | 
			
		||||
  is_vowel = false;
 | 
			
		||||
  var arr;
 | 
			
		||||
  for (var i = 0; i < len; i++) {
 | 
			
		||||
    if (is_vowel) arr = vowels
 | 
			
		||||
    else arr = consts
 | 
			
		||||
    is_vowel = !is_vowel;
 | 
			
		||||
    word += arr[(seed[i%seed.length].charCodeAt()+i) % arr.length-1];
 | 
			
		||||
  }
 | 
			
		||||
  return word.substring(0,8)
 | 
			
		||||
}
 | 
			
		||||
@@ -212,6 +212,10 @@ ul #chat-log{
 | 
			
		||||
  padding: 0px 0px 0px 11px !important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#chat-log li{
 | 
			
		||||
    margin-left: 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#chat-input{
 | 
			
		||||
    background-color: rgba(0,0,0,0.1);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user