Mozile (xhtml editing in your browser)    




A "warning" dialog for the Mozile Extension which allows the user to choose whether or not to enhance the Mozile editor on a given page.

Version: 0.7

Author: James A. Overton

Method Summary
static void mozileRemovePref(pref, value)
static void mozileWarningAccept()
static void mozileWarningInit()

<?xml version="1.0" encoding="UTF-8"?>

/* ***** BEGIN LICENSE BLOCK *****
 * Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
 * Full Terms at
 * 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 James A. Overton's code (
 * The Initial Developer of the Original Code is James A. Overton.
 * Portions created by the Initial Developer are Copyright (C) 2005-2006
 * the Initial Developer. All Rights Reserved.
 * Contributor(s):
 *	James A. Overton <>
 * ***** END LICENSE BLOCK ***** */

 * @fileoverview A "warning" dialog for the Mozile Extension which allows the user to choose whether or not to enhance the Mozile editor on a given page.
 * @link 
 * @author James A. Overton <>
 * @version 0.7

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mozile/content/core/interface.css" type="text/css"?>
<dialog xmlns=""
        title="Mozile Warning"
  	  	onload="this.moveToAlertPosition(); this.sizeToContent(); mozileWarningInit()"

	<script type="application/x-javascript">'UniversalXPConnect');

	var mozilePrefs = Components.classes[';1'].getService(Components.interfaces.nsIPrefService).getBranch(null);	
	var host = window.arguments[0];

	function mozileWarningInit() {
		var trustedSite = document.getElementById("trustedSite");
		var autoEnhanceSite = document.getElementById("autoEnhanceSite");
		if(host) {
			trustedSite.label = trustedSite.label.replace("this web site", host);
			autoEnhanceSite.label = autoEnhanceSite.label.replace("this web site", host);
		if(window.arguments[1]) {
			autoEnhanceSite.checked = window.arguments[1];
	function mozileWarningAccept() {
		var trustedSite = document.getElementById("trustedSite");
		if(trustedSite.checked) mozileSetPref("mozile.trustedSites", host);
		else mozileRemovePref("mozile.trustedSites", host);
		var autoEnhanceSite = document.getElementById("autoEnhanceSite");
		if(autoEnhanceSite.checked) mozileSetPref("mozile.autoEnhanceSites", host);
		else mozileRemovePref("mozile.autoEnhanceSites", host);
		var neverWarn = document.getElementById("neverWarn");
		if(neverWarn.checked) mozilePrefs.setBoolPref("mozile.neverWarn", true);
	function mozileSetPref(pref, value) {	
		var prefArray = mozilePrefs.getCharPref(pref).split(";");
		prefArray = prefString.split(";");
		for(var i=0; i &lt; prefArray.length; i++) {
			if(value == prefArray[i]) return;
		mozilePrefs.setCharPref(pref, prefArray.join(";"));
	function mozileRemovePref(pref, value) {	
		var prefArray = mozilePrefs.getCharPref(pref).split(";");
		for(var i=0; i &lt; prefArray.length; i++) {
			if(value == prefArray[i]) prefArray[i]=undefined;
		mozilePrefs.setCharPref(pref, prefArray.join(";"));

	<hbox class="header">
		<label value="Mozile Warning" />
		<description>Mozile can enhance Mozile editors in pages on the World Wide Web. Enhancements include access to the system clipboard, and saving files on the local computer. There is a security risk when a page is enhanced. Only enhance pages that you trust.</description>
		<checkbox id="trustedSite" label="Always trust this web site." checked="false"/>
		<checkbox id="autoEnhanceSite" label="Automatically enhance when editing this web site." checked="false"/>
		<checkbox id="neverWarn" label="Do not show warnings." checked="false"/>


Documentation generated by JSDoc on Wed Nov 1 15:11:15 2006

The mozile project can be contacted through the mailing list or the member list.
Copyright © 2000-2020. All rights reserved. Terms of Use & Privacy Policy.