Greasy Fork is available in English.

初音的青葱Onedrive微云自动填充密码并点击[多网页版]

不会因为打开多个游戏简介界面而覆盖密码

您查看的为 2020-06-20 14:48:36 UTC 提交的版本。查看 最新版本

// ==UserScript==
// @name         初音的青葱Onedrive微云自动填充密码并点击[多网页版]
// @namespace    http://tampermonkey.net/
// @version      2.1.0
// @description  不会因为打开多个游戏简介界面而覆盖密码
// @author       aotmd
// @match        https://mkgal-my.sharepoint.com/*
// @match        https://www.mkgal.com/*
// @match		 https://share.weiyun.com/*
// @icon         https://www.mkgal.com/static/images/login.jpg
// @grant        none
// ==/UserScript==

(function() {
	var setting = {
		//取不到值的默认密码
		"Onedrive默认密码": "MKFX",
		//过低将无法填充密码
		"微云延时": 500,
		//设置填充密码仅在www.mkgal.com点击链接时执行
		"网页限定": true,
	};
	window.onload = function() {
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = decodeURI(window.location.search).substr(1).match(reg);
			if (r != null) return (r[2]);
			return null;
		}
		var url = window.location.href;
		var str = /https:\/\/www\.mkgal\.com\/.+/i;
		var str2 = /https:\/\/mkgal-my\.sharepoint\.com\/.+/i;
		var str3 = /https:\/\/share\.weiyun\.com\/.+/i;
		if (str.test(url)) {
			var Onedrive = document.getElementsByClassName("pan")[0].getElementsByTagName("span")[0].innerText;
			var weiyun = document.getElementsByClassName("pan")[1].getElementsByTagName("span")[0].innerText;
			var a = document.getElementsByClassName("pan");
			a[0].getElementsByTagName("a")[0].href += "&password=" + a[0].getElementsByTagName("span")[0].innerText;
			a[1].getElementsByTagName("a")[0].href += "?password=" + a[1].getElementsByTagName("span")[0].innerText;
		} else if (str2.test(url)) {
			if (str.test(document.referrer) == false && setting.前网页限定) {
				return;
			}
			if (getQueryString('password') == null) {
				document.getElementById("txtPassword").value = setting.Onedrive默认密码;
			} else {
				document.getElementById("txtPassword").value = getQueryString('password')
			}
			document.getElementById("btnSubmitPassword").click();
		} else if (str3.test(url)) {
			if (str.test(document.referrer) == false && setting.前网页限定) {
				return;
			}
			if (getQueryString('password') != null) {
				setTimeout(function() {
					/*自定义方法触发事件*/
					window.inputValue = function(dom, st) {
						var evt = new InputEvent('input', {
							inputType: 'insertText',
							data: st,
							dataTransfer: null,
							isComposing: false
						});
						dom.value = st;
						dom.dispatchEvent(evt);
					};
					var iput = document.getElementsByClassName("input-txt")[0];
					window.inputValue(iput, getQueryString('password'));
					document.getElementsByClassName("btn btn-l btn-main")[0].click();
				}, setting.微云延时);
			}
		}
	};
})();