GOS scraper

try to take over the world!

当前为 2018-01-02 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name GOS scraper
  3. // @namespace https://www.gatesofsurvival.com
  4. // @version 0.70
  5. // @description try to take over the world!
  6. // @author Opal
  7. // @match https://www.gatesofsurvival.com/game/index.php?page=main
  8. // @grant none
  9. // ==/UserScript==
  10. extraButtonCode = "<div id=\"extra2\" class = \"classy\"><li class=\"classy\">Opal's Addons</li></div>";
  11. outputButtonCode ="<div id=\"output2\" class = \"classy\"><li class=\"classy\">---</li></div>";
  12. outputButton2Code ="<div id=\"output3\" class = \"classy\"><li class=\"classy\">---</li></div>";
  13. $("#logout").after(extraButtonCode);
  14. $("#extra2").after(outputButtonCode);
  15. $("#output2").after(outputButton2Code);
  16. $("#extra2").click(function(){
  17. var textNodes = $("#page > center table[width='80%'] tr").children('*').contents();
  18. var arr = ["0"];
  19. var skillTitles = [];
  20. var skillValues = [];
  21.  
  22.  
  23.  
  24. var transferIndex = 0;
  25. $.each(textNodes, function(index, value){
  26.  
  27. var zoop = $(value);
  28. var zoopText = zoop.text().trim();
  29. if (value.nodeType === 1 && (zoop.html().indexOf('Level') > -1))
  30. {
  31. arr.push(zoopText);
  32. skillTitles.push(zoopText);
  33. } else if (value.nodeType === 3 && zoopText !== '' && zoopText !== '\n'){
  34. //&& (arr[arr.length-1].indexOf('Level') > -1)
  35. console.log(zoopText);
  36. zoop = zoopText.split(",").join("");
  37. var maxValue = /\s\d+\s(?!\/)/;
  38. var found = zoop.match(maxValue);
  39. if (found){
  40. zoop = found[0];
  41. }
  42. skillLevel = zoop.replace(": ","");
  43. arr.push(skillLevel);
  44. skillValues.push(skillLevel);
  45. }
  46. });
  47. var outputForm = "<form><input type = \"text\" id=\"outputform\" value=\"\">";
  48. var outputForm3 = "<form><input type = \"text\" id=\"outputform3\" value=\"\">";
  49. arr.splice(0, 1);
  50. var output = skillValues.join(",");
  51. $("#output2").html(outputForm);
  52. $("#output3").html(outputForm3);
  53. $("#outputform").val((skillValues.join("\t")));
  54. console.log(skillTitles);
  55. $("#outputform3").val((skillTitles.join("\t")));
  56. });
  57.  
  58.  
  59.  
  60.