nishio
This is a better My page to have due to Scrapbox specifications. https://gyazo.com/03051565f03a70a83b182fda5965e187
If you make a personal page like this, you can use Ctrl+i to get an icon.
By first pinning the page with the image on it, it becomes a Favicon and is easily recognizable in browser tabs, etc.
https://gyazo.com/c078c5aa55ddbddd85530c5136b163e8
----- including user scripts for personal customization under -----
code:style.css
code:script.js
import '/api/code/nishio/MyUserScript/script.js'
---
code:script.js
import "/api/code/nishio/pin-diary-X/min.js"
code:disabled_script.js.disabled
import "/api/code/nishio/recently unopened pages/script.js"
code:script.js.disabled
import '/api/code/nishio/add_watchlist/script.js'
code:script.js
import '/api/code/nishio/open_with_mem/script.js'
code:script.js
import '/api/code/nishio/open_with_quartz/script.js'
code:script.js.disabled
import '/api/code/nishio/open_with_porter/script.js'
code:script.js.disabled
import { mount } from "../ScrapBubble-min/app.js";
mount({
});
code:script.js.disabled
import('/api/code/nishio/Ctrl+Enter in Scrapbox to ask Keicho a question/script.js');
"format" menu for full-width half-width conversion, etc. (from /shiology) 1. replace all bullets with Tab at the beginning
2. remove full-width and half-width spaces in a sentence
Fix garbled characters (in this case, change de' to de')
Replace full-width alphanumeric characters with half-width alphanumeric characters.
Replace full-width parentheses with half-width parentheses
6. put a space before or after the parentheses
7. space before and after the code block notation
code:script.js.disabled
scrapbox.PopupMenu.addButton({
title: 'format',
onClick: text => text.split('\n').map(function(line) {
return line.replace(/^\s*/g, s => s.replace(/\s/g, '\t'))
// .replace(/ /g, '')
.replace(/a-n|a-v゙/g, s => String.fromCharCode(s.charCodeAt(0) + 1)) .replace(/A-Za-z0-9/g, s => String.fromCharCode(s.charCodeAt(0) - 0xFEE0)) .replace('(', '(')
.replace(')', ')')
.replace(/\S\(/g, s => s.charAt(0) + ()
.replace(/\)\S/g, s => ') ' + s.charAt(1))
.replace(/\S.*/g, s => s.charAt(0) + ' ' + s.slice(1))
.replace(/.*\S/g, s => s.slice(0, -1) + ' ' + s.slice(-1))
}).join('\n')
})
code:script.js.disabled
var pagename = document.location.pathname.split("/").pop();
if(pagename == "cross_search"){
console.log(pagename);
var query = document.location.search.substr(1);
var page = document.getElementsByClassName("page")0; }
code:disabled_script.js.disabled
$('body').on('keydown',function(e){ // Enter key to create new page
if(e.target.tagName != "TEXTAREA" && e.target.tagName != "INPUT"){
if(e.key == 'Enter'){
var project = location.href.split('/')3; location.href = /${project}/new;
}
}
});
$('.btn.btn-default').on('click',function(){
var s = $('.form-control').val();
if(s == ''){
var project = location.href.split('/')3; location.href = /${project}/new;
}
});
time tagging.
Create a tag for year, a tag for day of month, and a tag for year and month. You can use "What did you do around what year?" or narrow it down to "Around what month of the year. The day-of-month tag is used for "This day in the past". code:script.js.disabled
scrapbox.PopupMenu.addButton({
title: "TimeTag",
onClick: (text) => {
var m = text.match(/((\d\d)?(\d\d))-?(\d\d)-?(\d\d)/);
return ${year}-${month}-${day} #${year} #${month}-${day} #${year}-${month};
}
})
2018-09-19 Date and time format to ←.
Moved To MyUserScript
code:script.js.disabled
scrapbox.TimeStamp.removeAllFormats()
scrapbox.TimeStamp.addFormat("YYYY-MM-DD")
2018-06-22
code:script.js.disabled
import '/api/code/nishio/excerpt-UserScript/script.js'
2018-06-12
reduce
code:script.js.disabled
var elm=document.createElement('span');
elm.append("ZoomOut")
elm.onclick = ()=>{
document.getElementsByClassName("page-list")0.setAttribute('style', 'zoom: 0.5') document.getElementsByTagName('body')0.webkitRequestFullscreen() }
document.getElementsByClassName("search-form")0.parentElement.append(elm) 2018-05-25
code:script.js.disabled
import '/api/code/nishio/Scrapbox lookback function/script.js'
voice input.
2018-04-15
code:script.js.disabled
import '/api/code/shokai/Voice Input Menu/script.js'
From Dr. Shiozawa's project
tweet menu.
code:script.js.disabled
scrapbox.PageMenu.addItem({
title: 'Tweet',
onClick: () => window.open(https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(document.title)})
})
Character Count Menu.
code:script.js.disabled
scrapbox.PageMenu.addItem({
title: () => {
if (!scrapbox.Page.lines) return
const chars = scrapbox.Page.lines.map(line => line.text.length).reduce((a,b) => a + b)
const words = scrapbox.Page.lines.map(line => line.text.split(/\s+/).length).reduce((a,b) => a + b)
return `${chars}characters ${words}words ${scrapbox.Page.lines.length}lines
},
onClick: () => null
})
character counter.
code:style.css_disabled
@import "/api/code/nishio/visible-characters-counter/style.css";
code:script.js_disabled
import "/api/code/nishio/visible-character-count-counter/script.js";
Search popup for selected string in project.
code:script.js.disabled
// Search for the selected string in the Scrapbox project
// Open the same results page as when using the Scapbox search box
scrapbox.PopupMenu.addButton({
title: 'Search in SB',.
onClick: function (text) {
var projectName = 'shio';
}
});
---
Cutting out a section of a page into a new page
code:disabled_script.js.diabled
scrapbox.PopupMenu.addButton({
title: 'NewPage',
onClick: text => {
const lines = text.split(/\r\n/g) .trim()
.replace(/\^\+.icon\]/gm, '')
const projectRoot = (() => {
const tmp = location.href.split('/')
tmp.pop()
return tmp.join('/')
})()
const currentPageTitle = decodeURIComponent(location.href.split(/\//g).pop())
lines.unshift(from [${currentPageTitle}])
const body = encodeURIComponent(lines.join('\n'))
window.open(${projectRoot}/${title}?body=${body})
return [${title}]
}
})
2021-05-06
code:script.js.disabled
const privateProject = "znishio"
scrapbox.PageMenu.addItem({
title: 'to🔒',
onClick: () => {
const title = document.location.pathname.split("/")2; window.open(https://scrapbox.io/${privateProject}/🔒${title}, "_blank")
}
})
scrapbox.PageMenu.addItem({
title: 'make🔒',
onClick: () => {
const title = document.location.pathname.split("/")2; const body = [https://scrapbox.io/nishio/${title} 🌏] [${title}]
window.open(https://scrapbox.io/${privateProject}/🔒${title}?body=${body}, "_blank")
}
})
code:style.css.disabled
a.mobile-search-toggle {
padding: 1em;
}
.toggle-button.closed {
padding-right: 1em;
}
.toggle-button.open {
padding-right: 1em;
}
---
This page is auto-translated from /nishio/nishio using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.