// ==UserScript== // @name Mount Olympus // @namespace mobiusevalon.tibbius.com // @version 1.6 // @author Mobius Evalon // @description Common features shared amongst all Olympian scripts. // @license Creative Commons Attribution-ShareAlike 4.0; http://creativecommons.org/licenses/by-sa/4.0/ // @require https://code.jquery.com/jquery-1.12.4.min.js // @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js // @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/ // @exclude /&hit_scraper$/ // @exclude /\/HM$/ // @grant none // @downloadURL none // ==/UserScript== if(window.olympus === undefined) window.olympus = {}; // there is a reason they are initialized in this order window.olympus.__name = "olympus"; window.olympus.known_olympians = ["harpocrates","hermes","artemis","athena"]; window.olympus.default_settings = { query_turkopticon:true, use_to_cache:true, to_cache_timeout:10800000, to_pay_weight: 6.5, to_fair_weight:4, to_fast_weight:1, to_comm_weight:0.5, bayesian_to:true }; window.olympus.__init = function() { console.log("olympus init"); this.settings.init(this); olympus.style.add( "#javascriptDependentFunctionality {display: block !important;}"+ ".dialog.floats {border-radius: 8px; border: 2px solid #000000; max-height: 550px; position: absolute !important; z-index: 500; background-color: #7fb4cf; top: 25px; left: 200px; font-size: 12px;} "+ ".dialog.narrow {width: 300px; min-width: 300px;} "+ ".dialog.wide {width: 550px; min-width: 550px;} "+ ".dialog .scrolling-content {max-height: 350px; overflow-y: auto;} "+ ".dialog .actions {margin: 10px auto; padding: 0px; text-align: center; display: block;} "+ ".dialog .actions input:not(:last-of-type) {margin-right: 15px;} "+ ".dialog .head {padding: 0px; margin: 10px auto; font-size: 175%; font-weight: bold; width: 100%; text-align: center; cursor: move;} "+ "#olympian_help p.inset {margin-left: 25px;}"+ "#olympian_help p.inset b {margin-left: -25px; display: block;}"+ "#olympian_settings .sidebar {float: left; min-width: 100px; padding-left: 5px;}"+ "#olympian_settings .sidebar .tab {height: 30px; line-height: 30px; text-align: center; font-weight: bold; cursor: pointer;}"+ "#olympian_settings .sidebar .tab.active {background-color: #88c1de;}"+ "#olympian_settings .container {background-color: #88c1de; padding: 5px; margin-right: 5px; min-height: 150px;}"+ "#olympian_settings .subheader {font-size: 125%; font-weight: bold; margin-bottom: 10px; background-color: #96d5f5; padding: 5px 0px 5px 5px;}"+ "#olympian_settings .container .option_container {display: block;}"+ "#olympian_settings .container .option_container b.name {width: 150px; display: inline-block; margin-right: 10px;}"+ "#olympian_settings .container .description {margin-top: 5px; margin-bottom: 10px; font-size: 90%; padding-left: 10px;}"+ "#olympian_settings .container .description .toggle {margin-right: 5px;}"+ "#olympian_settings .container .description .collapsed {display: inline-block; width: 350px; height: 16px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;}"+ "#olympian_settings .container .subtitle.to_attr {width: 50px; display: inline-block; margin-right: 5px; text-align: right;}"+ "#olympian_settings .container .fa-toggle-off, #olympian_settings .container .fa-toggle-on, #olympian_settings .container .fa-plus-square-o, #olympian_settings .container .fa-minus-square-o {cursor: pointer;}"+ "#olympian_settings .container input[type='number'] {width: 45px;}"+ "#olympian_settings .container .plain {margin-bottom: 20px;}"+ "#open_olympus_settings {cursor: pointer;}"+ ".anim_pulse {animation-name: anim_pulse; animation-duration: 350ms; animation-iteration-count: infinite; animation-timing-function: linear; animation-direction: alternate;}"+ "@keyframes anim_pulse {from {opacity: 1;} to {opacity: 0.25;}} " ); // append the fontawesome stylesheet to the page if it does not exist if(!$("link[rel='stylesheet'][href$='font-awesome.min.css']").length) $("head").append( $("") .attr({ "data-pantheon":"olympus", "rel":"stylesheet", "href":"https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" }) ); Array.prototype.contains = function(item) { return (this.indexOf(item) > -1); }; String.prototype.collapseWhitespace = function() { return this.replace(/\s{2,}/g," ").trim(); }; String.prototype.ucFirst = function() { return (this.charAt(0).toUpperCase()+this.slice(1)); }; String.prototype.contains = function(substring) { return (this.indexOf(substring) > -1); }; // append the help window to the document $("body").append( $("
") .attr({ "data-pantheon":"olympus", "id":"olympian_help", "class":"dialog wide floats" }) .append( $("

") .attr("class","head") .text("Olympian help"), $("
") .attr("class","scrolling-content") .append( $("
").attr("class","explain") ), $("
") .attr("class","actions") .append( $("