m-team https fix

Convert in-site http links to https

Version vom 28.02.2016. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        m-team https fix
// @namespace   m-team
// @version     0.02
// @grant       none
// @include     https://tp.m-team.cc/*
// @description Convert in-site http links to https
// @description:zh-CN 将站内 http 链接转换为 https
// @description:zh-TW 將站內 http 鏈接轉換為 https
// ==/UserScript==

(function(){
	var snapResults = document.evaluate("//a[contains(@href,'http://tp.m-team.cc/')]", 
		document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
		console.log(snapResults.snapshotLength, '----');
	for (var i = snapResults.snapshotLength - 1; i >= 0; i--) {
		var elm = snapResults.snapshotItem(i);
		console.log(elm.getAttribute('href'),elm.getAttribute('href').replace(/^http:\/\/(tp\.m-team\.cc\/)/i, "https://$1"));
		elm.setAttribute('href', elm.getAttribute('href').replace(/^http:\/\/(tp\.m-team\.cc\/)/i, "https://$1"));
	}
})()