「MediaWiki:Forum.js」の版間の差分
編集の要約なし |
編集の要約なし |
||
| 209行目: | 209行目: | ||
deletesummary: 'delete post', | deletesummary: 'delete post', | ||
deletethreadsummary: 'スレッドの削除', | deletethreadsummary: 'スレッドの削除', | ||
toppage_css: "<style>.f-sticky>td:first-child>a::before{content:'';background-image:url(https://upload.wikimedia.org/wikipedia/commons/a/a5/OOjs_UI_icon_pushPin.svg);width:.8em;height:.8em;margin-right:.2em;display:inline-block;background-size:.8em}#f-loadmore{display:block;margin-left:auto;margin-right:auto;}</style>", | toppage_css: "<style>.f-sticky>td:first-child>a::before{content:'';background-image:url(https://upload.wikimedia.org/wikipedia/commons/a/a5/OOjs_UI_icon_pushPin.svg);width:.8em;height:.8em;margin-right:.2em;display:inline-block;background-size:.8em}#f-loadmore{display:block;margin-left:auto;margin-right:auto;}#f-create-btn-mobile{display:none;margin:1em 0;text-align:right;}@media (max-width:768px){.mw-indicators{display:block!important;}#f-create-btn-mobile{display:block;}}#f-notice{background:#fffacd;border:1px solid #daa520;border-radius:4px;padding:1em;margin:1em 0;font-size:.95em;line-height:1.6;}</style>", | ||
toppage_notice: mw.forum.notice ? `<div id="f-notice">${mw.forum.notice}</div>` : '', | |||
load_more: '<input type="button" value="もっと読み込む" class="mw-ui-button" id="f-loadmore">', | load_more: '<input type="button" value="もっと読み込む" class="mw-ui-button" id="f-loadmore">', | ||
create: '<input type="button" class="mw-ui-button mw-ui-progressive" value="スレッドを作成">', | create: '<input type="button" class="mw-ui-button mw-ui-progressive" value="スレッドを作成">', | ||
| 422行目: | 423行目: | ||
mc.innerHTML = msg.loading; | mc.innerHTML = msg.loading; | ||
func.getthreads().then((res) => { | func.getthreads().then((res) => { | ||
mc.innerHTML = res[0] + msg.toppage_css; | mc.innerHTML = msg.toppage_notice + res[0] + msg.toppage_css; | ||
// モバイル用の「スレッドを作成」ボタンを追加 | |||
const mobileBtn = document.createElement('div'); | |||
mobileBtn.id = 'f-create-btn-mobile'; | |||
mobileBtn.innerHTML = msg.create; | |||
mc.insertBefore(mobileBtn, mc.firstChild); | |||
mobileBtn.querySelector('input').onclick = function () { | |||
const url = new URL(window.location.href); | |||
url.searchParams.set('newthread', '1'); | |||
location.href = url; | |||
}; | |||
if (res[1]) { | if (res[1]) { | ||
document.querySelector('#mw-content-text').innerHTML += msg.load_more; | document.querySelector('#mw-content-text').innerHTML += msg.load_more; | ||