diff -r d341117f9370 -r 803dbeb7c919 client/js/main.js --- a/client/js/main.js Tue Feb 26 19:04:37 2013 +0100 +++ b/client/js/main.js Wed Feb 27 19:04:36 2013 +0100 @@ -26,6 +26,8 @@ Rkns._ = _; +Rkns.VERSION = '0.2'; + Rkns.pickerColors = ["#8f1919", "#a80000", "#d82626", "#ff0000", "#e87c7c", "#ff6565", "#f7d3d3", "#fecccc", "#8f5419", "#a85400", "#d87f26", "#ff7f00", "#e8b27c", "#ffb265", "#f7e5d3", "#fee5cc", "#8f8f19", "#a8a800", "#d8d826", "#feff00", "#e8e87c", "#feff65", "#f7f7d3", "#fefecc", "#198f19", "#00a800", "#26d826", "#00ff00", "#7ce87c", "#65ff65", "#d3f7d3", "#ccfecc", "#198f8f", "#00a8a8", "#26d8d8", "#00feff", "#7ce8e8", "#65feff", "#d3f7f7", "#ccfefe", "#19198f", "#0000a8", "#2626d8", "#0000ff", "#7c7ce8", "#6565ff", "#d3d3f7", "#ccccfe", "#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe", "#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff"]; Rkns._BaseBin = function(_renkan, _opts) { @@ -87,6 +89,8 @@ /* Point of entry */ Rkns.Renkan = function(_opts) { + var _this = this; + if (typeof _opts.language !== "string" || typeof Rkns.i18n[_opts.language] == "undefined") { _opts.language = "en"; } @@ -108,10 +112,22 @@ if (typeof _opts.read_only !== "boolean") { _opts.read_only = false; } + if (typeof _opts.properties !== "object") { + _opts.properties = []; + } + if (typeof _opts.property_files === "object") { + Rkns._(_opts.property_files).each(function(f) { + Rkns.$.getJSON(f, function(data) { + _this.properties = _this.properties.concat(data); + }); + }); + } this.project = new Rkns.Models.Project(); this.language = _opts.language; this.static_url = _opts.static_url; + this.show_bins = _opts.show_bins; this.read_only = _opts.read_only; + this.properties = _opts.properties; this.translate = function(_text) { return (Rkns.i18n[_opts.language] || Rkns.i18n[_opts.language.substr(0,2)] || {})[_text] || _text; } @@ -121,19 +137,13 @@ this.$ = Rkns.$("#" + _opts.container); this.$ .addClass("Rk-Main") - .html(this.template(_opts)); + .html(this.template(this)); this.renderer = new Rkns.Renderer.Scene(this); this.tabs = []; this.search_engines = []; - this.selected_bin_item = undefined; this.current_user_list = new Rkns.Models.UsersList(); - var _this = this; - this.$.mouseup(function() { - _this.selected_bin_item = undefined; - _this.$.find(".Rk-Bin-Item.dragging").removeClass("dragging"); - }); if (!_opts.search.length) { this.$.find(".Rk-Web-Search-Form").detach(); } else { @@ -185,19 +195,6 @@ _this.$.find(".Rk-Bin-Main").slideUp(); _mainDiv.slideDown(); } - }).on("mousedown", ".Rk-Bin-Item", function() { - if (_this.read_only) { - return false; - } - var _t = Rkns.$(this); - _t.addClass("dragging"); - _this.selected_bin_item = { - uri : $(_t).attr("data-uri"), - title : $(_t).attr("data-title"), - description : $(_t).attr("data-description"), - image: $(_t).attr("data-image") - } - return false; }).on("mouseover", ".Rk-Bin-Item", function(_e) { var _t = Rkns.$(this); if (_t && $(_t).attr("data-uri")) { @@ -210,6 +207,12 @@ } }).mouseout(function() { _this.renderer.unhighlightAll(); + }).on("dragstart", ".Rk-Bin-Item", function(e) { + var _t = Rkns.$(this); + e.originalEvent.dataTransfer.setData("text/x-iri-title",$(_t).attr("data-title")); + e.originalEvent.dataTransfer.setData("text/x-iri-description",$(_t).attr("data-description")); + e.originalEvent.dataTransfer.setData("text/x-iri-uri",$(_t).attr("data-uri")); + e.originalEvent.dataTransfer.setData("text/x-iri-image",$(_t).attr("data-image")); }); Rkns.$(window).resize(function() { _this.resizeBins(); @@ -227,11 +230,11 @@ } Rkns.Renkan.prototype.template = Rkns._.template( - '<% if (show_bins) { %>

Hyper Plateau

' - + '
' + '<% if (show_bins) { %>

<%- translate("Renkan") %>

' + + '" />' + '
    ' + '' - + '
    ' + + '" />' + '
    ' + '
      <% } %>
      ' );