User:KCCreations/chat.js

//Took the following code bit from User:Sophiedp, who I believe took it from User:Shining-Armor //Note that the first one has been modified to suit my needs $('[name="message"]').keypress(function (e) {   if (e.which == 32 || e.which == 13) {        switch (this.value) {        case '/rules':            this.value = 'The Community Central chat rules can be found here.';            break;        case '/changeusername':            this.value = 'You can request to change your username via Special:Contact/rename-account.';            break;        case '/changewikiname':            this.value = 'You can request to change your wiki\'s name or URL via Special:Contact/wiki-name-change.';            break;        case '/monstercat':            this.value = 'Monstercat is a Canadian electronic music record label from Vancouver. If you want to know more, go on Wikipedia or the wiki because I don\'t want to flood the chat.';            break;            case '/emotes':            this.value = 'The full list of emoticons here can be found at MediaWiki:Emoticons.'; break; case '/tou': this.value = 'Wikia\'s Terms of Use can be found here.'; break; case '/flight': this.value = 'https://www.youtube.com/watch?v=OVMuwa-HRCQ'; break; }   } });

//Thanks to the cube >_> $('[name="message"]').keypress(function (e) {   if (e.which == 13 && this.value.indexOf("/google") > -1 && this.value.indexOf("/google") < 8)        this.value = "http://google.com/search?q=" + encodeURIComponent(this.value.substring(8)); });

// Script imports window.importArticles( { type: 'script',  articles: [    'u:dev:MediaWiki:ChatOptions/code.js',    'u:dev:MediaWiki:ChatTimestamps/code.js'  ] });

//Auto chat night mode thing //http://stackoverflow.com/questions/18031410/javascript-if-time-is-between-7pm-and-7am-do-this $(function {  var today = new Date.getHours;  if (today >= 7 && today <= 19) {    return;  } else {    importArticles({ type: "style", articles: [ "u:community:User:KCCreations/Nightmodechat.css" ]   });  } });