<commit_before>/*
 * Copyright (C) 2012 B3Partners B.V.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

Ext.define("viewer.components.CustomConfiguration",{
    extend: "viewer.components.ConfigObject",
    form: null,
    constructor: function (parentid,config){
        viewer.components.CustomConfiguration.superclass.constructor.call(this, parentid,config);
        if(config == undefined || config == null){
            config = new Object();
        }
        var me=this;
        this.form = new Ext.form.FormPanel({
            url: 'Home/SubmitForm',
            frame: false,
            title: 'Configureer dit component',
            bodyPadding: me.formPadding,
            defaults: {
                anchor: '100%'
            },
            width: me.formWidth,
            items: [{
                xtype: 'textfield',
                fieldLabel: 'Naam',
                name: 'title',
                value: config.title,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Kaarten en kaartlaaggroepen krijgen een vinkvak',
                inputValue: true,
                name: 'groupCheck',
                checked: config.groupCheck? config.groupCheck : true,
                value: config.groupCheck? config.groupCheck : true,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Kaartlagen krijgen een vinkvak',
                inputValue: true,
                name: 'layersChecked',
                checked: config.layersChecked? config.layersChecked: true,
                value: config.layersChecked? config.layersChecked: true,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Achtergrondkaarten tonen',
                inputValue: true,
                name: 'showBaselayers',
                checked: config.showBaselayers? config.showBaselayers: true,
                value: config.showBaselayers? config.showBaselayers: true,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Algemeen icoon voor kaartlaag tonen',
                inputValue: true,
                name: 'showLeafIcon',
                checked: config.showLeafIcon? config.showLeafIcon:true,
                value: config.showLeafIcon? config.showLeafIcon:true,
                labelWidth:me.labelWidth
            }],

            renderTo: parentid//(2)
        });
    },
    getConfiguration: function(){
        var config = new Object();
        for( var i = 0 ; i < this.form.items.length ; i++){
            config[this.form.items.get(i).name] = this.form.items.get(i).value;
        }
        return config;
    }
});
<commit_msg>zoomToScaleText is configurable for toc.<commit_after>/*
 * Copyright (C) 2012 B3Partners B.V.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

Ext.define("viewer.components.CustomConfiguration",{
    extend: "viewer.components.ConfigObject",
    form: null,
    constructor: function (parentid,config){
        viewer.components.CustomConfiguration.superclass.constructor.call(this, parentid,config);
        if(config == undefined || config == null){
            config = new Object();
        }
        var me=this;
        this.form = new Ext.form.FormPanel({
            url: 'Home/SubmitForm',
            frame: false,
            title: 'Configureer dit component',
            bodyPadding: me.formPadding,
            defaults: {
                anchor: '100%'
            },
            width: me.formWidth,
            items: [{
                xtype: 'textfield',
                fieldLabel: 'Naam',
                name: 'title',
                value: config.title,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Kaarten en kaartlaaggroepen krijgen een vinkvak',
                inputValue: true,
                name: 'groupCheck',
                checked: config.groupCheck? config.groupCheck : true,
                value: config.groupCheck? config.groupCheck : true,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Kaartlagen krijgen een vinkvak',
                inputValue: true,
                name: 'layersChecked',
                checked: config.layersChecked? config.layersChecked: true,
                value: config.layersChecked? config.layersChecked: true,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Achtergrondkaarten tonen',
                inputValue: true,
                name: 'showBaselayers',
                checked: config.showBaselayers? config.showBaselayers: true,
                value: config.showBaselayers? config.showBaselayers: true,
                labelWidth:me.labelWidth
            },{
                xtype: 'checkbox',
                fieldLabel: 'Algemeen icoon voor kaartlaag tonen',
                inputValue: true,
                name: 'showLeafIcon',
                checked: config.showLeafIcon? config.showLeafIcon:true,
                value: config.showLeafIcon? config.showLeafIcon:true,
                labelWidth:me.labelWidth
            },{
                xtype: 'textfield',
                fieldLabel: 'Zoom naar schaal tekst',
                name: 'zoomToScaleText',
                value: config.zoomToScaleText,
                labelWidth:me.labelWidth
            }],

            renderTo: parentid//(2)
        });
    },
    getConfiguration: function(){
        var config = new Object();
        for( var i = 0 ; i < this.form.items.length ; i++){
            config[this.form.items.get(i).name] = this.form.items.get(i).value;
        }
        return config;
    }
});
<|endoftext|>


<commit_before>app.controller("HomeController", [
    "$scope",
    "$location",
    "$log",
    "$localStorage",
    "Request",
    "domainBase",
    "whoisUrl",
    function ($scope, $location, $log, $localStorage, Request, domainBase, whoisUrl) {
        'use strict';
        var expression = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
        var regex = new RegExp(expression);

        $scope.whois = function () {
            $scope.error = null;
            $scope.warn = null;
            $scope.status = null;
            $scope.disableBtn = true;
            if (!!!$scope.domain.match(regex)) {
                $scope.error = "Your input is not a valid domain name.";
                $scope.status = 400;
            } else {
                var data = ($.url($scope.domain)).attr();
                var requestUrl = domainBase + whoisUrl;
                // console.log($scope.domain, data);
                Request.fetch(requestUrl, data)
                    .then(function (response) {
                        // body...
                        if (!response.success) {
                            $scope.warn = response.message;
                            $scope.status = response.status + ' -';
                        }
                        $localStorage.domain = response.data;

                        $location.path('/verify');

                    }, function (error) {
                        // body...
                        $scope.error = error.statusText;
                        $scope.status = error.status + ' -';
                    });
            }

            $scope.disableBtn = false;

        };
    }]);
<commit_msg>update home controller<commit_after>app.controller("HomeController", [
    "$scope",
    "$location",
    "$log",
    "$localStorage",
    "Request",
    "domainBase",
    "whoisUrl",
    function ($scope, $location, $log, $localStorage, Request, domainBase, whoisUrl) {
        'use strict';
        var expression = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
        var regex = new RegExp(expression);

        $scope.whois = function () {
            $scope.error = null;
            $scope.warn = null;
            $scope.status = null;
            $scope.disableBtn = true;
            if (!!!$scope.domain.match(regex)) {
                $scope.error = "Your input is not a valid domain name.";
                $scope.status = 400;
            } else {
                var data = ($.url($scope.domain)).attr();
                var requestUrl = domainBase + whoisUrl;
                // console.log($scope.domain, data);
                Request.fetch(requestUrl, data)
                    .then(function (response) {
                        // body...
                        if (!response.success) {
                            $scope.warn = response.message;
                            $scope.status = response.status + ' -';
                        }
                        $localStorage.domain = response.data;

                        $location.path('/verify');

                    }, function (error) {
                        // body...
                        console.log(error);
                        $scope.error = error.statusText + ". We've notified the developers.";
                        $scope.status = error.status + ' -';
                    });
            }

            $scope.disableBtn = false;

        };
    }]);
<|endoftext|>


<commit_before>(function () {
    'use strict';

    /**
     * A component for split view content editing
     */
    var umbVariantContentEditors = {
        templateUrl: 'views/components/content/umb-variant-content-editors.html',
        bindings: {
            page: "<",
            content: "<",
            culture: "<",
            segment: "<",
            onSelectApp: "&?",
            onSelectAppAnchor: "&?",
            onBack: "&?",
            showBack: "<?"
        },
        controllerAs: 'vm',
        controller: umbVariantContentEditorsController
    };

    function umbVariantContentEditorsController($scope, $location, contentEditingHelper) {

        var prevContentDateUpdated = null;

        var vm = this;

        vm.$onInit = onInit;
        vm.$onChanges = onChanges;
        vm.$doCheck = doCheck;
        vm.$postLink = postLink;

        vm.openSplitView = openSplitView;
        vm.closeSplitView = closeSplitView;
        vm.selectVariant = selectVariant;
        vm.selectApp = selectApp;
        vm.selectAppAnchor = selectAppAnchor;

        //Used to track how many content views there are (for split view there will be 2, it could support more in theory)
        vm.editors = [];

        /** Called when the component initializes */
        function onInit() {
            prevContentDateUpdated = Utilities.copy(vm.content.updateDate);
            setActiveVariant();
        }

        /** Called when the component has linked all elements, this is when the form controller is available */
        function postLink() {

        }

        /**
         * Watch for model changes
         * @param {any} changes
         */
        function onChanges(changes) {

            if (changes.culture && !changes.culture.isFirstChange() && changes.culture.currentValue !== changes.culture.previousValue) {
                setActiveVariant();
            } else if (changes.segment && !changes.segment.isFirstChange() && changes.segment.currentValue !== changes.segment.previousValue) {
                setActiveVariant();
            }
        }

        /** Allows us to deep watch whatever we want - executes on every digest cycle */
        function doCheck() {
            if (!angular.equals(vm.content.updateDate, prevContentDateUpdated)) {
                setActiveVariant();
                prevContentDateUpdated = Utilities.copy(vm.content.updateDate);
            }
        }

        /** This is called when the split view changes based on the umb-variant-content */
        function splitViewChanged() {
            //send an event downwards
            $scope.$broadcast("editors.content.splitViewChanged", { editors: vm.editors });
        }

        /**
         * Set the active variant based on the current culture or segment (query string)
         */
        function setActiveVariant() {
            // set the active variant
            var activeVariant = null;
            _.each(vm.content.variants, function (v) {
                if ((vm.culture === "invariant" || v.language && v.language.culture === vm.culture) && v.segment === vm.segment) {
                    activeVariant = v;
                }
            });
            if (!activeVariant) {
                // Set the first variant to active if we can't find it.
                // If the content item is invariant, then only one item exists in the array.
                activeVariant = vm.content.variants[0];
            }

            insertVariantEditor(0, activeVariant);

            if (vm.editors.length > 1) {
                //now re-sync any other editor content (i.e. if split view is open)
                for (var s = 1; s < vm.editors.length; s++) {
                    //get the variant from the scope model
                    var variant = _.find(vm.content.variants, function (v) {
                        return (!v.language || v.language.culture === vm.editors[s].content.language.culture) && v.segment === vm.editors[s].content.segment;
                    });
                    vm.editors[s].content = variant;
                }
            }

        }

        /**
         * Updates the editors collection for a given index for the specified variant
         * @param {any} index
         * @param {any} variant
         */
        function insertVariantEditor(index, variant) {

            if (vm.editors[index]) {
                if (vm.editors[index].content === variant) {
                    console.error("This editor is already in this place.");
                    return;
                }
                vm.editors[index].content.active = false;
            }
            variant.active = true;

            var variantCulture = variant.language ? variant.language.culture : "invariant";
            var variantSegment = variant.segment;

            var currentCulture = index < vm.editors.length ? vm.editors[index].culture : null;
            var currentSegment = index < vm.editors.length ? vm.editors[index].segment : null;

            // if index not already exists or if the culture or segment isnt identical then we do a replacement.
            if (index >= vm.editors.length || currentCulture !== variantCulture || currentSegment !== variantSegment) {

                //Not the current culture or segment which means we need to modify the array.
                //NOTE: It is not good enough to just replace the `content` object at a given index in the array
                // since that would mean that directives are not re-initialized.
                vm.editors.splice(index, 1, {
                    compositeId: variant.compositeId,
                    content: variant,
                    culture: variantCulture,
                    segment: variantSegment
                });
            }
            else {
                //replace the content of the editor, since the cultura and segment is the same.
                vm.editors[index].content = variant;
            }

        }

        /**
         * Adds a new editor to the editors array to show content in a split view
         * @param {any} selectedVariant
         */
        function openSplitView(selectedVariant) {
            // enforce content contentApp in splitview.
            var contentApp = vm.content.apps.find((app) => app.alias === "umbContent");
            if(contentApp) {
                selectApp(contentApp);
            }

            insertVariantEditor(vm.editors.length, selectedVariant);

            splitViewChanged();

        }

        $scope.$on("editors.content.splitViewRequest", function(event, args) {requestSplitView(args);});
        vm.requestSplitView = requestSplitView;
        function requestSplitView(args) {
            var culture = args.culture;
            var segment = args.segment;

            var variant = _.find(vm.content.variants, function (v) {
                return (!v.language || v.language.culture === culture) && v.segment === segment;
            });

            if (variant != null) {
                openSplitView(variant);
            }
        }

        /** Closes the split view */
        function closeSplitView(editorIndex) {
            // TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular
            var editor = vm.editors[editorIndex];
            vm.editors.splice(editorIndex, 1);
            editor.content.active = false;

            //update the current culture to reflect the last open variant (closing the split view corresponds to selecting the other variant)

            $location.search({"cculture": vm.editors[0].content.language ? vm.editors[0].content.language.culture : null, "csegment": vm.editors[0].content.segment});
            splitViewChanged();
        }

        /**
         * Changes the currently selected variant
         * @param {any} variant This is the model of the variant/language drop down item in the editor header
         * @param {any} editorIndex The index of the editor being changed
         */
        function selectVariant(variant, editorIndex) {

            var variantCulture = variant.language ? variant.language.culture : "invariant";
            var variantSegment = variant.segment || null;

            // Check if we already have this editor open, if so, do nothing.
            if (vm.editors.find((editor) => (!editor.content.language || editor.content.language.culture === variantCulture) && editor.content.segment === variantSegment)) {
                return;
            }

            //if the editor index is zero, then update the query string to track the lang selection, otherwise if it's part
            //of a 2nd split view editor then update the model directly.
            if (editorIndex === 0) {
                //If we've made it this far, then update the query string.
                //The editor will respond to this query string changing.
                $location.search("cculture", variantCulture).search("csegment", variantSegment);
            }
            else {

                //update the editors collection
                insertVariantEditor(editorIndex, variant);

            }
        }

        /**
         * Stores the active app in a variable so we can remember it when changing language
         * @param {any} app This is the model of the selected app
         */
        function selectApp(app) {
            if(vm.onSelectApp) {
                vm.onSelectApp({"app": app});
            }
        }

        function selectAppAnchor(app, anchor) {
            if(vm.onSelectAppAnchor) {
                vm.onSelectAppAnchor({"app": app, "anchor": anchor});
            }
        }

    }

    angular.module('umbraco.directives').component('umbVariantContentEditors', umbVariantContentEditors);

})();
<commit_msg>correct spelling mistake<commit_after>(function () {
    'use strict';

    /**
     * A component for split view content editing
     */
    var umbVariantContentEditors = {
        templateUrl: 'views/components/content/umb-variant-content-editors.html',
        bindings: {
            page: "<",
            content: "<",
            culture: "<",
            segment: "<",
            onSelectApp: "&?",
            onSelectAppAnchor: "&?",
            onBack: "&?",
            showBack: "<?"
        },
        controllerAs: 'vm',
        controller: umbVariantContentEditorsController
    };

    function umbVariantContentEditorsController($scope, $location, contentEditingHelper) {

        var prevContentDateUpdated = null;

        var vm = this;

        vm.$onInit = onInit;
        vm.$onChanges = onChanges;
        vm.$doCheck = doCheck;
        vm.$postLink = postLink;

        vm.openSplitView = openSplitView;
        vm.closeSplitView = closeSplitView;
        vm.selectVariant = selectVariant;
        vm.selectApp = selectApp;
        vm.selectAppAnchor = selectAppAnchor;

        //Used to track how many content views there are (for split view there will be 2, it could support more in theory)
        vm.editors = [];

        /** Called when the component initializes */
        function onInit() {
            prevContentDateUpdated = Utilities.copy(vm.content.updateDate);
            setActiveVariant();
        }

        /** Called when the component has linked all elements, this is when the form controller is available */
        function postLink() {

        }

        /**
         * Watch for model changes
         * @param {any} changes
         */
        function onChanges(changes) {

            if (changes.culture && !changes.culture.isFirstChange() && changes.culture.currentValue !== changes.culture.previousValue) {
                setActiveVariant();
            } else if (changes.segment && !changes.segment.isFirstChange() && changes.segment.currentValue !== changes.segment.previousValue) {
                setActiveVariant();
            }
        }

        /** Allows us to deep watch whatever we want - executes on every digest cycle */
        function doCheck() {
            if (!angular.equals(vm.content.updateDate, prevContentDateUpdated)) {
                setActiveVariant();
                prevContentDateUpdated = Utilities.copy(vm.content.updateDate);
            }
        }

        /** This is called when the split view changes based on the umb-variant-content */
        function splitViewChanged() {
            //send an event downwards
            $scope.$broadcast("editors.content.splitViewChanged", { editors: vm.editors });
        }

        /**
         * Set the active variant based on the current culture or segment (query string)
         */
        function setActiveVariant() {
            // set the active variant
            var activeVariant = null;
            _.each(vm.content.variants, function (v) {
                if ((vm.culture === "invariant" || v.language && v.language.culture === vm.culture) && v.segment === vm.segment) {
                    activeVariant = v;
                }
            });
            if (!activeVariant) {
                // Set the first variant to active if we can't find it.
                // If the content item is invariant, then only one item exists in the array.
                activeVariant = vm.content.variants[0];
            }

            insertVariantEditor(0, activeVariant);

            if (vm.editors.length > 1) {
                //now re-sync any other editor content (i.e. if split view is open)
                for (var s = 1; s < vm.editors.length; s++) {
                    //get the variant from the scope model
                    var variant = _.find(vm.content.variants, function (v) {
                        return (!v.language || v.language.culture === vm.editors[s].content.language.culture) && v.segment === vm.editors[s].content.segment;
                    });
                    vm.editors[s].content = variant;
                }
            }

        }

        /**
         * Updates the editors collection for a given index for the specified variant
         * @param {any} index
         * @param {any} variant
         */
        function insertVariantEditor(index, variant) {

            if (vm.editors[index]) {
                if (vm.editors[index].content === variant) {
                    console.error("This editor is already in this place.");
                    return;
                }
                vm.editors[index].content.active = false;
            }
            variant.active = true;

            var variantCulture = variant.language ? variant.language.culture : "invariant";
            var variantSegment = variant.segment;

            var currentCulture = index < vm.editors.length ? vm.editors[index].culture : null;
            var currentSegment = index < vm.editors.length ? vm.editors[index].segment : null;

            // if index not already exists or if the culture or segment isnt identical then we do a replacement.
            if (index >= vm.editors.length || currentCulture !== variantCulture || currentSegment !== variantSegment) {

                //Not the current culture or segment which means we need to modify the array.
                //NOTE: It is not good enough to just replace the `content` object at a given index in the array
                // since that would mean that directives are not re-initialized.
                vm.editors.splice(index, 1, {
                    compositeId: variant.compositeId,
                    content: variant,
                    culture: variantCulture,
                    segment: variantSegment
                });
            }
            else {
                //replace the content of the editor, since the culture and segment is the same.
                vm.editors[index].content = variant;
            }

        }

        /**
         * Adds a new editor to the editors array to show content in a split view
         * @param {any} selectedVariant
         */
        function openSplitView(selectedVariant) {
            // enforce content contentApp in splitview.
            var contentApp = vm.content.apps.find((app) => app.alias === "umbContent");
            if(contentApp) {
                selectApp(contentApp);
            }

            insertVariantEditor(vm.editors.length, selectedVariant);

            splitViewChanged();

        }

        $scope.$on("editors.content.splitViewRequest", function(event, args) {requestSplitView(args);});
        vm.requestSplitView = requestSplitView;
        function requestSplitView(args) {
            var culture = args.culture;
            var segment = args.segment;

            var variant = _.find(vm.content.variants, function (v) {
                return (!v.language || v.language.culture === culture) && v.segment === segment;
            });

            if (variant != null) {
                openSplitView(variant);
            }
        }

        /** Closes the split view */
        function closeSplitView(editorIndex) {
            // TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular
            var editor = vm.editors[editorIndex];
            vm.editors.splice(editorIndex, 1);
            editor.content.active = false;

            //update the current culture to reflect the last open variant (closing the split view corresponds to selecting the other variant)

            $location.search({"cculture": vm.editors[0].content.language ? vm.editors[0].content.language.culture : null, "csegment": vm.editors[0].content.segment});
            splitViewChanged();
        }

        /**
         * Changes the currently selected variant
         * @param {any} variant This is the model of the variant/language drop down item in the editor header
         * @param {any} editorIndex The index of the editor being changed
         */
        function selectVariant(variant, editorIndex) {

            var variantCulture = variant.language ? variant.language.culture : "invariant";
            var variantSegment = variant.segment || null;

            // Check if we already have this editor open, if so, do nothing.
            if (vm.editors.find((editor) => (!editor.content.language || editor.content.language.culture === variantCulture) && editor.content.segment === variantSegment)) {
                return;
            }

            //if the editor index is zero, then update the query string to track the lang selection, otherwise if it's part
            //of a 2nd split view editor then update the model directly.
            if (editorIndex === 0) {
                //If we've made it this far, then update the query string.
                //The editor will respond to this query string changing.
                $location.search("cculture", variantCulture).search("csegment", variantSegment);
            }
            else {

                //update the editors collection
                insertVariantEditor(editorIndex, variant);

            }
        }

        /**
         * Stores the active app in a variable so we can remember it when changing language
         * @param {any} app This is the model of the selected app
         */
        function selectApp(app) {
            if(vm.onSelectApp) {
                vm.onSelectApp({"app": app});
            }
        }

        function selectAppAnchor(app, anchor) {
            if(vm.onSelectAppAnchor) {
                vm.onSelectAppAnchor({"app": app, "anchor": anchor});
            }
        }

    }

    angular.module('umbraco.directives').component('umbVariantContentEditors', umbVariantContentEditors);

})();
<|endoftext|>


<commit_before>
/*
Script: Selector.js
	Contains the Selector Component Class of the Content Floor App.

License:
	MIT-style license.

iFramework Copyright:
	copyright (c) 2007 Jerome Vial, <http://iframework.org>

iFramework Credits:
	- Class is based on MooTools framework <http://www.mootools.net/> (c) 2007 Valerio Proietti, MIT-style license
	- Classes were coded by David Mignot, Lucas Pillonel, Denis Schneiter, Gregory Paccaud and Jerome Vial
*/

/*
Class: UI.Selector
	The flying selector object of the <http://iframework.org> framework.
	Creates a new div element, its initialize method will bind button with a group of elements.

Arguments:
	options - clss and id

Example:
	(start code)
	var my_selector = new UI.Selector({
		'clss'	: 'ui-select'
		]
	});
	(end)
*/

UI.Selector = new Class({

	Implements: [Events, Options],

	options: {
		container: document.body,
		scope: document.body,
		target: document.body,
		trigger: 'click',

		clss: 'ui-selector',
		prefix: 'pages',
		zIndex: 1100,
		wrapper: {
			tagName: 'div',
			clss: 'ui-selector'
		},

		components: [],
		toolbar: false,
		menu: false,
		border: {
			size: 1,
			display:'none'
		},
		resizer: true,
		overlay: false,
		cookie: {
			duration: 365,
			path: '/'
		},
		usefx: true,
		enable : true,
		timerOnHide: 0,
		onCatch: {},
		onDisable: {},
		onEnable: {},
		positionning: 'relative'
	},

	initialize: function(options){
		//console.log('UI.Selector.initilize()');
		this.setOptions(options);

		this.selectors = [];

		this.container = this.options.container;

		var scope = this.options.scope;
		var target = this.options.target;

		this.name = this.options.prefix+'-'+this.options.name;
		this.size = {};

		this.timer = null;

		//console.log('UI.Selector.init(scope,target)',this.name);

		this._initElement(this.options.components);
		this._initEvents(scope,target);

		//console.log('shoud hide this');

		this.container.addEvent('click', function() {

			//console.log('content clicked');
		});

		this.hideNow();
	},

	update: function(){

		var scope = this.options.scope;
		var target = this.options.target;

		this._initEvents(scope,target);
	},

	_initEvents: function(scope,target) {
		//console.log('UI.Selector._initEvents(scope,target)',typeOf(scope),target);
		var delay = 20;
		var self = this;

		//console.log('UI.Selector._initEvents(scope,target)',typeOf(scope),target);

		var delegation = self.options.trigger+':relay('+target+')';

		scope.addEvent(delegation, function(ev, el) {
			self.reach(el)
		});

		/*var list = scope.querySelectorAll( target );

		//console.log(list);

		new Array()

		Array.each(list, function(el) {
			//console.log('UI.Selector.target',el,self.options.trigger);
			el.store('selector', self);
			el.addEvent(self.options.trigger, function(){
				self.reach(el);
			});

			el.addEvents({
				mouseenter: function(e) {
					//e.stop();
					clearTimeout(self.timer);
				},
				mouseover: function(e) {
					//self.reach(el);
					//e.stop();
					clearTimeout(self.timer);
				}
			});
		});*/

		/*pages.addEvent('resize', function() {
			self.reach(self.el);
		});*/
	},

	attachElement: function(el) {
		//console.log('UI.Selector._initEvents(scope,target)',scope,target);
		var delay = 20;
		var self = this;

		//console.log('UI.Selector._setEventsElement',el,self.options.trigger);

		el.addEvent(self.options.trigger, function(){
			self.reach(el);
		});

		el.addEvents({
			mouseenter: function(e) {
				//e.stop();
				clearTimeout(self.timer);
			},
			mouseover: function(e) {
				//self.reach(el);
				//e.stop();
				clearTimeout(self.timer);
			}
		});

		/*pages.addEvent('resize', function() {
			self.reach(self.el);
		});*/
	},

	_initElement: function(components){
		var self = this;

		this.wrapper = new Element('div', {
			'class': this.options.wrapper.clss,
			zIndex: this.options.zIndex
		}).set('data-selector', this.options.name)
		.inject(this.options.container, 'top');

		components.each(function(name){
			//console.log('Selector _initElement',name);
			self.options[name].content = self.options.container;
			var build = 'build'+name.capitalize();
			if (!self.options[name].usefx)
				self.options[name].usefx = self.options.usefx;

			self.selectors.push(self[build](self.options[name]));
		});

		if (this.isEnable()) this.enable();
		else this.disable();

		return this.wrapper;
	},

	buildComponent: function() {

	},

	buildBorder: function(options){
		var self = this;
		//console.log();

		options.positionning = this.options.positionning;

		this.border = new UI.Selector.Border(this.wrapper, options);

		this.addEvents({
			show: function(){ self.border.show(); },
			hide: function(){ self.border.hide(); },
			reach: function(el){ self.border.reach(el); },
			repos: function(el){ self.border.reach(el); },
			highlight: function(color){	self.border.highlight(color); }
		});
	},

	buildMask: function(opts){
		var self = this;

		opts.positionning = this.options.positionning;

		opts.scope = this.options.scope;

		this.mask = new UI.Selector.Mask(this.wrapper, opts);

		this.addEvents({
			show: function(){ self.mask.show(); },
			hide: function(){ self.mask.hide(); },
			reach: function(el){	self.mask.reach(el); },
			repos: function(el){	self.mask.reach(el); },
			highlight: function(color){	self.mask.highlight(color); }
		});
	},

	buildResizer: function(options){
		var self = this;

		this.resizer = new UI.Selector.Resizer(this.wrapper, options).addEvents({
			mouseleave: function() {
				self.hide();
			},
			mouseenter: function() {
				clearTimeout(self.timer);
			}
		});

		this.addEvents({
			show: function(el){ self.resizer.show(); },
			hide: function(el){	self.resizer.hide(); },
			reach: function(el){ self.resizer.reach(el); },
			repos: function(el){ self.resizer.reach(el); }
		});
	},

	buildMenu: function(options){
		//console.log('buildMenu', this.options.name, options);

		var self = this,
			left = null,
			right = null;

		// console.log( this.wrapper, options);

		options.positionning = this.options.positionning;

		this.menu = new UI.Selector.Menu( this.wrapper, options);

		if (this.options.timerOnHide) {
			this.menu.element.addEvents({
				mouseleave: function() {
					self.hide();
				},
				mouseenter: function() {
					clearTimeout(self.timer);
				}
			});
		}

		this.addEvents({
			show: function(){ self.menu.element.show(); },
			hide: function(){	self.menu.element.hide(); },
			reach: function(el) { self.menu.reach(el);	},
			repos: function(el) { self.menu.reach(el); },
			highlight: function(color){	self.menu.element.highlight(color); }
		});
	},

	buildStatus: function(options){
		//console.log('buildMenu', this.options.name, options);

		var self = this,
			left = null,
			right = null;

		//console.log( this.wrapper);

		this.status = new UI.Selector.Status( this.wrapper, options);

		if (this.options.timerOnHide) {
			this.status.element.addEvents({
				mouseleave: function() {
					self.hide();
				},
				mouseenter: function() {
					clearTimeout(self.timer);
				}
			});
		}

		this.addEvents({
			show: function(){ self.status.element.show(); },
			hide: function(){	self.status.element.hide(); },
			reach: function(el) { self.status.reach(el); },
			repos: function(el) { self.status.reach(el); },
			highlight: function(color){	self.status.element.highlight(color); }
		});
	},

	_initOverlay: function(){
		var self = this;

		this.overlay = new UI.Overlay({
			container: this.options.container
		}).addEvents({
			click: function() {
				self.fireEvent('click', self.el);
			},
			dblclick: function() {
				self.fireEvent('dblclick',self.el);
			}
		});

		if (this.options.timerOnHide) {
			this.overlay.element.addEvents({
				mouseleave: function() {
					clearTimeout(self.timer);
					self.hide();
				},
				mouseenter: function() {
					//console.log('enteroverlay');
					clearTimeout(self.timer);
				}

			});
		}

		this.addEvents({
			show: function(el){ self.overlay.show(); },
			hide: function(el){	self.overlay.hide(); },
			reach: function(el){	self.overlay.reach(el); },
			repos: function(el){	self.overlay.reach(el); },
			highlight: function(color){	self.overlay.highlight(color); }
		});
	},

	reach: function(el){
		if (el) {
			this.el = el;
		} else if (this.el) {
			el = this.el;
		} else { return; }

		//console.log('reach',el);

		if (this.isEnable) {
			this.show();
			this.fireEvent('reach',el);
		}
	},

	repos: function(el){
		if (el) {
			this.el = el;
		} else if (this.el) {
			el = this.el;
		} else { return; }

		//console.log('reach',el);

		if (this.isEnable) {
			this.show();
			this.fireEvent('repos',el);
		}
	},

	set: function(name,value,name){
		//console.log(name,value,name);

		if (name)
			self[name][name](value);
		else
		this.selectors.each(function(name) {
			self[name][name](value);
		});

		return this;
	},

	/*

			Note: Should be cool if we can also add and remove selectors

	*/
	add: function(type) {

	},

	remove: function(type) {

	},

	hide: function(){
		clearTimeout(this.timer);
		this.timer = (function() {
			this.fireEvent('hide');
		}).delay(this.options.timerOnHide,this);
	},

	hideNow: function(){
		clearTimeout(this.timer);
		this.fireEvent('hide');
	},

	show: function(){
		clearTimeout(this.timer);
		if (this.isEnable)
			this.fireEvent('show');
	},

	highlight: function(color){
		if (this.isEnable)
			this.fireEvent('highlight',color);
	},

	enable: function(selector) {
		//console.log('enable', this.options.name);

		this.isEnable = true;
		Cookie.write(this.name, '1', this.options.cookie);
		//this.show();
	},

	disable: function(selector) {
		//console.log('disable', this.options.name);

		this.isEnable = false;
		Cookie.write(this.name, '0', this.options.cookie);
		this.hideNow();
	},

	isEnable: function() {
		if (Cookie.read(this.name) == '1') return true;
			else return false;
	},

	toggle: function(){
		if (Cookie.read(this.name) == '1') this.disable();
		else this.enable();
	}
});

