您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Helps the Olympian scripts when they need GreaseMonkey functions
当前为
- // ==UserScript==
- // @name Harpocrates
- // @namespace mobiusevalon.tibbius.com
- // @version 0.1
- // @author Mobius Evalon
- // @description Helps the Olympian scripts when they need GreaseMonkey functions
- // @license Creative Commons Attribution-ShareAlike 4.0; http://creativecommons.org/licenses/by-sa/4.0/
- // @include /^https{0,1}:\/\/\w{0,}\.?mturk\.com.+/
- // @include /^https{0,1}:\/\/\w{0,}\.amazon\.com\/ap\/signin/
- // @grant GM_setValue
- // @grant GM_getValue
- // ==/UserScript==
- // use of unsafeWindow is necessary to get harpocrates into the un-sandboxed
- // space with the rest of the olympian scripts
- if(unsafeWindow.olympus === undefined) unsafeWindow.olympus = {};
- unsafeWindow.olympus.harpocrates = {
- __12_hrs:43200000,
- get login_timestamp() {
- return GM_getValue("login_timestamp",0);
- },
- __init:function() {
- console.log("harpocrates init");
- if(/^https{0,1}:\/\/\w{0,}\.amazon\.com\/ap\/signin/i.test(window.location.href)) {
- olympus.style.add(".red {color: #f00;}");
- $("#signInSubmit-input").click(function() {
- GM_setValue("login_timestamp",Date.now());
- });
- }
- else this.display();
- },
- display:function() {
- var login_time = (this.login_timestamp*1);
- if(login_time > 0) {
- var time_left = ((this.__12_hrs-(Date.now()-login_time))/1000);
- $("span.header_links").append(
- $("<br/>"),
- $("<b/>")
- .attr("class",("logout_time"+(time_left <= 1800 ? " anim_pulse red" : "")))
- .text("Time to logout: "+(time_left <= 300 ? "any moment" : olympus.utilities.dhms(time_left)))
- );
- }
- }
- };