Greasy Fork is available in English.

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

同步最新网址,支持旧的链接

您查看的为 2020-09-28 12:18:24 UTC 提交的版本。查看 最新版本

// ==UserScript==
// @name         初音的青葱Onedrive微云自动填充密码并点击[多网页版]
// @namespace    http://tampermonkey.net/
// @version      2.3.2
// @description  同步最新网址,支持旧的链接
// @author       aotmd
// @match        https://mkgal-my.sharepoint.com/*
// @match        https://mkfx-my.sharepoint.cn/*
// @match        https://mkgal.com/*
// @match        https://*.mkgal.com/*
// @match		 https://share.weiyun.com/*
// @match        https://www.mikugal.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 = /mkgal\.com\/.+/i;
        var str_=/mikugal\.com\/.+/i;
        //下载页
		var str2 = /https:\/\/mkfx-my\.sharepoint\.cn\/.+/i;
        var str2_=/https:\/\/mkgal-my\.sharepoint\.com\/.+/i;
		var str3 = /https:\/\/share\.weiyun\.com\/.+/i;
		if (str.test(url)||str_.test(url)) {
            alert(document.getElementsByTagName("h2")[0].innerText+' [-'+getQueryString('id')+'-]');
			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]目前没有密码
			a[1].getElementsByTagName("a")[0].href += "?password=" + a[1].getElementsByTagName("span")[0].innerText;
			a[2].getElementsByTagName("a")[0].href += "&password=" + a[2].getElementsByTagName("span")[0].innerText;
		} else if (str2.test(url)||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.微云延时);
			}
		}
	};
})();