一个自用的脚本,所生成的密码仅建议作为实际密码的组成部分使用
目前為
// ==UserScript==
// @name 密码生成器
// @namespace wdssmq
// @description 一个自用的脚本,所生成的密码仅建议作为实际密码的组成部分使用
// @include http://*
// @include https://*
// @version 1
// @require https://cdn.bootcss.com/jquery/3.1.0/jquery.min.js
// @grant none
// ==/UserScript==
$(function () {
'use strict';
// return false;
var host = window.location.host;
var strHash = fnHostHash(host, 65537);
var domH2 = $('<h2 style="background-color: rgb(252, 248, 227); border: 1px solid rgb(250, 235, 204); border-radius: 4px; padding: 5px; z-index: 1060; margin: 0px auto; position: fixed; bottom: 0px; width: 100%; font-size: 15px; line-height: 1.2em; text-align: center;">1kyx1qy</h2>');
domH2.appendTo("body").html(strHash);
if (GetCookie(host) === host) {
domH2.hide();
}
$("input[type=password]").blur(function () {
SetCookie(host, host, 30);
domH2.hide();
});
function fnHostHash(host, i) {
host = host.replace(/[^\.]*\.?([^\.]+\.[^\.]+)/g, "$1");
i = parseInt(i);
var intHost = parseInt(host, 36);
var daysStamp = parseInt($.now() / (1000 * 60 * 60 * 24));
var result = "";
result = parseInt((daysStamp + (intHost % 181)) / 181);
result = result + i + intHost;
result = result * 181;
return result.toString(36);
}
function fnLog(n) {
if (Object.prototype.toString.call(n) === '[object Array]') {
a = n.join(" , ");
} else {
a = n;
}
if (document.getElementById('debug'))
document.getElementById('debug').innerHTML += a + "<br />";
console.log(a);
}
function SetCookie(sName, sValue, iExpireDays) {
var path = (typeof(cookiespath) == "undefined") ? "/" : cookiespath;
if (iExpireDays) {
var dExpire = new Date();
dExpire.setTime(dExpire.getTime() + parseInt(iExpireDays * 24 * 60 * 60 * 1000));
document.cookie = sName + "=" + escape(sValue) + "; expires=" + dExpire.toGMTString() + "; path=" + path;
} else {
document.cookie = sName + "=" + escape(sValue) + "; path=" + path;
}
}
function GetCookie(sName) {
var arr = document.cookie.match(new RegExp("(^| )" + sName + "=([^;]*)(;|$)"));
if (arr != null) {
return unescape(arr[2])
};
return null;
}
});