Skip to content

Commit

Permalink
v1.0.2 小改进
Browse files Browse the repository at this point in the history
同时增加对旧版平台bug的兼容
  • Loading branch information
ckx000 committed May 2, 2022
1 parent acc8ae5 commit c95668d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 26 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Docker:https://hub.docker.com/r/a76yyyy/qiandao


# 更新
v1.0.2 小改进。同时增加对旧版平台bug的兼容(编辑测试界面无法获取cookie)(新版签到平台已修正

v1.0.0 修改匹配及注入方式,添加设定选项方便自行添加需要启用的网站

# 鸣谢
Expand Down
19 changes: 0 additions & 19 deletions js/button.js

This file was deleted.

14 changes: 9 additions & 5 deletions js/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ function onload(func) {
onload(function() {
console.log("getcookieload");
document.body.setAttribute("get-cookie", "true");
window.postMessage({"info":"get-cookieModReady"}, "*");//预传递,在签到平台登录主页时自动填入info信息
window.addEventListener('click', function(event) {
window.postMessage({"info":"get-cookieModReady"}, "*");//预传递,测试自动填入功能
//添加旧版平台bug修复性兼容//将来弃置
if(location.pathname.indexOf('/edit')>0 ){$("a.ng-scope[data-toggle=get-cookie]").each(function(){this.removeAttribute("disabled")})}

window.addEventListener('click', function(event) {
var export_btn = event.target;
var port = chrome.runtime.connect({name: "get_cookie"});
if (export_btn.getAttribute("data-toggle") == "get-cookie") {
var port = chrome.runtime.connect({name: "get_cookie"});

var site = export_btn.getAttribute("data-site");
var name = export_btn.getAttribute("data-name");
var domain = export_btn.getAttribute("data-domain");
var callback = export_btn.getAttribute("data-callback");
port.postMessage({"do": "get_cookie", "site": site, "name": name, "domain": domain});
port.onMessage.addListener(function(msg) {
if (window.confirm('你确定要此网站获取你' + site + '的Cookies么?')) {
export_btn.setAttribute("data-cookie", JSON.stringify(msg));
//console.log(msg);
//export_btn.setAttribute("data-cookie", JSON.stringify(msg));
console.log("postMessage",msg);
window.postMessage(msg, "*");//传递给页面消息,让网页填上cookies数据
} else {
return false;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyqfMOCKmBFCyUDyIA2BKpJJhZnwYd4xBvu3B9ppdOQ98LYtK8pEcSGLpyhuzyiwtmlm9faAimQbCjelk1NGs/rkOTQFeC+X4TI4soujKA3v4vW1+QACchIiLCVel3nIJzU2Xq1vdbgP74wMWZ766xUqP4y6nNnGOaFvAWK+CuXPXOlNxbQ5ipNGUDR3MLz+PuLh1HtaMjtXWeJ5ailm8Rhuax9wAo1FcE/DwiRTbv11et/2MTda7Xo/3Z8S7Sc1gDbwHGFYRT931A3a+FUTTwiEDPP4LZmjBxgyknaBnj1Zh46kNYdaN1LFq3/0HloHq/E6B8rHXozqVHucaob+oMwIDAQAB",
"permissions": [ "cookies", "storage", "tabs", "\u003Call_urls>"],
"name": "__MSG_appName__",
"version": "1.0.0"
"version": "1.0.2"
}
2 changes: 1 addition & 1 deletion options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<p>填入需要加载插件的域名或ip地址: 一行一个</p>
<p>例如:只用ip访问的自己家内网的nas输入 192.168.0.111<br />
或者用域名访问的签到平台 qiandao.today</p>
<textarea id="tgurl" rows="6">
<textarea id="tgurl" rows="6" cols="46">
</textarea>
<div><button id="save">Save</button><span id="status"></span></div>
<button id="reset" style="display: none;">Reset</button>
Expand Down

0 comments on commit c95668d

Please sign in to comment.