client/js/main.js
changeset 42 48d825187d67
parent 41 9b9aabbb83bb
child 44 869410bab434
--- a/client/js/main.js	Fri Sep 14 10:21:00 2012 +0900
+++ b/client/js/main.js	Tue Nov 13 11:46:27 2012 +0100
@@ -36,13 +36,25 @@
         this.title_icon_$ = Rkns.$('<span>')
             .addClass("Rk-Bin-Title-Icon")
             .appendTo(this.$);
+            
         var _this = this;
-        Rkns.$('<span>')
+        
+        Rkns.$('<a>')
+            .attr("href","#")
             .addClass("Rk-Bin-Close")
             .html('&times;')
             .appendTo(this.$)
             .click(function() {
                 _this.destroy();
+                return false;
+            });
+        Rkns.$('<a>')
+            .attr("href","#")
+            .addClass("Rk-Bin-Refresh")
+            .appendTo(this.$)
+            .click(function() {
+                _this.refresh();
+                return false;
             });
         this.title_$ = Rkns.$('<h2>')
             .addClass("Rk-Bin-Title")
@@ -52,6 +64,12 @@
             .appendTo(this.$);
         this.title_$.html(_opts.title || '(new bin)');
         this.renkan.resizeBins();
+        
+        if (_opts.auto_refresh) {
+            window.setInterval(function() {
+                _this.refresh();
+            },_opts.auto_refresh)
+        }
     }
 }
 
@@ -133,22 +151,7 @@
     }
     Rkns._(_opts.bins).each(function(_bin) {
         _this.tabs.push(new _bin.bin(_this, _bin));
-    })
-    
-    /* The bins are not yet populated, but we want to bind dragging functions
-     * here, as it will be easier than in the bins. Therefore, we bind to Rk-Bins
-     * and look where the click was. */
-    function findItem(_event) {
-        var _t = Rkns.$(_event.target);
-        while (!_t.is(".Rk-Bins,.Rk-Bin-Item")) {
-            _t = _t.parent();
-        }
-        if (_t.is(".Rk-Bin-Item")) {
-            return _t
-        } else {
-            return null;
-        }
-    }
+    });
     
     this.$.find(".Rk-Bins")
         .on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() {