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(){ | |
// ある関数について、最初に呼び出されたときと2回目以降で処理を分ける方法 | |
// 自分自身を書き換える関数 | |
// 初期化コストが低いが、見た目がイマイチ | |
// 関数宣言でなくても良いが、関数宣言なら定義する場所を気にしなくて良くなる | |
function A(){ | |
A = _A; | |
/*一回目の処理*/ | |
// _A.apply(this,arguments);//2回目の処理を呼ぶこともOK |
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
var noun_typed_text = { | |
name: 'typed text', | |
suggest: function suggestTyped(txt, htm, cb, si){ | |
return !si && {text: txt, summary: htm, score: .4} | |
}, | |
} | |
var replace = CmdUtils.CreateCommand({ | |
name: 'replace', | |
icon: 'chrome://ubiquity/skin/icons/page_refresh.png', |
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
CmdUtils.CreateCommand({ | |
names: ["666"], | |
domain: "seret.co.il", | |
arguments: [ | |
{role: "object", label: 'what', nountype: noun_arb_text} | |
], | |
description: "seret.co.il חפש סרט באתר", | |
icon: "http://www.seret.co.il/favicon.ico", | |
homepage: "http://sites.google.com/site/ubiquityisrael", | |
author: { name: "Asaf David", email: "[email protected]"}, |
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
// ==UserScript== | |
// @name Opera Style Link Drag | |
// @author Griever satyr | |
// @include main | |
// @include chrome://global/content/viewSource.xul | |
// @include chrome://global/content/viewPartialSource.xul | |
// @version 0.0.1.20100421 | |
// ==/UserScript== | |
Array.forEach(document.querySelectorAll('tabbrowser, browser'), function(b){ | |
b.addEventListener('mousedown', this, true); |
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
<script> | |
function run(fn, arg){ | |
var start = new Date; | |
for(var i = 1e4; i--;) fn(arg); | |
return new Date - start; | |
} | |
var tests = [function(src){ | |
return src.slice(0, src.lastIndexOf("/") + 1); | |
}, function(src){ | |
var a = src.split("/"); |
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
var gQuery; | |
CmdUtils.makeSearchCommand({ | |
name: "Directory", | |
url: "http://www10.go.com.mt/edirnew_dev/modules/edir_checkquery.asp", | |
arguments: {suggest: function (txt) { | |
gQuery = txt; | |
return noun_arb_text.suggest(txt); | |
}}, | |
get postData() { | |
if(!gQuery) return null; |
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
CmdUtils.CreateCommand({ | |
names: ['open links', 'linkopen'], | |
description: 'Opens links from among the current page.', | |
icon: 'chrome://ubiquity/skin/icons/tab_go.png', | |
arguments: [{role: 'object', nountype: noun_arb_text}], | |
preview: function preview(pblock, {object: {text}}) { | |
var me = this, links = me._links(text); | |
if(!links.length) return void this.previewDefault(pblock); | |
CmdUtils.previewList( |
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 casecmd(fn) CmdUtils.CreateCommand({ | |
name: fn.name +' case', | |
description: 'Makes text '+ fn.name +' case.', | |
icon: icon(fn('Aa')), | |
argument: noun_arb_text, | |
execute: function case_execute({object: {text, html}}){ | |
if(!text) return; | |
var t = fn(text); | |
CmdUtils.setSelection(fn(html), {text: t}) || CmdUtils.copyToClipboard(t); | |
}, |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8"/> | |
<!-- Online here: http://ejohn.org/files/bugs/isObjectLiteral/ --> | |
<title>isObjectLiteral</title> | |
<style> | |
li { background: green; } li.FAIL { background: red; } | |
iframe { display: none; } | |
</style> |