Forum

通知中心
Clear all

算不算bug?

4
2 Users
0 Reactions
777 查看
帖子: 3
帖子发起者
(@hhcxxxx)
Active Member
已加入: 12 月 前

从讨论区跳转到提问区或者点开帖子会退出登录状态,综合讨论区里的帖子点开也会显示不在登录状态,而且留言什么的也会被要求登录

主题 Tags
3 Replies
帖子: 4727
(@lpofficial)
Honorable Member
已加入: 5 年 前

算。指向站内的链接地址会包含完整域名,但神社域名多,很可能点个链接一会儿变成 hacg.mov,接着变成 hacg.me,然后又是 hacg.icu。这些域名间又不会读取各自的 Cookie,所以就会这样。

我有空看看能不能写个油猴脚本缓解这个问题,至于如何从源头解决嘛就是 @多啦H萌 该考虑的了。

回复
帖子: 4727
(@lpofficial)
Honorable Member
已加入: 5 年 前

https://greasyfork.org/zh-CN/scripts/503867

// ==UserScript==
// @name               琉璃神社(hacg.me)_缓解多域名间来回跳转
// @name:en_US         HACG(hacg.me)_Multi-Domain Switching Reduction
// @description        缓解  https://www.hacg.me/wp/bbs/postid/48650  提出得多域名跳转问题。
// @version            1.0.0
// @author             璃末Li3nd
// @namespace           https://gitlab.com/LiuliPack 
// @match              *://*.hacg.*/*
// @match              *://*.liuli.*/*
// @match              *://*.llss.*/*
// @match              *://*.h2024.*/*
// @license            WTFPL
// @contributionURL     https://b23.tv/BV1ME411r78W 
// @icon                https://www.hacg.me/favicon.ico 
// @run-at             document-end
// @noframes
// ==/UserScript==

'use strict';

(function() {
    'use strict';

    document.querySelectorAll("a").forEach((ele) => {
        if(/(www\.)?(hacg|liuli|llss|h2024)\.(me)/.test(ele.href)) {
            ele.href = new URL(ele.href).pathname
        };
    });

})();
回复
帖子: 4727
(@lpofficial)
Honorable Member
已加入: 5 年 前
// ==UserScript==
// @name               琉璃神社(hacg.me)_缓解多域名间来回跳转
// @name:en_US         HACG(hacg.me)_Multi-Domain Switching Reduction
// @description        缓解  https://www.hacg.me/wp/bbs/postid/48650  提出得多域名跳转问题。
// @version            2.0.2
// @author             璃末Li3nd
// @namespace           https://gitlab.com/LiuliPack 
// @match              *://*.hacg.*/*
// @match              *://*.liuli.*/*
// @match              *://*.llss.*/*
// @match              *://*.h2024.*/*
// @exclude            *://hacg.uno/*
// @license            WTFPL
// @contributionURL     https://b23.tv/BV1ME411r78W 
// @icon                https://www.hacg.me/favicon.ico 
// @run-at             document-body
// ==/UserScript==

(function() {
    'use strict';

    const probe = new MutationObserver(() => {
        document.querySelectorAll('a:not(.probed, #post-63117 .entry-content a').forEach(ele => {
            if(/^https?:\/\/(www|cdn)\.(hacg|liuli|llss|h2024)\.*/.test(ele.href)) {
                ele.href = new URL(ele.href).pathname;
                ele.classList.add('probed')
            }
        })
    })

    probe.observe(document.body, { childList: true, subtree: true })


})();
回复