Created
April 21, 2012 16:12
-
-
Save technolize/2438054 to your computer and use it in GitHub Desktop.
github の organization ページにもフォローボタンを表示する
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 follow organization | |
// @description Show follow button on github organization page | |
// @namespace http://www.technolize.net/ | |
// @include https://github.com/* | |
// @version 0.1 | |
// @license MIT License | |
// @work Google Chrome | |
// ==/UserScript== | |
function main() { | |
if ($('span.organization-bit').length == 0) return; | |
var username = $('h1.avatared span.username').text(); | |
var btn_follow = $('<a/>').attr({ | |
'href': '/users/follow?target=' + username, | |
'data-method': 'post', | |
'data-remote': '', | |
'data-user': username | |
}).addClass('follow minibutton btn-follow js-toggler-target'); | |
$('<span><span class="icon"></span>Follow</span>').appendTo(btn_follow); | |
var btn_unfollow = $('<a/>').attr({ | |
'href': '/users/follow?target=' + username, | |
'data-method': 'post', | |
'data-remote': '', | |
'data-user': username | |
}).addClass('unfollow minibutton btn-unfollow js-toggler-target'); | |
$('<span><span class="icon"></span>Unfollow</span>').appendTo(btn_unfollow); | |
var container = $('<span class="js-toggler-container user-following-container"></span>'); | |
btn_follow.appendTo(container); | |
btn_unfollow.appendTo(container); | |
$('ul.pagehead-actions').append($('<li/>').append(container)); | |
} | |
var script = document.createElement('script'); | |
script.type = "text/javascript"; | |
script.textContent = '(' + main.toString() + ')();'; | |
document.body.appendChild(script); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment