This file contains 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
.cm-s-sublime-text-like.CodeMirror { | |
background-color: #242424; | |
color: #fff; | |
} | |
.CodeMirror div.CodeMirror-cursor { | |
border-left: 1px solid #f8f8f0; | |
z-index: 3; | |
} |
This file contains 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
/** | |
* pure js simplified XMLHttpRequest function | |
* | |
* @param {Object} p | |
* { | |
* url: | |
* required. | |
* method: | |
* ('GET' | 'POST') | |
* default is "GET" |
This file contains 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
(function(){ | |
var SCROLL_WIDTH = 24; | |
var btn_popup = document.getElementById("btn_popup"); | |
var popup = document.getElementById("popup"); | |
var popup_bar = document.getElementById("popup_bar"); | |
var btn_close = document.getElementById("btn_close"); | |
var smoke = document.getElementById("smoke"); |
This file contains 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
const Sanitizer = { | |
encode: function(str) { | |
if (!str) return; | |
str = "" + str; | |
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '''); | |
}, | |
decode: function(str) { | |
if (!str) return; | |
str = "" + str; | |
return str.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, '\'').replace(/&/g, '&'); |
This file contains 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
// camelCase -> hyphenCase | |
function camelToHyphenCase: function(str) { | |
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); | |
} | |
// hyphenCase -> camelCase | |
function hyphenToCamelCase(str) { | |
return str.replace(/-([a-z])/g, function(g) { | |
return g[1].toUpperCase(); | |
}); | |
} |
This file contains 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
JapaneseUtil = function() { | |
const charMode = { | |
none: null, | |
ascii: "ascii", | |
alphaNumMark: "alphaNumMark", | |
surroundMark: "surroundMark", // "'{} etc. | |
alphaNum: "alphaNum", | |
alpha: "alpha", |
This file contains 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
// server/hoge.js | |
const re = /\[\[(.+?)\]\]/g; // matches '*[[hoge]]' or '* [[hoge]]' | |
const reRedirect = /^\#REDIRECT\s?\[\[(.+)\]\]/; // matches '#REDIRECT [[hoge]]' | |
const reRelatedHeader = /\=\=\s?関連項目\s?\=\=/; | |
function getEndpoint(title) { | |
title = encodeURIComponent(title); | |
return `https://ja.wikipedia.org/w/api.php?action=query&titles=${title}&prop=revisions&rvprop=content&format=json`; | |
} |
This file contains 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
// 配列の重複を削除 | |
var arr = ["", "", "hoge", "baa", "hogege", "", "foo", "", ""]; | |
var newArr = arr.filter((x, i, self) => self.indexOf(x) === i); | |
// newArr -> ["", "hoge", "baa", "hogege", "foo"] |
This file contains 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
Webworker | |
// worker.js | |
var ju; | |
addEventListener('message', function(e) { | |
if (e.data == "dummy") { | |
importScripts('./JapaneseUtil.js'); | |
console.log("this worker on message...", e); |
OlderNewer