// ==UserScript== // @name Show Window Button for JK Forum // @namespace…
- User
// ==UserScript== // @name Show Window Button for JK Forum // @namespace http://tampermonkey.net/ // @version 1.1 // @description Adds a button to activate the showWindow function on JK Forum pages // @author Your Name // @match https://www.jkforum.net/* // @grant none // ==/UserScript==
(function() { 'use strict';
// Function to extract TID from the URL function getTID() { const url = window.location.href; const match = url.match(/thread-(\d{8})/); return match ? match[1] : null; } // Function to get the image URL from the <meta property="og:image"> function getImgURL() { const metaTag = document.querySelector('meta[property="og:image"]'); return metaTag ? metaTag.getAttribute('content') : null; } // Function to create and add the button function addButton() { const button = document.createElement('button'); button.innerText = 'Set as Cover'; button.style.position = 'fixed'; button.style.top = '10px'; button.style.right = '10px'; button.style.zIndex = '1000'; button.style.padding = '10px'; button.style.backgroundColor = '#4CAF50'; button.style.color = 'white'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; // Button click event button.onclick = function() { const tid = getTID(); const imgURL = getImgURL(); if (tid && imgURL) { const script = `showWindow('xx', 'plugin/?id=threadicon:set&tid=${tid}&imgurl=' + encodeURIComponent('${imgURL}'), 'get', 0);`; eval(script); } else { alert('TID or Image URL not found!'); } }; document.body.appendChild(button); } // Add button when the DOM is fully loaded window.onload = addButton;})();
please move the button to div.t_fsz and change the style to the following.
toggleButton.style.cursor = 'pointer'; toggleButton.style.backgroundColor = '#336699'; toggleButton.style.color = 'white'; toggleButton.style.border = 'none'; toggleButton.style.borderRadius = '5px'; toggleButton.style.padding = '1px 5px'; toggleButton.style.fontSize = '12px'; toggleButton.style.position = 'relative'; toggleButton.style.marginRight = '10px'; toggleButton.style.zIndex = '9999'; toggleButton.onclick = function(event) { - Assistant
- User
I have reposition it to div.pgs.mtm.mbm.cl
- Assistant