-
-
Save ssig33/1668954 to your computer and use it in GitHub Desktop.
Google+ の名前のとこを薄くぼかすやつ
This file contains 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 EvilRT | |
// @namespace gyuque | |
// @include https://plus.google.co* | |
// ==/UserScript== | |
(function() { | |
function makeFunc(postBox) { | |
var btn = document.createElement("button"); | |
btn.innerHTML = "Blur"; | |
postBox.appendChild(btn); | |
btn.style.fontSize = "6px"; | |
btn.style.position = "absolute"; | |
btn.style.left = "-0.5em"; | |
btn.style.top = "-0.9em"; | |
btn.style.opacity = "0.6"; | |
btn.addEventListener("click", function(){ | |
makeBlur(postBox); | |
}, false); | |
} | |
function makeBlur(postBox) { | |
//postBox.style.overflow = "hidden"; | |
var nameBoxes = postBox.getElementsByClassName("eE"); | |
if (nameBoxes[0]) { | |
var nameBox = nameBoxes[0]; | |
var nameLinks = postBox.getElementsByClassName("yn"); | |
if (nameLinks[0]) { | |
var st = nameLinks[0].style; | |
st.position = "relative"; | |
st.left = "-1300px"; | |
st.textShadow = | |
(navigator.userAgent.indexOf('WebKit') > -1) ? | |
"1300px 0 2px #36c" : "1300px 0 1.5px #36c"; | |
} | |
} | |
var avBoxes = postBox.getElementsByClassName("Fn"); | |
if (avBoxes[0]) { | |
relpaceIcon(avBoxes[0]); | |
} | |
} | |
function relpaceIcon(iconImg) { | |
var w = iconImg.offsetWidth; | |
var h = iconImg.offsetHeight; | |
var cv = document.createElement("canvas"); | |
cv.width = Math.floor(w / 3) + 6; | |
cv.height = Math.floor(h / 3) + 6; | |
cv.getContext("2d").drawImage(iconImg, 0, 0, w, h, 3, 3, w/3, h/3); | |
cv.style.width = (w+18)+"px"; | |
cv.style.height = (h+18)+"px"; | |
cv.style.top = "-9px"; | |
cv.style.left = "-9px"; | |
cv.style.marginRight = "-9px"; | |
cv.style.position = "relative"; | |
var container = iconImg.parentNode; | |
cv.className = iconImg.className; | |
container.insertBefore(cv, iconImg); | |
container.removeChild(iconImg); | |
} | |
function calcPosition(aElement) { | |
var win = aElement.ownerDocument.defaultView; | |
var x = y = 0; | |
while (aElement.offsetParent) { | |
x += aElement.offsetLeft; | |
y += aElement.offsetTop; | |
aElement = aElement.offsetParent; | |
} | |
return {x:x >> 0, y:y >> 0, win:win}; | |
} | |
var gyuque = function(){ | |
setTimeout(function(){ | |
var nodes = document.getElementsByClassName("Ve"); | |
for (var i = 0;i < nodes.length;i++) { | |
makeFunc(nodes[i]); | |
} | |
gyuque(); | |
}, 200); | |
} | |
gyuque(); | |
}) (); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment