Sleazy Fork is available in English.

Unlock region restrictions

Bypass some kind of region restrictions.

  1. // ==UserScript==
  2. // @name Unlock region restrictions
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.4
  5. // @description Bypass some kind of region restrictions.
  6. // @author CharRun
  7. // @grant GM_xmlhttpRequest
  8. // @run-at document-body
  9. // @connect steampowered.com
  10. // @include https://store.steampowered.com/app/*
  11. // @include https://store.steampowered.com/bundle/*
  12. // @include https://store.steampowered.com/sub/*
  13. // @include https://store.steampowered.com/search/*
  14. // @include https://store.steampowered.com/agecheck/*
  15. // ==/UserScript==
  16.  
  17. (()=>{
  18. let accountID = 0;
  19. let currentAppID = 0;
  20. let currentStoreType = null;
  21. let currentCountry = null;
  22.  
  23. let conf = {
  24. autoCheck:true,
  25. advancedSearch:false,
  26. defaultCountry:"美国",
  27. presetCountriesList:{
  28. "中国":"cn",
  29. "美国":"us",
  30. "加拿大":"ca",
  31. "俄罗斯":"ru",
  32. "澳大利亚":"au",
  33. "英国":"gb",
  34. "新加坡":"sg",
  35. "法国":"fr",
  36. "香港":"hk",
  37. "印度":"in",
  38. "日本":"jp",
  39. "韩国":"kr"
  40. }
  41. };
  42.  
  43. let temp = {};
  44. let blockingWaitDialog;
  45.  
  46. function init() {
  47. conf = JSON.parse(localStorage.getItem("STEAMCC_CONF")) || conf;
  48. if (typeof g_AccountID == "undefined" || typeof g_oSuggestParams == "undefined") {
  49. setTimeout(init,500);
  50. return;
  51. }
  52. accountID = g_AccountID;
  53. currentCountry = g_oSuggestParams ? g_oSuggestParams.cc.toLowerCase() : null;
  54. }
  55.  
  56.  
  57. function autoCheck() {
  58. if( location.pathname.match( /\/(app|sub|bundle)\/([0-9]{1,7})/ ) ){
  59. let result = location.pathname.match( /\/(app|sub|bundle)\/([0-9]{1,7})/ );
  60. currentStoreType = result[1];
  61. currentAppID = result[2];
  62. if((document.getElementById("error_box")||document.getElementById("agecheck_form")||document.getElementById("app_agegate")) && conf.autoCheck){
  63. if( cookieMIssCheck() ){
  64. blockingWaitDialog = ShowBlockingWaitDialog("检测到访问限制", `${conf.defaultCountry} 区域匿名数据获取中...`);
  65. anonymousAccess(conf.defaultCountry);
  66. }else{
  67. blockingWaitDialog = ShowBlockingWaitDialog("验证信息缺失", "设置关键Cookies中...");
  68. setCookie();
  69. }
  70. }
  71. }else if( /search\//ig.test(location.pathname) ){
  72. currentStoreType = "search";
  73. if( conf.advancedSearch ) {
  74. blockingWaitDialog = ShowBlockingWaitDialog("跨区搜索", `${conf.defaultCountry} 区域搜索结果获取中...`);
  75. anonymousAccess(conf.defaultCountry);
  76. }
  77. }else{
  78. //Not supported yet
  79. }
  80. }
  81.  
  82.  
  83.  
  84. function cookieMIssCheck() {
  85. let cookies = cookieParse();
  86. let wants_mature_content = cookies.wants_mature_content ? cookies.wants_mature_content == "1" ? true : false : false;
  87. let mature_content = cookies.mature_content ? cookies.mature_content == "1" ? true : false : false;
  88. let birthtime = cookies.birthtime ? cookies.birthtime <= "978278400" ? true : false : false;
  89. let lastagecheckage = cookies.lastagecheckage ? true : false;
  90. if(wants_mature_content&&mature_content&&birthtime&&lastagecheckage) return true;
  91. return false;
  92. }
  93. function cookieParse() {
  94. let cookieString = document.cookie;
  95. let cookieArray = cookieString.split(";");
  96. let cookies = {};
  97. for(let i = 0 , l = cookieArray.length; i < l ; i++){
  98. let cookie = cookieArray[i].trim();
  99. if(cookie == "") continue;
  100. let c = cookie.split("=");
  101. cookies[c[0]] = c[1];
  102. }
  103. return cookies;
  104. }
  105.  
  106. function setCookie() {
  107. let date = new Date();
  108. date.setTime(date.getTime() + 1000 * 3600 * 24 * 365);
  109. let expires = `expires=${date.toUTCString()};`;
  110. let path = "path=/;";
  111. document.cookie= "wants_mature_content=1;" + path + expires;
  112. document.cookie= "mature_content=1;" + path + expires;
  113. document.cookie= "lastagecheckage=1-January-1970;" + path + expires;
  114. document.cookie= "birthtime=-729000000;" + path + expires;
  115. blockingWaitDialog = blockingWaitDialog && blockingWaitDialog.Dismiss();
  116. location.href = location.href.replace( /\/agecheck/, "" );
  117. }
  118.  
  119.  
  120. function anonymousAccess(region) {
  121. region = region ? conf.presetCountriesList[region] ? conf.presetCountriesList[region] : region : "us";
  122. if(currentCountry == region){
  123. blockingWaitDialog = blockingWaitDialog && blockingWaitDialog.Dismiss();
  124. ShowConfirmDialog("访问暂停","访问区域与当前账户区域一致","继续访问","返回").done( result => {
  125. result && access(region);
  126. } );
  127. return;
  128. }else{
  129. access(region);
  130. }
  131.  
  132. function access(region) {
  133. blockingWaitDialog = blockingWaitDialog || ShowBlockingWaitDialog("匿名访问中", `${region} 区域匿名数据获取中...`);
  134.  
  135. let url = `${location.protocol + "//www.steampowered.com" + location.pathname.replace( /\/agecheck/, "" ) + (location.search == "" ? "?" : (location.search + "&"))}cc=${region}`;
  136.  
  137. GM_xmlhttpRequest({
  138. method:"GET",
  139. url:url,
  140. timeout:5000,
  141. headers:{
  142. Cookie:"wants_mature_content=1;mature_content=1;lastagecheckage=1-January-1970;birthtime=0"
  143. },
  144. onload: res => ifarme(res,region),
  145. ontimeout:timeout,
  146. onerror:fail
  147. });
  148.  
  149. function timeout () {
  150. blockingWaitDialog = blockingWaitDialog && blockingWaitDialog.Dismiss();
  151. ShowConfirmDialog("访问超时","数据获取失败...","再试一次","取消").done( result => {
  152. result && access(region);
  153. });
  154. }
  155.  
  156. function fail() {
  157. blockingWaitDialog = blockingWaitDialog && blockingWaitDialog.Dismiss();
  158. ShowConfirmDialog("访问失败","数据获取失败...","再试一次","取消").done( result => {
  159. result && access(region);
  160. });
  161. }
  162. }
  163. }
  164.  
  165.  
  166. function ifarme(res,region) {
  167. if(/id="error_box"/ig.exec(res.response)){
  168. blockingWaitDialog = blockingWaitDialog && blockingWaitDialog.Dismiss();
  169. ShowConfirmDialog("访问失败","访问区域受限制( 如访问区域无限制请反馈 )","确认","<a href=\"https://keylol.com/t482883-1-1\" title=\"\" target=\"_blank\">反馈</a>");
  170. return;
  171. }else if( res.finalUrl == "https://store.steampowered.com/"){
  172. blockingWaitDialog = blockingWaitDialog && blockingWaitDialog.Dismiss();
  173. ShowConfirmDialog("访问失败","被重定向为主页( 如访问区域无限制请反馈 )","确认","<a href=\"https://keylol.com/t482883-1-1\" title=\"\" target=\"_blank\">反馈</a>");
  174. return;
  175. }
  176.  
  177. let virtualDom = document.createElement("html");
  178. virtualDom.innerHTML = res.response;
  179. document.querySelector("title").innerHTML = virtualDom.querySelector("title").innerHTML;
  180. virtualDom.querySelector("head").innerHTML += `<base target=\"_blank\"><script>for(let i in parent.GDynamicStore){if(typeof GDynamicStore[i]=="object"){if(i=="s_rgfnOnReadyCallbacks")continue;GDynamicStore[i]=parent.GDynamicStore[i];}};ShowAlertDialog=parent.ShowAlertDialog;</script>`;
  181. let hint = `<div class="game_area_already_owned page_content"style="position:relative;background: linear-gradient(to right, rgba(255, 50, 50, 0.8) 0%,rgba(255, 180,180, 1) 100%);color: white"><div class="ds_owned_flag ds_flag"style="background-color: rgb(255, 140, 0)">脚本页面&nbsp;&nbsp;</div><div class="already_in_library"style="">此页面为<a href="https://keylol.com/t482883-1-1">SteamCC脚本</a>生成</div></div>`;
  182. virtualDom.querySelector("body").innerHTML = hint + virtualDom.querySelector(".responsive_page_template_content").innerHTML;
  183. let rNode = document.getElementsByClassName("responsive_page_template_content")[0];
  184.  
  185. if(accountID || currentStoreType == "search"){
  186. htmlModify(rNode,virtualDom,region);
  187. }
  188. let content = `<html class="responsive">${virtualDom.innerHTML}</html>`;
  189.  
  190. var iframe = document.createElement("iframe");
  191. iframe.id = "anonymousAccessIframe";
  192. iframe.style.width = "100%";
  193. iframe.style.height = "0";
  194. iframe.style.border = "none";
  195. iframe.style.overflow = "hidden";
  196. iframe.scrolling = "no";
  197. iframe.frameborder = "0";
  198.  
  199. rNode.innerHTML = "";
  200. rNode.appendChild(iframe);
  201.  
  202. let frameWin = iframe;
  203. if( iframe.contentWindow ){
  204. frameWin = iframe.contentWindow;
  205. }
  206.  
  207. frameWin.document.open();
  208. frameWin.document.writeln(content);
  209. frameWin.document.close();
  210. frameWin.GM_xmlhttpRequest = GM_xmlhttpRequest;
  211. frameWin.onload = function(){
  212. if( currentStoreType == "search" ){
  213. // fix spa histroy, BUG: can't forward;
  214. FillFormFromNavigation = frameWin.FillFormFromNavigation;
  215. OnLocationChange = frameWin.OnLocationChange;
  216. }
  217. blockingWaitDialog = blockingWaitDialog && blockingWaitDialog.Dismiss();
  218. function resize() {
  219. iframe.style.height = "auto"; // for get actual height
  220. iframe.style.height = frameWin.document.documentElement.scrollHeight + "px";
  221. }
  222. window.onresize = resize;
  223. let t = setInterval(() => {iframe.style.height = frameWin.document.documentElement.scrollHeight + "px";},600);
  224. setTimeout(()=>clearInterval(t),6000);
  225. virtualDom = content = null;
  226. };
  227. }
  228.  
  229. function htmlModify(rNode,virtualDom,region){
  230. temp.foryou_tab = rNode.querySelector("#foryou_tab") ? rNode.querySelector("#foryou_tab").innerHTML : temp.foryou_tab;
  231. temp.foryou_flyout = rNode.querySelector("#foryou_flyout") ? rNode.querySelector("#foryou_flyout").innerHTML : temp.foryou_flyout;
  232. temp.foryou_tab && (virtualDom.querySelector("#foryou_tab").innerHTML = temp.foryou_tab);
  233. temp.foryou_flyout && (virtualDom.querySelector("#foryou_flyout").innerHTML = temp.foryou_flyout);
  234.  
  235. switch (currentStoreType){
  236. case "app":
  237. if( document.querySelectorAll(".queue_actions_ctn a").length || (temp.block && temp.game_meta_data) ){
  238. temp.block = document.querySelector(".block .game_background_glow") ? document.querySelector(".block .game_background_glow").parentNode.innerHTML : temp.block;
  239. temp.game_meta_data = document.querySelector("#responsive_apppage_details_left_ctn") ? document.querySelector("#responsive_apppage_details_left_ctn").parentNode.innerHTML : temp.game_meta_data;
  240. virtualDom.querySelector(".block .game_background_glow").parentNode.innerHTML = temp.block;
  241. virtualDom.querySelector("#responsive_apppage_details_left_ctn").parentNode.innerHTML = temp.game_meta_data;
  242. }else {
  243. let wish_list_innerHTML = "";
  244. //add queue
  245. wish_list_innerHTML += `<a href="https://store.steampowered.com/explore/"class="btnv6_blue_hoverfade btn_medium right"data-tooltip-text="查看和定制您个性化的探索队列。"><span>查看您的队列&nbsp;&nbsp;&nbsp;<i class="ico16 arrow_next"></i></span></a>`;
  246.  
  247. //wishlist
  248. if( currentAppID in GDynamicStore.s_rgOwnedApps ){
  249. const ID_64 = `7656${accountID + 1197960265728}`;
  250. let appName = virtualDom.querySelector(".apphub_AppName").innerText;
  251. let parentNode = virtualDom.querySelector(".block .game_background_glow").parentNode;
  252. let ownApp = document.createElement("div");
  253. let playStats = document.createElement("div");
  254. ownApp.className = "game_area_already_owned page_content";
  255. playStats.className = "game_area_play_stats";
  256. ownApp.innerHTML = `<div class="ds_owned_flag ds_flag">已在库中&nbsp;&nbsp;</div><div class="already_in_library">您的Steam库中已有《${appName}》</div>`;
  257. playStats.innerHTML = `<div class="already_owned_actions"><!--install steam link--><div class="game_area_already_owned_btn"><a class="btnv6_lightblue_blue btnv6_border_2px btn_medium"href="https://store.steampowered.com/about/"><span>安装Steam</span></a></div><!--play link--><div class="game_area_already_owned_btn"><a class="btnv6_lightblue_blue btnv6_border_2px btn_medium"href="steam://run/${currentAppID}"><span>马上开玩</span></a></div></div><div class="block myactivity_block"id="my_activity"><div class="details_block hours_played">总时数 N/A 小时</div><div class="details_block"><a href="https://steamcommunity.com/profiles/${ID_64}/stats/appid/${currentAppID}">查看您的统计资料</a><a href="https://steamcommunity.com/stats/${currentAppID}/achievements">查看全球游戏统计资料</a></div></div><div style="clear:left;"></div>`;
  258. parentNode.appendChild(ownApp);
  259. parentNode.appendChild(playStats);
  260. }else{
  261. const ID_64 = `7656${accountID + 1197960265728}`;
  262. let temp = "";
  263. if( currentAppID in GDynamicStore.s_rgWishlist ){
  264. temp += `<div id="add_to_wishlist_area_success"style="display: block;"><a href="https://steamcommunity.com/profile/${ID_64}/wishlist"class="btnv6_blue_hoverfade btn_medium queue_btn_active"data-tooltip-text="该产品已在您的愿望单中。点击查看您的愿望单。"><span><img src="https://steamstore-a.akamaihd.net/public/images/v6/ico/ico_selected.png"border="0">已在愿望单中</span></a></div>`;
  265. }else{
  266. temp += `<div id="add_to_wishlist_area"><a class="btnv6_blue_hoverfade btn_medium"href="javascript:AddToWishlist( ${currentAppID}, 'add_to_wishlist_area', 'add_to_wishlist_area_success', 'add_to_wishlist_area_fail', '1_5_9__407' );"data-tooltip-text="在您愿望单中的物品正式发布或特价销售时获取邮件通知"><span>添加至您的愿望单</span></a></div><div id="add_to_wishlist_area_success"style="display: none;"><a href="https://steamcommunity.com/profile/${ID_64}/wishlist"class="btnv6_blue_hoverfade btn_medium queue_btn_active"data-tooltip-text="该产品已在您的愿望单中。点击查看您的愿望单。"><span><img src="https://steamstore-a.akamaihd.net/public/images/v6/ico/ico_selected.png"border="0">已在愿望单中</span></a></div>`;
  267. }
  268. temp += `<div id="add_to_wishlist_area_fail"style="display: none;"><b>哎呀,很抱歉!</b></div>`;
  269. wish_list_innerHTML += temp;
  270. }
  271. //follow
  272. wish_list_innerHTML += ` <div class="queue_control_button queue_btn_follow"><div class="btnv6_blue_hoverfade btn_medium queue_btn_inactive"style=""data-tooltip-text="此功能暂时无法使用。"><span>关注</span></div><div class="btnv6_blue_hoverfade btn_medium queue_btn_active"style="display: none;"><span><img src="https://steamstore-a.akamaihd.net/public/images/v6/ico/ico_selected.png"border="0">正在关注</span></div></div>`;
  273. //ignore
  274. wish_list_innerHTML += ` <div class="queue_control_button queue_btn_ignore"><div class="btnv6_blue_hoverfade btn_medium queue_btn_inactive"style="${(currentAppID in GDynamicStore.s_rgIgnoredApps) ? "display:none;" : ""}"data-tooltip-text="此功能暂时无法使用。"><span>忽略</span></div><div class="btnv6_blue_hoverfade btn_medium queue_btn_active"style="${(currentAppID in GDynamicStore.s_rgIgnoredApps) ? "" : "display:none;"}"data-tooltip-text="此功能暂时无法使用。"><span><img src="https://steamstore-a.akamaihd.net/public/images/v6/ico/ico_selected.png"border="0">已忽略</span></div></div>`;
  275. virtualDom.querySelector(".queue_actions_ctn").innerHTML = wish_list_innerHTML;
  276.  
  277. let temp = virtualDom.querySelector(".block.responsive_apppage_details_right.recommendation_noinfo");
  278. temp.parentNode.removeChild(temp);
  279. }
  280. //restart script
  281. virtualDom.querySelector("body").innerHTML += `<script>InitQueueControls(${currentAppID},${currentAppID},0,"1_7_7_230_12")</script>`;
  282. break;
  283. case "bundle":
  284. case "sub":
  285. break;
  286. case "search":
  287. let td = '<script>let g_cc="' + region + '";ExecuteSearch=function(rgParameters){if(g_bUseHistoryAPI){let t={...rgParameters};delete t["snr"];delete t["hide_filtered_results_warning"];if(t["sort_by"]=="_ASC")delete t["sort_by"];if(t["page"]=="1")delete t["page"];parent.history.pushState({params:t},"","?"+Object.toQueryString(t))}else{parent.window.location="#"+Object.toQueryString(rgParameters)}if(g_ajaxInFlight){g_rgDesiredParameters=rgParameters;return}if(g_rgCurrentParameters&&Object.toQueryString(g_rgCurrentParameters)==Object.toQueryString(rgParameters))return;g_rgCurrentParameters=rgParameters;let params="";for(let i in rgParameters){if(i=="cc")continue;params+=`${i}=${rgParameters[i]}&`}let url=`https://steampowered.com/search/results?${params}&cc=${g_cc}`;g_ajaxInFlight=GM_xmlhttpRequest({method:"GET",url:url,timeout:5000,headers:{Cookie:"wants_mature_content=1;mature_content=1;lastagecheckage=1-January-1970;birthtime=0"},onload:replace,ontimeout:timeout,onerror:fail});function replace(res){$J("#search_results").html(res.response);SearchCompleted(rgParameters)}function timeout(){ShowConfirmDialog("访问超时","数据获取失败...","再试一次","取消").done(result=>{result&&ExecuteSearch(rgParameters)})}function fail(){ShowConfirmDialog("访问失败","数据获取失败...","再试一次","取消").done(result=>{result&&ExecuteSearch(rgParameters)})}}</script>';
  288. virtualDom.querySelector("body").innerHTML += td;
  289. break;
  290. }
  291. }
  292.  
  293. function controlBar(){
  294. let postion = document.getElementById("global_action_menu");
  295. let menu = document.createElement("div");
  296. let style = document.createElement("style");
  297. style.innerHTML = "#cr-control-lable{position:relative;float:right;background-color:#171a21;color:#b8b6b4;width:150px;border:2px solid gray;border-radius:5px;}#cr-control-lable #select-box{margin:15px 0;padding:10px 0 5px 0;box-sizing:border-box;border:1px solid #171a21;border-radius:5px;min-width:100px;width:auto;display:none;position:absolute;background-color:#171a21}#cr-control-lable ul{max-height:300px;overflow:auto;margin:0;padding:0;}#cr-control-lable ul::-webkit-scrollbar{width:10px}#cr-control-lable ul::-webkit-scrollbar-thumb{background-color:#b8b6b4;border-radius:5px;}#cr-control-lable li{margin:0 15px;padding:5px 10px;list-style:none;border-bottom:1px solid #b8b6b4;}#cr-control-lable #select-box .modify{text-align:center;margin:5px 5px;border-radius:5px;}#cr-control-lable #select-box button{text-align:center;padding:0 5px;margin:0 2px;}#cr-control-lable .icon{position:absolute;width:7.5px;height:7.5px;box-sizing:border-box;border:7.5px solid;top:5px;left:15px;z-index:1;}#cr-control-lable .icon.on{border-color:#fff transparent transparent;}#cr-control-lable .icon.close{border-color:transparent transparent transparent #b8b6b4;}#cr-control-lable #cr-input{width:100%;text-align:center;padding-left:20px;color:#b8b6b4;background-color:#171a21;box-sizing:border-box;border-color:transparent;}#cr-control-lable #cr-input::placeholder{color:#b8b6b4;}#cr-control-lable #cr-input:focus::placeholder{color:#fff;}#cr-control-lable #cr-input:focus{outline:none;color:#fff;}#cr-control-lable button{outline:none;color:#b8b6b4;background-color:#171a21;border:none;text-align:center;box-sizing:border-box;padding:5 auto;}#cr-control-lable button:hover:active{color:#b8b6b4;}#cr-control-lable button:hover{color:#fff;cursor:pointer;}#cr-control-lable li:hover{color:#fff;cursor:pointer;}";
  298. // menu.style.display = "inline-block"
  299. document.getElementsByTagName("head")[0].appendChild(style);
  300. menu.innerHTML = `<div id="cr-control-lable"><div class="infobox"><div style="position: relative;"><span id="cr-icon"class="icon close"></span><input id="cr-input"type="text"name=""placeholder="输入/选择国家"autocomplete="off"></div><div style="text-align: center;"><button id="cr-check"style="width:32%;">访问</button><button id="cr-default"style="width:64%;">设置默认</button></div><div id="select-box"><ul id="cr-select-country"></ul><div class="modify"><button id="cr-modify">修改</button><button id="cr-reset">重置</button></div></div></div></div>`;
  301. postion.appendChild(menu);
  302.  
  303. let input = document.getElementById("cr-input");
  304. let ul = document.getElementById("cr-select-country");
  305. let check = document.getElementById("cr-check");
  306. let setDefault = document.getElementById("cr-default");
  307. let modify = document.getElementById("cr-modify");
  308. let reset = document.getElementById("cr-reset");
  309.  
  310. input.value = conf.defaultCountry;
  311. loadCountry();
  312.  
  313. function loadCountry(){
  314. ul.innerHTML = "";
  315. for(let i in conf.presetCountriesList){
  316. ul.innerHTML += `<li>${i}</li>`;
  317. }
  318. }
  319.  
  320.  
  321. ul.addEventListener("mousedown",function(e){
  322. if(e.target.tagName == "LI"){
  323. input.value = e.target.innerHTML
  324. }
  325. e.preventDefault();
  326. },true);
  327.  
  328. input.onfocus = function(){
  329. document.getElementById("cr-icon").className = "icon on";
  330. document.getElementById("select-box").style.display = "block";
  331. };
  332.  
  333. input.onblur = function(){
  334. document.getElementById("cr-icon").className = "icon close";
  335. document.getElementById("select-box").style.display = "none";
  336. };
  337.  
  338. input.onkeypress = function(e){
  339. if (e.keyCode == 13 || e.which == 13){
  340. check.onclick();
  341. }
  342. };
  343.  
  344. check.onclick = function(){
  345. let region = input.value == "" ? conf.defaultCountry : input.value;
  346. blockingWaitDialog = ShowBlockingWaitDialog("正在跨区访问", `${region} 区域匿名数据获取中...`);
  347. anonymousAccess(region);
  348. };
  349.  
  350. setDefault.onclick = function(){
  351. conf.defaultCountry = input.value == "" ? conf.defaultCountry : input.value;
  352. localStorage.setItem("STEAMCC_CONF", JSON.stringify(conf));
  353. };
  354.  
  355. modify.addEventListener("mousedown",function(e){
  356. ShowEditablePrompt("请按照 JSON 格式修改编辑",conf,trySave,console.log)
  357. function trySave(res){
  358. try{
  359. res = JSON.parse(res);
  360. if( (typeof res.autoCheck == "boolean") && (typeof res.advancedSearch == "boolean") && (typeof res.defaultCountry == "string") && (typeof res.presetCountriesList == "object")){
  361. conf = res;
  362. localStorage.setItem("STEAMCC_CONF", JSON.stringify(conf));
  363. loadCountry();
  364. }else{
  365. ShowConfirmDialog("请勿修改JSON结构","<p>└──&nbspRoot</p><p>&nbsp&nbsp&nbsp&nbsp├──&nbspautoCheck&nbsp(Boolean)</p><p>&nbsp&nbsp&nbsp&nbsp├──&nbspadvancedSearch&nbsp(Boolean)</p><p>&nbsp&nbsp&nbsp&nbsp├──&nbspdefaultCountry&nbsp(String)</p><p>&nbsp&nbsp&nbsp&nbsp├──&nbsppresetCountriesList&nbsp(Object)</p>","重新编辑","取消").done( result => {
  366. result && ShowEditablePrompt("请按照 JSON 格式修改编辑",conf,trySave);
  367. });
  368. return;
  369. }
  370. }catch(err){
  371. ShowConfirmDialog("JSON 解析出错","请按照 JSON 格式修改配置","重新编辑","取消").done( result => {
  372. result && ShowEditablePrompt("请按照 JSON 格式修改编辑",conf,trySave);
  373. });
  374. }
  375. }
  376. },true);
  377.  
  378. reset.addEventListener("mousedown",function(e){
  379. localStorage.removeItem("STEAMCC_CONF");
  380. ShowConfirmDialog("已重置","刷新后生效","刷新","稍后").done( result => {
  381. result && location.reload();
  382. });
  383. },true);
  384. }
  385.  
  386.  
  387. (function main(){
  388. init();
  389. autoCheck();
  390. window.onload = ()=>{
  391. controlBar();
  392. };
  393. })();
  394.  
  395. })()