PK
gk2ރp p install.rdf
{62b958b4-9962-4fc2-9983-01a9a42d6f2d}Browse Images0.2Browses all image links of a page.Jürgen Binderchrome://browseimages/content/browseImagesOptions.xulhttp://browseimages.mozdev.org/http://browseimages.mozdev.org/Pierre (Traduction française)content/browseimages/locale/de-DE/browseimages/locale/en-US/browseimages/locale/fr-FR/browseimages/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}0.101.0+PK
ek2 chrome/PK
|k2M< chrome/browseimages.jarPK
j2 content/PK
j2 content/browseimages/PK
j2eL/ / , content/browseimages/browseImagesOptions.xul
PK
zj299 > content/browseimages/browseimages-available-statusbar-icon.pngPNG
IHDR ԺS !PLTE }/ VIDATxc!% 0@`d j *( % ((AhB0?-M L%BPԁQRd # IENDB`PK
Bj2I"vc , content/browseimages/browseImagesOverlay.xul
PK
j2l? B content/browseimages/browseimages-not-available-statusbar-icon.pngPNG
IHDR ԺS !PLTE LLLiiiMMMp# VIDATxc#%!% 0@`d j *( % ((APh͖@4{yy!:=J [v IENDB`PK
ij2Dqʐ6 6 + content/browseimages/browseImagesOptions.js/* * * * * * * * * * * * * BEGIN LICENSE BLOCK * * * * * * * * * * * * * * * *
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "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 Original Code is Juergen Binder's Browse Images Code
*
* The Initial Developer of the Original Code is Juergen Binder.
* Portions created by Juergen Binde are Copyright (C) 2005
* Juergen Binder. All Rights Reserved.
*
* Contributor(s): Juergen Binder.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the LGPL or the GPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* * * * * * * * * * * * END LICENSE BLOCK * * * * * * * * * * * * * * * * */
var prefBranch = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch("browseimages.");
var props = document.getElementById("g-strings");
var availableList = document.getElementById("browseimages.options.statusbar.menuitems.available.list");
var enabledList = document.getElementById("browseimages.options.statusbar.menuitems.enabled.list");
var addButton = document.getElementById("browseimages.options.statusbar.menuitems.buttons.add");
var removeButton = document.getElementById("browseimages.options.statusbar.menuitems.buttons.remove");
function BIOinit() {
var width = prefBranch.getIntPref("optionsDialogWidth")
var height = prefBranch.getIntPref("optionsDialogHeight");
resizeTo(width, height);
if(availableList == null) {
availableList = document.getElementById("browseimages.options.statusbar.menuitems.available.list");
}
if(enabledList == null) {
enabledList = document.getElementById("browseimages.options.statusbar.menuitems.enabled.list");
}
if(addButton == null) {
addButton = document.getElementById("browseimages.options.statusbar.menuitems.buttons.add");
}
if(removeButton == null) {
removeButton = document.getElementById("browseimages.options.statusbar.menuitems.buttons.remove");
}
if(prefBranch.getBoolPref("centerImages")) {
document.getElementById("browseimages.options.centerimages").setAttribute("checked","true");
} else {
document.getElementById("browseimages.options.centerimages").setAttribute("checked","false");
}
if(prefBranch.getBoolPref("autoBack")) {
document.getElementById("browseimages.options.autoBack").setAttribute("checked","true");
} else {
document.getElementById("browseimages.options.autoBack").setAttribute("checked","false");
}
if(prefBranch.getBoolPref("statusbarMenu")) {
document.getElementById("browseimages.options.statusbarMenu").setAttribute("checked","true");
} else {
document.getElementById("browseimages.options.statusbarMenu").setAttribute("checked","false");
}
if(prefBranch.getBoolPref("toolsMenu")) {
document.getElementById("browseimages.options.toolsMenu").setAttribute("checked","true");
} else {
document.getElementById("browseimages.options.toolsMenu").setAttribute("checked","false");
}
if(prefBranch.getBoolPref("autoScan")) {
document.getElementById("browseimages.options.autoScan").setAttribute("checked","true");
} else {
document.getElementById("browseimages.options.autoScan").setAttribute("checked","false");
}
if(prefBranch.getBoolPref("goMenu")) {
document.getElementById("browseimages.options.goMenu").setAttribute("checked","true");
} else {
document.getElementById("browseimages.options.goMenu").setAttribute("checked","false");
}
document.getElementById("browseimage.options.historyMenuOptions.index.group")
.selectedIndex = 2 - prefBranch.getIntPref("back_history_menu_backToIndex");
document.getElementById("browseimage.options.historyMenuOptions.back.group")
.selectedIndex = 2 - prefBranch.getIntPref("back_history_menu_prevImg");
document.getElementById("browseimage.options.historyMenuOptions.forward.group")
.selectedIndex = 2 - prefBranch.getIntPref("forward_history_menu_nextImg");
document.getElementById("browseimage.options.historyMenuOptions.count")
.value = prefBranch.getIntPref("max_history_menu_items");
var txtbx = document.getElementById(
"browseimage.options.historyMenuOptions.count")
.inputField;
txtbx.setAttribute("style", "text-align:right;");
var availableList = document.getElementById("browseimages.options.statusbar.menuitems.available.list");
var enabledList = document.getElementById("browseimages.options.statusbar.menuitems.enabled.list");
var lists = prefBranch.getCharPref("statusbarMenuitems").split("|");
var availableItems = lists[0].split(";");
var enabledItems = lists[1].split(";");
if(props == null) {
props = document.getElementById("g-strings");
}
for(var i = 0; i < availableItems.length; i++) {
try {
availableList.appendItem(props.getString(availableItems[i]), availableItems[i]);
} catch(e) {}
}
for(var j = 0; j < enabledItems.length; j++) {
try {
enabledList.appendItem(props.getString(enabledItems[j]), enabledItems[j]);
} catch(e) {}
}
if(availableList.getRowCount() > 0) {
availableList.selectedIndex = 0;
BIOclick(true);
} else {
enabledList.selectedIndex = 0;
BIOclick(false);
}
}
function BIOsave() {
prefBranch.setIntPref("optionsDialogWidth", window.outerWidth);
prefBranch.setIntPref("optionsDialogHeight", window.outerHeight);
var availableList = document.getElementById("browseimages.options.statusbar.menuitems.available.list");
var enabledList = document.getElementById("browseimages.options.statusbar.menuitems.enabled.list");
if(document.getElementById("browseimages.options.statusbarMenu").getAttribute("checked") == "true") {
prefBranch.setBoolPref("statusbarMenu", 1);
} else {
prefBranch.setBoolPref("statusbarMenu", 0);
}
if(document.getElementById("browseimages.options.goMenu").getAttribute("checked") == "true") {
prefBranch.setBoolPref("goMenu", 1);
} else {
prefBranch.setBoolPref("goMenu", 0);
}
if(document.getElementById("browseimages.options.toolsMenu").getAttribute("checked") == "true") {
prefBranch.setBoolPref("toolsMenu", 1);
} else {
prefBranch.setBoolPref("toolsMenu", 0);
}
if(document.getElementById("browseimages.options.centerimages").getAttribute("checked") == "true") {
prefBranch.setBoolPref("centerImages", 1);
} else {
prefBranch.setBoolPref("centerImages", 0);
}
if(document.getElementById("browseimages.options.autoBack").getAttribute("checked") == "true") {
prefBranch.setBoolPref("autoBack", 1);
} else {
prefBranch.setBoolPref("autoBack", 0);
}
if(document.getElementById("browseimages.options.autoScan").getAttribute("checked") == "true") {
prefBranch.setBoolPref("autoScan", 1);
} else {
prefBranch.setBoolPref("autoScan", 0);
}
prefBranch.setIntPref("back_history_menu_backToIndex",
2 - document.getElementById(
"browseimage.options.historyMenuOptions.index.group")
.selectedIndex);
prefBranch.setIntPref("back_history_menu_prevImg",
2 - document.getElementById(
"browseimage.options.historyMenuOptions.back.group")
.selectedIndex);
prefBranch.setIntPref("forward_history_menu_nextImg",
2 - document.getElementById(
"browseimage.options.historyMenuOptions.forward.group")
.selectedIndex);
prefBranch.setIntPref("max_history_menu_items", document.getElementById(
"browseimage.options.historyMenuOptions.count").value);
var menuitemlist = new String();
for(var i = 0; i < availableList.getRowCount(); i++) {
menuitemlist += availableList.getItemAtIndex(i).value + ";";
}
menuitemlist += "|";
for(i = 0; i < enabledList.getRowCount(); i++) {
menuitemlist += enabledList.getItemAtIndex(i).value + ";";
}
prefBranch.setCharPref("statusbarMenuitems", menuitemlist);
}
function BIOclick(bool) {
if(bool) {
addButton.setAttribute("disabled", "false");
removeButton.setAttribute("disabled", "true");
} else {
addButton.setAttribute("disabled","true");
removeButton.setAttribute("disabled","false");
}
}
/*
* true => add
* false => remove
*/
function BIOaddMenuItem(bool) {
var sourceList = document.getElementById("browseimages.options.statusbar.menuitems.available.list");
var targetList = document.getElementById("browseimages.options.statusbar.menuitems.enabled.list");
if(!bool) {
var tempList = sourceList;
sourceList = targetList;
targetList = tempList;
}
var listitem;
for(var i = 0; i < sourceList.getRowCount(); i++) {
listitem = sourceList.getItemAtIndex(i);
if(listitem.selected) {
try{
if(listitem.value != "separator" || !bool) {
listitem = sourceList.removeItemAt(i);
}
if(listitem.value != "separator" || bool) {
if(targetList.selectedIndex > -1) {
targetList.insertItemAt(targetList.selectedIndex, listitem.label, listitem.value);
} else {
targetList.appendItem(listitem.label, listitem.value);
}
if(listitem.value != "separator") {
i--;
}
} else if(!bool) {
i--;
}
} catch(ex) {
alert(ex);
}
}
}
}
/* true => moveup
* false => movedown
*/
function BIOmove(dir) {
var delta;
var list;
var listitem;
var moveFirstIndex;
var moveLastIndex;
var dontForgetToSelect = new Array();
if(addButton.getAttribute("disabled") == "true") {
list = document.getElementById("browseimages.options.statusbar.menuitems.enabled.list");
} else {
list = document.getElementById("browseimages.options.statusbar.menuitems.available.list");
}
if(dir) {
moveFirstIndex = 1;
moveLastIndex = list.getRowCount();
delta = +1;
} else {
moveFirstIndex = list.getRowCount() - 2;
moveLastIndex = -1;
delta = -1;
}
for(var i = moveFirstIndex; i != moveLastIndex; i += delta) {
listitem = list.getItemAtIndex(i)
if(listitem.selected) {
listitem = list.removeItemAt(i);
i -= delta;
if(i == list.getRowCount()) {
listitem = list.appendItem(listitem.label, listitem.value);
} else {
listitem = list.insertItemAt(i, listitem.label, listitem.value);
}
dontForgetToSelect.push(listitem);
}
}
for(var j in dontForgetToSelect) {
list.addItemToSelection(dontForgetToSelect[j]);
}
}
function BIOselectAll() {
var availableList = document.getElementById("browseimages.options.statusbar.menuitems.available.list");
var enabledList = document.getElementById("browseimages.options.statusbar.menuitems.enabled.list");
if(addButton.getAttribute("disabled") == "true") {
try {
enabledList.selectAll();
} catch (e) {
availableList.selectAll();
}
} else {
/* could not be emtpy as separator always remains there */
availableList.selectAll();
}
}
PK
!k2 ʀ + content/browseimages/browseImagesOverlay.js/* * * * * * * * * * * * * BEGIN LICENSE BLOCK * * * * * * * * * * * * * * * *
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "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 Original Code is Juergen Binder's Browse Images Code
*
* The Initial Developer of the Original Code is Juergen Binder.
* Portions created by Juergen Binde are Copyright (C) 2005
* Juergen Binder. All Rights Reserved.
*
* Contributor(s): Juergen Binder.
*
* Please see also the licensing notes of the FillHistoryMenu function at the
* end of this file.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the LGPL or the GPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* * * * * * * * * * * * END LICENSE BLOCK * * * * * * * * * * * * * * * * */
var imgListArray = new Array();
var imgList = new String();
var referrerArray = new Array();
var index = -1;
var frameIndexPages = new Array();
var autoBackToIndex = new Boolean();
var max_history_menu_items_browseimages = 35;
var back_prevImg = 1;
var back_backToIndex = 1;
var forward_nextImg = 1;
var historyMenuMore = new Boolean();
try{
var theReferrer = Components.classes["@mozilla.org/network/standard-url;1"]
.getService(Components.interfaces.nsIURI);
var prefBranch = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefService)
.getBranch("browseimages.");
} catch (e) {}
var props = document.getElementById("gstrings");
document.addEventListener("load", applySettings, true);
/******************************************************************************
* *
* The BrowseImagesObserver calls the applySettings() function when the *
* browseimages preferences changed, so the changes take place in every window*
* *
* It is based on the example observer object from the Knowledge Base: *
* http://kb.mozillazine.org/Using_observers#Observer_object *
* *
******************************************************************************/
function browseImagesObserver() {
this.register();
}
browseImagesObserver.prototype = {
observe: function(subject, topic, data) {
applySettings();
},
register: function() {
var prefService;
prefService = Components.classes['@mozilla.org/preferences-service;1'].
getService(Components.interfaces.nsIPrefService);
prefBranch = Components.classes['@mozilla.org/preferences-service;1'].
getService(Components.interfaces.nsIPrefService).
getBranch("browseimages.");
var pbi =
prefBranch.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
pbi.addObserver("", this, false);
}
}
var observer = new browseImagesObserver();
observer.register();
/******************************************************************************
* *
* This function applies changes in the settings. *
* *
/*****************************************************************************/
function applySettings() {
document.removeEventListener("load", applySettings, true);
autoBackToIndex = prefBranch.getBoolPref("autoBack");
centerImages();
if(prefBranch.getBoolPref("goMenu")) {
document.getElementById("browseImagesGoMenu").removeAttribute("hidden");
} else {
document.getElementById("browseImagesGoMenu").setAttribute("hidden",
"true");
}
if(prefBranch.getBoolPref("toolsMenu")) {
document.getElementById("browseImagesToolsMenu")
.removeAttribute("hidden");
} else {
document.getElementById("browseImagesToolsMenu").setAttribute("hidden",
"true");
}
if(prefBranch.getBoolPref("statusbarMenu")) {
document.getElementById("browseimages-button").removeAttribute("hidden");
} else {
document.getElementById("browseimages-button").setAttribute("hidden",
"true");
}
max_history_menu_items_browseimages =
prefBranch.getIntPref("max_history_menu_items");
back_prevImg = prefBranch.getIntPref("back_history_menu_prevImg");
back_backToIndex = prefBranch.getIntPref("back_history_menu_backToIndex");
forward_nextImg = prefBranch.getIntPref("forward_history_menu_nextImg");
historyMenuMore = prefBranch.getBoolPref("history_menu_more");
if(prefBranch.getBoolPref("autoScan")) {
document.addEventListener("DOMNodeInserted", initBrowseImages, true);
document.addEventListener("load", finishDocumentScanning, true);
document.addEventListener("unload", saveOffsets, true);
document.addEventListener("load", restoreOffsets, true);
} else {
document.removeEventListener("DOMNodeInserted", initBrowseImages, true);
document.removeEventListener("load", finishDocumentScanning, true);
document.removeEventListener("unload", saveOffsets, true);
document.removeEventListener("load", restoreOffsets, true);
}
}
/******************************************************************************
* *
* This function saves the page offsets when the document has unloaded. *
* *
******************************************************************************/
function saveOffsets() {
if(content.document.URL == imgListArray[imgListArray.length - 1] &&
imgListArray.length > 1 && content.document.URL != "" &&
content.document.URL != "about:blank") {
gBrowser.tabContainer.selectedItem.indexXOffset = content.pageXOffset;
gBrowser.tabContainer.selectedItem.indexYOffset = content.pageYOffset;
if(content.frames.length > 1) {
var frameXOffset = new Array();
var frameYOffset = new Array();
for(var i = 0; i < content.frames.length; i++) {
frameXOffset[i] = content.frames[i].pageXOffset;
frameYOffset[i] = content.frames[i].pageYOffset;
}
gBrowser.tabContainer.selectedItem.frameXOffset = frameXOffset;
gBrowser.tabContainer.selectedItem.frameYOffset = frameYOffset;
}
}
}
/******************************************************************************
* *
* This function restores the page offsets when the document has loaded. *
* *
******************************************************************************/
function restoreOffsets() {
if(imgListArray.length > 1 && content.document.URL ==
imgListArray[imgListArray.length - 1] && content.frames.length == 0) {
content.scrollTo(gBrowser.tabContainer.selectedItem.indexXOffset,
gBrowser.tabContainer.selectedItem.indexYOffset);
} else if(imgListArray.length > 1 &&
content.document.URL == imgListArray[imgListArray.length - 1] &&
gBrowser.tabContainer.selectedItem.frameIndexPages &&
gBrowser.tabContainer.selectedItem.frameIndexPages.length > 1 &&
gBrowser.tabContainer.selectedItem.frameIndexPages.length ==
content.frames.length ) {
var frameXOffset = gBrowser.tabContainer.selectedItem.frameXOffset;
var frameYOffset = gBrowser.tabContainer.selectedItem.frameYOffset;
if(frameXOffset && frameYOffset) {
for(var i = 0; i < frameIndexPages.length; i++) {
content.frames[i].scrollTo(frameXOffset[i], frameYOffset[i]);
}
}
}
}
/******************************************************************************
* *
* Saves the index page of each frame if necessary. *
* *
******************************************************************************/
function saveIndexPageWithFrames() {
if(gBrowser.tabContainer.selectedItem.whileRestoringFrames)
return;
gBrowser.tabContainer.selectedItem.frameIndexPagesToRestore = new Array();
if(gBrowser.tabContainer.selectedItem.frameIndexPages) {
for(var q = 0; q < frameIndexPages.length; q++) {
gBrowser.tabContainer.selectedItem.frameIndexPagesToRestore[q] =
gBrowser.tabContainer.selectedItem.frameIndexPages[q];
}
}
}
/******************************************************************************
* *
* Restores an index page with frames *
* *
******************************************************************************/
function restoreIndexPageWithFrames() {
if(!gBrowser.tabContainer.selectedItem.frameIndexPagesToRestore) {
gBrowser.tabContainer.selectedItem.frameIndexPagesToRestore =
new Array();
return;
}
gBrowser.tabContainer.selectedItem.whileRestoringFrames = true;
var frameIndexPagesToRestore = gBrowser.tabContainer.selectedItem.
frameIndexPagesToRestore;
if(frameIndexPagesToRestore.length == content.frames.length) {
for(var i = 0; i < frameIndexPagesToRestore.length; i++) {
if(frameIndexPagesToRestore != "about:blank" &&
content.frames[i].location.href) {
content.frames[i].location.href = frameIndexPagesToRestore[i];
} else {
restoreIndexPageWithFrames();
}
}
gBrowser.tabContainer.selectedItem.frameIndexPagesToRestore = null;
}
gBrowser.tabContainer.selectedItem.whileRestoringFrames = false;
}
/******************************************************************************
* *
* One of the main functions. It controls the creating of the image list and *
* takes care about tab changes. *
* *
******************************************************************************/
function createImgList() {
/********* Loads the correct variables for the current tab *********/
if(gBrowser.tabContainer.selectedItem.imgList != null) {
imgList = gBrowser.tabContainer.selectedItem.imgList;
} else {
imgList = new String();
}
if(gBrowser.tabContainer.selectedItem.imgListArray != null) {
imgListArray = gBrowser.tabContainer.selectedItem.imgListArray;
} else {
imgListArray = new Array();
}
if(gBrowser.tabContainer.selectedItem.referrerArray != null) {
referrerArray = gBrowser.tabContainer.selectedItem.referrerArray;
} else {
referrerArray = new Array();
}
if(gBrowser.tabContainer.selectedItem.frameIndexPages != null) {
frameIndexPages = gBrowser.tabContainer.selectedItem.frameIndexPages;
} else {
frameIndexPages = new Array();
}
if(gBrowser.tabContainer.selectedItem.whileRestoringFrames != null &&
gBrowser.tabContainer.selectedItem.whileRestoringFrames == true) {
return;
}
/*********************** Creating the image List ***********************/
var framesIndices = 0;
if(content.frames.length > 0 && imgListArray[imgListArray.length - 1] ==
content.document.URL && !compareArrays(content.frames, frameIndexPages,
true)) {
framesIndices = -1;
}
if(imgList.indexOf("\n" + content.document.URL + "\n") == -1 ||
framesIndices == -1) {
imgList = "";
index = -1;
referrerArray = new Array();
if(content.frames.length == 0) { /* no frames */
frameIndexPages = null;
createImgListForFrame(content.document.links, content.document.URL);
createAreaHrefArray(content.document.getElementsByTagName("area"),
content.document.URL);
} else { /* frames */
for(var f = 0; f < content.frames.length; f++) {
frameIndexPages[f] = content.frames[f].document.URL;
if(content.frames[f].document.links.length > 0) {
createImgListForFrame(content.frames[f].document.links,
frameIndexPages[f]);
createAreaHrefArray(content.frames[f].document.
getElementsByTagName("area"),
frameIndexPages[f]);
}
}
}
imgListArray = imgList.split("\n");
imgListArray[imgListArray.length - 1] = content.document.URL;
imgList += content.document.URL + "\n";
imgList = "\n" + imgList;
referrerArray.push(content.document.referrer);
addRangeToSessionHistory(0, (imgListArray.length - 1));
}
gBrowser.tabContainer.selectedItem.referrerArray = referrerArray;
gBrowser.tabContainer.selectedItem.imgList = imgList;
gBrowser.tabContainer.selectedItem.imgListArray = imgListArray;
gBrowser.tabContainer.selectedItem.frameIndexPages = frameIndexPages;
if(imgListArray.length > 1) {
document.getElementById("browseimages-button").setAttribute(
"src", "chrome://browseimages/content/browseimages-" +
"available-statusbar-icon.png");
} else {
document.getElementById("browseimages-button").setAttribute(
"src", "chrome://browseimages/content/browseimages-not-" +
"available-statusbar-icon.png");
}
}
/******************************************************************************
* *
* This function adds a range of the imgListArray to the session history in *
* order to enable the forward extra mouse button, so you can go with it to *
* the next image. *
* *
******************************************************************************/
function addRangeToSessionHistory(theFirstIndex, theLastIndex) {
try{
if(theFirstIndex == 0 && theLastIndex == imgListArray.length - 1 &&
gBrowser.tabContainer.selectedItem.indexPage != content.document.URL) {
gBrowser.tabContainer.selectedItem.indexPage = content.document.URL; gBrowser.tabContainer.selectedItem.indexPageIndex = gBrowser.sessionHistory.index;
}
var SHInternal = Components.classes
['@mozilla.org/browser/shistory-internal;1'].
createInstance(Components.interfaces.nsISHistoryInternal);
SHInternal = gBrowser.sessionHistory.QueryInterface(Components.
interfaces.nsISHistoryInternal);
if(imgListArray.length > 1 ) {
if(!gBrowser.canGoForward) {
rangeReallyAddingFunction(theFirstIndex, theLastIndex);
} else {
correctIndex();
var imgListArrayIndex = index;
var i = 0;
if(index == imgListArray.length - 1 && content.document.URL == imgListArray[imgListArray.length - 1]) {
i = 1;
imgListArrayIndex = -1;
}
while(i < imgListArray.length && imgListArray[imgListArrayIndex + i] == (SHInternal.getEntryAtIndex(SHInternal.index + i, false)).URI.spec) {
i++;
}
if(i < imgListArray.length && (SHInternal.getEntryAtIndex(SHInternal.index + i, false)).URI.spec == imgListArray[imgListArray.length - 1] ) {
rangeReallyAddingFunction(theFirstIndex, theLastIndex);
}
}
}
} catch (exception) {
/** Don't complaine! ;-) **/
}
}
/******************************************************************************
* *
* This function is a help function for addRangeToSessionHistory() *
* *
******************************************************************************/
function rangeReallyAddingFunction(theFirstIndex, theLastIndex) {
var SHInternal = Components.classes
['@mozilla.org/browser/shistory-internal;1'].
createInstance(Components.interfaces.nsISHistoryInternal);
SHInternal = gBrowser.sessionHistory.QueryInterface(Components.
interfaces.nsISHistoryInternal);
var SHindexbefore = SHInternal.index;
for(var k = theFirstIndex; k <= theLastIndex; k++) {
var uriParts = imgListArray[k].split("/");
var label = "\u203A\u203A " + uriParts[uriParts.length - 1]
+ " (" + imgListArray[k]+")";
addEntryToSessionHistory(imgListArray[k], label, referrerArray[k]);
}
SHInternal.getEntryAtIndex(SHindexbefore, true);
}
/******************************************************************************
* *
* This function generates an array of links of map area links and calls *
* createImgListForFrame function to process this array *
* *
******************************************************************************/
function createAreaHrefArray(areaArray, theReferrer) {
if(areaArray.length == 0)
return;
var areaLinks = new Array();
for(var i = 0; i < areaArray.length; i++) {
areaLinks[i] = areaArray[i].href;
}
createImgListForFrame(areaLinks, theReferrer);
}
/******************************************************************************
* *
* This function parses link arrays for image links and adds these to the *
* imgList and their referrer to the referrer array. *
* *
******************************************************************************/
function createImgListForFrame(linksArray, theReferrer) {
if(!linksArray || !theReferrer)
return;
var jpgIndex = -1;
var gifIndex = -1;
var pngIndex = -1;
var jpegIndex = -1;
var bmpIndex = -1;
for(var i = 0; i < linksArray.length; i++) {
if(imgList.indexOf(linksArray[i].toString()+ "\n") > -1)
continue;
jpgIndex = linksArray[i].toString().toLowerCase().lastIndexOf(".jpg");
gifIndex = linksArray[i].toString().toLowerCase().lastIndexOf(".gif");
pngIndex = linksArray[i].toString().toLowerCase().lastIndexOf(".png");
jpegIndex = linksArray[i].toString().toLowerCase().lastIndexOf(".jpeg");
bmpIndex = linksArray[i].toString().toLowerCase().lastIndexOf(".bmp");
if((jpgIndex > -1 && linksArray[i].toString().charAt(jpgIndex + 4)
.toString().search(/[\w-\/]/) == -1
|| gifIndex > -1 && linksArray[i].toString().charAt(gifIndex + 4)
.toString().search(/[\w-\/]/) == -1
|| pngIndex > -1 && linksArray[i] .toString().charAt(pngIndex + 4)
.toString().search(/[\w-\/]/) == -1
|| bmpIndex > -1 && linksArray[i].toString().charAt(bmpIndex + 4)
.toString().search(/[\w-\/]/) == -1
|| jpegIndex > -1 && linksArray[i].toString().charAt(jpegIndex + 5)
.toString().search(/[\w-\/]/) == -1)) {
imgList+=(linksArray[i] + "\n");
referrerArray.push(theReferrer);
}
}
}
/******************************************************************************
* *
* This function adds an entry to the session history with given url, title *
* and referrer *
* *
******************************************************************************/
function addEntryToSessionHistory(theURI, theTitle, theReferrer) {
try{
var theNSURI = Components.classes["@mozilla.org/network/standard-url;1"]
.createInstance(Components.interfaces.nsIURI);
theNSURI.spec = theURI;
var theReferrerURI = Components.classes
["@mozilla.org/network/standard-url;1"]
.createInstance(Components.interfaces.nsIURI);
theReferrerURI.spec = theReferrer;
var SHInternal = Components.classes
['@mozilla.org/browser/shistory-internal;1']
.createInstance(
Components.interfaces.nsISHistoryInternal);
SHInternal = gBrowser.sessionHistory.
QueryInterface(Components.interfaces.nsISHistoryInternal);
gBrowser.sessionHistory.maxLength = 999999;
SHInternal.maxLength = 999999;
var SHEntry = Components.classes
['@mozilla.org/browser/session-history-entry;1']
.createInstance(Components.interfaces.nsISHEntry);
SHEntry.SetTitle(theTitle);
SHEntry.SetURI(theNSURI);
SHEntry.referrerURI = theReferrerURI;
SHInternal.addEntry(SHEntry, true);
var bf = document.getElementById("Browser:Forward");
bf.removeAttribute("disabled");
} catch (exception) {
/** Don't complain! ;-) **/
}
}
/******************************************************************************
* *
* This function opens the Browse Images Options dialog window. *
* *
******************************************************************************/
function showBIOptions() {
window.openDialog("chrome://browseimages/content/browseImagesOptions.xul",
"BrowseImagesOptions", "chrome,centerscreen,resizable,width=1000");
}
/******************************************************************************
* *
* This function sorts the Image List. *
* *
******************************************************************************/
function sortImgList() {
imgListArray.sort();
}
/******************************************************************************
* *
* Generic funtion for going on to the next (dir > 0) or previous (dir < 0) *
* image *
* *
******************************************************************************/
function goon(dir) {
createImgList();
correctIndex();
if(imgListArray.length > 1) {
if(index >= imgListArray.length - 1 && dir > 0) {
index = -1;
} else if(index <= 0 && dir < 0) {
index = imgListArray.length;
}
index += dir;
theReferrer.spec = referrerArray[index];
loadURI(imgListArray[index], theReferrer, null);
}
}
/******************************************************************************
* *
* For going to the next image *
* *
******************************************************************************/
function nextImg() {
goon(1);
}
function nextImage() {
goon(1);
}
/******************************************************************************
* *
* For going to the previous image *
* *
******************************************************************************/
function prevImg() {
goon(-1);
}
function prevImage() {
goon(-1);
}
/******************************************************************************
* *
* Loads the image whose menuitem has been clicked *
* *
******************************************************************************/
function gotoImage(menuitem) {
theReferrer.spec = menuitem.getAttribute("referrer");
loadURI(menuitem.getAttribute("value"), theReferrer, null);
}
/******************************************************************************
* *
* This function determines the index of the current page and corrects the *
* index variable to it. *
* *
******************************************************************************/
function correctIndex() {
if(index < 0 || imgListArray[index] && imgListArray[index] !=
content.document.URL) {
index = 0;
while(index < imgListArray.length && imgListArray[index] !=
content.document.URL) {
index++;
}
}
}
/******************************************************************************
* *
* One of the main functions. It is called when a DOMNOde is inserted (and *
* AutoScan is enabled). It manages saving and restoring of index pages with *
* frames, initializing the creating of the image list and the (not always) *
* fast adding to the session history *
* *
******************************************************************************/
function initBrowseImages() {
if(gBrowser.tabContainer.selectedItem.frameIndexPages &&
imgListArray.length > 1 &&
imgListArray[imgListArray.length - 1] != content.document.URL) {
saveIndexPageWithFrames();
}
if(gBrowser.tabContainer.selectedItem.frameIndexPagesToRestore != null &&
content.document.URL == imgListArray[imgListArray.length - 1] &&
imgListArray.length > 1) {
restoreIndexPageWithFrames();
}
createImgList();
correctIndex();
addRangeToSessionHistory(((index + 1) >= imgListArray.length ? 0 : index + 1), (imgListArray.length - 1));
}
/******************************************************************************
* *
* In addition to the initBrowseImages() function this method is called when *
* the page has loaded completely. It rescans the document, so no link can be *
* overlooked. Furthermore it handles the auto Back to begin after cycling *
* all the images. *
* *
******************************************************************************/
function finishDocumentScanning() {
if(imgListArray[imgListArray.length - 1] == content.document.URL) {
gBrowser.tabContainer.selectedItem.imgList = "";
gBrowser.tabContainer.selectedItem.imgListArray = new Array();
initBrowseImages();
gBrowser.tabContainer.selectedItem.imgList = imgList;
gBrowser.tabContainer.selectedItem.imgListArray = imgListArray;
if(imgListArray.length > 1 && autoBackToIndex) {
backToIndex();
}
correctIndex();
addRangeToSessionHistory(((index + 1) == imgListArray.length ? 0 : index + 1), (imgListArray.length - 1));
}
}
/******************************************************************************
* *
* This function builds the Browse Images menu. *
* *
******************************************************************************/
function buildBrowseImagesMenu(menu) {
/* ID = context-browseimages */
if(menu == null) {
return false;
}
createImgList();
while(menu.childNodes.length > 0) {
menu.removeChild(menu.firstChild);
}
if(props == null) {
props = document.getElementById("gstrings");
}
var list = prefBranch.getCharPref("statusbarMenuitems").split("|");
var menuitems = list[1].split(";");
for(var i in menuitems) {
var menuitem = document.createElement("menuitem");
try {
menuitem.setAttribute("label", props.getString(menuitems[i]));
} catch (ex) {
continue;
}
switch(menuitems[i]) {
case "options" :
menuitem.setAttribute("oncommand", "showBIOptions();");
break;
case "sortList" :
menuitem.setAttribute("oncommand", "sortImgList();");
break;
case "centerImages" :
menuitem.setAttribute("oncommand", "togglePref(\"centerImages\");");
menuitem.setAttribute("type", "checkbox");
if(prefBranch.getBoolPref("centerImages")) {
menuitem.setAttribute("checked", "true");
}
break;
case "autoBack" :
menuitem.setAttribute("oncommand",
"togglePref(\"autoBack\");");
menuitem.setAttribute("type", "checkbox");
if(prefBranch.getBoolPref("autoBack")) {
menuitem.setAttribute("checked", "true");
}
break;
case "autoScan" :
menuitem.setAttribute("oncommand", "togglePref(\"autoScan\");");
menuitem.setAttribute("type", "checkbox");
if(prefBranch.getBoolPref("autoScan")) {
menuitem.setAttribute("checked", "true");
}
break;
case "backToIndex" :
menuitem.setAttribute("oncommand", "backToIndex();");
break;
case "imageList" :
addImageListToMenu(menu);
menuitem = null;
break;
case "nextImage" :
menuitem.setAttribute("oncommand", "nextImg();");
break;
case "prevImage" :
menuitem.setAttribute("oncommand", "prevImg();");
break;
case "separator" :
menuitem = document.createElement("menuseparator");
break;
}
if(menuitem != null) {
menu.appendChild(menuitem);
}
}
return true;
}
/******************************************************************************
* *
* This function adds the image list to the menu *
* *
******************************************************************************/
function addImageListToMenu(menu) {
if(!imgListArray)
return;
if(imgListArray.length > 1) {
for(var i = 0; i 0 && arrayB.length > 0 &&
arrayA.length == arrayB.length) {
var a;
var b;
for(var i = 0; i < arrayA.length; i++) {
if(docUrlA) {
a = arrayA[i].document.URL;
} else {
a = arrayA[i];
}
b = arrayB[i];
if(a != b) {
return false;
}
}
return true;
} else {
return false;
}
}
/******************************************************************************
* *
* This function creates a menuitem whose label is determinate by a string *
* property and adds this menuitem to a menu. *
* *
******************************************************************************/
function createSpecialMenuItem(menu, string) {
if(props == null) {
props = document.getElementById("gstrings");
}
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("index", -1);//necessary for deleteHistoryItems(aMenu)
menuitem.setAttribute("oncommand", string + "();");
try {
menuitem.setAttribute("label", props.getString(string));
} catch(exception) {
menuitem.setAttribute("label", string);
}
menu.appendChild(menuitem);
}
/******************************************************************************
* *
* This function adds an menuseparator to a menu. *
* *
******************************************************************************/
function addSeparator(menu) {
var sep = document.createElement("menuseparator");
sep.setAttribute("index", -1); // necessary for deleteHistoryItems(aMenu)
menu.appendChild(sep);
}
/*******************************************************************************
* This method was copied and licensed under the MPL/GPL/LPGL tri-license from *
* the original firfox file "browser.js" by me, Juergen Binder, In Firefox you *
* can view the "browser.js" with the URL "chrome://browser/content/browser.js".
* The current version of the browser.js file can be found on *
http://lxr.mozilla.org/aviary101branch/source/browser/base/content/browser.js
* At the moment (March 10, 2005) starts the FillHistoryMenu function at line *
* #2420. *
* *
* The Original Browser.js Code of this function is mozilla.org code. *
* The code of the extended function is Juergen Binder's Browse Image code *
* *
* The Initial Developer of the Original Browser.js Code of this function is *
* Netscape Communications Corporation. *
* Portions created by the Initial Developer are Copyright (C) 1998 *
* the Initial Developer. All Rights Reserved. *
* *
* The Initial Developer of the extended function's Code is Juergen Binder. *
* Portions created by Juergen Binder are Copyright (C) 2005 *
* Juergen Binder. All Rights Reserved. *
* *
* *
* Contributor(s) of the orginal code: *
* Blake Ross *
* David Hyatt *
* Peter Annema *
* Dean Tessman *
* Kevin Puetz (puetzk@iastate.edu) *
* Ben Goodger *
* Pierre Chanial *
* Jason Eager *
* Joe Hewitt *
* Alec Flett *
* *
* Contributor of the function extending code: *
* Juergen Binder *
* *
* *
* *
* I, Juergen Binder, have done the following changes: *
* - The constant MAX_HISTORY_MENU_ITEMS was replaced by the variable *
* max_history_menu_items_browseimages, marked with comment tags /**/ /*
* - 4 code blocks were added. They are marked with Browse Image Addition #i *
* Tags *
* - In the forward block in line 1244 I inserted a "+ 1" between ? and : *
* to fix a bug, I marked this with /*!*/ /*
* *
* No line of the original code was deleted or changed otherwise than *
* mentioned above. *
* *
********************************************************************************
* *
* If I have made a mistake licensing the code, please just email me at *
* juergenbinder@quantentunnel.de and I'll correct it immediatly so suing *
* suing won't be necessary and just wasting of time and money :-) *
* *
********************************************************************************
* *
* This function creates the dropdownlist of the forward and back buttons. *
* Some lines are added to add Browse Images' next Image, previous Image and *
* backtoIndex functionality. *
* *
*******************************************************************************/
function FillHistoryMenu (aParent, aMenu) {
// Remove old entries if any
deleteHistoryItems(aParent);
var sessionHistory = getWebNavigation().sessionHistory;
var count = sessionHistory.count;
var index = sessionHistory.index;
var end;
var j;
var entry;
switch (aMenu)
{
case "back":
/****************** Begin Browse Images Addition 1 ******************/
if(imgListArray.length > 1) {
if(back_prevImg == 2) {
createSpecialMenuItem(aParent, "prevImage");
}
if(back_backToIndex == 2) {
createSpecialMenuItem(aParent, "backToIndex");
}
if(back_prevImg == 2 || back_backToIndex == 2) {
addSeparator(aParent);
}
}
/******************* End Browse Images Addition 1 *******************/
end = (index > /**/ max_history_menu_items_browseimages /**/ ) ? index - /**/ max_history_menu_items_browseimages /**/ : 0;
if ((index - 1) < end) return false;
for (j = index - 1; j >= end; j--)
{
entry = sessionHistory.getEntryAtIndex(j, false);
if (entry)
createMenuItem(aParent, j, entry.title);
}
/****************** Begin Browse Images Addition 2 ******************/
if(imgListArray.length > 1) {
if(back_prevImg == 1 || back_backToIndex == 1) {
addSeparator(aParent);
}
if(back_prevImg == 1) {
createSpecialMenuItem(aParent, "prevImage");
}
if(back_backToIndex == 1) {
createSpecialMenuItem(aParent, "backToIndex");
}
}
/******************* End Browse Images Addition 2 *******************/
break;
case "forward":
/****************** Begin Browse Images Addition 3 ******************/
if(imgListArray.length > 1 && forward_nextImg == 2) {
createSpecialMenuItem(aParent, "nextImage");
addSeparator(aParent);
}
/******************* End Browse Images Addition 3 *******************/
end = ((count-index) > /**/ max_history_menu_items_browseimages /**/ ) ? index + /**/ max_history_menu_items_browseimages + 1/*!*/ : count;
if ((index + 1) >= end) return false;
for (j = index + 1; j < end; j++)
{
entry = sessionHistory.getEntryAtIndex(j, false);
if (entry)
createMenuItem(aParent, j, entry.title);
}
/****************** Begin Browse Images Addition 4 ******************/
if(index + end < count) {
}
if(imgListArray.length > 1 && forward_nextImg == 1) {
addSeparator(aParent);
createSpecialMenuItem(aParent, "nextImage");
}
/******************* End Browse Images Addition 4 *******************/
break;
case "go":
aParent.lastChild.hidden = (count == 0);
end = count > /**/ max_history_menu_items_browseimages /**/ ? count - /**/ max_history_menu_items_browseimages /**/ : 0;
for (j = count - 1; j >= end; j--)
{
entry = sessionHistory.getEntryAtIndex(j, false);
if (entry)
createRadioMenuItem(aParent, j, entry.title, j==index);
}
break;
}
return true;
}PK
k2q=.Q Q ! content/browseimages/contents.rdf
chrome://browseimages/content/browseImagesOverlay.xulPK
j2 locale/PK
j2
locale/fr-FR/PK
j2 locale/fr-FR/browseimages/PK
j2ͯr r &