client/js/main.js
changeset 28 805d85b3f390
parent 26 2fad193bae98
child 34 08a366a35143
equal deleted inserted replaced
26:2fad193bae98 28:805d85b3f390
     1 /* 
     1 /* 
     2  *  Copyright 2012 Institut de recherche et d'innovation 
     2  *  Copyright 2012 Institut de recherche et d'innovation 
     3  *  contributor(s) : Samuel Huron, Raphael Velt
     3  *  contributor(s) : Yves-Marie Haussonne, Raphael Velt, Samuel Huron
     4  *   
     4  *   
     5  *  contact@iri.centrepompidou.fr
     5  *  contact@iri.centrepompidou.fr
     6  *  http://www.iri.centrepompidou.fr 
     6  *  http://www.iri.centrepompidou.fr 
     7  *   
     7  *   
     8  *  This software is a computer program whose purpose is to show and add annotations on a video .
     8  *  This software is a computer program whose purpose is to show and add annotations on a video .
    16  *  knowledge of the CeCILL-C license and that you accept its terms.
    16  *  knowledge of the CeCILL-C license and that you accept its terms.
    17 */
    17 */
    18 
    18 
    19 /* Declaring the Renkan Namespace Rkns and Default values */
    19 /* Declaring the Renkan Namespace Rkns and Default values */
    20 
    20 
    21 Rkns = {
    21 if (typeof Rkns !== "object") {
    22     _MIN_DRAG_DISTANCE: 2,
    22     Rkns = {}
    23     _NODE_RADIUS: 20,
       
    24     _NODE_FONT_SIZE: 14,
       
    25     _ARROW_LENGTH: 20,
       
    26     _ARROW_WIDTH: 15,
       
    27     _RENDER: 1,
       
    28     _SAVE: 2,
       
    29     _RENDER_AND_SAVE: 3
       
    30 }
    23 }
    31 
    24 
    32 Rkns.$ = jQuery;
    25 Rkns.$ = jQuery;
    33 
    26 
    34 Rkns._ = _;
    27 Rkns._ = _;
    53     }
    46     }
    54 }
    47 }
    55 /* Point of entry */
    48 /* Point of entry */
    56 
    49 
    57 Rkns.Renkan = function(_opts) {
    50 Rkns.Renkan = function(_opts) {
    58     if (typeof _opts.remotemodel !== "string") {
       
    59         _opts.remotemodel = "FullJson";
       
    60     }
       
    61     if (typeof _opts.language !== "string" || typeof Rkns.i18n[_opts.language] == "undefined") {
    51     if (typeof _opts.language !== "string" || typeof Rkns.i18n[_opts.language] == "undefined") {
    62         _opts.language = "en";
    52         _opts.language = "en";
    63     }
    53     }
    64     if (typeof _opts.container !== "string") {
    54     if (typeof _opts.container !== "string") {
    65         _opts.container = "renkan";
    55         _opts.container = "renkan";
   171 }
   161 }
   172 
   162 
   173 Rkns.Renkan.prototype.template = Rkns._.template(
   163 Rkns.Renkan.prototype.template = Rkns._.template(
   174     '<div class="Rk-Bins">'
   164     '<div class="Rk-Bins">'
   175     + '<form class="Rk-Search-Form"><input class="Rk-Search-Input" type="search" placeholder="Search" /><select class="Rk-Search-Select"></select></form>'
   165     + '<form class="Rk-Search-Form"><input class="Rk-Search-Input" type="search" placeholder="Search" /><select class="Rk-Search-Select"></select></form>'
   176     + '<ul class="Rk-Bin-List"></ul></div><div class="Rk-Render"></div>'
   166     + '<ul class="Rk-Bin-List"></ul></div><div class="Rk-Render Rk-Render-Panel"></div>'
   177 );
   167 );
   178 
   168 
   179 
   169 
   180 Rkns.Renkan.prototype.resizeBins = function() {
   170 Rkns.Renkan.prototype.resizeBins = function() {
   181     var _d = + this.$.find(".Rk-Search-Form").outerHeight();
   171     var _d = + this.$.find(".Rk-Search-Form").outerHeight();
   216     inherit : function(_baseClass, _callbefore) {
   206     inherit : function(_baseClass, _callbefore) {
   217         var _class = function() {
   207         var _class = function() {
   218             if (typeof _callbefore === "function") {
   208             if (typeof _callbefore === "function") {
   219                 _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));
   209                 _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));
   220             }
   210             }
   221             if (typeof _baseClass.prototype._init !== "function") {
       
   222                 _baseClass.prototype._init = function() {}
       
   223             }
       
   224             _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));
   211             _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));
   225             this._init.apply(this, Array.prototype.slice.call(arguments, 0));
   212             if (typeof this._init == "function") {
       
   213                 this._init.apply(this, Array.prototype.slice.call(arguments, 0));
       
   214             }
   226         }
   215         }
   227         _class.prototype = new _baseClass();
   216         _class.prototype = new _baseClass();
   228         return _class;
   217         return _class;
   229     }
   218     }
   230 }
   219 }