Created
March 21, 2012 00:12
-
-
Save LouCypher/2142869 to your computer and use it in GitHub Desktop.
Google +1 userscripts
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 Flickr Plus One Like | |
// @namespace http://mozilla.status.net/loucypher | |
// @description Add Google+1 and Facebook Like buttons | |
// @author LouCypher | |
// @license free | |
// @match *://*.flickr.com/photos/* | |
// @include http://www.flickr.com/photos/* | |
// @include https://secure.flickr.com/photos/* | |
// ==/UserScript== | |
var parent = $("#main > #sidebar > #photo-story") || | |
$("#main > #ViewSet > .vsDetails"); | |
if (!parent) return; | |
var div = $append($create("div"), parent); | |
div.style.marginTop = "1em"; | |
var gp = $append($create("g:plusone"), div); | |
gp.setAttribute("size", "medium"); | |
var fbLike = $append($create("fb:like"), div); | |
fbLike.setAttribute("send", false); | |
fbLike.setAttribute("show_faces", false); | |
fbLike.setAttribute("layout", "button_count"); | |
fbLike.style.verticalAlign = "top"; | |
$append($script("//apis.google.com/js/plusone.js"), parent); | |
$append($script("//connect.facebook.net/en_US/all.js#xfbml=1"), parent); | |
function $(aSelector) { | |
return document.querySelector(aSelector); | |
} | |
function $create(aElement) { | |
return document.createElement(aElement); | |
} | |
function $append(aNode, aParent) { | |
return aParent.appendChild(aNode); | |
} | |
function $script(aSource, aSync) { | |
var script = $create("script"); | |
script.setAttribute("async", aSync ? false : true); | |
script.type = "text/javascript"; | |
script.src = aSource; | |
return script; | |
} |
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 github:gist+1 | |
// @namespace http://mozilla.status.net/loucypher | |
// @description Add Google +1 button on gist.github.com | |
// @version 0.2.20120321.01 | |
// @author LouCypher | |
// @license free | |
// @icon http://i.imgur.com/vFoYD.png | |
// @include https://gist.github.com/* | |
// ==/UserScript== | |
var path = document.querySelector("#repos .title > .path"); | |
if (!path) return; | |
var div = path.parentNode.insertBefore(document.createElement("div"), path.nextSibling); | |
div.style.cssFloat = "left"; | |
div.style.margin = ".5em 0 0 1em"; | |
var gp = div.appendChild(document.createElement("g:plusone")); | |
gp.setAttribute("size", "small"); | |
gp.setAttribute("annotation", "bubble"); | |
var script = document.createElement("script"); | |
script.setAttribute("async", true); | |
script.type = "text/javascript"; | |
script.src = "//apis.google.com/js/plusone.js"; | |
gp.parentNode.appendChild(script); |
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 github+1 | |
// @namespace http://mozilla.status.net/loucypher | |
// @description Add Google +1 button on github | |
// @version 0.2.20120321.01 | |
// @author LouCypher | |
// @license free | |
// @icon http://i.imgur.com/vFoYD.png | |
// @include https://github.com/* | |
// ==/UserScript== | |
var uList = document.querySelector(".site ul.pagehead-actions"); | |
if (!uList) return; | |
var list = uList.appendChild(document.createElement("li")); | |
list.style.verticalAlign = "-5px"; | |
var gp = list.appendChild(document.createElement("g:plusone")); | |
gp.setAttribute("size", "medium"); | |
gp.setAttribute("annotation", "bubble"); | |
var script = document.createElement("script"); | |
script.setAttribute("async", true); | |
script.type = "text/javascript"; | |
script.src = "//apis.google.com/js/plusone.js"; | |
gp.parentNode.appendChild(script); |
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 MDN+1 | |
// @namespace http://mozilla.status.net/loucypher | |
// @description Added Google+1 button on MDN articles | |
// @icon http://i.imgur.com/5SesG.png | |
// @author LouCypher | |
// @license free | |
// @include https://developer.mozilla.org/* | |
// @exclude https://developer.mozilla.org/Talk:* | |
// @exclude https://developer.mozilla.org/*action=* | |
// ==/UserScript== | |
var uList = document.querySelector("#page-buttons"); | |
if (!uList) return; | |
var list = uList.insertBefore(document.createElement("li"), uList.firstChild); | |
list.style.marginTop = "3px"; | |
var gp = list.appendChild(document.createElement("g:plusone")); | |
var script = document.createElement("script"); | |
script.setAttribute("async", true); | |
script.type = "text/javascript"; | |
script.src = "https://apis.google.com/js/plusone.js"; | |
gp.parentNode.appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good