// ==UserScript== // @name access_to_erep // @namespace eChina_Victory // @description 用https://访问游戏时,各个功能正常 // @include https://www.erepublik.com/* // @version 1.1 // @grant none // @downloadURL none // ==/UserScript== (function(){ // 必须载入reward.js,否则每日任务奖励无法领取 var scriptElement = document.createElement( "script" ); scriptElement.type = "text/javascript"; scriptElement.src = "https://www.erepublik.com/js/citizen/reward.js"; document.body.appendChild( scriptElement ); // 将所有http://链接替换成https:// var links = document.getElementsByTagName("a"); var t; for(var i = 0; i < links.length; i++) { t = links[i]; t.href = t.href.replace("http://www.erepublik.com", "https://www.erepublik.com"); } // 无头鸡还使用了getJSON()和post(),需要先把参数中的http替换成https,再 // 调用正常的函数。 var f1 = unsafeWindow.jQuery.getJSON; unsafeWindow.jQuery.getJSON = function(e, t, n) { f1(e.replace("http://www.erepublik.com", "https://www.erepublik.com"), t, n); } var f2 = unsafeWindow.jQuery.post; unsafeWindow.jQuery.post = function(e, r, i, s) { f2(e.replace("http://www.erepublik.com", "https://www.erepublik.com"), r, i, s); } })();