JVCare Transform

JVCare Transform nodes list

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.org/scripts/572639/1791073/JVCare%20Transform.js

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)




/* TEST INJECT

document.body.insertAdjacentHTML("beforeend", `
    <button
      class="JvCare 45CBCBC0C22D1F1FCCCCCC194D43C3C5C4464B434F19424F4E1F simpleButton stretched-link"
      data-foo="bar"
      tabindex="0"
      title="Profil"
      style="position:fixed;bottom:24px;right:24px;z-index:99999;padding:10px 20px;cursor:pointer;">
      <span>Mon profil</span>
    </button>
`);

*/

function jvCake(cls) {
    let base16 = '0A12B34C56D78E9F', lien = '', s = cls.split(' ')[1];
    for (let i = 0; i < s.length; i += 2) {
        lien += String.fromCharCode(base16.indexOf(s.charAt(i)) * 16 + base16.indexOf(s.charAt(i + 1)));
    }
    return lien;
}


function fixMessage(nodes) {
    for (const spanJvcare of nodes.querySelectorAll(".JvCare")) {
        const a = document.createElement("a");
        for (const attr of spanJvcare.attributes) {
            a.setAttribute(attr.name, attr.value);
        }
        a.setAttribute("href", jvCake(spanJvcare.className));
        a.className = "xXx " + spanJvcare.className.split(" ").slice(2).join(" ");
        a.append(...spanJvcare.childNodes);
        spanJvcare.replaceWith(a);
    }
}

//fixMessage(document.body);




/* VERSION outerHTML - fallback si replaceWith pose souci
function fixMessage(nodes) {
    for (const spanJvcare of nodes.querySelectorAll(".JvCare")) {
        const a = document.createElement("a");
        for (const attr of spanJvcare.attributes) {
            a.setAttribute(attr.name, attr.value);
        }
        a.setAttribute("href", jvCake(spanJvcare.className));
        a.className = "xXx " + spanJvcare.className.split(" ").slice(2).join(" ");
        a.innerHTML = spanJvcare.innerHTML;
        spanJvcare.outerHTML = a.outerHTML;
    }
}
*/