steam csgo社区商店 页面跳转 - steamcommunity.com

2022/5/8 16:10:20

  1. // ==UserScript==
  2. // @name steam csgo社区商店 页面跳转 - steamcommunity.com
  3. // @namespace Violentmonkey Scripts
  4. // @match https://steamcommunity.com/market/listings/730/*
  5. // @grant none
  6. // @version 1.0
  7. // @author -
  8. // @description 2022/5/8 16:10:20
  9. // @license GPL License
  10. // ==/UserScript==
  11. (function() {
  12. var style = document.createElement("style");
  13. style.type = "text/css";
  14.   style.appendChild(document.createTextNode(".myBtnStyle{display:inline-block;background-color:#799905; font-size:10px;color:#FFF;margin-left:15px;padding:2px;border-radius:3px;cursor:pointer;}"));
  15. var head = document.getElementsByTagName("head")[0];
  16. head.appendChild(style);
  17. let appendSpan = document.createElement("SPAN");
  18. appendSpan.innerHTML = "<input id='appendSpanInput' /><div id='gotoPage' class='myBtnStyle'>跳转</div>"
  19. document.getElementsByClassName('market_paging_summary')[0].appendChild(appendSpan)
  20. document.getElementById("gotoPage").addEventListener("click",function(event){
  21. let v = document.getElementById("appendSpanInput").value + "0";
  22.  
  23. fetch(window.location.href +'/render/?query=&start='+v+'&count=10&country=CN&language=schinese&currency=23',{
  24. method:'GET',
  25. // headers:Headers,
  26. mode:'cors'
  27.  
  28. }).then(Response=> Response.json()).then(
  29. data => {
  30. if(data == null){
  31. alert("请求次数过多或页数输入错误,请稍后再试!")
  32. }
  33. else{
  34. document.getElementById("searchResultsRows").innerHTML = data['results_html'];
  35. }
  36.  
  37. }
  38. );
  39.  
  40.  
  41. })
  42. })();