Tell-command

Adds a /t-command for Kongregate's chat which automatically replaces with "/w" when pressing space. This is to allow for an easy transition betwen Kong chat and most MMOs

  1. // ==UserScript==
  2. // @name Tell-command
  3. // @namespace tag://kongregate
  4. // @description Adds a /t-command for Kongregate's chat which automatically replaces with "/w" when pressing space. This is to allow for an easy transition betwen Kong chat and most MMOs
  5. // @include http://www.kongregate.com/games/*
  6. // @author Aru (modifying Ventero's /r command script)
  7. // @version 1.1
  8. // @date 01/05/2010
  9. // ==/UserScript==
  10. // Licensed under Creative Commons by-nc-sa http://creativecommons.org/licenses/by-nc-sa/3.0/
  11.  
  12. // Modified by MrSpontaneous (http://www.kongregate.com/accounts/MrSpontaneous) 10/12/09
  13. // Updated by MrSpontaneous for new framework support 1/5/2010
  14. // /r-command script written by Ventero (http://www.kongregate.com/accounts/Ventero) 05/01/09
  15.  
  16. var dom;
  17. try{
  18. if(unsafeWindow && unsafeWindow.holodeck){
  19. dom = unsafeWindow;
  20. } else {
  21. dom = this;
  22. }
  23. }catch(e){
  24. dom = this;
  25. }
  26.  
  27. function init_tellcommand(){
  28. var CDialogue = dom.ChatDialogue;
  29.  
  30. if (CDialogue){
  31. CDialogue.prototype = dom.CDprototype||dom.ChatDialogue.prototype;
  32.  
  33. if(!CDialogue.prototype.oldKeyPressTell){
  34. CDialogue.prototype.oldKeyPressTell = CDialogue.prototype.onKeyPress;
  35.  
  36. CDialogue.prototype.onKeyPress = function (a) {
  37. if ((z=this._input_node.getValue().match(/^\/[tT](.*)/)) && a.which == 32) {
  38. var x=z[1]||"";
  39. this.setInput("/w ");
  40. a.stop();
  41. };
  42. this.oldKeyPressTell(a);
  43. }
  44. }
  45. }
  46. };
  47.  
  48. function check(){
  49. if(!dom.injectScript && !dom._promptedFramework){
  50. if(confirm("You don't have the latest version of the framework-script!\n" +
  51. "Please install it, otherwise the scripts won't work.\n" +
  52. "Clicking ok will open a new tab where you can install the script"))
  53. window.open("http://userscripts.org/scripts/show/54245", "_blank");
  54. dom._promptedFramework = true;
  55. } else {
  56. dom.injectScript(init_tellcommand, 100);
  57. }
  58. }
  59.  
  60. setTimeout(check, 0);