<commit_msg>Work on Website without iframe<commit_after>
/*
Script: Selector.js
	Contains the Selector Component Class of the Content Floor App.

License:
	MIT-style license.

iFramework Copyright:
	copyright (c) 2007 Jerome Vial, <http://iframework.org>

iFramework Credits:
	- Class is based on MooTools framework <http://www.mootools.net/> (c) 2007 Valerio Proietti, MIT-style license
	- Classes were coded by David Mignot, Lucas Pillonel, Denis Schneiter, Gregory Paccaud and Jerome Vial
*/

/*
Class: UI.Selector
	The flying selector object of the <http://iframework.org> framework.
	Creates a new div element, its initialize method will bind button with a group of elements.

Arguments:
	options - clss and id

Example:
	(start code)
	var my_selector = new UI.Selector({
		'clss'	: 'ui-select'
		]
	});
	(end)
*/

UI.Selector = new Class({

	Implements: [Events, Options],

	options: {
		container: document.body,
		scope: document.body,
		target: document.body,
		trigger: 'click',

		clss: 'ui-selector',
		prefix: 'pages',
		zIndex: 1100,
		wrapper: {
			tagName: 'div',
			clss: 'ui-selector'
		},

		components: [],
		toolbar: false,
		menu: false,
		border: {
			size: 1,
			display:'none'
		},
		resizer: true,
		overlay: false,
		cookie: {
			duration: 365,
			path: '/'
		},
		usefx: true,
		enable : true,
		timerOnHide: 0,
		onCatch: {},
		onDisable: {},
		onEnable: {},
		//positionning: 'relative'
	},

	initialize: function(options){
		//console.log('UI.Selector.initilize()');
		this.setOptions(options);

		this.selectors = [];

		this.container = this.options.container;

		var scope = this.options.scope;
		var target = this.options.target;

		this.name = this.options.prefix+'-'+this.options.name;
		this.size = {};

		this.timer = null;

		//console.log('UI.Selector.init(scope,target)',this.name);

		this._initElement(this.options.components);
		this._initEvents(scope,target);

		//console.log('shoud hide this');

		this.container.addEvent('click', function() {

			//console.log('content clicked');
		});

		this.hideNow();
	},

	update: function(){

		var scope = this.options.scope;
		var target = this.options.target;

		this._initEvents(scope,target);
	},

	_initEvents: function(scope,target) {
		//console.log('UI.Selector._initEvents(scope,target)',typeOf(scope),target);
		var delay = 20;
		var self = this;

		//console.log('UI.Selector._initEvents(scope,target)',typeOf(scope),target);

		var delegation = self.options.trigger+':relay('+target+')';

		scope.addEvent(delegation, function(ev, el) {
			self.reach(el)
		});

		/*var list = scope.querySelectorAll( target );

		//console.log(list);

		new Array()

		Array.each(list, function(el) {
			//console.log('UI.Selector.target',el,self.options.trigger);
			el.store('selector', self);
			el.addEvent(self.options.trigger, function(){
				self.reach(el);
			});

			el.addEvents({
				mouseenter: function(e) {
					//e.stop();
					clearTimeout(self.timer);
				},
				mouseover: function(e) {
					//self.reach(el);
					//e.stop();
					clearTimeout(self.timer);
				}
			});
		});*/

		/*pages.addEvent('resize', function() {
			self.reach(self.el);
		});*/
	},

	attachElement: function(el) {
		//console.log('UI.Selector._initEvents(scope,target)',scope,target);
		var delay = 20;
		var self = this;

		//console.log('UI.Selector._setEventsElement',el,self.options.trigger);

		el.addEvent(self.options.trigger, function(){
			self.reach(el);
		});

		el.addEvents({
			mouseenter: function(e) {
				//e.stop();
				clearTimeout(self.timer);
			},
			mouseover: function(e) {
				//self.reach(el);
				//e.stop();
				clearTimeout(self.timer);
			}
		});

		/*pages.addEvent('resize', function() {
			self.reach(self.el);
		});*/
	},

	_initElement: function(components){
		var self = this;

		this.wrapper = new Element('div', {
			'class': this.options.wrapper.clss,
			zIndex: this.options.zIndex
		}).set('data-selector', this.options.name)
		.inject(this.options.container, 'top');

		components.each(function(name){
			//console.log('Selector _initElement',name);
			self.options[name].content = self.options.container;
			var build = 'build'+name.capitalize();
			if (!self.options[name].usefx)
				self.options[name].usefx = self.options.usefx;

			self.selectors.push(self[build](self.options[name]));
		});

		if (this.isEnable()) this.enable();
		else this.disable();

		return this.wrapper;
	},

	buildComponent: function() {

	},

	buildBorder: function(options){
		var self = this;
		//console.log();

		options.positionning = this.options.positionning;

		this.border = new UI.Selector.Border(this.wrapper, options);

		this.addEvents({
			show: function(){ self.border.show(); },
			hide: function(){ self.border.hide(); },
			reach: function(el){ self.border.reach(el); },
			repos: function(el){ self.border.reach(el); },
			highlight: function(color){	self.border.highlight(color); }
		});
	},

	buildMask: function(opts){
		var self = this;

		opts.positionning = this.options.positionning;

		opts.scope = this.options.scope;

		this.mask = new UI.Selector.Mask(this.wrapper, opts);

		this.addEvents({
			show: function(){ self.mask.show(); },
			hide: function(){ self.mask.hide(); },
			reach: function(el){	self.mask.reach(el); },
			repos: function(el){	self.mask.reach(el); },
			highlight: function(color){	self.mask.highlight(color); }
		});
	},

	buildResizer: function(options){
		var self = this;

		this.resizer = new UI.Selector.Resizer(this.wrapper, options).addEvents({
			mouseleave: function() {
				self.hide();
			},
			mouseenter: function() {
				clearTimeout(self.timer);
			}
		});

		this.addEvents({
			show: function(el){ self.resizer.show(); },
			hide: function(el){	self.resizer.hide(); },
			reach: function(el){ self.resizer.reach(el); },
			repos: function(el){ self.resizer.reach(el); }
		});
	},

	buildMenu: function(options){
		//console.log('buildMenu', this.options.name, options);

		var self = this,
			left = null,
			right = null;

		// console.log( this.wrapper, options);

		options.positionning = this.options.positionning;

		this.menu = new UI.Selector.Menu( this.wrapper, options);

		if (this.options.timerOnHide) {
			this.menu.element.addEvents({
				mouseleave: function() {
					self.hide();
				},
				mouseenter: function() {
					clearTimeout(self.timer);
				}
			});
		}

		this.addEvents({
			show: function(){ self.menu.element.show(); },
			hide: function(){	self.menu.element.hide(); },
			reach: function(el) { self.menu.reach(el);	},
			repos: function(el) { self.menu.reach(el); },
			highlight: function(color){	self.menu.element.highlight(color); }
		});
	},

	buildStatus: function(options){
		//console.log('buildMenu', this.options.name, options);

		var self = this,
			left = null,
			right = null;

		//console.log( this.wrapper);

		this.status = new UI.Selector.Status( this.wrapper, options);

		if (this.options.timerOnHide) {
			this.status.element.addEvents({
				mouseleave: function() {
					self.hide();
				},
				mouseenter: function() {
					clearTimeout(self.timer);
				}
			});
		}

		this.addEvents({
			show: function(){ self.status.element.show(); },
			hide: function(){	self.status.element.hide(); },
			reach: function(el) { self.status.reach(el); },
			repos: function(el) { self.status.reach(el); },
			highlight: function(color){	self.status.element.highlight(color); }
		});
	},

	_initOverlay: function(){
		var self = this;

		this.overlay = new UI.Overlay({
			container: this.options.container
		}).addEvents({
			click: function() {
				self.fireEvent('click', self.el);
			},
			dblclick: function() {
				self.fireEvent('dblclick',self.el);
			}
		});

		if (this.options.timerOnHide) {
			this.overlay.element.addEvents({
				mouseleave: function() {
					clearTimeout(self.timer);
					self.hide();
				},
				mouseenter: function() {
					//console.log('enteroverlay');
					clearTimeout(self.timer);
				}

			});
		}

		this.addEvents({
			show: function(el){ self.overlay.show(); },
			hide: function(el){	self.overlay.hide(); },
			reach: function(el){	self.overlay.reach(el); },
			repos: function(el){	self.overlay.reach(el); },
			highlight: function(color){	self.overlay.highlight(color); }
		});
	},

	reach: function(el){
		if (el) {
			this.el = el;
		} else if (this.el) {
			el = this.el;
		} else { return; }

		//console.log('reach',el);

		if (this.isEnable) {
			this.show();
			this.fireEvent('reach',el);
		}
	},

	repos: function(el){
		if (el) {
			this.el = el;
		} else if (this.el) {
			el = this.el;
		} else { return; }

		//console.log('reach',el);

		if (this.isEnable) {
			this.show();
			this.fireEvent('repos',el);
		}
	},

	set: function(name,value,name){
		//console.log(name,value,name);

		if (name)
			self[name][name](value);
		else
		this.selectors.each(function(name) {
			self[name][name](value);
		});

		return this;
	},

	/*

			Note: Should be cool if we can also add and remove selectors

	*/
	add: function(type) {

	},

	remove: function(type) {

	},

	hide: function(){
		clearTimeout(this.timer);
		this.timer = (function() {
			this.fireEvent('hide');
		}).delay(this.options.timerOnHide,this);
	},

	hideNow: function(){
		clearTimeout(this.timer);
		this.fireEvent('hide');
	},

	show: function(){
		clearTimeout(this.timer);
		if (this.isEnable)
			this.fireEvent('show');
	},

	highlight: function(color){
		if (this.isEnable)
			this.fireEvent('highlight',color);
	},

	enable: function(selector) {
		//console.log('enable', this.options.name);

		this.isEnable = true;
		Cookie.write(this.name, '1', this.options.cookie);
		//this.show();
	},

	disable: function(selector) {
		//console.log('disable', this.options.name);

		this.isEnable = false;
		Cookie.write(this.name, '0', this.options.cookie);
		this.hideNow();
	},

	isEnable: function() {
		if (Cookie.read(this.name) == '1') return true;
			else return false;
	},

	toggle: function(){
		if (Cookie.read(this.name) == '1') this.disable();
		else this.enable();
	}
});

