Last active
November 30, 2016 05:33
-
-
Save tkrkt/2c5f881606fbe65bb869b1bfbdd92239 to your computer and use it in GitHub Desktop.
Add "Stock Ranking" link to Qiita's tags page
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 Qiita Stock Ranking Link | |
// @description Add "Stock Ranking" link to Qiita's tags page | |
// @namespace https://gist.github.com/tkrkt | |
// @include http://qiita.com/tags/* | |
// @version 2 | |
// @grant none | |
// ==/UserScript== | |
const tag = document.querySelector('h1.tagShowHeader_name').textContent; | |
const encodedTag = encodeURIComponent(tag); | |
const utf8 = tag.length === encodedTag.length ? '' : 'utf8=%E2%9C%93&'; | |
const container = document.querySelector('section.tagShowLikeRanking'); | |
if (container) { | |
container.innerHTML += | |
`<p class="text-right"> | |
<a href="/search?${utf8}sort=stock&q=tag%3A${encodedTag}"> | |
ストック数の多い投稿を見る | |
<i class="fa fa-angle-double-right"></i> | |
</a> | |
</p>`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment