<commit_before>/**
 * A HotspotDOM, to be displayed like a billboard. This hotspot provides a
 * single div positioned at the right position in the scene, without any
 * content in it and any deformation. It is up to the FORGE user to specify
 * those. Two things can be tweaked here: the displayObject property of this
 * hotspot, which is a {@link FORGE.DisplayObjectContainer}, and the DOM part
 * of this container, accessible through `displayObject.dom` or more directly
 * using the `dom` property on the object HotspotDOM.
 *
 * @constructor FORGE.HotspotDOM
 * @param {FORGE.Viewer} viewer - viewer reference
 * @param {HotspotConfig} config - hotspot configuration
 * @extends {FORGE.BaseObject}
 */
FORGE.HotspotDOM = function(viewer, config)
{
    /**
     * The viewer reference
     * @name FORGE.HotspotDOM#_viewer
     * @type {FORGE.Viewer}
     * @private
     */
    this._viewer = viewer;

    /**
     * Hotspot configuration
     * @name FORGE.HotspotDOM#_config
     * @type {HotspotConfig}
     * @private
     */
    this._config = config;

    /**
     * HotspotTransform object for the positioning and scaling (no rotation)
     * @name  FORGE.Hotspot3D#_transform
     * @type {FORGE.HotspotTransform}
     * @private
     */
    this._transform = null;

    /**
     * The HTML element composing the hotspot
     * @name FORGE.HotspotDOM#_dom
     * @type {Element|HTMLElement}
     * @private
     */
    this._dom = null;

    /**
     * Events object that will keep references of the ActionEventDispatcher
     * @name FORGE.HotspotDOM#_events
     * @type {Object<FORGE.ActionEventDispatcher>}
     * @private
     */
    this._events = null;

    FORGE.BaseObject.call(this, "HotspotDOM");

    this._boot();
};

FORGE.HotspotDOM.prototype = Object.create(FORGE.BaseObject.prototype);
FORGE.HotspotDOM.prototype.constructor = FORGE.HotspotDOM;

/**
 * @name FORGE.HotspotDOM.DEFAULT_CONFIG
 * @type {HotspotConfig}
 */
FORGE.HotspotDOM.DEFAULT_CONFIG =
{
    dom:
    {
        id: "hostpot-dom",
        width: 320,
        height: 240,
        color: "white",
        index: 10
    }
};

/**
 * Boot sequence.
 * @method FORGE.HotspotDOM#_boot
 * @private
 */
FORGE.HotspotDOM.prototype._boot = function()
{
    this._transform = new FORGE.HotspotTransform();

    this._events = {};

    this._parseConfig(this._config);
    this._register();

    this._viewer.renderer.view.onChange.add(this._viewChangeHandler, this);
};

/**
 * Parse the config object
 * @method FORGE.HotspotDOM#_parseConfig
 * @param {HotspotConfig} config - the hotspot config to parse
 * @private
 */
FORGE.HotspotDOM.prototype._parseConfig = function(config)
{
    config = /** @type {HotspotConfig} */ (FORGE.Utils.extendMultipleObjects(FORGE.HotspotDOM.DEFAULT_CONFIG, config));

    this._uid = config.uid;

    if (typeof config.events === "object" && config.events !== null)
    {
        this._createEvents(config.events);
    }

    var dom = config.dom;

    if (dom !== null && typeof dom !== "undefined")
    {
        var id;

        if (typeof dom.id === "string")
        {
            id = dom.id;
        }
        else
        {
            id = this._uid;
        }

        // get the already present hotspot in the dom, or create it
        var div = document.getElementById(id);

        if (div !== null)
        {
            this._dom = div;
        }
        else
        {
            this._dom = document.createElement("div");
            this._dom.id = id;
        }

        this._dom.classList.add("hotspot-dom");
        this._dom.style.position = "absolute";

        if (typeof dom.class === "string")
        {
            this._dom.classList.add(dom.class);
        }
        else if (Array.isArray(dom.class) === true)
        {
            for (var i = 0, ii = dom.class.length; i < ii; i++)
            {
                this._dom.classList.add(dom.class[i]);
            }
        }

        // basic CSS from json configuration
        var rule = "." + this._dom.id + "-basic-class {";

        if (typeof dom.width === "number")
        {
            rule += "width: " + dom.width + "px;";
        }
        else if (typeof dom.width === "string")
        {
            rule += "width: " + dom.width + ";";
        }

        if (typeof dom.height === "number")
        {
            rule += "height: " + dom.height + "px;";
        }
        else if (typeof dom.height === "string")
        {
            rule += "height: " + dom.height + ";";
        }

        if (typeof dom.color === "string")
        {
            rule += "background-color: " + dom.color + ";";
        }

        if (typeof dom.index === "number")
        {
            rule+= "z-index: " + dom.index + ";";
        }

        rule += "}";
        this._viewer.domHotspotStyle.sheet.insertRule(rule, 0);
        this._dom.classList.add(this._dom.id + "-basic-class");
    }

    this._dom.style.pointerEvents = "auto";
    this._dom.addEventListener("click", this._domClickHandler.bind(this));
    this._dom.addEventListener("mouseover", this._domOverHandler.bind(this));
    this._dom.addEventListener("mouseout", this._domOutHandler.bind(this));

    if (config.transform !== null && typeof config.transform !== "undefined")
    {
        this._transform.load(config.transform, false);
    }

    this.show();
};

FORGE.HotspotDOM.prototype._domClickHandler = function(event)
{
    // Actions defined from the json
    if(FORGE.Utils.isTypeOf(this._events.onClick, "ActionEventDispatcher") === true)
    {
        this._events.onClick.dispatch();
    }
};

FORGE.HotspotDOM.prototype._domOverHandler = function(event)
{
    // Actions defined from the json
    if(FORGE.Utils.isTypeOf(this._events.onOver, "ActionEventDispatcher") === true)
    {
        this._events.onOver.dispatch();
    }
};

FORGE.HotspotDOM.prototype._domOutHandler = function(event)
{
    // Actions defined from the json
    if(FORGE.Utils.isTypeOf(this._events.onOut, "ActionEventDispatcher") === true)
    {
        this._events.onOut.dispatch();
    }
};

/**
 * Create action events dispatchers.
 * @method FORGE.HotspotDOM#_createEvents
 * @private
 * @param {Object} events - The events config of the dom hotspot.
 */
FORGE.HotspotDOM.prototype._createEvents = function(events)
{
    var event;
    for(var e in events)
    {
        event = new FORGE.ActionEventDispatcher(this._viewer, e);
        event.addActions(events[e]);
        this._events[e] = event;
    }
};

/**
 * Clear all object events.
 * @method FORGE.HotspotDOM#_clearEvents
 * @private
 */
FORGE.HotspotDOM.prototype._clearEvents = function()
{
    for(var e in this._events)
    {
        this._events[e].destroy();
        this._events[e] = null;
    }
};

/**
 * Handles the changing view, as it can only be present in the Rectilinear view.
 * @method FORGE.HotspotDOM#_viewChangeHandler
 * @private
 */
FORGE.HotspotDOM.prototype._viewChangeHandler = function()
{
    this._dom.style.display = "block";

    if (this._viewer.view.type !== FORGE.ViewType.RECTILINEAR)
    {
        this._dom.style.display = "none";
    }
};

/**
 * Show the hotspot by appending it to the DOM container.
 * @method FORGE.HotspotDOM#show
 */
FORGE.HotspotDOM.prototype.show = function()
{
    this._viewer.domHotspotContainer.dom.appendChild(this._dom);
};

/**
 * Hide the hotspot by removing it to the DOM container.
 * @method FORGE.HotspotDOM#hide
 */
FORGE.HotspotDOM.prototype.hide = function()
{
    this._viewer.domHotspotContainer.dom.removeChild(this._dom, false);
};

/**
 * Update routine
 * @method FORGE.HotspotDOM#update
 */
FORGE.HotspotDOM.prototype.update = function()
{
    // get the screen position of the hotspots
    var position = this._viewer.view.worldToScreen(this._transform.position.values);

    if (position !== null)
    {
        var x = position.x - this._dom.clientWidth / 2;
        var y = position.y - this._dom.clientHeight / 2;
        this._dom.style.left = x + "px";
        this._dom.style.top = y + "px";
    }
    else
    {
        this._dom.style.left = "99999px";
        this._dom.style.top = "99999px";
    }
};

/**
 * Destroy routine
 * @method FORGE.HotspotDOM#destroy
 */
FORGE.HotspotDOM.prototype.destroy = function()
{
    this._dom = null;

    this._transform.destroy();
    this._transform = null;

    this._clearEvents();
    this._events = null;
};

/**
 * @name FORGE.HotspotDOM#dom
 * @readonly
 * @type {?Element|HTMLElement}
 */
Object.defineProperty(FORGE.HotspotDOM.prototype, "dom",
{
    /** @this {FORGE.HotspotDOM} */
    get: function()
    {
        return this._dom;
    }
});
<commit_msg>Fix HotspotDOM jscs and doc<commit_after>/**
 * A HotspotDOM, to be displayed like a billboard. This hotspot provides a
 * single div positioned at the right position in the scene, without any
 * content in it and any deformation. It is up to the FORGE user to specify
 * those. Two things can be tweaked here: the displayObject property of this
 * hotspot, which is a {@link FORGE.DisplayObjectContainer}, and the DOM part
 * of this container, accessible through `displayObject.dom` or more directly
 * using the `dom` property on the object HotspotDOM.
 *
 * @constructor FORGE.HotspotDOM
 * @param {FORGE.Viewer} viewer - viewer reference
 * @param {HotspotConfig} config - hotspot configuration
 * @extends {FORGE.BaseObject}
 */
FORGE.HotspotDOM = function(viewer, config)
{
    /**
     * The viewer reference
     * @name FORGE.HotspotDOM#_viewer
     * @type {FORGE.Viewer}
     * @private
     */
    this._viewer = viewer;

    /**
     * Hotspot configuration
     * @name FORGE.HotspotDOM#_config
     * @type {HotspotConfig}
     * @private
     */
    this._config = config;

    /**
     * HotspotTransform object for the positioning and scaling (no rotation)
     * @name  FORGE.Hotspot3D#_transform
     * @type {FORGE.HotspotTransform}
     * @private
     */
    this._transform = null;

    /**
     * The HTML element composing the hotspot
     * @name FORGE.HotspotDOM#_dom
     * @type {Element|HTMLElement}
     * @private
     */
    this._dom = null;

    /**
     * Events object that will keep references of the ActionEventDispatcher
     * @name FORGE.HotspotDOM#_events
     * @type {Object<FORGE.ActionEventDispatcher>}
     * @private
     */
    this._events = null;

    FORGE.BaseObject.call(this, "HotspotDOM");

    this._boot();
};

FORGE.HotspotDOM.prototype = Object.create(FORGE.BaseObject.prototype);
FORGE.HotspotDOM.prototype.constructor = FORGE.HotspotDOM;

/**
 * @name FORGE.HotspotDOM.DEFAULT_CONFIG
 * @type {HotspotConfig}
 */
FORGE.HotspotDOM.DEFAULT_CONFIG =
{
    dom:
    {
        id: "hostpot-dom",
        width: 320,
        height: 240,
        color: "white",
        index: 10
    }
};

/**
 * Boot sequence.
 * @method FORGE.HotspotDOM#_boot
 * @private
 */
FORGE.HotspotDOM.prototype._boot = function()
{
    this._transform = new FORGE.HotspotTransform();

    this._events = {};

    this._parseConfig(this._config);
    this._register();

    this._viewer.renderer.view.onChange.add(this._viewChangeHandler, this);
};

/**
 * Parse the config object
 * @method FORGE.HotspotDOM#_parseConfig
 * @param {HotspotConfig} config - the hotspot config to parse
 * @private
 */
FORGE.HotspotDOM.prototype._parseConfig = function(config)
{
    config = /** @type {HotspotConfig} */ (FORGE.Utils.extendMultipleObjects(FORGE.HotspotDOM.DEFAULT_CONFIG, config));

    this._uid = config.uid;

    if (typeof config.events === "object" && config.events !== null)
    {
        this._createEvents(config.events);
    }

    var dom = config.dom;

    if (dom !== null && typeof dom !== "undefined")
    {
        var id;

        if (typeof dom.id === "string")
        {
            id = dom.id;
        }
        else
        {
            id = this._uid;
        }

        // get the already present hotspot in the dom, or create it
        var div = document.getElementById(id);

        if (div !== null)
        {
            this._dom = div;
        }
        else
        {
            this._dom = document.createElement("div");
            this._dom.id = id;
        }

        this._dom.classList.add("hotspot-dom");
        this._dom.style.position = "absolute";

        if (typeof dom.class === "string")
        {
            this._dom.classList.add(dom.class);
        }
        else if (Array.isArray(dom.class) === true)
        {
            for (var i = 0, ii = dom.class.length; i < ii; i++)
            {
                this._dom.classList.add(dom.class[i]);
            }
        }

        // basic CSS from json configuration
        var rule = "." + this._dom.id + "-basic-class {";

        if (typeof dom.width === "number")
        {
            rule += "width: " + dom.width + "px;";
        }
        else if (typeof dom.width === "string")
        {
            rule += "width: " + dom.width + ";";
        }

        if (typeof dom.height === "number")
        {
            rule += "height: " + dom.height + "px;";
        }
        else if (typeof dom.height === "string")
        {
            rule += "height: " + dom.height + ";";
        }

        if (typeof dom.color === "string")
        {
            rule += "background-color: " + dom.color + ";";
        }

        if (typeof dom.index === "number")
        {
            rule+= "z-index: " + dom.index + ";";
        }

        rule += "}";
        this._viewer.domHotspotStyle.sheet.insertRule(rule, 0);
        this._dom.classList.add(this._dom.id + "-basic-class");
    }

    this._dom.style.pointerEvents = "auto";
    this._dom.addEventListener("click", this._domClickHandler.bind(this));
    this._dom.addEventListener("mouseover", this._domOverHandler.bind(this));
    this._dom.addEventListener("mouseout", this._domOutHandler.bind(this));

    if (config.transform !== null && typeof config.transform !== "undefined")
    {
        this._transform.load(config.transform, false);
    }

    this.show();
};

/**
 * DOM click handler
 * @method FORGE.HotspotDOM#_domClickHandler
 * @private
 */
FORGE.HotspotDOM.prototype._domClickHandler = function()
{
    // Actions defined from the json
    if(FORGE.Utils.isTypeOf(this._events.onClick, "ActionEventDispatcher") === true)
    {
        this._events.onClick.dispatch();
    }
};

/**
 * DOM over handler
 * @method FORGE.HotspotDOM#_domOverHandler
 * @private
 */
FORGE.HotspotDOM.prototype._domOverHandler = function()
{
    // Actions defined from the json
    if(FORGE.Utils.isTypeOf(this._events.onOver, "ActionEventDispatcher") === true)
    {
        this._events.onOver.dispatch();
    }
};

/**
 * DOM out handler
 * @method FORGE.HotspotDOM#_domOutHandler
 * @private
 */
FORGE.HotspotDOM.prototype._domOutHandler = function()
{
    // Actions defined from the json
    if(FORGE.Utils.isTypeOf(this._events.onOut, "ActionEventDispatcher") === true)
    {
        this._events.onOut.dispatch();
    }
};

/**
 * Create action events dispatchers.
 * @method FORGE.HotspotDOM#_createEvents
 * @private
 * @param {Object} events - The events config of the dom hotspot.
 */
FORGE.HotspotDOM.prototype._createEvents = function(events)
{
    var event;
    for(var e in events)
    {
        event = new FORGE.ActionEventDispatcher(this._viewer, e);
        event.addActions(events[e]);
        this._events[e] = event;
    }
};

/**
 * Clear all object events.
 * @method FORGE.HotspotDOM#_clearEvents
 * @private
 */
FORGE.HotspotDOM.prototype._clearEvents = function()
{
    for(var e in this._events)
    {
        this._events[e].destroy();
        this._events[e] = null;
    }
};

/**
 * Handles the changing view, as it can only be present in the Rectilinear view.
 * @method FORGE.HotspotDOM#_viewChangeHandler
 * @private
 */
FORGE.HotspotDOM.prototype._viewChangeHandler = function()
{
    this._dom.style.display = "block";

    if (this._viewer.view.type !== FORGE.ViewType.RECTILINEAR)
    {
        this._dom.style.display = "none";
    }
};

/**
 * Show the hotspot by appending it to the DOM container.
 * @method FORGE.HotspotDOM#show
 */
FORGE.HotspotDOM.prototype.show = function()
{
    this._viewer.domHotspotContainer.dom.appendChild(this._dom);
};

/**
 * Hide the hotspot by removing it to the DOM container.
 * @method FORGE.HotspotDOM#hide
 */
FORGE.HotspotDOM.prototype.hide = function()
{
    this._viewer.domHotspotContainer.dom.removeChild(this._dom, false);
};

/**
 * Update routine
 * @method FORGE.HotspotDOM#update
 */
FORGE.HotspotDOM.prototype.update = function()
{
    // get the screen position of the hotspots
    var position = this._viewer.view.worldToScreen(this._transform.position.values);

    if (position !== null)
    {
        var x = position.x - this._dom.clientWidth / 2;
        var y = position.y - this._dom.clientHeight / 2;
        this._dom.style.left = x + "px";
        this._dom.style.top = y + "px";
    }
    else
    {
        this._dom.style.left = "99999px";
        this._dom.style.top = "99999px";
    }
};

/**
 * Destroy routine
 * @method FORGE.HotspotDOM#destroy
 */
FORGE.HotspotDOM.prototype.destroy = function()
{
    this._dom = null;

    this._transform.destroy();
    this._transform = null;

    this._clearEvents();
    this._events = null;
};

/**
 * @name FORGE.HotspotDOM#dom
 * @readonly
 * @type {?Element|HTMLElement}
 */
Object.defineProperty(FORGE.HotspotDOM.prototype, "dom",
{
    /** @this {FORGE.HotspotDOM} */
    get: function()
    {
        return this._dom;
    }
});
<|endoftext|>


<commit_before>module.exports = {

//---------------------------------------------------------------------
// Action Name
//
// This is the name of the action displayed in the editor.
//---------------------------------------------------------------------

name: "Check Variable",

//---------------------------------------------------------------------
// Action Section
//
// This is the section the action will fall into.
//---------------------------------------------------------------------

section: "Conditions",

//---------------------------------------------------------------------
// Action Subtitle
//
// This function generates the subtitle displayed next to the name.
//---------------------------------------------------------------------

subtitle: function(data) {
	const results = ["Continue Actions", "Stop Action Sequence", "Jump To Action", "Jump Forward Actions"];
	return `If True: ${results[parseInt(data.iftrue)]} ~ If False: ${results[parseInt(data.iffalse)]}`;
},

//---------------------------------------------------------------------
	 // DBM Mods Manager Variables (Optional but nice to have!)
	 //
	 // These are variables that DBM Mods Manager uses to show information
	 // about the mods for people to see in the list.
	 //---------------------------------------------------------------------

	 // Who made the mod (If not set, defaults to "DBM Mods")
	 author: "DBM, EGGSY & MrGold", //UI fixed by MrGold

	 // The version of the mod (Defaults to 1.0.0)
	 version: "1.9.4", //Added in 1.9.1

	 // A short description to show on the mod line for this mod (Must be on a single line)
	 short_description: "Added more options to default action.",

	 // If it depends on any other mods by name, ex: WrexMODS if the mod uses something from WrexMods

	 //---------------------------------------------------------------------

//---------------------------------------------------------------------
// Action Fields
//
// These are the fields for the action. These fields are customized
// by creating elements with corresponding IDs in the HTML. These
// are also the names of the fields stored in the action's JSON data.
//---------------------------------------------------------------------

fields: ["storage", "varName", "comparison", "value", "iftrue", "iftrueVal", "iffalse", "iffalseVal"],

//---------------------------------------------------------------------
// Command HTML
//
// This function returns a string containing the HTML used for
// editting actions.
//
// The "isEvent" parameter will be true if this action is being used
// for an event. Due to their nature, events lack certain information,
// so edit the HTML to reflect this.
//
// The "data" parameter stores constants for select elements to use.
// Each is an array: index 0 for commands, index 1 for events.
// The names are: sendTargets, members, roles, channels,
//                messages, servers, variables
//---------------------------------------------------------------------

html: function(isEvent, data) {
	return `

This action has been modified by DBM Mods.

		Source Variable:

		<select id="storage" class="round" onchange="glob.refreshVariableList(this)">
			${data.variables[1]}
		</select>

		Variable Name:

		<input id="varName" class="round" type="text" list="variableList">

		Comparison Type:

		<select id="comparison" class="round" onchange="glob.onChange1(this)">
			<option value="0" selected>Exists</option>
			<option value="1">Equals</option>
			<option value="2">Equals Exactly</option>
			<option value="3">Less Than</option>
			<option value="4">Greater Than</option>
			<option value="5">Includes</option>
			<option value="6">Matches Regex</option>
			<option value="7">Length is Bigger Than</option>
			<option value="8">Length is Smaller Than</option>
			<option value="9">Length Equals</option>
			<option value="10">Starts With</option>
			<option value="11">Ends With</option>
		</select>

		Value to Compare to:

		<input id="value" class="round" type="text" name="is-eval">

	${data.conditions[0]}

`
},

//---------------------------------------------------------------------
// Action Editor Init Code
//
// When the HTML is first applied to the action editor, this code
// is also run. This helps add modifications or setup reactionary
// functions for the DOM elements.
//---------------------------------------------------------------------

init: function() {
	const {glob, document} = this;

	glob.onChange1 = function(event) {
		if(event.value === "0") {
			document.getElementById("directValue").style.display = 'none';
		} else {
			document.getElementById("directValue").style.display = null;
		}
	};

	glob.onChange1(document.getElementById('comparison'));
	glob.refreshVariableList(document.getElementById('storage'));
	glob.onChangeTrue(document.getElementById('iftrue'));
	glob.onChangeFalse(document.getElementById('iffalse'));
},

//---------------------------------------------------------------------
// Action Bot Function
//
// This is the function for the action within the Bot's Action class.
// Keep in mind event calls won't have access to the "msg" parameter,
// so be sure to provide checks for variable existance.
//---------------------------------------------------------------------

action: function(cache) {
	const data = cache.actions[cache.index];
	const type = parseInt(data.storage);
	const varName = this.evalMessage(data.varName, cache);
	const variable = this.getVariable(type, varName, cache);
	let result = false;
	if(variable) {
		const val1 = variable;
		const compare = parseInt(data.comparison);
		let val2 = this.evalMessage(data.value, cache);
		if(compare !== 6) val2 = this.eval(val2, cache);
		if(val2 === false) val2 = this.evalMessage(data.value, cache);
		switch(compare) {
			case 0:
				result = Boolean(val1 !== undefined);
				break;
			case 1:
				result = Boolean(val1 == val2);
				break;
			case 2:
				result = Boolean(val1 === val2);
				break;
			case 3:
				result = Boolean(val1 < val2);
				break;
			case 4:
				result = Boolean(val1 > val2);
				break;
			case 5:
				if(typeof(val1.includes) === 'function') {
					result = Boolean(val1.includes(val2));
				}
				break;
			case 6:
				result = Boolean(val1.match(new RegExp('^' + val2 + '$', 'i')));
				break;
			case 7:
				result = Boolean(val1.length > val2);
				break;
			case 8:
				result = Boolean(val1.length < val2);
				break;
			case 9: //Added by Lasse
			  result = Boolean(val1.length == val2);
			  break;
			case 10: //Added by MrGold
			  result = val1.startsWith(val2);
			  break;
			case 11: //Added by MrGold
			  result = val1.endsWith(val2);
			  break;
		}
	}
	this.executeResults(result, data, cache);
},

//---------------------------------------------------------------------
// Action Bot Mod
//
// Upon initialization of the bot, this code is run. Using the bot's
// DBM namespace, one can add/modify existing functions if necessary.
// In order to reduce conflictions between mods, be sure to alias
// functions you wish to overwrite.
//---------------------------------------------------------------------

mod: function(DBM) {
}

}; // End of module
<commit_msg>Updated Check Variable<commit_after>module.exports = {

//---------------------------------------------------------------------
// Action Name
//
// This is the name of the action displayed in the editor.
//---------------------------------------------------------------------

name: "Check Variable",

//---------------------------------------------------------------------
// Action Section
//
// This is the section the action will fall into.
//---------------------------------------------------------------------

section: "Conditions",

//---------------------------------------------------------------------
// Action Subtitle
//
// This function generates the subtitle displayed next to the name.
//---------------------------------------------------------------------

subtitle: function(data) {
	const comparisons = ["Exists", "Equals", "Equals Exactly", "Less Than", "Greater Than", "Includes", "Matches Regex", "Length is Bigger Than", "Length is Smaller Than", "Length is Equals", "Starts With", "Ends With", "Matches Full Regex"];
	const results = ["Continue Actions", "Stop Action Sequence", "Jump To Action", "Jump Forward Actions"];
	return `${comparisons[parseInt(data.comparison)]} | If True: ${results[parseInt(data.iftrue)]} ~ If False: ${results[parseInt(data.iffalse)]}`;
},

//---------------------------------------------------------------------
	 // DBM Mods Manager Variables (Optional but nice to have!)
	 //
	 // These are variables that DBM Mods Manager uses to show information
	 // about the mods for people to see in the list.
	 //---------------------------------------------------------------------

	 // Who made the mod (If not set, defaults to "DBM Mods")
	 author: "DBM, EGGSY, MrGold, Lasse, ZockerNico", //UI fixed by MrGold

	 // The version of the mod (Defaults to 1.0.0)
	 version: "1.9.6", //Added in 1.9.1

	 // A short description to show on the mod line for this mod (Must be on a single line)
	 short_description: "Added more options to default action.",

	 // If it depends on any other mods by name, ex: WrexMODS if the mod uses something from WrexMods

	 //---------------------------------------------------------------------

//---------------------------------------------------------------------
// Action Fields
//
// These are the fields for the action. These fields are customized
// by creating elements with corresponding IDs in the HTML. These
// are also the names of the fields stored in the action's JSON data.
//---------------------------------------------------------------------

fields: ["storage", "varName", "comparison", "value", "iftrue", "iftrueVal", "iffalse", "iffalseVal"],

//---------------------------------------------------------------------
// Command HTML
//
// This function returns a string containing the HTML used for
// editting actions.
//
// The "isEvent" parameter will be true if this action is being used
// for an event. Due to their nature, events lack certain information,
// so edit the HTML to reflect this.
//
// The "data" parameter stores constants for select elements to use.
// Each is an array: index 0 for commands, index 1 for events.
// The names are: sendTargets, members, roles, channels,
//                messages, servers, variables
//---------------------------------------------------------------------

html: function(isEvent, data) {
	return `

This action has been modified by DBM Mods.

		Source Variable:

		<select id="storage" class="round" onchange="glob.refreshVariableList(this)">
			${data.variables[1]}
		</select>

		Variable Name:

		<input id="varName" class="round" type="text" list="variableList">

		Comparison Type:

		<select id="comparison" class="round" onchange="glob.onChange1(this)">
			<option value="0" selected>Exists</option>
			<option value="1">Equals</option>
			<option value="2">Equals Exactly</option>
			<option value="3">Less Than</option>
			<option value="4">Greater Than</option>
			<option value="5">Includes</option>
			<option value="6">Matches Regex</option>
			<option value="12">Matches Full Regex</option>
			<option value="7">Length is Bigger Than</option>
			<option value="8">Length is Smaller Than</option>
			<option value="9">Length is Equals</option>
			<option value="10">Starts With</option>
			<option value="11">Ends With</option>
		</select>

		Value to Compare to:

		<input id="value" class="round" type="text" name="is-eval" placeholder="">

	${data.conditions[0]}

`
},

//---------------------------------------------------------------------
// Action Editor Init Code
//
// When the HTML is first applied to the action editor, this code
// is also run. This helps add modifications or setup reactionary
// functions for the DOM elements.
//---------------------------------------------------------------------

init: function() {
	const {glob, document} = this;

	glob.onChange1 = function(event) {
		if(parseInt(event.value) == 0) {
			document.getElementById('directValue').style.display = 'none';
		} else {
			document.getElementById('directValue').style.display = null;
		};
		switch(parseInt(event.value)) {
			case 6:
				document.getElementById('value').placeholder = "('My'|'Regex')";
				break;
			case 12:
				document.getElementById('value').placeholder = "/('My'|'Regex')\\w+/igm";
				break;
			default:
				document.getElementById('value').placeholder = "";
		};
	};

	glob.onChange1(document.getElementById('comparison'));
	glob.refreshVariableList(document.getElementById('storage'));
	glob.onChangeTrue(document.getElementById('iftrue'));
	glob.onChangeFalse(document.getElementById('iffalse'));
},

//---------------------------------------------------------------------
// Action Bot Function
//
// This is the function for the action within the Bot's Action class.
// Keep in mind event calls won't have access to the "msg" parameter,
// so be sure to provide checks for variable existance.
//---------------------------------------------------------------------

action: function(cache) {
	const data = cache.actions[cache.index];
	const type = parseInt(data.storage);
	const varName = this.evalMessage(data.varName, cache);
	const variable = this.getVariable(type, varName, cache);
	let result = false;
	if(variable) {
		const val1 = variable;
		const compare = parseInt(data.comparison);
		let val2 = this.evalMessage(data.value, cache);
		if(compare !== 6) val2 = this.eval(val2, cache);
		if(val2 === false) val2 = this.evalMessage(data.value, cache);
		switch(compare) {
			case 0:
				result = Boolean(val1 !== undefined);
				break;
			case 1:
				result = Boolean(val1 == val2);
				break;
			case 2:
				result = Boolean(val1 === val2);
				break;
			case 3:
				result = Boolean(val1 < val2);
				break;
			case 4:
				result = Boolean(val1 > val2);
				break;
			case 5:
				if(typeof(val1.includes) === 'function') {
					result = Boolean(val1.includes(val2));
				}
				break;
			case 6:
				result = Boolean(val1.match(new RegExp('^' + val2 + '$', 'i')));
				break;
			case 7:
				result = Boolean(val1.length > val2);
				break;
			case 8:
				result = Boolean(val1.length < val2);
				break;
			case 9: //Added by Lasse
			  	result = Boolean(val1.length == val2);
			  	break;
			case 10: //Added by MrGold
			  	result = Boolean(val1.startsWith(val2));
			  	break;
			case 11: //Added by MrGold
			  	result = Boolean(val1.endsWith(val2));
			  	break;
			case 12: //Added by ZockerNico
				result = Boolean(val1.match(new RegExp(val2)));
				break;
		}
	}
	this.executeResults(result, data, cache);
},

//---------------------------------------------------------------------
// Action Bot Mod
//
// Upon initialization of the bot, this code is run. Using the bot's
// DBM namespace, one can add/modify existing functions if necessary.
// In order to reduce conflictions between mods, be sure to alias
// functions you wish to overwrite.
//---------------------------------------------------------------------

mod: function(DBM) {
}

}; // End of module
<|endoftext|>


<commit_before>function getErrorCode(error) {
    if (!error.response) {
        return error.toString();
    }
    const { data } = error.response;
    if (!data) {
        return `clientError - ${error.message}`;
    }
    if (!data.extras || !data.extras.result_codes) {
        return `unknownResponse - ${error.message}`;
    }
    if (data.extras.result_codes.transaction === 'tx_failed') {
        return data.extras.result_codes.operations.find(op => op !== 'op_success');
    }
    return data.extras.result_codes.transaction;
}

const errorMap = new Map();
// 'ERROR_CODE' - 'DESCRIPTION'
// TX errors: https://www.stellar.org/developers/guides/concepts/transactions.html
// OP errors: https://www.stellar.org/developers/guides/concepts/list-of-operations.html
errorMap
    // transaction errors
    .set('tx_too_early',
        'Ledger closeTime before minTime value in the transaction.')
    .set('tx_too_late',
        'Ledger closeTime after maxTime value in the transaction.')
    .set('tx_missing_operation',
        'No operation was specified.')
    .set('tx_bad_seq',
        'Transaction failed because sequence got out of sync. Please reload StellarTerm and try again.')
    .set('tx_bad_auth',
        'Too few valid signatures / wrong network.')
    .set('tx_insufficient_balance',
        'Fee would bring account below minimum reserve.')
    .set('tx_no_account',
        'Source account not found.')
    .set('tx_insufficient_fee',
        'Fee is too small.')
    .set('tx_bad_auth_extra',
        'Unused signatures attached to transaction.')
    .set('tx_internal_error',
        'An unknown error occurred.')
    // operation errors
    .set('op_low_reserve',
        'Your account does not have enough XLM to meet the minimum balance.')
    .set('op_underfunded',
        'Transaction failed due to a lack of funds.')
    .set('op_malformed',
        'The input to the payment or the destination is invalid.')
    .set('op_already_exist',
        'The destination account already exists')
    .set('buy_not_authorized',
        'Unable to create offer because the issuer has not authorized you to trade this asset. ' +
        'To fix this issue, check with the issuers website.')
    .set('op_src_not_authorized',
        'The source account is not authorized to send this payment.')
    .set('op_no_destination',
        'The receiving account does not exist.')
    .set('op_line_full',
        'The destination account (receiver) does not have sufficient limits to receive amount and still ' +
        'satisfy its buying liabilities.')
    .set('op_no_trust',
        'Destination does not have a trust line.')
    .set('op_src_no_trust',
        'The source account does not trust the issuer of the asset it is trying to send.')
    .set('op_no_issuer',
        'The issuer of the asset does not exist.')
    .set('op_invalid_limit',
        'The limit is not sufficient to hold the current balance of the trustline and still satisfy ' +
        'its buying liabilities.')
    .set('op_self_not_allowed',
        'The source account attempted to create a trustline for itself, which is not allowed.')
    .set('op_too_few_offers',
        'There is no path of offers connecting the send asset and destination asset. ' +
        'Stellar only considers paths of length 5 or shorter.')
    .set('op_offer_cross_self',
        'The payment would cross one of its own offers.')
    .set('op_over_sendmax',
        'The paths that could send destination amount of destination asset would exceed send max.')
    .set('op_sell_no_trust',
        'The account creating the offer does not have a trustline for the asset it is selling.')
    .set('op_buy_no_trust',
        'The account creating the offer does not have a trustline for the asset it is buying.')
    .set('op_sell_not_authorized',
        'The account creating the offer is not authorized to buy this asset.')
    .set('op_buy_not_authorized',
        'The account creating the offer is not authorized to sell this asset.')
    .set('op_cross_self',
        'The account has opposite offer of equal or lesser price active, so the account creating this offer ' +
        'would immediately cross itself.')
    .set('op_sell_no_issuer',
        'The issuer of selling asset does not exist.')
    .set('op_buy_no_issuer',
        'The issuer of buying asset does not exist.')
    .set('op_offer_not_found',
        'An offer with some offerID cannot be found.')
    .set('op_too_many_signers',
        '20 is the maximum number of signers an account can have, and adding another signer would exceed that.')
    .set('op_bad_flags',
        'The flags set and/or cleared are invalid by themselves or in combination.')
    .set('op_invalid_inflation',
        'The destination account set in the inflation field does not exist.')
    .set('op_cant_change',
        'This account can no longer change the option it wants to change.')
    .set('op_unknown_flag',
        'The account is trying to set a flag that is unknown.')
    .set('op_threshold_out_of_range',
        'The value for a key weight or threshold is invalid.')
    .set('op_bad_signer',
        'Any additional signers added to the account cannot be the master key.')
    .set('op_invalid_home_domain',
        'Home domain is malformed.')
    .set('op_no_trust_line',
        'The trustor does not have a trustline with the issuer performing this operation.')
    .set('op_trust_not_required',
        'The source account (issuer performing this operation) does not require trust. ' +
        'In other words, it does not have the flag AUTH_REQUIRED_FLAG set.')
    .set('op_cant_revoke',
        'The source account is trying to revoke the trustline of the trustor, but it cannot do so.')
    .set('op_immutable_set',
        'The source account has AUTH_IMMUTABLE flag set.')
    .set('op_has_sub_entries',
        'The source account has trust lines/offers.')
    .set('op_seqnum_too_far',
        'Source’s account sequence number is too high. It must be less than (ledgerSeq << 32) = ' +
        '(ledgerSeq * 0x100000000). (protocol version 10 and above)')
    .set('op_dest_full',
        'The destination account cannot receive the balance of the source account and still satisfy its lumen ' +
        'buying liabilities. (protocol version 10 and above)')
    .set('op_not_time',
        'Inflation only runs once a week. This failure means it is not time for a new inflation round yet.')
    .set('op_not_supported_yet',
        'The network hasn’t moved to this protocol change yet. This failure means the network doesn’t support ' +
        'this feature yet.')
    .set('op_name_not_found',
        'Trying to remove a Data Entry that isn’t there. This will happen if Name is set (and Value isn’t) but ' +
        'the Account doesn’t have a DataEntry with that Name.')
    .set('op_invalid_name',
        'Name not a valid string.')
    .set('op_bad_seq',
        'The specified bumpTo sequence number is not a valid sequence number. It must be between 0 ' +
        'and INT64_MAX (9223372036854775807 or 0x7fffffffffffffff).');

export default function ErrorHandler(error) {
    const errorCode = getErrorCode(error);
    return errorMap.has(errorCode) ?
        errorMap.get(errorCode) :
        errorCode;
}
<commit_msg>Changed error message for 'op_low_reserve' code<commit_after>function getErrorCode(error) {
    if (!error.response) {
        return error.toString();
    }
    const { data } = error.response;
    if (!data) {
        return `clientError - ${error.message}`;
    }
    if (!data.extras || !data.extras.result_codes) {
        return `unknownResponse - ${error.message}`;
    }
    if (data.extras.result_codes.transaction === 'tx_failed') {
        return data.extras.result_codes.operations.find(op => op !== 'op_success');
    }
    return data.extras.result_codes.transaction;
}

const errorMap = new Map();
// 'ERROR_CODE' - 'DESCRIPTION'
// TX errors: https://www.stellar.org/developers/guides/concepts/transactions.html
// OP errors: https://www.stellar.org/developers/guides/concepts/list-of-operations.html
errorMap
    // transaction errors
    .set('tx_too_early',
        'Ledger closeTime before minTime value in the transaction.')
    .set('tx_too_late',
        'Ledger closeTime after maxTime value in the transaction.')
    .set('tx_missing_operation',
        'No operation was specified.')
    .set('tx_bad_seq',
        'Transaction failed because sequence got out of sync. Please reload StellarTerm and try again.')
    .set('tx_bad_auth',
        'Too few valid signatures / wrong network.')
    .set('tx_insufficient_balance',
        'Fee would bring account below minimum reserve.')
    .set('tx_no_account',
        'Source account not found.')
    .set('tx_insufficient_fee',
        'Fee is too small.')
    .set('tx_bad_auth_extra',
        'Unused signatures attached to transaction.')
    .set('tx_internal_error',
        'An unknown error occurred.')
    // operation errors
    .set('op_low_reserve',
        'The destination is a new non-activated account. A new account has to have at least 1 XLM.')
    .set('op_underfunded',
        'Transaction failed due to a lack of funds.')
    .set('op_malformed',
        'The input to the payment or the destination is invalid.')
    .set('op_already_exist',
        'The destination account already exists')
    .set('buy_not_authorized',
        'Unable to create offer because the issuer has not authorized you to trade this asset. ' +
        'To fix this issue, check with the issuers website.')
    .set('op_src_not_authorized',
        'The source account is not authorized to send this payment.')
    .set('op_no_destination',
        'The receiving account does not exist.')
    .set('op_line_full',
        'The destination account (receiver) does not have sufficient limits to receive amount and still ' +
        'satisfy its buying liabilities.')
    .set('op_no_trust',
        'Destination does not have a trust line.')
    .set('op_src_no_trust',
        'The source account does not trust the issuer of the asset it is trying to send.')
    .set('op_no_issuer',
        'The issuer of the asset does not exist.')
    .set('op_invalid_limit',
        'The limit is not sufficient to hold the current balance of the trustline and still satisfy ' +
        'its buying liabilities.')
    .set('op_self_not_allowed',
        'The source account attempted to create a trustline for itself, which is not allowed.')
    .set('op_too_few_offers',
        'There is no path of offers connecting the send asset and destination asset. ' +
        'Stellar only considers paths of length 5 or shorter.')
    .set('op_offer_cross_self',
        'The payment would cross one of its own offers.')
    .set('op_over_sendmax',
        'The paths that could send destination amount of destination asset would exceed send max.')
    .set('op_sell_no_trust',
        'The account creating the offer does not have a trustline for the asset it is selling.')
    .set('op_buy_no_trust',
        'The account creating the offer does not have a trustline for the asset it is buying.')
    .set('op_sell_not_authorized',
        'The account creating the offer is not authorized to buy this asset.')
    .set('op_buy_not_authorized',
        'The account creating the offer is not authorized to sell this asset.')
    .set('op_cross_self',
        'The account has opposite offer of equal or lesser price active, so the account creating this offer ' +
        'would immediately cross itself.')
    .set('op_sell_no_issuer',
        'The issuer of selling asset does not exist.')
    .set('op_buy_no_issuer',
        'The issuer of buying asset does not exist.')
    .set('op_offer_not_found',
        'An offer with some offerID cannot be found.')
    .set('op_too_many_signers',
        '20 is the maximum number of signers an account can have, and adding another signer would exceed that.')
    .set('op_bad_flags',
        'The flags set and/or cleared are invalid by themselves or in combination.')
    .set('op_invalid_inflation',
        'The destination account set in the inflation field does not exist.')
    .set('op_cant_change',
        'This account can no longer change the option it wants to change.')
    .set('op_unknown_flag',
        'The account is trying to set a flag that is unknown.')
    .set('op_threshold_out_of_range',
        'The value for a key weight or threshold is invalid.')
    .set('op_bad_signer',
        'Any additional signers added to the account cannot be the master key.')
    .set('op_invalid_home_domain',
        'Home domain is malformed.')
    .set('op_no_trust_line',
        'The trustor does not have a trustline with the issuer performing this operation.')
    .set('op_trust_not_required',
        'The source account (issuer performing this operation) does not require trust. ' +
        'In other words, it does not have the flag AUTH_REQUIRED_FLAG set.')
    .set('op_cant_revoke',
        'The source account is trying to revoke the trustline of the trustor, but it cannot do so.')
    .set('op_immutable_set',
        'The source account has AUTH_IMMUTABLE flag set.')
    .set('op_has_sub_entries',
        'The source account has trust lines/offers.')
    .set('op_seqnum_too_far',
        'Source’s account sequence number is too high. It must be less than (ledgerSeq << 32) = ' +
        '(ledgerSeq * 0x100000000). (protocol version 10 and above)')
    .set('op_dest_full',
        'The destination account cannot receive the balance of the source account and still satisfy its lumen ' +
        'buying liabilities. (protocol version 10 and above)')
    .set('op_not_time',
        'Inflation only runs once a week. This failure means it is not time for a new inflation round yet.')
    .set('op_not_supported_yet',
        'The network hasn’t moved to this protocol change yet. This failure means the network doesn’t support ' +
        'this feature yet.')
    .set('op_name_not_found',
        'Trying to remove a Data Entry that isn’t there. This will happen if Name is set (and Value isn’t) but ' +
        'the Account doesn’t have a DataEntry with that Name.')
    .set('op_invalid_name',
        'Name not a valid string.')
    .set('op_bad_seq',
        'The specified bumpTo sequence number is not a valid sequence number. It must be between 0 ' +
        'and INT64_MAX (9223372036854775807 or 0x7fffffffffffffff).');

export default function ErrorHandler(error) {
    const errorCode = getErrorCode(error);
    return errorMap.has(errorCode) ?
        errorMap.get(errorCode) :
        errorCode;
}
<|endoftext|>


<commit_before>import React, { Component } from 'react';
import './App.css';

import * as serverAPI from './actions/serverAPI';

import Table from './components/Table';
import Search from './components/Search';
import Footer from './components/Footer';
import Navigation from './components/Navigation';
import DetailPage from './DetailPage';

class App extends Component {

  constructor(props) {
    super(props);
    this.state = {
      politicians: [],
      original_politicians: [],
    };
    this.loadListOfPoliticiants = this.loadListOfPoliticiants.bind(this);
    this.filterNames = this.filterNames.bind(this);
  }

  componentWillMount() {
    this.loadListOfPoliticiants();
  }

  loadListOfPoliticiants() {
    serverAPI.listPoliticians(
      (list) => {
        this.setState({
          politicians: list,
          original_politicians : list,
        });
      });
  }

  filterNames(query) {
    query = query.toLowerCase();
    const politicians = this.state.original_politicians.filter(p =>
      (p.firstname.toLowerCase().startsWith(query) || p.surname.toLowerCase().startsWith(query) || p.party_abbreviation.toLowerCase() === query));
    this.setState({
      politicians : politicians,
    })
  }

  render() {
    return (this.props.params.splat.length > 0) ?
     (<DetailPage id={this.props.params.splat} />) :
     (

          <Navigation />

          <Search filterNames={this.filterNames} names={this.state.politicians.map(politician => { return {
            firstname: politician.firstname,
            surname: politician.surname}})}/>

    );
  }
}

export default App;
<commit_msg>fix_link 1<commit_after>import React, { Component } from 'react';
import './App.css';

import * as serverAPI from './actions/serverAPI';

import Table from './components/Table';
import Search from './components/Search';
import Footer from './components/Footer';
import Navigation from './components/Navigation';
import DetailPage from './DetailPage';

class App extends Component {

  constructor(props) {
    super(props);
    this.state = {
      politicians: [],
      original_politicians: [],
    };
    this.loadListOfPoliticiants = this.loadListOfPoliticiants.bind(this);
    this.filterNames = this.filterNames.bind(this);
  }

  componentWillMount() {
    this.loadListOfPoliticiants();
  }

  loadListOfPoliticiants() {
    serverAPI.listPoliticians(
      (list) => {
        this.setState({
          politicians: list,
          original_politicians : list,
        });
      });
  }

  filterNames(query) {
    query = query.toLowerCase();
    const politicians = this.state.original_politicians.filter(p =>
      (p.firstname.toLowerCase().startsWith(query) || p.surname.toLowerCase().startsWith(query) || p.party_abbreviation.toLowerCase() === query));
    this.setState({
      politicians : politicians,
    })
  }

  render() {
    return (this.props.params.splat.length > 0 && this.props.params.splat !== "profil") ?
     (<DetailPage id={this.props.params.splat} />) :
     (

          <Navigation />

          <Search filterNames={this.filterNames} names={this.state.politicians.map(politician => { return {
            firstname: politician.firstname,
            surname: politician.surname}})}/>

    );
  }
}

export default App;
<|endoftext|>


<commit_before>module.exports = {
  'clear-filter': '清除關鍵字',
  'matched-message': '有 {count} 個結果符合關鍵字 {keyword}',
  'search-entries': '搜尋詞條...',
  'about': '關於',
  'add-a-folder': '新增一個資料夾',
  'add-entry': '新增詞條',
  'add-folder': '新增資料夾',
  'app-language': '應用程式語言',
  'back': '上一頁',
  'bo': '藏文',
  'cancel': '取消',
  'category': '類別',
  'category-1': '人',
  'category-2': '尊',
  'category-3': '寺',
  'category-4': '地',
  'category-5': '經',
  'category-6': '物',
  'category-7': '量',
  'category-8': '句',
  'choose-at-least-one-content-field': '請至少選擇一個內容欄位',
  'choose-at-least-one-target-language': '請至少選擇一個目標語言',
  'choose-csv-file': '選擇 CSV 檔案',
  'completed-csv-line': '已寫入 {completedLines} 行',
  'confirm': '確認',
  'content-fields': '內容欄位',
  'csv-imported-done': '{filename} 已匯入完成',
  'delete': '刪除',
  'delete-folder-instruction': '輸入 {folderName} 刪除這個資料夾, 被刪除的資料將沒辦法復原',
  'done': '完成',
  'edit': '編輯',
  'edit-folder': '編輯資料夾',
  'edit-folder-entry': '編輯 {sourceEntry}',
  'en': '英文',
  'explaination': '解釋',
  'explaination-category-1': '人物',
  'explaination-category-10': '術語',
  'explaination-category-11': '梵語',
  'explaination-category-12': '漢語',
  'explaination-category-13': '蒙古語',
  'explaination-category-2': '神尊',
  'explaination-category-3': '寺廟',
  'explaination-category-4': '地方',
  'explaination-category-5': '經典',
  'explaination-category-6': '物品',
  'explaination-category-7': '法數',
  'explaination-category-8': '文句',
  'explaination-category-9': '語言',
  'explaination-category-num': '解釋分類 {num}',
  'explaination-lang': '解釋 - {lang}',
  'explaination-note': '解釋註解',
  'explaination-note-num': '解釋註記 {num}',
  'explaination-num-lang': '解釋 {num} - {lang}',
  'explaination-source-num': '解釋出處 {num}',
  'export': '匯出',
  'field-source-language-required': '必須填寫來源語言',
  'folder-entries': '{folderName} 的詞條',
  'folder-entries-has-been-deleted': '已刪除 {count} 個詞條',
  'folder-entry-has-been-created': '已新增詞條 {sourceEntry}',
  'folder-entry-has-been-updated': '已更新詞條 {sourceEntry}',
  'folder-entry-name-required': '必須填寫詞條',
  'folder-entry-name-taken': '詞條在這個資料夾已經存在',
  'folder-has-been-created': '已建立資料夾 {folderName}',
  'folder-has-been-deleted': '已刪除資料夾 {folderName}',
  'folder-has-been-updated': '已更新資料夾 {folderName}',
  'folder-name': '資料夾名稱',
  'folder-name-required': '必須填寫資料夾名稱',
  'folder-name-taken': '資料夾名稱 {folderName} 已經存在',
  'folders': '資料夾列表',
  'garchen': '噶千',
  'home': '首頁',
  'import-csv-file': '匯入 CSV 檔案',
  'import-csv-rule-1': '1. 本版本支援的字典語言代碼有: {supportedLangs}, 以下簡稱 {langExpression}',
  'import-csv-rule-2': '2. 以下有用到多國語言的欄位名稱以 {langExpression} 表示對應的語言代碼, 例如主詞條的欄位 source-entry-{langExpression} 套用藏文後變為 source-entry-bo',
  'import-csv-rule-3': '3. 支援的欄位名稱有: {supportedColumnNames}',
  'import-csv-rule-4': '4. 第一行必須定義欄位, 而且必須包含一個主詞條 source-entry-[lang], 範例檔案請參考',
  'import-csv-rule-5': '5. 如果覺得匯入期間操作會不順暢可以嘗試把設定頁的寫入延遲加長',
  'login': '登入',
  'next-page': '下一頁',
  'no-column-row-detected': '在 {errorFilename} 偵測不到欄位資訊',
  'original-lang': '原文 - {lang}',
  'page-num': '頁碼',
  'please-input-exact-the-same-folder-name': '請輸入{folderName}',
  'prev-page': '上一頁',
  'sect': '宗派',
  'sect-1': '舊',
  'sect-2': '當',
  'sect-3': '薩',
  'sect-4': '噶',
  'sect-5': '香',
  'sect-6': '斷',
  'sect-7': '時',
  'sect-8': '依',
  'see-imported-folder': '看看新匯入的資料夾',
  'settings': '設定',
  'source': '出處',
  'source-entry': '主詞條',
  'source-entry-lang': '主詞條 - {lang}',
  'source-lang': '出處 - {lang}',
  'source-language': '來源語言',
  'submit': '送出',
  'target-entry-lang': '詞條 - {lang}',
  'target-language': '目標語言',
  'time': '時',
  'update': '更新',
  'write-delay-with-num': '寫入延遲時間 {writeDelay} 毫秒',
  'zh-CN': '簡體中文',
  'zh-TW': '繁體中文'
};
<commit_msg>remove translation time<commit_after>module.exports = {
  'clear-filter': '清除關鍵字',
  'matched-message': '有 {count} 個結果符合關鍵字 {keyword}',
  'search-entries': '搜尋詞條...',
  'about': '關於',
  'add-a-folder': '新增一個資料夾',
  'add-entry': '新增詞條',
  'add-folder': '新增資料夾',
  'app-language': '應用程式語言',
  'back': '上一頁',
  'bo': '藏文',
  'cancel': '取消',
  'category': '類別',
  'category-1': '人',
  'category-2': '尊',
  'category-3': '寺',
  'category-4': '地',
  'category-5': '經',
  'category-6': '物',
  'category-7': '量',
  'category-8': '句',
  'choose-at-least-one-content-field': '請至少選擇一個內容欄位',
  'choose-at-least-one-target-language': '請至少選擇一個目標語言',
  'choose-csv-file': '選擇 CSV 檔案',
  'completed-csv-line': '已寫入 {completedLines} 行',
  'confirm': '確認',
  'content-fields': '內容欄位',
  'csv-imported-done': '{filename} 已匯入完成',
  'delete': '刪除',
  'delete-folder-instruction': '輸入 {folderName} 刪除這個資料夾, 被刪除的資料將沒辦法復原',
  'done': '完成',
  'edit': '編輯',
  'edit-folder': '編輯資料夾',
  'edit-folder-entry': '編輯 {sourceEntry}',
  'en': '英文',
  'explaination': '解釋',
  'explaination-category-1': '人物',
  'explaination-category-10': '術語',
  'explaination-category-11': '梵語',
  'explaination-category-12': '漢語',
  'explaination-category-13': '蒙古語',
  'explaination-category-2': '神尊',
  'explaination-category-3': '寺廟',
  'explaination-category-4': '地方',
  'explaination-category-5': '經典',
  'explaination-category-6': '物品',
  'explaination-category-7': '法數',
  'explaination-category-8': '文句',
  'explaination-category-9': '語言',
  'explaination-category-num': '解釋分類 {num}',
  'explaination-lang': '解釋 - {lang}',
  'explaination-note': '解釋註解',
  'explaination-note-num': '解釋註記 {num}',
  'explaination-num-lang': '解釋 {num} - {lang}',
  'explaination-source-num': '解釋出處 {num}',
  'export': '匯出',
  'field-source-language-required': '必須填寫來源語言',
  'folder-entries': '{folderName} 的詞條',
  'folder-entries-has-been-deleted': '已刪除 {count} 個詞條',
  'folder-entry-has-been-created': '已新增詞條 {sourceEntry}',
  'folder-entry-has-been-updated': '已更新詞條 {sourceEntry}',
  'folder-entry-name-required': '必須填寫詞條',
  'folder-entry-name-taken': '詞條在這個資料夾已經存在',
  'folder-has-been-created': '已建立資料夾 {folderName}',
  'folder-has-been-deleted': '已刪除資料夾 {folderName}',
  'folder-has-been-updated': '已更新資料夾 {folderName}',
  'folder-name': '資料夾名稱',
  'folder-name-required': '必須填寫資料夾名稱',
  'folder-name-taken': '資料夾名稱 {folderName} 已經存在',
  'folders': '資料夾列表',
  'garchen': '噶千',
  'home': '首頁',
  'import-csv-file': '匯入 CSV 檔案',
  'import-csv-rule-1': '1. 本版本支援的字典語言代碼有: {supportedLangs}, 以下簡稱 {langExpression}',
  'import-csv-rule-2': '2. 以下有用到多國語言的欄位名稱以 {langExpression} 表示對應的語言代碼, 例如主詞條的欄位 source-entry-{langExpression} 套用藏文後變為 source-entry-bo',
  'import-csv-rule-3': '3. 支援的欄位名稱有: {supportedColumnNames}',
  'import-csv-rule-4': '4. 第一行必須定義欄位, 而且必須包含一個主詞條 source-entry-[lang], 範例檔案請參考',
  'import-csv-rule-5': '5. 如果覺得匯入期間操作會不順暢可以嘗試把設定頁的寫入延遲加長',
  'login': '登入',
  'next-page': '下一頁',
  'no-column-row-detected': '在 {errorFilename} 偵測不到欄位資訊',
  'original-lang': '原文 - {lang}',
  'page-num': '頁碼',
  'please-input-exact-the-same-folder-name': '請輸入{folderName}',
  'prev-page': '上一頁',
  'sect': '宗派',
  'sect-1': '舊',
  'sect-2': '當',
  'sect-3': '薩',
  'sect-4': '噶',
  'sect-5': '香',
  'sect-6': '斷',
  'sect-7': '時',
  'sect-8': '依',
  'see-imported-folder': '看看新匯入的資料夾',
  'settings': '設定',
  'source': '出處',
  'source-entry': '主詞條',
  'source-entry-lang': '主詞條 - {lang}',
  'source-lang': '出處 - {lang}',
  'source-language': '來源語言',
  'submit': '送出',
  'target-entry-lang': '詞條 - {lang}',
  'target-language': '目標語言',
  'update': '更新',
  'write-delay-with-num': '寫入延遲時間 {writeDelay} 毫秒',
  'zh-CN': '簡體中文',
  'zh-TW': '繁體中文'
};
<|endoftext|>


<commit_before>this.recline = this.recline || {};
this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.ActivityAPI = this.recline.Backend.ActivityAPI || {};

(function($, my) {
    my.__type__ = 'ActivityAPI';

    var fields = [
        {
            id: 'created_on',
            label: 'Performed On',
            type: 'datetime'
        },
        {
            id: 'action',
            label: 'Action',
            type: 'string'
        },
        {
            id: 'user',
            label: 'Performed By',
            type: 'string'
        },
        {
            id: 'msg',
            label: 'Description',
            type: 'string'
        }
    ];

    my.fetch = function(dataset){
        var deferred = $.Deferred();
        deferred.resolve({
            fields: fields
        });
        return deferred.promise();
    };

    my.query = function(queryObj, dataset){
        var deferred, jqXHR, params;
        deferred = $.Deferred();
        params = {
            count: 1
        };
        jqXHR = $.getJSON(dataset.url, params);
        jqXHR.done(function(data) {
            var total;
            total = data[0].count;
            params = {
                start: queryObj.from,
                limit: queryObj.size
            };
            // default sort
            var sort = {field: "created_on", order: "desc"};
            var sortDirs = {asc: 1, desc: -1};
            if(queryObj.sort && queryObj.sort.length > 0)
            {
                var sort = queryObj.sort[0];
            }
            var sortParam = {};
            sortParam[sort.field] = sortDirs[sort.order];
            params['sort'] = JSON.stringify(sortParam);
            jqXHR = $.getJSON(dataset.url, params);
            return jqXHR.done(function(data) {
                return deferred.resolve({
                    total: total,
                    hits: data
                });
            });
        });
        jqXHR.fail(function(e) {
            return deferred.reject(e);
        });
        return deferred.promise();
    };
}(jQuery, this.recline.Backend.ActivityAPI));<commit_msg>Implemented query params to the api<commit_after>this.recline = this.recline || {};
this.recline.Backend = this.recline.Backend || {};
this.recline.Backend.ActivityAPI = this.recline.Backend.ActivityAPI || {};

(function($, my) {
    my.__type__ = 'ActivityAPI';

    var fields = [
        {
            id: 'created_on',
            label: 'Performed On',
            type: 'datetime'
        },
        {
            id: 'action',
            label: 'Action',
            type: 'string'
        },
        {
            id: 'user',
            label: 'Performed By',
            type: 'string'
        },
        {
            id: 'msg',
            label: 'Description',
            type: 'string'
        }
    ];

    my.fetch = function(dataset){
        var deferred = $.Deferred();
        deferred.resolve({
            fields: fields
        });
        return deferred.promise();
    };

    my.query = function(queryObj, dataset){
        var deferred, jqXHR, params;
        deferred = $.Deferred();
        params = {
            count: 1
        };
        jqXHR = $.getJSON(dataset.url, params);
        jqXHR.done(function(data) {
            var total;
            total = data[0].count;
            params = {
                start: queryObj.from,
                limit: queryObj.size
            };
            // query params
            var queryParam = {'$and': []};
            if(queryObj.q){
                var qParam = {$or: []};
                _.each(fields, function(field){
                    var reParam = {};
                    reParam[field.id] = {$regex: queryObj.q, $options: "i"};
                    qParam['$or'].push(reParam);
                });
                //params['query'] = JSON.stringify(qParam);
                queryParam['$and'].push(qParam);
            }
            // filters
            if(queryObj.filters.length > 0)
            {
                var filterParam = {$and: []};
                _.each(queryObj.filters, function(filter){
                    if(filter.type === "term")
                    {
                        var filterObj = {};
                        filterObj[filter.field] = filter.term;
                        filterParam.$and.push(filterObj);
                    }
                    else if(filter.type === "range")
                    {
                        var filterObj = {};
                        filterObj[filter.field] = {$gte: filter.start, $lte: filter.stop};
                        filterParam.$and.push(filterObj);
                    }
                });
                // make sure we have some filters before we add to our array
                if(filterParam.$and.length > 0)
                {
                    queryParam['$and'].push(filterParam.$and.length > 1?filterParam:filterParam.$and[0]);
                }
            }
            if(queryParam.$and && queryParam.$and.length > 0)
            {
                params['query'] = queryParam.$and.length > 1?JSON.stringify(queryParam):JSON.stringify(queryParam.$and[0]);
            }
            // default sort
            var sort = {field: "created_on", order: "desc"};
            var sortDirs = {asc: 1, desc: -1};
            if(queryObj.sort && queryObj.sort.length > 0)
            {
                var sort = queryObj.sort[0];
            }
            var sortParam = {};
            sortParam[sort.field] = sortDirs[sort.order];
            params['sort'] = JSON.stringify(sortParam);
            jqXHR = $.getJSON(dataset.url, params);
            return jqXHR.done(function(data) {
                return deferred.resolve({
                    total: total,
                    hits: data
                });
            });
        });
        jqXHR.fail(function(e) {
            return deferred.reject(e);
        });
        return deferred.promise();
    };
}(jQuery, this.recline.Backend.ActivityAPI));<|endoftext|>


<commit_before>const utils = require('./utils')

class EventHandler
{
    constructor(errorHandler, opts = {failFast:true, unknownActionMsg:'Unknown Action'})
    {
        this._events = {}
        this._errorHandler = errorHandler
        this._opts = opts
    }
    setErrorHandler(handler)
    {
        this._errorHandler = handler
    }
    registerPreValidator(eventName, ...validators)
    {
        this._initEvent(eventName)
        validators.forEach(validator =>
        {
            this._events[eventName].preValidators.push(validator)
        })
    }
    registerPostValidator(eventName, ...validators)
    {
        this._initEvent(eventName)
        validators.forEach(validator =>
        {
            this._events[eventName].postValidators.push(validator)
        })
    }
    registerHandler(eventName, ...handlers)
    {
        this._initEvent(eventName)
        handlers.forEach(handler =>
        {
            this._events[eventName].handlers.push(handler)
        })
    }
    registerMiddleware(eventName, ...middlewares)
    {
        this._initEvent(eventName)
        middlewares.forEach(handler =>
        {
            this._events[eventName].middlewares.push(handler)
        })
    }
    _preValidate(eventName, args = [])
    {
        return this._validate(eventName, args, this._events[eventName].preValidators)
    }
    _postValidate(eventName, args = [])
    {
        return this._validate(eventName, args, this._events[eventName].postValidators)
    }
    async _validate(eventName, args, validators)
    {
        let result = []
        if(this._opts.failFast)
        {
            await utils.asyncSome(validators, async validator =>
            {
                let val = await validator.apply(validator, args)
                if(!val)
                {
                    result = [validator.msg]
                    return true
                }
                return false
            })
        }
        else
        {
            result = await validators.reduce(async (acc, validator) =>
            {
                let val = await validator.apply(validator, args)
                return val ? acc: acc.concat(validator.msg)
            }, Promise.resolve([]))
        }
        if(result.length > 0)
        {
            this._errorHandler(result, ...args)
            return false
        }
        return true
    }
    async _applyMiddlewares(eventName, args)
    {
        await this._events[eventName].middlewares.reduce((acc, middleware) => acc.then(result => middleware.apply(middleware, args)), Promise.resolve())
    }
    async _applyHandlers(eventName, args)
    {
        await Promise.all(this._events[eventName].handlers)
    }
    async handle(eventName, ...args)
    {
        if(!this._events[eventName])
        {
            this._errorHandler([this._opts.unknownActionMsg], ...args)
            return
        }
        let preValidationResult = await this._preValidate(eventName, args)
        if(!preValidationResult)
            return
        await this._applyMiddlewares(eventName, args)
        let postValidationResult = await this._postValidate(eventName, args)
        if(!postValidationResult)
            return
        await this._applyHandlers(eventName, args)
    }
    _initEvent(eventName)
    {
        if(!this._events[eventName])
            this._events[eventName] =
            {
                postValidators:[],
                preValidators:[],
                handlers:[],
                middlewares:[]
            }
    }
}

module.exports = EventHandler<commit_msg>fix handlers<commit_after>const utils = require('./utils')

class EventHandler
{
    constructor(errorHandler, opts = {failFast:true, unknownActionMsg:'Unknown Action'})
    {
        this._events = {}
        this._errorHandler = errorHandler
        this._opts = opts
    }
    setErrorHandler(handler)
    {
        this._errorHandler = handler
    }
    registerPreValidator(eventName, ...validators)
    {
        this._initEvent(eventName)
        validators.forEach(validator =>
        {
            this._events[eventName].preValidators.push(validator)
        })
    }
    registerPostValidator(eventName, ...validators)
    {
        this._initEvent(eventName)
        validators.forEach(validator =>
        {
            this._events[eventName].postValidators.push(validator)
        })
    }
    registerHandler(eventName, ...handlers)
    {
        this._initEvent(eventName)
        handlers.forEach(handler =>
        {
            this._events[eventName].handlers.push(handler)
        })
    }
    registerMiddleware(eventName, ...middlewares)
    {
        this._initEvent(eventName)
        middlewares.forEach(handler =>
        {
            this._events[eventName].middlewares.push(handler)
        })
    }
    _preValidate(eventName, args = [])
    {
        return this._validate(eventName, args, this._events[eventName].preValidators)
    }
    _postValidate(eventName, args = [])
    {
        return this._validate(eventName, args, this._events[eventName].postValidators)
    }
    async _validate(eventName, args, validators)
    {
        let result = []
        if(this._opts.failFast)
        {
            await utils.asyncSome(validators, async validator =>
            {
                let val = await validator.apply(validator, args)
                if(!val)
                {
                    result = [validator.msg]
                    return true
                }
                return false
            })
        }
        else
        {
            result = await validators.reduce(async (acc, validator) =>
            {
                let val = await validator.apply(validator, args)
                return val ? acc: acc.concat(validator.msg)
            }, Promise.resolve([]))
        }
        if(result.length > 0)
        {
            this._errorHandler(result, ...args)
            return false
        }
        return true
    }
    async _applyMiddlewares(eventName, args)
    {
        await this._events[eventName].middlewares.reduce((acc, middleware) => acc.then(result => middleware.apply(middleware, args)), Promise.resolve())
    }
    _applyHandlers(eventName, args)
    {
        this._events[eventName].handlers.forEach(handler => handler.apply(handler, args))
    }
    async handle(eventName, ...args)
    {
        if(!this._events[eventName])
        {
            this._errorHandler([this._opts.unknownActionMsg], ...args)
            return
        }
        let preValidationResult = await this._preValidate(eventName, args)
        if(!preValidationResult)
            return
        await this._applyMiddlewares(eventName, args)
        let postValidationResult = await this._postValidate(eventName, args)
        if(!postValidationResult)
            return
        this._applyHandlers(eventName, args)
    }
    _initEvent(eventName)
    {
        if(!this._events[eventName])
            this._events[eventName] =
            {
                postValidators:[],
                preValidators:[],
                handlers:[],
                middlewares:[]
            }
    }
}

module.exports = EventHandler<|endoftext|>


<commit_before>/*
 * Alloy JavaScript Library v0.1
 * http://alloyui.com/
 *
 * Copyright (c) 2009 Liferay Inc.
 * Licensed under the MIT license.
 * http://alloyui.com/License
 *
 * Date: @DATE
 * Revision: @REVISION
 */

;(function() {
	var PATH_BASE = YUI.config.base + '../../../';
	var PATH_JAVASCRIPT = PATH_BASE + 'src/javascript/';
	var PATH_THEME_ROOT = PATH_BASE + 'themes/base/css/';
	var PATH_THEME_IMAGES = PATH_THEME_ROOT + '../images/';

	window.AUI = {
		defaults: {
			classNamePrefix: 'aui',

			//base: '',

			defaultModules: [ 'aui-base' ],

			filter: 'raw',

			modules: {

				/*
				* AUI Base modules
				*/
				'aui-base': {
					fullpath: PATH_JAVASCRIPT + 'base.js',
					requires: [ 'event', 'oop', 'component', 'aui-node', 'collection', 'widget-css' ]
				},
				'widget-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'widget.css',
					type: 'css'
				},

				/*
				* Data Set
				*/
				'data-set': {
					fullpath: PATH_JAVASCRIPT + 'data-set.js',
					requires: [ 'oop', 'collection', 'base' ]
				},

				/*
				* AutoComplete
				*/
				'autocomplete': {
					fullpath: PATH_JAVASCRIPT + 'autocomplete.js',
					requires: [ 'aui-base', 'component-overlay', 'datasource', 'dataschema', 'combobox', 'autocomplete-css' ]
				},
				'autocomplete-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'autocomplete.css',
					type: 'css'
				},

				/*
				* Parse Content
				*/
				'parse-content': {
					fullpath: PATH_JAVASCRIPT + 'parse-content.js',
					requires: [ 'async-queue', 'io', 'plugin' ]
				},

				/*
				* Editable
				*/
				'editable': {
					fullpath: PATH_JAVASCRIPT + 'editable.js',
					requires: [ 'aui-base', 'combobox', 'textarea', 'editable-css' ]
				},
				'editable-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'editable.css',
					type: 'css'
				},

				/*
				* Paginator
				*/
				'paginator': {
					fullpath: PATH_JAVASCRIPT + 'paginator.js',
					requires: [ 'aui-base', 'substitute', 'paginator-css' ]
				},
				'paginator-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'paginator.css',
					type: 'css'
				},

				/*
				* Rating
				*/
				'rating': {
					fullpath: PATH_JAVASCRIPT + 'rating.js',
					requires: [ 'aui-base', 'rating-css' ]
				},
				'rating-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'rating.css',
					type: 'css'
				},

				/*
				* Tool Item
				*/
				'tool-item': {
					fullpath: PATH_JAVASCRIPT + 'tool-item.js',
					requires: [ 'aui-base', 'state-interaction', 'tool-item-css' ]
				},
				'tool-item-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tool-item.css',
					type: 'css'
				},

				/*
				* Tool Set
				*/
				'tool-set': {
					fullpath: PATH_JAVASCRIPT + 'tool-set.js',
					requires: [ 'data-set', 'tool-item', 'tool-set-css' ]
				},
				'tool-set-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tool-set.css',
					type: 'css'
				},

				/*
				* Calendar
				*/
				'calendar': {
					fullpath: PATH_JAVASCRIPT + 'calendar.js',
					requires: [ 'aui-base', 'context-overlay', 'overlay-manager', 'datatype-date', 'calendar-css' ]
				},
				'calendar-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'calendar.css',
					type: 'css'
				},

				/*
				* Calendar
				*/
				'char-counter': {
					fullpath: PATH_JAVASCRIPT + 'char-counter.js',
					requires: [ 'aui-base', 'input-handler' ]
				},

				/*
				* DatePickerSelect
				*/
				'date-picker-select': {
					fullpath: PATH_JAVASCRIPT + 'date-picker-select.js',
					requires: [ 'calendar', 'tool-item', 'date-picker-select-css' ]
				},
				'date-picker-select-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'date-picker-select.css',
					type: 'css'
				},

				/*
				* ContextPanel
				*/
				'context-panel': {
					fullpath: PATH_JAVASCRIPT + 'context-panel.js',
					requires: [ 'context-overlay', 'anim', 'context-panel-css' ]
				},
				'context-panel-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'context-panel.css',
					type: 'css'
				},

				/*
				* ColorPicker
				*/
				'color-picker': {
					fullpath: PATH_JAVASCRIPT + 'color-picker.js',
					requires: [ 'context-overlay', 'dd', 'slider', 'substitute', 'tool-item', 'form', 'panel', 'color-picker-css' ]
				},
				'color-picker-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'color-picker.css',
					type: 'css'
				},

				/*
				* Tooltip
				*/
				'tooltip': {
					fullpath: PATH_JAVASCRIPT + 'tooltip.js',
					requires: [ 'context-panel', 'tooltip-css' ]
				},
				'tooltip-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tooltip.css',
					type: 'css'
				},

				/*
				* TreeData
				*/
				'tree-data': {
					fullpath: PATH_JAVASCRIPT + 'tree-data.js',
					requires: [ 'aui-base' ]
				},

				/*
				* TreeNode
				*/
				'tree-node': {
					fullpath: PATH_JAVASCRIPT + 'tree-node.js',
					requires: [ 'tree-data', 'io', 'json', 'tree-css' ]
				},

				/*
				* TreeView
				*/
				'tree-view': {
					fullpath: PATH_JAVASCRIPT + 'tree-view.js',
					requires: [ 'tree-node', 'dd', 'tree-css' ]
				},

				'tree-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tree.css',
					type: 'css'
				},

				/*
				* TextboxList
				*/
				'textboxlist': {
					fullpath: PATH_JAVASCRIPT + 'textboxlist.js',
					requires: [ 'anim-node-plugin', 'aui-base', 'autocomplete', 'node-focusmanager', 'textboxlist-css' ]
				},

				'textboxlist-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'textboxlist.css',
					type: 'css'
				},

				/*
				* Dialog
				*/
				'dialog': {
					fullpath: PATH_JAVASCRIPT + 'dialog.js',
					requires: [ 'plugin', 'panel', 'dd-constrain', 'aui-base', 'tool-item', 'overlay-manager', 'overlay-mask', 'io-plugin', 'dialog-css' ]
				},
				'dialog-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'dialog.css',
					type: 'css'
				},

				/*
				* Component Overlay
				*/
				'component-overlay': {
					fullpath: PATH_JAVASCRIPT + 'component-overlay.js',
					requires: [ 'component', 'widget-position', 'widget-stack', 'widget-position-ext', 'widget-stdmod' ]
				},

				/*
				* Tabs
				*/
				'tabs': {
					fullpath: PATH_JAVASCRIPT + 'tabs.js',
					requires: ['component', 'state-interaction', 'tabs-css']
				},
				'tabs-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tabs.css',
					type: 'css'
				},

				/*
				* Resize
				*/
				'resize': {
					fullpath: PATH_JAVASCRIPT + 'resize.js',
					requires: [ 'aui-base', 'dd', 'resize-css' ]
				},
				'resize-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'resize.css',
					type: 'css'
				},
				'resize-plugin': {
					fullpath: PATH_JAVASCRIPT + 'resize.js',
					requires: [ 'resize' ]
				},

				/*
				* Sortable
				*/
				'sortable': {
					fullpath: PATH_JAVASCRIPT + 'sortable.js',
					requires: [ 'aui-base', 'dd', 'sortable-css' ]
				},
				'sortable-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'sortable.css',
					type: 'css'
				},

				/*
				* LiveSearch
				*/
				'live-search': {
					fullpath: PATH_JAVASCRIPT + 'live-search.js',
					requires: [ 'aui-base' ]
				},

				/*
				* Nested list
				*/
				'nested-list': {
					fullpath: PATH_JAVASCRIPT + 'nested-list.js',
					requires: [ 'aui-base', 'dd' ]
				},

				/*
				* ContextOverlay
				*/
				'context-overlay': {
					fullpath: PATH_JAVASCRIPT + 'context-overlay.js',
					requires: [ 'aui-base', 'component-overlay', 'overlay-manager', 'delayed-task' ]
				},

				/*
				* OverlayManager
				*/
				'overlay-manager': {
					fullpath: PATH_JAVASCRIPT + 'overlay-manager.js',
					requires: [ 'aui-base', 'component', 'component-overlay', 'overlay', 'plugin' ]
				},

				/*
				* OverlayMask
				*/
				'overlay-mask': {
					fullpath: PATH_JAVASCRIPT + 'overlay-mask.js',
					requires: [ 'aui-base', 'component-overlay', 'event-resize' ]
				},

				/*
				* Module
				*/
				'panel': {
					fullpath: PATH_JAVASCRIPT + 'panel.js',
					requires: [ 'component', 'widget-stdmod', 'tool-set', 'panel-css' ]
				},
				'panel-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'panel.css',
					type: 'css'
				},

				/*
				* Form
				*/
				'form': {
					fullpath: PATH_JAVASCRIPT + 'form.js',
					requires: [ 'aui-base', 'data-set', 'io-form', 'field' ]
				},

				/*
				* Fieldset
				*/
				'fieldset': {
					fullpath: PATH_JAVASCRIPT + 'fieldset.js',
					requires: [ 'panel' ]
				},

				/*
				* Field
				*/
				'field': {
					fullpath: PATH_JAVASCRIPT + 'field.js',
					requires: [ 'substitute' ]
				},

				/*
				* Textfield
				*/
				'textfield': {
					fullpath: PATH_JAVASCRIPT + 'textfield.js',
					requires: [ 'field' ]
				},

				/*
				* Textarea
				*/
				'textarea': {
					fullpath: PATH_JAVASCRIPT + 'textarea.js',
					requires: [ 'textfield', 'textarea-css' ]
				},
				'textarea-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'textarea.css',
					type: 'css'
				},

				/*
				* Combobox
				*/
				'combobox': {
					fullpath: PATH_JAVASCRIPT + 'combobox.js',
					requires: [ 'textarea', 'tool-set', 'combobox-css' ]
				},
				'combobox-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'combobox.css',
					type: 'css'
				},

				/*
				* Component
				*/
				'component': {
					fullpath: PATH_JAVASCRIPT + 'component.js',
					requires: [ 'widget' ]
				},

				/*
				* IO Plugin
				*/
				'io-plugin': {
					fullpath: PATH_JAVASCRIPT + 'io-plugin.js',
					requires: [ 'aui-base', 'component-overlay', 'parse-content', 'io-request', 'plugin' ]
				},

				/*
				* Input Event Handler
				*/
				'input-handler': {
					fullpath: PATH_JAVASCRIPT + 'input-handler.js'
				},

				/*
				* IO Ajax configuration
				*/
				'io-request': {
					fullpath: PATH_JAVASCRIPT + 'io-request.js',
					requires: [ 'aui-base', 'io', 'json', 'plugin' ]
				},

				/*
				* Image Viewer
				*/
				'image-viewer': {
					fullpath: PATH_JAVASCRIPT + 'image-viewer.js',
					requires: [ 'aui-base', 'anim', 'overlay-mask', 'substitute', 'image-viewer-css' ]
				},

				'image-viewer-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'image-viewer.css',
					type: 'css'
				},

				/*
				* ImageGallery
				*/
				'image-gallery': {
					fullpath: PATH_JAVASCRIPT + 'image-gallery.js',
					requires: [ 'image-viewer', 'paginator', 'tool-set', 'image-gallery-css' ]
				},

				'image-gallery-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'image-gallery.css',
					type: 'css'
				},

				/*
				* State Interaction plugin
				*/
				'state-interaction': {
					fullpath: PATH_JAVASCRIPT + 'state-interaction.js',
					requires: [ 'aui-base', 'plugin' ]
				},

				/*
				* Chart Widgets
				*/
				'chart': {
					fullpath: PATH_JAVASCRIPT + 'chart.js',
					requires: [ 'datasource', 'swf', 'json' ]
				},

				/*
				* SWF Utility
				*/
				'swf': {
					fullpath: PATH_JAVASCRIPT + 'swf.js',
					requires: [ 'aui-base' ]
				}
			},

			paths: {
				images: PATH_THEME_IMAGES,
				javascript: PATH_JAVASCRIPT,
				theme: PATH_THEME_ROOT
			},

			io: {
				method: 'GET'
			},

			chart: {
				swfURL: 'assets/chart.swf'
			}
		}
	}
})();<commit_msg>Fix for calendar to use the new i18n features<commit_after>/*
 * Alloy JavaScript Library v0.1
 * http://alloyui.com/
 *
 * Copyright (c) 2009 Liferay Inc.
 * Licensed under the MIT license.
 * http://alloyui.com/License
 *
 * Date: @DATE
 * Revision: @REVISION
 */

;(function() {
	var PATH_BASE = YUI.config.base + '../../../';
	var PATH_JAVASCRIPT = PATH_BASE + 'src/javascript/';
	var PATH_THEME_ROOT = PATH_BASE + 'themes/base/css/';
	var PATH_THEME_IMAGES = PATH_THEME_ROOT + '../images/';

	window.AUI = {
		defaults: {
			classNamePrefix: 'aui',

			//base: '',

			defaultModules: [ 'aui-base' ],

			filter: 'raw',

			modules: {

				/*
				* AUI Base modules
				*/
				'aui-base': {
					fullpath: PATH_JAVASCRIPT + 'base.js',
					requires: [ 'event', 'oop', 'component', 'aui-node', 'collection', 'widget-css' ]
				},
				'widget-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'widget.css',
					type: 'css'
				},

				/*
				* Data Set
				*/
				'data-set': {
					fullpath: PATH_JAVASCRIPT + 'data-set.js',
					requires: [ 'oop', 'collection', 'base' ]
				},

				/*
				* AutoComplete
				*/
				'autocomplete': {
					fullpath: PATH_JAVASCRIPT + 'autocomplete.js',
					requires: [ 'aui-base', 'component-overlay', 'datasource', 'dataschema', 'combobox', 'autocomplete-css' ]
				},
				'autocomplete-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'autocomplete.css',
					type: 'css'
				},

				/*
				* Parse Content
				*/
				'parse-content': {
					fullpath: PATH_JAVASCRIPT + 'parse-content.js',
					requires: [ 'async-queue', 'io', 'plugin' ]
				},

				/*
				* Editable
				*/
				'editable': {
					fullpath: PATH_JAVASCRIPT + 'editable.js',
					requires: [ 'aui-base', 'combobox', 'textarea', 'editable-css' ]
				},
				'editable-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'editable.css',
					type: 'css'
				},

				/*
				* Paginator
				*/
				'paginator': {
					fullpath: PATH_JAVASCRIPT + 'paginator.js',
					requires: [ 'aui-base', 'substitute', 'paginator-css' ]
				},
				'paginator-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'paginator.css',
					type: 'css'
				},

				/*
				* Rating
				*/
				'rating': {
					fullpath: PATH_JAVASCRIPT + 'rating.js',
					requires: [ 'aui-base', 'rating-css' ]
				},
				'rating-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'rating.css',
					type: 'css'
				},

				/*
				* Tool Item
				*/
				'tool-item': {
					fullpath: PATH_JAVASCRIPT + 'tool-item.js',
					requires: [ 'aui-base', 'state-interaction', 'tool-item-css' ]
				},
				'tool-item-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tool-item.css',
					type: 'css'
				},

				/*
				* Tool Set
				*/
				'tool-set': {
					fullpath: PATH_JAVASCRIPT + 'tool-set.js',
					requires: [ 'data-set', 'tool-item', 'tool-set-css' ]
				},
				'tool-set-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tool-set.css',
					type: 'css'
				},

				/*
				* Calendar
				*/
				'calendar': {
					fullpath: PATH_JAVASCRIPT + 'calendar.js',
					requires: [ 'aui-base', 'context-overlay', 'overlay-manager', 'datatype-date', 'widget-i18n', 'calendar-css' ]
				},
				'calendar-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'calendar.css',
					type: 'css'
				},

				/*
				* Calendar
				*/
				'char-counter': {
					fullpath: PATH_JAVASCRIPT + 'char-counter.js',
					requires: [ 'aui-base', 'input-handler' ]
				},

				/*
				* DatePickerSelect
				*/
				'date-picker-select': {
					fullpath: PATH_JAVASCRIPT + 'date-picker-select.js',
					requires: [ 'calendar', 'tool-item', 'date-picker-select-css' ]
				},
				'date-picker-select-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'date-picker-select.css',
					type: 'css'
				},

				/*
				* ContextPanel
				*/
				'context-panel': {
					fullpath: PATH_JAVASCRIPT + 'context-panel.js',
					requires: [ 'context-overlay', 'anim', 'context-panel-css' ]
				},
				'context-panel-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'context-panel.css',
					type: 'css'
				},

				/*
				* ColorPicker
				*/
				'color-picker': {
					fullpath: PATH_JAVASCRIPT + 'color-picker.js',
					requires: [ 'context-overlay', 'dd', 'slider', 'substitute', 'tool-item', 'form', 'panel', 'color-picker-css' ]
				},
				'color-picker-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'color-picker.css',
					type: 'css'
				},

				/*
				* Tooltip
				*/
				'tooltip': {
					fullpath: PATH_JAVASCRIPT + 'tooltip.js',
					requires: [ 'context-panel', 'tooltip-css' ]
				},
				'tooltip-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tooltip.css',
					type: 'css'
				},

				/*
				* TreeData
				*/
				'tree-data': {
					fullpath: PATH_JAVASCRIPT + 'tree-data.js',
					requires: [ 'aui-base' ]
				},

				/*
				* TreeNode
				*/
				'tree-node': {
					fullpath: PATH_JAVASCRIPT + 'tree-node.js',
					requires: [ 'tree-data', 'io', 'json', 'tree-css' ]
				},

				/*
				* TreeView
				*/
				'tree-view': {
					fullpath: PATH_JAVASCRIPT + 'tree-view.js',
					requires: [ 'tree-node', 'dd', 'tree-css' ]
				},

				'tree-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tree.css',
					type: 'css'
				},

				/*
				* TextboxList
				*/
				'textboxlist': {
					fullpath: PATH_JAVASCRIPT + 'textboxlist.js',
					requires: [ 'anim-node-plugin', 'aui-base', 'autocomplete', 'node-focusmanager', 'textboxlist-css' ]
				},

				'textboxlist-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'textboxlist.css',
					type: 'css'
				},

				/*
				* Dialog
				*/
				'dialog': {
					fullpath: PATH_JAVASCRIPT + 'dialog.js',
					requires: [ 'plugin', 'panel', 'dd-constrain', 'aui-base', 'tool-item', 'overlay-manager', 'overlay-mask', 'io-plugin', 'dialog-css' ]
				},
				'dialog-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'dialog.css',
					type: 'css'
				},

				/*
				* Component Overlay
				*/
				'component-overlay': {
					fullpath: PATH_JAVASCRIPT + 'component-overlay.js',
					requires: [ 'component', 'widget-position', 'widget-stack', 'widget-position-ext', 'widget-stdmod' ]
				},

				/*
				* Tabs
				*/
				'tabs': {
					fullpath: PATH_JAVASCRIPT + 'tabs.js',
					requires: ['component', 'state-interaction', 'tabs-css']
				},
				'tabs-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'tabs.css',
					type: 'css'
				},

				/*
				* Resize
				*/
				'resize': {
					fullpath: PATH_JAVASCRIPT + 'resize.js',
					requires: [ 'aui-base', 'dd', 'resize-css' ]
				},
				'resize-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'resize.css',
					type: 'css'
				},
				'resize-plugin': {
					fullpath: PATH_JAVASCRIPT + 'resize.js',
					requires: [ 'resize' ]
				},

				/*
				* Sortable
				*/
				'sortable': {
					fullpath: PATH_JAVASCRIPT + 'sortable.js',
					requires: [ 'aui-base', 'dd', 'sortable-css' ]
				},
				'sortable-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'sortable.css',
					type: 'css'
				},

				/*
				* LiveSearch
				*/
				'live-search': {
					fullpath: PATH_JAVASCRIPT + 'live-search.js',
					requires: [ 'aui-base' ]
				},

				/*
				* Nested list
				*/
				'nested-list': {
					fullpath: PATH_JAVASCRIPT + 'nested-list.js',
					requires: [ 'aui-base', 'dd' ]
				},

				/*
				* ContextOverlay
				*/
				'context-overlay': {
					fullpath: PATH_JAVASCRIPT + 'context-overlay.js',
					requires: [ 'aui-base', 'component-overlay', 'overlay-manager', 'delayed-task' ]
				},

				/*
				* OverlayManager
				*/
				'overlay-manager': {
					fullpath: PATH_JAVASCRIPT + 'overlay-manager.js',
					requires: [ 'aui-base', 'component', 'component-overlay', 'overlay', 'plugin' ]
				},

				/*
				* OverlayMask
				*/
				'overlay-mask': {
					fullpath: PATH_JAVASCRIPT + 'overlay-mask.js',
					requires: [ 'aui-base', 'component-overlay', 'event-resize' ]
				},

				/*
				* Module
				*/
				'panel': {
					fullpath: PATH_JAVASCRIPT + 'panel.js',
					requires: [ 'component', 'widget-stdmod', 'tool-set', 'panel-css' ]
				},
				'panel-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'panel.css',
					type: 'css'
				},

				/*
				* Form
				*/
				'form': {
					fullpath: PATH_JAVASCRIPT + 'form.js',
					requires: [ 'aui-base', 'data-set', 'io-form', 'field' ]
				},

				/*
				* Fieldset
				*/
				'fieldset': {
					fullpath: PATH_JAVASCRIPT + 'fieldset.js',
					requires: [ 'panel' ]
				},

				/*
				* Field
				*/
				'field': {
					fullpath: PATH_JAVASCRIPT + 'field.js',
					requires: [ 'substitute' ]
				},

				/*
				* Textfield
				*/
				'textfield': {
					fullpath: PATH_JAVASCRIPT + 'textfield.js',
					requires: [ 'field' ]
				},

				/*
				* Textarea
				*/
				'textarea': {
					fullpath: PATH_JAVASCRIPT + 'textarea.js',
					requires: [ 'textfield', 'textarea-css' ]
				},
				'textarea-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'textarea.css',
					type: 'css'
				},

				/*
				* Combobox
				*/
				'combobox': {
					fullpath: PATH_JAVASCRIPT + 'combobox.js',
					requires: [ 'textarea', 'tool-set', 'combobox-css' ]
				},
				'combobox-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'combobox.css',
					type: 'css'
				},

				/*
				* Component
				*/
				'component': {
					fullpath: PATH_JAVASCRIPT + 'component.js',
					requires: [ 'widget' ]
				},

				/*
				* IO Plugin
				*/
				'io-plugin': {
					fullpath: PATH_JAVASCRIPT + 'io-plugin.js',
					requires: [ 'aui-base', 'component-overlay', 'parse-content', 'io-request', 'plugin' ]
				},

				/*
				* Input Event Handler
				*/
				'input-handler': {
					fullpath: PATH_JAVASCRIPT + 'input-handler.js'
				},

				/*
				* IO Ajax configuration
				*/
				'io-request': {
					fullpath: PATH_JAVASCRIPT + 'io-request.js',
					requires: [ 'aui-base', 'io', 'json', 'plugin' ]
				},

				/*
				* Image Viewer
				*/
				'image-viewer': {
					fullpath: PATH_JAVASCRIPT + 'image-viewer.js',
					requires: [ 'aui-base', 'anim', 'overlay-mask', 'substitute', 'image-viewer-css' ]
				},

				'image-viewer-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'image-viewer.css',
					type: 'css'
				},

				/*
				* ImageGallery
				*/
				'image-gallery': {
					fullpath: PATH_JAVASCRIPT + 'image-gallery.js',
					requires: [ 'image-viewer', 'paginator', 'tool-set', 'image-gallery-css' ]
				},

				'image-gallery-css': {
					ext: false,
					fullpath: PATH_THEME_ROOT + 'image-gallery.css',
					type: 'css'
				},

				/*
				* State Interaction plugin
				*/
				'state-interaction': {
					fullpath: PATH_JAVASCRIPT + 'state-interaction.js',
					requires: [ 'aui-base', 'plugin' ]
				},

				/*
				* Chart Widgets
				*/
				'chart': {
					fullpath: PATH_JAVASCRIPT + 'chart.js',
					requires: [ 'datasource', 'swf', 'json' ]
				},

				/*
				* SWF Utility
				*/
				'swf': {
					fullpath: PATH_JAVASCRIPT + 'swf.js',
					requires: [ 'aui-base' ]
				}
			},

			paths: {
				images: PATH_THEME_IMAGES,
				javascript: PATH_JAVASCRIPT,
				theme: PATH_THEME_ROOT
			},

			io: {
				method: 'GET'
			},

			chart: {
				swfURL: 'assets/chart.swf'
			}
		}
	}
})();<|endoftext|>