Created
April 30, 2018 20:05
-
-
Save cuylerstuwe/264139538ff7940127c2353746b4e052 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Panda Crazy Enhancements - Droppable, Burn All Surveys, Etc. | |
| // @namespace cuyler_stuwe | |
| // @version 4.2 | |
| // @description Make links in Panda Crazy droppable. | |
| // @author Cuyler Stuwe | |
| // @include https://www.mturk.com/mturk/welcome?pandacrazy* | |
| // @include https://worker.mturk.com/?filters[search_term]=pandacrazy=on | |
| // @include https://worker.mturk.com/requesters/PandaCrazy/projects | |
| // @icon http://i.imgur.com/hLwZkUt.jpg | |
| // @grant none | |
| // ==/UserScript== | |
| const OLD_SITE_COLOR = "rgba(255,0,0,0.3)"; | |
| const NEW_SITE_COLOR = "rgba(0,255,0,0.3)"; | |
| (function() { | |
| 'use strict'; | |
| let siteColor; | |
| let siteString; | |
| if(window.location.href.toLowerCase().includes("worker.mturk.com")) { | |
| siteColor = NEW_SITE_COLOR; | |
| siteString = "NEW WORKER SITE"; | |
| } | |
| else { | |
| siteColor = OLD_SITE_COLOR; | |
| siteString = "OLD SITE"; | |
| } | |
| let semiTransColorDiv = document.createElement("DIV"); | |
| semiTransColorDiv.style = | |
| "width: 100%;" + | |
| " height: 20%;" + | |
| `background-color: ${siteColor}; ` + | |
| "pointer-events:none;" + | |
| "z-index: 20000000;" + | |
| "position: fixed;" + | |
| "left: 0px;" + | |
| "top: 80%;" + | |
| "text-align:center;" + | |
| // "display: none;" + | |
| "opacity: 1" + | |
| ""; | |
| let leftDiv = document.createElement("DIV"); | |
| leftDiv.innerHTML = "<section>PandA Once</section><section style='margin-top:50px;'>🐼x1</section><section style='margin-top:50px;'><strong>(Survey)</strong></section>"; | |
| leftDiv.style = | |
| "position: absolute;" + | |
| "padding-top: 10px;" + | |
| "pointer-events:none;" + | |
| "z-index: 20000001;" + | |
| "left: 0%;" + | |
| "top: 0%;" + | |
| "width: 50%;" + | |
| "height: 100%;" + | |
| "border: 1px solid black;" + | |
| "background: black;" + | |
| "color: white;" + | |
| "opacity: 0;" + | |
| "font-size: 3.0em;"; | |
| semiTransColorDiv.appendChild(leftDiv); | |
| let rightDiv = document.createElement("DIV"); | |
| rightDiv.innerHTML = "<section>PandA Indefinitely</section><section style='margin-top:50px;'>🐼🐼🐼...</section><section style='margin-top:50px;'><strong>(Batch)</strong></section>"; | |
| rightDiv.style = | |
| "position: absolute;" + | |
| "padding-top: 10px;" + | |
| "pointer-events:none;" + | |
| "z-index: 20000002;" + | |
| "left: 50%;" + | |
| "top: 0%;" + | |
| "width: 50%;" + | |
| "height: 100%;" + | |
| "background: white;" + | |
| "color: black;" + | |
| "opacity: 0;" + | |
| "font-size: 3.0em;" + | |
| ""; | |
| semiTransColorDiv.appendChild(rightDiv); | |
| let wordsSpan = document.createElement("SPAN"); | |
| wordsSpan.style = | |
| "max-width: 100px;" + | |
| "background-color: black;" + | |
| "pointer-events: none;" + | |
| "color: white;"; | |
| wordsSpan.innerText = siteString; | |
| semiTransColorDiv.appendChild(wordsSpan); | |
| document.addEventListener('dragover', () => { | |
| leftDiv.style.pointerEvents = "auto"; | |
| rightDiv.style.pointerEvents = "auto"; | |
| leftDiv.style.opacity = "1"; | |
| rightDiv.style.opacity = "1"; | |
| }); | |
| document.addEventListener('dragleave', (e) => { | |
| if(e.relatedTarget === null) { | |
| leftDiv.style.pointerEvents = "none"; | |
| rightDiv.style.pointerEvents = "none"; | |
| leftDiv.style.opacity = "0"; | |
| rightDiv.style.opacity = "0"; | |
| } | |
| }); | |
| document.addEventListener('drop', () => {leftDiv.style.opacity = "0"; rightDiv.style.opacity = "0";}); | |
| leftDiv.addEventListener('dragover', e => e.preventDefault() ); | |
| leftDiv.addEventListener('dragenter', e=> e.preventDefault() ); | |
| leftDiv.addEventListener('drop', function(e) { | |
| e.preventDefault(); | |
| document.querySelector("#bShortAddJ").click(); | |
| document.querySelector(".groupIdInput").value = | |
| e.dataTransfer.getData("text/plain"); | |
| document.querySelector(".onlyOnce").checked = true; | |
| document.querySelector(".nonselectable.JRAddPanda").click(); | |
| leftDiv.style.pointerEvents = "none"; | |
| rightDiv.style.pointerEvents = "none"; | |
| }); | |
| rightDiv.addEventListener('dragover', e => e.preventDefault() ); | |
| rightDiv.addEventListener('dragenter', e=> e.preventDefault() ); | |
| rightDiv.addEventListener('drop', function(e) { | |
| e.preventDefault(); | |
| document.querySelector("#bShortAddJ").click(); | |
| document.querySelector(".groupIdInput").value = | |
| e.dataTransfer.getData("text/plain"); | |
| document.querySelector(".onlyOnce").checked = false; | |
| document.querySelector(".nonselectable.JRAddPanda").click(); | |
| leftDiv.style.pointerEvents = "none"; | |
| rightDiv.style.pointerEvents = "none"; | |
| }); | |
| document.body.appendChild(semiTransColorDiv); | |
| let topRightDiv = document.createElement("DIV"); | |
| topRightDiv.style = "" + | |
| "position: absolute;" + | |
| "pointer-events:auto;" + | |
| "z-index: 20000008;" + | |
| "right: 0px;" + | |
| "top: 0px;" + | |
| "height: 50px;" + | |
| "width: 100px;" + | |
| "border: 1px solid black;" + | |
| "background-color: yellow;" + | |
| "opacity: 1;" + | |
| "text-align: center;" + | |
| "font-size: 2.2em;" + | |
| "user-select: none;" + | |
| "cursor: pointer;"; | |
| topRightDiv.innerHTML = `<p style="margin: 0px; padding: 10px 0px 0px 0px; font-size: 1em;">📋➡️🔥</p>`; | |
| document.body.appendChild(topRightDiv); | |
| topRightDiv.addEventListener('click', function(e) { | |
| document.querySelector("#bJobsList").click(); | |
| document.querySelector("input[type='radio'][name='searchingJob'][value='once']").click(); | |
| document.querySelector("input.JRCheckbox").click(); | |
| document.querySelector("span[data-htmltext='Delete Selected']").click(); | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment