generated at
UserScript:background-image-2
痛モードのテスト用ユーティリティ(その2 ワイドモード)
script.js
scrapbox.PageMenu.addItem({ title: 'background-image-2', onClick: (e) => { var style = document.getElementById('__itab__') if (style) { style.remove() e.currentTarget.innerText = 'background-image-2' return } const image = prompt("url") console.log(image) const regex = /(https?)(:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\.(jpg|jpeg|gif|png)/ const result = regex.test(image); if(result != true) { e.currentTarget.innerText = 'background-image-2' return } else { e.currentTarget.innerText ='✅background-image-2' } const css = 'body {' + ' background-image: url("' + image + '");' + ' background-repeat: repeat-y;' + ' background-attachment: scroll;' + ' background-position: center top ;' + ' background-size: 100% auto;' // 横幅を100%にして算出 + '}' + '.page {' + ' opacity:0.8;' + '}' + ' .page:hover {' + ' opacity:1;' + '}' //console.log(css) style = document.createElement('style') style.setAttribute('id', '__itab__') style.appendChild(document.createTextNode(css)) document.head.appendChild(style) } })

UserScript:background-image-1 -- いい名前を考えないと
UserScript