Skip to content

Instantly share code, notes, and snippets.

diff -r d1ddc3299a92 common/content/util.js
--- a/common/content/util.js Fri Mar 18 22:31:08 2011 +0900
+++ b/common/content/util.js Tue Mar 22 02:19:26 2011 +0900
@@ -762,10 +762,14 @@
// Handle as URL, but remove spaces. Useful for copied/'p'asted URLs.
return url.replace(/\s*\n+\s*/g, "");
+ let uri = util.createURI(url);
+ if (util.validateHost(uri))
+ return uri.spec;
@teramako
teramako / toolbar.2.patch
Created March 26, 2011 14:16
Vimperator のステータスラインにツールバーを導入するパッチ(caisuiさんのに+αしてCSSを追加したバージョン)
diff -r a9f2a2b7c47e common/content/commandline.js
--- a/common/content/commandline.js Fri Mar 25 23:04:39 2011 +0900
+++ b/common/content/commandline.js Sat Mar 26 23:14:58 2011 +0900
@@ -130,6 +130,7 @@
this._promptWidget = document.getElementById("liberator-commandline-prompt-text");
// the command bar which contains the current command
this._commandWidget = document.getElementById("liberator-commandline-command");
+ this._bottombarWidget = document.getElementById("liberator-bottombar");
this._messageBox = document.getElementById("liberator-message");
@teramako
teramako / semiAutoComplete.js
Created April 7, 2011 08:42
[Vimperator]semiAutoComplete (テキトウにコードを書いていたらタブを押して初めて自動補完が有効になるコードとなった
let (cl = commandline) {
cl._autocompleteTimer = new Timer(200, 500, function autocompleteTell(tabPressed) {
if (events.feedingKeys || !options["autocomplete"])
return;
if (!this._completions && this._commandWidget.value.length >= 2) {
this._completions = CommandLine.Completions(this._commandWidget.inputField);
this._completions.complete(false, false);
}
@teramako
teramako / run_trackpoint_serv.bat
Created May 10, 2011 01:31
ThinkPadのトラックポイントのサービスがたまに動いていない時があり、その場合の対応バッチスクリプト
@echo off
echo "search tp4serv..."
tasklist | find "tp4serv.exe" >nul
if ERRORLEVEL 1 goto run
echo "shutdown tp4serv..."
taskkill /im tp4serv.exe /f >nul
if ERRORLEVEL 1 goto end
@teramako
teramako / class-example.js
Created May 14, 2011 18:02
JavaScript でクラスもどきを作る
// ===================================
// Example
// ===================================
/**
* Point
* @class
* @augments Class
* @param {Number} x x-axis
* @param {Number} y y-axis
*/
@teramako
teramako / proxy_sample.js
Created May 16, 2011 09:00
どこかで見かけたProxyのサンプル
var $ = Proxy.ceate({
get: function (_, name) {
return function () {
var args = Array.prototype.slice.call(arguments);
var func = function (o) {
return o[name].apply(o, args);
};
return func;
};
}
@teramako
teramako / memory-reports.js
Created May 19, 2011 08:23
[Vimperator Plugin]about:memory のようなものを出力する
commands.addUserCommand(["memory[reports]"], "show memory reports",
show,
{},
true);
function getMemoryInfo () {
const MRM = Cc["@mozilla.org/memory-reporter-manager;1"].getService(Ci.nsIMemoryReporterManager);
var data = [],
reports = MRM.enumerateReporters();
while (reports.hasMoreElements()) {
@teramako
teramako / unicode.js
Created June 1, 2011 14:05
Unicode ⇔ UTF-8
const table = [
0xC0, // 192(11000000) 2 byte
0xe0, // 224(11100000) 3 byte
0xf0 // 240(11110000) 4 byte
];
/**
* Unicode文字をUTF-8バイト列に変換
* @param {String} str
@teramako
teramako / mkdir.sh
Created July 4, 2011 05:36
mkdirコマンドを少し便利に
# source 読み込むこと前提
# インラインやパイプ時に作成したディレクトリパスを出力する
# example
# 1.
# cd `mkdir foo`
# 2.
# tar -xzvf foo.tar.gz -C `mkdir foo`
# 3.
# mkdir foo bar hoge | xargs
@teramako
teramako / google-plus-imageuploader.js
Created July 16, 2011 04:55
[Vimperator-plugin]Google+ Poster
var GooglePlus = null,
PostData = null;
(function init() {
if (typeof plugins.googlePlus == "undefined") {
window.setTimeout(init, 500);
} else {
GooglePlus = plugins.googlePlus;