您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a "Select All" button to select all checkboxes for torrents on both the notifications page and delete notification page
- // ==UserScript==
- // @name GGn Select All Notifications
- // @namespace http://tampermonkey.net/
- // @version 1.1
- // @match https://gazellegames.net/torrents.php*action=delete_notify*
- // @match https://gazellegames.net/torrents.php*action=notify*
- // @description Add a "Select All" button to select all checkboxes for torrents on both the notifications page and delete notification page
- // @author SleepingGiant
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- function addSelectAllButton() {
- var selectAllButton = document.createElement('button');
- selectAllButton.innerText = 'Select All';
- // Add the 'button' class to apply the existing page styles
- selectAllButton.classList.add('button', 'input[type=submit]', 'input[type=button]');
- var container = document.querySelector('.center');
- if (container) {
- // Insert the button into the container
- container.appendChild(selectAllButton);
- selectAllButton.addEventListener('click', function () {
- var checkboxes = document.querySelectorAll('input[type="checkbox"]');
- if (checkboxes.length > 0) {
- var allChecked = Array.from(checkboxes).every(checkbox => checkbox.checked);
- checkboxes.forEach(function (checkbox) {
- checkbox.checked = !allChecked;
- });
- }
- });
- // Once the button is added, stop further retries
- clearInterval(intervalId);
- }
- }
- // Retry adding the button every 100ms, up to 100 times
- let retryCount = 0;
- let maxRetries = 100;
- let intervalId = setInterval(function() {
- addSelectAllButton();
- retryCount++;
- if (retryCount >= maxRetries) {
- clearInterval(intervalId);
- console.log('Max retries reached. Stopping attempts.');
- }
- }, 75);
- })();