├── .gitattributes ├── .babelrc ├── .bowerrc ├── .yo-rc.json ├── app ├── images │ ├── hosii.png │ ├── icon-128.png │ ├── icon-16.png │ ├── icon-48.png │ ├── moriogai.png │ ├── moriogai_old.png │ └── 5000-trillion-yen.png ├── _locales │ ├── ja │ │ └── messages.json │ └── en │ │ └── messages.json ├── options.html ├── scripts.babel │ ├── chromereload.js │ ├── options.js │ └── contentscript.js └── manifest.json ├── README.md ├── .gitignore ├── bower.json ├── test ├── spec │ └── test.js └── index.html ├── .editorconfig ├── LICENSE.md ├── package.json └── gulpfile.babel.js /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"] 3 | } 4 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "app/bower_components" 3 | } 4 | -------------------------------------------------------------------------------- /.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-mocha": { 3 | "ui": "tdd", 4 | "rjs": false 5 | } 6 | } -------------------------------------------------------------------------------- /app/images/hosii.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nekowen/5000-trillion-yen-converter/HEAD/app/images/hosii.png -------------------------------------------------------------------------------- /app/images/icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nekowen/5000-trillion-yen-converter/HEAD/app/images/icon-128.png -------------------------------------------------------------------------------- /app/images/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nekowen/5000-trillion-yen-converter/HEAD/app/images/icon-16.png -------------------------------------------------------------------------------- /app/images/icon-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nekowen/5000-trillion-yen-converter/HEAD/app/images/icon-48.png -------------------------------------------------------------------------------- /app/images/moriogai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nekowen/5000-trillion-yen-converter/HEAD/app/images/moriogai.png -------------------------------------------------------------------------------- /app/images/moriogai_old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nekowen/5000-trillion-yen-converter/HEAD/app/images/moriogai_old.png -------------------------------------------------------------------------------- /app/images/5000-trillion-yen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nekowen/5000-trillion-yen-converter/HEAD/app/images/5000-trillion-yen.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 5000兆円欲しい! 2 | つ 5000兆円コンバーター 3 | 4 | # その前に 5 | 6 | `npm install && bower install` 7 | 8 | デバッグ時には 9 | 10 | `gulp watch` 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | temp 3 | .tmp 4 | dist 5 | .sass-cache 6 | app/bower_components 7 | test/bower_components 8 | package 9 | app/scripts 10 | 11 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "5000-trillion-yen", 3 | "private": true, 4 | "version": "0.0.0", 5 | "dependencies": { 6 | "jquery": "^3.2.1" 7 | }, 8 | "devDependencies": { 9 | "chai": "^4.0.0", 10 | "mocha": "^3.4.2" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /test/spec/test.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | describe('Give it some context', function () { 5 | describe('maybe a bit more context here', function () { 6 | it('should run here few assertions', function () { 7 | 8 | }); 9 | }); 10 | }); 11 | })(); 12 | -------------------------------------------------------------------------------- /app/_locales/ja/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "appName": { 3 | "message": "5000兆円コンバーター", 4 | "description": "The name of the application" 5 | }, 6 | "appDescription": { 7 | "message": "5000兆円を5000兆円に置き換えます。5000兆円な気分になれます。たぶん", 8 | "description": "The description of the application" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "appName": { 3 | "message": "5000 trillion yen Converter", 4 | "description": "The name of the application" 5 | }, 6 | "appDescription": { 7 | "message": "It is a plug-in that converts '5000 trillion yen' to 5000 trillion yen", 8 | "description": "The description of the application" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

変換する対象

10 | 5000兆円 11 | 欲しい! 12 | 森鴎外 13 | 14 |

15 | 変更後はページを更新してください 16 |

17 | 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | [*.json] 15 | indent_size = 2 16 | 17 | # We recommend you to keep these unchanged 18 | end_of_line = lf 19 | charset = utf-8 20 | trim_trailing_whitespace = true 21 | insert_final_newline = true 22 | 23 | [*.md] 24 | trim_trailing_whitespace = false 25 | -------------------------------------------------------------------------------- /app/scripts.babel/chromereload.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // Reload client for Chrome Apps & Extensions. 4 | // The reload client has a compatibility with livereload. 5 | // WARNING: only supports reload command. 6 | 7 | const LIVERELOAD_HOST = 'localhost:'; 8 | const LIVERELOAD_PORT = 35729; 9 | const connection = new WebSocket('ws://' + LIVERELOAD_HOST + LIVERELOAD_PORT + '/livereload'); 10 | 11 | connection.onerror = error => { 12 | console.log('reload connection got error:', error); 13 | }; 14 | 15 | connection.onmessage = e => { 16 | if (e.data) { 17 | const data = JSON.parse(e.data); 18 | if (data && data.command === 'reload') { 19 | chrome.runtime.reload(); 20 | } 21 | } 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mocha Spec Runner 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/scripts.babel/options.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | $(function(){ 4 | let defaults = { 5 | enable5000: true, 6 | enableMoriogai: true, 7 | enableHosii: true 8 | }; 9 | 10 | chrome.storage.local.get(defaults, (items) => { 11 | $('#5000trillion').prop('checked', items.enable5000); 12 | $('#morimori').prop('checked', items.enableMoriogai); 13 | $('#hosii').prop('checked', items.enableHosii); 14 | }); 15 | 16 | $('#5000trillion').change(function() { 17 | let checked = $(this).is(':checked'); 18 | let object = { 19 | enable5000: checked 20 | }; 21 | chrome.storage.local.set(object, function(){}); 22 | }); 23 | 24 | $('#morimori').change(function() { 25 | let checked = $(this).is(':checked'); 26 | let object = { 27 | enableMoriogai: checked 28 | }; 29 | chrome.storage.local.set(object, function(){}); 30 | }); 31 | 32 | $('#hosii').change(function() { 33 | let checked = $(this).is(':checked'); 34 | let object = { 35 | enableHosii: checked 36 | }; 37 | chrome.storage.local.set(object, function(){}); 38 | }); 39 | }); -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Owen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "__MSG_appName__", 3 | "version": "1.0.6", 4 | "manifest_version": 2, 5 | "description": "__MSG_appDescription__", 6 | "icons": { 7 | "16": "images/icon-16.png", 8 | "48": "images/icon-48.png", 9 | "128": "images/icon-128.png" 10 | }, 11 | "default_locale": "ja", 12 | "background": { 13 | "scripts": [ 14 | "scripts/chromereload.js" 15 | ] 16 | }, 17 | "options_ui": { 18 | "page": "options.html", 19 | "open_in_tab": false 20 | }, 21 | "permissions": [ 22 | "http://*/*", 23 | "https://*/*", 24 | "storage" 25 | ], 26 | "content_scripts": [ 27 | { 28 | "matches": [ 29 | "http://*/*", 30 | "https://*/*" 31 | ], 32 | "js": [ 33 | "bower_components/jquery/dist/jquery.slim.min.js", 34 | "scripts/contentscript.js", 35 | "scripts/options.js" 36 | ], 37 | "run_at": "document_end", 38 | "all_frames": false 39 | } 40 | ], 41 | "web_accessible_resources": [ 42 | "images/5000-trillion-yen.png", 43 | "images/moriogai.png", 44 | "images/moriogai_old.png", 45 | "images/hosii.png" 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "5000-trillion-yen", 3 | "private": true, 4 | "engines": { 5 | "node": ">=0.8.0" 6 | }, 7 | "devDependencies": { 8 | "babel-core": "^6.7.2", 9 | "babel-preset-es2015": "^6.6.0", 10 | "del": "^2.2.0", 11 | "gulp": "^3.9.1", 12 | "gulp-babel": "^6.1.2", 13 | "gulp-cache": "^0.4.3", 14 | "gulp-chrome-manifest": "0.0.13", 15 | "gulp-clean-css": "^2.0.3", 16 | "gulp-eslint": "^2.0.0", 17 | "gulp-if": "^2.0.0", 18 | "gulp-imagemin": "^2.4.0", 19 | "gulp-livereload": "^3.8.1", 20 | "gulp-load-plugins": "^1.2.0", 21 | "gulp-htmlmin": "^1.3.0", 22 | "gulp-size": "^2.1.0", 23 | "gulp-sourcemaps": "^1.6.0", 24 | "gulp-uglify": "^1.5.3", 25 | "gulp-useref": "^3.0.8", 26 | "gulp-zip": "^3.2.0", 27 | "main-bower-files": "^2.11.1", 28 | "run-sequence": "^1.1.5", 29 | "wiredep": "^4.0.0" 30 | }, 31 | "eslintConfig": { 32 | "env": { 33 | "node": true, 34 | "browser": true 35 | }, 36 | "globals": { 37 | "chrome": true 38 | }, 39 | "rules": { 40 | "eol-last": 0, 41 | "quotes": [ 42 | 2, 43 | "single" 44 | ] 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /gulpfile.babel.js: -------------------------------------------------------------------------------- 1 | // generated on 2017-05-29 using generator-chrome-extension 0.6.1 2 | import gulp from 'gulp'; 3 | import gulpLoadPlugins from 'gulp-load-plugins'; 4 | import del from 'del'; 5 | import runSequence from 'run-sequence'; 6 | import {stream as wiredep} from 'wiredep'; 7 | 8 | const $ = gulpLoadPlugins(); 9 | 10 | gulp.task('extras', () => { 11 | return gulp.src([ 12 | 'app/*.*', 13 | 'app/_locales/**', 14 | '!app/scripts.babel', 15 | '!app/*.json', 16 | '!app/*.html', 17 | ], { 18 | base: 'app', 19 | dot: true 20 | }).pipe(gulp.dest('dist')); 21 | }); 22 | 23 | function lint(files, options) { 24 | return () => { 25 | return gulp.src(files) 26 | .pipe($.eslint(options)) 27 | .pipe($.eslint.format()); 28 | }; 29 | } 30 | 31 | gulp.task('lint', lint('app/scripts.babel/**/*.js', { 32 | env: { 33 | es6: true 34 | } 35 | })); 36 | 37 | gulp.task('images', () => { 38 | return gulp.src('app/images/**/*') 39 | .pipe($.if($.if.isFile, $.cache($.imagemin({ 40 | progressive: true, 41 | interlaced: true, 42 | // don't remove IDs from SVGs, they are often used 43 | // as hooks for embedding and styling 44 | svgoPlugins: [{cleanupIDs: false}] 45 | })) 46 | .on('error', function (err) { 47 | console.log(err); 48 | this.end(); 49 | }))) 50 | .pipe(gulp.dest('dist/images')); 51 | }); 52 | 53 | gulp.task('html', () => { 54 | return gulp.src('app/*.html') 55 | .pipe($.useref({searchPath: ['.tmp', 'app', '.']})) 56 | .pipe($.sourcemaps.init()) 57 | .pipe($.if('*.js', $.uglify())) 58 | .pipe($.if('*.css', $.cleanCss({compatibility: '*'}))) 59 | .pipe($.sourcemaps.write()) 60 | .pipe($.if('*.html', $.htmlmin({removeComments: true, collapseWhitespace: true}))) 61 | .pipe(gulp.dest('dist')); 62 | }); 63 | 64 | gulp.task('chromeManifest', () => { 65 | return gulp.src('app/manifest.json') 66 | .pipe($.chromeManifest({ 67 | buildnumber: true, 68 | background: { 69 | target: 'scripts/background.js', 70 | exclude: [ 71 | 'scripts/chromereload.js' 72 | ] 73 | } 74 | })) 75 | .pipe($.if('*.css', $.cleanCss({compatibility: '*'}))) 76 | .pipe($.if('*.js', $.sourcemaps.init())) 77 | .pipe($.if('*.js', $.uglify())) 78 | .pipe($.if('*.js', $.sourcemaps.write('.'))) 79 | .pipe(gulp.dest('dist')); 80 | }); 81 | 82 | gulp.task('babel', () => { 83 | return gulp.src('app/scripts.babel/**/*.js') 84 | .pipe($.babel({ 85 | presets: ['es2015'] 86 | })) 87 | .pipe(gulp.dest('app/scripts')); 88 | }); 89 | 90 | gulp.task('clean', del.bind(null, ['.tmp', 'dist'])); 91 | 92 | gulp.task('watch', ['lint', 'babel'], () => { 93 | $.livereload.listen(); 94 | 95 | gulp.watch([ 96 | 'app/*.html', 97 | 'app/scripts/**/*.js', 98 | 'app/images/**/*', 99 | 'app/styles/**/*', 100 | 'app/_locales/**/*.json' 101 | ]).on('change', $.livereload.reload); 102 | 103 | gulp.watch('app/scripts.babel/**/*.js', ['lint', 'babel']); 104 | gulp.watch('bower.json', ['wiredep']); 105 | }); 106 | 107 | gulp.task('size', () => { 108 | return gulp.src('dist/**/*').pipe($.size({title: 'build', gzip: true})); 109 | }); 110 | 111 | gulp.task('wiredep', () => { 112 | gulp.src('app/*.html') 113 | .pipe(wiredep({ 114 | ignorePath: /^(\.\.\/)*\.\./ 115 | })) 116 | .pipe(gulp.dest('app')); 117 | }); 118 | 119 | gulp.task('package', function () { 120 | var manifest = require('./dist/manifest.json'); 121 | return gulp.src('dist/**') 122 | .pipe($.zip('5000-trillion-yen-' + manifest.version + '.zip')) 123 | .pipe(gulp.dest('package')); 124 | }); 125 | 126 | gulp.task('build', (cb) => { 127 | runSequence( 128 | 'lint', 'babel', 'chromeManifest', 129 | ['html', 'images', 'extras'], 130 | 'size', cb); 131 | }); 132 | 133 | gulp.task('default', ['clean'], cb => { 134 | runSequence('build', cb); 135 | }); 136 | -------------------------------------------------------------------------------- /app/scripts.babel/contentscript.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | (() => { 4 | class Core { 5 | constructor() { 6 | this.observer = new MutationObserver((records) => { 7 | if (records.length === 0) { 8 | return; 9 | } 10 | 11 | const addedNodes = records.reduce((prev, current) => { 12 | return prev.concat(Array.from(current.addedNodes)); 13 | }, []); 14 | 15 | if (addedNodes.length === 0) { 16 | return; 17 | } 18 | this.process($(addedNodes)); 19 | }); 20 | 21 | // 設定 22 | this.enable5000 = false; 23 | this.enableMoriogai = false; 24 | this.enableHosii = false; 25 | 26 | this._regex5000 = new RegExp('(5000|5000)兆円', 'g'); 27 | this._regexHosii = new RegExp('(ほ|欲)しい(!|!)', 'g'); 28 | this._regexMoriogai = new RegExp('森(鴎|鷗)外', 'g'); 29 | this._defaultFilterTags = ['div', 'p', 'b', 'a', 'span', 'em', 'strong']; 30 | this._defaultSelector = this._defaultFilterTags.join(','); 31 | } 32 | 33 | get regex5000() { 34 | return this._regex5000; 35 | } 36 | 37 | get regexHosii() { 38 | return this._regexHosii; 39 | } 40 | 41 | get regexMoriogai() { 42 | return this._regexMoriogai; 43 | } 44 | 45 | get defaultFilterTags() { 46 | return this._defaultFilterTags; 47 | } 48 | 49 | get defaultSelector() { 50 | return this._defaultSelector; 51 | } 52 | 53 | get defaultSettings() { 54 | return { 55 | enable5000: true, 56 | enableMoriogai: true, 57 | enableHosii: true 58 | } 59 | } 60 | 61 | loadSettings(defaults, callback = null) { 62 | chrome.storage.local.get(defaults, (items) => { 63 | this.enable5000 = items.enable5000; 64 | this.enableMoriogai = items.enableMoriogai; 65 | this.enableHosii = items.enableHosii; 66 | 67 | if (callback) { 68 | callback(); 69 | } 70 | }); 71 | 72 | chrome.storage.onChanged.addListener((changes, namespace) => { 73 | if (namespace === 'local') { 74 | if (changes.enable5000) { 75 | this.enable5000 = changes.enable5000.newValue; 76 | } 77 | if (changes.enableMoriogai) { 78 | this.enableMoriogai = changes.enableMoriogai.newValue; 79 | } 80 | if (changes.enableHosii) { 81 | this.enableHosii = changes.enableHosii.newValue; 82 | } 83 | } 84 | }); 85 | } 86 | 87 | ready() { 88 | let defaults = this.defaultSettings; 89 | this.loadSettings(defaults, () => { 90 | this.process(); 91 | }); 92 | } 93 | 94 | getImageTag(srcPath, style, alt = '5000兆円') { 95 | return $('', {src: srcPath, alt: alt}).css(style).prop('outerHTML'); 96 | } 97 | 98 | getStyle(height) { 99 | return { 100 | 'height': height, 101 | 'vertical-align': 'top', 102 | }; 103 | } 104 | 105 | get5000(height, alt) { 106 | let style = this.getStyle(height); 107 | let path = chrome.extension.getURL('images/5000-trillion-yen.png'); 108 | return this.getImageTag(path, style, alt); 109 | } 110 | 111 | getMoriogai(height, alt, oldCharacter = false) { 112 | let style = this.getStyle(height); 113 | let fileName = (oldCharacter ? 'moriogai_old.png' : 'moriogai.png'); 114 | let path = chrome.extension.getURL('images/' + fileName); 115 | return this.getImageTag(path, style, alt); 116 | } 117 | 118 | getHosii(height, alt) { 119 | let style = this.getStyle(height); 120 | let path = chrome.extension.getURL('images/hosii.png'); 121 | return this.getImageTag(path, style, alt); 122 | } 123 | 124 | observe() { 125 | let options = { 126 | characterData: true, 127 | childList: true, 128 | subtree: true 129 | }; 130 | this.observer.observe($('body').get(0), options); 131 | } 132 | 133 | disconnect() { 134 | this.observer.disconnect(); 135 | } 136 | 137 | isMatchText(text) { 138 | if (this.enable5000 && text.match(this.regex5000)) { 139 | return true; 140 | } 141 | if (this.enableMoriogai && text.match(this.regexMoriogai)) { 142 | return true; 143 | } 144 | if (this.enableHosii && text.match(this.regexHosii)) { 145 | return true; 146 | } 147 | return false; 148 | } 149 | 150 | replaceHTMLchars(text) { 151 | // https://qiita.com/saekis/items/c2b41cd8940923863791 152 | if(typeof text !== 'string') { 153 | return text; 154 | } 155 | 156 | return text.replace(/[&'`"<>]/g, function(match) { 157 | return { 158 | '&': '&', 159 | '\'': ''', 160 | '`': '`', 161 | '"': '"', 162 | '<': '<', 163 | '>': '>', 164 | }[match] 165 | }); 166 | } 167 | 168 | process(elements = null) { 169 | if (!this.enable5000 && !this.enableMoriogai && !this.enableHosii) { 170 | // disabled 171 | return; 172 | } 173 | 174 | // Disconnect Observer 175 | this.disconnect(); 176 | 177 | /** 178 | * 置き換え処理 179 | */ 180 | let self = this; 181 | 182 | // 置き換えする対象が指定されていない場合はデフォルトのセレクタを使用 183 | // 指定されている場合は要素に対してfind 184 | if (elements === null) { 185 | // Default 186 | elements = $(this.defaultSelector); 187 | } else { 188 | elements = elements.find(this.defaultSelector); 189 | } 190 | 191 | elements.contents().filter(function() { 192 | let text = $(this).text(); 193 | return this.nodeType === 3 && self.isMatchText(text); 194 | }).html(function() { 195 | let html = $(this); 196 | 197 | // 利用できそうなCSSの値を拾ってくる 198 | let heightkey = ['line-height', 'font-size'].find((element) => { 199 | const value = $(this).parent().css(element); 200 | return !Number.isNaN(parseInt(value)); 201 | }); 202 | let height = '22px'; // Default 203 | if (heightkey !== undefined) { 204 | height = $(this).parent().css(heightkey); 205 | } 206 | 207 | var replacedStr = self.replaceHTMLchars(html.text()); 208 | if (self.enable5000) { 209 | replacedStr = replacedStr.replace(self.regex5000, (match) => { 210 | return self.get5000(height, match); 211 | }); 212 | } 213 | 214 | if (self.enableMoriogai) { 215 | replacedStr = replacedStr.replace(self.regexMoriogai, (match) => { 216 | const isOldCharacter = (match === '森鷗外'); 217 | return self.getMoriogai(height, match, isOldCharacter); 218 | }); 219 | } 220 | 221 | if (self.enableHosii) { 222 | replacedStr = replacedStr.replace(self.regexHosii, (match) => { 223 | return self.getHosii(height, match); 224 | }); 225 | } 226 | 227 | return html.replaceWith(replacedStr); 228 | }); 229 | 230 | // Reconnect 231 | this.observe(); 232 | } 233 | } 234 | 235 | 236 | const core = new Core; 237 | core.ready(); 238 | })(); 239 | --------------------------------------------------------------------------------