// ==UserScript==
// @name Add Nicopedia Menu
// @namespace Add Nicopedia Menu
// @description ニコニコ大百科の単語記事右側にメニューを追加します
// @author sotoba
// @match https://dic.nicovideo.jp/*
// @version 0.0.2-20181101
// @homepageURL https://github.com/SotobatoNihu/AddNicopediaMenu
// @license MIT License
// @downloadURL none
// ==/UserScript==
const MENUID = 'nicopedia-menu'
//取り急ぎの実装なのでレイアウトはあとでちゃんとしたものを作ります
const drowMenu=(word)=>{
const menuElem=document.getElementById(MENUID)
menuElem.innerHTML=`
ニコニコ大百科で検索する:
「${word}」でキーワード検索
「${word}」でタグ検索
キーワードで検索する:
Google
2ch /
/
/
最近更新された…
単語記事 / 動画記事 / 商品記事 /
ユーザ記事 / コミュ記事 / 生放送記事 /
書き込み / お絵カキコ / ピコカキコ /
トップ / マイページ / ログアウト
`
}
// document.addEventListener('DOMContentLoaded', function () {
window.onload = function () {
console.log('fugafuga')
if (document.getElementById(MENUID) === null) {
const elm = document.createElement('div')
elm.id = MENUID
elm.style.height = 'auto'
elm.style.backgroundColor='#FFF'
elm.style.border='1px solid #000'
document.getElementById('right-column').insertAdjacentElement('afterbegin', elm)
}
const word = document.getElementById('search-box').value
const modifyWord=word.replace(' ','_')
console.log(`word:${word}`)
console.log(`modifiedword:${word}`)
drowMenu(modifyWord)
}
// })