<|endoftext|>


<commit_before>dojo.provide("dijit.layout.TabContainer");

dojo.require("dijit.layout._TabContainerBase");
dojo.require("dijit.layout.TabController");
dojo.require("dijit.layout.ScrollingTabController");

dojo.declare("dijit.layout.TabContainer",
	dijit.layout._TabContainerBase,
	{
		// summary:
		//		A Container with tabs to select each child (only one of which is displayed at a time).
		// description:
		//		A TabContainer is a container that has multiple panes, but shows only
		//		one pane at a time.  There are a set of tabs corresponding to each pane,
		//		where each tab has the name (aka title) of the pane, and optionally a close button.

		// useMenu: [const] Boolean
		//		True if a menu should be used to select tabs when they are too
		//		wide to fit the TabContainer, false otherwise.
		useMenu: true,

		// useSlider: [const] Boolean
		//		True if a slider should be used to select tabs when they are too
		//		wide to fit the TabContainer, false otherwise.
		useSlider: true,

		// _controllerWidget: String
		//		An optional parameter to overrider the default TabContainer controller used.
		_controllerWidget: null,

		_makeController: function(/*DomNode*/ srcNode){
			// summary:
			//		Instantiate tablist controller widget and return reference to it.
			//		Callback from _TabContainerBase.postCreate().
			// tags:
			//		protected extension

			var cls = this.baseClass + "-tabs" + (this.doLayout ? "" : " dijitTabNoLayout"),
				TabController = dojo.getObject(this._controllerWidget);

			return new TabController({
				id: this.id + "_tablist",
				tabPosition: this.tabPosition,
				doLayout: this.doLayout,
				containerId: this.id,
				"class": cls,
				nested: this.nested,
				useMenu: this.useMenu,
				useSlider: this.useSlider,
				tabStripClass: this.tabStrip ? this.baseClass + (this.tabStrip ? "":"No") + "Strip": null
			}, srcNode);
		},

		postMixInProperties: function(){
			this.inherited(arguments);

			// Scrolling controller only works for horizontal non-nested tabs
			if(!this._controllerWidget){
				this._controllerWidget = (this.tabPosition == "top" || this.tabPosition == "bottom") && !this.nested ?
							"dijit.layout.ScrollingTabController" : "dijit.layout.TabController";
			}
		}
});

<commit_msg>Make controllerWidget public so that users can set it to something else in markup, although it better to make your own TabContainer subclass in this case so you don't pull in code (specifically ScrollTabController) that you don't need.<commit_after>dojo.provide("dijit.layout.TabContainer");

dojo.require("dijit.layout._TabContainerBase");
dojo.require("dijit.layout.TabController");
dojo.require("dijit.layout.ScrollingTabController");

dojo.declare("dijit.layout.TabContainer",
	dijit.layout._TabContainerBase,
	{
		// summary:
		//		A Container with tabs to select each child (only one of which is displayed at a time).
		// description:
		//		A TabContainer is a container that has multiple panes, but shows only
		//		one pane at a time.  There are a set of tabs corresponding to each pane,
		//		where each tab has the name (aka title) of the pane, and optionally a close button.

		// useMenu: [const] Boolean
		//		True if a menu should be used to select tabs when they are too
		//		wide to fit the TabContainer, false otherwise.
		useMenu: true,

		// useSlider: [const] Boolean
		//		True if a slider should be used to select tabs when they are too
		//		wide to fit the TabContainer, false otherwise.
		useSlider: true,

		// controllerWidget: String
		//		An optional parameter to override the widget used to display the tab labels
		controllerWidget: "",

		_makeController: function(/*DomNode*/ srcNode){
			// summary:
			//		Instantiate tablist controller widget and return reference to it.
			//		Callback from _TabContainerBase.postCreate().
			// tags:
			//		protected extension

			var cls = this.baseClass + "-tabs" + (this.doLayout ? "" : " dijitTabNoLayout"),
				TabController = dojo.getObject(this.controllerWidget);

			return new TabController({
				id: this.id + "_tablist",
				tabPosition: this.tabPosition,
				doLayout: this.doLayout,
				containerId: this.id,
				"class": cls,
				nested: this.nested,
				useMenu: this.useMenu,
				useSlider: this.useSlider,
				tabStripClass: this.tabStrip ? this.baseClass + (this.tabStrip ? "":"No") + "Strip": null
			}, srcNode);
		},

		postMixInProperties: function(){
			this.inherited(arguments);

			// Scrolling controller only works for horizontal non-nested tabs
			if(!this.controllerWidget){
				this.controllerWidget = (this.tabPosition == "top" || this.tabPosition == "bottom") && !this.nested ?
							"dijit.layout.ScrollingTabController" : "dijit.layout.TabController";
			}
		}
});

<|endoftext|>


<commit_before>var memblox = (function(window, document, undefined) {
  if(!window.console || !console.log){
    console = {};
    console.log = alert;
  }
  // makeHud method for creating new Heads up display
  function makeHud(id, cols, rows, font, x, y, prefix, suffix){
   var thishud = (function(Port, id, cols, rows, font, x, y, prefix, suffix){
      var hud = new HUD(id);
      var lastmsg = "";
      var prefix = prefix;
      var suffix = suffix;

      hud.setFont(font);
      hud.setPosition(x, y);
      hud.setTableSize(cols, rows);
      hud.setTracking(.7, 1.2);

      Port.attach(hud);

      return {
        hud: hud,
        write: function(msg){
          var clearString = "";
          var i = cols;
          while(i--){
            clearString += " ";
          };
          hud.setString(0,0,clearString)
          lastmessage = msg;
          msg = (prefix) ? prefix + msg : msg;
          msg = (suffix) ? msg + suffix : msg;
          hud.setString(0,0,msg);
        },
        read: function(){
          return lastmsg;
        }
      };
    })(Effect.Port,id, cols, rows, font, x, y, prefix, suffix)
    return thishud;
  }

  /* randomInt
   *  @param low : the low number in the return set
   *  @param high : the high number in the return set
   */

  // EventTarget class acts as base for custom events
  var memblox = {
    objects : {
      blocks : [],
      makeHud : makeHud
    },
    options : {
      pSize:40,
      boardHeight: 480,
      boardWidth: 320,
    },
    io : {
      messageDisplay: {},
      scoreDisplay: {},
      levelDisplay: {}
    },
    events: {
      levelCleared : function(obj, level){
        if((level + 1) >= 8){
          obj.environment.currentLevel = 1;
        };
        obj.environment.currentLevel = level + 1;
        obj.environment.matchSetSize = (level + 1) * 2;
        obj.environment.matchCount = 0;
      },
      gameOver : function(obj){
        obj.active = false;
      }
    },
    environment: {
      player : "",
      score : 0,
      currentLevel :1,
      level : [1,2,3,4,5,6,7,8],
      flipped : {
        count : 0,
        blocks : []
      },
      matchSetSize : 3, // in level change algorithm should be currentLevel * 2
      matchCount : 0,
      topScores : [],
      players : [],
      theme : 0,
      themes : ["default","mario"],
      activeblock : null
    },
    start_new_game: function() {
		// start new game (from title screen)
		var port = Effect.Port;

		//memblox.spriteGroups = {};

		Effect.Audio.quiet();

		Effect.Game.clearSchedule();
		Effect.Game.removeAllTweens();
		Effect.Port.removeAll();
		Effect.Port.setBackgroundColor('black');

        Effect.Game.loadLevel( 'Default', function(){
            var bplane = Effect.Port.getPlane("Background");
            var backsprite = bplane.createSprite("Background");
            splane = Effect.Port.getPlane("Blocks");
            splane.createSprite("Block",{x:120, y:-40});
            splane.draw();
            music.playSound();
        });
        Effect.Game.addEventListener( 'onLogic', function(clock){
            if(memblox.environment.matchCount > memblox.environment.currentLevel * 10){
                memblox.events.levelCleared(memblox, memblox.environment.currentLevel);
            }
            memblox.io.levelDisplay.write(memblox.environment.currentLevel);
            memblox.io.scoreDisplay.write(memblox.environment.score);
        });
	}, // start_new_game
    data : (function(){
      if(openDatabase){
        var db = openDatabase("scubed", "1.0", "Scubed High Scores", "1024");
        var msg = [];
        var addScore = function(player, score){
          db.transaction(function(tx){
            tx.executeSql("INSERT INTO scubed (player, score) VALUES (?,?)",
            [player, score],
            function(tx, data){msg.push(data);},
            function(tx, e){msg.push(e);})
          })
        };
        var highScores = function(){
          db.transaction(function(tx){
            tx.executeSql("SELECT * FROM scubed ORDER BY score"),
            function(tx, data){msg.push(data);},
            function(tx, e){msg.push(e);}
          })
        };
        return {
          addScore : addScore,
          highScores: highScores,
          msg: msg
        }
      }else{
        return {};
      }
    })(),
  }
  return memblox;
})(window, window.document)

var speed = 4;
var BLOCK_HEIGHT = 40;
var BLOCK_WIDTH  = 40;
var GAME_LEFT_BOUNDARY = 0;
var GAME_RIGHT_BOUNDARY = GAME_LEFT_BOUNDARY + (BLOCK_WIDTH*8);
var GAME_UPPER_BOUNDARY = 0;
var GAME_LOWER_BOUNDARY = GAME_UPPER_BOUNDARY + (BLOCK_HEIGHT*12);

// These are the delays in secs. between block movements for each level
// index 0 is the delay for level 1, etc.
//
var FALL_DELAY = new Array(0.5, 0.45, 0.4, 0.35, 0.25, 0.2, 0.15, 0.1, 0.05);

var FAST_FALL_DELAY = 0.05;
function randomInt(low, high){
  return Math.floor(Math.random() * (high - (low - 1))) + low;
}
Sprite.extend('Background',{ url: '/images/backgrounds/' + memblox.environment.themes[memblox.environment.theme] + '/bg1.jpg',
  width: memblox.options.boardWidth,
  height: memblox.options.boardHeight,
  setup : function(clock){
    console.log('/images/backgrounds/' + memblox.environment.themes[memblox.environment.theme] + '/bg1.jpg');
    this.setImage('/images/backgrounds/' + memblox.environment.themes[memblox.environment.theme] + '/bg1.jpg');
  }
});
Sprite.extend('Block',{	url: '/images/sprites/' + memblox.environment.themes[memblox.environment.theme] + '/' + randomInt(1, 16) + '.png',
        width: memblox.options.pSize,
	height: memblox.options.pSize,
	hitRect: new Rect(1, 1, memblox.options.pSize, memblox.options.pSize),
	collisions: true,
	state: 'falling',
	bumpedSide: false,
        setup: function(clock){
          this.matchNumber = randomInt(1, memblox.environment.matchSetSize);
          this.setImage("/images/sprites/" + memblox.environment.themes[memblox.environment.theme] + "/" + this.matchNumber + ".png");
        },
	logic: function(clock) {
          this.bumpedSide = false;
          this.prevX = this.x;
          this.prevY = this.y;
          if(this.flipping){
            if (this.frameX < 9){
              this.setFrameX(this.frameX + 1);
            }else{
              this.flipping = false;
            }
          }else if(this.unflipping && !this.flipping){
            if( this.frameX > 0){
              this.setFrameX(this.frameX - 1);
            }else{
              this.unflipping = false;
            }
          }
          this[ this.state ](clock);
	}
});
Block.add({
	falling: function(clock) {
		// now move the sprite, horizontal only first
		//
                var hit;
                var dir;
                if (Effect.Game.isKeyDown("right")) {
                  hit = this.move( this.width, 0 );
                  dir = -1;
                }else if(Effect.Game.isKeyDown("left")){
                  hit = this.move( -this.width, 0 );
                  dir = 1;
                }else if(Effect.Game.isKeyDown("down")){
                  this.y += 10;
                }
		if (this.didCollideX(hit)) {
		    	this.bumpedSide = true;
			this.x = this.x + (this.width * dir) ;
		}
		this.xd = 0;
                var hit = this.move( 0, 1 * memblox.environment.currentLevel );
                if (this.didCollideY(hit)) {
                        // if we hit something solid, stop our vert movement
                        this.y = this.y - (1 * memblox.environment.currentLevel);
                        var splane = Effect.Port.getPlane("Blocks");
                        if(this.y >= 0){
                          memblox.environment.activeblock = splane.createSprite("Block",{x: 120, y:-40});
                        }else{
                          memblox.io.messageDisplay.write("GAME OVER SUCKA!");
                        }
                        this.state = 'stuck';
                }
	}
});
Block.add({
	didCollideX: function(hit) {
		return (hit && (hit.target.solid ||
		       (hit.target.type == 'Block' && hit.target.state == 'stuck'))) ||
		       this.x < GAME_LEFT_BOUNDARY ||
		       this.x > GAME_RIGHT_BOUNDARY - this.width;
	},

	didCollideY: function(hit) {
		return (hit && (hit.target.solid ||
		       (hit.target.type == 'Block' && hit.target.state == 'stuck'))) ||
		       this.y > GAME_LOWER_BOUNDARY - this.height;
	}
});

Block.add({
	stuck: function(clock) {
		var hit = this.move( 0, 1 * memblox.environment.currentLevel );
                if (this.didCollideY(hit)) {
                        // if we hit something solid, stop our vert movement
                        this.y = this.y - (1 * memblox.environment.currentLevel);
                        var splane = Effect.Port.getPlane("Blocks");
                        this.state = 'stuck';
                }
	}
});

Block.add({
  flip : function(splane){
    this.flipping = true;
    if(memblox.environment.flipped.blocks.length == 1){
        if (this.matchNumber == memblox.environment.flipped.blocks[0].matchNumber && this !== memblox.environment.flipped.blocks[0]){
          if(this == memblox.environment.activeblock || memblox.environment.flipped.blocks[0] == memblox.environment.activeblock){
            memblox.environment.activeblock = splane.createSprite("Block", {x: 120, y: -40});
          }// otherwise just use the active block that is already there, the match was done on the ground
          splane.deleteSprite(this.id);
          splane.deleteSprite(memblox.environment.flipped.blocks[0].id);
          memblox.environment.matchCount += 1;
          memblox.environment.score += 20 * memblox.environment.currentLevel;
          console.log(memblox.environment.matchCount);
        }
        memblox.environment.flipped.blocks[0].unflipping = true;
        this.unflipping = true;
        memblox.environment.flipped.blocks = [];
      }else{
        memblox.environment.flipped.blocks.push(this);
      }

      console.log(this.matchNumber);
    }
});
Effect.Game.addEventListener( 'onLoadGame',function(){
  memblox.io.messageDisplay = memblox.objects.makeHud("message", 20, 5, memblox.environment.themes[memblox.environment.theme] + "Font", 20, 100, null, null);
  memblox.io.scoreDisplay =  memblox.objects.makeHud("score", 13, 1, memblox.environment.themes[memblox.environment.theme] + "Font", 3, 3, "Score:", null);
  memblox.io.levelDisplay =  memblox.objects.makeHud("level", 5, 1, memblox.environment.themes[memblox.environment.theme] + "Font", 176, 3, "Lvl:", null);
  var music = Effect.Audio.getTrack("/audio/music/" + memblox.environment.themes[memblox.environment.theme] + "/bg-music.mp3");

  Effect.Port.addEventListener( 'onMouseDown', function(pt, buttonIdx){
    var splane = Effect.Port.getPlane("Blocks");
    var sprite = splane.lookupSpriteFromGlobal(pt);
    if(sprite){
      sprite.flip(splane);
    }
  });
  Effect.Game.loadLevel( 'TitleScreen', function(){
  		// title screen is now loaded
		Effect.Game.clearSchedule();
		Effect.Game.setState( 'title' );
		Effect.Port.setScroll( 0, 0 );
		var splane = Effect.Port.getPlane('TitleSprites');
		splane.createSprite( StaticImageSprite, { url: '/images/sprites/title/scubed.png', x: 130, y: -150, zIndex: 3 } ).tween({
			delay: 0,
			duration: 180,
			mode: 'EaseOut',
			algorithm: 'Quintic',
			properties: {
				y: { start: -150, end: 40 }
			}
		});
        // hook mouse events for the buttons
		splane.createSprite( 'TitleButton', {
			url: '/images/sprites/title/startGameBtn.png',
			x: 340,
			y: 600,
			zIndex: 4,
			onMouseUp: function() { memblox.start_new_game(); }
		} ).tween({
			delay: 0,
			duration: 180,
			mode: 'EaseOut',
			algorithm: 'Quintic',
			properties: {
				x: { start: 340, end: 50 },
				y: { start: 600, end: 425 }
			}
		}).captureMouse();

  };

});<commit_msg>somehting fishy<commit_after>var memblox = (function(window, document, undefined) {
  if(!window.console || !console.log){
    console = {};
    console.log = alert;
  }
  // makeHud method for creating new Heads up display
  function makeHud(id, cols, rows, font, x, y, prefix, suffix){
   var thishud = (function(Port, id, cols, rows, font, x, y, prefix, suffix){
      var hud = new HUD(id);
      var lastmsg = "";
      var prefix = prefix;
      var suffix = suffix;

      hud.setFont(font);
      hud.setPosition(x, y);
      hud.setTableSize(cols, rows);
      hud.setTracking(.7, 1.2);

      Port.attach(hud);

      return {
        hud: hud,
        write: function(msg){
          var clearString = "";
          var i = cols;
          while(i--){
            clearString += " ";
          };
          hud.setString(0,0,clearString)
          lastmessage = msg;
          msg = (prefix) ? prefix + msg : msg;
          msg = (suffix) ? msg + suffix : msg;
          hud.setString(0,0,msg);
        },
        read: function(){
          return lastmsg;
        }
      };
    })(Effect.Port,id, cols, rows, font, x, y, prefix, suffix)
    return thishud;
  }

  /* randomInt
   *  @param low : the low number in the return set
   *  @param high : the high number in the return set
   */

  // EventTarget class acts as base for custom events
  var memblox = {
    objects : {
      blocks : [],
      makeHud : makeHud
    },
    options : {
      pSize:40,
      boardHeight: 480,
      boardWidth: 320,
    },
    io : {
      messageDisplay: {},
      scoreDisplay: {},
      levelDisplay: {}
    },
    events: {
      levelCleared : function(obj, level){
        if((level + 1) >= 8){
          obj.environment.currentLevel = 1;
        };
        obj.environment.currentLevel = level + 1;
        obj.environment.matchSetSize = (level + 1) * 2;
        obj.environment.matchCount = 0;
      },
      gameOver : function(obj){
        obj.active = false;
      }
    },
    environment: {
      player : "",
      score : 0,
      currentLevel :1,
      level : [1,2,3,4,5,6,7,8],
      flipped : {
        count : 0,
        blocks : []
      },
      matchSetSize : 3, // in level change algorithm should be currentLevel * 2
      matchCount : 0,
      topScores : [],
      players : [],
      theme : 0,
      themes : ["default","mario"],
      activeblock : null
    },
    start_new_game: function() {
		// start new game (from title screen)
		var port = Effect.Port;

		//memblox.spriteGroups = {};

		Effect.Audio.quiet();
		Effect.Game.clearSchedule();
		Effect.Game.removeAllTweens();
		Effect.Port.removeAll();
		Effect.Port.setBackgroundColor('black');
        memblox.io.messageDisplay = memblox.objects.makeHud("message", 20, 5,
            memblox.environment.themes[memblox.environment.theme] + "Font", 20, 100, null, null);
        memblox.io.scoreDisplay =  memblox.objects.makeHud("score", 13, 1, memblox.environment.themes
            [memblox.environment.theme] + "Font", 3, 3, "Score:", null);
        memblox.io.levelDisplay =  memblox.objects.makeHud("level", 5, 1, memblox.environment.themes
            [memblox.environment.theme] + "Font", 176, 3, "Lvl:", null);
        var music = Effect.Audio.getTrack("/audio/music/" + memblox.environment.themes
            [memblox.environment.theme] + "/bg-music.mp3");
        Effect.Port.addEventListener( 'onMouseDown', function(pt, buttonIdx){
            var splane = Effect.Port.getPlane("Blocks");
            var sprite = splane.lookupSpriteFromGlobal(pt);
            if(sprite){
                sprite.flip(splane);
            }
        });
        Effect.Game.loadLevel( 'Default', function(){
            var bplane = Effect.Port.getPlane("Background");
            var backsprite = bplane.createSprite("Background");
            splane = Effect.Port.getPlane("Blocks");
            splane.createSprite("Block",{x:120, y:-40});
            splane.draw();
            music.playSound();
        });
        Effect.Game.addEventListener( 'onLogic', function(clock){
            if(memblox.environment.matchCount > memblox.environment.currentLevel * 10){
                memblox.events.levelCleared(memblox, memblox.environment.currentLevel);
            }
            memblox.io.levelDisplay.write(memblox.environment.currentLevel);
            memblox.io.scoreDisplay.write(memblox.environment.score);
        });
	}, // start_new_game
    data : (function(){
      if(openDatabase){
        var db = openDatabase("scubed", "1.0", "Scubed High Scores", "1024");
        var msg = [];
        var addScore = function(player, score){
          db.transaction(function(tx){
            tx.executeSql("INSERT INTO scubed (player, score) VALUES (?,?)",
            [player, score],
            function(tx, data){msg.push(data);},
            function(tx, e){msg.push(e);})
          })
        };
        var highScores = function(){
          db.transaction(function(tx){
            tx.executeSql("SELECT * FROM scubed ORDER BY score"),
            function(tx, data){msg.push(data);},
            function(tx, e){msg.push(e);}
          })
        };
        return {
          addScore : addScore,
          highScores: highScores,
          msg: msg
        }
      }else{
        return {};
      }
    })(),
  }
  return memblox;
})(window, window.document)

var speed = 4;
var BLOCK_HEIGHT = 40;
var BLOCK_WIDTH  = 40;
var GAME_LEFT_BOUNDARY = 0;
var GAME_RIGHT_BOUNDARY = GAME_LEFT_BOUNDARY + (BLOCK_WIDTH*8);
var GAME_UPPER_BOUNDARY = 0;
var GAME_LOWER_BOUNDARY = GAME_UPPER_BOUNDARY + (BLOCK_HEIGHT*12);

// These are the delays in secs. between block movements for each level
// index 0 is the delay for level 1, etc.
//
var FALL_DELAY = new Array(0.5, 0.45, 0.4, 0.35, 0.25, 0.2, 0.15, 0.1, 0.05);

var FAST_FALL_DELAY = 0.05;
function randomInt(low, high){
  return Math.floor(Math.random() * (high - (low - 1))) + low;
}
Sprite.extend('Background',{ url: '/images/backgrounds/' + memblox.environment.themes[memblox.environment.theme] + '/bg1.jpg',
  width: memblox.options.boardWidth,
  height: memblox.options.boardHeight,
  setup : function(clock){
    console.log('/images/backgrounds/' + memblox.environment.themes[memblox.environment.theme] + '/bg1.jpg');
    this.setImage('/images/backgrounds/' + memblox.environment.themes[memblox.environment.theme] + '/bg1.jpg');
  }
});
Sprite.extend('Block',{	url: '/images/sprites/' + memblox.environment.themes[memblox.environment.theme] + '/' + randomInt(1, 16) + '.png',
        width: memblox.options.pSize,
	height: memblox.options.pSize,
	hitRect: new Rect(1, 1, memblox.options.pSize, memblox.options.pSize),
	collisions: true,
	state: 'falling',
	bumpedSide: false,
        setup: function(clock){
          this.matchNumber = randomInt(1, memblox.environment.matchSetSize);
          this.setImage("/images/sprites/" + memblox.environment.themes[memblox.environment.theme] + "/" + this.matchNumber + ".png");
        },
	logic: function(clock) {
          this.bumpedSide = false;
          this.prevX = this.x;
          this.prevY = this.y;
          if(this.flipping){
            if (this.frameX < 9){
              this.setFrameX(this.frameX + 1);
            }else{
              this.flipping = false;
            }
          }else if(this.unflipping && !this.flipping){
            if( this.frameX > 0){
              this.setFrameX(this.frameX - 1);
            }else{
              this.unflipping = false;
            }
          }
          this[ this.state ](clock);
	}
});
Block.add({
	falling: function(clock) {
		// now move the sprite, horizontal only first
		//
                var hit;
                var dir;
                if (Effect.Game.isKeyDown("right")) {
                  hit = this.move( this.width, 0 );
                  dir = -1;
                }else if(Effect.Game.isKeyDown("left")){
                  hit = this.move( -this.width, 0 );
                  dir = 1;
                }else if(Effect.Game.isKeyDown("down")){
                  this.y += 10;
                }
		if (this.didCollideX(hit)) {
		    	this.bumpedSide = true;
			this.x = this.x + (this.width * dir) ;
		}
		this.xd = 0;
                var hit = this.move( 0, 1 * memblox.environment.currentLevel );
                if (this.didCollideY(hit)) {
                        // if we hit something solid, stop our vert movement
                        this.y = this.y - (1 * memblox.environment.currentLevel);
                        var splane = Effect.Port.getPlane("Blocks");
                        if(this.y >= 0){
                          memblox.environment.activeblock = splane.createSprite("Block",{x: 120, y:-40});
                        }else{
                          memblox.io.messageDisplay.write("GAME OVER SUCKA!");
                        }
                        this.state = 'stuck';
                }
	}
});
Block.add({
	didCollideX: function(hit) {
		return (hit && (hit.target.solid ||
		       (hit.target.type == 'Block' && hit.target.state == 'stuck'))) ||
		       this.x < GAME_LEFT_BOUNDARY ||
		       this.x > GAME_RIGHT_BOUNDARY - this.width;
	},

	didCollideY: function(hit) {
		return (hit && (hit.target.solid ||
		       (hit.target.type == 'Block' && hit.target.state == 'stuck'))) ||
		       this.y > GAME_LOWER_BOUNDARY - this.height;
	}
});

Block.add({
	stuck: function(clock) {
		var hit = this.move( 0, 1 * memblox.environment.currentLevel );
                if (this.didCollideY(hit)) {
                        // if we hit something solid, stop our vert movement
                        this.y = this.y - (1 * memblox.environment.currentLevel);
                        var splane = Effect.Port.getPlane("Blocks");
                        this.state = 'stuck';
                }
	}
});

Block.add({
  flip : function(splane){
    this.flipping = true;
    if(memblox.environment.flipped.blocks.length == 1){
        if (this.matchNumber == memblox.environment.flipped.blocks[0].matchNumber && this !== memblox.environment.flipped.blocks[0]){
          if(this == memblox.environment.activeblock || memblox.environment.flipped.blocks[0] == memblox.environment.activeblock){
            memblox.environment.activeblock = splane.createSprite("Block", {x: 120, y: -40});
          }// otherwise just use the active block that is already there, the match was done on the ground
          splane.deleteSprite(this.id);
          splane.deleteSprite(memblox.environment.flipped.blocks[0].id);
          memblox.environment.matchCount += 1;
          memblox.environment.score += 20 * memblox.environment.currentLevel;
          console.log(memblox.environment.matchCount);
        }
        memblox.environment.flipped.blocks[0].unflipping = true;
        this.unflipping = true;
        memblox.environment.flipped.blocks = [];
      }else{
        memblox.environment.flipped.blocks.push(this);
      }

      console.log(this.matchNumber);
    }
});
Effect.Game.addEventListener( 'onLoadGame',function(){
  Effect.Game.loadLevel( 'TitleScreen', function(){
  		// title screen is now loaded
		Effect.Game.clearSchedule();
		Effect.Game.setState( 'title' );
		Effect.Port.setScroll( 0, 0 );
		var splane = Effect.Port.getPlane('TitleSprites');
		splane.createSprite( StaticImageSprite, { url: '/images/sprites/title/scubed.png', x: 130, y: -150, zIndex: 3 } ).tween({
			delay: 0,
			duration: 180,
			mode: 'EaseOut',
			algorithm: 'Quintic',
			properties: {
				y: { start: -150, end: 40 }
			}
		});
        // hook mouse events for the buttons
		splane.createSprite( 'TitleButton', {
			url: '/images/sprites/title/startGameBtn.png',
			x: 340,
			y: 600,
			zIndex: 4,
			onMouseUp: function() { memblox.start_new_game(); }
		} ).tween({
			delay: 0,
			duration: 180,
			mode: 'EaseOut',
			algorithm: 'Quintic',
			properties: {
				x: { start: 340, end: 50 },
				y: { start: 600, end: 425 }
			}
		}).captureMouse();

  });

});<|endoftext|>


<commit_before>/*
IRA - Interactive Relational Algebra Tool
Copyright (C) 2010-2012 Henrik Mühe

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
function ConditionalRightAntiJoin(condition,input1, input2) {
    this.input1 = input1;
    this.input2 = input2;
    this.condition = condition;

    this.setChildren([this.condition, this.input1, this.input2]);

    this.getName = function() {
        return this.input1.getName() + "_" + this.input2.getName();
    };
    this.setName = null;

    this.getColumns = function() {
        if (this.condition.isEmpty()) return (new ConditionalJoin(this.condition, this.input1, this.input2)).getColumns();
        return this.input2.getColumns();
    };
    this.setColumns = null;

    this.getResult = function() {
        if (this.condition.isEmpty()) return (new ConditionalJoin(this.condition, this.input1, this.input2)).getResult();
        if (!input1.columns || !input2.columns) {
          return [];
        }
        if (this.condition.isEmpty()) return (new ConditionalJoin(this.condition, this.input1, this.input2)).getResult();
        var r = new ConditionalRightSemiJoin(condition,input1,input2);
        var m = new Minus(input2,r);
        return m.getResult();
    };

    this.copy = function() {
        return new ConditionalRightAntiJoin(this.condition.copy(), this.input1.copy(), this.input2.copy());
    };

    this.toHTML = function(options) {
      var display = '';
      display += '(' + this.input1.toHTML(options) + " " + latex("\\lhd") + "" + this.condition.toHTML(options) + " " + " " + this.input2.toHTML(options) + ")";
      return display;
    };

    this.toLatex = function(options) {
        return "(" + this.input1.toLatex(options) + "\\lhd_{" + this.condition.toLatex(options) + "} " + this.input2.toLatex(options) + ")";
    };
}
ConditionalRightAntiJoin.prototype = new Relation();
<commit_msg>Fixed Issue<commit_after>/*
IRA - Interactive Relational Algebra Tool
Copyright (C) 2010-2012 Henrik Mühe

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
function ConditionalRightAntiJoin(condition,input1, input2) {
    this.input1 = input1;
    this.input2 = input2;
    this.condition = condition;

    this.setChildren([this.condition, this.input1, this.input2]);

    this.getName = function() {
        return this.input1.getName() + "_" + this.input2.getName();
    };
    this.setName = null;

    this.getColumns = function() {
        if (this.condition.isEmpty()) return (new ConditionalJoin(this.condition, this.input1, this.input2)).getColumns(true);
        return this.input2.getColumns();
    };
    this.setColumns = null;

    this.getResult = function() {
        if (this.condition.isEmpty()) return (new ConditionalJoin(this.condition, this.input1, this.input2)).getResult();
        if (!input1.columns || !input2.columns) {
          return [];
        }
        if (this.condition.isEmpty()) return (new ConditionalJoin(this.condition, this.input1, this.input2)).getResult();
        var r = new ConditionalRightSemiJoin(condition,input1,input2);
        var m = new Minus(input2,r);
        return m.getResult();
    };

    this.copy = function() {
        return new ConditionalRightAntiJoin(this.condition.copy(), this.input1.copy(), this.input2.copy());
    };

    this.toHTML = function(options) {
      var display = '';
      display += '(' + this.input1.toHTML(options) + " " + latex("\\lhd") + "" + this.condition.toHTML(options) + " " + " " + this.input2.toHTML(options) + ")";
      return display;
    };

    this.toLatex = function(options) {
        return "(" + this.input1.toLatex(options) + "\\lhd_{" + this.condition.toLatex(options) + "} " + this.input2.toLatex(options) + ")";
    };
}
ConditionalRightAntiJoin.prototype = new Relation();
<|endoftext|>