Advertisement
Quimbox

script de evaluación

Sep 9th, 2011
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print("javascript evaluation script loaded - edited by Stuart");
  2.  
  3. Script.create("room");
  4.  
  5. Script.eval("room", "String.prototype.trim = function () { return this.replace(/^[\\s\\xA0]+/, \"\").replace(/[\\s\\xA0]+$/, \"\"); }");
  6. Script.eval("room", "String.prototype.endsWith = function (str) { return this.match(str + \"$\") == str; }");
  7. Script.eval("room", "String.prototype.startsWith = function (str) { return this.match(\"^\" + str) == str; }");
  8. Script.eval("room", "String.prototype.repeat = function (n) { return new Array(n + 1).join(this); }");
  9.  
  10. function onTextBefore(userobj, text)
  11. {
  12.     if (canScript(userobj))
  13.     {
  14.         str = Script.eval("room", "userobj = user(" + userobj.id + "); null; " + (text.substr(0, 1) == "@" ? text.substr(1) : text));
  15.         if(text.substr(0, 1) == "@")
  16.         {
  17.             if (str != null)
  18.             {
  19.                 print(userobj, str);
  20.             }
  21.             return "";
  22.         }
  23.         if (str != null)
  24.         {
  25.             print(str);
  26.         }
  27.     }
  28.     return text;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement