Skip to content

Instantly share code, notes, and snippets.

@gyuque
Created January 24, 2012 06:52
Show Gist options
  • Save gyuque/1668517 to your computer and use it in GitHub Desktop.
Save gyuque/1668517 to your computer and use it in GitHub Desktop.
Google+ の名前のとこを薄くぼかすやつ
// ==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 nodes = document.getElementsByClassName("Ve");
for (var i = 0;i < nodes.length;i++) {
makeFunc(nodes[i]);
}
}) ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment