generated at
tanacchi

this is tanacchi’s page



style.css
a#Templates.tool-btn:hover { text-decoration: none } a#Templates.tool-btn::before { position: absolute; left: calc(48px/3 - 1px); content: '\f067'; font: 21px/46px 'FontAwesome' } a#Templates.tool-btn img { opacity: 0 } code:style.css .line strong.level-1 { color: #e61e00; background: none; } .line strong.level-2 { color: #0052ec; background: none; } .line strong.level-3 { color: #000000; background: linear-gradient(transparent 90%, #0052ec 90%, #0052ec 100%); } .line strong.level-4 { color: #000000; background: linear-gradient(transparent 90%, #e61e00 90%, #e61e00 100%); } .line strong:not([class]) { color: #404040; background: linear-gradient(transparent 80%, palegreen 80%, palegreen 100%); } code: style.css .level-1 img { width: 16.7%; max-height: none; } .level-2 img { width: 33.3%; max-height: none; } .level-3 img { width: 50.0%; max-height: none; } .level-4 img { width: 66.7%; max-height: none; } .level-5 img { width: 83.3%; max-height: none; } .level-6 img { width: 100%; max-height: none; } /* Tweet button */ .line .deco-\& { display: inline-block; padding: 0.2em 0.4em; text-decoration: none; background: #55acee; color: #fff; border-radius: 4px; transition: .3s; -webkit-transform: scale(1); transform: scale(1); } line .deco-\&{ -webkit-transform: scale(1.1); transform: scale(1.1); } .line .deco-\& a{ text-decoration: none; color: #fff; }

script.js
addTemplateItemsToPageMenu() scrapbox.TimeStamp.addFormat('YYYY/MM/DD') function addTemplateItemsToPageMenu() { // テンプレートメニューの定義ここから ---------- 下の解説を見てね!! ---------- const __templates = [ { title: 'diary_template', template: 'https://scrapbox.io/api/code/tanacchi-diary/templates/diary_template.js' }, { title: 'weekly_template', template: 'https://scrapbox.io/api/code/tanacchi-diary/templates/weekly_template.js' }, ] // テンプレートメニューの定義ここまで ---------- const __templMenuTitle = 'Templates' scrapbox.PageMenu.addMenu({ title: __templMenuTitle, image: '/assets/img/logo.png', onClick: () => { } }) __templates.forEach((i) => { scrapbox.PageMenu(__templMenuTitle).addItem({ title: i.title, onClick: () => { __loadTemplate(i.template) }}) }) var __loadTemplate = function (templateUrl) { if (scrapbox.Page.lines && scrapbox.Page.lines.length == 1) { // タイトル行をクリックしたことにする const line = document.getElementById('L' + scrapbox.Page.lines[0].id) // const lastChar = $(line).find('span[class^="c-"]').last().get(0) const lastChar = $(line).find('span.char-index').last().get(0) __mimicClick(line.id, line.offsetWidth, lastChar.offsetTop + 10) // テンプレートを読み込む $('#text-input').load(templateUrl, function (response, status, xhr) { if (status == "success") { try { // 読み込んだテンプレートをテキストエリアにセットしまして const textarea = document.getElementById('text-input') textarea.value = /\.js$/.test(templateUrl) ? eval(response) : response // テキストエリアのinputイベントを出しまして const event = document.createEvent('Event') event.initEvent('input', true, true) textarea.dispatchEvent(event) // 選択状態を解除したいのでもう1回クリックしとく __mimicClick(line.id, line.offsetWidth, lastChar.offsetTop + 10) } catch (ex) { console.log("だめでした>< \n" + ex) } } else { console.log("だめでした>< \n" + status) } }) } } const __mimicClick = (targetId, left, top) => { const genEvent = type => { const event = document.createEvent("MouseEvents") event.initMouseEvent(type, true, true, window, 1, 0, 0, left, top, false, false, false, false, 0, null) return event } const elm = document.getElementById(targetId) elm.dispatchEvent(genEvent("mousedown")) elm.dispatchEvent(genEvent("mouseup")) elm.dispatchEvent(genEvent("click")) } } $('body').attr('data-daiiz-rel-bubble', 'off') $('body').attr('data-daiiz-text-bubble', 'on') $('body').attr('data-daiiz-icon-button', 'on') $('body').attr('data-daiiz-gyazo-text-bubble', 'daiiz') $('body').attr('data-daiiz-paste-url-title', 'ctrl')