將製作ejcees(中國象棋打譜程式)

分享和讨论Javascript相关的话题
回复
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4982
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

ejceesExpSvg不能轉json。
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4982
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

代码: 全选

(function() {
    const currentHash = window.location.hash;
    if (currentHash) {
        const targetLink = document.querySelector('a.ejcees');
        if (targetLink && targetLink.href) {
            const newUrl = targetLink.href + currentHash;
            window.location.href = newUrl;
        }
    }
})();
改進以上代碼,在加上hash前,要先加上?url=當前地址的encodeUricomponer轉碼。
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4982
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

gemini fast

代码: 全选

(function() {
    const currentHash = window.location.hash;
    // 獲取當前完整 URL 並進行編碼
    const encodedCurrentUrl = encodeURIComponent(window.location.href);

    if (currentHash) {
        const targetLink = document.querySelector('a.ejcees');
        
        if (targetLink && targetLink.href) {
            let baseUrl = targetLink.href;

            // 判斷原連結是否已經帶有參數,決定用 '?' 還是 '&' 拼接
            const separator = baseUrl.includes('?') ? '&' : '?';
            
            // 拼接順序:原連結 + ?url=當前地址 + #Hash
            const newUrl = `${baseUrl}${separator}url=${encodedCurrentUrl}${currentHash}`;
            
            window.location.href = newUrl;
        }
    }
})();
https://ejsoon.vip/
弈趣極光:享受思維樂趣
头像
ejsoon
圈圈精英
圈圈精英
帖子: 4982
注册时间: 2022年 11月 18日 17:36
为圈友点赞: 173 次
被圈友点赞: 202 次
联系:

Re: 將製作ejcees(中國象棋打譜程式)

帖子 ejsoon »

url點第二次會出現中文,而不再編碼。
https://ejsoon.vip/
弈趣極光:享受思維樂趣
回复

在线用户

正浏览此版面之用户: 没有注册用户 和 1 访客