mozdev.org

Mozile (xhtml editing in your browser)    

resources:
Overview

loader.js

Summary

This file configures the loading of Mozile into the Mozile Extensions. It is identical to "mozile.js" except for the settings.

Version: 0.7

Author: James A. Overton


/* ***** BEGIN LICENSE BLOCK *****
 * Licensed under Version: MPL 1.1/GPL 2.0/LGPL 2.1
 * Full Terms at http://mozile.mozdev.org/license2.html
 *
 * 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 (james@overton.ca).
 *
 * 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 <james@overton.ca>
 *
 * ***** END LICENSE BLOCK ***** */

/** 
 * @fileoverview This file configures the loading of Mozile into the Mozile Extensions. It is identical to "mozile.js" except for the settings.
 * @link http://mozile.mozdev.org 
 * @author James A. Overton <james@overton.ca>
 * @version 0.7
 */


/**** INSTRUCTIONS ****/

/**
 * This file allows you to configure how Mozile will operate in your webpages.
 * There are two sections to this file:
 *   - Configuration
 *   - Initialization
 * In order for Mozile to function, you will likely have to change
 * the Configuration options.
 * You probably should NOT change anything in the Initialization section.
 */



/**** CONFIGURATION ****/


var mozileScriptSource = "chrome://mozile/content/";
var mozileOptions = "warnBeforeUnload=false";
var mozileInterface = true; // Load interface code.
var mozileModules = [
		//"UnwantedModule",
		"UndoRedo",
		"CopyCutPaste: requestPrivileges=false",
		"XHTMLBasic",
		"LocalFile: default=true",
		"HTTPPost",
]; // end of mozileModules array
var XHTMLNS = "http://www.w3.org/1999/xhtml";



/**** END OF CONFIGURATION ****/



/**
 * Mozile Configuration
 * This function creates the main Mozile object and loads the modules.
 */
// Do not edit the following line.
function mozileConfiguration() {
	mozile.load();

/**** COMMANDS ****/

// mozile.createEditor("someElementId","");
//mozile.createEditors(".editor","");
// mozile.replaceTextarea("someTextareaId");

/**** END OF COMMANDS ****/


} // end of mozileConfiguration()





/*********** DO NOT EDIT BELOW THIS LINE ***********/
/**** (unless you really know what you're doing) ****/





/**** INITIALIZATION ****/

/**
 * Mozile Initialization
 * This function inserts a <script> tag into the document. The <script> tag load the core.js JavaScript file, which makes Mozile work. Once core.js is loaded, it will call the mozileConfiguration() function above, while will continue the loading process.
 */
function mozileInitialization() {

/**
 * Browser Detection
 * Mozile only works in Mozilla browsers: Firefox and Mozilla (Seamonkey). Although Apple's Safari browser might report that it is Gecko compatible, it does not include all the necessary functionality for Mozile, so it is not supported.
 */
	if((navigator.product == 'Gecko') && (navigator.userAgent.indexOf("Safari") == -1))
	{
		
		// If no mozileScriptSource is given, try to get the src attribute of the script tag in the original document which points to this file.
		if(mozileScriptSource=="") {
			var mozileRE = /(.*)mozile.js$/;
			var source, result;
			var scripts = document.getElementsByTagName("script");
			for(var i=0; i<scripts.length; i++) {
				source = scripts[i].getAttribute("src");
				result = mozileRE.exec(source);
				if(result && result[1]) {
					mozileScriptSource = result[1] + "../";
					break;
				}
			}
		}		
		
		// Build the script tag
		var scriptTag = document.createElementNS(XHTMLNS,"script");
		scriptTag.setAttribute("id","Mozile-Core-core.js");
		scriptTag.setAttribute("type","application/x-javascript");
		scriptTag.setAttribute("src", mozileScriptSource +"core/core.js");
			
		// For HTML insert the tag in the head, otherwise at the beginning of the documentElement
		if(document.documentElement.tagName.toLowerCase() == "html") document.getElementsByTagName("head")[0].appendChild(scriptTag);
		else document.documentElement.insertBefore(scriptTag,document.documentElement.firstChild);
	
		// core.js should now load when this script is finished running

	}

	// If the browser detection fails, throw an error. 
	// TODO; It might be better to die silently.
	else {
		alert("Mozile Error: This browser is not supported! Only Mozilla and Mozilla Firefox browsers are currently supported.");
	}

} // end of mozileInitialization()


// Finally, call the initialization function.
mozileInitialization();


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-2019. All rights reserved. Terms of Use & Privacy Policy.