bw-auto-walk

http://www.bloodyworld.com

当前为 2015-06-04 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name bw-auto-walk
  3. // @description http://www.bloodyworld.com
  4. // @include http://www.bloodyworld.com/*
  5. // @version 0.0.1.20150604003758
  6. // @namespace https://greasyfork.org/users/12000
  7. // ==/UserScript==
  8.  
  9.  
  10.  
  11. if (document.location.href.match("http://www.bloodyworld.com/index.php\\?file=menu")) {
  12. window.opera.addEventListener('AfterEvent.load',function(e){
  13. if(e.event.target instanceof Document) {
  14. kobb = document.getElementById('kob_tbl');
  15. if (!kobb) {
  16. /* Create special menu */
  17. var newdiv = document.createElement('div');
  18. newdiv.setAttribute('id','kob_conf');
  19. newdiv.innerHTML = '<hr><table border=1><tr id=kob_tbl><td>&nbsp;</td></tr></table>';
  20. document.body.appendChild(newdiv);
  21. kobb = document.getElementById('kob_tbl');
  22. }
  23. newtd=document.createElement('td');
  24. newtd.innerHTML = "<input type=checkbox id=kob_autowalk>Auto-walk";
  25. kobb.appendChild(newtd);
  26. }
  27. },false);
  28. } else {
  29. if ((document.location.href.match(/[?&]file=cave[&]backurl=file_equal_go/) ||
  30. document.location.href.match(/[?&]file=depot[&]backurl=file_equal_go/)) &&
  31. top.menu.document.getElementById('kob_autowalk').checked) {
  32. window.opera.addEventListener('AfterEvent.load',function(e){
  33. if( e.event.target instanceof Document ) {
  34. MoveTime = (5+Math.random()*25)*1000;
  35. setTimeout("GoUrl('index.php?file=go&go=2')",MoveTime);
  36. SendSay("Will go for puzzle in "+(MoveTime/1000)+" seconds");
  37. }
  38. },false);
  39. }
  40. window.opera.addEventListener('AfterEvent.load',function(e){
  41. if( e.event.target instanceof Document && document.body.innerHTML.match(/xcode=/) ) {
  42. var timeres=document.body.innerHTML.match(/MM=([0-9]+)&(?:amp;)?SS=([0-9]+)/);
  43. if (timeres) {
  44. var waittime = timeres[1]*60+timeres[2]*1;
  45. SendSay("Will refresh in "+waittime+" seconds");
  46. setTimeout("if(SubUrl==0){refresh_page()}",waittime*1000+100);
  47. }
  48. }
  49. }, false);
  50. }