// ==UserScript== // @name 5ch 画像&動画etc // @namespace http://tampermonkey.net/ // @version 0.2.0 // @description 惰性で作りました。嫌な部分は改変して使って下さい。時々改修するかも。 // @author 匿名Cat // @match https://*.5ch.net/test/read.cgi/*/* // @match http://*.5ch.net/test/read.cgi/*/* // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js // @require https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js // @resource bootstrap.min.css https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css // @icon https://www.google.com/s2/favicons?domain=5ch.net // @grant GM_download // @grant GM_addStyle // @grant GM_getResourceText // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; $.noConflict() const extract5chURL = hrefStr => hrefStr?.match(/(?:http:\/\/jump\.5ch\.net\/\?)(.+)/)?.[1] const optionalHttps = hrefStr => /^https?:\/\//.test(hrefStr) ? hrefStr : 'https://' + hrefStr // 設定開始================ const settings = { imgExts: ['jpg', 'png', 'webp', 'jpeg', 'gif', 'webp'], keys: { download: ['d'], removePreview: ['c', 'Escape']} } // 直接生成型画像 サイズ const size = '10rem' const forHost = { 0: { matcher: /https?:\/\/(?!hebi|leia).+\.5ch\.net\/test\/read.cgi\//, getSrc: extract5chURL, append: '.message', }, "hebi.5ch.net": { getSrc: href => href, append: 'dd' }, "leia.5ch.net": { getSrc: extract5chURL, append: 'dd' } } const userScriptId = "ch_im_and_video__" // 設定終了============== // bootstrap style読み込み GM_addStyle(GM_getResourceText("bootstrap.min.css")) const style = ` body { font-size: 1.5rem; } /* 画像 */ *[div="thumb5ch"] { display: inline-block; } .container.container_body { margin: unset 0; display: flex; position: relative; } .container.container_body>.contents { max-width: 60vw; } .preview-container { flex: 1; position: relative; } .preview-container:before { content: ""; display: block; padding-top: 75%; } .preview-container>img { position: sticky; top: 0; left: 0; bottom: 0; right: 0; width: 100%; max-height: 100vh; object-fit: contain; z-index: 3;} a.image { font-size: 0; } /* ナビゲーションバー */ #${userScriptId}nav { z-index: 3; position: fixed; width: 100%; padding: 0; margin: 0; top: 0; } #${userScriptId}extract_im { cursor: pointer; } .dropdown-menu { font-size: inherit; } /* 5ch公式のGUI */ .topmenu.centered, .bottommenu.centered { display: none; } .navbar-fixed-top.search-header .input-group { display: none; } .submitbtn.btn { font-size: inherit; } .rBtn { border: none; } ` // util const d = document const isImageUrl = url => new RegExp(`\\.${settings.imgExts.join('|')}$`, 'g').test(url) const utilUnion = arr => [...new Set(arr)] jQuery(d).ready($ => { const $body = $(d.body) $body.append($('