- 単に
vimp-plugin
という名のプロトコルを作るプラグイン $runtimePath
/chrome/ がルートとなる- 例: vimp-plugin://test.xul =>
$runtimePath
/chrome/test.xul
- 例: vimp-plugin://test.xul =>
- Chrome特権を有するため XUL ファイルを開くことが可能
- 他のプラグインと組み合わせてGUIの作成ができる
This file contains hidden or 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
/** | |
* @fileoverview Gyazo にキャプチャ画像をアップロードするライブラリ | |
* @author teramako teramako.at.gmail.com | |
* @license MPL 1.1 | |
* @requires Firefox, Chrome特権 | |
* @example | |
* // 表示画面のキャプチャを 3/4 スケールで撮る | |
* var win = gBrowser.mCurrentBrowser.contentWindow; | |
* var file = createCaptureFile(win, win.scrollX, win.scrollY, win.innerWidth, win.innerHeight, 0.75); | |
* uploadGyazo(file, function callback (url) { |
This file contains hidden or 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
@charset "UTF-8"; | |
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); | |
@-moz-document url(chrome://browser/content/browser.xul) { | |
#sidebar-header { -moz-box-ordinal-group: 100; } | |
} | |
@-moz-document url(chrome://pano/content/sidebar.xul) { | |
#panoSearchbar { -moz-box-ordinal-group: 100; } | |
tree { | |
border: 0 !important; |
This file contains hidden or 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
/* | |
* タブを削除せずに、セッションを残しつつコンテンツをアンロードさせるエコなプラグイン | |
* unload[tab] num | |
*/ | |
if (!("SS" in this)) { | |
XPCOMUtils.defineLazyServiceGetter(this, "SS", "@mozilla.org/browser/sessionstore;1", "nsISessionStore"); | |
} | |
function unloadTab (aTab) { |
This file contains hidden or 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
/* | |
* 事前にランタイムディレクトリ内に module ディレクトリを作成し workerとして使うファイルを置いておくこと | |
*/ | |
var resourceName = "vimp-module"; | |
var IO = services.get("io"); | |
var moduleDirs = io.getRuntimeDirectories("module"); | |
if (moduleDirs.length === 0) | |
throw new Error("module directory is not found"); |
This file contains hidden or 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 util = { | |
requestAnimationFrame: (function() { | |
if ("mozRequestAnimationFrame" in window) | |
return window.mozRequestAnimationFrame.bind(window); | |
else if ("webkitRequestAnimationFrame" in window) | |
return window.webkitRequestAnimationFrame.bind(window); | |
else { | |
return function (callback) { |
This file contains hidden or 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
# 例: tar -xzvf hoge.tar.gz -C `mkdir hoge` | |
mkdir () { | |
/usr/bin/mkdir "$@" | |
local RC=$? | |
if [ ! -t 1 -a $RC = 0 ] | |
then | |
for buf in "$@" | |
do |
This file contains hidden or 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
/* | |
@license MPL 1.1/GPL 2.0/LGPL 2.1 | |
*/ | |
const { classes: Cc, interfaces: Ci, utils: Cu } = Components; | |
const UUID = "{9362f799-ce76-4d7c-9335-396b1c7870a6}"; | |
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | |
XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); |
This file contains hidden or 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
commands.addUserCommand(["bookmarks", "bm"], "Bookmarks", | |
function (args) { | |
var folderId = PlacesUtils.bookmarksMenuFolderId; | |
if (args["-tag"]) | |
folderId = PlacesUtils.tagsFolderId; | |
else if (args["-toolbar"]) | |
folderId = PlacesUtils.toolbarFolderId; | |
var str = args.literalArg; |
This file contains hidden or 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
// 以下のコードをテキトウな RCファイル 等に書く | |
// RC ファイルに | |
// :cabbrev -javascript gitio userContenx.gitio() | |
userContext.gitio = function gitioShortener (aURL, aCode, aCallback) { | |
var xhr = new XMLHttpRequest, | |
form = new FormData; | |
xhr.open("POST", "http://git.io", !!aCallback); | |
if (aCallback) { | |
xhr.onreadystatechange = function () { |