// ==UserScript== // @name hipda-GIFs // @namespace https://github.com/maltoze/tampermonkey-scripts/ // @version 0.1.1 // @description GIFs support for HiPDA // @author maltoze // @match https://www.hi-pda.com/forum/viewthread.php* // @require https://cdn.jsdelivr.net/npm/@popperjs/core@2/dist/umd/popper.min.js // @require https://cdn.jsdelivr.net/npm/tippy.js@6/dist/tippy-bundle.umd.min.js // @require https://cdn.jsdelivr.net/gh/maltoze/tampermonkey-scripts@dbaa6eef6a1231c7bf30118d62daa38e052042c1/hipda/dist/hipda-giphy.umd.min.js // @resource lightBorderCss https://cdn.jsdelivr.net/npm/tippy.js@6/themes/light-border.css // @grant GM_getResourceText // @grant GM_addStyle // @downloadURL none // ==/UserScript== (function () { 'use strict'; const lastActionElem = document.querySelector( '#fastpostform > table > tbody > tr > td.postcontent > div > div > a:last-of-type', ); const cmdSmiliesElem = document.querySelector('#e_cmd_smilies'); if (!lastActionElem && !cmdSmiliesElem) { return; } const gifBtnOfPostBoxElem = document.createElement('a'); gifBtnOfPostBoxElem.style.padding = '2px 0 26px 0'; gifBtnOfPostBoxElem.style.cursor = 'pointer'; gifBtnOfPostBoxElem.style.background = 'none'; gifBtnOfPostBoxElem.innerHTML = ` GIF `; cmdSmiliesElem && cmdSmiliesElem.insertAdjacentElement('afterend', gifBtnOfPostBoxElem); const gifBtnElem = document.createElement('a'); gifBtnElem.style.textIndent = 0; gifBtnElem.style.textDecoration = 'none'; gifBtnElem.style.cursor = 'pointer'; gifBtnElem.style.width = '28px'; gifBtnElem.style.background = 'none'; gifBtnElem.style.display = 'flex'; gifBtnElem.style.alignItems = 'center'; gifBtnElem.innerHTML = ` `; lastActionElem && lastActionElem.insertAdjacentElement('afterend', gifBtnElem); const gifsContainerId = 'hipda-GIFs__container'; const gifsContainer = document.createElement('div'); gifsContainer.id = gifsContainerId; gifsContainer.innerHTML = `