steam show Community Items beta

add Community Items images

  1. // ==UserScript==
  2. // @name steam show Community Items beta
  3. // @description add Community Items images
  4. // @namespace steam_Items_images
  5. // @author Covenant
  6. // @version 1.0.7
  7. // @license MIT
  8. // @homepage
  9. // @match https://store.steampowered.com/*
  10. // @match https://steamcommunity.com/*
  11. // @match https://steamdb.info/*
  12. // @match https://www.steamcardexchange.net/*
  13. // @icon data:image/svg+xml;base64,PHN2ZyB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMjAgMTYiIHdpZHRoPSI0MCIgaGVpZ2h0PSIzMiI+CjxjaXJjbGUgc3Ryb2tlLXdpZHRoPSIxLjVweCIgY3k9IjQuNSIgY3g9IjE1LjUiIHI9IjMuNzUiIGNsYXNzPSJzdHJva2UiIHN0cm9rZT0iI0JCQkJCQiIgZmlsbD0ibm9uZSI+PC9jaXJjbGU+CjxjaXJjbGUgY3g9IjE1LjUiIGN5PSI0LjUiIHI9IjEuODU1IiBjbGFzcz0iZmlsbCIgZmlsbD0iI0JCQkJCQiI+PC9jaXJjbGU+CjxwYXRoIGQ9Ik0xMS42NTYgNC4yTDEyLjc1IDcuMTRsMi44NjUgMS4zODctNS4xMyAzLjg1My0uODY3LTIuMDktMS43NzMtLjk0MnoiIGNsYXNzPSJmaWxsIiBmaWxsPSIjQkJCQkJCIj48L3BhdGg+CjxjaXJjbGUgY3k9IjEyLjUiIGN4PSI3LjUiIHI9IjMiIGNsYXNzPSJzdHJva2UiIHN0cm9rZT0iI0JCQkJCQiIgZmlsbD0ibm9uZSI+PC9jaXJjbGU+CjxyZWN0IHRyYW5zZm9ybT0ibWF0cml4KC45MjQzMiAuMzgxNiAtLjM4NzI3IC45MjE5NiAwIDApIiByeT0iMS41MjYiIHdpZHRoPSI5LjQ3NyIgeT0iNy4xNTUiIHg9IjMuNzY3IiBoZWlnaHQ9IjMuMDUzIiBjbGFzcz0iZmlsbCIgZmlsbD0iI0JCQkJCQiI+PC9yZWN0Pgo8L3N2Zz4=
  14. // @grant GM_setValue
  15. // @grant GM_getValue
  16. // @grant GM_registerMenuCommand
  17. // @grant GM_xmlhttpRequest
  18. // @connect www.steamcardexchange.net
  19. // @connect steamcommunity.com
  20. // @run-at document-end
  21. // @noframes
  22. // ==/UserScript==
  23. var timeoutID;
  24. var is_Community_Items_Exist=true;
  25. var is_avatar_Exist=true;
  26. const ary_lang_steam=["english","japanese","latam","bulgarian","schinese","tchinese","czech","danish","dutch","finnish","french","german","greek","hungarian","italian","koreana","norwegian","polish","brazilian","portuguese","romanian","russian","spanish","swedish","thai","turkish","ukrainian","vietnamese"];
  27. const ary_currency_steam=["USD","GBP","EUR","CHF","RUB","PLN","BRL","JPY","SEK","IDR","MYR","BWP","SGD","THB","VND","KRW","TRY","UAH","MXN","CAD","AUD","NZD","CNY","INR","CLP","PEN","COP","ZAR","HKD","TWD","SAR","AED"];
  28. const akamaihd="steamcdn-a.akamaihd.net";
  29. const steamstatic="cdn.cloudflare.steamstatic.com";
  30. const steamcommunity="steamcommunity.com";
  31. const profilebackground="/economy/profilebackground";
  32. const public_images="/steamcommunity/public/images";
  33. const priceoverview="https://steamcommunity.com/market/priceoverview/";
  34. const s_normal_Cards="&category_753_cardborder[]=tag_cardborder_0#p1_name_asc";
  35. const s_foil_cards="&category_753_cardborder[]=tag_cardborder_1#p1_name_asc";
  36. const s_p_background="&category_753_item_class[]=tag_item_class_3#p1_name_asc";
  37. const s_emotion="&category_753_item_class[]=tag_item_class_4#p1_name_asc";
  38. const s_sale_items="&category_753_item_class[]=tag_item_class_10#p1_name_asc";
  39. var gm_currency=GM_getValue('steam_currency', 1);
  40. var gm_steamcommunity_item_json=GM_getValue('load_steamcommunity_item_json', false);
  41. var url_steam_app;
  42. var url_category_753_Game;
  43. var url_avatar;
  44. var url_points_shop;
  45. var url_curatorsreviewing;
  46. var url_cardexchange;
  47. var url_steamdb_app;
  48. var url_steamdb_communityitems;
  49. var url_steamdb_achievements;
  50. function create_style(textContent,id,class_name){
  51. let style=create_node("style",class_name,true,document.body);
  52. style.type='text/css';
  53. style.id=id;
  54. style.textContent=textContent;
  55. return style;
  56. }
  57. const font_family_steam_main="font-family: 'Motiva Sans','color_emoji','Noto Sans CJK JP','Meiryo','Yu Gothic','Microsoft JhengHei','old_emoji',sans-serif;";
  58. const font_family_steam_info="font-family: Arial, Helvetica,'color_emoji','Noto Sans CJK JP','Meiryo','Yu Gothic','Microsoft JhengHei','old_emoji',sans-serif;";
  59. const font_face_lite=`
  60. @font-face{font-family: 'color_emoji';src: local('Twemoji Mozilla'),/*url('file:///C:/Program Files/Mozilla Firefox/fonts/TwemojiMozilla.ttf'),local('SamsungColorEmoji'),*/local('Noto Color Emoji'),local('Segoe UI Emoji'),local('Apple Color Emoji');}
  61. @font-face{font-family: 'symbol_emoji';src: local('Segoe UI Symbol'),local('NotoSansSymbols-Regular-Subsetted');}\n@font-face{font-family: 'old_emoji';src: local('Noto Color Emoji');}
  62. @font-face{font-family: 'NotoSans_CJK';src: local('NotoSansCJKjp-Regular');}\n`;
  63. var style_font_face=create_style(font_face_lite,"gm_font_face_Items",["user_gm_css","font_face","css_steam_Items_images"]);
  64. var style_user_css=create_style(".user_div_steam_main{"+font_family_steam_main+"font-weight: 100;}\n","gm_user_css_Items",["user_gm_css","css_steam_Items_images"]);
  65. style_user_css.textContent+=`.user_div_steam_info{`+font_family_steam_info+`font-weight: 100;}
  66. .user_newmodal_background{position: fixed;z-index: 900;background: #000000;opacity: 0.8;top: 0;right: 0;bottom: 0;left: 0;}
  67. .user_btn_steam{min-width: 2.5rem;margin-right: 2px;margin-left: 3px;margin-top: 1px;margin-bottom: 1px;padding-left: 5px;padding-right: 5px;}
  68. a[class~='external'].external{background-position-x: right;background-position-y: center;background-repeat: no-repeat;background-size: 0.857em;padding-right: 1em;background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTIiIGhlaWdodD0iMTIiPjxkZWZzPjxmaWx0ZXIgaWQ9ImRhcmtyZWFkZXItaW1hZ2UtZmlsdGVyIj48ZmVDb2xvck1hdHJpeCB0eXBlPSJtYXRyaXgiIHZhbHVlcz0iMC4yNDkgLTAuNjE0IC0wLjY3MiAwLjAwMCAxLjAzNSAtMC42NDYgMC4yODggLTAuNjY0IDAuMDAwIDEuMDIwIC0wLjYzNiAtMC42MDkgMC4yNTAgMC4wMDAgMC45OTQgMC4wMDAgMC4wMDAgMC4wMDAgMS4wMDAgMC4wMDAiIC8+PC9maWx0ZXI+PC9kZWZzPjxpbWFnZSB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbHRlcj0idXJsKCNkYXJrcmVhZGVyLWltYWdlLWZpbHRlcikiIHhsaW5rOmhyZWY9ImRhdGE6aW1hZ2Uvc3ZnK3htbDtiYXNlNjQsUEQ5NGJXd2dkbVZ5YzJsdmJqMGlNUzR3SWlCbGJtTnZaR2x1WnowaVZWUkdMVGdpUHo0S1BITjJaeUI0Yld4dWN6MGlhSFIwY0RvdkwzZDNkeTUzTXk1dmNtY3ZNakF3TUM5emRtY2lJSGRwWkhSb1BTSXhNaUlnYUdWcFoyaDBQU0l4TWlJZ2RtbGxkMEp2ZUQwaU1DQXdJREV5SURFeUlqNEtDVHgwYVhSc1pUNEtDUWxsZUhSbGNtNWhiQ0JzYVc1ckNnazhMM1JwZEd4bFBnb0pQSEJoZEdnZ1ptbHNiRDBpSXpNMll5SWdaRDBpVFRZZ01XZzFkalZNT0M0NE5pQXpMamcxSURRdU55QTRJRFFnTnk0emJEUXVNVFV0TkM0eE5rdzJJREZhVFRJZ00yZ3lkakZJTW5ZMmFEWldPR2d4ZGpKaE1TQXhJREFnTUNBeExURWdNVWd5WVRFZ01TQXdJREFnTVMweExURldOR0V4SURFZ01DQXdJREVnTVMweFdpSXZQZ284TDNOMlp6NEsiIC8+PC9zdmc+);}\n`;
  69. function create_div(class_name,is_appendChild,node,refNode){
  70. let div=create_node("div",class_name,is_appendChild,node,refNode);
  71. div.style.backgroundSize='contain';
  72. div.style.backgroundRepeat='no-repeat';
  73. div.lang='ja';
  74. return div;
  75. }
  76. var newmodal_background=create_div("user_newmodal_background",true,document.body);
  77. newmodal_background.style.setProperty('display','none');
  78. function create_a(text,url,class_name,is_appendChild,node,refNode){
  79. let anchor=create_node("a",class_name,is_appendChild,node,refNode);
  80. anchor.href=url;
  81. anchor.innerText=text;
  82. anchor.title=text;
  83. anchor.target="_blank";
  84. return anchor;
  85. }
  86. function create_img(url,title,class_name,is_appendChild,node,refNode){
  87. let img=create_node("img",class_name,is_appendChild,node,refNode);
  88. img.src=url;
  89. img.title=title;
  90. img.alt=title;
  91. return img;
  92. }
  93. function create_img_click(url,title,class_name,is_appendChild,node,refNode){
  94. let img=create_img(url,title,class_name,is_appendChild,node,refNode);
  95. img.width=54;
  96. img.addEventListener('click',() => {
  97. let img_tmp=img.cloneNode(true);
  98. img_tmp.style.setProperty('position','fixed');
  99. img_tmp.style.setProperty('left',"50%");
  100. img_tmp.style.setProperty('top',"50%");
  101. img_tmp.style.setProperty('transform',"translate(-50%,-50%)");
  102. img_tmp.style.setProperty('max-height',"95%");
  103. img_tmp.style.setProperty('z-index','1000');
  104. img_tmp.removeAttribute('width');
  105. newmodal_background.style.removeProperty('display');
  106. document.body.appendChild(img_tmp);
  107. img_tmp.addEventListener('click',() => {
  108. newmodal_background.style.setProperty('display','none');
  109. img_tmp.remove();
  110. });
  111. /*if(img.style.getPropertyValue('position')!="fixed"){
  112. img.style.setProperty('position','fixed');
  113. img.style.setProperty('left',"50%");
  114. img.style.setProperty('top',"50%");
  115. img.style.setProperty('transform',"translate(-50%,-50%)");
  116. img.style.setProperty('max-height',"95%");
  117. img.removeAttribute('width');
  118. newmodal_background.style.removeProperty('display');
  119. }else{
  120. img.style.removeProperty('position');
  121. img.style.removeProperty('left');
  122. img.style.removeProperty('top');
  123. img.style.removeProperty('transform');
  124. img.setAttribute('width', '54');
  125. newmodal_background.style.setProperty('display','none');
  126. }//*/
  127. });
  128. return img;
  129. }
  130. function create_btn(innerText,class_name,is_appendChild,node,refNode){
  131. let btn=create_node_text("button",innerText,class_name,is_appendChild,node,refNode);
  132. return btn;
  133. }
  134. function create_span(innerText,class_name,is_appendChild,node,refNode){
  135. let span=create_node_text("span",innerText,class_name,is_appendChild,node,refNode);
  136. return span;
  137. }
  138. function create_br(is_appendChild,node,refNode){
  139. let br=create_node("br",[],is_appendChild,node,refNode);
  140. return br;
  141. }
  142. function create_node(tagname,class_name,is_appendChild,node,refNode){
  143. let element=document.createElement(tagname);
  144. if(Array.isArray(class_name)){
  145. for(let i=0; i<class_name.length; i++){element.classList.add(class_name[i]);}
  146. }else if(typeof class_name==='string'){element.classList.add(class_name);}
  147. if(is_appendChild){node.appendChild(element);}else{node.insertBefore(element, refNode);}
  148. return element;
  149. }
  150. function create_node_text(tagname,innerText,class_name,is_appendChild,node,refNode){
  151. let element=create_node(tagname,class_name,is_appendChild,node,refNode);
  152. element.innerText=innerText;
  153. element.lang='ja';
  154. return element;
  155. }
  156. function fn_gm_XMLHttpRequest(url,fn){
  157. GM_xmlhttpRequest({
  158. method: "GET",
  159. url: url,
  160. headers:{
  161. 'content-type': 'text/html; charset=UTF-8',
  162. 'user-agent':window.navigator.userAgent
  163. },
  164. onload: function (response){
  165. fn(response);
  166. /*console.log([
  167. "GM_xmlhttpRequest",
  168. response.status,
  169. response.statusText,
  170. response.readyState,
  171. response.responseHeaders,
  172. //response.responseText,
  173. response.finalUrl].join("\n")
  174. );//*/
  175. }
  176. });
  177. }
  178. function fn_url(url){
  179. let obj_url=new URL(url);
  180. let params=obj_url.searchParams;
  181. return [obj_url,params];
  182. }
  183. //console.log("break");
  184. function steam_app_id(url){
  185. url=fn_url(url);
  186. let host=url[0].host;
  187. let pathname=url[0].pathname;
  188. let ary_pathname=pathname.split('/');
  189. if(url[0].host=="store.steampowered.com"){
  190. if(ary_pathname[1]=="app")return ary_pathname[2];
  191. else if(ary_pathname[1]=="api")return url[1].get('appids');
  192. }else if(url[0].host=="steamdb.info"){
  193. if(ary_pathname[1]=="app")return ary_pathname[2];
  194. }else if(url[0].host=="steamcommunity.com"){
  195. if(ary_pathname[1]=="app")return ary_pathname[2];
  196. if(ary_pathname[3]=="achievements"){//achievements
  197. if(!isNaN(ary_pathname[2])){return ary_pathname[2];}
  198. else{
  199. let gameLogo_a=document.querySelectorAll('div.gameLogo>a')[0];
  200. if(gameLogo_a!=undefined){return fn_url(gameLogo_a.href)[0].pathname.split('/')[2];}
  201. else{return null;}
  202. }
  203. }
  204. if(url[1].get('category_753_Game[]')!=null)return url[1].get('category_753_Game[]').replace(/tag_app_/i, '');//Community Market
  205. if(ary_pathname[3]=="753")return parseInt(ary_pathname[4],10);//Community Market item
  206. if(ary_pathname[3]=="gamecards")return parseInt(ary_pathname[4],10);//badge
  207. }else if(url[0].host=="www.steamcardexchange.net"){
  208. if(url[0].search.search(new RegExp("\\?gamepage-appid-", "i"))==0){
  209. return url[0].search.replace(/[^0-9.]/g, '').replace(/(\\..*?)\\..*/g, '$1');
  210. }
  211. }
  212. return null;
  213. }
  214. function fn_re_market_check(response){
  215. let dom=document.createRange().createContextualFragment(response.responseText);
  216. if(response.status==200){
  217. if(dom.querySelectorAll('div.market_sortable_column').length==0)is_Community_Items_Exist=false;
  218. let anchor=document.querySelectorAll('a.anchor_Items');
  219. for(let i = 0; i < anchor.length; i++){
  220. if(is_Community_Items_Exist){
  221. anchor[i].parentNode.classList.add('link_item');
  222. }else{anchor[i].style.display="none";}
  223. }
  224. anchor[0].parentNode.classList.add('checked_item');
  225. }else{//451
  226. console.log("market response.status: "+response.status+response.responseHeaders);
  227. }
  228. }
  229. function fn_re_avatar_check(response){
  230. if(response.status==200){
  231. if(response.finalUrl.search(new RegExp("/Avatar/List", "i"))==-1)is_avatar_Exist=false;
  232. let anchor=document.querySelectorAll('a.anchor_avatar')[0];
  233. if(is_avatar_Exist){
  234. anchor.parentNode.classList.add('link_avatar');
  235. }else{anchor.style.display="none";}
  236. anchor.parentNode.classList.add('checked_avatar');
  237. }else{//
  238. console.log("avatar response.status: "+response.status+response.responseHeaders);
  239. }
  240. }
  241. function fn_re_item(response){
  242. let dom=document.createRange().createContextualFragment(response.responseText);
  243. let url=fn_url(response.finalUrl);
  244. let appid=url[0].search.replace(/\?gamepage-appid-/i, '');
  245. if(response.status==200){
  246. let output=document.querySelectorAll('div.user_item')[0];
  247. //
  248. let dom_div=Array.from(dom.querySelectorAll('.container>div'));
  249. let count_card;
  250. let a_booster;
  251. for(let i=0; i<dom_div.length; i++){
  252. if(dom_div[i].classList.contains('items-center')){
  253. let div_span_a=dom_div[i].querySelectorAll('span>a').length>0?dom_div[i].querySelectorAll('span>a')[0].innerText:null;
  254. if(div_span_a==null)continue;
  255. if(div_span_a.search(/Trading Cards/i)==0){
  256. count_card=dom_div[i+1].querySelectorAll('div>a>img').length;
  257. }
  258. if(div_span_a.search(/Booster Pack/i)==0){
  259. let href_booster=dom_div[i+1].querySelectorAll('div>a')[0].href;
  260. a_booster=create_a("booster "+6000/(count_card),href_booster,["linkbar","booster"],true,output);
  261. let market_hash_name=href_booster.replace(new RegExp("https://steamcommunity.com/market/listings/753/", "i"), '');
  262. if(gm_steamcommunity_item_json)fn_gm_XMLHttpRequest(priceoverview+"?appid=753&market_hash_name="+market_hash_name+"&currency="+gm_currency,fn_re_json_priceoverview);
  263. }
  264. if(div_span_a.search(/Badges/i)!=-1){
  265. let ary_img=dom_div[i+1].querySelectorAll('div>img');
  266. for(let j=0; j<ary_img.length; j++){
  267. create_img_click(ary_img[j].src.replace(akamaihd, steamstatic),"Badges",[],true,output);
  268. }
  269. create_br(true,output);
  270. }
  271. if(div_span_a.search(/Emoticons/i)==0){
  272. let ary_img=dom_div[i+1].querySelectorAll('div>img');
  273. for(let j=0; j<ary_img.length; j++){
  274. if(ary_img[j].src.search(new RegExp("/economy/emoticon", "i"))!=-1)continue;
  275. create_img_click(ary_img[j].src.replace(akamaihd, steamstatic),"Emoticons",[],true,output);
  276. }
  277. create_br(true,output);
  278. }
  279. if(div_span_a.search(/Backgrounds/i)==0){
  280. let ary_img=dom_div[i+1].querySelectorAll('div>a>img');
  281. for(let j=0; j<ary_img.length; j++){
  282. create_img_click(ary_img[j].src.replace(steamcommunity, steamstatic).replace(profilebackground, public_images),"Backgrounds",[],true,output);
  283. }
  284. create_br(true,output);
  285. }
  286. if(div_span_a.search(/Animated Stickers/i)==0){
  287. let ary_img=dom_div[i+1].querySelectorAll('div>div.hover-toggle-secondary>img');
  288. for(let j=0; j<ary_img.length; j++){
  289. create_img_click(ary_img[j].src,"Animated Stickers",[],true,output);
  290. }
  291. create_br(true,output);
  292. }
  293. if(div_span_a.search(/Animated Backgrounds/i)==0){
  294. let ary_img=dom_div[i+1].querySelectorAll('div>div.hover-toggle-primary>img');
  295. for(let j=0; j<ary_img.length; j++){
  296. create_img_click(ary_img[j].src.replace(steamcommunity, steamstatic).replace(profilebackground, public_images),"Animated Backgrounds",[],true,output);
  297. }
  298. }
  299. if(div_span_a.search(/Animated Mini Backgrounds/i)==0){
  300. let ary_img=dom_div[i+1].querySelectorAll('div>div.hover-toggle-primary>img');
  301. for(let j=0; j<ary_img.length; j++){
  302. create_img_click(ary_img[j].src,"Animated Mini Backgrounds",[],true,output);
  303. }
  304. }
  305. if(div_span_a.search(/Avatar Frames/i)==0){
  306. let ary_img=dom_div[i+1].querySelectorAll('div>div.hover-toggle-secondary>img');
  307. for(let j=0; j<ary_img.length; j++){
  308. create_img_click(ary_img[j].src,"Avatar Frames",[],true,output);
  309. }
  310. create_br(true,output);
  311. }
  312. if(div_span_a.search(/Animated Avatars/i)==0){
  313. let ary_img=dom_div[i+1].querySelectorAll('div>div.hover-toggle-secondary>img');
  314. for(let j=0; j<ary_img.length; j++){
  315. create_img_click(ary_img[j].src,"Animated Avatars",[],true,output);
  316. }
  317. create_br(true,output);
  318. }
  319. }
  320. }
  321. if(dom_div.length>0){output.appendChild(a_booster);}
  322. else{
  323. create_span("fn_re_item querySelectorAll error",[],true,output);
  324. }
  325. console.log("fn_re_item 200");
  326. }else{//
  327. console.log("item response.status: "+response.status+response.responseHeaders);
  328. }
  329. }
  330. function fn_re_avatar(response){
  331. let dom=document.createRange().createContextualFragment(response.responseText);
  332. let url=fn_url(response.finalUrl);
  333. if(response.status==200){
  334. let output=document.querySelectorAll('div.user_item')[0];//console.log(response.responseText);
  335. let avatarBlockFull=Array.from(dom.querySelectorAll('div#avatarBlockFull>a>img'));
  336. for(let j=0; j<avatarBlockFull.length; j++){
  337. let img_url=avatarBlockFull[j].src;
  338. create_img_click(img_url,'',null,true,output);
  339. }
  340. create_br(true,output);
  341. console.log("fn_re_avatar 200");
  342. }else{//
  343. console.log("avatar response.status: "+response.status+response.responseHeaders);
  344. }
  345. }
  346. function fn_re_json_priceoverview(response){
  347. let output;
  348. if(document.location.host=="steamcommunity.com")output=document.querySelectorAll('div#largeiteminfo_item_type')[0];
  349. else if(document.location.host=="store.steampowered.com")output=document.querySelectorAll('a.booster')[0];
  350. else if(document.location.host=="www.steamcardexchange.net")output=document.querySelectorAll('.container>div>span.truncate')[1];
  351. if(response.status==200){
  352. let url=fn_url(response.finalUrl);
  353. let json=JSON.parse(response.responseText);
  354. let lowest_price=json['lowest_price'];
  355. output.innerText+=" "+lowest_price;
  356.  
  357. }else{//
  358. console.log("json_render response.status: "+response.status+response.responseHeaders);
  359. create_span(" response_status: "+response.status,"response_status",true,output);
  360. }
  361. }
  362. function fn_re_json_render(response){
  363. let output;
  364. if(document.location.host=="steamcommunity.com")output=document.querySelectorAll('div#largeiteminfo_game_info')[0];
  365. else if(document.location.host=="store.steampowered.com")output=document.querySelectorAll('div.user_item')[0];
  366. else if(document.location.host=="www.steamcardexchange.net")output=document.querySelectorAll('div.game-title')[0];
  367. if(response.status==200){
  368. let url=fn_url(response.finalUrl);
  369. let json=JSON.parse(response.responseText);
  370. let text=json['results_html'];
  371. let results_html=document.createRange().createContextualFragment(text);
  372. let market_listing_price=results_html.querySelectorAll('span.market_listing_price');
  373. for(let i=0; i<market_listing_price.length; i++){
  374. output.appendChild(market_listing_price[i]);
  375. }
  376. }else{//
  377. console.log("json_render response.status: "+response.status+response.responseHeaders);
  378. create_span(" response_status: "+response.status,"response_status",true,output);
  379. }
  380. }
  381. function main_01(game_meta_data,appid){
  382. var tmp=document.querySelectorAll('div.Community_Items')[0];//old script
  383. if(tmp==undefined){
  384. var category_block=document.querySelectorAll('div#category_block')[0];
  385. var div_item_link=create_div(['block',"user_div_steam_info","Community_Items"],false,game_meta_data[0],category_block);
  386. var a_avatar=create_a("Avatar",url_avatar,['linkbar',"anchor_avatar"],true,div_item_link);
  387. var a_market=create_a("Community Market",url_category_753_Game,['linkbar',"anchor_Items"],true,div_item_link);
  388. var a_points=create_a("Points Shop",url_points_shop,['linkbar',"anchor_Items"],true,div_item_link);
  389. var a_steamcardexchange=create_a("steamcardexchange",url_cardexchange,['linkbar',"anchor_Items","external"],true,div_item_link);
  390. var a_steamdb=create_a("steamdb/communityitems",url_steamdb_communityitems,['linkbar',"anchor_Items","external"],true,div_item_link);
  391. div_item_link.style.backgroundImage="url('https://cdn.cloudflare.steamstatic.com/steam/apps/"+appid+"/page_bg_generated_v6b.jpg')";
  392. div_item_link.classList.add('link_dev');
  393. fn_gm_XMLHttpRequest(url_category_753_Game,fn_re_market_check);
  394. fn_gm_XMLHttpRequest(url_avatar,fn_re_avatar_check);
  395. }
  396. }
  397. function main_02(){
  398. let div_Community_item=document.querySelectorAll('div.Community_Items')[0];
  399. if(div_Community_item.classList.contains('checked_item')&&div_Community_item.classList.contains('checked_avatar')){
  400. window.clearInterval(timeoutID);
  401. if(div_Community_item.classList.contains('link_item'))fn_gm_XMLHttpRequest(url_cardexchange,fn_re_item);
  402. if(div_Community_item.classList.contains('link_avatar'))fn_gm_XMLHttpRequest(url_avatar,fn_re_avatar);//page dont load
  403. }
  404. }
  405. function main_inventory(){
  406. let url=fn_url(document.location);
  407. let econ_tag_filter_checkbox=document.querySelectorAll("input[type='checkbox'].econ_tag_filter_checkbox");
  408. for(let i=0; i<econ_tag_filter_checkbox.length; i++){
  409. let tag_name=econ_tag_filter_checkbox[i].getAttribute("tag_name");
  410. if(tag_name.search(/app_/i)==0&&!econ_tag_filter_checkbox[i].classList.contains('done')){
  411. let appid=tag_name.replace("app_","");
  412. create_a("Market","https://steamcommunity.com/market/search?appid=753&category_753_Game[]=tag_app_"+appid+"#p1_name_asc",["btn_green_white_innerfade","user_btn_steam"],true,econ_tag_filter_checkbox[i].parentNode);
  413. create_a("steamcardexchange","https://www.steamcardexchange.net/index.php?gamepage-appid-"+appid,["btnv6_blue_hoverfade","user_btn_steam","external"],true,econ_tag_filter_checkbox[i].parentNode);
  414. create_a("gamecards","https://"+url[0].host+url[0].pathname.replace("inventory","gamecards")+appid+url[0].search,["btn_grey_white_innerfade","user_btn_steam"],true,econ_tag_filter_checkbox[i].parentNode);
  415. econ_tag_filter_checkbox[i].classList.add("done");
  416. }
  417. }
  418. }
  419. function fn_steam_url(appid){
  420. url_steam_app="https://store.steampowered.com/app/"+appid;
  421. url_category_753_Game="https://steamcommunity.com/market/search?appid=753&category_753_Game[]=tag_app_"+appid+"#p1_name_asc";
  422. url_avatar="https://steamcommunity.com/ogg/"+appid+"/Avatar/List";
  423. url_points_shop="https://store.steampowered.com/points/shop/app/"+appid;
  424. url_curatorsreviewing="https://store.steampowered.com/curators/curatorsreviewing/?appid="+appid;
  425. url_cardexchange="https://www.steamcardexchange.net/index.php?gamepage-appid-"+appid;
  426. url_steamdb_app="https://steamdb.info/app/"+appid+"/";
  427. url_steamdb_communityitems="https://steamdb.info/app/"+appid+"/communityitems/";
  428. url_steamdb_achievements="https://steamdb.info/app/"+appid+"/stats/";
  429. }
  430. (function(){//main
  431. 'use strict';
  432. let url=fn_url(document.location);
  433. let appid=steam_app_id(document.location);//document.location.host+document.location.pathname+document.location.search+document.location.hash
  434. fn_steam_url(appid);
  435. let lang=document.documentElement.lang;
  436. GM_registerMenuCommand("load json price"+(gm_steamcommunity_item_json?"✔️":"❌"), () => {
  437. GM_setValue('load_steamcommunity_item_json',!gm_steamcommunity_item_json);
  438. });
  439. console.log("steam: "+appid+" "+url[0].host);
  440. if(url[0].host=="store.steampowered.com"){
  441. let game_meta_data=document.querySelectorAll('div.game_meta_data');//steam game page
  442. if(game_meta_data.length>0){
  443. window.setTimeout(( () => main_01(game_meta_data,appid) ), 100);//old script
  444. let div_item_heading=create_node_text("div","community items",['block',"heading"],true,game_meta_data[0]);
  445. let div_item_main=create_div(['block',"user_div_steam_info","user_item"],true,game_meta_data[0]);
  446. timeoutID = window.setInterval(( () => main_02()), 1000);//show item image
  447. let div_curators=create_div(['block',"user_div_steam_info","user_curators"],true,game_meta_data[0]);
  448. create_a("curators",url_curatorsreviewing,"linkbar",true,div_curators);
  449. }
  450. if(url[0].pathname=="/curators/curatorsreviewing/"){//steam curatorsreviewing page
  451. let page_content=document.querySelectorAll('div.light_container>div.page_content');
  452. let div_lang=create_div(["breadcrumbs","user_div_steam_main"],false,page_content[0],page_content[0].firstChild);
  453. for(let i=0; i<ary_lang_steam.length; i++){
  454. let anchor_lang=create_a(ary_lang_steam[i],"#","lang",true,div_lang);
  455. anchor_lang.setAttribute("onclick","ChangeLanguage('"+ary_lang_steam[i]+"'); return false;");
  456. create_span(" / ","breadcrumb_separator",true,div_lang);
  457. }
  458. }
  459. }else if(url[0].host=="steamcommunity.com"&&document.querySelectorAll('div.error_ctn')[0]==undefined){
  460. let div_1=document.querySelectorAll('div.market_search_results_header>div')[0];//market/search
  461. if(div_1!=undefined){
  462. create_a(appid,url_steam_app,"market_searchedForTerm",true,div_1);
  463. create_a("steamdb",url_steamdb_communityitems,["market_searchedForTerm","external"],true,div_1);
  464. create_a("steamcardexchange",url_cardexchange,["market_searchedForTerm","external"],true,div_1);
  465. create_a("Normal Cards","https://"+url[0].host+url[0].pathname+url[0].search+s_normal_Cards,"market_searchedForTerm",true,div_1);
  466. create_a("Foil Cards","https://"+url[0].host+url[0].pathname+url[0].search+s_foil_cards,"market_searchedForTerm",true,div_1);
  467. create_a("Profile Background","https://"+url[0].host+url[0].pathname+url[0].search+s_p_background,"market_searchedForTerm",true,div_1);
  468. create_a("Emotion","https://"+url[0].host+url[0].pathname+url[0].search+s_emotion,"market_searchedForTerm",true,div_1);
  469. create_a("Sale Items","https://"+url[0].host+url[0].pathname+url[0].search+s_sale_items,"market_searchedForTerm",true,div_1);
  470. }
  471. if(url[0].pathname.search(new RegExp("/market/listings/", "i"))==0){//market/listings
  472. let div_2=document.querySelectorAll('div.market_listing_nav')[0];
  473. let div_3=document.querySelectorAll('div#mainContents')[0];
  474. let app_id=parseInt(url[0].pathname.replace(new RegExp("/market/listings/", "i"), ''));
  475. let market_hash_name=url[0].pathname.replace(new RegExp("/market/listings/"+app_id+"/", "i"), '');
  476. create_a(appid,url_steam_app,["btn_green_white_innerfade","user_btn_steam"],true,div_2);
  477. create_a("steamdb",url_steamdb_communityitems,["btn_grey_white_innerfade","user_btn_steam","external"],true,div_2);
  478. create_a("steamcardexchange",url_cardexchange,["btn_grey_white_innerfade","user_btn_steam","external"],true,div_2);
  479. create_a("priceoverview",priceoverview+"?appid="+app_id+"&market_hash_name="+market_hash_name+"&currency="+gm_currency,["btn_darkred_white_innerfade","user_btn_steam"],true,div_2);
  480. let a_render=create_a("render?currency="+gm_currency+"&format=json","https://"+url[0].host+url[0].pathname+"/render?start=0&count=10&currency="+gm_currency+"&language=english&format=json",["btn_darkred_white_innerfade","user_btn_steam"],true,div_2);
  481. a_render.title="You have made too many requests. Please wait and try your request again later.";
  482. if(gm_steamcommunity_item_json)fn_gm_XMLHttpRequest(priceoverview+"?appid="+app_id+"&market_hash_name="+market_hash_name+"&currency="+gm_currency,fn_re_json_priceoverview);
  483. let anchor=document.querySelectorAll('div.market_listing_nav>a');
  484. for(let i=0; i<anchor.length; i++){
  485. if(anchor[i].href.search(new RegExp("category_753_Game", "i"))!=-1){
  486. anchor[i].href+="#p1_name_asc";
  487. break;
  488. }
  489. }
  490. for(let i=0; i<ary_currency_steam.length; i++){//btn_currency
  491. let btn_currency=create_btn(ary_currency_steam[i],["btnv6_blue_hoverfade","user_btn_steam"],true,div_3);
  492. btn_currency.addEventListener('click',() => {
  493. GM_setValue('steam_currency', i+1);
  494. });
  495. }
  496. }
  497. if(url[0].pathname.search(/\/stats\/\d+\/achievements/i)==0){//achievements /stats/\d+/achievements
  498. let div_tab=document.querySelectorAll('div#mainContents>div#tabs')[0];
  499. if(div_tab!=undefined){
  500. let div_achievements=create_div(["tabOff","user_div_steam_info"],true,div_tab);
  501. create_a("steamdb achievements",url_steamdb_achievements,["steamdb","external"],true,div_achievements);
  502. }
  503. }
  504. let div_profile_small_header_text=document.querySelectorAll('div.profile_small_header_text')[0];//profile game badge
  505. if(div_profile_small_header_text!=undefined){
  506. create_span("🛍️","profile_small_header_arrow",true,div_profile_small_header_text);
  507. create_a("Community Market",url_category_753_Game,"anchor",true,div_profile_small_header_text);
  508. }
  509. if(url[0].pathname.search(/\/profiles\/\d+\/gamecards/i)==0||url[0].pathname.search(/\/id\/.+\/gamecards/i)==0){//profiles/\d+/gamecards //id/.+/gamecards
  510. let gamecard=document.querySelectorAll('img.gamecard');
  511. if(gamecard.length>0)document.querySelectorAll('div.badge_title')[0].innerText+=" ["+6000/gamecard.length+"]";
  512. }
  513. if(url[0].pathname.search(/\/profiles\/\d+\/inventory/i)==0||url[0].pathname.search(/\/id\/.+\/inventory/i)==0){//profiles/\d+/inventory //id/.+/inventory
  514. window.setInterval(( () => main_inventory() ), 3000);
  515. }
  516. }else if(url[0].host=="steamdb.info"){
  517. if(appid!=null){
  518. let app_links=document.querySelectorAll('nav.app-links')[0];
  519. let tab_communityitems=document.querySelectorAll('a#tab-communityitems')[0];
  520. if(app_links!=undefined){
  521. if(tab_communityitems!=undefined)create_a("Community Market",url_category_753_Game,"linkbar",true,app_links);
  522. create_a("curators",url_curatorsreviewing,"linkbar",true,app_links);
  523. }
  524. }
  525. }else if(url[0].host=="www.steamcardexchange.net"){
  526. let container_div=document.querySelectorAll('.container>div');
  527. let count_card;
  528. for(let i=0; i<container_div.length; i++){
  529. if(container_div[i].classList.contains('items-center')){
  530. let div_span_a=container_div[i].querySelectorAll('span>a').length>0?container_div[i].querySelectorAll('span>a')[0].innerText:null;
  531. if(div_span_a!=null){
  532. if(div_span_a.search(/Trading Cards/i)==0){
  533. count_card=container_div[i+1].querySelectorAll('div>a>img').length;
  534. }
  535. if(div_span_a.search(/Booster Pack/i)==0){
  536. let href_booster=container_div[i+1].querySelectorAll('div>a')[0].href;
  537. let market_hash_name=href_booster.replace(new RegExp("https://steamcommunity.com/market/listings/753/", "i"), '');
  538. if(gm_steamcommunity_item_json)fn_gm_XMLHttpRequest(priceoverview+"?appid=753&market_hash_name="+market_hash_name+"&currency="+gm_currency,fn_re_json_priceoverview);
  539. }
  540. }
  541. if(container_div[i].classList.contains('lg\:flex-row')){//link
  542. let btn_primary=container_div[i].querySelectorAll('div>a');
  543. for(let i=0; i<btn_primary.length; i++){
  544. if(btn_primary[i].innerText.search(new RegExp("STEAM MARKET", "i"))==0){
  545. btn_primary[i].href+="#p1_name_asc";break;
  546. }
  547. }
  548. create_a("steamdb",url_steamdb_app,["btn-primary","lg:w-min"],true,container_div[i]);
  549. }
  550. }
  551. }
  552. let game_name=document.querySelectorAll('.container>div>span.truncate').length>1?document.querySelectorAll('.container>div>span.truncate')[1]:null;
  553. if(game_name!=null){game_name.innerText+=" ["+6000/count_card+"]";}
  554. if(container_div.length==0)console.log("querySelectorAll error");
  555. }
  556. })();
  557. /*
  558. btn_green_white_innerfade
  559. btn_blue_white_innerfade
  560. btn_darkblue_white_innerfade
  561. btn_darkred_white_innerfade
  562. btn_grey_white_innerfade
  563. btn_grey_grey
  564. btn_grey_grey_outer_bevel
  565. btn_grey_black
  566. btnv6_blue_hoverfade
  567. btnv6_lightblue_blue
  568. btnv6_blue_blue_innerfade
  569. btnv6_green_white_innerfade
  570. btnv6_grey_black
  571. btnv6_white_transparent
  572. btn_teal
  573. btn_royal_blue
  574. btn_plum
  575. btn_green_steamui
  576. btn_grey_steamui
  577. btn_blue_steamui
  578. //old
  579. div.badge>div>img
  580. div.emoticon>div>img
  581. div.background>div>a>img
  582. div.avataranimated>div>img.image-animated
  583. div.sticker>div>img.image-animated
  584. div.minibg>div>img
  585. div.booster>div>div>a
  586. div.card>div>a>img
  587. */