gecko-dev/suite/common/pref/pref-history.xul

154 строки
5.5 KiB
Plaintext
Исходник Обычный вид История

<?xml version="1.0"?>
<!--
The contents of this file are subject to the Netscape 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/NPL/
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 Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s):
Jason Eager <jce2@po.cwru.edu>
-->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/dialogOverlay.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://communicator/locale/pref/pref-history.dtd" >
<window xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="color-dialog"
orient="vertical"
onload="parent.initPanel('chrome://communicator/content/pref/pref-history.xul');">
<script type="application/x-javascript">
<![CDATA[
var _elementIDs = ["histDay", "shistMax"];
function Startup()
{
parent.hPrefWindow.registerOKCallbackFunc(onHistoryOK);
var button = document.getElementById("ClearUrlBarHistoryButton");
try {
var urlBarHist = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
.getService(Components.interfaces.nsIUrlbarHistory);
var isBtnLocked = parent.hPrefWindow.getPrefIsLocked(button.getAttribute("prefstring"));
button.disabled = ( urlBarHist.count == 0 ) || isBtnLocked ;
}
catch(ex) {
}
}
function onHistoryOK()
{
var data = parent.hPrefWindow.wsm.dataManager.pageData["chrome://communicator/content/pref/pref-history.xul"];
var panelIsShown = ("GetSHistValue" in window);
var maxSize = data['shistMax'].value;
if (panelIsShown)
maxSize = GetSHistValue();
if (maxSize < 0) {
// set the pref to 0 so the UI reflects the proper value
if (panelIsShown)
document.getElementById("shistMax").value = "0";
else
data['shistMax'].value = "0";
maxSize = 0;
}
try {
var SHistory = Components.classes["@mozilla.org/browser/shistory;1"]
.getService(Components.interfaces.nsISHistory);
SHistory.maxLength = maxSize;
}
catch (ex) {
}
}
function GetSHistValue() {
return document.getElementById('shistMax').value;
}
function prefClearGlobalHistory()
{
var globalHistory = Components.classes["@mozilla.org/browser/global-history;1"]
.getService(Components.interfaces.nsIBrowserHistory);
globalHistory.removeAllPages();
}
function prefClearUrlbarHistory()
{
var button = document.getElementById("ClearUrlBarHistoryButton");
var urlBarHistory = Components.classes["@mozilla.org/browser/urlbarhistory;1"]
.getService(Components.interfaces.nsIUrlbarHistory);
urlBarHistory.clearHistory();
button.setAttribute("disabled","true");
}
]]>
</script>
<hbox class="box-smallheader" title="&lHeader;"/>
<!-- history -->
<groupbox orient="vertical">
<caption label="&header3.label;"/>
<html>&historyPages.label;</html>
<hbox align="center">
<text class="label" value="&pageHis.label;" accesskey="&pageHis.accesskey;" for="histDay"/>
<textbox id="histDay" size="3" wsm_persist="true"
pref="true" preftype="int" prefstring="browser.history_expire_days"
prefattribute="value"/>
<text class="label" value="&days.label;"/>
<spacer flex="1"/>
<button class="dialog" label="&clearHistory.label;" accesskey="&clearHistory.accesskey;"
oncommand="prefClearGlobalHistory();"
id="browserClearHistory" pref="true" preftype="bool"
prefstring="pref.browser.history.disable_button.clear_hist" prefattribute="disabled"/>
</hbox>
</groupbox>
<!-- no honey, I haven't been viewing porn, honest! -->
<groupbox orient="vertical">
<caption label="&locationBarHistory.label;"/>
<hbox align="center">
<html flex="1">&clearLocationBar.label;</html>
<hbox align="center" pack="end">
<button class="dialog" id="ClearUrlBarHistoryButton" label="&clearLocationBarButton.label;" accesskey="&clearLocationBarButton.accesskey;"
oncommand="prefClearUrlbarHistory();"
pref="true" preftype="bool"
prefstring="pref.browser.history.disable_button.clear_urlbar" prefattribute="disabled"/>
</hbox>
</hbox>
</groupbox>
<!-- Session History -->
<groupbox orient="vertical">
<caption label="&shistory.label;"/>
<html>&shistoryDescription1.label;</html>
<hbox align="center">
<text class="label" value="&shistoryDescription2.label;" accesskey="&shistory.accesskey;" for="shistMax"/>
<textbox id="shistMax" size="3" wsm_persist="true"
pref="true" preftype="int" prefstring="browser.sessionhistory.max_entries"
prefattribute="value"/>
<spacer flex="1"/>
</hbox>
</groupbox>
</window>