// ==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 Cover Image'; // Apply the new styles button.style.cursor = 'pointer'; button.style.backgroundColor = '#f92672'; button.style.color = 'white'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.padding = '1px 5px'; button.style.fontSize = '12px'; button.style.position = 'relative'; button.style.marginRight = '10px'; button.style.zIndex = '9999'; // Button click event button.onclick = function(event) { 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!'); } }; // Append the button to div.t_fsz const targetDiv = document.querySelector('div.pgs.mtm.mbm.cl'); if (targetDiv) { targetDiv.appendChild(button); } else { console.warn('Target div not found. Button not added.'); } } // Add button when the DOM is fully loaded window.onload = addButton;})();
How can i set it to run in
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.