您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Speculatively performs SSL/TLS handshakes for hovered links to speed up browsing.
当前为
- // ==UserScript==
- // @name SSL Accelerator
- // @description Speculatively performs SSL/TLS handshakes for hovered links to speed up browsing.
- // @author Anon
- // @version 0.1.0
- // @license Public domain
- // @include *
- // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js
- // @require https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.11.2/URI.min.js
- // @grant GM_xmlhttpRequest
- // @grant GM_log
- // @namespace https://greasyfork.org/users/4614
- // ==/UserScript==
- var alreadyHandshakedWith = {};
- var handshakeStartDelayTimerID = 0;
- var currentRequest = null;
- var currentHostname = (new URI(window.location.href)).hostname();
- $("body").on("mouseenter", "a", function (e)
- {
- var targetURI = new URI(e.target.href);
- var targetProtocol = targetURI.protocol();
- var targetHostname = targetURI.hostname();
- if (targetProtocol != "https" ||
- targetHostname == currentHostname)
- {
- return;
- }
- if (alreadyHandshakedWith[targetHostname])
- {
- GM_log("Already handshaked with " + targetHostname);
- return;
- }
- clearTimeout(handshakeStartDelayTimerID);
- handshakeStartDelayTimerID = setTimeout(function ()
- {
- GM_log("Handshaking with \"" + targetHostname + "\"..");
- currentRequest = GM_xmlhttpRequest({
- method: "HEAD",
- url: "https://" + targetHostname,
- onload: function()
- {
- GM_log("Successfuly handshaked with \"" + targetHostname + "\".");
- currentRequest = null;
- },
- });
- alreadyHandshakedWith[targetHostname] = true;
- }, 100);
- });
- $("body").on("mouseout", "a", function (e)
- {
- clearTimeout(handshakeStartDelayTimerID);
- });