My Tampermonkey script works but Tumblr refills the original information

时间:2015-07-28 16:54:48

标签: javascript greasemonkey tumblr tampermonkey

I'm working on a script to remove certain pre-loaded values in my tumblr blog when I share something.

What it does right now is click on the settings icon enter image description here

Then it removes the content source:

enter image description here

The problem is that after running the script, and submitting the post, the Content source is still appearing... seems Tumblr detects this and refills the value.

This doesn't happen if I do it manually.

Any clue on why this is happening?

I even put the setTimeout function and clicked on it to try to avoid it but it's not "saving" the information after.

// ==UserScript==
// @name         RemoveContent
// @namespace    http://www.myblog.com
// @version      0.1
// @description  Removes pre-loaded stuff
// @author       You
// @match        https://www.tumblr.com/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant    GM_addStyle
// ==/UserScript==

document.querySelector(".post-settings").click();

waitForKeyElements (
    "#sourceUrl_input",
    changeContentInput
);

function changeContentInput () {
    setTimeout(function(){ document.getElementById('sourceUrl_input').click(); }, 1000);
    setTimeout(function(){ document.getElementById('sourceUrl_input').value = ""; }, 1000);
    setTimeout(function(){ document.getElementById('sourceUrl_input').click(); }, 1000);
}

0 个答案:

没有答案