您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Helps the Olympian scripts when they need GreaseMonkey functions
当前为
- // ==UserScript==
- // @name Harpocrates
- // @namespace mobiusevalon.tibbius.com
- // @version 0.3
- // @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*\.amazon\.com\/ap\/signin.*(?:openid\.assoc_handle|pf_rd_i)=amzn_mturk/
- // @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,
- login_timestamp:0,
- __init:function() {
- console.log("harpocrates init");
- if(/^https{0,1}:\/\/\w{0,}\.amazon\.com\/ap\/signin/i.test(window.location.href)) {
- $("#signInSubmit-input").click(function() {
- GM_setValue("login_timestamp",Date.now());
- });
- }
- else {
- olympus.style.add(
- ".red {color: #f00;}"+
- ".logout_time {margin-right: 4px;}"
- );
- this.login_timestamp = (GM_getValue("login_timestamp",0)*1);
- $("span.header_links").append(
- $("<br/>"),
- $("<b/>")
- .attr({
- "id":"harpocrates_logout_time",
- "title":("You logged into Mechanical Turk on "+olympus.utilities.datetime.output(this.login_timestamp,"d M \\a\\t H:i")+".\n\n"+
- "The cookie for Mechanical Turk expires after 12 hours, which means you will be required to login again when this timer reaches zero.")
- })
- );
- this.update();
- }
- },
- update:function() {
- if(olympus.harpocrates.login_timestamp > 0) {
- var time_left = ((olympus.harpocrates.__12_hrs-(Date.now()-olympus.harpocrates.login_timestamp))/1000);
- $("#harpocrates_logout_time")
- .attr("class",((time_left <= 3600 ? " red" : "")+(time_left <= 1800 ? " anim_pulse" : "")))
- .text("Time to logout: "+(time_left <= 300 ? "any moment" : olympus.utilities.dhms(time_left)));
- setTimeout(olympus.harpocrates.update,60000);
- }
- else $("#harpocrates_logout_time")
- .removeClass("red anim_pulse")
- .attr("title","")
- .text("");
- }
- };