Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==UserScript==
// @name Twitter OAuth Caution
// @namespace http://github.com/mooz/
// @description Display caution when application requests a 'write' access
// @include https://twitter.com/oauth/authorize?*
// @include https://twitter.com/oauth/authenticate?*
// ==/UserScript==
(function () {
var msgElem = document.querySelector(".signin-content > h4");
var msgText = msgElem.textContent;
var writeRequired = ["update", "\u66F4\u65B0"].some(function (w) {return msgText.indexOf(w) !== -1});
if (!writeRequired)
return;
function p(text, style, _p) {
_p = document.createElement("p");
_p.textContent = text;
_p.setAttribute("style", style);
return _p;
};
var caution = document.createElement("div");
caution.setAttribute("style", ['-moz-border-radius : 3px'
,'border-radius : 3px'
,'padding : 10px'
,'margin : 10px'
,'background-color : #fbd71c'
,'-moz-box-shadow : 0px 0px 3px #353535'
,'-webkit-box-shadow : 0px 0px 3px #353535'
,'box-shadow : 0px 0px 3px #353535'
,'text-align : center'
].join(';'));
caution.appendChild(p("CAUTION", "color : #000000; font-weight : bold; font-size : 40px;"));
caution.appendChild(p("This application is requesting a 'Write' access", "color : #000000; font-size : 20px;"));
msgElem.parentNode.insertBefore(caution, msgElem.nextSibling);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.