Last active
August 9, 2018 14:12
-
-
Save noromanba/c2f24e19ae24ac5b6a1e6f578ca98191 to your computer and use it in GitHub Desktop.
complement title on reader of publus.jp for UserScript
This file contains hidden or 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 Pubrasche | |
// @namespace https://noromanba.github.com | |
// @description complement title on reader of publus.jp for UserScript | |
// @include *://jumpbookstore.com/client_info/SHUEISHA/html/player/viewer.html* | |
// @grant none | |
// @noframes | |
// @run-at document-end | |
// @version 2018.8.8.1 | |
// @homepage https://gist.github.com/noromanba/c2f24e19ae24ac5b6a1e6f578ca98191 | |
// @downloadURL https://gist.github.com/noromanba/c2f24e19ae24ac5b6a1e6f578ca98191/raw/pubrasche.user.js | |
// @license MIT License https://nrm.mit-license.org/2018 | |
// @author noromanba https://noromanba.github.com | |
// @icon https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Maki-parking-garage-11.svg/1000px-Maki-parking-garage-11.svg.png | |
// ==/UserScript== | |
// Icon (CC0 by samanpwbb; Mapbox) | |
// https://commons.wikimedia.org/wiki/File%3AMaki-parking-garage-11.svg | |
// https://github.com/mapbox/maki/blob/master/icons/parking-garage-11.svg | |
// Devel | |
// https://gist.github.com/noromanba/c2f24e19ae24ac5b6a1e6f578ca98191 | |
// https://publus.jp/reader/ | |
(() => { | |
'use strict'; | |
const observer = new MutationObserver(records => { | |
records.forEach(record => { | |
const node = record.target; | |
if (!node.title) return; | |
document.title = `${node.title} - ${document.title}`; | |
observer.disconnect(); | |
}); | |
}); | |
observer.observe(document.body.querySelector([ | |
'#pagetitle', | |
]), { attributes: true, attributeFilter: ['title',], }); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment