client/js/main.js
changeset 42 48d825187d67
parent 41 9b9aabbb83bb
child 44 869410bab434
equal deleted inserted replaced
41:9b9aabbb83bb 42:48d825187d67
    34             .addClass("Rk-Bin")
    34             .addClass("Rk-Bin")
    35             .appendTo(_renkan.$.find(".Rk-Bin-List"));
    35             .appendTo(_renkan.$.find(".Rk-Bin-List"));
    36         this.title_icon_$ = Rkns.$('<span>')
    36         this.title_icon_$ = Rkns.$('<span>')
    37             .addClass("Rk-Bin-Title-Icon")
    37             .addClass("Rk-Bin-Title-Icon")
    38             .appendTo(this.$);
    38             .appendTo(this.$);
       
    39             
    39         var _this = this;
    40         var _this = this;
    40         Rkns.$('<span>')
    41         
       
    42         Rkns.$('<a>')
       
    43             .attr("href","#")
    41             .addClass("Rk-Bin-Close")
    44             .addClass("Rk-Bin-Close")
    42             .html('&times;')
    45             .html('&times;')
    43             .appendTo(this.$)
    46             .appendTo(this.$)
    44             .click(function() {
    47             .click(function() {
    45                 _this.destroy();
    48                 _this.destroy();
       
    49                 return false;
       
    50             });
       
    51         Rkns.$('<a>')
       
    52             .attr("href","#")
       
    53             .addClass("Rk-Bin-Refresh")
       
    54             .appendTo(this.$)
       
    55             .click(function() {
       
    56                 _this.refresh();
       
    57                 return false;
    46             });
    58             });
    47         this.title_$ = Rkns.$('<h2>')
    59         this.title_$ = Rkns.$('<h2>')
    48             .addClass("Rk-Bin-Title")
    60             .addClass("Rk-Bin-Title")
    49             .appendTo(this.$);
    61             .appendTo(this.$);
    50         this.main_$ = Rkns.$('<div>')
    62         this.main_$ = Rkns.$('<div>')
    51             .addClass("Rk-Bin-Main")
    63             .addClass("Rk-Bin-Main")
    52             .appendTo(this.$);
    64             .appendTo(this.$);
    53         this.title_$.html(_opts.title || '(new bin)');
    65         this.title_$.html(_opts.title || '(new bin)');
    54         this.renkan.resizeBins();
    66         this.renkan.resizeBins();
       
    67         
       
    68         if (_opts.auto_refresh) {
       
    69             window.setInterval(function() {
       
    70                 _this.refresh();
       
    71             },_opts.auto_refresh)
       
    72         }
    55     }
    73     }
    56 }
    74 }
    57 
    75 
    58 Rkns._BaseBin.prototype.destroy = function() {
    76 Rkns._BaseBin.prototype.destroy = function() {
    59     this.$.detach();
    77     this.$.detach();
   131         );
   149         );
   132         this.setSearchEngine(0);
   150         this.setSearchEngine(0);
   133     }
   151     }
   134     Rkns._(_opts.bins).each(function(_bin) {
   152     Rkns._(_opts.bins).each(function(_bin) {
   135         _this.tabs.push(new _bin.bin(_this, _bin));
   153         _this.tabs.push(new _bin.bin(_this, _bin));
   136     })
   154     });
   137     
       
   138     /* The bins are not yet populated, but we want to bind dragging functions
       
   139      * here, as it will be easier than in the bins. Therefore, we bind to Rk-Bins
       
   140      * and look where the click was. */
       
   141     function findItem(_event) {
       
   142         var _t = Rkns.$(_event.target);
       
   143         while (!_t.is(".Rk-Bins,.Rk-Bin-Item")) {
       
   144             _t = _t.parent();
       
   145         }
       
   146         if (_t.is(".Rk-Bin-Item")) {
       
   147             return _t
       
   148         } else {
       
   149             return null;
       
   150         }
       
   151     }
       
   152     
   155     
   153     this.$.find(".Rk-Bins")
   156     this.$.find(".Rk-Bins")
   154         .on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() {
   157         .on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() {
   155             var _mainDiv = Rkns.$(this).siblings(".Rk-Bin-Main");
   158             var _mainDiv = Rkns.$(this).siblings(".Rk-Bin-Main");
   156             if (_mainDiv.is(":hidden")) {
   159             if (_mainDiv.is(":hidden")) {