hdvietnam.com - Thanks Auto-reloading

Tự động "hiển linh" khi bấm "Cảm ơn"

// ==UserScript==
// @name        hdvietnam.com - Thanks Auto-reloading
// @namespace   Violentmonkey Scripts
// @match       https://hdvietnam.com/threads/*
// @grant       none
// @version     1.0
// @author      ReeganExE (Ninh Pham)
// @description Tự động "hiển linh" khi bấm "Cảm ơn"
// ==/UserScript==

jQuery(() => {
  jQuery('.LikeLink.like').click((e) => {
    const pid = e.currentTarget.dataset.container.replace('#likes-post-', '');
    jQuery(document).one('XFAjaxSuccess', (e) => {
      if (e.textStatus === 'success') {
        fetch(`https://hdvietnam.com/posts/${pid}`)
          .then((a) => a.text())
          .then((t) => {
            const a = new DOMParser().parseFromString(t, 'text/html');
            const s = `post-${pid}`;
            const el = document.getElementById(s);
            el.innerHTML = a.getElementById(s).innerHTML;
            XenForo.activate(el);
          });
      }
    });
  });
})