javascript:document.write('<form name="f" action="https://kabutan.jp/search/" method="POST"><input type="hidden" name="input_string" value="%s"></form><script>f.submit();</script>');
↑は株探の場合
javascript:document.write('<form name="f" action="https://kabutan.jp/search/" method="POST"><input type="hidden" name="input_string" value="%s"></form><script>f.submit();</script>');
function setWordHighlight (word) {
var doc = document,
df = doc.createDocumentFragment(),
span = doc.createElement('span'),
texts = doc.evaluate('descendant::text()[normalize-space(.)]', doc.body, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
span.className = 'high-light';
span.appendChild(doc.createTextNode(word));
for (var i = 0, l = texts.snapshotLength, stringsLength, textNode; i < l; ++i) {
textNode = texts.snapshotItem(i);
strings = textNode.data.split(word);
stringsLength = strings.length;
if (stringsLength > 1) {
df.appendChild(doc.createTextNode(strings[0]));
for (var j = 1; j < stringsLength; ++j) {
df.appendChild(span.cloneNode(true));
df.appendChild(doc.createTextNode(strings[j]));
}
textNode.parentNode.replaceChild(df, textNode);
}
}
}
setWordHighlight('test');
.high-light { color: black; background-color: yellow; font-weight: bold; }
全要素を走査し順番に意味が無い場合、若干ですが高速化できます。
for (var i = 0; i < list.length; i++) {console.log(list[i]);}
毎回、.lengthを参照するのは無駄ですので予め変数に入れておきます。
for (var i = 0, len = list.length; i < len; i++) {console.log(list[i]); }
順番に意味がないのなら、最後から走査することでさらに簡略化できます。
var i = list.length - 1;for (; i >= 0; i--) {console.log(list[i]);}
array instanceof Array
では不十分なので
Array.isArray(obj)
を使用する
古いブラウザでは↓を追加しとく
if (!Array.isArray) {
Array.isArray = function (vArg) {
return Object.prototype.toString.call(vArg) === "[object Array]";
};
}
s = s.replace(/\/$/,'');
// ↑より高速
if ('/' === s.charAt(s.length - 1))
s.slice(0, -1);
// ES6から
if (s.endsWith('/'))
s.slice(0, -1);
同期後、「後で更新」を選択
PCにUSB接続して,.koboフォルダのKoboRoot.tgzを削除
まずは < たこ焼き > から天上碑のシステム辞書をダウンロードします. ダウンロードしたファイルを %USERPROFILE%\Application Data\Justsystem\ATOK\DIC フォルダに解凍します. 今回は 20090521_tenjohi_2002sys.dic というファイルが得られました. これを秀丸のバイナリーモード(または他のバイナリエディタ)で開きます. そして 00040 が「01」になっているのを「00」に編集して上書き保存します.
http://feed.designlinkdatabase.net/feed/outsite_102424.aspxnormalize-space()を使って余計なスペースを除去したほうが良いようです。
normalize-space(@class), " "), " aaa ")] normalize-spaceは前後のスペースを削除し、連続したスペースをひとつのスペースにしてくれます。
var num = "1234567890";
document.write( num.split(/(?=(?:\d{3})+$)/).join() + "\n");
document.write( num.split(/(?=(?:\d{3})*$)/).join(",") + "\n");
document.write( num.replace(/(\d)(?=(\d{3})+$)/g,'$1,') + "\n");
document.write( num.replace(/\B(?=(?:\d{3})+$)/g, ',') + "\n");
var d = chrome.app.getDetails();
console.dir(d); // 例: バージョンを取得
var version = chrome.app.getDetails().version;
function getManifest() { var manifestObject = false; var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { manifestObject = JSON.parse(xhr.responseText); } }; xhr.open("GET", chrome.extension.getURL('/manifest.json'), false); try { xhr.send(); } catch(e) { } return manifestObject; }
function setPref(prefName, value) {
if (typeof value === 'boolean') {
gBranch.setBoolPref(prefName, value);
} else if (typeof value === 'number') {
gBranch.setIntPref(prefName, value); // -2,147,483,648~2,147,483,647
} else if (typeof value === 'string') {
var ustr = Cc['@mozilla.org/supports-string;1'].createInstance(Ci.nsISupportsString);
ustr.data = value;
gBranch.setComplexValue(prefName, Ci.nsISupportsString, ustr);
// gBranch.setCharPref(prefName, value); // ASCII only 日本語はムリ
}
}
function getPref(prefName, defValue) {
var type = gBranch.getPrefType(prefName);
const nsIPrefBranch = Ci.nsIPrefBranch;
switch (type) {
case nsIPrefBranch.PREF_STRING:
default:
return gBranch.getComplexValue(prefName, Ci.nsISupportsString).data;
// return gBranch.getCharPref(prefName); // ASCII only
case nsIPrefBranch.PREF_INT:
return gBranch.getIntPref(prefName);
case nsIPrefBranch.PREF_BOOL:
return target.getBoolPref(prefName);
}
return defValue;
}
<a onclick="return noReferer(this);" href="http://www.teria.com/~koseki/memo/referrer/view.php">http://www.teria.com/~koseki/memo/referrer/view.php</a>
function noReferer(a) {
var w = window.open();
w.document.write('<meta http-equiv="refresh" content="0;url='+a.href+'">');
w.document.close();
return false;
}
https://developer.mozilla.org/ja/docs/XUL/Style/text-link使い方: <label class="text-link" value="Google" href="http://www.google.co.jp" />
/*******************************************************************************
関数名前 : WriteLHistory
処理機能 : cookieに書き込み
引数 : cookie名, 値
作成日 : 2011/4/1
*******************************************************************************/
function WriteLHistory(name, value) {
var dt = new Date(2037, 11, 31);
document.cookie = name + "=" + value + ";expires=" + dt.toGMTString() + ";path=/;";
}