Skip to content

Instantly share code, notes, and snippets.

@0mg
Last active December 15, 2015 15:09
Show Gist options
  • Save 0mg/5279480 to your computer and use it in GitHub Desktop.
Save 0mg/5279480 to your computer and use it in GitHub Desktop.
tw-minus developer
// ==UserScript==
// @name tw-minus developer
// @include https://api.twitter.com/robots.txt?-=/*
// ==/UserScript==
var props = function(arg) {
if (arg === null || arg === undefined) return arg;
var proplist = [];
for (var i in arg) proplist.push(i + " : " + arg[i]);
proplist.unshift(arg);
return proplist.join("\n");
};
(function() {
// property overrider
var decoy = function(path, value) {
(function set(p) {
var _v = value;
Object.defineProperty(p, path.shift(), {
get: function() { return _v; },
set: function(v) { if (path.length) set(_v = v); }
});
})(window);
};
// overwrite API version
if (typeof API !== "undefined") return;
decoy(["API", "V"], 1);
})();
addEventListener("load", function() {
// set settings/api <input> value
var strs = {
head: "",
get: "/1.1/statuses/user_timeline.json?x=@&&=&%23=&=3&%26&x=0",
post: "/1.1/blocks/destroy.json?screen_name=%40"
};
var nd = {
head: D.qs("#main input")[0],
get: D.qs("#main input")[1],
post: D.qs("#main input")[2]
};
if (U.getURL().path === "settings/api") {
nd.head.value = "";
nd.get.value = strs.get;
nd.post.value = strs.post;
}
}, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment