Work frame scroller

Hide the copyright footer, automatically scroll the page down to the work frame, and move the control buttons and timer to the header

目前為 2015-10-22 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Work frame scroller
// @namespace    mobiusevalon.tibbius.com
// @version      0.2
// @description  Hide the copyright footer, automatically scroll the page down to the work frame, and move the control buttons and timer to the header
// @author       Mobius Evalon
// @include      /^https{0,1}:\/\/work\.crowdsurfwork\.com\/tasks\/\w{32}.*?$/
// @grant        none
// ==/UserScript==

function ypos(elem)
{
    var y = 0;
    if(elem.offsetParent)
    {
        do y += elem.offsetTop;
        while (elem = elem.offsetParent);
        return y;
    }
}

var header = document.getElementsByClassName("headerwrapper")[0];
var footer = document.getElementsByTagName("footer")[0];
var work_frame = document.getElementById("innerframe");
var task_detail = document.getElementById("task-detail-nav");
var accept_button = document.getElementById("accept-button");
var header_right = header.getElementsByClassName("header-right")[0];
var head = document.getElementsByTagName("head")[0];

var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = "#task-detail-nav {margin: 0px !important; padding: 0px !important; color: #ffffff !important;}"+
    "#task-detail-nav a.btn {margin: 0px 10px !important; padding: 6px 15px !important;}"+
    "#task-detail-nav #Countdown h4 {margin: 0px 10px !important;}";
head.appendChild(css);

footer.style.display = "none"; // takes up unnecessary space and contains nothing but a copyright date

if(accept_button !== null && accept_button !== undefined) // i keep getting these buttons backward because of Turk
{
    var pn = accept_button.parentNode;
    pn.removeChild(accept_button);
    pn.insertBefore(accept_button,pn.childNodes[0]);
}
task_detail.parentNode.removeChild(task_detail);
task_detail.className = "";
header_right.insertBefore(task_detail,header_right.childNodes[0]);

window.scroll(0,ypos(work_frame)-header.scrollHeight+10); // body tag contains 10px of margin by default
长期地址
遇到问题?请前往 GitHub 提 Issues。