// ==UserScript== // @name Web Page Accelerator // @namespace instant.page // @version v1.0.5.2.0 // @author OB_BUFF // @description Automatically accelerates hyperlinks on web pages to improve loading speed. Integrates the latest instant.page v5.2.0 features with multi-language support (default: English) and removes store link redirection functionality. // @license GPL-v3 // @require https://registry.npmmirror.com/sweetalert2/10.16.6/files/dist/sweetalert2.min.js // @resource swalStyle https://registry.npmmirror.com/sweetalert2/10.16.6/files/dist/sweetalert2.min.css // @match *://*/* // @noframes // @run-at document-idle // @grant GM_openInTab // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @grant GM_getResourceText // @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjggMTI4Ij48cGF0aCBkPSJNMCA3OWMwLTM1LjQgMjguNS02NCA2My45LTY0LjFzNjQuMSAyOC42IDY0LjEgNjRjMCA5LjQtMi4xIDE4LjQtNS43IDI2LjUtMSAyLjMtMi4zIDQuNi0zLjYgNi43LS40LjYtMSAxLTEuNyAxSDExYy0uNyAwLTEuMy0uNC0xLjctMS0xLjMtMi4yLTIuNS00LjQtMy42LTYuN0MyLjEgOTcuNCAwIDg4LjQgMCA3OXptMjQuNC0zOS43Yy01LjIgNS4xLTkuMiAxMS4xLTEyIDE3LjgtMyA2LjktNC41IDE0LjItNC41IDIxLjhhNTUuODYgNTUuODYgMCAwIDAgNC40IDIxLjhjLjcgMS42IDEuNCAzLjIgMi4yIDQuN2g5OC44Yy44LTEuNSAxLjYtMy4xIDIuMi00LjdhNTUuODYgNTUuODYgMCAwIDAgNC40LTIxLjggNTUuODYgNTUuODYgMCAwIDAtNC40LTIxLjhjLTIuOC02LjctNi45LTEyLjctMTItMTcuOC01LjEtNS4yLTExLjEtOS4yLTE3LjgtMTJhNTUuODYgNTUuODYgMCAwIDAtMjEuOC00LjQgNTUuODYgNTUuODYgMCAwIDAtMjEuOCA0LjRjLTYuNiAyLjgtMTIuNiA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LjNBNDIuMDQgNDIuMDQgMCAwIDEgMjYgNjNjMi01IDUtOS40IDguOC0xMy4yUzQzIDQzLjEgNDcuOSA0MWE0Mi4wNCA0Mi4wNCAwIDAgMSAzMi4yIDBjNC45IDIuMSA5LjMgNS4xIDEzLjEgOC45Qzk3IDUzLjYgOTkuOSA1OCAxMDIgNjNhNDIuMDQgNDIuMDQgMCAwIDEgMy4yIDE2LjFjMCAzLjItLjQgNi4zLTEuMSA5LjMtLjYgMi41IDEuMyA0LjkgMy45IDQuOSAxLjggMCAzLjUtMS4zIDMuOS0zLjEuOC0zLjYgMS4zLTcuMyAxLjMtMTEuMSAwLTI3LjMtMjIuMS00OS4zLTQ5LjMtNDkuM3oiIGZpbGw9IiM0NDQiLz48L3N2Zz4= // @downloadURL https://update.greasyfork.icu/scripts/526323/Web%20Page%20Accelerator.user.js // @updateURL https://update.greasyfork.icu/scripts/526323/Web%20Page%20Accelerator.meta.js // ==/UserScript== /* ------------------------------- Multi-language support (default: English) You can extend the translations object to support more languages. ---------------------------------- */ const translations = { en: { acceleratedCount: "Accelerated: ", times: " times", resetPrompt: "Are you sure you want to reset the acceleration count?", confirm: "OK", cancel: "Cancel", settingsTitle: "Accelerator Settings", accelerateExternal: "Accelerate external links", accelerateParams: "Accelerate links with parameters", openInSameTab: "Open links in the same tab", animationEffect: "Animation effect", prefetchDelay: "Prefetch delay (ms)", excludeURLs: "Exclude the following URLs (one per line)", excludeKeywords: "Exclude the following keywords (one per line)", save: "Save", usageFooter: "Click here to view the usage instructions. This assistant is free and open-source." } }; const lang = 'en'; // Default language // ------------------------------- // Utility functions // ------------------------------- let util = { getValue(name) { return GM_getValue(name); }, setValue(name, value) { GM_setValue(name, value); }, // Check if the given string (after removing '-' and '_') contains any of the keywords (case-insensitive) include(str, arr) { str = str.replace(/[-_]/ig, ''); for (let i = 0, l = arr.length; i < l; i++) { let val = arr[i].trim(); if (val !== '' && str.toLowerCase().indexOf(val.toLowerCase()) > -1) { return true; } } return false; }, addStyle(id, tag, css) { tag = tag || 'style'; let doc = document, styleDom = doc.getElementById(id); if (styleDom) return; let style = doc.createElement(tag); style.rel = 'stylesheet'; style.id = id; tag === 'style' ? style.innerHTML = css : style.href = css; doc.head.appendChild(style); }, // Common regex patterns reg: { chrome: /^https?:\/\/chrome\.google\.com\/webstore\/.+?\/([a-z]{32})(?=[\/#?]|$)/, chromeNew: /^https?:\/\/chromewebstore\.google\.com\/.+?\/([a-z]{32})(?=[\/#?]|$)/, edge: /^https?:\/\/microsoftedge\.microsoft\.com\/addons\/.+?\/([a-z]{32})(?=[\/#?]|$)/, firefox: /^https?:\/\/(reviewers\.)?(addons\.mozilla\.org|addons(?:-dev)?\.allizom\.org)\/.*?(?:addon|review)\/([^/<>"'?#]+)/, microsoft: /^https?:\/\/(?:apps|www)\.microsoft\.com\/(?:store|p)\/.+?\/([a-zA-Z\d]{10,})(?=[\/#?]|$)/, } }; // ------------------------------- // Main logic // ------------------------------- let main = { // Initialize configuration values (store values using GM storage) initValue() { // Note: The "store link" redirection option has been removed. let value = [{ name: 'setting_success_times', value: 0 }, { name: 'allow_external_links', value: true }, { name: 'allow_query_links', value: true }, { name: 'enable_target_self', value: false }, { name: 'enable_animation', value: false }, { name: 'delay_on_hover', value: 65 }, { name: 'exclude_list', value: '' }, { name: 'exclude_keyword', value: 'login\nlogout\nregister\nsignin\nsignup\nsignout\npay\ncreate\nedit\ndownload\ndel\nreset\nsubmit\ndoubleclick\ngoogleads\nexit' }]; value.forEach((v) => { if (util.getValue(v.name) === undefined) { util.setValue(v.name, v.value); } }); }, // Register menu commands for the settings panel and reset function registerMenuCommand() { GM_registerMenuCommand( "🚀 " + translations[lang].acceleratedCount + util.getValue('setting_success_times') + translations[lang].times, () => { Swal.fire({ showCancelButton: true, title: translations[lang].resetPrompt, icon: 'warning', confirmButtonText: translations[lang].confirm, cancelButtonText: translations[lang].cancel, customClass: { popup: 'instant-popup', }, }).then((res) => { if (res.isConfirmed) { util.setValue('setting_success_times', 0); history.go(0); } }); } ); let dom = `