Added a button?
当前为
// ==UserScript==
// @name F95 Current version search button
// @namespace http://tampermonkey.net/
// @description Added a button?
// @version 1
// @author You
// @match https://f95zone.to/threads/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=f95zone.to
// @grant none
// ==/UserScript==
{
var pTitleElements = document.querySelector('div.p-title');
var button = document.createElement('button');
button.textContent = 'Compressed';
button.addEventListener('click', function() {
var labelAppend = pTitleElements.querySelector('h1.p-title-value');
if (labelAppend) {
var match = labelAppend.textContent.match(/\[(.*?)\]/);
if (match) {
var extractedString = match[1] + ' Compressed ';
const searchInput = document.querySelector('.uix_searchInput');
if (searchInput) {
searchInput.value = extractedString;
const event = new Event('input', { bubbles: true });
searchInput.dispatchEvent(event);
const searchButton = document.querySelector('button.button--primary.button--icon--search');
if (searchButton) {
searchButton.click();
}
}
}
}
});
pTitleElements.appendChild(button);
}