/* * Copyright (c) 2005-2007 * Authors: KSS Project Contributors (see doc/CREDITS.txt) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ /*global kukit, document, window */ kukit = new function() { /// MODULE START var ku = this; ku.isDevelMode = false; ;;; ku.isDevelMode = true; var _isKineticStylesheet = function(node) { var rel = node.rel; if (rel=="kinetic-stylesheet") { return true; } // BBB to be removed after 2008-02-17 if (rel=="kukit" || rel=="k-stylesheet") { ;;; var msg = node.href + ': rel "' + rel +'" is deprecated;'; ;;; msg = msg + ' use "kinetic-stylesheet" instead.'; ;;; kukit.logWarning(msg); return true; } return false; }; /* * class _RuleSheetLink */ var _RuleSheetLink = function(href, res_type) { this.href = href; this.res_type = res_type; }; /* * class Engine */ ku.Engine = function() { this.initialize = function() { this.documentRules = new kukit.rd.MethodTable(); // table from res_type to rule processor this._ruleProcessorClasses = {}; // register processor for type kss this._ruleProcessorClasses.kss = kukit.kssp.KssRuleProcessor; this._ruleProcessors = []; this.bindScheduler = new kukit.ut.SerializeScheduler(); // State vars storage. This can be used from kss via a method. this.stateVariables = {}; // instantiate request manager this.requestManager = new kukit.rm.RequestManager(); this.binderInfoRegistry = new kukit.er.BinderInfoRegistry(); // instantiate a load scheduler this.loadScheduler = new kukit.rd.LoadActions(); this.initializedOnDOMLoad = false; // setup events queuing, collect them at the end of commands this.setupEventsQueue = []; this.setupEventsInProgress = false; this.baseUrl = this.calculateBase(); }; this.calculateBase = function() { var base = ''; // returns empty base when not in browser (cli tests) try { var _dummy = document; _dummy = window; } catch (e) { // testing or what return base; } base = kukit.ut.calculateBase(document, window.location.href); return base; }; this.getRuleSheetLinks = function() { var nodes = document.getElementsByTagName("link"); var results = []; for (var i=0; i