Last active
October 12, 2018 00:42
-
-
Save khsk/9c3f75b24093b642ec222f921439c045 to your computer and use it in GitHub Desktop.
「Markdownを表示する」ボタンを追加するユーザースクリプト 新レイアウト版 ref: https://qiita.com/khsk/items/4752f80bde7b634f0b00
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 Source | |
// @namespace com.cielavenir | |
// @description Show link to Qiita Markdown source. | |
// @include http://qiita.com/*/items/* | |
// @include http://qiita.com/*/private/* | |
// @version 0.0.0.3 | |
// ==/UserScript== | |
(function(){ | |
var ul=document.getElementsByClassName('dropdown-menu dropdown-menu-right'); | |
if(!ul)return; | |
var li=document.createElement('li'); | |
var a=document.createElement('a'); | |
a.href=location.href.split('#')[0]+'.md'; | |
var span=document.createElement('span'); | |
span.className='fa fa-fw fa-file-text-o'; | |
span.setAttribute('aria-hidden', 'true'); | |
a.textContent=' Markdownを表示する'; | |
a.insertBefore(span, a.firstChild); | |
li.appendChild(a); | |
var li2 = li.cloneNode(true); | |
ul[0].appendChild(li); | |
ul[1].appendChild(li2); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment