Last active
August 29, 2015 13:57
-
-
Save hasbromlp/9562212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).keydown(function(event) { | |
if(!event.ctrlKey || event.shiftKey) | |
return true; | |
var tag; | |
switch(event.which) { | |
case 83: tag = 'spoiler'; break; | |
case 80: tag = '.pic'; break; | |
default: | |
return true; | |
} | |
if(typeof event.target.selectionStart == "undefined" || event.target.selectionStart == null) | |
return true; | |
var text = $(event.target).val(); | |
var start = event.target.selectionStart; | |
var end = event.target.selectionEnd; | |
if (tag == ".pic") { | |
text = text.slice(0,start) + text.slice(start,end) + tag + text.slice(end); | |
} | |
else{ | |
text = text.slice(0,start) + '['+tag+']' + text.slice(start,end) + '[/'+tag+']' + text.slice(end); | |
} | |
$(event.target).val(text); | |
var afterInsert = end + ('['+tag+']').length; | |
event.target.setSelectionRange(afterInsert, afterInsert); | |
return false; | |
}); | |
$('body').append($( '<audio preload="auto" id="squee"><source src="http://rickyfk.site50.net/squee.ogg" type="audio/ogg"> <source src="https://dl.dropboxusercontent.com/u/25841884/squee.mp3" type="audio/mp3"></audio>' ) ); | |
$( '#squee' )[ 0 ].volume= .6; | |
var squeetoggle = true; | |
var toggle = $("<span/>").addClass("pointer label label-info pull-right") | |
.text("Squee") | |
.appendTo($("#chatheader")); | |
toggle.click(function () { | |
if (squeetoggle) { | |
squeetoggle = false; | |
toggle.removeClass("label-info").addClass("label-default"); | |
} else { | |
squeetoggle = true; | |
toggle.removeClass("label-default").addClass("label-info"); | |
} | |
}); | |
function notification() | |
{ | |
var squee= $( '.nick-highlight:not( .parsed )' ); | |
if( squee.length && squeetoggle) { | |
$('#squee')[0].play( ); | |
squee.addClass( 'parsed' ); | |
} | |
} | |
setInterval( notification , 1000 ); | |
socket.on("setAFK", scrollChat); | |
socket.on("chatMsg", function(data) { | |
if (data.msg.indexOf("<a") != -1 || data.msg.indexOf("<img") != -1) { | |
setTimeout(scrollChat, 500); | |
} | |
}); | |
var favicon = $("<link/>").attr("id", "favicon") | |
.attr("rel", "shortcut icon") | |
.attr("type", "image/png") | |
.attr("href", "http://i.imgur.com/Sr1n7Fa.png") | |
.appendTo("head"); | |
$(".navbar-brand").html("<img src='http://i.imgur.com/Sr1n7Fa.png' width='125'>"); | |
$("#chatonly").css("display","none"); | |
$("#help").css("display","none"); | |
addChatMessage({username: "[Server]", msg:"YOU NEED TO SIGN BACKUP I UPDATED THE WHOLE SITE AND LOST THE DATABASE SORRY ABOUT THAT Remember, Love And Tolerance! Thanks to banditen for the donation.", time: Date.now()}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment