client/js/main.js
author rougeronj
Wed, 03 Jun 2015 17:27:46 +0200
changeset 471 e0c7be5dc02c
parent 455 18b9be54174d
child 472 6dcff4438175
permissions -rw-r--r--
Add a router to handle fragment identifier Set up a listener of the router in the scene to update it Start Backbone.history (eventlistener of the router) when all the project is loaded Include router.js to all the test file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5
67085e6281e5 Added basic node/edge editing
veltr
parents: 4
diff changeset
     1
/* Declaring the Renkan Namespace Rkns and Default values */
1
45cca39b00ac First rendering tests
veltr
parents:
diff changeset
     2
195
15e048e00002 Better User List Management
veltr
parents: 188
diff changeset
     3
(function(root) {
15e048e00002 Better User List Management
veltr
parents: 188
diff changeset
     4
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
     5
    "use strict";
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
     6
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
     7
    if (typeof root.Rkns !== "object") {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
     8
        root.Rkns = {};
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
     9
    }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    10
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    11
    var Rkns = root.Rkns;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    12
    var $ = Rkns.$ = root.jQuery;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    13
    var _ = Rkns._ = root._;
195
15e048e00002 Better User List Management
veltr
parents: 188
diff changeset
    14
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    15
    Rkns.pickerColors = ["#8f1919", "#a80000", "#d82626", "#ff0000", "#e87c7c", "#ff6565", "#f7d3d3", "#fecccc",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    16
        "#8f5419", "#a85400", "#d87f26", "#ff7f00", "#e8b27c", "#ffb265", "#f7e5d3", "#fee5cc",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    17
        "#8f8f19", "#a8a800", "#d8d826", "#feff00", "#e8e87c", "#feff65", "#f7f7d3", "#fefecc",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    18
        "#198f19", "#00a800", "#26d826", "#00ff00", "#7ce87c", "#65ff65", "#d3f7d3", "#ccfecc",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    19
        "#198f8f", "#00a8a8", "#26d8d8", "#00feff", "#7ce8e8", "#65feff", "#d3f7f7", "#ccfefe",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    20
        "#19198f", "#0000a8", "#2626d8", "#0000ff", "#7c7ce8", "#6565ff", "#d3d3f7", "#ccccfe",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    21
        "#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    22
        "#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff"
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    23
    ];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    24
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    25
    Rkns.__renkans = [];
1
45cca39b00ac First rendering tests
veltr
parents:
diff changeset
    26
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    27
    var _BaseBin = Rkns._BaseBin = function(_renkan, _opts) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    28
        if (typeof _renkan !== "undefined") {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    29
            this.renkan = _renkan;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    30
            this.renkan.$.find(".Rk-Bin-Main").hide();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    31
            this.$ = Rkns.$('<li>')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    32
                .addClass("Rk-Bin")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    33
                .appendTo(_renkan.$.find(".Rk-Bin-List"));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    34
            this.title_icon_$ = Rkns.$('<span>')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    35
                .addClass("Rk-Bin-Title-Icon")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    36
                .appendTo(this.$);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    37
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    38
            var _this = this;
1
45cca39b00ac First rendering tests
veltr
parents:
diff changeset
    39
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    40
            Rkns.$('<a>')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    41
                .attr({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    42
                    href: "#",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    43
                    title: _renkan.translate("Close bin")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    44
                })
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    45
                .addClass("Rk-Bin-Close")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    46
                .html('&times;')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    47
                .appendTo(this.$)
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    48
                .click(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    49
                    _this.destroy();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    50
                    if (!_renkan.$.find(".Rk-Bin-Main:visible").length) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    51
                        _renkan.$.find(".Rk-Bin-Main:last").slideDown();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    52
                    }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    53
                    _renkan.resizeBins();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    54
                    return false;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    55
                });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    56
            Rkns.$('<a>')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    57
                .attr({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    58
                    href: "#",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    59
                    title: _renkan.translate("Refresh bin")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    60
                })
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    61
                .addClass("Rk-Bin-Refresh")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    62
                .appendTo(this.$)
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    63
                .click(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    64
                    _this.refresh();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    65
                    return false;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    66
                });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    67
            this.count_$ = Rkns.$('<div>')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    68
                .addClass("Rk-Bin-Count")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    69
                .appendTo(this.$);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    70
            this.title_$ = Rkns.$('<h2>')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    71
                .addClass("Rk-Bin-Title")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    72
                .appendTo(this.$);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    73
            this.main_$ = Rkns.$('<div>')
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    74
                .addClass("Rk-Bin-Main")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    75
                .appendTo(this.$)
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    76
                .html('<h4 class="Rk-Bin-Loading">' + _renkan.translate("Loading, please wait") + '</h4>');
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    77
            this.title_$.html(_opts.title || '(new bin)');
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    78
            this.renkan.resizeBins();
195
15e048e00002 Better User List Management
veltr
parents: 188
diff changeset
    79
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    80
            if (_opts.auto_refresh) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    81
                window.setInterval(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    82
                    _this.refresh();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    83
                }, _opts.auto_refresh);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    84
            }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    85
        }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    86
    };
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
    87
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    88
    _BaseBin.prototype.destroy = function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    89
        this.$.detach();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    90
        this.renkan.resizeBins();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    91
    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    92
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    93
    /* Point of entry */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    94
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    95
    var Renkan = Rkns.Renkan = function(_opts) {
34
08a366a35143 First part of SH design integration
veltr
parents: 28
diff changeset
    96
        var _this = this;
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
    97
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
    98
        Rkns.__renkans.push(this);
471
e0c7be5dc02c Add a router to handle fragment identifier
rougeronj
parents: 455
diff changeset
    99
        
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   100
        this.options = _.defaults(_opts, Rkns.defaults, {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   101
            templates: renkanJST
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   102
        });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   103
        this.template = renkanJST['templates/main.html'];
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   104
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   105
        _.each(this.options.property_files, function(f) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   106
            Rkns.$.getJSON(f, function(data) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   107
                _this.options.properties = _this.options.properties.concat(data);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   108
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   109
        });
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   110
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   111
        this.read_only = this.options.read_only || !this.options.editor_mode;
471
e0c7be5dc02c Add a router to handle fragment identifier
rougeronj
parents: 455
diff changeset
   112
        
e0c7be5dc02c Add a router to handle fragment identifier
rougeronj
parents: 455
diff changeset
   113
        this.router = new Rkns.Router();
e0c7be5dc02c Add a router to handle fragment identifier
rougeronj
parents: 455
diff changeset
   114
        
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   115
        this.project = new Rkns.Models.Project();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   116
        this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);
433
e457ec945e50 replace underscore par lodash
ymh <ymh.work@gmail.com>
parents: 430
diff changeset
   117
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   118
        this.setCurrentUser = function(user_id, user_name) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   119
            this.project.addUser({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   120
                _id: user_id,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   121
                title: user_name
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   122
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   123
            this.current_user = user_id;
195
15e048e00002 Better User List Management
veltr
parents: 188
diff changeset
   124
            this.renderer.redrawUsers();
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   125
        };
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   126
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   127
        if (typeof this.options.user_id !== "undefined") {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   128
            this.current_user = this.options.user_id;
160
408da84d4dc0 Convert tabs added by ide configuration mistake
veltr
parents: 159
diff changeset
   129
        }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   130
        this.$ = Rkns.$("#" + this.options.container);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   131
        this.$
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   132
            .addClass("Rk-Main")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   133
            .html(this.template(this));
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   134
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   135
        this.tabs = [];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   136
        this.search_engines = [];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   137
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   138
        this.current_user_list = new Rkns.Models.UsersList();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   139
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   140
        this.current_user_list.on("add remove", function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   141
            if (this.renderer) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   142
                this.renderer.redrawUsers();
21
b43dd87f7ffa Added Drag+Drop from a tweet list
veltr
parents: 20
diff changeset
   143
            }
188
50b3287d06dd Added a basic space editor
veltr
parents: 185
diff changeset
   144
        });
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   145
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   146
        this.colorPicker = (function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   147
            var _tmpl = renkanJST['templates/colorpicker.html'];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   148
            return '<ul class="Rk-Edit-ColorPicker">' + Rkns.pickerColors.map(function(c) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   149
                return _tmpl({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   150
                    c: c
26
2fad193bae98 Added basic LDT project import
veltr
parents: 24
diff changeset
   151
                });
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   152
            }).join("") + '</ul>';
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   153
        })();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   154
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   155
        if (this.options.show_editor) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   156
            this.renderer = new Rkns.Renderer.Scene(this);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   157
        }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   158
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   159
        if (!this.options.search.length) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   160
            this.$.find(".Rk-Web-Search-Form").detach();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   161
        } else {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   162
            var _tmpl = renkanJST['templates/search.html'],
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   163
                _select = this.$.find(".Rk-Search-List"),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   164
                _input = this.$.find(".Rk-Web-Search-Input"),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   165
                _form = this.$.find(".Rk-Web-Search-Form");
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   166
            _.each(this.options.search, function(_search, _key) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   167
                if (Rkns[_search.type] && Rkns[_search.type].Search) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   168
                    _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));
160
408da84d4dc0 Convert tabs added by ide configuration mistake
veltr
parents: 159
diff changeset
   169
                }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   170
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   171
            _select.html(
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   172
                _(this.search_engines).map(function(_search, _key) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   173
                    return _tmpl({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   174
                        key: _key,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   175
                        title: _search.getSearchTitle(),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   176
                        className: _search.getBgClass()
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   177
                    });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   178
                }).join("")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   179
            );
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   180
            _select.find("li").click(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   181
                var _el = Rkns.$(this);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   182
                _this.setSearchEngine(_el.attr("data-key"));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   183
                _form.submit();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   184
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   185
            _form.submit(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   186
                if (_input.val()) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   187
                    var _search = _this.search_engine;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   188
                    _search.search(_input.val());
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   189
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   190
                return false;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   191
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   192
            this.$.find(".Rk-Search-Current").mouseenter(
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   193
                function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   194
                    _select.slideDown();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   195
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   196
            );
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   197
            this.$.find(".Rk-Search-Select").mouseleave(
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   198
                function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   199
                    _select.hide();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   200
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   201
            );
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   202
            this.setSearchEngine(0);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   203
        }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   204
        _.each(this.options.bins, function(_bin) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   205
            if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   206
                _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));
160
408da84d4dc0 Convert tabs added by ide configuration mistake
veltr
parents: 159
diff changeset
   207
            }
20
bd58970ffd16 Refactoring to better fit the MVVM pattern
veltr
parents: 18
diff changeset
   208
        });
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   209
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   210
        var elementDropped = false;
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   211
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   212
        this.$.find(".Rk-Bins")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   213
            .on("click", ".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   214
                var _mainDiv = Rkns.$(this).siblings(".Rk-Bin-Main");
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   215
                if (_mainDiv.is(":hidden")) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   216
                    _this.$.find(".Rk-Bin-Main").slideUp();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   217
                    _mainDiv.slideDown();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   218
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   219
            });
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   220
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   221
        if (this.options.show_editor) {
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   222
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   223
            this.$.find(".Rk-Bins").on("mouseover", ".Rk-Bin-Item", function(_e) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   224
                var _t = Rkns.$(this);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   225
                if (_t && $(_t).attr("data-uri")) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   226
                    var _models = _this.project.get("nodes").where({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   227
                        uri: $(_t).attr("data-uri")
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   228
                    });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   229
                    _.each(_models, function(_model) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   230
                        _this.renderer.highlightModel(_model);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   231
                    });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   232
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   233
            }).mouseout(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   234
                _this.renderer.unhighlightAll();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   235
            }).on("mousemove", ".Rk-Bin-Item", function(e) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   236
                try {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   237
                    this.dragDrop();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   238
                } catch (err) {}
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   239
            }).on("touchstart", ".Rk-Bin-Item", function(e) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   240
                elementDropped = false;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   241
            }).on("touchmove", ".Rk-Bin-Item", function(e) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   242
                e.preventDefault();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   243
                var touch = e.originalEvent.changedTouches[0],
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   244
                    off = _this.renderer.canvas_$.offset(),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   245
                    w = _this.renderer.canvas_$.width(),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   246
                    h = _this.renderer.canvas_$.height();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   247
                if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   248
                    if (elementDropped) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   249
                        _this.renderer.onMouseMove(touch, true);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   250
                    } else {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   251
                        elementDropped = true;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   252
                        var div = document.createElement('div');
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   253
                        div.appendChild(this.cloneNode(true));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   254
                        _this.renderer.dropData({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   255
                            "text/html": div.innerHTML
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   256
                        }, touch);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   257
                        _this.renderer.onMouseDown(touch, true);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   258
                    }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   259
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   260
            }).on("touchend", ".Rk-Bin-Item", function(e) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   261
                if (elementDropped) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   262
                    _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   263
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   264
                elementDropped = false;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   265
            }).on("dragstart", ".Rk-Bin-Item", function(e) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   266
                var div = document.createElement('div');
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   267
                div.appendChild(this.cloneNode(true));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   268
                try {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   269
                    e.originalEvent.dataTransfer.setData("text/html", div.innerHTML);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   270
                } catch (err) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   271
                    e.originalEvent.dataTransfer.setData("text", div.innerHTML);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   272
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   273
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   274
196
2a2fcec209d0 Added in-graph search
veltr
parents: 195
diff changeset
   275
        }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   276
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   277
        Rkns.$(window).resize(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   278
            _this.resizeBins();
196
2a2fcec209d0 Added in-graph search
veltr
parents: 195
diff changeset
   279
        });
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   280
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   281
        var lastsearch = false,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   282
            lastval = '';
1
45cca39b00ac First rendering tests
veltr
parents:
diff changeset
   283
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   284
        this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input", function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   285
            var val = Rkns.$(this).val();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   286
            if (val === lastval) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   287
                return;
1
45cca39b00ac First rendering tests
veltr
parents:
diff changeset
   288
            }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   289
            var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   290
            if (search.source === lastsearch) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   291
                return;
1
45cca39b00ac First rendering tests
veltr
parents:
diff changeset
   292
            }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   293
            lastsearch = search.source;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   294
            _.each(_this.tabs, function(tab) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   295
                tab.render(search);
196
2a2fcec209d0 Added in-graph search
veltr
parents: 195
diff changeset
   296
            });
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   297
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   298
        });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   299
        this.$.find(".Rk-Bins-Search-Form").submit(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   300
            return false;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   301
        });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   302
    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   303
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   304
    Renkan.prototype.translate = function(_text) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   305
        if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   306
            return Rkns.i18n[this.options.language][_text];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   307
        }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   308
        if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   309
            return Rkns.i18n[this.options.language.substr(0, 2)][_text];
196
2a2fcec209d0 Added in-graph search
veltr
parents: 195
diff changeset
   310
        }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   311
        return _text;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   312
    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   313
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   314
    Renkan.prototype.onStatusChange = function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   315
        this.renderer.onStatusChange();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   316
    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   317
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   318
    Renkan.prototype.setSearchEngine = function(_key) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   319
        this.search_engine = this.search_engines[_key];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   320
        this.$.find(".Rk-Search-Current").attr("class", "Rk-Search-Current " + this.search_engine.getBgClass());
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   321
        var listClasses = this.search_engine.getBgClass().split(" ");
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   322
        var classes = "";
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   323
        for (var i = 0; i < listClasses.length; i++) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   324
            classes += "." + listClasses[i];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   325
        }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   326
        this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder", this.translate("Search in ") + this.$.find(".Rk-Search-List " + classes).html());
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   327
    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   328
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   329
    Renkan.prototype.resizeBins = function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   330
        var _d = +this.$.find(".Rk-Bins-Head").outerHeight();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   331
        this.$.find(".Rk-Bin-Title:visible").each(function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   332
            _d += Rkns.$(this).outerHeight();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   333
        });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   334
        this.$.find(".Rk-Bin-Main").css({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   335
            height: this.$.find(".Rk-Bins").height() - _d
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   336
        });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   337
    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   338
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   339
    /* Utility functions */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   340
    var getUUID4 = function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   341
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   342
            var r = Math.random() * 16 | 0,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   343
                v = c === 'x' ? r : (r & 0x3 | 0x8);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   344
            return v.toString(16);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   345
        });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   346
    };
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   347
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   348
    Rkns.Utils = {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   349
        getUUID4: getUUID4,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   350
        getUID: (function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   351
            function pad(n) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   352
                return n < 10 ? '0' + n : n;
196
2a2fcec209d0 Added in-graph search
veltr
parents: 195
diff changeset
   353
            }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   354
            var _d = new Date(),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   355
                ID_AUTO_INCREMENT = 0,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   356
                ID_BASE = _d.getUTCFullYear() + '-' +
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   357
                pad(_d.getUTCMonth() + 1) + '-' +
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   358
                pad(_d.getUTCDate()) + '-' +
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   359
                getUUID4();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   360
            return function(_base) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   361
                var _n = (++ID_AUTO_INCREMENT).toString(16),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   362
                    _uidbase = (typeof _base === "undefined" ? "" : _base + "-");
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   363
                while (_n.length < 4) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   364
                    _n = '0' + _n;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   365
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   366
                return _uidbase + ID_BASE + '-' + _n;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   367
            };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   368
        })(),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   369
        getFullURL: function(url) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   370
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   371
            if (typeof(url) === 'undefined' || url == null) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   372
                return "";
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   373
            }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   374
            if (/https?:\/\//.test(url)) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   375
                return url;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   376
            }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   377
            var img = new Image();
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   378
            img.src = url;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   379
            var res = img.src;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   380
            img.src = null;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   381
            return res;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   382
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   383
        },
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   384
        inherit: function(_baseClass, _callbefore) {
293
fba23fde14ba Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents: 290
diff changeset
   385
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   386
            var _class = function(_arg) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   387
                if (typeof _callbefore === "function") {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   388
                    _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   389
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   390
                _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   391
                if (typeof this._init === "function" && !this._initialized) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   392
                    this._init.apply(this, Array.prototype.slice.call(arguments, 0));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   393
                    this._initialized = true;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   394
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   395
            };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   396
            _.extend(_class.prototype, _baseClass.prototype);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   397
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   398
            return _class;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   399
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   400
        },
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   401
        regexpFromTextOrArray: (function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   402
            var charsub = [
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   403
                    '[aáàâä]',
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   404
                    '[cç]',
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   405
                    '[eéèêë]',
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   406
                    '[iíìîï]',
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   407
                    '[oóòôö]',
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   408
                    '[uùûü]'
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   409
                ],
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   410
                removeChars = [
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   411
                    String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   412
                    "{", "}", "(", ")", "[", "]", "【", "】", "、", "・", "‥", "。", "「", "」", "『", "』", "〜", ":", "!", "?", " ",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   413
                    ",", " ", ";", "(", ")", ".", "*", "+", "\\", "?", "|", "{", "}", "[", "]", "^", "#", "/"
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   414
                ],
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   415
                remsrc = "[\\" + removeChars.join("\\") + "]",
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   416
                remrx = new RegExp(remsrc, "gm"),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   417
                charsrx = _.map(charsub, function(c) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   418
                    return new RegExp(c);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   419
                });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   420
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   421
            function replaceText(_text) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   422
                var txt = _text.toLowerCase().replace(remrx, ""),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   423
                    src = "";
284
fa8035885814 build renderer with require js
cavaliet
parents: 242
diff changeset
   424
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   425
                function makeReplaceFunc(l) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   426
                    return function(k, v) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   427
                        l = l.replace(charsrx[k], v);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   428
                    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   429
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   430
                for (var j = 0; j < txt.length; j++) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   431
                    if (j) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   432
                        src += remsrc + "*";
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   433
                    }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   434
                    var l = txt[j];
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   435
                    _.each(charsub, makeReplaceFunc(l));
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   436
                    src += l;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   437
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   438
                return src;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   439
            }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   440
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   441
            function getSource(inp) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   442
                switch (typeof inp) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   443
                    case "string":
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   444
                        return replaceText(inp);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   445
                    case "object":
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   446
                        var src = '';
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   447
                        _.each(inp, function(v) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   448
                            var res = getSource(v);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   449
                            if (res) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   450
                                if (src) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   451
                                    src += '|';
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   452
                                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   453
                                src += res;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   454
                            }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   455
                        });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   456
                        return src;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   457
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   458
                return '';
284
fa8035885814 build renderer with require js
cavaliet
parents: 242
diff changeset
   459
            }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   460
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   461
            return function(_textOrArray) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   462
                var source = getSource(_textOrArray);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   463
                if (source) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   464
                    var testrx = new RegExp(source, "im"),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   465
                        replacerx = new RegExp('(' + source + ')', "igm");
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   466
                    return {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   467
                        isempty: false,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   468
                        source: source,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   469
                        test: function(_t) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   470
                            return testrx.test(_t);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   471
                        },
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   472
                        replace: function(_text, _replace) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   473
                            return _text.replace(replacerx, _replace);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   474
                        }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   475
                    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   476
                } else {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   477
                    return {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   478
                        isempty: true,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   479
                        source: '',
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   480
                        test: function() {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   481
                            return true;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   482
                        },
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   483
                        replace: function(_text) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   484
                            return text;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   485
                        }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   486
                    };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   487
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   488
            };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   489
        })(),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   490
        /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   491
        _MIN_DRAG_DISTANCE: 2,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   492
        /* Distance between the inner and outer radius of buttons that appear when hovering on a node */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   493
        _NODE_BUTTON_WIDTH: 40,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   494
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   495
        _EDGE_BUTTON_INNER: 2,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   496
        _EDGE_BUTTON_OUTER: 40,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   497
        /* Constants used to know if a specific action is to be performed when clicking on the canvas */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   498
        _CLICKMODE_ADDNODE: 1,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   499
        _CLICKMODE_STARTEDGE: 2,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   500
        _CLICKMODE_ENDEDGE: 3,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   501
        /* Node size step: Used to calculate the size change when clicking the +/- buttons */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   502
        _NODE_SIZE_STEP: Math.LN2 / 4,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   503
        _MIN_SCALE: 1 / 20,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   504
        _MAX_SCALE: 20,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   505
        _MOUSEMOVE_RATE: 80,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   506
        _DOUBLETAP_DELAY: 800,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   507
        /* Maximum distance in pixels (squared, to reduce calculations)
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   508
         * between two taps when double-tapping on a touch terminal */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   509
        _DOUBLETAP_DISTANCE: 20 * 20,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   510
        /* A placeholder so a default colour is displayed when a node has a null value for its user property */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   511
        _USER_PLACEHOLDER: function(_renkan) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   512
            return {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   513
                color: _renkan.options.default_user_color,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   514
                title: _renkan.translate("(unknown user)"),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   515
                get: function(attr) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   516
                    return this[attr] || false;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   517
                }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   518
            };
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   519
        },
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   520
        /* The code for the "Drag and Add Bookmarklet", slightly minified and with whitespaces removed, though
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   521
         * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   522
         */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   523
        _BOOKMARKLET_CODE: function(_renkan) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   524
            return "(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<p_style=\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\">" +
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   525
                _renkan.translate("Drag items from this website, drop them in Renkan").replace(/ /g, "_") +
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   526
                "</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\/\\/[^\\/]*twitter\\.com\\//,s:'.tweet',n:'twitter'},{r:/https?:\\/\\/[^\\/]*google\\.[^\\/]+\\//,s:'.g',n:'google'},{r:/https?:\\/\\/[^\\/]*lemonde\\.fr\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();";
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   527
        },
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   528
        /* Shortens text to the required length then adds ellipsis */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   529
        shortenText: function(_text, _maxlength) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   530
            return (_text.length > _maxlength ? (_text.substr(0, _maxlength) + '…') : _text);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   531
        },
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   532
        /* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   533
         * Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   534
        drawEditBox: function(_options, _coords, _path, _xmargin, _selector) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   535
            _selector.css({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   536
                width: (_options.tooltip_width - 2 * _options.tooltip_padding)
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   537
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   538
            var _height = _selector.outerHeight() + 2 * _options.tooltip_padding,
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   539
                _isLeft = (_coords.x < paper.view.center.x ? 1 : -1),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   540
                _left = _coords.x + _isLeft * (_xmargin + _options.tooltip_arrow_length),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   541
                _right = _coords.x + _isLeft * (_xmargin + _options.tooltip_arrow_length + _options.tooltip_width),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   542
                _top = _coords.y - _height / 2;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   543
            if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   544
                _top = Math.max(paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2) - _height;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   545
            }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   546
            if (_top < _options.tooltip_margin) {
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   547
                _top = Math.min(_options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   548
            }
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   549
            var _bottom = _top + _height;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   550
            /* jshint laxbreak:true */
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   551
            _path.segments[0].point = _path.segments[7].point = _coords.add([_isLeft * _xmargin, 0]);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   552
            _path.segments[1].point.x = _path.segments[2].point.x = _path.segments[5].point.x = _path.segments[6].point.x = _left;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   553
            _path.segments[3].point.x = _path.segments[4].point.x = _right;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   554
            _path.segments[2].point.y = _path.segments[3].point.y = _top;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   555
            _path.segments[4].point.y = _path.segments[5].point.y = _bottom;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   556
            _path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   557
            _path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   558
            _path.closed = true;
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   559
            _path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0, _top], [0, _bottom]);
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   560
            _selector.css({
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   561
                left: (_options.tooltip_padding + Math.min(_left, _right)),
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   562
                top: (_options.tooltip_padding + _top)
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   563
            });
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   564
            return _path;
284
fa8035885814 build renderer with require js
cavaliet
parents: 242
diff changeset
   565
        }
444
19f0b7803aed add schema version + dataloaders to ensure data migrations + small correction for php server exmple + a readme for the php server example
ymh <ymh.work@gmail.com>
parents: 433
diff changeset
   566
    };
195
15e048e00002 Better User List Management
veltr
parents: 188
diff changeset
   567
})(window);
188
50b3287d06dd Added a basic space editor
veltr
parents: 185
diff changeset
   568
50b3287d06dd Added a basic space editor
veltr
parents: 185
diff changeset
   569
/* END main.js */