Modcaller *OLD*

Adds a modcall link to the chat

  1. // ==UserScript==
  2. // @name Modcaller *OLD*
  3. // @author MrSpontaneous (http://www.kongregate.com/accounts/MrSpontaneous)
  4. // @namespace http://www.kongregate.com
  5. // @description Adds a modcall link to the chat
  6. // @include *://www.kongregate.com/games/*/*
  7. // @version 0.0.1.20171113053528
  8. // ==/UserScript==
  9. // You cannot modify or redistribute this script without permission.
  10.  
  11. function init() {
  12. var inject_code = new Array();
  13. inject_code.push('insertmodwhisper = function (mod) { if (mod[0] != "^") {this.holodeck.insertPrivateMessagePrefixFor(mod + " [MC] I need help in " + this.holodeck._chat_window._active_room._room.name + ".");} else { error = mod.split(":"); this.holodeck.activeDialogue().displayMessage(error[0].substr(1), error[1], {class:"whisper sent_whisper"}, {"non_user":true});} };');
  14. inject_code.push('loadScript = function() { var newScript = document.createElement("script"); newScript.src = "http://modcaller.appspot.com/modcaller.js?room="+this.holodeck._chat_window._active_room._room.id; document.body.appendChild(newScript);};');
  15. inject_code.push('whispermod = function() { loadScript();};');
  16.  
  17. var script = document.createElement('script');
  18. script.innerHTML = inject_code.join('\n');
  19.  
  20. document.getElementsByTagName('head')[0].appendChild(script);
  21. }
  22.  
  23. call = document.createElement("option");
  24. call.setAttribute("class","action");
  25. call.setAttribute("onclick","whispermod();");
  26. call.innerHTML="Call a Mod";
  27.  
  28. select = document.getElementsByClassName("chat_actions_container")[0].childNodes[1];
  29. select.appendChild(call);
  30.  
  31. setTimeout(init, 500);