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
//Doing something for every instance of a specific HTML element | |
//demo call: execOnTags("a",function(a){a.href=a.href.replace("http://","ftp://")}); | |
function xpathOnTags(tag, func, doc){ | |
var i, allNodes=[], thisNode; | |
doc = doc || content.document; | |
allNodes = doc.getElementsByTagName(tag); | |
for (i = 0; i < allNodes.length; i++){ | |
thisNode = allNodes[i]; | |
func(thisNode); |
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
const DocLogic = function(configObject){ | |
const KEY_PERSIST = configObject.KEY_PERSIST; //not used currently | |
const KEY_CSS = configObject.KEY_CSS; //about:config user pref, a string holding textbox style | |
const KEY_NOSAVE = configObject.KEY_NOSAVE; //about:config user pref, a boolean holding save prompt state | |
const ID_TEXTBOX = configObject.ID_TEXTBOX; //ID of the editor textbox | |
const ID_FNLABEL = configObject.ID_FNLABEL; //ID of the filname label | |
const XUL_OPTIONS = configObject.XUL_OPTIONS; //chrom URI of options window | |
const AUTOSAVE_FILE = configObject.AUTOSAVE_FILE; //path to file used for persistance of text |
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 makeStrList(seed){ | |
/* private variables */ | |
var sliceFn = Array.prototype.slice; | |
var seed = seed || ''; | |
/* prototype */ | |
//if(typeof String.prototype.trim==='undefined') | |
//if(! 'trim' in String.prototype.trim) |
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
//2013-02-26 05:02 am | |
//constructor | |
function Set(){ | |
var values = [].slice.call(arguments); | |
this.set = {}; | |
if(values.length>0){ | |
Set.prototype.add.apply(this, values); | |
} | |
} |
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
//2013-01-03 06:28 am | |
'-use strict'; | |
let FileIO = new function(){ | |
/******************** Private ********************/ | |
let Cc=Components.classes; | |
let Ci=Components.interfaces; | |
let prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService); | |
// Flags passed when opening a file |
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
/* 2013-03-03 03:41 am | |
GreaseMonkey: | |
in about:config set greasemonkey.fileIsGreaseable = true | |
// @require file:///D:/_VB%20Progs/_JavaScript/DOM%20Chained%20Mini%20Library/domch.js | |
var $ = make$(document); | |
Chrome Scope: | |
var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader); | |
loader.loadSubScript("file:///D:/_VB%20Progs/_JavaScript/DOM%20Chained%20Mini%20Library/domch.js"); |
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 iterator = { | |
array : [], | |
position: 0, | |
hasNext: function() { | |
return this.position < this.array.length; | |
}, | |
next: function() { | |
return this.array[this.position++]; | |
}, |