Yahoo Finance HTTPS to HTTPS Form Submit

Fix any forms on HTTPS pages that have HTTP submission URLs to avoid warnings

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Yahoo Finance HTTPS to HTTPS Form Submit
// @description Fix any forms on HTTPS pages that have HTTP submission URLs to avoid warnings
// @author      Jefferson "jscher2000" Scher
// @namespace   JeffersonScher
// @copyright   Copyright 2015 Jefferson Scher
// @license     BSD 3-clause
// @include     https://biz.yahoo.com/*
// @include     https://finance.yahoo.com/*
// @version     0.5
// @grant       none
// ==/UserScript==

function fixForms(){
  // Create a node list of forms whose action does not start with https: or with /
  var tgts = document.querySelectorAll('form[action]:not([action^="https:"]):not([action^="/"])');
  for (var i=0; i<tgts.length; i++){
    var actn = tgts[i].getAttribute("action");
    // If the action starts with http: switch it to https:
    if (actn.substr(0, 5) == "http:") tgts[i].setAttribute("action", "https:" + actn.substr(5));
  }
}
// Run fixForms half a second from now (approx. half a second after DOM Content Loaded)
window.setTimeout(fixForms, 500);