app/soc/content/js/melange-091015.js
author Daniel Hans <Daniel.M.Hans@gmail.com>
Mon, 02 Nov 2009 23:38:43 +0100
changeset 3074 ebda36efbd61
parent 3039 14194c0b3cd1
permissions -rw-r--r--
HtmlSanitizer becomes Python 2.6 compatible. The Cleaner class must not have any arguments when calling __init__ function for the object class, because in this case Python 2.6 raises TypeError (while previous versions just ignored them).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3039
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     1
/* Copyright 2009 the Melange authors.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     2
 *
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     3
 * Licensed under the Apache License, Version 2.0 (the "License");
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     4
 * you may not use this file except in compliance with the License.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     5
 * You may obtain a copy of the License at
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     6
 *
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     7
 *   http://www.apache.org/licenses/LICENSE-2.0
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     8
 *
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
     9
 * Unless required by applicable law or agreed to in writing, software
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    10
 * distributed under the License is distributed on an "AS IS" BASIS,
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    11
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    12
 * See the License for the specific language governing permissions and
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    13
 * limitations under the License.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    14
 */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    15
/**
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    16
 * @author <a href="mailto:fadinlight@gmail.com">Mario Ferraro</a>
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    17
 */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    18
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    19
(function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    20
  /** @lends melange */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    21
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    22
  /** General melange package.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    23
    * @name melange
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    24
    * @namespace melange
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    25
    */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    26
  var melange = window.melange = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    27
    return new melange();
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    28
  };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    29
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    30
  if (window.jQuery === undefined) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    31
    throw new Error("jQuery package must be loaded exposing jQuery namespace");
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    32
  }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    33
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    34
  if (window.JSON === undefined) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    35
    throw new Error("json2 package must be loaded exposing JSON namespace");
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    36
  }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    37
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    38
  /** Shortcut to current package.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    39
    * @private
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    40
    */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    41
  var $m = melange;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    42
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    43
  /** Contains general configuration for melange package.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    44
    * @variable
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    45
    * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    46
    * @name melange.config
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    47
    */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    48
  $m.config = {};
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    49
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    50
  (function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    51
    var configuration =
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    52
      jQuery("script[melangeConfig][src$='melange.js']").attr("melangeConfig");
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    53
    if (configuration) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    54
      var configuration_object = JSON.parse("{ " + configuration + " }");
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    55
      jQuery.extend($m.config, configuration_object);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    56
    }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    57
  }());
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    58
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    59
  /** Shortcut to clone objects using jQuery.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    60
    * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    61
    * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    62
    * @name melange.clone
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    63
    * @param {Object} object the object to clone
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    64
    * @returns {Object} a new, cloned object
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    65
    */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    66
  $m.clone = function (object) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    67
    // clone object, see
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    68
    // http://stackoverflow.com/questions/122102/
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    69
    // what-is-the-most-efficent-way-to-clone-a-javascript-object
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    70
    return jQuery.extend(true, {}, object);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    71
  };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    72
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    73
  /** Set melange general options.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    74
    * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    75
    * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    76
    * @name melange.setOptions
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    77
    * @param {Object} options Options to set/unset
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    78
    */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    79
  $m.setOptions = function (options) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    80
    switch (options.debug) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    81
    case true:
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    82
      $m.logging.setDebug();
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    83
      break;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    84
    case false:
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    85
      $m.logging.unsetDebug();
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    86
      break;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    87
    default:
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    88
      $m.logging.setDebug();
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    89
    }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    90
    if (options.debugLevel) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    91
      $m.logging.setDebugLevel(options.debugLevel);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    92
    }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    93
  };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    94
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    95
  /** Facility to load google API.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    96
    * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    97
    * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    98
    * @name melange.loadGoogleApi
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
    99
    * @param {String} modulename Google Ajax module to load
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   100
    * @param {String|Number} moduleversion Google Ajax module version to load
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   101
    * @param {Object} settings Google Ajax settings for the module
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   102
    * @param {Function} callback to be called as soon as module is loaded
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   103
    */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   104
  $m.loadGoogleApi = function (modulename, moduleversion, settings, callback) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   105
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   106
    if (!modulename || !moduleversion) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   107
      throw new TypeError("modulename must be defined");
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   108
    }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   109
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   110
    /** Options to be sent to google.load constructor
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   111
      * @private
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   112
      * @name melange.loadGoogleApi.options
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   113
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   114
    var options = {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   115
      name : modulename,
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   116
      version : moduleversion,
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   117
      settings : settings
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   118
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   119
    jQuery.extend(options.settings, {callback: callback});
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   120
    google.load(options.name, options.version, options.settings);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   121
  };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   122
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   123
  (function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   124
    /** @lends melange.error */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   125
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   126
    /** Package that handles melange errors
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   127
      * @namespace melange.error
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   128
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   129
    melange.error = window.melange.error = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   130
      return new melange.error();
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   131
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   132
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   133
    /** Shortcut to current package.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   134
      * @property
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   135
      * @private
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   136
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   137
    var $m = melange.error;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   138
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   139
    /** List of default custom error types to be created.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   140
      * @property
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   141
      * @private
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   142
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   143
    var error_types = [
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   144
      "DependencyNotSatisfied",
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   145
      "notImplementedByChildClass"
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   146
    ];
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   147
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   148
    /** Create errors
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   149
      * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   150
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   151
      * @name melange.error.createErrors
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   152
      * @param {String[]} error_types Array of strings with errors names
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   153
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   154
    $m.createErrors = function (error_types) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   155
      jQuery.each(error_types, function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   156
        melange.error[this] = Error;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   157
      });
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   158
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   159
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   160
    $m.createErrors(error_types);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   161
  }());
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   162
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   163
  (function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   164
    /** @lends melange.logging */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   165
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   166
    /** Package that contains all log related functions.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   167
      * @name melange.logging
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   168
      * @namespace melange.logging
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   169
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   170
    melange.logging = window.melange.logging = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   171
      return new melange.logging();
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   172
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   173
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   174
    /** Shortcut to current package.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   175
      * @property
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   176
      * @private
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   177
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   178
    var $m = melange.logging;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   179
    /** @private */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   180
    var debug = false;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   181
    /** @private */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   182
    var current_debug_level = 5;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   183
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   184
    /** Set debug logging on.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   185
      * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   186
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   187
      * @name melange.logging.setDebug
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   188
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   189
    $m.setDebug = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   190
      debug = true;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   191
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   192
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   193
    /** Set debug logging off.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   194
      * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   195
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   196
      * @name melange.logging.unsetDebug
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   197
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   198
    $m.unsetDebug = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   199
      debug = false;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   200
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   201
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   202
    /** Check if debug is active.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   203
      * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   204
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   205
      * @name melange.logging.isDebug
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   206
      * @returns {boolean} true if debug is on, false otherwise
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   207
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   208
    $m.isDebug = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   209
      return debug ? true : false;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   210
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   211
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   212
    /** Set the current debug level.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   213
      * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   214
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   215
      * @name melange.logging.setDebugLevel
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   216
      * @param level The log level to set
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   217
      * @throws {TypeError} if the parameter given is not a number
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   218
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   219
    $m.setDebugLevel = function (level) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   220
      if (isNaN(level)) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   221
        throw new melange.error.TypeError(
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   222
          "melange.logging.setDebugLevel: parameter must be a number"
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   223
        );
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   224
      }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   225
      if (level <= 0) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   226
        level = 1;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   227
      }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   228
      if (level >= 6) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   229
        level = 5;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   230
      }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   231
      current_debug_level = level;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   232
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   233
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   234
    /** Get the current debug level.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   235
      * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   236
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   237
      * @name melange.logging.getDebugLevel
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   238
      * @returns {Number} The current debug level
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   239
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   240
    $m.getDebugLevel = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   241
      return current_debug_level;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   242
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   243
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   244
    /** A decorator for logging.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   245
      * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   246
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   247
      * @name melange.logging.debugDecorator
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   248
      * @param {Object} object_to_decorate The Function/Object to decorate
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   249
      * @returns {Object} Same object,decorated with log(level,message) func
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   250
    */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   251
    $m.debugDecorator = function (object_to_decorate) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   252
      /** Function to handle output of logs.
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   253
        * @function
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   254
        * @name melange.logging.debugDecorator.log
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   255
        * @param level The log level
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   256
        * @param message The string
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   257
        */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   258
      object_to_decorate.log = function (level, message) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   259
          if (melange.logging.isDebug() && current_debug_level >= level) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   260
            console.debug(message);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   261
          }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   262
        };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   263
      return object_to_decorate;
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   264
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   265
  }());
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   266
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   267
  (function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   268
    /** @lends melange.templates */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   269
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   270
    /** Package that provides basic templates functions
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   271
      * @name melange.templates
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   272
      * @namespace melange.templates
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   273
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   274
    melange.templates = window.melange.templates = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   275
      return new melange.templates();
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   276
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   277
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   278
    /** Shortcut to current package
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   279
      * @private
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   280
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   281
    var $m = melange.logging.debugDecorator(melange.templates);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   282
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   283
    melange.error.createErrors([
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   284
    ]);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   285
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   286
    /** Parent prototype for all templates
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   287
      * @class
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   288
      * @constructor
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   289
      * @name melange.templates._baseTemplate
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   290
      * @public
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   291
      */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   292
    $m._baseTemplate = function () {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   293
      this.context = {};
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   294
      var configuration = jQuery("script[melangeContext]")[0];
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   295
      if (configuration !== undefined) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   296
        configuration = jQuery(configuration).attr("melangeContext");
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   297
        if (configuration) {
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   298
          /* FIXME: json2 doesn't parse the object if they have k:"v" instead
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   299
             of "k":"v", but this is not what gviz outputs, we need to change
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   300
             gviz source or hack json2 source or use another method. eval()
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   301
             must be not used anyway
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   302
          */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   303
          /*jslint evil: true,undef: false */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   304
          eval("var configuration_object = " + configuration);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   305
          jQuery.extend(this.context, configuration_object);
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   306
          /*jslint evil: false,undef: true */
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   307
        }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   308
      }
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   309
    };
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   310
  }());
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   311
}());
14194c0b3cd1 General JavaScript utilities for melange.
Mario Ferraro <fadinlight@gmail.com>
parents:
diff changeset
   312
window.melange = window.melange.logging.debugDecorator(window.melange);