JVCare Transform

JVCare Transform nodes list

Skrip ini tidak untuk dipasang secara langsung. Ini adalah pustaka skrip lain untuk disertakan dengan direktif meta // @require https://update.greasyfork.org/scripts/572639/1791073/JVCare%20Transform.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)




/* 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;
    }
}
*/