您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automatically checks Share checkbox, focuses Tags input and enable CTRL + Enter submit on linkding bookmarks page
当前为
// ==UserScript== // @name Auto Check Share and Focus Tags plus CTRL + Enter Save and Close // @namespace http://tampermonkey.net/ // @version 0.3 // @description Automatically checks Share checkbox, focuses Tags input and enable CTRL + Enter submit on linkding bookmarks page // @author Webmaster // @match https://*/bookmarks/new* // @grant none // ==/UserScript== (function() { 'use strict'; // Function to check the Share checkbox function checkShareBox() { const checkbox = document.getElementById('id_shared'); if (checkbox) { checkbox.checked = true; } } // Function to focus the Tags input function focusTagsInput() { const tagsInput = document.getElementById('id_tag_string'); if (tagsInput) { tagsInput.focus(); } } // Function to handle form submission function setupFormSubmission() { document.addEventListener('keydown', function(event) { if (event.ctrlKey && event.key === 'Enter') { const submitButton = document.querySelector('input[type="submit"][value="Save and close"]'); if (submitButton) { event.preventDefault(); // Prevent default Ctrl+Enter behavior submitButton.click(); // Trigger the form submission } } }); } // Run when page loads window.addEventListener('load', function() { checkShareBox(); focusTagsInput(); setupFormSubmission(); }); // For cases where content might load dynamically const observer = new MutationObserver(function(mutations) { checkShareBox(); focusTagsInput(); setupFormSubmission(); }); // Start observing the document with the configured parameters observer.observe(document, { childList: true, subtree: true }); })();