Clickcritters Monthly Adopter

Adopts all Clickcritters monthlies with their default names

当前为 2015-08-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Clickcritters Monthly Adopter
  3. // @namespace github.com/richardmin97/ClickCrittersScripts/
  4. // @version 0.0.3
  5. // @description Adopts all Clickcritters monthlies with their default names
  6. // @author Seiryuu
  7. // @author Richard Min
  8. // @match http://*.clickcritters.com/adoptables.php*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13. function xpath(query) {
  14. return document.evaluate(query, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0);
  15. }
  16.  
  17. var form;
  18.  
  19. if (form = xpath("//form[@method='post']"))
  20. {
  21. form.submit();
  22. }
  23.  
  24.  
  25. if(document.body.innerHTML.indexOf("You have been awarded a ") != -1)
  26. {
  27. window.location.replace("http://www.clickcritters.com/adoptables.php");
  28. }
  29.  
  30. //todo: use jquery so this isn't so bad