--- a/client/js/main.js Fri Apr 19 13:39:39 2013 +0200
+++ b/client/js/main.js Fri Apr 19 15:31:56 2013 +0200
@@ -52,25 +52,25 @@
Rkns.$('<a>')
.attr({
- href: "#",
- title: _renkan.translate("Close bin")
- })
+ href: "#",
+ title: _renkan.translate("Close bin")
+ })
.addClass("Rk-Bin-Close")
.html('×')
.appendTo(this.$)
.click(function() {
_this.destroy();
if (!_renkan.$.find(".Rk-Bin-Main:visible").length) {
- _renkan.$.find(".Rk-Bin-Main:last").slideDown();
+ _renkan.$.find(".Rk-Bin-Main:last").slideDown();
}
_renkan.resizeBins();
return false;
});
Rkns.$('<a>')
.attr({
- href: "#",
- title: _renkan.translate("Refresh bin")
- })
+ href: "#",
+ title: _renkan.translate("Refresh bin")
+ })
.addClass("Rk-Bin-Refresh")
.appendTo(this.$)
.click(function() {
@@ -110,11 +110,11 @@
this.options = _.defaults(_opts, Rkns.defaults);
- Rkns._(this.options.property_files).each(function(f) {
- Rkns.$.getJSON(f, function(data) {
- _this.options.properties = _this.options.properties.concat(data);
- });
- });
+ Rkns._(this.options.property_files).each(function(f) {
+ Rkns.$.getJSON(f, function(data) {
+ _this.options.properties = _this.options.properties.concat(data);
+ });
+ });
this.read_only = this.options.read_only || !this.options.editor_mode;
@@ -141,9 +141,9 @@
_input = this.$.find(".Rk-Web-Search-Input")
_form = this.$.find(".Rk-Web-Search-Form");
Rkns._(this.options.search).each(function(_search, _key) {
- if (Rkns[_search.type] && Rkns[_search.type].Search) {
- _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));
- }
+ if (Rkns[_search.type] && Rkns[_search.type].Search) {
+ _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));
+ }
});
_select.html(
Rkns._(this.search_engines).map(function(_search, _key) {
@@ -175,9 +175,9 @@
this.setSearchEngine(0);
}
Rkns._(this.options.bins).each(function(_bin) {
- if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {
- _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));
- }
+ if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {
+ _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));
+ }
});
var elementDropped = false;
@@ -202,43 +202,43 @@
}).mouseout(function() {
_this.renderer.unhighlightAll();
}).on("mousemove", ".Rk-Bin-Item", function(e) {
- try {
- this.dragDrop();
- }
- catch(err) {}
+ try {
+ this.dragDrop();
+ }
+ catch(err) {}
}).on("touchstart", ".Rk-Bin-Item", function(e) {
- elementDropped = false;
+ elementDropped = false;
}).on("touchmove", ".Rk-Bin-Item", function(e) {
- e.preventDefault();
- var touch = e.originalEvent.changedTouches[0],
- off = _this.renderer.canvas_$.offset(),
- w = _this.renderer.canvas_$.width(),
- h = _this.renderer.canvas_$.height();
- if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {
- if (elementDropped) {
- _this.renderer.onMouseMove(touch, true);
- } else {
- elementDropped = true;
- var div = document.createElement('div');
- div.appendChild(this.cloneNode(true));
- _this.renderer.dropData({"text/html": div.innerHTML}, touch);
- _this.renderer.onMouseDown(touch, true);
- }
- }
+ e.preventDefault();
+ var touch = e.originalEvent.changedTouches[0],
+ off = _this.renderer.canvas_$.offset(),
+ w = _this.renderer.canvas_$.width(),
+ h = _this.renderer.canvas_$.height();
+ if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {
+ if (elementDropped) {
+ _this.renderer.onMouseMove(touch, true);
+ } else {
+ elementDropped = true;
+ var div = document.createElement('div');
+ div.appendChild(this.cloneNode(true));
+ _this.renderer.dropData({"text/html": div.innerHTML}, touch);
+ _this.renderer.onMouseDown(touch, true);
+ }
+ }
}).on("touchend", ".Rk-Bin-Item", function(e) {
- if (elementDropped) {
- _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);
- }
- elementDropped = false;
+ if (elementDropped) {
+ _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);
+ }
+ elementDropped = false;
}).on("dragstart", ".Rk-Bin-Item", function(e) {
- var div = document.createElement('div');
- div.appendChild(this.cloneNode(true));
- try {
- e.originalEvent.dataTransfer.setData("text/html",div.innerHTML);
- }
- catch(err) {
- e.originalEvent.dataTransfer.setData("text",div.innerHTML);
- }
+ var div = document.createElement('div');
+ div.appendChild(this.cloneNode(true));
+ try {
+ e.originalEvent.dataTransfer.setData("text/html",div.innerHTML);
+ }
+ catch(err) {
+ e.originalEvent.dataTransfer.setData("text",div.innerHTML);
+ }
});
Rkns.$(window).resize(function() {
_this.resizeBins();
@@ -266,17 +266,17 @@
);
Rkns.Renkan.prototype.translate = function(_text) {
- if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {
- return Rkns.i18n[this.options.language][_text];
- }
- if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0,2)] && Rkns.i18n[this.options.language.substr(0,2)][_text]) {
- return Rkns.i18n[this.options.language.substr(0,2)][_text];
- }
- return _text;
+ if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {
+ return Rkns.i18n[this.options.language][_text];
+ }
+ if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0,2)] && Rkns.i18n[this.options.language.substr(0,2)][_text]) {
+ return Rkns.i18n[this.options.language.substr(0,2)][_text];
+ }
+ return _text;
}
Rkns.Renkan.prototype.onStatusChange = function() {
- this.renderer.onStatusChange();
+ this.renderer.onStatusChange();
}
Rkns.Renkan.prototype.setSearchEngine = function(_key) {
@@ -299,6 +299,7 @@
Rkns.Utils = {
_ID_AUTO_INCREMENT : 0,
_ID_BASE : (function(_d) {
+
function pad(n){return n<10 ? '0'+n : n}
function fillrand(n) {
var _res = ''
@@ -311,30 +312,35 @@
+ pad(_d.getUTCMonth()+1) + '-'
+ pad(_d.getUTCDate()) + '-'
+ fillrand(16);
+
})(new Date()),
getUID : function(_base) {
+
var _n = (++this._ID_AUTO_INCREMENT).toString(16),
_base = (typeof _base === "undefined" ? "" : _base + "-" );
while (_n.length < 4) {
_n = '0' + _n
}
return _base + this._ID_BASE + '-' + _n;
+
},
getFullURL : function(url) {
-
- if(typeof(url) == 'undefined' || url == null ) {
- return "";
- }
- if(url.indexOf("http://")==0) {
- return url;
- }
- var img = new Image();
- img.src = url;
- var res = img.src;
- img.src = null;
- return res;
+
+ if(typeof(url) == 'undefined' || url == null ) {
+ return "";
+ }
+ if(/https?:\/\//.test(url)) {
+ return url;
+ }
+ var img = new Image();
+ img.src = url;
+ var res = img.src;
+ img.src = null;
+ return res;
+
},
inherit : function(_baseClass, _callbefore) {
+
var _class = function() {
if (typeof _callbefore === "function") {
_callbefore.apply(this, Array.prototype.slice.call(arguments, 0));
@@ -346,5 +352,6 @@
}
_class.prototype = new _baseClass();
return _class;
+
}
}
\ No newline at end of file