home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ac-grenoble.fr
/
2015.02.ftp.ac-grenoble.fr.tar
/
ftp.ac-grenoble.fr
/
assistance.logicielle
/
r-kiosk-0.5.2-firefox.xpi
/
chrome
/
content
/
rkiosk
/
rkioskbrowser.js
< prev
next >
Wrap
Text File
|
2007-03-08
|
16KB
|
383 lines
function Rkiosk_donothing()
{
}
function Rkiosk_navbar_setting()
{
var rkiosk_navbar_enable="true";
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch);
if (prefs.getPrefType("rkiosk.navbar") == prefs.PREF_BOOL){
if (prefs.getBoolPref("rkiosk.navbar")) rkiosk_navbar_enable = "false";
}
var rkiosk_element = document.getElementById("navigator-toolbox");
rkiosk_element.setAttribute("hidden", rkiosk_navbar_enable);
}
function RkioskBrowserStartup()
{
gBrowser = document.getElementById("content");
window.tryToClose = WindowIsClosing;
Rkiosk_navbar_setting();
var uriToLoad = null;
// Check for window.arguments[0]. If present, use that for uriToLoad.
if ("arguments" in window && window.arguments[0])
uriToLoad = window.arguments[0];
gIsLoadingBlank = uriToLoad == "about:blank";
if (!gIsLoadingBlank)
prepareForStartup();
//@line 756 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
if (uriToLoad && !gIsLoadingBlank) {
if (window.arguments.length >= 3)
loadURI(uriToLoad, window.arguments[2], window.arguments[3] || null,
window.arguments[4] || false);
else
loadOneOrMoreURIs(uriToLoad);
}
//@line 765 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
var sidebarSplitter;
if (window.opener && !window.opener.closed) {
if (window.opener.gFindBar && window.opener.gFindBar.mFindMode == FIND_NORMAL) {
var openerFindBar = window.opener.document.getElementById("FindToolbar");
if (openerFindBar && !openerFindBar.hidden)
gFindBar.openFindBar();
}
var openerSidebarBox = window.opener.document.getElementById("sidebar-box");
// The opener can be the hidden window too, if we're coming from the state
// where no windows are open, and the hidden window has no sidebar box.
if (openerSidebarBox && !openerSidebarBox.hidden) {
var sidebarBox = document.getElementById("sidebar-box");
var sidebarTitle = document.getElementById("sidebar-title");
sidebarTitle.setAttribute("value", window.opener.document.getElementById("sidebar-title").getAttribute("value"));
sidebarBox.setAttribute("width", openerSidebarBox.boxObject.width);
var sidebarCmd = openerSidebarBox.getAttribute("sidebarcommand");
sidebarBox.setAttribute("sidebarcommand", sidebarCmd);
sidebarBox.setAttribute("src", window.opener.document.getElementById("sidebar").getAttribute("src"));
gMustLoadSidebar = true;
sidebarBox.hidden = false;
sidebarSplitter = document.getElementById("sidebar-splitter");
sidebarSplitter.hidden = false;
document.getElementById(sidebarCmd).setAttribute("checked", "true");
}
}
else {
var box = document.getElementById("sidebar-box");
if (box.hasAttribute("sidebarcommand")) {
var commandID = box.getAttribute("sidebarcommand");
if (commandID) {
var command = document.getElementById(commandID);
if (command) {
gMustLoadSidebar = true;
box.hidden = false;
sidebarSplitter = document.getElementById("sidebar-splitter");
sidebarSplitter.hidden = false;
command.setAttribute("checked", "true");
}
else {
// Remove the |sidebarcommand| attribute, because the element it
// refers to no longer exists, so we should assume this sidebar
// panel has been uninstalled. (249883)
box.removeAttribute("sidebarcommand");
}
}
}
}
// Certain kinds of automigration rely on this notification to complete their
// tasks BEFORE the browser window is shown.
var obs = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
obs.notifyObservers(null, "browser-window-before-show", "");
// Set a sane starting width/height for all resolutions on new profiles.
if (!document.documentElement.hasAttribute("width")) {
var defaultWidth = 994, defaultHeight;
if (screen.availHeight <= 600) {
document.documentElement.setAttribute("sizemode", "maximized");
defaultWidth = 610;
defaultHeight = 450;
}
else {
// Create a narrower window for large or wide-aspect displays, to suggest
// side-by-side page view.
if ((screen.availWidth / 2) >= 800)
defaultWidth = (screen.availWidth / 2) - 20;
defaultHeight = screen.availHeight - 10;
//@line 849 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
}
document.documentElement.setAttribute("width", defaultWidth);
document.documentElement.setAttribute("height", defaultHeight);
}
setTimeout(RkioskdelayedStartup, 0);
}
function prepareForStartup()
{
gURLBar = document.getElementById("urlbar");
gURLBarContainer = document.getElementById("urlbar-container");
gNavigatorBundle = document.getElementById("bundle_browser");
gProgressMeterPanel = document.getElementById("statusbar-progresspanel");
gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false);
gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, true);
gBrowser.addEventListener("NewTab", BrowserOpenTab, false);
var webNavigation;
try {
// Create the browser instance component.
appCore = Components.classes["@mozilla.org/appshell/component/browser/instance;1"]
.createInstance(Components.interfaces.nsIBrowserInstance);
if (!appCore)
throw "couldn't create a browser instance";
webNavigation = getWebNavigation();
if (!webNavigation)
throw "no XBL binding for browser";
} catch (e) {
alert("Error launching browser window:" + e);
window.close(); // Give up.
return;
}
// initialize observers and listeners
// and give C++ access to gBrowser
window.XULBrowserWindow = new nsBrowserStatusHandler();
window.QueryInterface(nsCI.nsIInterfaceRequestor)
.getInterface(nsIWebNavigation)
.QueryInterface(nsCI.nsIDocShellTreeItem).treeOwner
.QueryInterface(nsCI.nsIInterfaceRequestor)
.getInterface(nsCI.nsIXULWindow)
.XULBrowserWindow = window.XULBrowserWindow;
window.QueryInterface(nsCI.nsIDOMChromeWindow).browserDOMWindow =
new nsBrowserAccess();
// set default character set if provided
if ("arguments" in window && window.arguments.length > 1 && window.arguments[1]) {
if (window.arguments[1].indexOf("charset=") != -1) {
var arrayArgComponents = window.arguments[1].split("=");
if (arrayArgComponents) {
//we should "inherit" the charset menu setting in a new window
getMarkupDocumentViewer().defaultCharacterSet = arrayArgComponents[1];
}
}
}
// Initialize browser instance..
appCore.setWebShellWindow(window);
// Manually hook up session and global history for the first browser
// so that we don't have to load global history before bringing up a
// window.
// Wire up session and global history before any possible
// progress notifications for back/forward button updating
webNavigation.sessionHistory = Components.classes["@mozilla.org/browser/shistory;1"]
.createInstance(Components.interfaces.nsISHistory);
var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
os.addObserver(gBrowser.browsers[0], "browser:purge-session-history", false);
// remove the disablehistory attribute so the browser cleans up, as
// though it had done this work itself
gBrowser.browsers[0].removeAttribute("disablehistory");
// enable global history
gBrowser.docShell.QueryInterface(Components.interfaces.nsIDocShellHistory).useGlobalHistory = true;
// hook up UI through progress listener
gBrowser.addProgressListener(window.XULBrowserWindow, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
// Initialize the feedhandler
FeedHandler.init();
// Initialize the searchbar
BrowserSearch.init();
}
function RkioskdelayedStartup()
{
var os = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
os.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
os.addObserver(gXPInstallObserver, "xpinstall-install-blocked", false);
if (!gPrefService)
gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
BrowserOffline.init();
if (gURLBar && document.documentElement.getAttribute("chromehidden").indexOf("toolbar") != -1) {
gURLBar.setAttribute("readonly", "true");
gURLBar.setAttribute("enablehistory", "false");
}
if (gIsLoadingBlank)
prepareForStartup();
if (gURLBar)
gURLBar.addEventListener("dragdrop", URLBarOnDrop, true);
gBrowser.addEventListener("pageshow", function(evt) { setTimeout(pageShowEventHandlers, 0, evt); }, true);
window.addEventListener("keypress", ctrlNumberTabSelection, false);
if (gMustLoadSidebar) {
var sidebar = document.getElementById("sidebar");
var sidebarBox = document.getElementById("sidebar-box");
sidebar.setAttribute("src", sidebarBox.getAttribute("src"));
}
gFindBar.initFindBar();
//@line 972 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
// add bookmark options to context menu for tabs
addBookmarkMenuitems();
initServices();
initBMService();
// now load bookmarks
BMSVC.readBookmarks();
var bt = document.getElementById("bookmarks-ptf");
if (bt) {
var btf = BMSVC.getBookmarksToolbarFolder().Value;
bt.ref = btf;
document.getElementById("bookmarks-chevron").ref = btf;
bt.database.AddObserver(BookmarksToolbarRDFObserver);
}
window.addEventListener("resize", BookmarksToolbar.resizeFunc, false);
document.getElementById("PersonalToolbar")
.controllers.appendController(BookmarksMenuController);
//@line 996 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
// called when we go into full screen, even if it is
// initiated by a web page script
window.addEventListener("fullscreen", onFullScreen, true);
var element;
if (gIsLoadingBlank && gURLBar && !gURLBar.hidden &&
!gURLBarContainer.parentNode.collapsed)
element = gURLBar;
else
element = content;
// This is a redo of the fix for jag bug 91884
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Components.interfaces.nsIWindowWatcher);
if (window == ww.activeWindow) {
element.focus();
} else {
// set the element in command dispatcher so focus will restore properly
// when the window does become active
if (element instanceof Components.interfaces.nsIDOMWindow) {
document.commandDispatcher.focusedWindow = element;
document.commandDispatcher.focusedElement = null;
} else if (element instanceof Components.interfaces.nsIDOMElement) {
document.commandDispatcher.focusedWindow = element.ownerDocument.defaultView;
document.commandDispatcher.focusedElement = element;
}
}
SetPageProxyState("invalid");
var toolbox = document.getElementById("navigator-toolbox");
toolbox.customizeDone = BrowserToolboxCustomizeDone;
// Set up Sanitize Item
gSanitizeListener = new SanitizeListener();
var pbi = gPrefService.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
// Enable/Disable URL Bar Auto Fill
gURLBarAutoFillPrefListener = new URLBarAutoFillPrefListener();
pbi.addObserver(gURLBarAutoFillPrefListener.domain, gURLBarAutoFillPrefListener, false);
// Enable/Disable auto-hide tabbar
gAutoHideTabbarPrefListener = new AutoHideTabbarPrefListener();
pbi.addObserver(gAutoHideTabbarPrefListener.domain, gAutoHideTabbarPrefListener, false);
// Enable/Disable Go button
gGoButtonPrefListener = new GoButtonPrefListener();
pbi.addObserver(gGoButtonPrefListener.domain, gGoButtonPrefListener, false);
pbi.addObserver(gHomeButton.prefDomain, gHomeButton, false);
gHomeButton.updateTooltip();
gClickSelectsAll = gPrefService.getBoolPref("browser.urlbar.clickSelectsAll");
if (gURLBar)
gURLBar.clickSelectsAll = gClickSelectsAll;
//@line 1055 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
// Perform default browser checking (after window opens).
var shell = getShellService();
if (shell) {
var shouldCheck = shell.shouldCheckDefaultBrowser;
var willRestoreSession = false;
try {
var ss = Cc["@mozilla.org/browser/sessionstartup;1"].
getService(Ci.nsISessionStartup);
willRestoreSession = ss.doRestore();
}
catch (ex) { /* never mind; suppose SessionStore is broken */ }
if (shouldCheck && !shell.isDefaultBrowser(true) && !willRestoreSession) {
var brandBundle = document.getElementById("bundle_brand");
var shellBundle = document.getElementById("bundle_shell");
var brandShortName = brandBundle.getString("brandShortName");
var promptTitle = shellBundle.getString("setDefaultBrowserTitle");
var promptMessage = shellBundle.getFormattedString("setDefaultBrowserMessage",
[brandShortName]);
var checkboxLabel = shellBundle.getFormattedString("setDefaultBrowserDontAsk",
[brandShortName]);
const IPS = Components.interfaces.nsIPromptService;
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(IPS);
var checkEveryTime = { value: shouldCheck };
var rv = ps.confirmEx(window, promptTitle, promptMessage,
(IPS.BUTTON_TITLE_YES * IPS.BUTTON_POS_0) +
(IPS.BUTTON_TITLE_NO * IPS.BUTTON_POS_1),
null, null, null, checkboxLabel, checkEveryTime);
if (rv == 0)
shell.setDefaultBrowser(true, false);
shell.shouldCheckDefaultBrowser = checkEveryTime.value;
}
}
//@line 1090 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
// BiDi UI
gBidiUI = isBidiEnabled();
if (gBidiUI) {
document.getElementById("documentDirection-separator").hidden = false;
document.getElementById("documentDirection-swap").hidden = false;
document.getElementById("textfieldDirection-separator").hidden = false;
document.getElementById("textfieldDirection-swap").hidden = false;
}
//@line 1106 "/cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-release/WINNT_5.2_Depend/mozilla/browser/base/content/browser.js"
// Initialize the microsummary service by retrieving it, prompting its factory
// to create its singleton, whose constructor initializes the service.
Cc["@mozilla.org/microsummary/service;1"].getService(Ci.nsIMicrosummaryService);
// initialize the session-restore service (in case it's not already running)
if (document.documentElement.getAttribute("windowtype") == "navigator:browser") {
try {
var ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
ss.init(window);
} catch(ex) {
dump("nsSessionStore could not be initialized: " + ex + "\n");
}
}
BrowserFullScreen();
// browser-specific tab augmentation
AugmentTabs.init();
}