Solving maths is fun

Solves fun math

安裝腳本?
作者推薦腳本

您可能也會喜歡 TagPro RL Chat

安裝腳本
  1. // ==UserScript==
  2. // @name Solving maths is fun
  3. // @description Solves fun math
  4. // @author Ko
  5. // @version 1.2
  6. // @include *.koalabeast.com:*
  7. // @include *.jukejuice.com:*
  8. // @include *.newcompte.fr:*
  9. // @include *.koalabeast.com/game
  10. // @include *.jukejuice.com/game
  11. // @include *.newcompte.fr/game
  12. // @icon https://raw.githubusercontent.com/wilcooo/TagPro-ScriptResources/master/maths.png
  13. // @supportURL https://www.reddit.com/message/compose/?to=Wilcooo
  14. // @license MIT
  15. // @namespace https://greasyfork.org/users/152992
  16. // ==/UserScript==
  17.  
  18.  
  19. tagpro.ready(function() {
  20.  
  21. var names = [];
  22.  
  23. tagpro.socket.on('p', function(p) {
  24.  
  25. for (var pu of (p.u || p)) {
  26.  
  27. if (pu.name != names[pu.id]) {
  28. names[pu.id] = pu.name;
  29.  
  30. if (pu.name && isNaN(pu.name) && pu.name.match(/^[ \d×÷=/*+-]+$/)) {
  31. try {
  32. var answer = eval(pu.name.replace('×','*').replace('÷','/').replace('=',''));
  33. setTimeout(tagpro.socket.emit,
  34. 500 + Math.random()*1000,
  35. 'chat', {message:String(answer)});
  36. } catch(e){}
  37. }
  38. }
  39. }
  40. });
  41. });