Created
December 25, 2010 19:06
-
-
Save alexeyr/755003 to your computer and use it in GitHub Desktop.
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
/********************************************************************************* | |
* The contents of this file are subject to the Mozilla Public License Version 1.1 | |
* ("License"); you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at http://www.mozilla.org/MPL/. | |
* | |
* Software distributed under the License is distributed on an "AS IS" basis, | |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for | |
* the specific language governing rights and limitations under the License. | |
* | |
* The Initial Developer of the Original Code is Howie Wang. | |
* Contributor(s): Alexey Romanov. | |
* | |
* Alternatively, the contents of this file may be used under the terms | |
* of the GPL 2.0 license (http://www.gnu.org/licenses/gpl-2.0.html) or the | |
* LGPL 2.1 license (http://www.gnu.org/licenses/lgpl-2.1.html), in which case | |
* the provisions of this license are applicable instead of those above. | |
********************************************************************************/ | |
alert("Start loading"); | |
alert("Step 1"); | |
nextplease.strings = document.getElementById("nextplease.strings"); | |
alert("Step 2"); | |
nextplease.isAlpha = function (str) { | |
var isAlphaRegEx = /^[a-z ]$/i; | |
return isAlphaRegEx.test(str); | |
}; | |
nextplease.isMac = /Mac/i.test(window.navigator.platform); | |
nextplease.platformKeyStrings = document.getElementById("platformKeys"); | |
nextplease.keyStrings = document.getElementById("localeKeys"); | |
nextplease.platformKeys = { | |
shift: nextplease.platformKeyStrings.getString("VK_SHIFT"), | |
ctrl: nextplease.platformKeyStrings.getString("VK_CONTROL"), | |
alt: nextplease.platformKeyStrings.getString("VK_ALT"), | |
meta: nextplease.platformKeyStrings.getString("VK_META"), | |
sep: nextplease.platformKeyStrings.getString("MODIFIER_SEPARATOR") | |
}; | |
switch (nextplease.accelKeyPrefs.getIntPref("")) { | |
case KeyEvent.DOM_VK_ALT: nextplease.platformKeys.accel = nextplease.platformKeys.alt; break; | |
case KeyEvent.DOM_VK_CONTROL: nextplease.platformKeys.accel = nextplease.platformKeys.ctrl; break; | |
case KeyEvent.DOM_VK_META: nextplease.platformKeys.accel = nextplease.platformKeys.meta; break; | |
default: nextplease.platformKeys.accel = (nextplease.isMac ? nextplease.platformKeys.meta : nextplease.platformKeys.ctrl); | |
} | |
nextplease.createModifierPopup = function (menulist, includeShift) { | |
var addKey = function (modifierValue) { | |
var modifierLabel = | |
modifierValue.replace("alt", nextplease.platformKeys.alt). | |
replace("shift", nextplease.platformKeys.shift). | |
replace("accel", nextplease.platformKeys.accel). | |
replace(/ /g, nextplease.platformKeys.sep); | |
menulist.appendItem(modifierLabel, modifierValue); | |
}; | |
addKey("accel"); | |
addKey("alt"); | |
addKey("accel alt"); | |
if (includeShift) { | |
addKey("accel shift"); | |
addKey("alt shift"); | |
addKey("accel alt shift"); | |
} | |
}; | |
nextplease.createKeyMenu = function (menulist) { | |
var addKey = function (keyCodeString) { | |
var label = nextplease.keyStrings.getString(keyCodeString); | |
var keyCodeValue = KeyEvent["DOM_" + keyCodeString]; | |
menulist.appendItem(label, keyCodeValue); | |
}; | |
menulist.appendItem("", ""); | |
addKey("VK_LEFT"); | |
addKey("VK_RIGHT"); | |
addKey("VK_UP"); | |
addKey("VK_DOWN"); | |
addKey("VK_PAGE_UP"); | |
addKey("VK_PAGE_DOWN"); | |
addKey("VK_HOME"); | |
addKey("VK_END"); | |
addKey("VK_F1"); | |
addKey("VK_F2"); | |
addKey("VK_F3"); | |
addKey("VK_F4"); | |
addKey("VK_F5"); | |
addKey("VK_F6"); | |
addKey("VK_F7"); | |
addKey("VK_F8"); | |
addKey("VK_F9"); | |
addKey("VK_F10"); | |
addKey("VK_F11"); | |
addKey("VK_F12"); | |
addKey("VK_ENTER"); | |
addKey("VK_RETURN"); | |
addKey("VK_TAB"); | |
addKey("VK_BACK"); | |
addKey("VK_DELETE"); | |
addKey("VK_ESCAPE"); | |
addKey("VK_INSERT"); | |
}; | |
// Read the phrases that specify a next link | |
// by reading the preferences or defaults, | |
// populate the listbox with the phrases, | |
// and put the phrases in a lookup table. | |
nextplease.initListBox = function (listboxId, prefName, defaultValues) { | |
var listbox = document.getElementById(listboxId); | |
var phrase; | |
var i = 0; | |
var tempprefname = prefName + '.expr0'; | |
if (this.prefs.prefHasUserValue(tempprefname)) { | |
while (this.prefs.prefHasUserValue(tempprefname)) { | |
var prefValue = this.GetUnicharPref(tempprefname); | |
var values = prefValue.split("|"); | |
for (var j = 0; j < values.length; j++) { | |
phrase = values[j].replace(/&pipe;/g, "|"); | |
if (phrase !== "") { | |
listbox.appendItem(phrase, phrase); | |
// Scroll to the newly added item to workaround | |
// what I think is a Firefox bug. I was getting | |
// Javascript exceptions when trying to read the | |
// values at the bottom that are "hidden". | |
listbox.ensureIndexIsVisible(listbox.getRowCount() - 1); | |
} | |
} | |
i++; | |
tempprefname = prefName + '.expr' + i; | |
} | |
} else { | |
for (var k = 0; k < defaultValues.length; k++) { | |
phrase = defaultValues[k]; | |
listbox.appendItem(phrase, phrase); | |
// Scroll to item to workaround Firefox bug. | |
listbox.ensureIndexIsVisible(k); | |
} | |
} | |
listbox.ensureIndexIsVisible(0); | |
}; | |
nextplease.initModifierSelector = function (prefname, elemId, includeShift) { | |
// Read the key binding prefs and set the dialog items appropriately | |
var menuElem = document.getElementById(elemId); | |
nextplease.createModifierPopup(menuElem, includeShift); | |
var prefValue = nextplease.getModifierPref(prefname); | |
menuElem.value = prefValue; | |
}; | |
nextplease.initKeySelector = function (prefname, keyElemId, keyMenuId) { | |
var keyElem = document.getElementById(keyElemId); | |
var keyMenu = document.getElementById(keyMenuId); | |
nextplease.createKeyMenu(keyMenu); | |
var keyCode = nextplease.prefs.getIntPref(prefname); | |
if (nextplease.KeyCodeToNameMap[keyCode]) { | |
keyElem.value = ""; | |
keyMenu.value = keyCode; | |
} else { | |
keyMenu.value = ""; | |
keyElem.value = String.fromCharCode(keyCode); | |
} | |
}; | |
nextplease.initRegEx = function (prefname, elemId, defaultValue) { | |
var textbox = document.getElementById(elemId); | |
if (this.prefs.prefHasUserValue(prefname)) { | |
var prefValue = this.Trim(this.GetUnicharPref(prefname)); | |
if (prefValue !== "") { | |
textbox.value = prefValue; | |
} else { | |
textbox.value = defaultValue; | |
} | |
} else { | |
textbox.value = defaultValue; | |
} | |
}; | |
//Initialize options | |
nextplease.initializeOptions = function () { | |
this.log("initializating options."); | |
if (!this.prefs) { | |
this.log("nextplease.prefs undefined. This shouldn't happen!"); | |
this.prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("nextplease."); | |
} | |
this.keyBindingsChanged = false; | |
this.initListBox('nextfields', 'nextphrase', this.DefaultNextPhrases); | |
this.initListBox('prevfields', 'prevphrase', this.DefaultPrevPhrases); | |
this.initListBox('firstfields', 'firstphrase', this.DefaultFirstPhrases); | |
this.initListBox('lastfields', 'lastphrase', this.DefaultLastPhrases); | |
this.initListBox('nextimagefields', 'nextimage', this.DefaultNextImages); | |
this.initListBox('previmagefields', 'previmage', this.DefaultPrevImages); | |
this.initListBox('firstimagefields', 'firstimage', this.DefaultFirstImages); | |
this.initListBox('lastimagefields', 'lastimage', this.DefaultLastImages); | |
this.logDetail("listboxes initialized."); | |
this.initRegEx('nextregex', 'nextRegEx', this.DefaultNextRegEx); | |
this.initRegEx('prevregex', 'prevRegEx', this.DefaultPrevRegEx); | |
this.initRegEx('firstregex', 'firstRegEx', this.DefaultFirstRegEx); | |
this.initRegEx('lastregex', 'lastRegEx', this.DefaultLastRegEx); | |
this.initRegEx('galleryregex', 'galleryRegEx', this.DefaultGalleryRegEx); | |
this.logDetail("regexes initialized."); | |
document.getElementById("nextplease.log.normal").checked = this.prefs.getBoolPref('log'); | |
document.getElementById("nextplease.log.detailed").checked = this.prefs.getBoolPref('log.detailed'); | |
this.logDetail("options initialized."); | |
var prefwindow = document.getElementById("nextpleaseprefs"); | |
prefwindow.showPane(prefwindow.currentPane); | |
// prefwindow.sizeToContent(); | |
}; | |
alert("before lgp"); | |
nextplease.loadGeneralPreferences = function () { | |
var numberShortcutLabels = nextplease.strings.getString("enableNumberShortcuts").split("|"); | |
document.getElementById("nextpleaseAllowNumberShortcuts").label = numberShortcutLabels[0]; | |
document.getElementById("nextpleaseAllowNumberShortcuts1").value = nextplease.platformKeys.sep + numberShortcutLabels[1]; | |
nextplease.initModifierSelector('numbermodifier', 'nextpleaseNumberShortcutModifier', false); | |
nextplease.enableDisableNumberShortcutModifierMenu(); | |
nextplease.initModifierSelector('keymodifier', 'nextpleaseNextModifier', true); | |
nextplease.initModifierSelector('prevkeymodifier', 'nextpleasePrevModifier', true); | |
nextplease.initModifierSelector('firstkeymodifier', 'nextpleaseFirstModifier', true); | |
nextplease.initModifierSelector('lastkeymodifier', 'nextpleaseLastModifier', true); | |
nextplease.initKeySelector('nextkey', 'nextkey', 'nextkeymenu'); | |
nextplease.initKeySelector('prevkey', 'prevkey', 'prevkeymenu'); | |
nextplease.initKeySelector('firstkey', 'firstkey', 'firstkeymenu'); | |
nextplease.initKeySelector('lastkey', 'lastkey', 'lastkeymenu'); | |
}; | |
alert("after lgp " + nextplease.loadGeneralPreferences); | |
nextplease.syncModifierPref = function(modifierMenuElem) { | |
return modifierMenuElem.value; | |
}; | |
nextplease.saveKeyPref = function (prefname, keyElemId, keyMenuId) { | |
var keyString = nextplease.Trim(document.getElementById(keyElemId).value); | |
var keyCode; | |
if (keyString === "") { | |
keyCode = document.getElementById(keyMenuId).value; | |
} else { | |
// if (!this.isAlpha(keyString)) return; | |
keyCode = keyString.toUpperCase().charCodeAt(0); | |
} | |
nextplease.prefs.setIntPref(prefname, keyCode); | |
}; | |
// Save the listbox items specified by listboxId into | |
// the preference specified by prefs and prefbranchname | |
nextplease.saveListboxPrefs = function (listboxId, prefbranchname) { | |
var listbox = document.getElementById(listboxId); | |
var numRows = listbox.getRowCount(); | |
this.prefs.deleteBranch(prefbranchname + '.'); | |
var tempstr = ""; | |
for (var i = 0; i < numRows; i++) { | |
tempstr = tempstr + "|" + listbox.getItemAtIndex(i).value.replace(/\|/g, "&pipe;"); | |
} | |
this.SetUnicharPref(prefbranchname + '.expr0', tempstr); | |
}; | |
// Write out the preferences from the dialog. | |
nextplease.saveOptions = function () { | |
this.log("saving options."); | |
this.prefs.setCharPref('keymodifier', document.getElementById('nextpleaseNextModifier').value); | |
this.prefs.setCharPref('prevkeymodifier', document.getElementById('nextpleasePrevModifier').value); | |
this.prefs.setCharPref('firstkeymodifier', document.getElementById('nextpleaseFirstModifier').value); | |
this.prefs.setCharPref('lastkeymodifier', document.getElementById('nextpleaseLastModifier').value); | |
this.prefs.setCharPref('numbermodifier', document.getElementById('nextpleaseNumberShortcutModifier').value); | |
this.saveKeyPref('nextkey', 'nextkey', 'nextkeymenu'); | |
this.saveKeyPref('prevkey', 'prevkey', 'prevkeymenu'); | |
this.saveKeyPref('lastkey', 'lastkey', 'lastkeymenu'); | |
this.saveKeyPref('firstkey', 'firstkey', 'firstkeymenu'); | |
this.logDetail("keys saved."); | |
this.saveListboxPrefs('nextfields', 'nextphrase'); | |
this.saveListboxPrefs('prevfields', 'prevphrase'); | |
this.saveListboxPrefs('firstfields', 'firstphrase'); | |
this.saveListboxPrefs('lastfields', 'lastphrase'); | |
this.saveListboxPrefs('nextimagefields', 'nextimage'); | |
this.saveListboxPrefs('previmagefields', 'previmage'); | |
this.saveListboxPrefs('firstimagefields', 'firstimage'); | |
this.saveListboxPrefs('lastimagefields', 'lastimage'); | |
this.logDetail("phrases and images saved."); | |
this.prefs.setBoolPref('allowsubmit', document.getElementById("nextpleaseAllowSubmit").checked); | |
this.prefs.setBoolPref('allownumbershortcuts', document.getElementById("nextpleaseAllowNumberShortcuts").checked); | |
this.prefs.setBoolPref('allowcontextmenu', document.getElementById("nextpleaseAllowContextMenu").checked); | |
this.prefs.setBoolPref('allowsmartnext', document.getElementById("nextpleaseAllowSmartNext").checked); | |
this.prefs.setBoolPref('log', document.getElementById("nextplease.log.normal").checked); | |
this.prefs.setBoolPref('log.detailed', document.getElementById("nextplease.log.detailed").checked); | |
this.logDetail("checkboxes saved."); | |
this.SetUnicharPref('nextregex', document.getElementById('nextRegEx').value); | |
this.SetUnicharPref('prevregex', document.getElementById('prevRegEx').value); | |
this.SetUnicharPref('firstregex', document.getElementById('firstRegEx').value); | |
this.SetUnicharPref('lastregex', document.getElementById('lastRegEx').value); | |
this.SetUnicharPref('galleryregex', document.getElementById('galleryRegEx').value); | |
this.logDetail("regexes saved."); | |
if (this.keyBindingsChanged) { | |
alert(nextplease.strings.getString("keyBindingChanged")); | |
} | |
this.logDetail("options saved."); | |
}; | |
nextplease.onModifierMenuChange = function (keyElemId, menuKeyId, keyModifierId) { | |
var keyElem = document.getElementById(keyElemId); | |
var keyMenu = document.getElementById(menuKeyId); | |
var keyModifierElem = document.getElementById(keyModifierId); | |
var nextElem = document.getElementById('nextkey'); | |
var prevElem = document.getElementById('prevkey'); | |
var firstElem = document.getElementById('firstkey'); | |
var lastElem = document.getElementById('lastkey'); | |
var nextMenuElem = document.getElementById('nextkeymenu'); | |
var prevMenuElem = document.getElementById('prevkeymenu'); | |
var firstMenuElem = document.getElementById('firstkeymenu'); | |
var lastMenuElem = document.getElementById('lastkeymenu'); | |
var nextModifierElem = document.getElementById('nextpleaseNextModifier'); | |
var prevModifierElem = document.getElementById('nextpleasePrevModifier'); | |
var firstModifierElem = document.getElementById('nextpleaseFirstModifier'); | |
var lastModifierElem = document.getElementById('nextpleaseLastModifier'); | |
if ((keyModifierElem !== nextModifierElem) && (keyModifierElem.value === nextModifierElem.value) && | |
(keyElem.value.toUpperCase() === nextElem.value.toUpperCase()) && (keyMenu.value === nextMenuElem.value)) { | |
keyElem.value = ""; | |
keyMenu.value = ""; | |
} | |
if ((keyModifierElem !== prevModifierElem) && (keyModifierElem.value === prevModifierElem.value) && | |
(keyElem.value.toUpperCase() === prevElem.value.toUpperCase()) && (keyMenu.value === prevMenuElem.value)) { | |
keyElem.value = ""; | |
keyMenu.value = ""; | |
} | |
if ((keyModifierElem !== firstModifierElem) && (keyModifierElem.value === firstModifierElem.value) && | |
(keyElem.value.toUpperCase() === firstElem.value.toUpperCase()) && (keyMenu.value === firstMenuElem.value)) { | |
keyElem.value = ""; | |
keyMenu.value = ""; | |
} | |
if ((keyModifierElem !== lastModifierElem) && (keyModifierElem.value === lastModifierElem.value) && | |
(keyElem.value.toUpperCase() === lastElem.value.toUpperCase()) && (keyMenu.value === lastMenuElem.value)) { | |
keyElem.value = ""; | |
keyMenu.value = ""; | |
} | |
this.keyBindingsChanged = true; | |
return true; | |
}; | |
nextplease.onKeyMenuChange = function (keyElemId, menuKeyId, keyModifierId) { | |
// Ensure that key and keymenu do not both | |
// have an entry | |
var keyElem = document.getElementById(keyElemId); | |
var keyMenu = document.getElementById(menuKeyId); | |
var keyModifierElem = document.getElementById(keyModifierId); | |
if (keyMenu.value !== "") { | |
keyElem.value = ""; | |
} | |
var nextMenuElem = document.getElementById('nextkeymenu'); | |
var prevMenuElem = document.getElementById('prevkeymenu'); | |
var firstMenuElem = document.getElementById('firstkeymenu'); | |
var lastMenuElem = document.getElementById('lastkeymenu'); | |
var nextModifierElem = document.getElementById('nextpleaseNextModifier'); | |
var prevModifierElem = document.getElementById('nextpleasePrevModifier'); | |
var firstModifierElem = document.getElementById('nextpleaseFirstModifier'); | |
var lastModifierElem = document.getElementById('nextpleaseLastModifier'); | |
if ((keyMenu !== nextMenuElem) && (keyMenu.value === nextMenuElem.value) && (keyModifierElem.value === nextModifierElem.value)) { | |
nextMenuElem.value = ""; | |
} | |
if ((keyMenu !== prevMenuElem) && (keyMenu.value === prevMenuElem.value) && (keyModifierElem.value === prevModifierElem.value)) { | |
prevMenuElem.value = ""; | |
} | |
if ((keyMenu !== firstMenuElem) && (keyMenu.value === firstMenuElem.value) && (keyModifierElem.value === firstModifierElem.value)) { | |
firstMenuElem.value = ""; | |
} | |
if ((keyMenu !== lastMenuElem) && (keyMenu.value === lastMenuElem.value) && (keyModifierElem.value === lastModifierElem.value)) { | |
lastMenuElem.value = ""; | |
} | |
this.keyBindingsChanged = true; | |
return true; | |
}; | |
nextplease.onKeyChange = function (keyElemId, menuKeyId, keyModifierId) { | |
var keyElem = document.getElementById(keyElemId); | |
var keyModifierElem = document.getElementById(keyModifierId); | |
// Ensure that key and keymenu do not both | |
// have an entry | |
if (keyElem.value !== "") { | |
document.getElementById(menuKeyId).value = ""; | |
} | |
var nextElem = document.getElementById('nextkey'); | |
var prevElem = document.getElementById('prevkey'); | |
var firstElem = document.getElementById('firstkey'); | |
var lastElem = document.getElementById('lastkey'); | |
var nextModifierElem = document.getElementById('nextpleaseNextModifier'); | |
var prevModifierElem = document.getElementById('nextpleasePrevModifier'); | |
var firstModifierElem = document.getElementById('nextpleaseFirstModifier'); | |
var lastModifierElem = document.getElementById('nextpleaseLastModifier'); | |
if ((keyElem !== nextElem) && (nextElem.value.toUpperCase() === keyElem.value.toUpperCase()) && (keyModifierElem.value === nextModifierElem.value)) { | |
nextElem.value = ""; | |
} | |
if ((keyElem !== prevElem) && (prevElem.value.toUpperCase() === keyElem.value.toUpperCase()) && (keyModifierElem.value === prevModifierElem.value)) { | |
prevElem.value = ""; | |
} | |
if ((keyElem !== firstElem) && (firstElem.value.toUpperCase() === keyElem.value.toUpperCase()) && (keyModifierElem.value === firstModifierElem.value)) { | |
firstElem.value = ""; | |
} | |
if ((keyElem !== lastElem) && (lastElem.value.toUpperCase() === keyElem.value.toUpperCase()) && (keyModifierElem.value === lastModifierElem.value)) { | |
lastElem.value = ""; | |
} | |
this.keyBindingsChanged = true; | |
return true; | |
}; | |
nextplease.selectedPanelChanged = function (listbox) { | |
var deck = listbox.parentNode.lastChild.firstChild; | |
deck.selectedIndex = listbox.selectedIndex; | |
nextplease.enableDisableRemoveButton(deck.selectedPanel); | |
}; | |
nextplease.enableDisableRemoveButton = function (listbox) { | |
var removeButton = listbox.parentNode.parentNode.lastChild.lastChild; | |
removeButton.disabled = (listbox.selectedCount === 0); | |
}; | |
// Add the an item from the field to the listbox specified by listboxId | |
nextplease.addToListbox = function (newElemFieldId, listboxId) { | |
var newElemString = this.Trim(document.getElementById(newElemFieldId).value); | |
if (newElemString === "") { | |
alert(nextplease.strings.getString("noWhitespacePhrases")); | |
} else { | |
var listbox = document.getElementById(listboxId); | |
var numberOfRows = listbox.getRowCount(); | |
for (var i = 0; i < numberOfRows; i++) { | |
if (listbox.getItemAtIndex(i).label === newElemString) { | |
alert(nextplease.strings.getFormattedString("addingExistingPhrase", [newElemString])); | |
return; | |
} | |
} | |
listbox.appendItem(newElemString, newElemString); | |
listbox.ensureIndexIsVisible(listbox.getRowCount() - 1); | |
} | |
}; | |
// Add the an item from the field to the listbox specified by listboxId | |
nextplease.addToListbox = function (node) { | |
var textbox = node.parentNode.firstChild; | |
var listbox = node.parentNode.parentNode.firstChild.selectedPanel; | |
var newElemString = nextplease.Trim(textbox.value); | |
if (newElemString === "") { | |
alert(nextplease.strings.getString("noWhitespacePhrases")); | |
} else { | |
var numberOfRows = listbox.getRowCount(); | |
for (var i = 0; i < numberOfRows; i++) { | |
if (listbox.getItemAtIndex(i).label === newElemString) { | |
alert(nextplease.strings.getFormattedString("addingExistingPhrase", [newElemString])); | |
return; | |
} | |
} | |
listbox.appendItem(newElemString, newElemString); | |
listbox.ensureIndexIsVisible(listbox.getRowCount() - 1); | |
} | |
}; | |
nextplease.addOnReturn = function (evt, node) { | |
if ((evt.keyCode === evt.DOM_VK_RETURN) || (evt.keyCode === evt.DOM_VK_ENTER)) { | |
nextplease.addToListbox(node); | |
evt.preventDefault(); | |
return false; | |
} | |
}; | |
nextplease.removeSelectedFromListbox = function (node) { | |
var listbox = node.parentNode.parentNode.firstChild.selectedPanel; | |
var selected = listbox.selectedItems; | |
var selectedCount = selected.length; | |
for (var j = selectedCount - 1; j >= 0; j--) { | |
listbox.removeChild(selected[j]); | |
} | |
}; | |
nextplease.removeSelectedOnDelete = function (evt, node) { | |
if (evt.keyCode === evt.DOM_VK_DELETE) { | |
nextplease.removeSelectedFromListbox(node); | |
evt.preventDefault(); | |
return false; | |
} | |
}; | |
nextplease.restoreDefault = function (elementId, defaultString) { | |
document.getElementById(elementId).value = defaultString; | |
}; | |
nextplease.enableDisableNumberShortcutModifierMenu = function () { | |
document.getElementById("nextpleaseNumberShortcutModifier").disabled = !document.getElementById("nextpleaseAllowNumberShortcuts").checked; | |
}; |
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
<?xml version="1.0"?> | |
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> | |
<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?> | |
<!DOCTYPE window SYSTEM "chrome://nextplease/locale/nextplease.dtd"> | |
<prefwindow id="nextpleaseprefs" title="&options.title;" buttons="accept, cancel" | |
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | |
<prefpane id="nextplease.general" label="&options.general.title;" image="chrome://nextplease/skin/Sound Mixer.png" | |
onpaneload="alert('pane load'); nextplease.loadGeneralPreferences();"> | |
<preferences> | |
<preference id="allowsubmit" name="nextplease.allowsubmit" type="bool"/> | |
<preference id="allownumbershortcuts" name="nextplease.allownumbershortcuts" type="bool"/> | |
<preference id="allowcontextmenu" name="nextplease.allowcontextmenu" type="bool"/> | |
<preference id="allowsmartnext" name="nextplease.allowsmartnext" type="bool"/> | |
<preference id="numbermodifier" name="nextplease.numbermodifier" type="string"/> | |
<preference id="keymodifier" name="nextplease.keymodifier" type="string"/> | |
<preference id="prevkeymodifier" name="nextplease.prevkeymodifier" type="string"/> | |
<preference id="firstkeymodifier" name="nextplease.firstkeymodifier" type="string"/> | |
<preference id="lastkeymodifier" name="nextplease.lastkeymodifier" type="string"/> | |
<preference id="nextkey" name="nextplease.nextkey" type="int"/> | |
<preference id="prevkey" name="nextplease.prevkey" type="int"/> | |
<preference id="firstkey" name="nextplease.firstkey" type="int"/> | |
<preference id="lastkey" name="nextplease.lastkey" type="int"/> | |
</preferences> | |
<vbox flex="1"> | |
<hbox flex="1"> | |
<vbox flex="1"> | |
<groupbox flex="1"> | |
<caption label="&options.general.title;" /> | |
<vbox flex="1"> | |
<checkbox id="nextpleaseAllowSubmit" label="&options.general.submitButtons;" | |
preference="allowsubmit"/> | |
<checkbox id="nextpleaseAllowContextMenu" label="&options.general.contextMenu;" | |
preference="allowcontextmenu"/> | |
<checkbox id="nextpleaseAllowSmartNext" label="&options.general.smartNext;" | |
preference="allowsmartnext"/> | |
</vbox> | |
</groupbox> | |
<groupbox flex="1"> | |
<caption label="&options.general.keyBindings;" /> | |
<vbox flex="1"> | |
<hbox flex="1" align="center"> | |
<checkbox id="nextpleaseAllowNumberShortcuts" oncommand="nextplease.enableDisableNumberShortcutModifierMenu();" | |
preference="allownumbershortcuts"/> | |
<menulist id="nextpleaseNumberShortcutModifier" preference-editable="true" preference="numbermodifier" onsynctopreference="return nextplease.syncModifierPref(this);" style="margin-right: 0"> | |
<menupopup onpopuphiding="nextplease.keyBindingsChanged = true;"/> | |
</menulist> | |
<label id="nextpleaseAllowNumberShortcuts1"/> | |
</hbox> | |
<separator class="thin"/> | |
<grid> | |
<columns> | |
<column/> | |
<column/> | |
<column/> | |
<column/> | |
<column/> | |
<column/> | |
</columns> | |
<rows> | |
<row align="center"> | |
<label value="&options.general.nextKey;" /> | |
<menulist id="nextpleaseNextModifier" preference-editable="true" preference="keymodifier" onsynctopreference="return nextplease.syncModifierPref(this);" > | |
<menupopup onpopuphiding="nextplease.onModifierMenuChange('nextkey', 'nextkeymenu', 'nextpleaseNextModifier');"/> | |
</menulist> | |
<label value="&options.general.enterKey;" /> | |
<textbox id="nextkey" type="text" size="1" maxlength="1" | |
onchange="return nextplease.onKeyChange('nextkey', 'nextkeymenu', 'nextpleaseNextModifier');" /> | |
<label value="&options.general.or;" /> | |
<menulist id="nextkeymenu"> | |
<menupopup onpopuphiding="return nextplease.onKeyMenuChange('nextkey', 'nextkeymenu', 'nextpleaseNextModifier');"/> | |
</menulist> | |
</row> | |
<row align="center"> | |
<label value="&options.general.prevKey;" /> | |
<menulist id="nextpleasePrevModifier" preference-editable="true" preference="prevkeymodifier" onsynctopreference="return nextplease.syncModifierPref(this);" > | |
<menupopup onpopuphiding="nextplease.onModifierMenuChange('prevkey', 'prevkeymenu', 'nextpleasePrevModifier');"/> | |
</menulist> | |
<label value="&options.general.enterKey;" /> | |
<textbox id="prevkey" type="text" size="1" maxlength="1" | |
onchange="return nextplease.onKeyChange('prevkey', 'prevkeymenu', 'nextpleasePrevModifier');" /> | |
<label value="&options.general.or;" /> | |
<menulist id="prevkeymenu"> | |
<menupopup onpopuphiding="return nextplease.onKeyMenuChange('prevkey', 'prevkeymenu', 'nextpleasePrevModifier');"/> | |
</menulist> | |
</row> | |
<row align="center"> | |
<label value="&options.general.firstKey;" /> | |
<menulist id="nextpleaseFirstModifier" preference-editable="true" preference="firstkeymodifier" onsynctopreference="return nextplease.syncModifierPref(this);" > | |
<menupopup onpopuphiding="nextplease.onModifierMenuChange('firstkey', 'firstkeymenu', 'nextpleaseFirstModifier');"/> | |
</menulist> | |
<label value="&options.general.enterKey;" /> | |
<textbox id="firstkey" type="text" size="1" maxlength="1" | |
onchange="return nextplease.onKeyChange('firstkey', 'firstkeymenu', 'nextpleaseFirstModifier');" /> | |
<label value="&options.general.or;" /> | |
<menulist id="firstkeymenu"> | |
<menupopup onpopuphiding="return nextplease.onKeyMenuChange('firstkey', 'firstkeymenu', 'nextpleaseFirstModifier');"/> | |
</menulist> | |
</row> | |
<row align="center"> | |
<label value="&options.general.lastKey;" /> | |
<menulist id="nextpleaseLastModifier" preference-editable="true" preference="lastkeymodifier" onsynctopreference="return nextplease.syncModifierPref(this);" > | |
<menupopup onpopuphiding="nextplease.onModifierMenuChange('lastkey', 'lastkeymenu', 'nextpleaseLastModifier');"/> | |
</menulist> | |
<label value="&options.general.enterKey;" /> | |
<textbox id="lastkey" type="text" size="1" maxlength="1" | |
onchange="return nextplease.onKeyChange('lastkey', 'lastkeymenu', 'nextpleaseLastModifier');" /> | |
<label value="&options.general.or;" /> | |
<menulist id="lastkeymenu"> | |
<menupopup onpopuphiding="return nextplease.onKeyMenuChange('lastkey', 'lastkeymenu', 'nextpleaseLastModifier');"/> | |
</menulist> | |
</row> | |
</rows> | |
</grid> | |
</vbox> | |
</groupbox> | |
</vbox> | |
</hbox> | |
</vbox> | |
</prefpane> | |
<prefpane id="nextplease.phrases" label="&options.phrases.title;" image="chrome://nextplease/skin/Document.png"> | |
<preferences></preferences> | |
<hbox flex="1"> | |
<listbox width="80" onselect="nextplease.selectedPanelChanged(this);"> | |
<listitem label="&options.next;" selected="true"/> | |
<listitem label="&options.prev;"/> | |
<listitem label="&options.first;"/> | |
<listitem label="&options.last;"/> | |
</listbox> | |
<separator class="groove" orient="vertical" style="opacity: 0.5; margin-top: 5px; margin-bottom: 5px;"/> | |
<vbox flex="1"> | |
<deck flex="1"> | |
<listbox id="nextfields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
<listbox id="prevfields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
<listbox id="firstfields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
<listbox id="lastfields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
</deck> | |
<separator class="thin"/> | |
<hbox align="stretch"> | |
<textbox type="text" maxlength="256" onkeypress="nextplease.addOnReturn(event, this);"/> | |
<button label="&options.add;" style="margin-left: 0" | |
oncommand="nextplease.addToListbox(this);" /> | |
<spacer flex="1" minwidth="20"/> | |
<button label="&options.remove;" tooltiptext="&options.removeSelected;" disabled="true" style="margin-right: 2px" | |
oncommand="nextplease.removeSelectedFromListbox(this);" /> | |
</hbox> | |
</vbox> | |
</hbox> | |
</prefpane> | |
<prefpane id="nextplease.images" label="&options.images.title;" image="chrome://nextplease/skin/Image.png"> | |
<preferences></preferences> | |
<vbox flex="1"> | |
<label value="&options.images.firstLine;" /> | |
<label value="&options.images.secondLine;" /> | |
<hbox flex="1"> | |
<listbox width="80" onselect="nextplease.selectedPanelChanged(this);"> | |
<listitem label="&options.next;" selected="true"/> | |
<listitem label="&options.prev;"/> | |
<listitem label="&options.first;"/> | |
<listitem label="&options.last;"/> | |
</listbox> | |
<separator class="groove" orient="vertical" style="opacity: 0.5; margin-top: 5px; margin-bottom: 5px;"/> | |
<vbox flex="1"> | |
<deck flex="1"> | |
<listbox id="nextimagefields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
<listbox id="previmagefields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
<listbox id="firstimagefields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
<listbox id="lastimagefields" seltype="multiple" flex="1" | |
onkeypress="nextplease.removeSelectedOnDelete(event, this);" onselect="nextplease.enableDisableRemoveButton(this);"/> | |
</deck> | |
<hbox align="stretch"> | |
<textbox type="text" maxlength="256" onkeypress="nextplease.addOnReturn(event, this);"/> | |
<button label="&options.add;" style="margin-left: 0" | |
oncommand="nextplease.addToListbox(this);" /> | |
<spacer flex="1" minwidth="20"/> | |
<button label="&options.removeSelected;" disabled="true" style="margin-right: 2px" | |
oncommand="nextplease.removeSelectedFromListbox(this);" /> | |
</hbox> | |
</vbox> | |
</hbox> | |
</vbox> | |
</prefpane> | |
<prefpane id="nextplease.advanced" label="&options.advanced.title;" image="chrome://nextplease/skin/Filter List.png"> | |
<preferences></preferences> | |
<vbox> | |
<description width="200">&options.advanced.warning;</description> | |
<grid> | |
<columns> | |
<column/> | |
<column/> | |
<column/> | |
</columns> | |
<rows> | |
<row align="center" flex="1"> | |
<label value="&options.next;:" /> | |
<textbox id="nextRegEx" type="text" size="40" maxlength="2048" /> | |
<button id="nextRegExDefaultButton" class="dialog" label="&options.restoreDefault;" | |
oncommand="nextplease.restoreDefault('nextRegEx', nextplease.DefaultNextRegEx); return false;" /> | |
</row> | |
<row align="center" flex="1"> | |
<label value="&options.prev;:" /> | |
<textbox id="prevRegEx" type="text" size="40" maxlength="2048" /> | |
<button id="prevRegExDefaultButton" class="dialog" label="&options.restoreDefault;" | |
oncommand="nextplease.restoreDefault('prevRegEx', nextplease.DefaultPrevRegEx); return false;" /> | |
</row> | |
<row align="center" flex="1"> | |
<label value="&options.first;:" /> | |
<textbox id="firstRegEx" type="text" size="40" maxlength="2048" /> | |
<button id="firstRegExDefaultButton" class="dialog" label="&options.restoreDefault;" | |
oncommand="nextplease.restoreDefault('firstRegEx', nextplease.DefaultFirstRegEx); return false;" /> | |
</row> | |
<row align="center" flex="1"> | |
<label value="&options.last;:" /> | |
<textbox id="lastRegEx" type="text" size="40" maxlength="2048" /> | |
<button id="lastRegExDefaultButton" class="dialog" label="&options.restoreDefault;" | |
oncommand="nextplease.restoreDefault('lastRegEx', nextplease.DefaultLastRegEx); return false;" /> | |
</row> | |
<row align="center" flex="1"> | |
<label value="&options.advanced.gallery;" /> | |
<textbox id="galleryRegEx" type="text" size="40" maxlength="2048" /> | |
<button id="galleryRegExDefaultButton" class="dialog" label="&options.restoreDefault;" | |
oncommand="nextplease.restoreDefault('galleryRegEx', nextplease.DefaultGalleryRegEx); return false;" /> | |
</row> | |
</rows> | |
</grid> | |
</vbox> | |
</prefpane> | |
<prefpane id="nextplease.debug" label="&options.debug.title;" image="chrome://nextplease/skin/Settings.png"> | |
<preferences></preferences> | |
<vbox flex="1"> | |
<checkbox id="nextplease.log.normal" label="&options.log.normal;"/> | |
<checkbox id="nextplease.log.detailed" label="&options.log.detailed;"/> | |
<!--<checkbox id="nextplease.log.file" label="&options.log.file;"/>--> | |
</vbox> | |
</prefpane> | |
<stringbundleset> | |
<stringbundle id="nextplease.strings" src="chrome://nextplease/locale/nextplease.properties"/> | |
<stringbundle id="platformKeys" src="chrome://global-platform/locale/platformKeys.properties"/> | |
<stringbundle id="localeKeys" src="chrome://global/locale/keys.properties"/> | |
</stringbundleset> | |
<script type="application/x-javascript" src="chrome://nextplease/content/nextpleaseCommon.js" /> | |
<script type="application/x-javascript" src="chrome://nextplease/content/nextpleaseOptions.js" /> | |
</prefwindow> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment