f(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function lt(n){return function(t,e,r){var u={};e=J.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r 3&&"function"==typeof r[t-2])var e=Q(r[--t-1],r[t--],2);else t>2&&"function"==typeof r[t-1]&&(e=r[--t]);for(var u=p(arguments,1,t),o=-1,a=i(),f=i();++o \n \n \n \n \n \n \n '+__e(renkan.translate("Change edge direction"))+"\n \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+__e(edge.description)+" \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' '+(null==(__t=hdescription)?"":__t)+" \n \n \n \n \n \n \n '+__e(renkan.translate("Size:"))+'\n -\n '+__e(node.size)+'\n +\n \n \n \n \n \n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n \n \n \n '+__e(node.description)+" \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n '+(null==(__t=hdescription)?"":__t)+" \n \n \n \n \n \n \n '+__e(renkan.translate("Change edge direction"))+"\n \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+__e(edge.description)+" \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' '+(null==(__t=hdescription)?"":__t)+" \n \n \n \n \n \n \n '+__e(renkan.translate("Size:"))+'\n -\n '+__e(node.size)+'\n +\n \n \n \n \n \n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n \n \n \n '+__e(node.description)+" \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n '+(null==(__t=hdescription)?"":__t)+" \\n \\n \\n \\n \\n \\n \\n ' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'\\n \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n %-edge.to_color%>;\">\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n ;\">\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n \\n ' +\n__e( edge.short_uri ) +\n'\\n ' +\n__e(edge.description) +\n' \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' \\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Size:\")) +\n'\\n -\\n ' +\n__e(node.size) +\n'\\n +\\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n \\n \\n \\n \\n ' +\n__e(node.short_uri) +\n'\\n ' +\n__e(node.description) +\n' \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' \\n \\n \\n \\n \\n \\n \\n ' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'\\n \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n %-edge.to_color%>;\">\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n ;\">\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n \\n ' +\n__e( edge.short_uri ) +\n'\\n ' +\n__e(edge.description) +\n' \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' \\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Size:\")) +\n'\\n -\\n ' +\n__e(node.size) +\n'\\n +\\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n \\n \\n \\n \\n ' +\n__e(node.short_uri) +\n'\\n ' +\n__e(node.description) +\n' \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' f(h,y))&&((u||v)&&h.push(y),s.push(g))}return v?(l(h.k),c(h)):u&&l(h),s}function lt(n){return function(t,e,r){var u={};e=J.createCallback(e,r,3),r=-1;var o=t?t.length:0;if(typeof o=="number")for(;++r 3&&"function"==typeof r[t-2])var e=Q(r[--t-1],r[t--],2);else t>2&&"function"==typeof r[t-1]&&(e=r[--t]);for(var u=p(arguments,1,t),o=-1,a=i(),f=i();++o \n \n \n \n \n \n \n '+__e(renkan.translate("Change edge direction"))+"\n \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+__e(edge.description)+" \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' '+(null==(__t=hdescription)?"":__t)+" \n \n \n \n \n \n \n '+__e(renkan.translate("Size:"))+'\n -\n '+__e(node.size)+'\n +\n \n \n \n \n \n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n \n \n \n '+__e(node.description)+" \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n '+(null==(__t=hdescription)?"":__t)+" \n \n \n \n \n \n \n '+__e(renkan.translate("Change edge direction"))+"\n \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+__e(edge.description)+" \n '+__e(renkan.translate("From:"))+'\n \n '+__e(shortenText(edge.from_title,25))+'\n \n '+__e(renkan.translate("To:"))+'\n \n '+__e(shortenText(edge.to_title,25))+"\n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(edge.created_by_title,25))+"\n "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' "+(null==(__t=hdescription)?"":__t)+" Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+' '+(null==(__t=hdescription)?"":__t)+" \n \n \n \n \n \n \n '+__e(renkan.translate("Size:"))+'\n -\n '+__e(node.size)+'\n +\n \n \n \n \n \n \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n \n \n \n '+__e(node.description)+" \n '+__e(renkan.translate("Created by:"))+'\n \n '+__e(shortenText(node.created_by_title,25))+"\n '+(null==(__t=hdescription)?"":__t)+" \\n \\n \\n \\n \\n \\n \\n ' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'\\n \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n %-edge.to_color%>;\">\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n ;\">\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n \\n ' +\n__e( edge.short_uri ) +\n'\\n ' +\n__e(edge.description) +\n' \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' \\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Size:\")) +\n'\\n -\\n ' +\n__e(node.size) +\n'\\n +\\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n \\n \\n \\n \\n ' +\n__e(node.short_uri) +\n'\\n ' +\n__e(node.description) +\n' \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' \\n \\n \\n \\n \\n \\n \\n ' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'\\n \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n %-edge.to_color%>;\">\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n ;\">\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n \\n ' +\n__e( edge.short_uri ) +\n'\\n ' +\n__e(edge.description) +\n' \\n ' +\n__e(renkan.translate(\"From:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"To:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n' ' +\n((__t = (hdescription)) == null ? '' : __t) +\n' \\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Size:\")) +\n'\\n -\\n ' +\n__e(node.size) +\n'\\n +\\n \\n \\n \\n \\n \\n \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n \\n \\n \\n \\n ' +\n__e(node.short_uri) +\n'\\n ' +\n__e(node.description) +\n' \\n ' +\n__e(renkan.translate(\"Created by:\")) +\n'\\n \\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n ' +\n((__t = (hdescription)) == null ? '' : __t) +\n'\n ×'+__e(renkan.translate("Edit Edge"))+"\n
\n\n ×\n ',options.show_edge_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',edge.uri&&(__p+='\n \n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" "),__p+="\n \n
\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n \n"),__p+="\n\n
'+(null==(__t=htitle)?"":__t)+"
\n \n
'+(null==(__t=htitle)?"":__t)+"
\n
\n '+(null==(__t=htitle)?"":__t)+'
\n \n\n'),__p+='\n
\n ',url&&(__p+='\n \n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+=""),__p+="\n
\n ",description&&(__p+='\n '+__e(translate("Select contents:"))+'
\n \n \n \n
\n ×'+__e(renkan.translate("Edit Node"))+"\n
\n\n ',node.clip_path&&(__p+='\n \n '),__p+="\n
\n ×\n ',options.show_node_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',node.uri&&(__p+='\n \n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+=""),__p+="\n \n
\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n \n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n \n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n
\n '+__e(project.get("title")||translate("Untitled project"))+"\n
\n ",__p+="\n ",options.show_user_list&&(__p+='\n \n
\n \n '+(null==(__t=htitle)?"":__t)+'\n
\n ").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("
'+a.translate("Loading, please wait")+"
"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return''+b.pickerColors.map(function(b){return a({c:b})}).join("")+"
"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageXTags
Annotations
\n ×'+__e(renkan.translate("Edit Edge"))+"\n
\n\n ×\n ',options.show_edge_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',edge.uri&&(__p+='\n \n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" "),__p+="\n \n
\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n \n"),__p+="\n\n
'+(null==(__t=htitle)?"":__t)+"
\n \n
'+(null==(__t=htitle)?"":__t)+"
\n
\n '+(null==(__t=htitle)?"":__t)+'
\n \n\n'),__p+='\n
\n ',url&&(__p+='\n \n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+=""),__p+="\n
\n ",description&&(__p+='\n '+__e(translate("Select contents:"))+'
\n \n \n \n
\n ×'+__e(renkan.translate("Edit Node"))+"\n
\n\n ',node.clip_path&&(__p+='\n \n '),__p+="\n
\n ×\n ',options.show_node_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',node.uri&&(__p+='\n \n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+=""),__p+="\n \n
\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n \n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n \n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n
\n '+__e(project.get("title")||translate("Untitled project"))+"\n
\n ",__p+="\n ",options.show_user_list&&(__p+='\n \n
\n \n '+(null==(__t=htitle)?"":__t)+'\n
\n ").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("
'+a.translate("Loading, please wait")+"
"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return''+b.pickerColors.map(function(b){return a({c:b})}).join("")+"
"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageXTags
Annotations
\\n ×' +\n__e(renkan.translate(\"Edit Edge\")) +\n'\\n
\\n\\n ×\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (edge.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' ';\n } ;\n__p += '\\n \\n
\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n\\n';\n } ;\n__p += '\\n
\\n ';\n if (url) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '';\n } ;\n__p += '\\n
\\n ';\n if (description) { ;\n__p += '\\n ' +\n__e( translate(\"Select contents:\")) +\n'
\\n \\n \\n \\n
\\n ×' +\n__e(renkan.translate(\"Edit Node\")) +\n'\\n
\\n\\n ';\n if (node.clip_path) { ;\n__p += '\\n \\n ';\n };\n__p += '\\n
\\n ×\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (node.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '';\n } ;\n__p += '\\n \\n
\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n \\n';\n } ;\n__p += ' ';\n if (node.has_creator && options.show_node_tooltip_creator) { ;\n__p += '\\n
\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n
\\n ';\n } else { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n \\n
\\n
\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n
\\n ')\n .addClass(\"Rk-Bin-Title\")\n .appendTo(this.$);\n this.main_$ = Rkns.$('
' + _renkan.translate(\"Loading, please wait\") + '
');\n this.title_$.html(_opts.title || '(new bin)');\n this.renkan.resizeBins();\n\n if (_opts.auto_refresh) {\n window.setInterval(function() {\n _this.refresh();\n }, _opts.auto_refresh);\n }\n }\n };\n\n _BaseBin.prototype.destroy = function() {\n this.$.detach();\n this.renkan.resizeBins();\n };\n\n /* Point of entry */\n\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).join(\"\") + '
';\n })();\n\n if (this.options.show_editor) {\n this.renderer = new Rkns.Renderer.Scene(this);\n }\n\n if (!this.options.search.length) {\n this.$.find(\".Rk-Web-Search-Form\").detach();\n } else {\n var _tmpl = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='Tags
Annotations
\\n ×' +\n__e(renkan.translate(\"Edit Edge\")) +\n'\\n
\\n\\n ×\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (edge.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' ';\n } ;\n__p += '\\n \\n
\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n\\n';\n } ;\n__p += '\\n
\\n ';\n if (url) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '';\n } ;\n__p += '\\n
\\n ';\n if (description) { ;\n__p += '\\n ' +\n__e( translate(\"Select contents:\")) +\n'
\\n \\n \\n \\n
\\n ×' +\n__e(renkan.translate(\"Edit Node\")) +\n'\\n
\\n\\n ';\n if (node.clip_path) { ;\n__p += '\\n \\n ';\n };\n__p += '\\n
\\n ×\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (node.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '';\n } ;\n__p += '\\n \\n
\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n \\n';\n } ;\n__p += ' ';\n if (node.has_creator && options.show_node_tooltip_creator) { ;\n__p += '\\n
\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n
\\n ';\n } else { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n \\n
\\n
\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n
\\n ')\n .addClass(\"Rk-Bin-Title\")\n .appendTo(this.$);\n this.main_$ = Rkns.$('
' + _renkan.translate(\"Loading, please wait\") + '
');\n this.title_$.html(_opts.title || '(new bin)');\n this.renkan.resizeBins();\n\n if (_opts.auto_refresh) {\n window.setInterval(function() {\n _this.refresh();\n }, _opts.auto_refresh);\n }\n }\n };\n\n _BaseBin.prototype.destroy = function() {\n this.$.detach();\n this.renkan.resizeBins();\n };\n\n /* Point of entry */\n\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).join(\"\") + '
';\n })();\n\n if (this.options.show_editor) {\n this.renderer = new Rkns.Renderer.Scene(this);\n }\n\n if (!this.options.search.length) {\n this.$.find(\".Rk-Web-Search-Form\").detach();\n } else {\n var _tmpl = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='Tags
Annotations
\n ×'+__e(renkan.translate("Edit Edge"))+"\n
\n\n ×\n ',options.show_edge_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',edge.uri&&(__p+='\n \n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" "),__p+="\n \n
\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n \n"),__p+="\n\n
'+(null==(__t=htitle)?"":__t)+"
\n \n
'+(null==(__t=htitle)?"":__t)+"
\n
\n '+(null==(__t=htitle)?"":__t)+'
\n \n\n'),__p+='\n
\n ',url&&(__p+='\n \n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+=""),__p+="\n
\n ",description&&(__p+='\n '+__e(translate("Select contents:"))+'
\n \n \n \n
\n ×'+__e(renkan.translate("Edit Node"))+"\n
\n\n ',node.clip_path&&(__p+='\n \n '),__p+="\n
\n ×\n ',options.show_node_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',node.uri&&(__p+='\n \n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+=""),__p+="\n \n
\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n \n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n \n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n
\n '+__e(project.get("title")||translate("Untitled project"))+"\n
\n ",__p+="\n ",options.show_user_list&&(__p+='\n \n
\n \n '+(null==(__t=htitle)?"":__t)+'\n
\n ").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("
'+a.translate("Loading, please wait")+"
"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return''+b.pickerColors.map(function(b){return a({c:b})}).join("")+"
"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageXTags
Annotations
\n ×'+__e(renkan.translate("Edit Edge"))+"\n
\n\n ×\n ',options.show_edge_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',edge.uri&&(__p+='\n \n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" "),__p+="\n \n
\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n \n"),__p+="\n\n
'+(null==(__t=htitle)?"":__t)+"
\n \n
'+(null==(__t=htitle)?"":__t)+"
\n
\n '+(null==(__t=htitle)?"":__t)+'
\n \n\n'),__p+='\n
\n ',url&&(__p+='\n \n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+=""),__p+="\n
\n ",description&&(__p+='\n '+__e(translate("Select contents:"))+'
\n \n \n \n
\n ×'+__e(renkan.translate("Edit Node"))+"\n
\n\n ',node.clip_path&&(__p+='\n \n '),__p+="\n
\n ×\n ',options.show_node_tooltip_color&&(__p+='\n \n '),__p+='\n \n ',node.uri&&(__p+='\n \n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+=""),__p+="\n \n
\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n \n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n \n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n
\n '+__e(project.get("title")||translate("Untitled project"))+"\n
\n ",__p+="\n ",options.show_user_list&&(__p+='\n \n
\n \n '+(null==(__t=htitle)?"":__t)+'\n
\n ").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("
'+a.translate("Loading, please wait")+"
"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return''+b.pickerColors.map(function(b){return a({c:b})}).join("")+"
"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageXTags
Annotations
\\n ×' +\n__e(renkan.translate(\"Edit Edge\")) +\n'\\n
\\n\\n ×\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (edge.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' ';\n } ;\n__p += '\\n \\n
\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n\\n';\n } ;\n__p += '\\n
\\n ';\n if (url) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '';\n } ;\n__p += '\\n
\\n ';\n if (description) { ;\n__p += '\\n ' +\n__e( translate(\"Select contents:\")) +\n'
\\n \\n \\n \\n
\\n ×' +\n__e(renkan.translate(\"Edit Node\")) +\n'\\n
\\n\\n ';\n if (node.clip_path) { ;\n__p += '\\n \\n ';\n };\n__p += '\\n
\\n ×\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (node.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '';\n } ;\n__p += '\\n \\n
\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n \\n';\n } ;\n__p += ' ';\n if (node.has_creator && options.show_node_tooltip_creator) { ;\n__p += '\\n
\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n
\\n ';\n } else { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n \\n
\\n
\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n
\\n ')\n .addClass(\"Rk-Bin-Title\")\n .appendTo(this.$);\n this.main_$ = Rkns.$('
' + _renkan.translate(\"Loading, please wait\") + '
');\n this.title_$.html(_opts.title || '(new bin)');\n this.renkan.resizeBins();\n\n if (_opts.auto_refresh) {\n window.setInterval(function() {\n _this.refresh();\n }, _opts.auto_refresh);\n }\n }\n };\n\n _BaseBin.prototype.destroy = function() {\n this.$.detach();\n this.renkan.resizeBins();\n };\n\n /* Point of entry */\n\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).join(\"\") + '
';\n })();\n\n if (this.options.show_editor) {\n this.renderer = new Rkns.Renderer.Scene(this);\n }\n\n if (!this.options.search.length) {\n this.$.find(\".Rk-Web-Search-Form\").detach();\n } else {\n var _tmpl = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='Tags
Annotations
\\n ×' +\n__e(renkan.translate(\"Edit Edge\")) +\n'\\n
\\n\\n ×\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (edge.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' ';\n } ;\n__p += '\\n \\n
\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n
' +\n((__t = (htitle)) == null ? '' : __t) +\n'
\\n \\n\\n';\n } ;\n__p += '\\n
\\n ';\n if (url) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '';\n } ;\n__p += '\\n
\\n ';\n if (description) { ;\n__p += '\\n ' +\n__e( translate(\"Select contents:\")) +\n'
\\n \\n \\n \\n
\\n ×' +\n__e(renkan.translate(\"Edit Node\")) +\n'\\n
\\n\\n ';\n if (node.clip_path) { ;\n__p += '\\n \\n ';\n };\n__p += '\\n
\\n ×\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n \\n ';\n if (node.uri) { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '';\n } ;\n__p += '\\n \\n
\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n \\n';\n } ;\n__p += ' ';\n if (node.has_creator && options.show_node_tooltip_creator) { ;\n__p += '\\n
\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n
\\n ';\n } else { ;\n__p += '\\n \\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n \\n
\\n
\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n
\\n ')\n .addClass(\"Rk-Bin-Title\")\n .appendTo(this.$);\n this.main_$ = Rkns.$('
' + _renkan.translate(\"Loading, please wait\") + '
');\n this.title_$.html(_opts.title || '(new bin)');\n this.renkan.resizeBins();\n\n if (_opts.auto_refresh) {\n window.setInterval(function() {\n _this.refresh();\n }, _opts.auto_refresh);\n }\n }\n };\n\n _BaseBin.prototype.destroy = function() {\n this.$.detach();\n this.renkan.resizeBins();\n };\n\n /* Point of entry */\n\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).join(\"\") + '
';\n })();\n\n if (this.options.show_editor) {\n this.renderer = new Rkns.Renderer.Scene(this);\n }\n\n if (!this.options.search.length) {\n this.$.find(\".Rk-Web-Search-Form\").detach();\n } else {\n var _tmpl = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='Tags
Annotations