client/js/main.js
changeset 170 603ffa4c6fa5
parent 169 a60a450b8f3b
child 185 ad8c900d87e5
equal deleted inserted replaced
169:a60a450b8f3b 170:603ffa4c6fa5
    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 if (typeof Rkns !== "object") {
    21 if (typeof Rkns !== "object") {
    22     Rkns = {}
    22     Rkns = {};
    23 }
    23 }
    24 
    24 
    25 Rkns.$ = jQuery;
    25 Rkns.$ = jQuery;
    26 
    26 
    27 Rkns._ = _;
    27 Rkns._ = _;
    91         this.renkan.resizeBins();
    91         this.renkan.resizeBins();
    92         
    92         
    93         if (_opts.auto_refresh) {
    93         if (_opts.auto_refresh) {
    94             window.setInterval(function() {
    94             window.setInterval(function() {
    95                 _this.refresh();
    95                 _this.refresh();
    96             },_opts.auto_refresh)
    96             },_opts.auto_refresh);
    97         }
    97         }
    98     }
    98     }
    99 };
    99 };
   100 
   100 
   101 Rkns._BaseBin.prototype.destroy = function() {
   101 Rkns._BaseBin.prototype.destroy = function() {
   136     if (!this.options.search.length) {
   136     if (!this.options.search.length) {
   137         this.$.find(".Rk-Web-Search-Form").detach();
   137         this.$.find(".Rk-Web-Search-Form").detach();
   138     } else {
   138     } else {
   139         var _tmpl = Rkns._.template('<li class="<%= className %>" data-key="<%= key %>"><%= title %></li>'),
   139         var _tmpl = Rkns._.template('<li class="<%= className %>" data-key="<%= key %>"><%= title %></li>'),
   140             _select = this.$.find(".Rk-Search-List"),
   140             _select = this.$.find(".Rk-Search-List"),
   141             _input = this.$.find(".Rk-Web-Search-Input")
   141             _input = this.$.find(".Rk-Web-Search-Input"),
   142             _form = this.$.find(".Rk-Web-Search-Form");
   142             _form = this.$.find(".Rk-Web-Search-Form");
   143         Rkns._(this.options.search).each(function(_search, _key) {
   143         Rkns._(this.options.search).each(function(_search, _key) {
   144             if (Rkns[_search.type] && Rkns[_search.type].Search) {
   144             if (Rkns[_search.type] && Rkns[_search.type].Search) {
   145                 _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));
   145                 _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));
   146             }
   146             }
   249        Rkns._(_this.tabs).each(function(tab) {
   249        Rkns._(_this.tabs).each(function(tab) {
   250            tab.render(val);
   250            tab.render(val);
   251        });
   251        });
   252     });
   252     });
   253     this.$.find(".Rk-Bins-Search-Form").submit(function() {
   253     this.$.find(".Rk-Bins-Search-Form").submit(function() {
   254         return false
   254         return false;
   255     });
   255     });
   256 };
   256 };
   257 
   257 
   258 Rkns.Renkan.prototype.template = Rkns._.template(
   258 Rkns.Renkan.prototype.template = Rkns._.template(
   259     '<% if (options.show_bins) { %><div class="Rk-Bins"><div class="Rk-Bins-Head"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>'
   259     '<% if (options.show_bins) { %><div class="Rk-Bins"><div class="Rk-Bins-Head"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>'
   298 
   298 
   299 Rkns.Utils = {
   299 Rkns.Utils = {
   300     _ID_AUTO_INCREMENT : 0,
   300     _ID_AUTO_INCREMENT : 0,
   301     _ID_BASE : (function(_d) {
   301     _ID_BASE : (function(_d) {
   302         
   302         
   303         function pad(n){return n<10 ? '0'+n : n}
   303         function pad(n){return n<10 ? '0'+n : n;}
   304         function fillrand(n) {
   304         function fillrand(n) {
   305             var _res = ''
   305             var _res = '';
   306             for (var i=0; i<n; i++) {
   306             for (var i=0; i<n; i++) {
   307                 _res += Math.floor(16*Math.random()).toString(16);
   307                 _res += Math.floor(16*Math.random()).toString(16);
   308             }
   308             }
   309             return _res;
   309             return _res;
   310         }
   310         }
   317     getUID : function(_base) {
   317     getUID : function(_base) {
   318         
   318         
   319         var _n = (++this._ID_AUTO_INCREMENT).toString(16),
   319         var _n = (++this._ID_AUTO_INCREMENT).toString(16),
   320             _base = (typeof _base === "undefined" ? "" : _base + "-" );
   320             _base = (typeof _base === "undefined" ? "" : _base + "-" );
   321         while (_n.length < 4) {
   321         while (_n.length < 4) {
   322             _n = '0' + _n
   322             _n = '0' + _n;
   323         }
   323         }
   324         return _base + this._ID_BASE + '-' + _n;
   324         return _base + this._ID_BASE + '-' + _n;
   325         
   325         
   326     },
   326     },
   327     getFullURL : function(url) {
   327     getFullURL : function(url) {
   348             _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));
   348             _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));
   349             if (typeof this._init == "function" && !this._initialized) {
   349             if (typeof this._init == "function" && !this._initialized) {
   350                 this._init.apply(this, Array.prototype.slice.call(arguments, 0));
   350                 this._init.apply(this, Array.prototype.slice.call(arguments, 0));
   351                 this._initialized = true;
   351                 this._initialized = true;
   352             }
   352             }
   353         }
   353         };
   354         Rkns._(_class.prototype).extend(_baseClass.prototype);
   354         Rkns._(_class.prototype).extend(_baseClass.prototype);
   355         return _class;
   355         return _class;
   356         
   356         
   357     }
   357     }
   358 };
   358 };