--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map Thu Apr 23 16:37:42 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map Thu Apr 23 16:42:31 2015 +0200
@@ -1,1 +1,1 @@
-{"version":3,"file":"renkan.min.js","sources":["../../js/main.js","../../js/models.js","../../js/defaults.js","../../js/i18n.js","../../js/full-json.js","../../js/save-once.js","../../js/ldtjson-bin.js","../../js/list-bin.js","../../js/wikipedia-bin.js","paper-renderer.js"],"names":["root","Rkns","$","jQuery","_","pickerColors","__renkans","_BaseBin","_renkan","_opts","this","renkan","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","title","translate","html","click","destroy","length","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","prototype","detach","Renkan","push","options","defaults","property_files","each","f","getJSON","data","properties","concat","read_only","editor_mode","project","Models","Project","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","template","tabs","search_engines","current_user_list","UsersList","on","colorPicker","_tmpl","map","c","join","show_editor","Renderer","Scene","search","_select","_input","_form","_search","type","Search","_key","key","getSearchTitle","className","getBgClass","_el","setSearchEngine","submit","val","search_engine","mouseenter","mouseleave","bins","_bin","Bin","elementDropped","_mainDiv","siblings","is","slideUp","_t","_models","get","where","uri","_model","highlightModel","mouseout","unhighlightAll","dragDrop","err","e","preventDefault","touch","originalEvent","changedTouches","off","canvas_$","offset","w","width","h","height","pageX","left","pageY","top","onMouseMove","div","document","createElement","appendChild","cloneNode","dropData","text/html","innerHTML","onMouseDown","onMouseUp","dataTransfer","setData","resize","lastsearch","lastval","Utils","regexpFromTextOrArray","source","tab","render","_text","i18n","language","substr","onStatusChange","listClasses","split","classes","i","_d","outerHeight","css","getUUID4","replace","r","Math","random","v","toString","getUID","pad","n","Date","ID_AUTO_INCREMENT","ID_BASE","getUTCFullYear","getUTCMonth","getUTCDate","_base","_n","_uidbase","getFullURL","url","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","Array","slice","call","arguments","_init","_initialized","extend","replaceText","makeReplaceFunc","l","k","charsrx","txt","toLowerCase","remrx","j","remsrc","charsub","getSource","inp","removeChars","String","fromCharCode","RegExp","_textOrArray","testrx","replacerx","isempty","_replace","text","_MIN_DRAG_DISTANCE","_NODE_BUTTON_WIDTH","_EDGE_BUTTON_INNER","_EDGE_BUTTON_OUTER","_CLICKMODE_ADDNODE","_CLICKMODE_STARTEDGE","_CLICKMODE_ENDEDGE","_NODE_SIZE_STEP","LN2","_MIN_SCALE","_MAX_SCALE","_MOUSEMOVE_RATE","_DOUBLETAP_DELAY","_DOUBLETAP_DISTANCE","_USER_PLACEHOLDER","color","default_user_color","_BOOKMARKLET_CODE","shortenText","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","size","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","Backbone","obj","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","description","prepare","validate","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","image","clip_path","shape","Edge","from","to","View","isArray","zoom_level","RosterUser","blacklist","HasMany","reverseRelation","includeInJSON","_props","_user","findOrCreate","addNode","_node","addEdge","_edge","addView","_view","removeNode","remove","removeEdge","_project","users","nodes","edges","views","_item","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","static_url","show_bins","manual_save","show_top_bar","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","show_zoom","save_view","default_view","show_search_field","show_user_list","user_name_editable","user_color_editable","show_user_color","show_save_button","show_export_button","show_open_button","show_addnode_button","show_addedge_button","show_bookmarklet","show_fullscreen_button","home_button_url","home_button_title","show_minimap","minimap_width","minimap_height","minimap_padding","minimap_background_color","minimap_border_color","minimap_highlight_color","minimap_highlight_weight","buttons_background","buttons_label_color","buttons_label_font_size","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","selected_node_stroke_width","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","change_shapes","edge_stroke_width","selected_edge_stroke_width","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","show_node_editor_uri","show_node_editor_description","show_node_editor_size","show_node_editor_color","show_node_editor_image","show_node_editor_creator","allow_image_upload","uploaded_image_max_kb","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_color","show_node_tooltip_image","show_node_tooltip_creator","show_edge_editor_uri","show_edge_editor_color","show_edge_editor_direction","show_edge_editor_nodes","show_edge_editor_creator","show_edge_tooltip_uri","show_edge_tooltip_color","show_edge_tooltip_nodes","show_edge_tooltip_creator","fr","Edit Node","Edit Edge","Title:","URI:","Description:","From:","To:","Image URL:","Choose Image File:","Full Screen","Add Node","Add Edge","Save Project","Open Project","Auto-save enabled","Connection lost","Created by:","Zoom In","Zoom Out","Edit","Remove","Cancel deletion","Link to another node","Enlarge","Shrink","Click on the background canvas to add a node","Click on a first node to start the edge","Click on a second node to complete the edge","Wikipedia","Wikipedia in ","French","English","Japanese","Untitled project","Lignes de Temps","Loading, please wait","Edge color:","Node color:","Choose color","Change edge direction","Do you really wish to remove node ","Do you really wish to remove edge ","This file is not an image","Image size must be under ","Size:","KB","Choose from vocabulary:","SKOS Documentation properties","has note","has example","has definition","SKOS Semantic relations","has broader","has narrower","has related","Dublin Core Metadata","has contributor","covers","created by","has date","published by","has source","has subject","Dragged resource","Search the Web","Search in Bins","Close bin","Refresh bin","(untitled)","Select contents:","Drag items from this website, drop them in Renkan","Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.","Shapes available","Circle","Square","Diamond","Hexagone","Ellipse","Star","Zoom Fit","Download Project","Zoom Save","View saved zoom","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","jsonIO","_proj","http_method","_load","redrawActive","set","loading_status","_data","save_status","fixSize","_save","ajax","contentType","JSON","stringify","success","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","autoScale","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","escape","convertTC","_ms","_res","_totalSeconds","abs","floor","_hours","_minutes","_seconds","_html","_projtitle","meta","count","tags","_tag","_title","htitle","encodedtitle","encodeURIComponent","annotations","_annotation","_description","content","_duration","end","begin","_img","hdescription","start","duration","mediaid","media","annotationid","show","dataType","lang","_q","ResultsBin","segmentTemplate","max_results","highlightrx","objects","_segment","_begin","start_ts","_end","iri_id","element_id","format","q","limit","ResourceList","resultTemplate","list","trim","_match","langs","en","ja","query","_result","encodeURI","snippet","define","_BaseRepresentation","_renderer","_changeBinding","redraw","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","rotate","star","svg","path","ShapeBuilder","NodeRepr","node_layer","activate","buildShape","strokeWidth","h_ratio","labels_$","normal_buttons","NodeEditButton","NodeRemoveButton","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","pending_delete_buttons","NodeRevertButton","all_buttons","active_buttons","last_circle_radius","minimap","minimap_circle","__representation","miniframe","node_group","addChild","shapeBuilder","_dontRedrawEdges","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","scale","forEach","b","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_color","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","ed","edge","repr","getRepresentationByModel","from_representation","to_representation","_image","image_cache","clipPath","hasClipPath","_clip","baseRadius","centerPoint","instructions","lastCoords","minX","Infinity","minY","maxX","maxY","transformCoords","tabc","relative","newCoords","parseFloat","isY","instr","coords","lineTo","cubicCurveTo","quadraticCurveTo","_raster","Raster","locked","Group","clipped","_circleClip","divide","throttledPaperDraw","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","hideButtons","buttons_timeout","undefined","textToReplace","hlvalue","saveCoords","toModelCoords","_event","_isTouch","unselectAll","click_target","edge_layer","bundle","addToBundles","line","arrow","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","handleIn","handleOut","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","item","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","node","has_creator","short_uri","image_placeholder","created_by_color","created_by_title","closeEditor","onFieldChange","shape_changed","keyCode","change","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","titlehtml","load","EdgeEditor","_from_model","_to_model","from_title","to_title","from_color","to_color","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","clearTimeout","NodeButton","delid","delete_list","time","valueOf","confirm","unset","_off","_point","addTempEdge","MiniFrame","filesaver","representations","notif_$","setup","initialScale","totalScroll","mouse_down","selected_target","Layer","background_layer","topleft","bounds","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","_lastTap","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","types","t","getData","parse","bindClick","selector","fname","evt","last","fadeIn","delay","fadeOut","mouseover","onResize","_ratio","newWidth","newHeight","ratioH","delta","ratioW","resizeZoom","_thRedraw","addRepresentations","_thRedrawUsers","el","_delay","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","_repr","_inR","_outR","_startAngle","_endAngle","_padding","_imgname","_caption","_startRads","PI","_endRads","_startdx","sin","_startdy","cos","_startXIn","_startYIn","_startXOut","_startYOut","_enddx","_enddy","_endXIn","_endYIn","_endXOut","_endYOut","_centerR","_centerRads","_centerX","_centerY","_centerXIn","_centerXOut","_centerYIn","_centerYOut","_textX","_textY","arcTo","PointText","characterStyle","fontSize","paragraphStyle","justification","visible","_visible","_restPos","_grp","_imgdelta","_currentPos","pivot","_edgeRepr","_bundle","_er","_dir","indexOf","savebtn","tip","_offset","force_view","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","redrawMiniframe","bottomright","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","blur","empty","parent","name","background","_representation","_representations","_from","_tmpEdge","last_point","_scrolldelta","SQRT2","SQRT1_2","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","_isFull","mozFullScreen","webkitIsFullScreen","_requestMethods","_cancelMethods","widthAft","heightAft","viewSize","zoomOut","zoomIn","_scaleWidth","_scaleHeight","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","foldBins","sizeAft","foldBinsButton","sizeBef","animate","open","require","config","paths","jquery","underscore","startRenkan"],"mappings":";;;;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1BttB,EAASutB,iBAAmBA,EAC5BvtB,EAASwtB,iBAAmBA,EAC5BxtB,EAAS4zB,UAAYA,EACrB5zB,EAASC,MAAQA,EAEjBshC,gBAGJ1e,OAAO,gBAAiB","sourcesContent":["\n/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n\"use strict\";\n\nif (typeof root.Rkns !== \"object\") {\n root.Rkns = {};\n}\n\nvar Rkns = root.Rkns;\nvar $ = Rkns.$ = root.jQuery;\nvar _ = Rkns._ = root._;\n\nRkns.pickerColors = [\"#8f1919\", \"#a80000\", \"#d82626\", \"#ff0000\", \"#e87c7c\", \"#ff6565\", \"#f7d3d3\", \"#fecccc\",\n \"#8f5419\", \"#a85400\", \"#d87f26\", \"#ff7f00\", \"#e8b27c\", \"#ffb265\", \"#f7e5d3\", \"#fee5cc\",\n \"#8f8f19\", \"#a8a800\", \"#d8d826\", \"#feff00\", \"#e8e87c\", \"#feff65\", \"#f7f7d3\", \"#fefecc\",\n \"#198f19\", \"#00a800\", \"#26d826\", \"#00ff00\", \"#7ce87c\", \"#65ff65\", \"#d3f7d3\", \"#ccfecc\",\n \"#198f8f\", \"#00a8a8\", \"#26d8d8\", \"#00feff\", \"#7ce8e8\", \"#65feff\", \"#d3f7f7\", \"#ccfefe\",\n \"#19198f\", \"#0000a8\", \"#2626d8\", \"#0000ff\", \"#7c7ce8\", \"#6565ff\", \"#d3d3f7\", \"#ccccfe\",\n \"#8f198f\", \"#a800a8\", \"#d826d8\", \"#ff00fe\", \"#e87ce8\", \"#ff65fe\", \"#f7d3f7\", \"#feccfe\",\n \"#000000\", \"#242424\", \"#484848\", \"#6d6d6d\", \"#919191\", \"#b6b6b6\", \"#dadada\", \"#ffffff\"];\n\nRkns.__renkans = [];\n\nvar _BaseBin = Rkns._BaseBin = function(_renkan, _opts) {\n if (typeof _renkan !== \"undefined\") {\n this.renkan = _renkan;\n this.renkan.$.find(\".Rk-Bin-Main\").hide();\n this.$ = Rkns.$('<li>')\n .addClass(\"Rk-Bin\")\n .appendTo(_renkan.$.find(\".Rk-Bin-List\"));\n this.title_icon_$ = Rkns.$('<span>')\n .addClass(\"Rk-Bin-Title-Icon\")\n .appendTo(this.$);\n\n var _this = this;\n\n Rkns.$('<a>')\n .attr({\n href: \"#\",\n title: _renkan.translate(\"Close bin\")\n })\n .addClass(\"Rk-Bin-Close\")\n .html('×')\n .appendTo(this.$)\n .click(function() {\n _this.destroy();\n if (!_renkan.$.find(\".Rk-Bin-Main:visible\").length) {\n _renkan.$.find(\".Rk-Bin-Main:last\").slideDown();\n }\n _renkan.resizeBins();\n return false;\n });\n Rkns.$('<a>')\n .attr({\n href: \"#\",\n title: _renkan.translate(\"Refresh bin\")\n })\n .addClass(\"Rk-Bin-Refresh\")\n .appendTo(this.$)\n .click(function() {\n _this.refresh();\n return false;\n });\n this.count_$ = Rkns.$('<div>')\n .addClass(\"Rk-Bin-Count\")\n .appendTo(this.$);\n this.title_$ = Rkns.$('<h2>')\n .addClass(\"Rk-Bin-Title\")\n .appendTo(this.$);\n this.main_$ = Rkns.$('<div>')\n .addClass(\"Rk-Bin-Main\")\n .appendTo(this.$)\n .html('<h4 class=\"Rk-Bin-Loading\">' + _renkan.translate(\"Loading, please wait\") + '</h4>');\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\nvar Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults);\n\n _(this.options.property_files).each(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\n this.setCurrentUser = function (user_id, user_name) {\n \tthis.project.addUser({\n \t\t_id:user_id,\n \t\ttitle: user_name\n \t});\n \tthis.current_user = user_id;\n \tthis.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 = _.template('<li data-color=\"<%=c%>\" style=\"background: <%=c%>\"></li>');\n return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) { return _tmpl({c:c});}).join(\"\") + '</ul>';\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 = _.template('<li class=\"<%= className %>\" data-key=\"<%= key %>\"><%= title %></li>'),\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _(this.options.search).each(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() { _select.slideDown(); }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() { _select.hide(); }\n );\n this.setSearchEngine(0);\n }\n _(this.options.bins).each(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 _(_models).each(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 }\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({\"text/html\": div.innerHTML}, 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 }\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, 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 _(_this.tabs).each(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\nRenkan.prototype.template = _.template(\n '<% if (options.show_bins) { %><div class=\"Rk-Bins\"><div class=\"Rk-Bins-Head\"><h2 class=\"Rk-Bins-Title\"><%- translate(\"Select contents:\")%></h2>' +\n '<form class=\"Rk-Web-Search-Form Rk-Search-Form\"><input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\" placeholder=\"<%- translate(\"Search the Web\") %>\" />' +\n '<div class=\"Rk-Search-Select\"><div class=\"Rk-Search-Current\"></div><ul class=\"Rk-Search-List\"></ul></div>' +\n '<input type=\"submit\" value=\"\" class=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"<%- translate(\"Search the Web\") %>\" /></form>' +\n '<form class=\"Rk-Bins-Search-Form Rk-Search-Form\"><input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\" placeholder=\"<%- translate(\"Search in Bins\") %>\" />' +\n '<input type=\"submit\" value=\"\" class=\"Rk-Bins-Search-Submit Rk-Search-Submit\" title=\"<%- translate(\"Search in Bins\") %>\" /></form></div>' +\n '<ul class=\"Rk-Bin-List\"></ul></div><% } %>' +\n '<% if (options.show_editor) { %><div class=\"Rk-Render Rk-Render-<% if (options.show_bins) { %>Panel<% } else { %>Full<% } %>\"></div><% } %>'\n);\n\nRenkan.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\nRenkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n};\n\nRenkan.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\t(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\nRenkan.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 */\nvar getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n};\n\nRkns.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 = '0' + _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 _(_class.prototype).extend(_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 = _(charsub).map(function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx,\"\"), src = \"\";\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 _(charsub).each(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 _(inp).each(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) { return testrx.test(_t); },\n replace: function(_text, _replace) { return _text.replace(replacerx, _replace); }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() { return true; },\n replace: function(_text) { return text; }\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='<p_style=\\\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\\\">\" +\n _renkan.translate(\"Drag items from this website, drop them in Renkan\").replace(/ /g,\"_\") +\n \"</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\\\/\\\\/[^\\\\/]*twitter\\\\.com\\\\//,s:'.tweet',n:'twitter'},{r:/https?:\\\\/\\\\/[^\\\\/]*google\\\\.[^\\\\/]+\\\\//,s:'.g',n:'google'},{r:/https?:\\\\/\\\\/[^\\\\/]*lemonde\\\\.fr\\\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();\";\n },\n /* Shortens text to the required length then adds ellipsis */\n shortenText: function(_text, _maxlength) {\n return (_text.length > _maxlength ? (_text.substr(0,_maxlength) + '…') : _text);\n },\n /* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited\n * Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */\n drawEditBox: function(_options, _coords, _path, _xmargin, _selector) {\n _selector.css({\n width: ( _options.tooltip_width - 2* _options.tooltip_padding )\n });\n var _height = _selector.outerHeight() + 2* _options.tooltip_padding,\n _isLeft = (_coords.x < paper.view.center.x ? 1 : -1),\n _left = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length ),\n _right = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length + _options.tooltip_width ),\n _top = _coords.y - _height / 2;\n if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) {\n _top = Math.max( paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2 ) - _height;\n }\n if (_top < _options.tooltip_margin) {\n _top = Math.min( _options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2 );\n }\n var _bottom = _top + _height;\n /* jshint laxbreak:true */\n _path.segments[0].point\n = _path.segments[7].point\n = _coords.add([_isLeft * _xmargin, 0]);\n _path.segments[1].point.x\n = _path.segments[2].point.x\n = _path.segments[5].point.x\n = _path.segments[6].point.x\n = _left;\n _path.segments[3].point.x\n = _path.segments[4].point.x\n = _right;\n _path.segments[2].point.y\n = _path.segments[3].point.y\n = _top;\n _path.segments[4].point.y\n = _path.segments[5].point.y\n = _bottom;\n _path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2;\n _path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2;\n _path.closed = true;\n _path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0,_top], [0, _bottom]);\n _selector.css({\n left: (_options.tooltip_padding + Math.min(_left, _right)),\n top: (_options.tooltip_padding + _top)\n });\n return _path;\n }\n};\n})(window);\n\n/* END main.js */\n","(function() {\n \"use strict\";\n var root = this;\n\n var Backbone = root.Backbone;\n\n var Models = root.Rkns.Models = {};\n\n Models.getUID = function(obj) {\n var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,\n function(c) {\n var r = Math.random() * 16 | 0, v = c === 'x' ? r\n : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n if (typeof obj !== 'undefined') {\n return obj.type + \"-\" + guid;\n }\n else {\n return guid;\n }\n };\n\n var RenkanModel = Backbone.RelationalModel.extend({\n idAttribute : \"_id\",\n constructor : function(options) {\n\n if (typeof options !== \"undefined\") {\n options._id = options._id || options.id || Models.getUID(this);\n options.title = options.title || \"\";\n options.description = options.description || \"\";\n options.uri = options.uri || \"\";\n\n if (typeof this.prepare === \"function\") {\n options = this.prepare(options);\n }\n }\n Backbone.RelationalModel.prototype.constructor.call(this, options);\n },\n validate : function() {\n if (!this.type) {\n return \"object has no type\";\n }\n },\n addReference : function(_options, _propName, _list, _id, _default) {\n var _element = _list.get(_id);\n if (typeof _element === \"undefined\" &&\n typeof _default !== \"undefined\") {\n _options[_propName] = _default;\n }\n else {\n _options[_propName] = _element;\n }\n }\n });\n\n // USER\n var User = Models.User = RenkanModel.extend({\n type : \"user\",\n prepare : function(options) {\n options.color = options.color || \"#666666\";\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n color : this.get(\"color\")\n };\n }\n });\n\n // NODE\n var Node = Models.Node = RenkanModel.extend({\n type : \"node\",\n relations : [ {\n type : Backbone.HasOne,\n key : \"created_by\",\n relatedModel : User\n } ],\n prepare : function(options) {\n var project = options.project;\n this.addReference(options, \"created_by\", project.get(\"users\"),\n options.created_by, project.current_user);\n options.description = options.description || \"\";\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n position : this.get(\"position\"),\n image : this.get(\"image\"),\n color : this.get(\"color\"),\n created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n .get(\"_id\") : null,\n size : this.get(\"size\"),\n clip_path : this.get(\"clip_path\"),\n shape : this.get(\"shape\")\n };\n }\n });\n\n // EDGE\n var Edge = Models.Edge = RenkanModel.extend({\n type : \"edge\",\n relations : [ {\n type : Backbone.HasOne,\n key : \"created_by\",\n relatedModel : User\n }, {\n type : Backbone.HasOne,\n key : \"from\",\n relatedModel : Node\n }, {\n type : Backbone.HasOne,\n key : \"to\",\n relatedModel : Node\n } ],\n prepare : function(options) {\n var project = options.project;\n this.addReference(options, \"created_by\", project.get(\"users\"),\n options.created_by, project.current_user);\n this.addReference(options, \"from\", project.get(\"nodes\"),\n options.from);\n this.addReference(options, \"to\", project.get(\"nodes\"), options.to);\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n from : this.get(\"from\") ? this.get(\"from\").get(\"_id\") : null,\n to : this.get(\"to\") ? this.get(\"to\").get(\"_id\") : null,\n color : this.get(\"color\"),\n created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n .get(\"_id\") : null\n };\n }\n });\n\n // View\n var View = Models.View = RenkanModel.extend({\n type : \"view\",\n relations : [ {\n type : Backbone.HasOne,\n key : \"created_by\",\n relatedModel : User\n } ],\n prepare : function(options) {\n var project = options.project;\n this.addReference(options, \"created_by\", project.get(\"users\"),\n options.created_by, project.current_user);\n options.description = options.description || \"\";\n if (typeof options.offset !== \"undefined\") {\n var offset = {};\n if (Array.isArray(options.offset)) {\n offset.x = options.offset[0];\n offset.y = options.offset.length > 1 ? options.offset[1]\n : options.offset[0];\n }\n else if (options.offset.x != null) {\n offset.x = options.offset.x;\n offset.y = options.offset.y;\n }\n options.offset = offset;\n }\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n zoom_level : this.get(\"zoom_level\"),\n offset : this.get(\"offset\"),\n title : this.get(\"title\"),\n description : this.get(\"description\"),\n created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n .get(\"_id\") : null\n // Don't need project id\n };\n }\n });\n\n // PROJECT\n var Project = Models.Project = RenkanModel.extend({\n type : \"project\",\n blacklist : [ 'save_status', ],\n relations : [ {\n type : Backbone.HasMany,\n key : \"users\",\n relatedModel : User,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n }, {\n type : Backbone.HasMany,\n key : \"nodes\",\n relatedModel : Node,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n }, {\n type : Backbone.HasMany,\n key : \"edges\",\n relatedModel : Edge,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n }, {\n type : Backbone.HasMany,\n key : \"views\",\n relatedModel : View,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n } ],\n addUser : function(_props, _options) {\n _props.project = this;\n var _user = User.findOrCreate(_props);\n this.get(\"users\").push(_user, _options);\n return _user;\n },\n addNode : function(_props, _options) {\n _props.project = this;\n var _node = Node.findOrCreate(_props);\n this.get(\"nodes\").push(_node, _options);\n return _node;\n },\n addEdge : function(_props, _options) {\n _props.project = this;\n var _edge = Edge.findOrCreate(_props);\n this.get(\"edges\").push(_edge, _options);\n return _edge;\n },\n addView : function(_props, _options) {\n _props.project = this;\n // TODO: check if need to replace with create only\n var _view = View.findOrCreate(_props);\n // TODO: Should we remember only one view?\n this.get(\"views\").push(_view, _options);\n return _view;\n },\n removeNode : function(_model) {\n this.get(\"nodes\").remove(_model);\n },\n removeEdge : function(_model) {\n this.get(\"edges\").remove(_model);\n },\n validate : function(options) {\n var _project = this;\n _(\n [].concat(options.users, options.nodes, options.edges,\n options.views)).each(function(_item) {\n if (_item) {\n _item.project = _project;\n }\n });\n },\n // Add event handler to remove edges when a node is removed\n initialize : function() {\n var _this = this;\n this.on(\"remove:nodes\", function(_node) {\n _this.get(\"edges\").remove(\n _this.get(\"edges\").filter(\n function(_edge) {\n return _edge.get(\"from\") === _node ||\n _edge.get(\"to\") === _node;\n }));\n });\n },\n toJSON : function() {\n var json = _.clone(this.attributes);\n for ( var attr in json) {\n if ((json[attr] instanceof Backbone.Model) ||\n (json[attr] instanceof Backbone.Collection) ||\n (json[attr] instanceof RenkanModel)) {\n json[attr] = json[attr].toJSON();\n }\n }\n return _.omit(json, this.blacklist);\n }\n });\n\n var RosterUser = Models.RosterUser = Backbone.Model\n .extend({\n type : \"roster_user\",\n idAttribute : \"_id\",\n\n constructor : function(options) {\n\n if (typeof options !== \"undefined\") {\n options._id = options._id ||\n options.id ||\n Models.getUID(this);\n options.title = options.title || \"(untitled \" + this.type + \")\";\n options.description = options.description || \"\";\n options.uri = options.uri || \"\";\n options.project = options.project || null;\n options.site_id = options.site_id || 0;\n\n if (typeof this.prepare === \"function\") {\n options = this.prepare(options);\n }\n }\n Backbone.Model.prototype.constructor.call(this, options);\n },\n\n validate : function() {\n if (!this.type) {\n return \"object has no type\";\n }\n },\n\n prepare : function(options) {\n options.color = options.color || \"#666666\";\n return options;\n },\n\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n color : this.get(\"color\"),\n project : (this.get(\"project\") != null) ? this.get(\n \"project\").get(\"id\") : null,\n site_id : this.get(\"site_id\")\n };\n }\n });\n\n var UsersList = Models.UsersList = Backbone.Collection.extend({\n model : RosterUser\n });\n\n}).call(window);\n","Rkns.defaults = {\n\n language: (navigator.language || navigator.userLanguage || \"en\"),\n /* GUI Language */\n container: \"renkan\",\n /* GUI Container DOM element ID */\n search: [],\n /* List of Search Engines */\n bins: [],\n /* List of Bins */\n static_url: \"\",\n /* URL for static resources */\n show_bins: true,\n /* Show bins in left column */\n properties: [],\n /* Semantic properties for edges */\n show_editor: true,\n /* Show the graph editor... Setting this to \"false\" only shows the bins part ! */\n read_only: false,\n /* Allows editing of renkan without changing the rest of the GUI. Can be switched on/off on the fly to block/enable editing */\n editor_mode: true,\n /* Switch for Publish/Edit GUI. If editor_mode is false, read_only will be true. */\n manual_save: false,\n /* In snapshot mode, clicking on the floppy will save a snapshot. Otherwise, it will show the connection status */\n show_top_bar: true,\n /* Show the top bar, (title, buttons, users) */\n default_user_color: \"#303030\",\n size_bug_fix: true,\n /* Resize the canvas after load (fixes a bug on iPad and FF Mac) */\n force_resize: false,\n allow_double_click: true,\n /* Allows Double Click to create a node on an empty background */\n zoom_on_scroll: true,\n /* Allows to use the scrollwheel to zoom */\n element_delete_delay: 0,\n /* Delay between clicking on the bin on an element and really deleting it\n Set to 0 for delete confirm */\n autoscale_padding: 50,\n resize: true,\n \n /* zoom options */\n show_zoom: true,\n /* show zoom buttons */\n save_view: true,\n /* show buttons to save view */\n default_view: false,\n /* Allows to load default view (zoom+offset) at start on read_only mode, instead of autoScale. the default_view will be the last */\n \n \n /* TOP BAR BUTTONS */\n show_search_field: true,\n show_user_list: true,\n user_name_editable: true,\n user_color_editable: true,\n show_user_color: true,\n show_save_button: true,\n show_export_button: true,\n show_open_button: false,\n show_addnode_button: true,\n show_addedge_button: true,\n show_bookmarklet: true,\n show_fullscreen_button: true,\n home_button_url: false,\n home_button_title: \"Home\",\n\n /* MINI-MAP OPTIONS */\n\n show_minimap: true,\n /* Show a small map at the bottom right */\n minimap_width: 160,\n minimap_height: 120,\n minimap_padding: 20,\n minimap_background_color: \"#ffffff\",\n minimap_border_color: \"#cccccc\",\n minimap_highlight_color: \"#ffff00\",\n minimap_highlight_weight: 5,\n \n\n /* EDGE/NODE COMMON OPTIONS */\n\n buttons_background: \"#202020\",\n buttons_label_color: \"#c000c0\",\n buttons_label_font_size: 9,\n\n /* NODE DISPLAY OPTIONS */\n\n show_node_circles: true,\n /* Show circles for nodes */\n clip_node_images: true,\n /* Constraint node images to circles */\n node_images_fill_mode: false,\n /* Set to false for \"letterboxing\" (height/width of node adapted to show full image)\n Set to true for \"crop\" (adapted to fill circle) */\n node_size_base: 25,\n node_stroke_width: 2,\n selected_node_stroke_width: 4,\n node_fill_color: \"#ffffff\",\n highlighted_node_fill_color: \"#ffff00\",\n node_label_distance: 5,\n /* Vertical distance between node and label */\n node_label_max_length: 60,\n /* Maximum displayed text length */\n label_untitled_nodes: \"(untitled)\",\n /* Label to display on untitled nodes */\n change_shapes: true,\n /* Change shapes enabled */\n\n /* EDGE DISPLAY OPTIONS */\n\n edge_stroke_width: 2,\n selected_edge_stroke_width: 4,\n edge_label_distance: 0,\n edge_label_max_length: 20,\n edge_arrow_length: 18,\n edge_arrow_width: 12,\n edge_gap_in_bundles: 12,\n label_untitled_edges: \"\",\n\n /* CONTEXTUAL DISPLAY (TOOLTIP OR EDITOR) OPTIONS */\n\n tooltip_width: 275,\n tooltip_padding: 10,\n tooltip_margin: 15,\n tooltip_arrow_length : 20,\n tooltip_arrow_width : 40,\n tooltip_top_color: \"#f0f0f0\",\n tooltip_bottom_color: \"#d0d0d0\",\n tooltip_border_color: \"#808080\",\n tooltip_border_width: 1,\n\n /* NODE EDITOR OPTIONS */\n\n show_node_editor_uri: true,\n show_node_editor_description: true,\n show_node_editor_size: true,\n show_node_editor_color: true,\n show_node_editor_image: true,\n show_node_editor_creator: true,\n allow_image_upload: true,\n uploaded_image_max_kb: 500,\n\n /* NODE TOOLTIP OPTIONS */\n\n show_node_tooltip_uri: true,\n show_node_tooltip_description: true,\n show_node_tooltip_color: true,\n show_node_tooltip_image: true,\n show_node_tooltip_creator: true,\n\n /* EDGE EDITOR OPTIONS */\n\n show_edge_editor_uri: true,\n show_edge_editor_color: true,\n show_edge_editor_direction: true,\n show_edge_editor_nodes: true,\n show_edge_editor_creator: true,\n\n /* EDGE TOOLTIP OPTIONS */\n\n show_edge_tooltip_uri: true,\n show_edge_tooltip_color: true,\n show_edge_tooltip_nodes: true,\n show_edge_tooltip_creator: true\n\n /* */\n\n};\n","Rkns.i18n = {\n fr: {\n \"Edit Node\": \"Édition d’un nœud\",\n \"Edit Edge\": \"Édition d’un lien\",\n \"Title:\": \"Titre :\",\n \"URI:\": \"URI :\",\n \"Description:\": \"Description :\",\n \"From:\": \"De :\",\n \"To:\": \"Vers :\",\n \"Image\": \"Image\",\n \"Image URL:\": \"URL d'Image\",\n \"Choose Image File:\": \"Choisir un fichier image\",\n \"Full Screen\": \"Mode plein écran\",\n \"Add Node\": \"Ajouter un nœud\",\n \"Add Edge\": \"Ajouter un lien\",\n \"Save Project\": \"Enregistrer le projet\",\n \"Open Project\": \"Ouvrir un projet\",\n \"Auto-save enabled\": \"Enregistrement automatique activé\",\n \"Connection lost\": \"Connexion perdue\",\n \"Created by:\": \"Créé par :\",\n \"Zoom In\": \"Agrandir l’échelle\",\n \"Zoom Out\": \"Rapetisser l’échelle\",\n \"Edit\": \"Éditer\",\n \"Remove\": \"Supprimer\",\n \"Cancel deletion\": \"Annuler la suppression\",\n \"Link to another node\": \"Créer un lien\",\n \"Enlarge\": \"Agrandir\",\n \"Shrink\": \"Rétrécir\",\n \"Click on the background canvas to add a node\": \"Cliquer sur le fond du graphe pour rajouter un nœud\",\n \"Click on a first node to start the edge\": \"Cliquer sur un premier nœud pour commencer le lien\",\n \"Click on a second node to complete the edge\": \"Cliquer sur un second nœud pour terminer le lien\",\n \"Wikipedia\": \"Wikipédia\",\n \"Wikipedia in \": \"Wikipédia en \",\n \"French\": \"Français\",\n \"English\": \"Anglais\",\n \"Japanese\": \"Japonais\",\n \"Untitled project\": \"Projet sans titre\",\n \"Lignes de Temps\": \"Lignes de Temps\",\n \"Loading, please wait\": \"Chargement en cours, merci de patienter\",\n \"Edge color:\": \"Couleur :\",\n \"Node color:\": \"Couleur :\",\n \"Choose color\": \"Choisir une couleur\",\n \"Change edge direction\": \"Changer le sens du lien\",\n \"Do you really wish to remove node \": \"Voulez-vous réellement supprimer le nœud \",\n \"Do you really wish to remove edge \": \"Voulez-vous réellement supprimer le lien \",\n \"This file is not an image\": \"Ce fichier n'est pas une image\",\n \"Image size must be under \": \"L'image doit peser moins de \",\n \"Size:\": \"Taille :\",\n \"KB\": \"ko\",\n \"Choose from vocabulary:\": \"Choisir dans un vocabulaire :\",\n \"SKOS Documentation properties\": \"SKOS: Propriétés documentaires\",\n \"has note\": \"a pour note\",\n \"has example\": \"a pour exemple\",\n \"has definition\": \"a pour définition\",\n \"SKOS Semantic relations\": \"SKOS: Relations sémantiques\",\n \"has broader\": \"a pour concept plus large\",\n \"has narrower\": \"a pour concept plus étroit\",\n \"has related\": \"a pour concept apparenté\",\n \"Dublin Core Metadata\": \"Métadonnées Dublin Core\",\n \"has contributor\": \"a pour contributeur\",\n \"covers\": \"couvre\",\n \"created by\": \"créé par\",\n \"has date\": \"a pour date\",\n \"published by\": \"édité par\",\n \"has source\": \"a pour source\",\n \"has subject\": \"a pour sujet\",\n \"Dragged resource\": \"Ressource glisée-déposée\",\n \"Search the Web\": \"Rechercher en ligne\",\n \"Search in Bins\": \"Rechercher dans les chutiers\",\n \"Close bin\": \"Fermer le chutier\",\n \"Refresh bin\": \"Rafraîchir le chutier\",\n \"(untitled)\": \"(sans titre)\",\n \"Select contents:\": \"Sélectionner des contenus :\",\n \"Drag items from this website, drop them in Renkan\": \"Glissez des éléments de ce site web vers Renkan\",\n \"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\": \"Glissez ce bouton vers votre barre de favoris. Ensuite, depuis un site tiers, cliquez dessus pour activer 'Drag-to-Add' puis glissez des éléments de ce site vers Renkan\",\n \"Shapes available\": \"Formes disponibles\",\n \"Circle\": \"Cercle\",\n \"Square\": \"Carré\",\n \"Diamond\": \"Losange\",\n \"Hexagone\": \"Hexagone\",\n \"Ellipse\": \"Ellipse\",\n \"Star\": \"Étoile\",\n \"Zoom Fit\": \"Ajuster le Zoom\",\n \"Download Project\": \"Télécharger le projet\",\n \"Zoom Save\": \"Sauver le Zoom\",\n \"View saved zoom\": \"Restaurer le Zoom\",\n \"Renkan \\'Drag-to-Add\\' bookmarklet\": \"Renkan \\'Deplacer-Pour-Ajouter\\' Signet\",\n \"(unknown user)\":\"(non authentifié)\",\n \"<unknown user>\":\"<non authentifié>\",\n \"Search in graph\":\"Rechercher dans carte\",\n \"Search in \" : \"Chercher dans \"\n }\n};\n","/* Saves the Full JSON at each modification */\n\nRkns.jsonIO = function(_renkan, _opts) {\n var _proj = _renkan.project;\n if (typeof _opts.http_method === \"undefined\") {\n _opts.http_method = 'PUT';\n }\n var _load = function() {\n _renkan.renderer.redrawActive = false;\n _proj.set({\n loading_status : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _proj.set(_data, {\n validate : true\n });\n _proj.set({\n loading_status : false\n });\n _proj.set({\n save_status : 0\n });\n _renkan.renderer.redrawActive = true;\n _renkan.renderer.fixSize();\n });\n };\n var _save = function() {\n _proj.set({\n save_status : 2\n });\n var _data = _proj.toJSON();\n if (!_renkan.read_only) {\n Rkns.$.ajax({\n type : _opts.http_method,\n url : _opts.url,\n contentType : \"application/json\",\n data : JSON.stringify(_data),\n success : function(data, textStatus, jqXHR) {\n _proj.set({\n save_status : 0\n });\n }\n });\n }\n\n };\n var _thrSave = Rkns._.throttle(function() {\n setTimeout(_save, 100);\n }, 1000);\n _proj.on(\"add:nodes add:edges add:users add:views\", function(_model) {\n _model.on(\"change remove\", function(_model) {\n _thrSave();\n });\n _thrSave();\n });\n _proj.on(\"change\", function() {\n if (!(_proj.changedAttributes.length === 1 && _proj\n .hasChanged('save_status'))) {\n _thrSave();\n }\n });\n\n _load();\n};\n","/* Saves the Full JSON once */\n\nRkns.jsonIOSaveOnClick = function(_renkan, _opts) {\n var _proj = _renkan.project,\n _saveWarn = false,\n _onLeave = function() {\n return \"Project not saved\";\n };\n if (typeof _opts.http_method === \"undefined\") {\n _opts.http_method = 'POST';\n }\n var _load = function() {\n var getdata = {},\n rx = /id=([^&#?=]+)/,\n matches = document.location.hash.match(rx);\n if (matches) {\n getdata.id = matches[1];\n }\n Rkns.$.ajax({\n url: _opts.url,\n data: getdata,\n beforeSend: function(){\n \t_proj.set({loading_status:true});\n },\n success: function(_data) {\n _proj.set(_data, {validate: true});\n \t_proj.set({loading_status:false});\n _proj.set({save_status:0});\n \t_renkan.renderer.autoScale();\n }\n });\n };\n var _save = function() {\n _proj.set(\"saved_at\", new Date());\n var _data = _proj.toJSON();\n Rkns.$.ajax({\n type: _opts.http_method,\n url: _opts.url,\n contentType: \"application/json\",\n data: JSON.stringify(_data),\n beforeSend: function(){\n \t_proj.set({save_status:2});\n },\n success: function(data, textStatus, jqXHR) {\n $(window).off(\"beforeunload\", _onLeave);\n _saveWarn = false;\n _proj.set({save_status:0});\n //document.location.hash = \"#id=\" + data.id;\n //$(\".Rk-Notifications\").text(\"Saved as \"+document.location.href).fadeIn().delay(2000).fadeOut();\n }\n });\n };\n var _checkLeave = function() {\n \t_proj.set({save_status:1});\n \t\n var title = _proj.get(\"title\");\n if (title && _proj.get(\"nodes\").length) {\n $(\".Rk-Save-Button\").removeClass(\"disabled\");\n } else {\n $(\".Rk-Save-Button\").addClass(\"disabled\");\n }\n if (title) {\n $(\".Rk-PadTitle\").css(\"border-color\",\"#333333\");\n }\n if (!_saveWarn) {\n _saveWarn = true;\n $(window).on(\"beforeunload\", _onLeave);\n }\n };\n _load();\n _proj.on(\"add:nodes add:edges add:users change\", function(_model) {\n\t _model.on(\"change remove\", function(_model) {\n\t \tif(!(_model.changedAttributes.length === 1 && _model.hasChanged('save_status'))) {\n\t \t\t_checkLeave();\n\t \t}\n\t });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('save_status'))) {\n\t\t _checkLeave();\n \t}\n });\n _renkan.renderer.save = function() {\n if ($(\".Rk-Save-Button\").hasClass(\"disabled\")) {\n if (!_proj.get(\"title\")) {\n $(\".Rk-PadTitle\").css(\"border-color\",\"#ff0000\");\n }\n } else {\n _save();\n }\n };\n};\n","(function(Rkns) {\n\"use strict\";\n\nvar _ = Rkns._;\n\nvar Ldt = Rkns.Ldt = {};\n\nvar Bin = Ldt.Bin = function(_renkan, _opts) {\n if (_opts.ldt_type) {\n var Resclass = Ldt[_opts.ldt_type+\"Bin\"];\n if (Resclass) {\n return new Resclass(_renkan, _opts);\n }\n }\n console.error(\"No such LDT Bin Type\");\n};\n\nvar ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nProjectBin.prototype.tagTemplate = _.template(\n '<li class=\"Rk-Bin-Item\" draggable=\"true\" data-image=\"<%- Rkns.Utils.getFullURL(static_url+\\'img/ldt-tag.png\\') %>\" data-uri=\"<%=ldt_platform%>ldtplatform/ldt/front/search/?search=<%=encodedtitle%>&field=all\" data-title=\"<%-title%>\" data-description=\"Tag \\'<%-title%>\\'\">' +\n '<img class=\"Rk-Ldt-Tag-Icon\" src=\"<%-static_url%>img/ldt-tag.png\" /><h4><%=htitle%></h4><div class=\"Rk-Clear\"></div></li>'\n);\n\nProjectBin.prototype.annotationTemplate = _.template(\n '<li class=\"Rk-Bin-Item\" draggable=\"true\" data-image=\"<%- Rkns.Utils.getFullURL(image) %>\" data-uri=\"<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>\" data-title=\"<%-title%>\" data-description=\"<%-description%>\">' +\n '<img class=\"Rk-Ldt-Annotation-Icon\" src=\"<%=image%>\"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class=\"Rk-Clear\"></div></li>'\n);\n\nProjectBin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.proj_id = _opts.project_id;\n this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n this.title_$.html(_opts.title);\n this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n this.refresh();\n};\n\nProjectBin.prototype.render = function(searchbase) {\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n function highlight(_text) {\n var _e = _(_text).escape();\n return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n }\n function convertTC(_ms) {\n function pad(_n) {\n var _res = _n.toString();\n while (_res.length < 2) {\n _res = '0' + _res;\n }\n return _res;\n }\n var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n _hours = Math.floor(_totalSeconds / 3600),\n _minutes = (Math.floor(_totalSeconds / 60) % 60),\n _seconds = _totalSeconds % 60,\n _res = '';\n if (_hours) {\n _res += pad(_hours) + ':';\n }\n _res += pad(_minutes) + ':' + pad(_seconds);\n return _res;\n }\n\n var _html = '<li><h3>Tags</h3></li>',\n _projtitle = this.data.meta[\"dc:title\"],\n _this = this,\n count = 0;\n _this.title_$.text('LDT Project: \"' + _projtitle + '\"');\n _(_this.data.tags).map(function(_tag) {\n var _title = _tag.meta[\"dc:title\"];\n if (!search.isempty && !search.test(_title)) {\n return;\n }\n count++;\n _html += _this.tagTemplate({\n ldt_platform: _this.ldt_platform,\n title: _title,\n htitle: highlight(_title),\n encodedtitle : encodeURIComponent(_title),\n static_url: _this.renkan.options.static_url\n });\n });\n _html += '<li><h3>Annotations</h3></li>';\n _(_this.data.annotations).map(function(_annotation) {\n var _description = _annotation.content.description,\n _title = _annotation.content.title.replace(_description,\"\");\n if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n return;\n }\n count++;\n var _duration = _annotation.end - _annotation.begin,\n _img = (\n (_annotation.content && _annotation.content.img && _annotation.content.img.src) ?\n _annotation.content.img.src :\n ( _duration ? _this.renkan.options.static_url+\"img/ldt-segment.png\" : _this.renkan.options.static_url+\"img/ldt-point.png\" )\n );\n _html += _this.annotationTemplate({\n ldt_platform: _this.ldt_platform,\n title: _title,\n htitle: highlight(_title),\n description: _description,\n hdescription: highlight(_description),\n start: convertTC(_annotation.begin),\n end: convertTC(_annotation.end),\n duration: convertTC(_duration),\n mediaid: _annotation.media,\n annotationid: _annotation.id,\n image: _img,\n static_url: _this.renkan.options.static_url\n });\n });\n\n this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nProjectBin.prototype.refresh = function() {\n var _this = this;\n Rkns.$.ajax({\n url: this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id,\n dataType: \"jsonp\",\n success: function(_data) {\n _this.data = _data;\n _this.render();\n }\n });\n};\n\nvar Search = Ldt.Search = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.lang = _opts.lang || \"en\";\n};\n\nSearch.prototype.getBgClass = function() {\n return \"Rk-Ldt-Icon\";\n};\n\nSearch.prototype.getSearchTitle = function() {\n return this.renkan.translate(\"Lignes de Temps\");\n};\n\nSearch.prototype.search = function(_q) {\n this.renkan.tabs.push(\n new ResultsBin(this.renkan, {\n search: _q\n })\n );\n};\n\nvar ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nResultsBin.prototype.segmentTemplate = _.template(\n '<li class=\"Rk-Bin-Item\" draggable=\"true\" data-image=\"<%- Rkns.Utils.getFullURL(image) %>\" data-uri=\"<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>\" data-title=\"<%-title%>\" data-description=\"<%-description%>\">' +\n '<img class=\"Rk-Ldt-Annotation-Icon\" src=\"<%=image%>\"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class=\"Rk-Clear\"></div></li>'\n);\n\nResultsBin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n this.max_results = _opts.max_results || 50;\n this.search = _opts.search;\n this.title_$.html('Lignes de Temps: \"' + _opts.search + '\"');\n this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n this.refresh();\n};\n\nResultsBin.prototype.render = function(searchbase) {\n if (!this.data) {\n return;\n }\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n function highlight(_text) {\n return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n }\n function convertTC(_ms) {\n function pad(_n) {\n var _res = _n.toString();\n while (_res.length < 2) {\n _res = '0' + _res;\n }\n return _res;\n }\n var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n _hours = Math.floor(_totalSeconds / 3600),\n _minutes = (Math.floor(_totalSeconds / 60) % 60),\n _seconds = _totalSeconds % 60,\n _res = '';\n if (_hours) {\n _res += pad(_hours) + ':';\n }\n _res += pad(_minutes) + ':' + pad(_seconds);\n return _res;\n }\n\n var _html = '',\n _this = this,\n count = 0;\n _(this.data.objects).each(function(_segment) {\n var _description = _segment.abstract,\n _title = _segment.title;\n if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n return;\n }\n count++;\n var _duration = _segment.duration,\n _begin = _segment.start_ts,\n _end = + _segment.duration + _begin,\n _img = (\n _duration ?\n _this.renkan.options.static_url + \"img/ldt-segment.png\" :\n _this.renkan.options.static_url + \"img/ldt-point.png\"\n );\n _html += _this.segmentTemplate({\n ldt_platform: _this.ldt_platform,\n title: _title,\n htitle: highlight(_title),\n description: _description,\n hdescription: highlight(_description),\n start: convertTC(_begin),\n end: convertTC(_end),\n duration: convertTC(_duration),\n mediaid: _segment.iri_id,\n //projectid: _segment.project_id,\n //cuttingid: _segment.cutting_id,\n annotationid: _segment.element_id,\n image: _img\n });\n });\n\n this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nResultsBin.prototype.refresh = function() {\n var _this = this;\n Rkns.$.ajax({\n url: this.ldt_platform + 'ldtplatform/api/ldt/1.0/segments/search/',\n data: {\n format: \"jsonp\",\n q: this.search,\n limit: this.max_results\n },\n dataType: \"jsonp\",\n success: function(_data) {\n _this.data = _data;\n _this.render();\n }\n });\n};\n\n})(window.Rkns);\n","Rkns.ResourceList = {};\n\nRkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.ResourceList.Bin.prototype.resultTemplate = Rkns._.template(\n '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\" data-uri=\"<%-url%>\" ' +\n 'data-title=\"<%-title%>\" data-description=\"<%-description%>\" ' +\n '<% if (image) { %>data-image=\"<%- Rkns.Utils.getFullURL(image) %>\"<% } else { %>data-image=\"\"<% } %> >' +\n '<% if (image) { %><img class=\"Rk-ResourceList-Image\" src=\"<%-image%>\"/><% } %><h4 class=\"Rk-ResourceList-Title\">' +\n '<% if (url) { %><a href=\"<%-url%>\" target=\"_blank\"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>' +\n '<% if (description) { %><p class=\"Rk-ResourceList-Description\"><%=hdescription%></p><% } %><% if (image) { %><div style=\"clear: both;\"></div><% } %></li>'\n);\n\nRkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.title_$.html(_opts.title);\n if (_opts.list) {\n this.data = _opts.list;\n }\n this.refresh();\n};\n\nRkns.ResourceList.Bin.prototype.render = function(searchbase) {\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n function highlight(_text) {\n var _e = _(_text).escape();\n return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n }\n var _html = \"\",\n _this = this,\n count = 0;\n Rkns._(this.data).each(function(_item) {\n var _element;\n if (typeof _item === \"string\") {\n if (/^(https?:\\/\\/|www)/.test(_item)) {\n _element = { url: _item };\n } else {\n _element = { title: _item.replace(/[:,]?\\s?(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+\\s?/,'').trim() };\n var _match = _item.match(/(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+/);\n if (_match) {\n _element.url = _match[0];\n }\n if (_element.title.length > 80) {\n _element.description = _element.title;\n _element.title = _element.title.replace(/^(.{30,60})\\s.+$/,'$1…');\n }\n }\n } else {\n _element = _item;\n }\n var title = _element.title || (_element.url || \"\").replace(/^https?:\\/\\/(www\\.)?/,'').replace(/^(.{40}).+$/,'$1…'),\n url = _element.url || \"\",\n description = _element.description || \"\",\n image = _element.image || \"\";\n if (url && !/^https?:\\/\\//.test(url)) {\n url = 'http://' + url;\n }\n if (!search.isempty && !search.test(title) && !search.test(description)) {\n return;\n }\n count++;\n _html += _this.resultTemplate({\n url: url,\n title: title,\n htitle: highlight(title),\n image: image,\n description: description,\n hdescription: highlight(description),\n static_url: _this.renkan.options.static_url\n });\n });\n _this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nRkns.ResourceList.Bin.prototype.refresh = function() {\n if (this.data) {\n this.render();\n }\n};\n","Rkns.Wikipedia = {\n};\n\nRkns.Wikipedia.Search = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.lang = _opts.lang || \"en\";\n};\n\nRkns.Wikipedia.Search.prototype.getBgClass = function() {\n return \"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-\" + this.lang;\n};\n\nRkns.Wikipedia.Search.prototype.getSearchTitle = function() {\n var langs = {\n \"fr\": \"French\",\n \"en\": \"English\",\n \"ja\": \"Japanese\"\n };\n if (langs[this.lang]) {\n return this.renkan.translate(\"Wikipedia in \") + this.renkan.translate(langs[this.lang]);\n } else {\n return this.renkan.translate(\"Wikipedia\") + \" [\" + this.lang + \"]\";\n }\n};\n\nRkns.Wikipedia.Search.prototype.search = function(_q) {\n this.renkan.tabs.push(\n new Rkns.Wikipedia.Bin(this.renkan, {\n lang: this.lang,\n search: _q\n })\n );\n};\n\nRkns.Wikipedia.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.Wikipedia.Bin.prototype.resultTemplate = Rkns._.template(\n '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\" data-uri=\"<%-url%>\" ' +\n 'data-title=\"Wikipedia: <%-title%>\" data-description=\"<%-description%>\" data-image=\"<%- Rkns.Utils.getFullURL( static_url + \\'img/wikipedia.png\\' ) %>\">' +\n '<img class=\"Rk-Wikipedia-Icon\" src=\"<%-static_url%>img/wikipedia.png\"></div><h4 class=\"Rk-Wikipedia-Title\"><a href=\"<%-url%>\" target=\"_blank\"><%=htitle%></a></h4>' +\n '<p class=\"Rk-Wikipedia-Snippet\"><%=hdescription%></p></li>'\n);\n\nRkns.Wikipedia.Bin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.search = _opts.search;\n this.lang = _opts.lang || \"en\";\n this.title_icon_$.addClass('Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-' + this.lang);\n this.title_$.html(this.search).addClass(\"Rk-Wikipedia-Title\");\n this.refresh();\n};\n\nRkns.Wikipedia.Bin.prototype.render = function(searchbase) {\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n function highlight(_text) {\n return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n }\n var _html = \"\",\n _this = this,\n count = 0;\n Rkns._(this.data.query.search).each(function(_result) {\n var title = _result.title,\n url = \"http://\" + _this.lang + \".wikipedia.org/wiki/\" + encodeURI(title.replace(/ /g,\"_\")),\n description = Rkns.$('<div>').html(_result.snippet).text();\n if (!search.isempty && !search.test(title) && !search.test(description)) {\n return;\n }\n count++;\n _html += _this.resultTemplate({\n url: url,\n title: title,\n htitle: highlight(title),\n description: description,\n hdescription: highlight(description),\n static_url: _this.renkan.options.static_url\n });\n });\n _this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nRkns.Wikipedia.Bin.prototype.refresh = function() {\n var _this = this;\n Rkns.$.ajax({\n url: \"http://\" + _this.lang + \".wikipedia.org/w/api.php?action=query&list=search&srsearch=\" + encodeURIComponent(this.search) + \"&format=json\",\n dataType: \"jsonp\",\n success: function(_data) {\n _this.data = _data;\n _this.render();\n }\n });\n};\n","\ndefine('renderer/baserepresentation',['jquery', 'underscore'], function ($, _) {\n \n\n /* Rkns.Renderer._BaseRepresentation Class */\n\n /* In Renkan, a \"Representation\" is a sort of ViewModel (in the MVVM paradigm) and bridges the gap between\n * models (written with Backbone.js) and the view (written with Paper.js)\n * Renkan's representations all inherit from Rkns.Renderer._BaseRepresentation '*/\n\n var _BaseRepresentation = function(_renderer, _model) {\n if (typeof _renderer !== \"undefined\") {\n this.renderer = _renderer;\n this.renkan = _renderer.renkan;\n this.project = _renderer.renkan.project;\n this.options = _renderer.renkan.options;\n this.model = _model;\n if (this.model) {\n var _this = this;\n this._changeBinding = function() {\n _this.redraw();\n };\n this._removeBinding = function() {\n _renderer.removeRepresentation(_this);\n _(function() {\n _renderer.redraw();\n }).defer();\n };\n this._selectBinding = function() {\n _this.select();\n };\n this._unselectBinding = function() {\n _this.unselect();\n };\n this.model.on(\"change\", this._changeBinding );\n this.model.on(\"remove\", this._removeBinding );\n this.model.on(\"select\", this._selectBinding );\n this.model.on(\"unselect\", this._unselectBinding );\n }\n }\n };\n\n /* Rkns.Renderer._BaseRepresentation Methods */\n\n _(_BaseRepresentation.prototype).extend({\n _super: function(_func) {\n return _BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1));\n },\n redraw: function() {},\n moveTo: function() {},\n show: function() { return \"BaseRepresentation.show\"; },\n hide: function() {},\n select: function() {\n if (this.model) {\n this.model.trigger(\"selected\");\n }\n },\n unselect: function() {\n if (this.model) {\n this.model.trigger(\"unselected\");\n }\n },\n highlight: function() {},\n unhighlight: function() {},\n mousedown: function() {},\n mouseup: function() {\n if (this.model) {\n this.model.trigger(\"clicked\");\n }\n },\n destroy: function() {\n if (this.model) {\n this.model.off(\"change\", this._changeBinding );\n this.model.off(\"remove\", this._removeBinding );\n this.model.off(\"select\", this._selectBinding );\n this.model.off(\"unselect\", this._unselectBinding );\n }\n }\n });\n\n /* End of Rkns.Renderer._BaseRepresentation Class */\n\n return _BaseRepresentation;\n\n});\n\ndefine('requtils',[], function ($, _) {\n \n return {\n getUtils: function(){\n return window.Rkns.Utils;\n },\n getRenderer: function(){\n return window.Rkns.Renderer;\n }\n };\n\n});\n\n\ndefine('renderer/basebutton',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer._BaseButton Class */\n\n /* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */\n\n var _BaseButton = Utils.inherit(BaseRepresentation);\n\n _(_BaseButton.prototype).extend({\n moveTo: function(_pos) {\n this.sector.moveTo(_pos);\n },\n show: function() {\n this.sector.show();\n },\n hide: function() {\n this.sector.hide();\n },\n select: function() {\n this.sector.select();\n },\n unselect: function(_newTarget) {\n this.sector.unselect();\n if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) {\n this.source_representation.unselect();\n }\n },\n destroy: function() {\n this.sector.destroy();\n }\n });\n\n return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n \n\n /* ShapeBuilder Begin */\n\n var builders = {\n \"circle\":{\n getShape: function() {\n return new paper.Path.Circle([0, 0], 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Circle(center, radius);\n }\n },\n \"rectangle\":{\n getShape: function() {\n return new paper.Path.Rectangle([-2, -2], [2, 2]);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n }\n },\n \"ellipse\":{\n getShape: function() {\n return new paper.Path.Ellipse(new paper.Rectangle([-2, -1], [2, 1]));\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Ellipse(new paper.Rectangle([-radius, -radius/2], [radius*2, radius]));\n }\n },\n \"polygon\":{\n getShape: function() {\n return new paper.Path.RegularPolygon([0, 0], 6, 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.RegularPolygon([0, 0], 6, radius);\n }\n },\n \"diamond\":{\n getShape: function() {\n var d = new paper.Path.Rectangle([-2, -2], [2, 2]);\n d.rotate(45);\n return d;\n },\n getImageShape: function(center, radius) {\n var d = new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n d.rotate(45);\n return d;\n }\n },\n \"star\":{\n getShape: function() {\n return new paper.Path.Star([0, 0], 8, 1, 0.7);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Star([0, 0], 8, radius*1, radius*0.7);\n }\n },\n \"svg\": function(path){\n return {\n getShape: function() {\n return new paper.Path(path);\n },\n getImageShape: function(center, radius) {\n // No calcul for the moment \n return new paper.Path();\n }\n };\n }\n };\n \n var ShapeBuilder = function (shape){\n if(typeof shape===\"undefined\"){\n shape = \"circle\";\n }\n if(shape.substr(0,4)===\"svg:\"){\n return builders.svg(shape.substr(4));\n }\n if(!(shape in builders)){\n shape = \"circle\";\n }\n return builders[shape];\n };\n \n return ShapeBuilder;\n\n});\n\ndefine('renderer/noderepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation', 'renderer/shapebuilder'], function ($, _, requtils, BaseRepresentation, ShapeBuilder) {\n \n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer.Node Class */\n\n /* The representation for the node : A circle, with an image inside and a text label underneath.\n * The circle and the image are drawn on canvas and managed by Paper.js.\n * The text label is an HTML node, managed by jQuery. */\n\n //var NodeRepr = Renderer.Node = Utils.inherit(Renderer._BaseRepresentation);\n var NodeRepr = Utils.inherit(BaseRepresentation);\n\n _(NodeRepr.prototype).extend({\n _init: function() {\n this.renderer.node_layer.activate();\n this.type = \"Node\";\n this.buildShape();\n if (this.options.show_node_circles) {\n this.circle.strokeWidth = this.options.node_stroke_width;\n this.h_ratio = 1;\n } else {\n this.h_ratio = 0;\n }\n this.title = $('<div class=\"Rk-Label\">').appendTo(this.renderer.labels_$);\n\n if (this.options.editor_mode) {\n var Renderer = requtils.getRenderer();\n this.normal_buttons = [\n new Renderer.NodeEditButton(this.renderer, null),\n new Renderer.NodeRemoveButton(this.renderer, null),\n new Renderer.NodeLinkButton(this.renderer, null),\n new Renderer.NodeEnlargeButton(this.renderer, null),\n new Renderer.NodeShrinkButton(this.renderer, null)\n ];\n this.pending_delete_buttons = [\n new Renderer.NodeRevertButton(this.renderer, null)\n ];\n this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n\n for (var i = 0; i < this.all_buttons.length; i++) {\n this.all_buttons[i].source_representation = this;\n }\n this.active_buttons = [];\n } else {\n this.active_buttons = this.all_buttons = [];\n }\n this.last_circle_radius = 1;\n\n if (this.renderer.minimap) {\n this.renderer.minimap.node_layer.activate();\n this.minimap_circle = new paper.Path.Circle([0, 0], 1);\n this.minimap_circle.__representation = this.renderer.minimap.miniframe.__representation;\n this.renderer.minimap.node_group.addChild(this.minimap_circle);\n }\n },\n buildShape: function(){\n if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n this.model.set(\"shape_changed\", false);\n delete this.img;\n }\n if(this.circle){\n this.circle.remove();\n delete this.circle;\n }\n // \"circle\" \"rectangle\" \"ellipse\" \"polygon\" \"star\" \"diamond\"\n this.shapeBuilder = new ShapeBuilder(this.model.get(\"shape\"));\n this.circle = this.shapeBuilder.getShape();\n this.circle.__representation = this;\n this.last_circle_radius = 1;\n },\n redraw: function(_dontRedrawEdges) {\n if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n this.buildShape();\n }\n var _model_coords = new paper.Point(this.model.get(\"position\")),\n _baseRadius = this.options.node_size_base * Math.exp((this.model.get(\"size\") || 0) * Utils._NODE_SIZE_STEP);\n if (!this.is_dragging || !this.paper_coords) {\n this.paper_coords = this.renderer.toPaperCoords(_model_coords);\n }\n this.circle_radius = _baseRadius * this.renderer.scale;\n if (this.last_circle_radius !== this.circle_radius) {\n this.all_buttons.forEach(function(b) {\n b.setSectorSize();\n });\n this.circle.scale(this.circle_radius / this.last_circle_radius);\n if (this.node_image) {\n this.node_image.scale(this.circle_radius / this.last_circle_radius);\n }\n }\n this.circle.position = this.paper_coords;\n if (this.node_image) {\n this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n }\n this.last_circle_radius = this.circle_radius;\n\n var old_act_btn = this.active_buttons;\n\n var opacity = 1;\n if (this.model.get(\"delete_scheduled\")) {\n opacity = 0.5;\n this.active_buttons = this.pending_delete_buttons;\n this.circle.dashArray = [2,2];\n } else {\n opacity = 1;\n this.active_buttons = this.normal_buttons;\n this.circle.dashArray = null;\n }\n\n if (this.selected && this.renderer.isEditable()) {\n if (old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n }\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n if (this.node_image) {\n this.node_image.opacity = this.highlighted ? opacity * 0.5 : (opacity - 0.01);\n }\n\n this.circle.fillColor = this.highlighted ? this.options.highlighted_node_fill_color : this.options.node_fill_color;\n\n this.circle.opacity = this.options.show_node_circles ? opacity : 0.01;\n\n var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_nodes) || \"\";\n _text = Utils.shortenText(_text, this.options.node_label_max_length);\n\n if (typeof this.highlighted === \"object\") {\n this.title.html(this.highlighted.replace(_(_text).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n } else {\n this.title.text(_text);\n }\n\n this.title.css({\n left: this.paper_coords.x,\n top: this.paper_coords.y + this.circle_radius * this.h_ratio + this.options.node_label_distance,\n opacity: opacity\n });\n var _color = this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n this.circle.strokeColor = _color;\n var _pc = this.paper_coords;\n this.all_buttons.forEach(function(b) {\n b.moveTo(_pc);\n });\n var lastImage = this.img;\n this.img = this.model.get(\"image\");\n if (this.img && this.img !== lastImage) {\n this.showImage();\n }\n if (this.node_image && !this.img) {\n this.node_image.remove();\n delete this.node_image;\n }\n\n if (this.renderer.minimap) {\n this.minimap_circle.fillColor = _color;\n var minipos = this.renderer.toMinimapCoords(_model_coords),\n miniradius = this.renderer.minimap.scale * _baseRadius,\n minisize = new paper.Size([miniradius, miniradius]);\n this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2));\n }\n\n if (!_dontRedrawEdges) {\n var _this = this;\n _.each(\n this.project.get(\"edges\").filter(\n function (ed) {\n return ((ed.get(\"to\") === _this.model) || (ed.get(\"from\") === _this.model));\n }\n ),\n function(edge, index, list) {\n var repr = _this.renderer.getRepresentationByModel(edge);\n if (repr && typeof repr.from_representation !== \"undefined\" && typeof repr.from_representation.paper_coords !== \"undefined\" && typeof repr.to_representation !== \"undefined\" && typeof repr.to_representation.paper_coords !== \"undefined\") {\n repr.redraw();\n }\n }\n );\n }\n\n },\n showImage: function() {\n var _image = null;\n if (typeof this.renderer.image_cache[this.img] === \"undefined\") {\n _image = new Image();\n this.renderer.image_cache[this.img] = _image;\n _image.src = this.img;\n } else {\n _image = this.renderer.image_cache[this.img];\n }\n if (_image.width) {\n if (this.node_image) {\n this.node_image.remove();\n }\n this.renderer.node_layer.activate();\n var width = _image.width,\n height = _image.height,\n clipPath = this.model.get(\"clip_path\"),\n hasClipPath = (typeof clipPath !== \"undefined\" && clipPath),\n _clip = null,\n baseRadius = null,\n centerPoint = null;\n\n if (hasClipPath) {\n _clip = new paper.Path();\n var instructions = clipPath.match(/[a-z][^a-z]+/gi) || [],\n lastCoords = [0,0],\n minX = Infinity,\n minY = Infinity,\n maxX = -Infinity,\n maxY = -Infinity;\n\n var transformCoords = function(tabc, relative) {\n var newCoords = tabc.slice(1).map(function(v, k) {\n var res = parseFloat(v),\n isY = k % 2;\n if (isY) {\n res = ( res - 0.5 ) * height;\n } else {\n res = ( res - 0.5 ) * width;\n }\n if (relative) {\n res += lastCoords[isY];\n }\n if (isY) {\n minY = Math.min(minY, res);\n maxY = Math.max(maxY, res);\n } else {\n minX = Math.min(minX, res);\n maxX = Math.max(maxX, res);\n }\n return res;\n });\n lastCoords = newCoords.slice(-2);\n return newCoords;\n };\n\n instructions.forEach(function(instr) {\n var coords = instr.match(/([a-z]|[0-9.-]+)/ig) || [\"\"];\n switch(coords[0]) {\n case \"M\":\n _clip.moveTo(transformCoords(coords));\n break;\n case \"m\":\n _clip.moveTo(transformCoords(coords, true));\n break;\n case \"L\":\n _clip.lineTo(transformCoords(coords));\n break;\n case \"l\":\n _clip.lineTo(transformCoords(coords, true));\n break;\n case \"C\":\n _clip.cubicCurveTo(transformCoords(coords));\n break;\n case \"c\":\n _clip.cubicCurveTo(transformCoords(coords, true));\n break;\n case \"Q\":\n _clip.quadraticCurveTo(transformCoords(coords));\n break;\n case \"q\":\n _clip.quadraticCurveTo(transformCoords(coords, true));\n break;\n }\n });\n\n baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](maxX - minX, maxY - minY) / 2;\n centerPoint = new paper.Point((maxX + minX) / 2, (maxY + minY) / 2);\n if (!this.options.show_node_circles) {\n this.h_ratio = (maxY - minY) / (2 * baseRadius);\n }\n } else {\n baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](width, height) / 2;\n centerPoint = new paper.Point(0,0);\n if (!this.options.show_node_circles) {\n this.h_ratio = height / (2 * baseRadius);\n }\n }\n var _raster = new paper.Raster(_image);\n _raster.locked = true; // Disable mouse events on icon\n if (hasClipPath) {\n _raster = new paper.Group(_clip, _raster);\n _raster.opacity = 0.99;\n /* This is a workaround to allow clipping at group level\n * If opacity was set to 1, paper.js would merge all clipping groups in one (known bug).\n */\n _raster.clipped = true;\n _clip.__representation = this;\n }\n if (this.options.clip_node_images) {\n var _circleClip = this.shapeBuilder.getImageShape(centerPoint, baseRadius);\n _raster = new paper.Group(_circleClip, _raster);\n _raster.opacity = 0.99;\n _raster.clipped = true;\n _circleClip.__representation = this;\n }\n this.image_delta = centerPoint.divide(baseRadius);\n this.node_image = _raster;\n this.node_image.__representation = _this;\n this.node_image.scale(this.circle_radius / baseRadius);\n this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n this.redraw();\n this.renderer.throttledPaperDraw();\n } else {\n var _this = this;\n $(_image).on(\"load\", function() {\n _this.showImage();\n });\n }\n },\n paperShift: function(_delta) {\n if (this.options.editor_mode) {\n if (!this.renkan.read_only) {\n this.is_dragging = true;\n this.paper_coords = this.paper_coords.add(_delta);\n this.redraw();\n }\n } else {\n this.renderer.paperShift(_delta);\n }\n },\n openEditor: function() {\n this.renderer.removeRepresentationsOfType(\"editor\");\n var _editor = this.renderer.addRepresentation(\"NodeEditor\",null);\n _editor.source_representation = this;\n _editor.draw();\n },\n select: function() {\n this.selected = true;\n this.circle.strokeWidth = this.options.selected_node_stroke_width;\n if (this.renderer.isEditable()) {\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n var _uri = this.model.get(\"uri\");\n if (_uri) {\n $('.Rk-Bin-Item').each(function() {\n var _el = $(this);\n if (_el.attr(\"data-uri\") === _uri) {\n _el.addClass(\"selected\");\n }\n });\n }\n if (!this.options.editor_mode) {\n this.openEditor();\n }\n\n if (this.renderer.minimap) {\n this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;\n this.minimap_circle.strokeColor = this.options.minimap_highlight_color;\n }\n this._super(\"select\");\n },\n hideButtons: function() {\n this.all_buttons.forEach(function(b) {\n b.hide();\n });\n delete(this.buttonTimeout);\n },\n unselect: function(_newTarget) {\n if (!_newTarget || _newTarget.source_representation !== this) {\n this.selected = false;\n var _this = this;\n this.buttons_timeout = setTimeout(function() { _this.hideButtons(); }, 200);\n this.circle.strokeWidth = this.options.node_stroke_width;\n $('.Rk-Bin-Item').removeClass(\"selected\");\n if (this.renderer.minimap) {\n this.minimap_circle.strokeColor = undefined;\n }\n this._super(\"unselect\");\n }\n },\n highlight: function(textToReplace) {\n var hlvalue = textToReplace || true;\n if (this.highlighted === hlvalue) {\n return;\n }\n this.highlighted = hlvalue;\n this.redraw();\n this.renderer.throttledPaperDraw();\n },\n unhighlight: function() {\n if (!this.highlighted) {\n return;\n }\n this.highlighted = false;\n this.redraw();\n this.renderer.throttledPaperDraw();\n },\n saveCoords: function() {\n var _coords = this.renderer.toModelCoords(this.paper_coords),\n _data = {\n position: {\n x: _coords.x,\n y: _coords.y\n }\n };\n if (this.renderer.isEditable()) {\n this.model.set(_data);\n }\n },\n mousedown: function(_event, _isTouch) {\n if (_isTouch) {\n this.renderer.unselectAll();\n this.select();\n }\n },\n mouseup: function(_event, _isTouch) {\n if (this.renderer.is_dragging && this.renderer.isEditable()) {\n this.saveCoords();\n } else {\n if (!_isTouch && !this.model.get(\"delete_scheduled\")) {\n this.openEditor();\n }\n this.model.trigger(\"clicked\");\n }\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.is_dragging = false;\n },\n destroy: function(_event) {\n this._super(\"destroy\");\n this.all_buttons.forEach(function(b) {\n b.destroy();\n });\n this.circle.remove();\n this.title.remove();\n if (this.renderer.minimap) {\n this.minimap_circle.remove();\n }\n if (this.node_image) {\n this.node_image.remove();\n }\n }\n });\n\n return NodeRepr;\n\n});\n\n\ndefine('renderer/edge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* Edge Class Begin */\n\n //var Edge = Renderer.Edge = Utils.inherit(Renderer._BaseRepresentation);\n var Edge = Utils.inherit(BaseRepresentation);\n\n _(Edge.prototype).extend({\n _init: function() {\n this.renderer.edge_layer.activate();\n this.type = \"Edge\";\n this.from_representation = this.renderer.getRepresentationByModel(this.model.get(\"from\"));\n this.to_representation = this.renderer.getRepresentationByModel(this.model.get(\"to\"));\n this.bundle = this.renderer.addToBundles(this);\n this.line = new paper.Path();\n this.line.add([0,0],[0,0],[0,0]);\n this.line.__representation = this;\n this.line.strokeWidth = this.options.edge_stroke_width;\n this.arrow = new paper.Path();\n this.arrow.add(\n [ 0, 0 ],\n [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n [ 0, this.options.edge_arrow_width ]\n );\n this.arrow.__representation = this;\n this.text = $('<div class=\"Rk-Label Rk-Edge-Label\">').appendTo(this.renderer.labels_$);\n this.arrow_angle = 0;\n if (this.options.editor_mode) {\n var Renderer = requtils.getRenderer();\n this.normal_buttons = [\n new Renderer.EdgeEditButton(this.renderer, null),\n new Renderer.EdgeRemoveButton(this.renderer, null)\n ];\n this.pending_delete_buttons = [\n new Renderer.EdgeRevertButton(this.renderer, null)\n ];\n this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n for (var i = 0; i < this.all_buttons.length; i++) {\n this.all_buttons[i].source_representation = this;\n }\n this.active_buttons = [];\n } else {\n this.active_buttons = this.all_buttons = [];\n }\n\n if (this.renderer.minimap) {\n this.renderer.minimap.edge_layer.activate();\n this.minimap_line = new paper.Path();\n this.minimap_line.add([0,0],[0,0]);\n this.minimap_line.__representation = this.renderer.minimap.miniframe.__representation;\n this.minimap_line.strokeWidth = 1;\n }\n },\n redraw: function() {\n var from = this.model.get(\"from\"),\n to = this.model.get(\"to\");\n if (!from || !to) {\n return;\n }\n this.from_representation = this.renderer.getRepresentationByModel(from);\n this.to_representation = this.renderer.getRepresentationByModel(to);\n if (typeof this.from_representation === \"undefined\" || typeof this.to_representation === \"undefined\") {\n return;\n }\n var _p0a = this.from_representation.paper_coords,\n _p1a = this.to_representation.paper_coords,\n _v = _p1a.subtract(_p0a),\n _r = _v.length,\n _u = _v.divide(_r),\n _ortho = new paper.Point([- _u.y, _u.x]),\n _group_pos = this.bundle.getPosition(this),\n _delta = _ortho.multiply( this.options.edge_gap_in_bundles * _group_pos ),\n _p0b = _p0a.add(_delta), /* Adding a 4 px difference */\n _p1b = _p1a.add(_delta), /* to differentiate bundled links */\n _a = _v.angle,\n _textdelta = _ortho.multiply(this.options.edge_label_distance),\n _handle = _v.divide(3),\n _color = this.model.get(\"color\") || this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n opacity = 1;\n\n if (this.model.get(\"delete_scheduled\") || this.from_representation.model.get(\"delete_scheduled\") || this.to_representation.model.get(\"delete_scheduled\")) {\n opacity = 0.5;\n this.line.dashArray = [2, 2];\n } else {\n opacity = 1;\n this.line.dashArray = null;\n }\n\n var old_act_btn = this.active_buttons;\n\n this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.strokeColor = _color;\n this.line.opacity = opacity;\n this.line.segments[0].point = _p0a;\n this.line.segments[1].point = this.paper_coords;\n this.line.segments[1].handleIn = _handle.multiply(-1);\n this.line.segments[1].handleOut = _handle;\n this.line.segments[2].point = _p1a;\n this.arrow.rotate(_a - this.arrow_angle);\n this.arrow.fillColor = _color;\n this.arrow.opacity = opacity;\n this.arrow.position = this.paper_coords;\n this.arrow_angle = _a;\n if (_a > 90) {\n _a -= 180;\n _textdelta = _textdelta.multiply(-1);\n }\n if (_a < -90) {\n _a += 180;\n _textdelta = _textdelta.multiply(-1);\n }\n var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_edges) || \"\";\n _text = Utils.shortenText(_text, this.options.node_label_max_length);\n this.text.text(_text);\n var _textpos = this.paper_coords.add(_textdelta);\n this.text.css({\n left: _textpos.x,\n top: _textpos.y,\n transform: \"rotate(\" + _a + \"deg)\",\n \"-moz-transform\": \"rotate(\" + _a + \"deg)\",\n \"-webkit-transform\": \"rotate(\" + _a + \"deg)\",\n opacity: opacity\n });\n this.text_angle = _a;\n\n var _pc = this.paper_coords;\n this.all_buttons.forEach(function(b) {\n b.moveTo(_pc);\n });\n\n if (this.renderer.minimap) {\n this.minimap_line.strokeColor = _color;\n this.minimap_line.segments[0].point = this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get(\"position\")));\n this.minimap_line.segments[1].point = this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get(\"position\")));\n }\n },\n openEditor: function() {\n this.renderer.removeRepresentationsOfType(\"editor\");\n var _editor = this.renderer.addRepresentation(\"EdgeEditor\",null);\n _editor.source_representation = this;\n _editor.draw();\n },\n select: function() {\n this.selected = true;\n this.line.strokeWidth = this.options.selected_edge_stroke_width;\n if (this.renderer.isEditable()) {\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n if (!this.options.editor_mode) {\n this.openEditor();\n }\n this._super(\"select\");\n },\n unselect: function(_newTarget) {\n if (!_newTarget || _newTarget.source_representation !== this) {\n this.selected = false;\n if (this.options.editor_mode) {\n this.all_buttons.forEach(function(b) {\n b.hide();\n });\n }\n this.line.strokeWidth = this.options.edge_stroke_width;\n this._super(\"unselect\");\n }\n },\n mousedown: function(_event, _isTouch) {\n if (_isTouch) {\n this.renderer.unselectAll();\n this.select();\n }\n },\n mouseup: function(_event, _isTouch) {\n if (!this.renkan.read_only && this.renderer.is_dragging) {\n this.from_representation.saveCoords();\n this.to_representation.saveCoords();\n this.from_representation.is_dragging = false;\n this.to_representation.is_dragging = false;\n } else {\n if (!_isTouch) {\n this.openEditor();\n }\n this.model.trigger(\"clicked\");\n }\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n },\n paperShift: function(_delta) {\n if (this.options.editor_mode) {\n if (!this.options.read_only) {\n this.from_representation.paperShift(_delta);\n this.to_representation.paperShift(_delta);\n }\n } else {\n this.renderer.paperShift(_delta);\n }\n },\n destroy: function() {\n this._super(\"destroy\");\n this.line.remove();\n this.arrow.remove();\n this.text.remove();\n if (this.renderer.minimap) {\n this.minimap_line.remove();\n }\n this.all_buttons.forEach(function(b) {\n b.destroy();\n });\n var _this = this;\n this.bundle.edges = _(this.bundle.edges).reject(function(_edge) {\n return _this === _edge;\n });\n }\n });\n\n return Edge;\n\n});\n\n\n\ndefine('renderer/tempedge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* TempEdge Class Begin */\n\n //var TempEdge = Renderer.TempEdge = Utils.inherit(Renderer._BaseRepresentation);\n var TempEdge = Utils.inherit(BaseRepresentation);\n\n _(TempEdge.prototype).extend({\n _init: function() {\n this.renderer.edge_layer.activate();\n this.type = \"Temp-edge\";\n\n var _color = (this.project.get(\"users\").get(this.renkan.current_user) || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n this.line = new paper.Path();\n this.line.strokeColor = _color;\n this.line.dashArray = [4, 2];\n this.line.strokeWidth = this.options.selected_edge_stroke_width;\n this.line.add([0,0],[0,0]);\n this.line.__representation = this;\n this.arrow = new paper.Path();\n this.arrow.fillColor = _color;\n this.arrow.add(\n [ 0, 0 ],\n [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n [ 0, this.options.edge_arrow_width ]\n );\n this.arrow.__representation = this;\n this.arrow_angle = 0;\n },\n redraw: function() {\n var _p0 = this.from_representation.paper_coords,\n _p1 = this.end_pos,\n _a = _p1.subtract(_p0).angle,\n _c = _p0.add(_p1).divide(2);\n this.line.segments[0].point = _p0;\n this.line.segments[1].point = _p1;\n this.arrow.rotate(_a - this.arrow_angle);\n this.arrow.position = _c;\n this.arrow_angle = _a;\n },\n paperShift: function(_delta) {\n if (!this.renderer.isEditable()) {\n this.renderer.removeRepresentation(_this);\n paper.view.draw();\n return;\n }\n this.end_pos = this.end_pos.add(_delta);\n var _hitResult = paper.project.hitTest(this.end_pos);\n this.renderer.findTarget(_hitResult);\n this.redraw();\n },\n mouseup: function(_event, _isTouch) {\n var _hitResult = paper.project.hitTest(_event.point),\n _model = this.from_representation.model,\n _endDrag = true;\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n var _target = _hitResult.item.__representation;\n if (_target.type.substr(0,4) === \"Node\") {\n var _destmodel = _target.model || _target.source_representation.model;\n if (_model !== _destmodel) {\n var _data = {\n id: Utils.getUID('edge'),\n created_by: this.renkan.current_user,\n from: _model,\n to: _destmodel\n };\n if (this.renderer.isEditable()) {\n this.project.addEdge(_data);\n }\n }\n }\n\n if (_model === _target.model || (_target.source_representation && _target.source_representation.model === _model)) {\n _endDrag = false;\n this.renderer.is_dragging = true;\n }\n }\n if (_endDrag) {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.renderer.removeRepresentation(this);\n paper.view.draw();\n }\n },\n destroy: function() {\n this.arrow.remove();\n this.line.remove();\n }\n });\n\n /* TempEdge Class End */\n\n return TempEdge;\n\n});\n\n\ndefine('renderer/baseeditor',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* _BaseEditor Begin */\n //var _BaseEditor = Renderer._BaseEditor = Utils.inherit(Renderer._BaseRepresentation);\n var _BaseEditor = Utils.inherit(BaseRepresentation);\n\n _(_BaseEditor.prototype).extend({\n _init: function() {\n this.renderer.buttons_layer.activate();\n this.type = \"editor\";\n this.editor_block = new paper.Path();\n var _pts = _(_.range(8)).map(function() {return [0,0];});\n this.editor_block.add.apply(this.editor_block, _pts);\n this.editor_block.strokeWidth = this.options.tooltip_border_width;\n this.editor_block.strokeColor = this.options.tooltip_border_color;\n this.editor_block.opacity = 0.8;\n this.editor_$ = $('<div>')\n .appendTo(this.renderer.editor_$)\n .css({\n position: \"absolute\",\n opacity: 0.8\n })\n .hide();\n },\n destroy: function() {\n this.editor_block.remove();\n this.editor_$.remove();\n }\n });\n\n /* _BaseEditor End */\n\n return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeEditor Begin */\n //var NodeEditor = Renderer.NodeEditor = Utils.inherit(Renderer._BaseEditor);\n var NodeEditor = Utils.inherit(BaseEditor);\n\n _(NodeEditor.prototype).extend({\n template: _.template(\n '<h2><span class=\"Rk-CloseX\">×</span><%-renkan.translate(\"Edit Node\")%></span></h2>' +\n '<p><label><%-renkan.translate(\"Title:\")%></label><input class=\"Rk-Edit-Title\" type=\"text\" value=\"<%-node.title%>\"/></p>' +\n '<% if (options.show_node_editor_uri) { %><p><label><%-renkan.translate(\"URI:\")%></label><input class=\"Rk-Edit-URI\" type=\"text\" value=\"<%-node.uri%>\"/><a class=\"Rk-Edit-Goto\" href=\"<%-node.uri%>\" target=\"_blank\"></a></p><% } %>' +\n '<% if (options.show_node_editor_description) { %><p><label><%-renkan.translate(\"Description:\")%></label><textarea class=\"Rk-Edit-Description\"><%-node.description%></textarea></p><% } %>' +\n '<% if (options.show_node_editor_size) { %><p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"Size:\")%></span><a href=\"#\" class=\"Rk-Edit-Size-Down\">-</a><span class=\"Rk-Edit-Size-Value\"><%-node.size%></span><a href=\"#\" class=\"Rk-Edit-Size-Up\">+</a></p><% } %>' +\n '<% if (options.show_node_editor_color) { %><div class=\"Rk-Editor-p\"><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"Node color:\")%></span><div class=\"Rk-Edit-ColorPicker-Wrapper\"><span class=\"Rk-Edit-Color\" style=\"background:<%-node.color%>;\"><span class=\"Rk-Edit-ColorTip\"></span></span>' +\n '<%= renkan.colorPicker %><span class=\"Rk-Edit-ColorPicker-Text\"><%- renkan.translate(\"Choose color\") %></span></div></div><% } %>' +\n '<% if (options.show_node_editor_image) { %><div class=\"Rk-Edit-ImgWrap\"><div class=\"Rk-Edit-ImgPreview\"><img src=\"<%-node.image || node.image_placeholder%>\" />' +\n '<% if (node.clip_path) { %><svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\"><path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"<%- node.clip_path %>\"/></svg><% }%>' +\n '</div></div><p><label><%-renkan.translate(\"Image URL:\")%></label><div><a class=\"Rk-Edit-Image-Del\" href=\"#\"></a><input class=\"Rk-Edit-Image\" type=\"text\" value=\"<%-node.image%>\"/></div></p>' +\n '<% if (options.allow_image_upload) { %><p><label><%-renkan.translate(\"Choose Image File:\")%></label><input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\"/></p><% }%><% } %>' +\n '<% if (options.show_node_editor_creator && node.has_creator) { %><p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"Created by:\")%></span> <span class=\"Rk-UserColor\" style=\"background:<%-node.created_by_color%>;\"></span><%- shortenText(node.created_by_title, 25) %></p><% } %>' +\n '<% if (options.change_shapes) { %><p><label><%-renkan.translate(\"Shapes available\")%>:</label> <select class=\"Rk-Edit-Shape\">' +\n '<option class=\"Rk-Edit-Vocabulary-Property\" value=\"circle\"<% if (node.shape === \"circle\") { %> selected<% } %>><%- renkan.translate(\"Circle\") %></option>' +\n '<option class=\"Rk-Edit-Vocabulary-Property\" value=\"rectangle\"<% if (node.shape === \"rectangle\") { %> selected<% } %>><%- renkan.translate(\"Square\") %></option>' +\n '<option class=\"Rk-Edit-Vocabulary-Property\" value=\"diamond\"<% if (node.shape === \"diamond\") { %> selected<% } %>><%- renkan.translate(\"Diamond\") %></option>' +\n '<option class=\"Rk-Edit-Vocabulary-Property\" value=\"polygon\"<% if (node.shape === \"polygon\") { %> selected<% } %>><%- renkan.translate(\"Hexagone\") %></option>' +\n '<option class=\"Rk-Edit-Vocabulary-Property\" value=\"ellipse\"<% if (node.shape === \"ellipse\") { %> selected<% } %>><%- renkan.translate(\"Ellipse\") %></option>' +\n '<option class=\"Rk-Edit-Vocabulary-Property\" value=\"star\"<% if (node.shape === \"star\") { %> selected<% } %>><%- renkan.translate(\"Star\") %></option>' +\n '</select></p><% } %>'\n ),\n readOnlyTemplate: _.template(\n '<h2><span class=\"Rk-CloseX\">×</span><% if (options.show_node_tooltip_color) { %><span class=\"Rk-UserColor\" style=\"background:<%-node.color%>;\"></span><% } %>' +\n '<span class=\"Rk-Display-Title\"><% if (node.uri) { %><a href=\"<%-node.uri%>\" target=\"_blank\"><% } %><%-node.title%><% if (node.uri) { %></a><% } %></span></h2>' +\n '<% if (node.uri && options.show_node_tooltip_uri) { %><p class=\"Rk-Display-URI\"><a href=\"<%-node.uri%>\" target=\"_blank\"><%-node.short_uri%></a></p><% } %>' +\n '<% if (options.show_node_tooltip_description) { %><p class=\"Rk-Display-Description\"><%-node.description%></p><% } %>' +\n '<% if (node.image && options.show_node_tooltip_image) { %><img class=\"Rk-Display-ImgPreview\" src=\"<%-node.image%>\" /><% } %>' +\n '<% if (node.has_creator && options.show_node_tooltip_creator) { %><p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"Created by:\")%></span><span class=\"Rk-UserColor\" style=\"background:<%-node.created_by_color%>;\"></span><%- shortenText(node.created_by_title, 25) %></p><% } %>'\n ),\n draw: function() {\n var _model = this.source_representation.model,\n _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate ),\n _image_placeholder = this.options.static_url + \"img/image-placeholder.png\",\n _size = (_model.get(\"size\") || 0);\n this.editor_$\n .html(_template({\n node: {\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n short_uri: Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n description: _model.get(\"description\"),\n image: _model.get(\"image\") || \"\",\n image_placeholder: _image_placeholder,\n color: _model.get(\"color\") || _created_by.get(\"color\"),\n clip_path: _model.get(\"clip_path\") || false,\n created_by_color: _created_by.get(\"color\"),\n created_by_title: _created_by.get(\"title\"),\n size: (_size > 0 ? \"+\" : \"\") + _size,\n shape: _model.get(\"shape\") || \"circle\"\n },\n renkan: this.renkan,\n options: this.options,\n shortenText: Utils.shortenText\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n\n this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n\n this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n if (!_model.get(\"uri\")) {\n return false;\n }\n });\n\n if (this.renderer.isEditable()) {\n\n var onFieldChange = _(function() {\n _(function() {\n if (_this.renderer.isEditable()) {\n var _data = {\n title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n };\n if (_this.options.show_node_editor_uri) {\n _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n }\n if (_this.options.show_node_editor_image) {\n _data.image = _this.editor_$.find(\".Rk-Edit-Image\").val();\n _this.editor_$.find(\".Rk-Edit-ImgPreview\").attr(\"src\", _data.image || _image_placeholder);\n }\n if (_this.options.show_node_editor_description) {\n _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n }\n if (_this.options.change_shapes) {\n if(_model.get(\"shape\")!==_this.editor_$.find(\".Rk-Edit-Shape\").val()){\n _data.shape = _this.editor_$.find(\".Rk-Edit-Shape\").val();\n _data.shape_changed = true;\n }\n }\n _model.set(_data);\n _this.redraw();\n // For an unknown reason, we have to set data twice when we change shape, otherwise the image disappears.\n if(_data.shape_changed===true){\n _model.set(_data);\n }\n } else {\n closeEditor();\n }\n }).defer();\n }).throttle(500);\n \n this.editor_$.on(\"keyup\", function(_e) {\n if (_e.keyCode === 27) {\n closeEditor();\n }\n });\n\n this.editor_$.find(\"input, textarea, select\").on(\"change keyup paste\", onFieldChange);\n\n if(_this.options.allow_image_upload) {\n this.editor_$.find(\".Rk-Edit-Image-File\").change(function() {\n if (this.files.length) {\n var f = this.files[0],\n fr = new FileReader();\n if (f.type.substr(0,5) !== \"image\") {\n alert(_this.renkan.translate(\"This file is not an image\"));\n return;\n }\n if (f.size > (_this.options.uploaded_image_max_kb * 1024)) {\n alert(_this.renkan.translate(\"Image size must be under \") + _this.options.uploaded_image_max_kb + _this.renkan.translate(\"KB\"));\n return;\n }\n fr.onload = function(e) {\n _this.editor_$.find(\".Rk-Edit-Image\").val(e.target.result);\n onFieldChange();\n };\n fr.readAsDataURL(f);\n }\n });\n }\n this.editor_$.find(\".Rk-Edit-Title\")[0].focus();\n\n var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n function(_e) {\n _e.preventDefault();\n _picker.show();\n },\n function(_e) {\n _e.preventDefault();\n _picker.hide();\n }\n );\n\n _picker.find(\"li\").hover(\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n },\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n }\n ).click(function(_e) {\n _e.preventDefault();\n if (_this.renderer.isEditable()) {\n _model.set(\"color\", $(this).attr(\"data-color\"));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n\n var shiftSize = function(n) {\n if (_this.renderer.isEditable()) {\n var _newsize = n+(_model.get(\"size\") || 0);\n _this.editor_$.find(\".Rk-Edit-Size-Value\").text((_newsize > 0 ? \"+\" : \"\") + _newsize);\n _model.set(\"size\", _newsize);\n paper.view.draw();\n } else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\".Rk-Edit-Size-Down\").click(function() {\n shiftSize(-1);\n return false;\n });\n this.editor_$.find(\".Rk-Edit-Size-Up\").click(function() {\n shiftSize(1);\n return false;\n });\n \n this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n \t_this.editor_$.find(\".Rk-Edit-Image\").val('');\n \tonFieldChange();\n return false;\n });\n } else {\n if (typeof this.source_representation.highlighted === \"object\") {\n var titlehtml = this.source_representation.highlighted.replace(_(_model.get(\"title\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>');\n this.editor_$.find(\".Rk-Display-Title\" + (_model.get(\"uri\") ? \" a\" : \"\")).html(titlehtml);\n if (this.options.show_node_tooltip_description) {\n this.editor_$.find(\".Rk-Display-Description\").html(this.source_representation.highlighted.replace(_(_model.get(\"description\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n }\n }\n }\n this.editor_$.find(\"img\").load(function() {\n _this.redraw();\n });\n },\n redraw: function() {\n var _coords = this.source_representation.paper_coords;\n Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);\n this.editor_$.show();\n paper.view.draw();\n }\n });\n\n /* NodeEditor End */\n\n return NodeEditor;\n\n});\n\n\ndefine('renderer/edgeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeEditor Begin */\n\n //var EdgeEditor = Renderer.EdgeEditor = Utils.inherit(Renderer._BaseEditor);\n var EdgeEditor = Utils.inherit(BaseEditor);\n\n _(EdgeEditor.prototype).extend({\n template: _.template(\n '<h2><span class=\"Rk-CloseX\">×</span><%-renkan.translate(\"Edit Edge\")%></span></h2>' +\n '<p><label><%-renkan.translate(\"Title:\")%></label><input class=\"Rk-Edit-Title\" type=\"text\" value=\"<%-edge.title%>\"/></p>' +\n '<% if (options.show_edge_editor_uri) { %><p><label><%-renkan.translate(\"URI:\")%></label><input class=\"Rk-Edit-URI\" type=\"text\" value=\"<%-edge.uri%>\"/><a class=\"Rk-Edit-Goto\" href=\"<%-edge.uri%>\" target=\"_blank\"></a></p>' +\n '<% if (options.properties.length) { %><p><label><%-renkan.translate(\"Choose from vocabulary:\")%></label><select class=\"Rk-Edit-Vocabulary\">' +\n '<% _(options.properties).each(function(ontology) { %><option class=\"Rk-Edit-Vocabulary-Class\" value=\"\"><%- renkan.translate(ontology.label) %></option>' +\n '<% _(ontology.properties).each(function(property) { var uri = ontology[\"base-uri\"] + property.uri; %><option class=\"Rk-Edit-Vocabulary-Property\" value=\"<%- uri %>' +\n '\"<% if (uri === edge.uri) { %> selected<% } %>><%- renkan.translate(property.label) %></option>' +\n '<% }) %><% }) %></select></p><% } } %>' +\n '<% if (options.show_edge_editor_color) { %><div class=\"Rk-Editor-p\"><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"Edge color:\")%></span><div class=\"Rk-Edit-ColorPicker-Wrapper\"><span class=\"Rk-Edit-Color\" style=\"background:<%-edge.color%>;\"><span class=\"Rk-Edit-ColorTip\"></span></span>' +\n '<%= renkan.colorPicker %><span class=\"Rk-Edit-ColorPicker-Text\"><%- renkan.translate(\"Choose color\") %></span></div></div><% } %>' +\n '<% if (options.show_edge_editor_direction) { %><p><span class=\"Rk-Edit-Direction\"><%- renkan.translate(\"Change edge direction\") %></span></p><% } %>' +\n '<% if (options.show_edge_editor_nodes) { %><p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"From:\")%></span><span class=\"Rk-UserColor\" style=\"background:<%-edge.from_color%>;\"></span><%- shortenText(edge.from_title, 25) %></p>' +\n '<p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"To:\")%></span><span class=\"Rk-UserColor\" style=\"background:<%-edge.to_color%>;\"></span><%- shortenText(edge.to_title, 25) %></p><% } %>' +\n '<% if (options.show_edge_editor_creator && edge.has_creator) { %><p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"Created by:\")%></span><span class=\"Rk-UserColor\" style=\"background:<%-edge.created_by_color%>;\"></span><%- shortenText(edge.created_by_title, 25) %></p><% } %>'\n ),\n readOnlyTemplate: _.template(\n '<h2><span class=\"Rk-CloseX\">×</span><% if (options.show_edge_tooltip_color) { %><span class=\"Rk-UserColor\" style=\"background:<%-edge.color%>;\"></span><% } %>' +\n '<span class=\"Rk-Display-Title\"><% if (edge.uri) { %><a href=\"<%-edge.uri%>\" target=\"_blank\"><% } %><%-edge.title%><% if (edge.uri) { %></a><% } %></span></h2>' +\n '<% if (options.show_edge_tooltip_uri && edge.uri) { %><p class=\"Rk-Display-URI\"><a href=\"<%-edge.uri%>\" target=\"_blank\"><%-edge.short_uri%></a></p><% } %>' +\n '<p><%-edge.description%></p>' +\n '<% if (options.show_edge_tooltip_nodes) { %><p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"From:\")%></span><span class=\"Rk-UserColor\" style=\"background:<%-edge.from_color%>;\"></span><%- shortenText(edge.from_title, 25) %></p>' +\n '<p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"To:\")%></span><span class=\"Rk-UserColor\" style=\"background:<%-edge.to_color%>;\"></span><%- shortenText(edge.to_title, 25) %></p><% } %>' +\n '<% if (options.show_edge_tooltip_creator && edge.has_creator) { %><p><span class=\"Rk-Editor-Label\"><%-renkan.translate(\"Created by:\")%></span><span class=\"Rk-UserColor\" style=\"background:<%-edge.created_by_color%>;\"></span><%- shortenText(edge.created_by_title, 25) %></p><% } %>'\n ),\n draw: function() {\n var _model = this.source_representation.model,\n _from_model = _model.get(\"from\"),\n _to_model = _model.get(\"to\"),\n _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate);\n this.editor_$\n .html(_template({\n edge: {\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n short_uri: Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n description: _model.get(\"description\"),\n color: _model.get(\"color\") || _created_by.get(\"color\"),\n from_title: _from_model.get(\"title\"),\n to_title: _to_model.get(\"title\"),\n from_color: _from_model.get(\"color\") || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n to_color: _to_model.get(\"color\") || (_to_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n created_by_color: _created_by.get(\"color\"),\n created_by_title: _created_by.get(\"title\")\n },\n renkan: this.renkan,\n shortenText: Utils.shortenText,\n options: this.options\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n if (!_model.get(\"uri\")) {\n return false;\n }\n });\n\n if (this.renderer.isEditable()) {\n\n var onFieldChange = _(function() {\n _(function() {\n if (_this.renderer.isEditable()) {\n var _data = {\n title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n };\n if (_this.options.show_edge_editor_uri) {\n _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n }\n _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n _model.set(_data);\n paper.view.draw();\n } else {\n closeEditor();\n }\n }).defer();\n }).throttle(500);\n\n this.editor_$.on(\"keyup\", function(_e) {\n if (_e.keyCode === 27) {\n closeEditor();\n }\n });\n\n this.editor_$.find(\"input\").on(\"keyup change paste\", onFieldChange);\n\n this.editor_$.find(\".Rk-Edit-Vocabulary\").change(function() {\n var e = $(this),\n v = e.val();\n if (v) {\n _this.editor_$.find(\".Rk-Edit-Title\").val(e.find(\":selected\").text());\n _this.editor_$.find(\".Rk-Edit-URI\").val(v);\n onFieldChange();\n }\n });\n this.editor_$.find(\".Rk-Edit-Direction\").click(function() {\n if (_this.renderer.isEditable()) {\n _model.set({\n from: _model.get(\"to\"),\n to: _model.get(\"from\")\n });\n _this.draw();\n } else {\n closeEditor();\n }\n });\n\n var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n function(_e) {\n _e.preventDefault();\n _picker.show();\n },\n function(_e) {\n _e.preventDefault();\n _picker.hide();\n }\n );\n\n _picker.find(\"li\").hover(\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n },\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n }\n ).click(function(_e) {\n _e.preventDefault();\n if (_this.renderer.isEditable()) {\n _model.set(\"color\", $(this).attr(\"data-color\"));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n }\n },\n redraw: function() {\n var _coords = this.source_representation.paper_coords;\n Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);\n this.editor_$.show();\n paper.view.draw();\n }\n });\n\n /* EdgeEditor End */\n\n return EdgeEditor;\n\n});\n\n\ndefine('renderer/nodebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* _NodeButton Begin */\n\n //var _NodeButton = Renderer._NodeButton = Utils.inherit(Renderer._BaseButton);\n var _NodeButton = Utils.inherit(BaseButton);\n\n _(_NodeButton.prototype).extend({\n setSectorSize: function() {\n var sectorInner = this.source_representation.circle_radius;\n if (sectorInner !== this.lastSectorInner) {\n if (this.sector) {\n this.sector.destroy();\n }\n this.sector = this.renderer.drawSector(\n this, 1 + sectorInner,\n Utils._NODE_BUTTON_WIDTH + sectorInner,\n this.startAngle,\n this.endAngle,\n 1,\n this.imageName,\n this.renkan.translate(this.text)\n );\n this.lastSectorInner = sectorInner;\n }\n },\n unselect: function() {\n BaseButton.prototype.unselect.apply(this, Array.prototype.slice.call(arguments, 1));\n if(this.source_representation && this.source_representation.buttons_timeout) {\n clearTimeout(this.source_representation.buttons_timeout);\n this.source_representation.hideButtons();\n }\n },\n select: function() {\n if(this.source_representation && this.source_representation.buttons_timeout) {\n clearTimeout(this.source_representation.buttons_timeout);\n }\n this.sector.select();\n },\n });\n\n /* _NodeButton End */\n\n return _NodeButton;\n\n});\n\n\ndefine('renderer/nodeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeEditButton Begin */\n\n //var NodeEditButton = Renderer.NodeEditButton = Utils.inherit(Renderer._NodeButton);\n var NodeEditButton = Utils.inherit(NodeButton);\n\n _(NodeEditButton.prototype).extend({\n _init: function() {\n this.type = \"Node-edit-button\";\n this.lastSectorInner = 0;\n this.startAngle = -135;\n this.endAngle = -45;\n this.imageName = \"edit\";\n this.text = \"Edit\";\n },\n mouseup: function() {\n if (!this.renderer.is_dragging) {\n this.source_representation.openEditor();\n }\n }\n });\n\n /* NodeEditButton End */\n\n return NodeEditButton;\n\n});\n\n\ndefine('renderer/noderemovebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n \n var Utils = requtils.getUtils();\n\n /* NodeRemoveButton Begin */\n\n //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);\n var NodeRemoveButton = Utils.inherit(NodeButton);\n\n _(NodeRemoveButton.prototype).extend({\n _init: function() {\n this.type = \"Node-remove-button\";\n this.lastSectorInner = 0;\n this.startAngle = 0;\n this.endAngle = 90;\n this.imageName = \"remove\";\n this.text = \"Remove\";\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.renderer.removeRepresentationsOfType(\"editor\");\n if (this.renderer.isEditable()) {\n if (this.options.element_delete_delay) {\n var delid = Utils.getUID(\"delete\");\n this.renderer.delete_list.push({\n id: delid,\n time: new Date().valueOf() + this.options.element_delete_delay\n });\n this.source_representation.model.set(\"delete_scheduled\", delid);\n } else {\n if (confirm(this.renkan.translate('Do you really wish to remove node ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n this.project.removeNode(this.source_representation.model);\n }\n }\n }\n }\n });\n\n /* NodeRemoveButton End */\n\n return NodeRemoveButton;\n\n});\n\n\ndefine('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeRevertButton Begin */\n\n //var NodeRevertButton = Renderer.NodeRevertButton = Utils.inherit(Renderer._NodeButton);\n var NodeRevertButton = Utils.inherit(NodeButton);\n\n _(NodeRevertButton.prototype).extend({\n _init: function() {\n this.type = \"Node-revert-button\";\n this.lastSectorInner = 0;\n this.startAngle = -135;\n this.endAngle = 135;\n this.imageName = \"revert\";\n this.text = \"Cancel deletion\";\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n if (this.renderer.isEditable()) {\n this.source_representation.model.unset(\"delete_scheduled\");\n }\n }\n });\n\n /* NodeRevertButton End */\n\n return NodeRevertButton;\n\n});\n\n\ndefine('renderer/nodelinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeLinkButton Begin */\n\n //var NodeLinkButton = Renderer.NodeLinkButton = Utils.inherit(Renderer._NodeButton);\n var NodeLinkButton = Utils.inherit(NodeButton);\n\n _(NodeLinkButton.prototype).extend({\n _init: function() {\n this.type = \"Node-link-button\";\n this.lastSectorInner = 0;\n this.startAngle = 90;\n this.endAngle = 180;\n this.imageName = \"link\";\n this.text = \"Link to another node\";\n },\n mousedown: function(_event, _isTouch) {\n if (this.renderer.isEditable()) {\n var _off = this.renderer.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]);\n this.renderer.click_target = null;\n this.renderer.removeRepresentationsOfType(\"editor\");\n this.renderer.addTempEdge(this.source_representation, _point);\n }\n }\n });\n\n /* NodeLinkButton End */\n\n return NodeLinkButton;\n\n});\n\n\n\ndefine('renderer/nodeenlargebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n \n var Utils = requtils.getUtils();\n\n /* NodeEnlargeButton Begin */\n\n //var NodeEnlargeButton = Renderer.NodeEnlargeButton = Utils.inherit(Renderer._NodeButton);\n var NodeEnlargeButton = Utils.inherit(NodeButton);\n\n _(NodeEnlargeButton.prototype).extend({\n _init: function() {\n this.type = \"Node-enlarge-button\";\n this.lastSectorInner = 0;\n this.startAngle = -45;\n this.endAngle = 0;\n this.imageName = \"enlarge\";\n this.text = \"Enlarge\";\n },\n mouseup: function() {\n var _newsize = 1 + (this.source_representation.model.get(\"size\") || 0);\n this.source_representation.model.set(\"size\", _newsize);\n this.source_representation.select();\n this.select();\n paper.view.draw();\n }\n });\n\n /* NodeEnlargeButton End */\n\n return NodeEnlargeButton;\n\n});\n\n\ndefine('renderer/nodeshrinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeShrinkButton Begin */\n\n //var NodeShrinkButton = Renderer.NodeShrinkButton = Utils.inherit(Renderer._NodeButton);\n var NodeShrinkButton = Utils.inherit(NodeButton);\n\n _(NodeShrinkButton.prototype).extend({\n _init: function() {\n this.type = \"Node-shrink-button\";\n this.lastSectorInner = 0;\n this.startAngle = -180;\n this.endAngle = -135;\n this.imageName = \"shrink\";\n this.text = \"Shrink\";\n },\n mouseup: function() {\n var _newsize = -1 + (this.source_representation.model.get(\"size\") || 0);\n this.source_representation.model.set(\"size\", _newsize);\n this.source_representation.select();\n this.select();\n paper.view.draw();\n }\n });\n\n /* NodeShrinkButton End */\n\n return NodeShrinkButton;\n\n});\n\n\ndefine('renderer/edgeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeEditButton Begin */\n\n //var EdgeEditButton = Renderer.EdgeEditButton = Utils.inherit(Renderer._BaseButton);\n var EdgeEditButton = Utils.inherit(BaseButton);\n\n _(EdgeEditButton.prototype).extend({\n _init: function() {\n this.type = \"Edge-edit-button\";\n this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -270, -90, 1, \"edit\", this.renkan.translate(\"Edit\"));\n },\n mouseup: function() {\n if (!this.renderer.is_dragging) {\n this.source_representation.openEditor();\n }\n }\n });\n\n /* EdgeEditButton End */\n\n return EdgeEditButton;\n\n});\n\n\ndefine('renderer/edgeremovebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeRemoveButton Begin */\n\n //var EdgeRemoveButton = Renderer.EdgeRemoveButton = Utils.inherit(Renderer._BaseButton);\n var EdgeRemoveButton = Utils.inherit(BaseButton);\n\n _(EdgeRemoveButton.prototype).extend({\n _init: function() {\n this.type = \"Edge-remove-button\";\n this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -90, 90, 1, \"remove\", this.renkan.translate(\"Remove\"));\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.renderer.removeRepresentationsOfType(\"editor\");\n if (this.renderer.isEditable()) {\n if (this.options.element_delete_delay) {\n var delid = Utils.getUID(\"delete\");\n this.renderer.delete_list.push({\n id: delid,\n time: new Date().valueOf() + this.options.element_delete_delay\n });\n this.source_representation.model.set(\"delete_scheduled\", delid);\n } else {\n if (confirm(this.renkan.translate('Do you really wish to remove edge ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n this.project.removeEdge(this.source_representation.model);\n }\n }\n }\n }\n });\n\n /* EdgeRemoveButton End */\n\n return EdgeRemoveButton;\n\n});\n\n\ndefine('renderer/edgerevertbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeRevertButton Begin */\n\n //var EdgeRevertButton = Renderer.EdgeRevertButton = Utils.inherit(Renderer._BaseButton);\n var EdgeRevertButton = Utils.inherit(BaseButton);\n\n _(EdgeRevertButton.prototype).extend({\n _init: function() {\n this.type = \"Edge-revert-button\";\n this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -135, 135, 1, \"revert\", this.renkan.translate(\"Cancel deletion\"));\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n if (this.renderer.isEditable()) {\n this.source_representation.model.unset(\"delete_scheduled\");\n }\n }\n });\n\n /* EdgeRevertButton End */\n\n return EdgeRevertButton;\n\n});\n\n\ndefine('renderer/miniframe',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* MiniFrame Begin */\n\n //var MiniFrame = Renderer.MiniFrame = Utils.inherit(Renderer._BaseRepresentation);\n var MiniFrame = Utils.inherit(BaseRepresentation);\n\n _(MiniFrame.prototype).extend({\n paperShift: function(_delta) {\n this.renderer.offset = this.renderer.offset.subtract(_delta.divide(this.renderer.minimap.scale).multiply(this.renderer.scale));\n this.renderer.redraw();\n },\n mouseup: function(_delta) {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n }\n });\n\n /* MiniFrame End */\n\n return MiniFrame;\n\n});\n\n\ndefine('renderer/scene',['jquery', 'underscore', 'filesaver', 'requtils', 'renderer/miniframe'], function ($, _, filesaver, requtils, MiniFrame) {\n \n\n var Utils = requtils.getUtils();\n\n /* Scene Begin */\n\n var Scene = function(_renkan) {\n this.renkan = _renkan;\n this.$ = $(\".Rk-Render\");\n this.representations = [];\n this.$.html(this.template(_renkan));\n this.onStatusChange();\n this.canvas_$ = this.$.find(\".Rk-Canvas\");\n this.labels_$ = this.$.find(\".Rk-Labels\");\n this.editor_$ = this.$.find(\".Rk-Editor\");\n this.notif_$ = this.$.find(\".Rk-Notifications\");\n paper.setup(this.canvas_$[0]);\n this.scale = 1;\n this.initialScale = 1;\n this.offset = paper.view.center;\n this.totalScroll = 0;\n this.mouse_down = false;\n this.click_target = null;\n this.selected_target = null;\n this.edge_layer = new paper.Layer();\n this.node_layer = new paper.Layer();\n this.buttons_layer = new paper.Layer();\n this.delete_list = [];\n this.redrawActive = true;\n\n if (_renkan.options.show_minimap) {\n this.minimap = {\n background_layer: new paper.Layer(),\n edge_layer: new paper.Layer(),\n node_layer: new paper.Layer(),\n node_group: new paper.Group(),\n size: new paper.Size( _renkan.options.minimap_width, _renkan.options.minimap_height )\n };\n\n this.minimap.background_layer.activate();\n this.minimap.topleft = paper.view.bounds.bottomRight.subtract(this.minimap.size);\n this.minimap.rectangle = new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]), this.minimap.size.add([4,4]));\n this.minimap.rectangle.fillColor = _renkan.options.minimap_background_color;\n this.minimap.rectangle.strokeColor = _renkan.options.minimap_border_color;\n this.minimap.rectangle.strokeWidth = 4;\n this.minimap.offset = new paper.Point(this.minimap.size.divide(2));\n this.minimap.scale = 0.1;\n\n this.minimap.node_layer.activate();\n this.minimap.cliprectangle = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n this.minimap.node_group.addChild(this.minimap.cliprectangle);\n this.minimap.node_group.clipped = true;\n this.minimap.miniframe = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n this.minimap.node_group.addChild(this.minimap.miniframe);\n this.minimap.miniframe.fillColor = '#c0c0ff';\n this.minimap.miniframe.opacity = 0.3;\n this.minimap.miniframe.strokeColor = '#000080';\n this.minimap.miniframe.strokeWidth = 2;\n this.minimap.miniframe.__representation = new MiniFrame(this, null);\n }\n\n this.throttledPaperDraw = _(function() {\n paper.view.draw();\n }).throttle(100);\n\n this.bundles = [];\n this.click_mode = false;\n\n var _this = this,\n _allowScroll = true,\n _originalScale = 1,\n _zooming = false,\n _lastTapX = 0,\n _lastTapY = 0;\n\n this.image_cache = {};\n this.icon_cache = {};\n\n ['edit', 'remove', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {\n var img = new Image();\n img.src = _renkan.options.static_url + 'img/' + imgname + '.png';\n _this.icon_cache[imgname] = img;\n });\n\n var throttledMouseMove = _.throttle(function(_event, _isTouch) {\n _this.onMouseMove(_event, _isTouch);\n }, Utils._MOUSEMOVE_RATE);\n\n this.canvas_$.on({\n mousedown: function(_event) {\n _event.preventDefault();\n _this.onMouseDown(_event, false);\n },\n mousemove: function(_event) {\n _event.preventDefault();\n throttledMouseMove(_event, false);\n },\n mouseup: function(_event) {\n _event.preventDefault();\n _this.onMouseUp(_event, false);\n },\n mousewheel: function(_event, _delta) {\n if(_renkan.options.zoom_on_scroll) {\n _event.preventDefault();\n if (_allowScroll) {\n _this.onScroll(_event, _delta);\n }\n }\n },\n touchstart: function(_event) {\n _event.preventDefault();\n var _touches = _event.originalEvent.touches[0];\n if (\n _renkan.options.allow_double_click &&\n new Date() - _lastTap < Utils._DOUBLETAP_DELAY &&\n ( Math.pow(_lastTapX - _touches.pageX, 2) + Math.pow(_lastTapY - _touches.pageY, 2) < Utils._DOUBLETAP_DISTANCE )\n ) {\n _lastTap = 0;\n _this.onDoubleClick(_touches);\n } else {\n _lastTap = new Date();\n _lastTapX = _touches.pageX;\n _lastTapY = _touches.pageY;\n _originalScale = _this.scale;\n _zooming = false;\n _this.onMouseDown(_touches, true);\n }\n },\n touchmove: function(_event) {\n _event.preventDefault();\n _lastTap = 0;\n if (_event.originalEvent.touches.length === 1) {\n _this.onMouseMove(_event.originalEvent.touches[0], true);\n } else {\n if (!_zooming) {\n _this.onMouseUp(_event.originalEvent.touches[0], true);\n _this.click_target = null;\n _this.is_dragging = false;\n _zooming = true;\n }\n if (_event.originalEvent.scale === \"undefined\") {\n return;\n }\n var _newScale = _event.originalEvent.scale * _originalScale,\n _scaleRatio = _newScale / _this.scale,\n _newOffset = new paper.Point([\n _this.canvas_$.width(),\n _this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.offset.multiply( _scaleRatio ));\n _this.setScale(_newScale, _newOffset);\n }\n },\n touchend: function(_event) {\n _event.preventDefault();\n _this.onMouseUp(_event.originalEvent.changedTouches[0], true);\n },\n dblclick: function(_event) {\n _event.preventDefault();\n if (_renkan.options.allow_double_click) {\n _this.onDoubleClick(_event);\n }\n },\n mouseleave: function(_event) {\n _event.preventDefault();\n _this.onMouseUp(_event, false);\n _this.click_target = null;\n _this.is_dragging = false;\n },\n dragover: function(_event) {\n _event.preventDefault();\n },\n dragenter: function(_event) {\n _event.preventDefault();\n _allowScroll = false;\n },\n dragleave: function(_event) {\n _event.preventDefault();\n _allowScroll = true;\n },\n drop: function(_event) {\n _event.preventDefault();\n _allowScroll = true;\n var res = {};\n _(_event.originalEvent.dataTransfer.types).each(function(t) {\n try {\n res[t] = _event.originalEvent.dataTransfer.getData(t);\n } catch(e) {}\n });\n var text = _event.originalEvent.dataTransfer.getData(\"Text\");\n if (typeof text === \"string\") {\n switch(text[0]) {\n case \"{\":\n case \"[\":\n try {\n var data = JSON.parse(text);\n _(res).extend(data);\n }\n catch(e) {\n if (!res[\"text/plain\"]) {\n res[\"text/plain\"] = text;\n }\n }\n break;\n case \"<\":\n if (!res[\"text/html\"]) {\n res[\"text/html\"] = text;\n }\n break;\n default:\n if (!res[\"text/plain\"]) {\n res[\"text/plain\"] = text;\n }\n }\n }\n var url = _event.originalEvent.dataTransfer.getData(\"URL\");\n if (url && !res[\"text/uri-list\"]) {\n res[\"text/uri-list\"] = url;\n }\n _this.dropData(res, _event.originalEvent);\n }\n });\n\n var bindClick = function(selector, fname) {\n _this.$.find(selector).click(function(evt) {\n _this[fname](evt);\n return false;\n });\n };\n\n bindClick(\".Rk-ZoomOut\", \"zoomOut\");\n bindClick(\".Rk-ZoomIn\", \"zoomIn\");\n bindClick(\".Rk-ZoomFit\", \"autoScale\");\n this.$.find(\".Rk-ZoomSave\").click( function() {\n // Save scale and offset point\n _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset } );\n });\n this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n var view = _this.renkan.project.get(\"views\").last();\n if(view){\n _this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n }\n });\n if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n this.$.find(\".Rk-CurrentUser\").mouseenter(\n function() { _this.$.find(\".Rk-UserList\").slideDown(); }\n );\n this.$.find(\".Rk-Users\").mouseleave(\n function() { _this.$.find(\".Rk-UserList\").slideUp(); }\n );\n bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n bindClick(\".Rk-AddNode-Button\", \"addNodeBtn\");\n bindClick(\".Rk-AddEdge-Button\", \"addEdgeBtn\");\n bindClick(\".Rk-Save-Button\", \"save\");\n bindClick(\".Rk-Open-Button\", \"open\");\n bindClick(\".Rk-Export-Button\", \"exportProject\");\n this.$.find(\".Rk-Bookmarklet-Button\")\n /*jshint scripturl:true */\n .attr(\"href\",\"javascript:\" + Utils._BOOKMARKLET_CODE(_renkan))\n .click(function(){\n _this.notif_$\n .text(_renkan.translate(\"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\"))\n .fadeIn()\n .delay(5000)\n .fadeOut();\n return false;\n });\n this.$.find(\".Rk-TopBar-Button\").mouseover(function() {\n $(this).find(\".Rk-TopBar-Tooltip\").show();\n }).mouseout(function() {\n $(this).find(\".Rk-TopBar-Tooltip\").hide();\n });\n bindClick(\".Rk-Fold-Bins\", \"foldBins\");\n\n paper.view.onResize = function(_event) {\n var _ratio,\n newWidth = _event.width,\n newHeight = _event.height;\n\n if (_this.minimap) {\n _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size);\n _this.minimap.rectangle.fitBounds(_this.minimap.topleft.subtract([2,2]), _this.minimap.size.add([4,4]));\n _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size);\n }\n\n var ratioH = newHeight/(newHeight-_event.delta.height),\n ratioW = newWidth/(newWidth-_event.delta.width);\n if (newHeight < newWidth) {\n _ratio = ratioH;\n } else {\n _ratio = ratioW;\n }\n\n _this.resizeZoom(ratioW, ratioH, _ratio);\n\n _this.redraw();\n\n };\n\n var _thRedraw = _.throttle(function() {\n _this.redraw();\n },50);\n\n this.addRepresentations(\"Node\", this.renkan.project.get(\"nodes\"));\n this.addRepresentations(\"Edge\", this.renkan.project.get(\"edges\"));\n this.renkan.project.on(\"change:title\", function() {\n _this.$.find(\".Rk-PadTitle\").val(_renkan.project.get(\"title\"));\n });\n\n this.$.find(\".Rk-PadTitle\").on(\"keyup input paste\", function() {\n _renkan.project.set({\"title\": $(this).val()});\n });\n\n var _thRedrawUsers = _.throttle(function() {\n _this.redrawUsers();\n }, 100);\n\n _thRedrawUsers();\n\n // register model events\n this.renkan.project.on(\"change:save_status\", function(){\n switch (_this.renkan.project.get(\"save_status\")) {\n case 0: //clean\n _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n _this.$.find(\".Rk-Save-Button\").addClass(\"saved\");\n break;\n case 1: //dirty\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n _this.$.find(\".Rk-Save-Button\").addClass(\"to-save\");\n break;\n case 2: //saving\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n _this.$.find(\".Rk-Save-Button\").addClass(\"saving\");\n break;\n }\n });\n\n this.renkan.project.on(\"change:loading_status\", function(){\n if (_this.renkan.project.get(\"loading_status\")){\n var animate = _this.$.find(\".loader\").addClass(\"run\");\n var timer = setTimeout(function(){\n _this.$.find(\".loader\").hide(250);\n }, 3000);\n }\n });\n\n this.renkan.project.on(\"add:users remove:users\", _thRedrawUsers);\n\n this.renkan.project.on(\"add:views remove:views\", function(_node) {\n if(_this.renkan.project.get('views').length > 0) {\n _this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n else {\n _this.$.find(\".Rk-ZoomSetSaved\").hide();\n }\n });\n\n this.renkan.project.on(\"add:nodes\", function(_node) {\n _this.addRepresentation(\"Node\", _node);\n if (!_this.renkan.project.get(\"loading_status\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"add:edges\", function(_edge) {\n _this.addRepresentation(\"Edge\", _edge);\n if (!_this.renkan.project.get(\"loading_status\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"change:title\", function(_model, _title) {\n var el = _this.$.find(\".Rk-PadTitle\");\n if (el.is(\"input\")) {\n if (el.val() !== _title) {\n el.val(_title);\n }\n } else {\n el.text(_title);\n }\n });\n\n if (_renkan.options.size_bug_fix) {\n var _delay = (\n typeof _renkan.options.size_bug_fix === \"number\" ?\n _renkan.options.size_bug_fix\n : 500\n );\n window.setTimeout(\n function() {\n _this.fixSize();\n },\n _delay\n );\n }\n\n if (_renkan.options.force_resize) {\n $(window).resize(function() {\n _this.autoScale();\n });\n }\n\n if (_renkan.options.show_user_list && _renkan.options.user_color_editable) {\n var $cpwrapper = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker-Wrapper\"),\n $cplist = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker\");\n\n $cpwrapper.hover(\n function(_e) {\n if (_this.isEditable()) {\n _e.preventDefault();\n $cplist.show();\n }\n },\n function(_e) {\n _e.preventDefault();\n $cplist.hide();\n }\n );\n\n $cplist.find(\"li\").mouseenter(\n function(_e) {\n if (_this.isEditable()) {\n _e.preventDefault();\n _this.$.find(\".Rk-CurrentUser-Color\").css(\"background\", $(this).attr(\"data-color\"));\n }\n }\n );\n }\n\n if (_renkan.options.show_search_field) {\n\n var lastval = '';\n\n this.$.find(\".Rk-GraphSearch-Field\").on(\"keyup change paste input\", function() {\n var $this = $(this),\n val = $this.val();\n if (val === lastval) {\n return;\n }\n lastval = val;\n if (val.length < 2) {\n _renkan.project.get(\"nodes\").each(function(n) {\n _this.getRepresentationByModel(n).unhighlight();\n });\n } else {\n var rxs = Utils.regexpFromTextOrArray(val);\n _renkan.project.get(\"nodes\").each(function(n) {\n if (rxs.test(n.get(\"title\")) || rxs.test(n.get(\"description\"))) {\n _this.getRepresentationByModel(n).highlight(rxs);\n } else {\n _this.getRepresentationByModel(n).unhighlight();\n }\n });\n }\n });\n }\n\n this.redraw();\n\n window.setInterval(function() {\n var _now = new Date().valueOf();\n _this.delete_list.forEach(function(d) {\n if (_now >= d.time) {\n var el = _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id});\n if (el) {\n project.removeNode(el);\n }\n el = _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n if (el) {\n project.removeEdge(el);\n }\n }\n });\n _this.delete_list = _this.delete_list.filter(function(d) {\n return _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id}) || _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n });\n }, 500);\n\n if (this.minimap) {\n window.setInterval(function() {\n _this.rescaleMinimap();\n }, 2000);\n }\n\n };\n\n _(Scene.prototype).extend({\n template: _.template(\n '<% if (options.show_top_bar) { %><div class=\"Rk-TopBar\"><div class=\"loader\"></div><% if (!options.editor_mode) { %><h2 class=\"Rk-PadTitle\"><%- project.get(\"title\") || translate(\"Untitled project\")%></h2>' +\n '<% } else { %><input type=\"text\" class=\"Rk-PadTitle\" value=\"<%- project.get(\"title\") || \"\" %>\" placeholder=\"<%-translate(\"Untitled project\")%>\" /><% } %>' +\n '<% if (options.show_user_list) { %><div class=\"Rk-Users\"><div class=\"Rk-CurrentUser\"><% if (options.show_user_color) { %><div class=\"Rk-Edit-ColorPicker-Wrapper\"><span class=\"Rk-CurrentUser-Color\"><% if (options.user_color_editable) { %><span class=\"Rk-Edit-ColorTip\"></span><% } %></span>' +\n '<% if (options.user_color_editable) { print(colorPicker) } %></div><% } %><span class=\"Rk-CurrentUser-Name\"><unknown user></span></div><ul class=\"Rk-UserList\"></ul></div><% } %>' +\n '<% if (options.home_button_url) {%><div class=\"Rk-TopBar-Separator\"></div><a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"<%- options.home_button_url %>\"><div class=\"Rk-TopBar-Tooltip\"><div class=\"Rk-TopBar-Tooltip-Contents\">' +\n '<%- translate(options.home_button_title) %></div></div></a><% } %>' +\n '<% if (options.show_fullscreen_button) { %><div class=\"Rk-TopBar-Separator\"></div><div class=\"Rk-TopBar-Button Rk-FullScreen-Button\"><div class=\"Rk-TopBar-Tooltip\"><div class=\"Rk-TopBar-Tooltip-Contents\"><%-translate(\"Full Screen\")%></div></div></div><% } %>' +\n '<% if (options.editor_mode) { %>' +\n '<% if (options.show_addnode_button) { %><div class=\"Rk-TopBar-Separator\"></div><div class=\"Rk-TopBar-Button Rk-AddNode-Button\"><div class=\"Rk-TopBar-Tooltip\">' +\n '<div class=\"Rk-TopBar-Tooltip-Contents\"><%-translate(\"Add Node\")%></div></div></div><% } %>' +\n '<% if (options.show_addedge_button) { %><div class=\"Rk-TopBar-Separator\"></div><div class=\"Rk-TopBar-Button Rk-AddEdge-Button\"><div class=\"Rk-TopBar-Tooltip\">' +\n '<div class=\"Rk-TopBar-Tooltip-Contents\"><%-translate(\"Add Edge\")%></div></div></div><% } %>' +\n '<% if (options.show_export_button) { %><div class=\"Rk-TopBar-Separator\"></div><div class=\"Rk-TopBar-Button Rk-Export-Button\"><div class=\"Rk-TopBar-Tooltip\"><div class=\"Rk-TopBar-Tooltip-Contents\"><%-translate(\"Download Project\")%></div></div></div><% } %>' +\n '<% if (options.show_save_button) { %><div class=\"Rk-TopBar-Separator\"></div><div class=\"Rk-TopBar-Button Rk-Save-Button\"><div class=\"Rk-TopBar-Tooltip\"><div class=\"Rk-TopBar-Tooltip-Contents\"> </div></div></div><% } %>' +\n '<% if (options.show_open_button) { %><div class=\"Rk-TopBar-Separator\"></div><div class=\"Rk-TopBar-Button Rk-Open-Button\"><div class=\"Rk-TopBar-Tooltip\"><div class=\"Rk-TopBar-Tooltip-Contents\"><%-translate(\"Open Project\")%></div></div></div><% } %>' +\n '<% if (options.show_bookmarklet) { %><div class=\"Rk-TopBar-Separator\"></div><a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\"><div class=\"Rk-TopBar-Tooltip\"><div class=\"Rk-TopBar-Tooltip-Contents\">' +\n '<%-translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")%></div></div></a><div class=\"Rk-TopBar-Separator\"></div><% } %>' +\n '<% } else { %>' +\n '<% if (options.show_export_button) { %><div class=\"Rk-TopBar-Separator\"></div><div class=\"Rk-TopBar-Button Rk-Export-Button\"><div class=\"Rk-TopBar-Tooltip\"><div class=\"Rk-TopBar-Tooltip-Contents\"><%-translate(\"Download Project\")%></div></div></div><div class=\"Rk-TopBar-Separator\"></div><% } %>' +\n '<% };' +\n 'if (options.show_search_field) { %>' +\n '<form action=\"#\" class=\"Rk-GraphSearch-Form\"><input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"<%- translate(\"Search in graph\") %>\" /></form><div class=\"Rk-TopBar-Separator\"></div><% } %></div><% } %>' +\n '<div class=\"Rk-Editing-Space<% if (!options.show_top_bar) { %> Rk-Editing-Space-Full<% } %>\">' +\n '<div class=\"Rk-Labels\"></div><canvas class=\"Rk-Canvas\" <% if (options.resize) { %> resize=\"\" <% } %>></canvas><div class=\"Rk-Notifications\"></div><div class=\"Rk-Editor\">' +\n '<% if (options.show_bins) { %><div class=\"Rk-Fold-Bins\">«</div><% } %>' +\n '<% if (options.show_zoom) { %><div class=\"Rk-ZoomButtons\"><div class=\"Rk-ZoomIn\" title=\"<%-translate(\"Zoom In\")%>\"></div><div class=\"Rk-ZoomFit\" title=\"<%-translate(\"Zoom Fit\")%>\"></div><div class=\"Rk-ZoomOut\" title=\"<%-translate(\"Zoom Out\")%>\"></div>' +\n '<% if (options.editor_mode && options.save_view) { %><div class=\"Rk-ZoomSave\" title=\"<%-translate(\"Zoom Save\")%>\"></div><% } %>' +\n '<% if (options.save_view) { %><div class=\"Rk-ZoomSetSaved\" title=\"<%-translate(\"View saved zoom\")%>\"></div><% } %></div><% } %>' +\n '</div></div>'\n ),\n fixSize: function() {\n if( this.renkan.options.default_view && this.renkan.project.get(\"views\").length > 0) {\n var view = this.renkan.project.get(\"views\").last();\n this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n }\n else{\n this.autoScale();\n }\n },\n drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) {\n var _options = this.renkan.options,\n _startRads = _startAngle * Math.PI / 180,\n _endRads = _endAngle * Math.PI / 180,\n _img = this.icon_cache[_imgname],\n _startdx = - Math.sin(_startRads),\n _startdy = Math.cos(_startRads),\n _startXIn = Math.cos(_startRads) * _inR + _padding * _startdx,\n _startYIn = Math.sin(_startRads) * _inR + _padding * _startdy,\n _startXOut = Math.cos(_startRads) * _outR + _padding * _startdx,\n _startYOut = Math.sin(_startRads) * _outR + _padding * _startdy,\n _enddx = - Math.sin(_endRads),\n _enddy = Math.cos(_endRads),\n _endXIn = Math.cos(_endRads) * _inR - _padding * _enddx,\n _endYIn = Math.sin(_endRads) * _inR - _padding * _enddy,\n _endXOut = Math.cos(_endRads) * _outR - _padding * _enddx,\n _endYOut = Math.sin(_endRads) * _outR - _padding * _enddy,\n _centerR = (_inR + _outR) / 2,\n _centerRads = (_startRads + _endRads) / 2,\n _centerX = Math.cos(_centerRads) * _centerR,\n _centerY = Math.sin(_centerRads) * _centerR,\n _centerXIn = Math.cos(_centerRads) * _inR,\n _centerXOut = Math.cos(_centerRads) * _outR,\n _centerYIn = Math.sin(_centerRads) * _inR,\n _centerYOut = Math.sin(_centerRads) * _outR,\n _textX = Math.cos(_centerRads) * (_outR + 3),\n _textY = Math.sin(_centerRads) * (_outR + _options.buttons_label_font_size) + _options.buttons_label_font_size / 2;\n this.buttons_layer.activate();\n var _path = new paper.Path();\n _path.add([_startXIn, _startYIn]);\n _path.arcTo([_centerXIn, _centerYIn], [_endXIn, _endYIn]);\n _path.lineTo([_endXOut, _endYOut]);\n _path.arcTo([_centerXOut, _centerYOut], [_startXOut, _startYOut]);\n _path.fillColor = _options.buttons_background;\n _path.opacity = 0.5;\n _path.closed = true;\n _path.__representation = _repr;\n var _text = new paper.PointText(_textX,_textY);\n _text.characterStyle = {\n fontSize: _options.buttons_label_font_size,\n fillColor: _options.buttons_label_color\n };\n if (_textX > 2) {\n _text.paragraphStyle.justification = 'left';\n } else if (_textX < -2) {\n _text.paragraphStyle.justification = 'right';\n } else {\n _text.paragraphStyle.justification = 'center';\n }\n _text.visible = false;\n var _visible = false,\n _restPos = new paper.Point(-200, -200),\n _grp = new paper.Group([_path, _text]),\n //_grp = new paper.Group([_path]),\n _delta = _grp.position,\n _imgdelta = new paper.Point([_centerX, _centerY]),\n _currentPos = new paper.Point(0,0);\n _text.content = _caption;\n // set group pivot to not depend on text visibility that changes the group bounding box.\n _grp.pivot = _grp.bounds.center;\n _grp.visible = false;\n _grp.position = _restPos;\n var _res = {\n show: function() {\n _visible = true;\n _grp.position = _currentPos.add(_delta);\n _grp.visible = true;\n },\n moveTo: function(_point) {\n _currentPos = _point;\n if (_visible) {\n _grp.position = _point.add(_delta);\n }\n },\n hide: function() {\n _visible = false;\n _grp.visible = false;\n _grp.position = _restPos;\n },\n select: function() {\n _path.opacity = 0.8;\n _text.visible = true;\n },\n unselect: function() {\n _path.opacity = 0.5;\n _text.visible = false;\n },\n destroy: function() {\n _grp.remove();\n }\n };\n var showImage = function() {\n var _raster = new paper.Raster(_img);\n _raster.position = _imgdelta.add(_grp.position).subtract(_delta);\n _raster.locked = true; // Disable mouse events on icon\n _grp.addChild(_raster);\n };\n if (_img.width) {\n showImage();\n } else {\n $(_img).on(\"load\",showImage);\n }\n\n return _res;\n },\n addToBundles: function(_edgeRepr) {\n var _bundle = _(this.bundles).find(function(_bundle) {\n return (\n ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation ) ||\n ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation )\n );\n });\n if (typeof _bundle !== \"undefined\") {\n _bundle.edges.push(_edgeRepr);\n } else {\n _bundle = {\n from: _edgeRepr.from_representation,\n to: _edgeRepr.to_representation,\n edges: [ _edgeRepr ],\n getPosition: function(_er) {\n var _dir = (_er.from_representation === this.from) ? 1 : -1;\n return _dir * ( _(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 );\n }\n };\n this.bundles.push(_bundle);\n }\n return _bundle;\n },\n isEditable: function() {\n return (this.renkan.options.editor_mode && !this.renkan.read_only);\n },\n onStatusChange: function() {\n var savebtn = this.$.find(\".Rk-Save-Button\"),\n tip = savebtn.find(\".Rk-TopBar-Tooltip-Contents\");\n if (this.renkan.read_only) {\n savebtn.removeClass(\"disabled Rk-Save-Online\").addClass(\"Rk-Save-ReadOnly\");\n tip.text(this.renkan.translate(\"Connection lost\"));\n } else {\n if (this.renkan.options.manual_save) {\n savebtn.removeClass(\"Rk-Save-ReadOnly Rk-Save-Online\");\n tip.text(this.renkan.translate(\"Save Project\"));\n } else {\n savebtn.removeClass(\"disabled Rk-Save-ReadOnly\").addClass(\"Rk-Save-Online\");\n tip.text(this.renkan.translate(\"Auto-save enabled\"));\n }\n }\n this.redrawUsers();\n },\n setScale: function(_newScale, _offset) {\n if ((_newScale/this.initialScale) > Utils._MIN_SCALE && (_newScale/this.initialScale) < Utils._MAX_SCALE) {\n this.scale = _newScale;\n if (_offset) {\n this.offset = _offset;\n }\n this.redraw();\n }\n },\n autoScale: function(force_view) {\n var nodes = this.renkan.project.get(\"nodes\");\n if (nodes.length > 1) {\n var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n _minx = Math.min.apply(Math, _xx),\n _miny = Math.min.apply(Math, _yy),\n _maxx = Math.max.apply(Math, _xx),\n _maxy = Math.max.apply(Math, _yy);\n var _scale = Math.min( (paper.view.size.width - 2 * this.renkan.options.autoscale_padding) / (_maxx - _minx), (paper.view.size.height - 2 * this.renkan.options.autoscale_padding) / (_maxy - _miny));\n this.initialScale = _scale;\n // Override calculated scale if asked\n if((typeof force_view !== \"undefined\") && parseFloat(force_view.zoom_level)>0 && parseFloat(force_view.offset.x)>0 && parseFloat(force_view.offset.y)>0){\n this.setScale(parseFloat(force_view.zoom_level), new paper.Point(parseFloat(force_view.offset.x), parseFloat(force_view.offset.y)));\n }\n else{\n this.setScale(_scale, paper.view.center.subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale)));\n }\n }\n if (nodes.length === 1) {\n this.setScale(1, paper.view.center.subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y])));\n }\n },\n redrawMiniframe: function() {\n var topleft = this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),\n bottomright = this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));\n this.minimap.miniframe.fitBounds(topleft, bottomright);\n },\n rescaleMinimap: function() {\n var nodes = this.renkan.project.get(\"nodes\");\n if (nodes.length > 1) {\n var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n _minx = Math.min.apply(Math, _xx),\n _miny = Math.min.apply(Math, _yy),\n _maxx = Math.max.apply(Math, _xx),\n _maxy = Math.max.apply(Math, _yy);\n var _scale = Math.min(\n this.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n this.scale * 0.8 * this.renkan.options.minimap_height / paper.view.bounds.height,\n ( this.renkan.options.minimap_width - 2 * this.renkan.options.minimap_padding ) / (_maxx - _minx),\n ( this.renkan.options.minimap_height - 2 * this.renkan.options.minimap_padding ) / (_maxy - _miny)\n );\n this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale));\n this.minimap.scale = _scale;\n }\n if (nodes.length === 1) {\n this.minimap.scale = 0.1;\n this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y]).multiply(this.minimap.scale));\n }\n this.redraw();\n },\n toPaperCoords: function(_point) {\n return _point.multiply(this.scale).add(this.offset);\n },\n toMinimapCoords: function(_point) {\n return _point.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft);\n },\n toModelCoords: function(_point) {\n return _point.subtract(this.offset).divide(this.scale);\n },\n addRepresentation: function(_type, _model) {\n var RendererType = requtils.getRenderer()[_type];\n var _repr = new RendererType(this, _model);\n this.representations.push(_repr);\n return _repr;\n },\n addRepresentations: function(_type, _collection) {\n var _this = this;\n _collection.forEach(function(_model) {\n _this.addRepresentation(_type, _model);\n });\n },\n userTemplate: _.template(\n '<li class=\"Rk-User\"><span class=\"Rk-UserColor\" style=\"background:<%=background%>;\"></span><%=name%></li>'\n ),\n redrawUsers: function() {\n if (!this.renkan.options.show_user_list) {\n return;\n }\n var allUsers = [].concat((this.renkan.project.current_user_list || {}).models || [], (this.renkan.project.get(\"users\") || {}).models || []),\n ulistHtml = '',\n $userpanel = this.$.find(\".Rk-Users\"),\n $name = $userpanel.find(\".Rk-CurrentUser-Name\"),\n $cpitems = $userpanel.find(\".Rk-Edit-ColorPicker li\"),\n $colorsquare = $userpanel.find(\".Rk-CurrentUser-Color\"),\n _this = this;\n $name.off(\"click\").text(this.renkan.translate(\"<unknown user>\"));\n $cpitems.off(\"mouseleave click\");\n allUsers.forEach(function(_user) {\n if (_user.get(\"_id\") === _this.renkan.current_user) {\n $name.text(_user.get(\"title\"));\n $colorsquare.css(\"background\", _user.get(\"color\"));\n if (_this.isEditable()) {\n\n if (_this.renkan.options.user_name_editable) {\n $name.click(function() {\n var $this = $(this),\n $input = $('<input>').val(_user.get(\"title\")).blur(function() {\n _user.set(\"title\", $(this).val());\n _this.redrawUsers();\n _this.redraw();\n });\n $this.empty().html($input);\n $input.select();\n });\n }\n\n if (_this.renkan.options.user_color_editable) {\n $cpitems.click(\n function(_e) {\n _e.preventDefault();\n if (_this.isEditable()) {\n _user.set(\"color\", $(this).attr(\"data-color\"));\n }\n $(this).parent().hide();\n }\n ).mouseleave(function() {\n $colorsquare.css(\"background\", _user.get(\"color\"));\n });\n }\n }\n\n } else {\n ulistHtml += _this.userTemplate({\n name: _user.get(\"title\"),\n background: _user.get(\"color\")\n });\n }\n });\n $userpanel.find(\".Rk-UserList\").html(ulistHtml);\n },\n removeRepresentation: function(_representation) {\n _representation.destroy();\n this.representations = _(this.representations).reject(\n function(_repr) {\n return _repr === _representation;\n }\n );\n },\n getRepresentationByModel: function(_model) {\n if (!_model) {\n return undefined;\n }\n return _(this.representations).find(function(_repr) {\n return _repr.model === _model;\n });\n },\n removeRepresentationsOfType: function(_type) {\n var _representations = _(this.representations).filter(function(_repr) {\n return _repr.type === _type;\n }),\n _this = this;\n _(_representations).each(function(_repr) {\n _this.removeRepresentation(_repr);\n });\n },\n highlightModel: function(_model) {\n var _repr = this.getRepresentationByModel(_model);\n if (_repr) {\n _repr.highlight();\n }\n },\n unhighlightAll: function(_model) {\n _(this.representations).each(function(_repr) {\n _repr.unhighlight();\n });\n },\n unselectAll: function(_model) {\n _(this.representations).each(function(_repr) {\n _repr.unselect();\n });\n },\n redraw: function() {\n if(! this.redrawActive ) {\n return;\n }\n _(this.representations).each(function(_representation) {\n _representation.redraw(true);\n });\n if (this.minimap) {\n this.redrawMiniframe();\n }\n paper.view.draw();\n },\n addTempEdge: function(_from, _point) {\n var _tmpEdge = this.addRepresentation(\"TempEdge\",null);\n _tmpEdge.end_pos = _point;\n _tmpEdge.from_representation = _from;\n _tmpEdge.redraw();\n this.click_target = _tmpEdge;\n },\n findTarget: function(_hitResult) {\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n var _newTarget = _hitResult.item.__representation;\n if (this.selected_target !== _hitResult.item.__representation) {\n if (this.selected_target) {\n this.selected_target.unselect(_newTarget);\n }\n _newTarget.select(this.selected_target);\n this.selected_target = _newTarget;\n }\n } else {\n if (this.selected_target) {\n this.selected_target.unselect();\n }\n this.selected_target = null;\n }\n },\n paperShift: function(_delta) {\n this.offset = this.offset.add(_delta);\n this.redraw();\n },\n onMouseMove: function(_event) {\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]),\n _delta = _point.subtract(this.last_point);\n this.last_point = _point;\n if (!this.is_dragging && this.mouse_down && _delta.length > Utils._MIN_DRAG_DISTANCE) {\n this.is_dragging = true;\n }\n var _hitResult = paper.project.hitTest(_point);\n if (this.is_dragging) {\n if (this.click_target && typeof this.click_target.paperShift === \"function\") {\n this.click_target.paperShift(_delta);\n } else {\n this.paperShift(_delta);\n }\n } else {\n this.findTarget(_hitResult);\n }\n paper.view.draw();\n },\n onMouseDown: function(_event, _isTouch) {\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]);\n this.last_point = _point;\n this.mouse_down = true;\n if (!this.click_target || this.click_target.type !== \"Temp-edge\") {\n this.removeRepresentationsOfType(\"editor\");\n this.is_dragging = false;\n var _hitResult = paper.project.hitTest(_point);\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n this.click_target = _hitResult.item.__representation;\n this.click_target.mousedown(_event, _isTouch);\n } else {\n this.click_target = null;\n if (this.isEditable() && this.click_mode === Utils._CLICKMODE_ADDNODE) {\n var _coords = this.toModelCoords(_point),\n _data = {\n id: Utils.getUID('node'),\n created_by: this.renkan.current_user,\n position: {\n x: _coords.x,\n y: _coords.y\n }\n };\n _node = this.renkan.project.addNode(_data);\n this.getRepresentationByModel(_node).openEditor();\n }\n }\n }\n if (this.click_mode) {\n if (this.isEditable() && this.click_mode === Utils._CLICKMODE_STARTEDGE && this.click_target && this.click_target.type === \"Node\") {\n this.removeRepresentationsOfType(\"editor\");\n this.addTempEdge(this.click_target, _point);\n this.click_mode = Utils._CLICKMODE_ENDEDGE;\n this.notif_$.fadeOut(function() {\n $(this).html(this.renkan.translate(\"Click on a second node to complete the edge\")).fadeIn();\n });\n } else {\n this.notif_$.hide();\n this.click_mode = false;\n }\n }\n paper.view.draw();\n },\n onMouseUp: function(_event, _isTouch) {\n this.mouse_down = false;\n if (this.click_target) {\n var _off = this.canvas_$.offset();\n this.click_target.mouseup(\n {\n point: new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ])\n },\n _isTouch\n );\n } else {\n this.click_target = null;\n this.is_dragging = false;\n if (_isTouch) {\n this.unselectAll();\n }\n }\n paper.view.draw();\n },\n onScroll: function(_event, _scrolldelta) {\n this.totalScroll += _scrolldelta;\n if (Math.abs(this.totalScroll) >= 1) {\n var _off = this.canvas_$.offset(),\n _delta = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]).subtract(this.offset).multiply( Math.SQRT2 - 1 );\n if (this.totalScroll > 0) {\n this.setScale( this.scale * Math.SQRT2, this.offset.subtract(_delta) );\n } else {\n this.setScale( this.scale * Math.SQRT1_2, this.offset.add(_delta.divide(Math.SQRT2)));\n }\n this.totalScroll = 0;\n }\n },\n onDoubleClick: function(_event) {\n if (!this.isEditable()) {\n return;\n }\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]);\n var _hitResult = paper.project.hitTest(_point);\n if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === \"undefined\")) {\n var _coords = this.toModelCoords(_point),\n _data = {\n id: Utils.getUID('node'),\n created_by: this.renkan.current_user,\n position: {\n x: _coords.x,\n y: _coords.y\n }\n },\n _node = this.renkan.project.addNode(_data);\n this.getRepresentationByModel(_node).openEditor();\n }\n paper.view.draw();\n },\n defaultDropHandler: function(_data) {\n var newNode = {};\n var snippet = \"\";\n switch(_data[\"text/x-iri-specific-site\"]) {\n case \"twitter\":\n snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n var tweetdiv = snippet.find(\".tweet\");\n newNode.title = this.renkan.translate(\"Tweet by \") + tweetdiv.attr(\"data-name\");\n newNode.uri = \"http://twitter.com/\" + tweetdiv.attr(\"data-screen-name\") + \"/status/\" + tweetdiv.attr(\"data-tweet-id\");\n newNode.image = tweetdiv.find(\".avatar\").attr(\"src\");\n newNode.description = tweetdiv.find(\".js-tweet-text:first\").text();\n break;\n case \"google\":\n snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n newNode.title = snippet.find(\"h3:first\").text().trim();\n newNode.uri = snippet.find(\"h3 a\").attr(\"href\");\n newNode.description = snippet.find(\".st:first\").text().trim();\n break;\n default:\n if (_data[\"text/x-iri-source-uri\"]) {\n newNode.uri = _data[\"text/x-iri-source-uri\"];\n }\n }\n if (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]) {\n newNode.description = (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]).replace(/[\\s\\n]+/gm,' ').trim();\n }\n if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n var _svgimgs = snippet.find(\"image\");\n if (_svgimgs.length) {\n newNode.image = _svgimgs.attr(\"xlink:href\");\n }\n var _svgpaths = snippet.find(\"path\");\n if (_svgpaths.length) {\n newNode.clipPath = _svgpaths.attr(\"d\");\n }\n var _imgs = snippet.find(\"img\");\n if (_imgs.length) {\n newNode.image = _imgs[0].src;\n }\n var _as = snippet.find(\"a\");\n if (_as.length) {\n newNode.uri = _as[0].href;\n }\n newNode.title = snippet.find(\"[title]\").attr(\"title\") || newNode.title;\n newNode.description = snippet.text().replace(/[\\s\\n]+/gm,' ').trim();\n }\n if (_data[\"text/uri-list\"]) {\n newNode.uri = _data[\"text/uri-list\"];\n }\n if (_data[\"text/x-moz-url\"] && !newNode.title) {\n newNode.title = (_data[\"text/x-moz-url\"].split(\"\\n\")[1] || \"\").trim();\n if (newNode.title === newNode.uri) {\n newNode.title = false;\n }\n }\n if (_data[\"text/x-iri-source-title\"] && !newNode.title) {\n newNode.title = _data[\"text/x-iri-source-title\"];\n }\n if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n newNode.image = snippet.find(\"[data-image]\").attr(\"data-image\") || newNode.image;\n newNode.uri = snippet.find(\"[data-uri]\").attr(\"data-uri\") || newNode.uri;\n newNode.title = snippet.find(\"[data-title]\").attr(\"data-title\") || newNode.title;\n newNode.description = snippet.find(\"[data-description]\").attr(\"data-description\") || newNode.description;\n newNode.clipPath = snippet.find(\"[data-clip-path]\").attr(\"data-clip-path\") || newNode.clipPath;\n }\n\n if (!newNode.title) {\n newNode.title = this.renkan.translate(\"Dragged resource\");\n }\n var fields = [\"title\", \"description\", \"uri\", \"image\"];\n for (var i = 0; i < fields.length; i++) {\n var f = fields[i];\n if (_data[\"text/x-iri-\" + f] || _data[f]) {\n newNode[f] = _data[\"text/x-iri-\" + f] || _data[f];\n }\n if (newNode[f] === \"none\" || newNode[f] === \"null\") {\n newNode[f] = undefined;\n }\n }\n\n if(typeof this.renkan.options.drop_enhancer === \"function\"){\n newNode = this.renkan.options.drop_enhancer(newNode, _data);\n }\n\n return newNode;\n\n },\n dropData: function(_data, _event) {\n if (!this.isEditable()) {\n return;\n }\n if (_data[\"text/json\"] || _data[\"application/json\"]) {\n try {\n var jsondata = JSON.parse(_data[\"text/json\"] || _data[\"application/json\"]);\n _(_data).extend(jsondata);\n }\n catch(e) {}\n }\n\n var newNode = (typeof this.renkan.options.drop_handler === \"undefined\")?this.defaultDropHandler(_data):this.renkan.options.drop_handler(_data);\n\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]),\n _coords = this.toModelCoords(_point),\n _nodedata = {\n id: Utils.getUID('node'),\n created_by: this.renkan.current_user,\n uri: newNode.uri || \"\",\n title: newNode.title || \"\",\n description: newNode.description || \"\",\n image: newNode.image || \"\",\n color: newNode.color || undefined,\n clip_path: newNode.clipPath || undefined,\n position: {\n x: _coords.x,\n y: _coords.y\n }\n };\n var _node = this.renkan.project.addNode(_nodedata),\n _repr = this.getRepresentationByModel(_node);\n if (_event.type === \"drop\") {\n _repr.openEditor();\n }\n },\n fullScreen: function() {\n var _isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen,\n _el = this.renkan.$[0],\n _requestMethods = [\"requestFullScreen\",\"mozRequestFullScreen\",\"webkitRequestFullScreen\"],\n _cancelMethods = [\"cancelFullScreen\",\"mozCancelFullScreen\",\"webkitCancelFullScreen\"],\n i;\n if (_isFull) {\n for (i = 0; i < _cancelMethods.length; i++) {\n if (typeof document[_cancelMethods[i]] === \"function\") {\n document[_cancelMethods[i]]();\n break;\n }\n }\n var widthAft = this.$.width();\n var heightAft = this.$.height();\n\n if (this.renkan.options.show_top_bar) {\n heightAft -= this.$.find(\".Rk-TopBar\").height();\n }\n if (this.renkan.options.show_bins && (this.renkan.$.find(\".Rk-Bins\").position().left > 0)) {\n widthAft -= this.renkan.$.find(\".Rk-Bins\").width();\n }\n\n paper.view.viewSize = new paper.Size([widthAft, heightAft]);\n\n } else {\n for (i = 0; i < _requestMethods.length; i++) {\n if (typeof _el[_requestMethods[i]] === \"function\") {\n _el[_requestMethods[i]]();\n break;\n }\n }\n this.redraw();\n }\n },\n zoomOut: function() {\n var _newScale = this.scale * Math.SQRT1_2,\n _offset = new paper.Point([\n this.canvas_$.width(),\n this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT1_2 ) ).add(this.offset.multiply( Math.SQRT1_2 ));\n this.setScale( _newScale, _offset );\n },\n zoomIn: function() {\n var _newScale = this.scale * Math.SQRT2,\n _offset = new paper.Point([\n this.canvas_$.width(),\n this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n this.setScale( _newScale, _offset );\n },\n resizeZoom: function(_scaleWidth, _scaleHeight, _ratio) {\n var _newScale = this.scale * _ratio,\n _offset = new paper.Point([\n (this.offset.x * _scaleWidth),\n (this.offset.y * _scaleHeight)\n ]);\n this.setScale( _newScale, _offset );\n },\n addNodeBtn: function() {\n if (this.click_mode === Utils._CLICKMODE_ADDNODE) {\n this.click_mode = false;\n this.notif_$.hide();\n } else {\n this.click_mode = Utils._CLICKMODE_ADDNODE;\n this.notif_$.text(this.renkan.translate(\"Click on the background canvas to add a node\")).fadeIn();\n }\n return false;\n },\n addEdgeBtn: function() {\n if (this.click_mode === Utils._CLICKMODE_STARTEDGE || this.click_mode === Utils._CLICKMODE_ENDEDGE) {\n this.click_mode = false;\n this.notif_$.hide();\n } else {\n this.click_mode = Utils._CLICKMODE_STARTEDGE;\n this.notif_$.text(this.renkan.translate(\"Click on a first node to start the edge\")).fadeIn();\n }\n return false;\n },\n exportProject: function() {\n var projectJSON = this.renkan.project.toJSON(),\n downloadLink = document.createElement(\"a\"),\n projectId = projectJSON.id,\n fileNameToSaveAs = projectId + \".json\";\n\n // clean ids\n delete projectJSON.id;\n delete projectJSON._id;\n delete projectJSON.space_id;\n\n var objId;\n var idsMap = {};\n\n _.each(projectJSON.nodes, function(e,i,l) {\n objId = e.id || e._id;\n delete e._id;\n delete e.id;\n idsMap[objId] = e['@id'] = Utils.getUUID4();\n });\n _.each(projectJSON.edges, function(e,i,l) {\n delete e._id;\n delete e.id;\n e.to = idsMap[e.to];\n e.from = idsMap[e.from];\n });\n _.each(projectJSON.views, function(e,i,l) {\n objId = e.id || e._id;\n delete e._id;\n delete e.id;\n });\n projectJSON.users = [];\n\n var projectJSONStr = JSON.stringify(projectJSON, null, 2);\n var blob = new Blob([projectJSONStr], {type: \"application/json;charset=utf-8\"});\n filesaver(blob,fileNameToSaveAs);\n\n },\n foldBins: function() {\n var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n bins = this.renkan.$.find(\".Rk-Bins\");\n var _this = this,\n sizeBef = _this.canvas_$.width(),\n sizeAft;\n if (bins.position().left < 0) {\n bins.animate({left: 0},250);\n this.$.animate({left: 300},250,function() {\n var w = _this.$.width();\n paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n });\n if ((sizeBef - bins.width()) < bins.height()){\n sizeAft = sizeBef;\n } else {\n sizeAft = sizeBef - bins.width();\n }\n foldBinsButton.html(\"«\");\n } else {\n bins.animate({left: -300},250);\n this.$.animate({left: 0},250,function() {\n var w = _this.$.width();\n paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n });\n sizeAft = sizeBef+300;\n foldBinsButton.html(\"»\");\n }\n _this.resizeZoom(1, 1, (sizeAft/sizeBef));\n },\n save: function() { },\n open: function() { }\n });\n\n /* Scene End */\n\n return Scene;\n\n});\n\n\n//Load modules and use them\nif( typeof require.config === \"function\" ) {\n require.config({\n paths: {\n 'jquery':'../lib/jquery/jquery',\n 'underscore':'../lib/underscore/underscore',\n 'filesaver' :'../lib/FileSaver/FileSaver',\n 'requtils':'require-utils'\n }\n });\n}\n\nrequire(['renderer/baserepresentation',\n 'renderer/basebutton',\n 'renderer/noderepr',\n 'renderer/edge',\n 'renderer/tempedge',\n 'renderer/baseeditor',\n 'renderer/nodeeditor',\n 'renderer/edgeeditor',\n 'renderer/nodebutton',\n 'renderer/nodeeditbutton',\n 'renderer/noderemovebutton',\n 'renderer/noderevertbutton',\n 'renderer/nodelinkbutton',\n 'renderer/nodeenlargebutton',\n 'renderer/nodeshrinkbutton',\n 'renderer/edgeeditbutton',\n 'renderer/edgeremovebutton',\n 'renderer/edgerevertbutton',\n 'renderer/miniframe',\n 'renderer/scene'\n ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){\n\n \n\n var Rkns = window.Rkns;\n\n if(typeof Rkns.Renderer === \"undefined\"){\n Rkns.Renderer = {};\n }\n var Renderer = Rkns.Renderer;\n\n Renderer._BaseRepresentation = BaseRepresentation;\n Renderer._BaseButton = BaseButton;\n Renderer.Node = NodeRepr;\n Renderer.Edge = Edge;\n Renderer.TempEdge = TempEdge;\n Renderer._BaseEditor = BaseEditor;\n Renderer.NodeEditor = NodeEditor;\n Renderer.EdgeEditor = EdgeEditor;\n Renderer._NodeButton = NodeButton;\n Renderer.NodeEditButton = NodeEditButton;\n Renderer.NodeRemoveButton = NodeRemoveButton;\n Renderer.NodeRevertButton = NodeRevertButton;\n Renderer.NodeLinkButton = NodeLinkButton;\n Renderer.NodeEnlargeButton = NodeEnlargeButton;\n Renderer.NodeShrinkButton = NodeShrinkButton;\n Renderer.EdgeEditButton = EdgeEditButton;\n Renderer.EdgeRemoveButton = EdgeRemoveButton;\n Renderer.EdgeRevertButton = EdgeRevertButton;\n Renderer.MiniFrame = MiniFrame;\n Renderer.Scene = Scene;\n\n startRenkan();\n});\n\ndefine(\"main-renderer\", function(){});\n\n"]}
\ No newline at end of file
+{"version":3,"file":"renkan.min.js","sources":["../../js/main.js","../../js/models.js","../../js/defaults.js","../../js/i18n.js","../../js/full-json.js","../../js/save-once.js","../../js/ldtjson-bin.js","../../js/list-bin.js","../../js/wikipedia-bin.js","paper-renderer.js","templates.js"],"names":["root","Rkns","$","jQuery","_","pickerColors","__renkans","_BaseBin","_renkan","_opts","this","renkan","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","title","translate","html","click","destroy","length","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","prototype","detach","Renkan","push","options","defaults","templates","renkanJST","property_files","each","f","getJSON","data","properties","concat","read_only","editor_mode","project","Models","Project","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","template","tabs","search_engines","current_user_list","UsersList","on","colorPicker","_tmpl","map","c","join","show_editor","Renderer","Scene","search","_select","_input","_form","_search","type","Search","_key","key","getSearchTitle","className","getBgClass","_el","setSearchEngine","submit","val","search_engine","mouseenter","mouseleave","bins","_bin","Bin","elementDropped","_mainDiv","siblings","is","slideUp","_t","_models","get","where","uri","_model","highlightModel","mouseout","unhighlightAll","dragDrop","err","e","preventDefault","touch","originalEvent","changedTouches","off","canvas_$","offset","w","width","h","height","pageX","left","pageY","top","onMouseMove","div","document","createElement","appendChild","cloneNode","dropData","text/html","innerHTML","onMouseDown","onMouseUp","dataTransfer","setData","resize","lastsearch","lastval","Utils","regexpFromTextOrArray","source","tab","render","_text","i18n","language","substr","onStatusChange","listClasses","split","classes","i","_d","outerHeight","css","getUUID4","replace","r","Math","random","v","toString","getUID","pad","n","Date","ID_AUTO_INCREMENT","ID_BASE","getUTCFullYear","getUTCMonth","getUTCDate","_base","_n","_uidbase","getFullURL","url","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","Array","slice","call","arguments","_init","_initialized","extend","replaceText","makeReplaceFunc","l","k","charsrx","txt","toLowerCase","remrx","j","remsrc","charsub","getSource","inp","removeChars","String","fromCharCode","RegExp","_textOrArray","testrx","replacerx","isempty","_replace","text","_MIN_DRAG_DISTANCE","_NODE_BUTTON_WIDTH","_EDGE_BUTTON_INNER","_EDGE_BUTTON_OUTER","_CLICKMODE_ADDNODE","_CLICKMODE_STARTEDGE","_CLICKMODE_ENDEDGE","_NODE_SIZE_STEP","LN2","_MIN_SCALE","_MAX_SCALE","_MOUSEMOVE_RATE","_DOUBLETAP_DELAY","_DOUBLETAP_DISTANCE","_USER_PLACEHOLDER","color","default_user_color","_BOOKMARKLET_CODE","shortenText","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","size","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","Backbone","obj","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","description","prepare","validate","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","image","clip_path","shape","Edge","from","to","View","isArray","zoom_level","RosterUser","blacklist","HasMany","reverseRelation","includeInJSON","_props","_user","findOrCreate","addNode","_node","addEdge","_edge","addView","_view","removeNode","remove","removeEdge","_project","users","nodes","edges","views","_item","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","static_url","show_bins","manual_save","show_top_bar","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","show_zoom","save_view","default_view","show_search_field","show_user_list","user_name_editable","user_color_editable","show_user_color","show_save_button","show_export_button","show_open_button","show_addnode_button","show_addedge_button","show_bookmarklet","show_fullscreen_button","home_button_url","home_button_title","show_minimap","minimap_width","minimap_height","minimap_padding","minimap_background_color","minimap_border_color","minimap_highlight_color","minimap_highlight_weight","buttons_background","buttons_label_color","buttons_label_font_size","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","selected_node_stroke_width","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","change_shapes","edge_stroke_width","selected_edge_stroke_width","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","show_node_editor_uri","show_node_editor_description","show_node_editor_size","show_node_editor_color","show_node_editor_image","show_node_editor_creator","allow_image_upload","uploaded_image_max_kb","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_color","show_node_tooltip_image","show_node_tooltip_creator","show_edge_editor_uri","show_edge_editor_color","show_edge_editor_direction","show_edge_editor_nodes","show_edge_editor_creator","show_edge_tooltip_uri","show_edge_tooltip_color","show_edge_tooltip_nodes","show_edge_tooltip_creator","fr","Edit Node","Edit Edge","Title:","URI:","Description:","From:","To:","Image URL:","Choose Image File:","Full Screen","Add Node","Add Edge","Save Project","Open Project","Auto-save enabled","Connection lost","Created by:","Zoom In","Zoom Out","Edit","Remove","Cancel deletion","Link to another node","Enlarge","Shrink","Click on the background canvas to add a node","Click on a first node to start the edge","Click on a second node to complete the edge","Wikipedia","Wikipedia in ","French","English","Japanese","Untitled project","Lignes de Temps","Loading, please wait","Edge color:","Node color:","Choose color","Change edge direction","Do you really wish to remove node ","Do you really wish to remove edge ","This file is not an image","Image size must be under ","Size:","KB","Choose from vocabulary:","SKOS Documentation properties","has note","has example","has definition","SKOS Semantic relations","has broader","has narrower","has related","Dublin Core Metadata","has contributor","covers","created by","has date","published by","has source","has subject","Dragged resource","Search the Web","Search in Bins","Close bin","Refresh bin","(untitled)","Select contents:","Drag items from this website, drop them in Renkan","Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.","Shapes available","Circle","Square","Diamond","Hexagone","Ellipse","Star","Zoom Fit","Download Project","Zoom Save","View saved zoom","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","jsonIO","_proj","http_method","_load","redrawActive","set","loading_status","_data","save_status","fixSize","_save","ajax","contentType","JSON","stringify","success","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","autoScale","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","escape","convertTC","_ms","_res","_totalSeconds","abs","floor","_hours","_minutes","_seconds","_html","_projtitle","meta","count","tags","_tag","_title","htitle","encodedtitle","encodeURIComponent","annotations","_annotation","_description","content","_duration","end","begin","_img","hdescription","start","duration","mediaid","media","annotationid","show","dataType","lang","_q","ResultsBin","segmentTemplate","max_results","highlightrx","objects","_segment","_begin","start_ts","_end","iri_id","element_id","format","q","limit","ResourceList","resultTemplate","list","trim","_match","langs","en","ja","query","_result","encodeURI","snippet","define","_BaseRepresentation","_renderer","_changeBinding","redraw","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","rotate","star","svg","path","ShapeBuilder","NodeRepr","node_layer","activate","buildShape","strokeWidth","h_ratio","labels_$","normal_buttons","NodeEditButton","NodeRemoveButton","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","pending_delete_buttons","NodeRevertButton","all_buttons","active_buttons","last_circle_radius","minimap","minimap_circle","__representation","miniframe","node_group","addChild","shapeBuilder","_dontRedrawEdges","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","scale","forEach","b","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_color","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","ed","edge","repr","getRepresentationByModel","from_representation","to_representation","_image","image_cache","clipPath","hasClipPath","_clip","baseRadius","centerPoint","instructions","lastCoords","minX","Infinity","minY","maxX","maxY","transformCoords","tabc","relative","newCoords","parseFloat","isY","instr","coords","lineTo","cubicCurveTo","quadraticCurveTo","_raster","Raster","locked","Group","clipped","_circleClip","divide","throttledPaperDraw","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","hideButtons","buttons_timeout","undefined","textToReplace","hlvalue","saveCoords","toModelCoords","_event","_isTouch","unselectAll","click_target","edge_layer","bundle","addToBundles","line","arrow","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","handleIn","handleOut","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","item","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","node","has_creator","short_uri","image_placeholder","created_by_color","created_by_title","closeEditor","onFieldChange","shape_changed","keyCode","change","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","titlehtml","load","EdgeEditor","_from_model","_to_model","from_title","to_title","from_color","to_color","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","clearTimeout","NodeButton","delid","delete_list","time","valueOf","confirm","unset","_off","_point","addTempEdge","MiniFrame","filesaver","representations","notif_$","setup","initialScale","totalScroll","mouse_down","selected_target","Layer","background_layer","topleft","bounds","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","_lastTap","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","types","t","getData","parse","bindClick","selector","fname","evt","last","fadeIn","delay","fadeOut","mouseover","onResize","_ratio","newWidth","newHeight","ratioH","delta","ratioW","resizeZoom","_thRedraw","addRepresentations","_thRedrawUsers","el","_delay","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","_repr","_inR","_outR","_startAngle","_endAngle","_padding","_imgname","_caption","_startRads","PI","_endRads","_startdx","sin","_startdy","cos","_startXIn","_startYIn","_startXOut","_startYOut","_enddx","_enddy","_endXIn","_endYIn","_endXOut","_endYOut","_centerR","_centerRads","_centerX","_centerY","_centerXIn","_centerXOut","_centerYIn","_centerYOut","_textX","_textY","arcTo","PointText","characterStyle","fontSize","paragraphStyle","justification","visible","_visible","_restPos","_grp","_imgdelta","_currentPos","pivot","_edgeRepr","_bundle","_er","_dir","indexOf","savebtn","tip","_offset","force_view","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","redrawMiniframe","bottomright","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","blur","empty","parent","name","background","_representation","_representations","_from","_tmpEdge","last_point","_scrolldelta","SQRT2","SQRT1_2","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","_isFull","mozFullScreen","webkitIsFullScreen","_requestMethods","_cancelMethods","widthAft","heightAft","viewSize","zoomOut","zoomIn","_scaleWidth","_scaleHeight","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","foldBins","sizeAft","foldBinsButton","sizeBef","animate","open","require","config","paths","jquery","underscore","startRenkan","__t","__p","__e","ontology","label","property","print","__j"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;CAGA,SAAUA,GAEV,YAEyB,iBAAdA,GAAKC,OACZD,EAAKC,QAGT,IAAIA,GAAOD,EAAKC,KACZC,EAAID,EAAKC,EAAIF,EAAKG,OAClBC,EAAIH,EAAKG,EAAIJ,EAAKI,CAEtBH,GAAKI,cAAgB,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC9F,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC7E,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC7E,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC7E,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC7E,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAC7E,UAAW,UAAW,UAAW,UAAW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YACpC8vB,KAAO,0CACPC,IAAIjlC,UAAU,cACd,kBAEAglC,KAAO,SACF9jC,QAAQgU,YACb8vB,KAAO,8CACPC,IAAIjlC,UAAU,oBACd,kBAEAglC,KAAO,mBAEPA,KAAO,mBAGP,OAAOA","sourcesContent":["\n/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n\"use strict\";\n\nif (typeof root.Rkns !== \"object\") {\n root.Rkns = {};\n}\n\nvar Rkns = root.Rkns;\nvar $ = Rkns.$ = root.jQuery;\nvar _ = Rkns._ = root._;\n\nRkns.pickerColors = [\"#8f1919\", \"#a80000\", \"#d82626\", \"#ff0000\", \"#e87c7c\", \"#ff6565\", \"#f7d3d3\", \"#fecccc\",\n \"#8f5419\", \"#a85400\", \"#d87f26\", \"#ff7f00\", \"#e8b27c\", \"#ffb265\", \"#f7e5d3\", \"#fee5cc\",\n \"#8f8f19\", \"#a8a800\", \"#d8d826\", \"#feff00\", \"#e8e87c\", \"#feff65\", \"#f7f7d3\", \"#fefecc\",\n \"#198f19\", \"#00a800\", \"#26d826\", \"#00ff00\", \"#7ce87c\", \"#65ff65\", \"#d3f7d3\", \"#ccfecc\",\n \"#198f8f\", \"#00a8a8\", \"#26d8d8\", \"#00feff\", \"#7ce8e8\", \"#65feff\", \"#d3f7f7\", \"#ccfefe\",\n \"#19198f\", \"#0000a8\", \"#2626d8\", \"#0000ff\", \"#7c7ce8\", \"#6565ff\", \"#d3d3f7\", \"#ccccfe\",\n \"#8f198f\", \"#a800a8\", \"#d826d8\", \"#ff00fe\", \"#e87ce8\", \"#ff65fe\", \"#f7d3f7\", \"#feccfe\",\n \"#000000\", \"#242424\", \"#484848\", \"#6d6d6d\", \"#919191\", \"#b6b6b6\", \"#dadada\", \"#ffffff\"];\n\nRkns.__renkans = [];\n\nvar _BaseBin = Rkns._BaseBin = function(_renkan, _opts) {\n if (typeof _renkan !== \"undefined\") {\n this.renkan = _renkan;\n this.renkan.$.find(\".Rk-Bin-Main\").hide();\n this.$ = Rkns.$('<li>')\n .addClass(\"Rk-Bin\")\n .appendTo(_renkan.$.find(\".Rk-Bin-List\"));\n this.title_icon_$ = Rkns.$('<span>')\n .addClass(\"Rk-Bin-Title-Icon\")\n .appendTo(this.$);\n\n var _this = this;\n\n Rkns.$('<a>')\n .attr({\n href: \"#\",\n title: _renkan.translate(\"Close bin\")\n })\n .addClass(\"Rk-Bin-Close\")\n .html('×')\n .appendTo(this.$)\n .click(function() {\n _this.destroy();\n if (!_renkan.$.find(\".Rk-Bin-Main:visible\").length) {\n _renkan.$.find(\".Rk-Bin-Main:last\").slideDown();\n }\n _renkan.resizeBins();\n return false;\n });\n Rkns.$('<a>')\n .attr({\n href: \"#\",\n title: _renkan.translate(\"Refresh bin\")\n })\n .addClass(\"Rk-Bin-Refresh\")\n .appendTo(this.$)\n .click(function() {\n _this.refresh();\n return false;\n });\n this.count_$ = Rkns.$('<div>')\n .addClass(\"Rk-Bin-Count\")\n .appendTo(this.$);\n this.title_$ = Rkns.$('<h2>')\n .addClass(\"Rk-Bin-Title\")\n .appendTo(this.$);\n this.main_$ = Rkns.$('<div>')\n .addClass(\"Rk-Bin-Main\")\n .appendTo(this.$)\n .html('<h4 class=\"Rk-Bin-Loading\">' + _renkan.translate(\"Loading, please wait\") + '</h4>');\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\nvar Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {templates: renkanJST});\n\n _(this.options.property_files).each(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\n this.setCurrentUser = function (user_id, user_name) {\n \tthis.project.addUser({\n \t\t_id:user_id,\n \t\ttitle: user_name\n \t});\n \tthis.current_user = user_id;\n \tthis.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 = _.template('<li data-color=\"<%=c%>\" style=\"background: <%=c%>\"></li>');\n return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) { return _tmpl({c:c});}).join(\"\") + '</ul>';\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 = _.template('<li class=\"<%= className %>\" data-key=\"<%= key %>\"><%= title %></li>'),\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _(this.options.search).each(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() { _select.slideDown(); }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() { _select.hide(); }\n );\n this.setSearchEngine(0);\n }\n _(this.options.bins).each(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 _(_models).each(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 }\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({\"text/html\": div.innerHTML}, 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 }\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, 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 _(_this.tabs).each(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\nRenkan.prototype.template = _.template(\n '<% if (options.show_bins) { %><div class=\"Rk-Bins\"><div class=\"Rk-Bins-Head\"><h2 class=\"Rk-Bins-Title\"><%- translate(\"Select contents:\")%></h2>' +\n '<form class=\"Rk-Web-Search-Form Rk-Search-Form\"><input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\" placeholder=\"<%- translate(\"Search the Web\") %>\" />' +\n '<div class=\"Rk-Search-Select\"><div class=\"Rk-Search-Current\"></div><ul class=\"Rk-Search-List\"></ul></div>' +\n '<input type=\"submit\" value=\"\" class=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"<%- translate(\"Search the Web\") %>\" /></form>' +\n '<form class=\"Rk-Bins-Search-Form Rk-Search-Form\"><input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\" placeholder=\"<%- translate(\"Search in Bins\") %>\" />' +\n '<input type=\"submit\" value=\"\" class=\"Rk-Bins-Search-Submit Rk-Search-Submit\" title=\"<%- translate(\"Search in Bins\") %>\" /></form></div>' +\n '<ul class=\"Rk-Bin-List\"></ul></div><% } %>' +\n '<% if (options.show_editor) { %><div class=\"Rk-Render Rk-Render-<% if (options.show_bins) { %>Panel<% } else { %>Full<% } %>\"></div><% } %>'\n);\n\nRenkan.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\nRenkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n};\n\nRenkan.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\t(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\nRenkan.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 */\nvar getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\n};\n\nRkns.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 = '0' + _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 _(_class.prototype).extend(_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 = _(charsub).map(function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx,\"\"), src = \"\";\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 _(charsub).each(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 _(inp).each(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) { return testrx.test(_t); },\n replace: function(_text, _replace) { return _text.replace(replacerx, _replace); }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() { return true; },\n replace: function(_text) { return text; }\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='<p_style=\\\"position:fixed;top:0;right:0;font:bold_18px_sans-serif;color:#fff;background:#909;padding:10px;z-index:100000;\\\">\" +\n _renkan.translate(\"Drag items from this website, drop them in Renkan\").replace(/ /g,\"_\") +\n \"</p>'.replace(/_/g,String.fromCharCode(32));b.appendChild(d);e=[{r:/https?:\\\\/\\\\/[^\\\\/]*twitter\\\\.com\\\\//,s:'.tweet',n:'twitter'},{r:/https?:\\\\/\\\\/[^\\\\/]*google\\\\.[^\\\\/]+\\\\//,s:'.g',n:'google'},{r:/https?:\\\\/\\\\/[^\\\\/]*lemonde\\\\.fr\\\\//,s:'[data-vr-contentbox]',n:'lemonde'}];f=false;e.forEach(function(g){if(g.r.test(c)){f=g;}});if(f){h=function(){Array.prototype.forEach.call(a.querySelectorAll(f.s),function(i){i[j]=true;k=i.style;k.borderWidth='2px';k.borderColor='#909';k.borderStyle='solid';k.backgroundColor='rgba(200,0,180,.1)';})};window.setInterval(h,500);h();};a.addEventListener('dragstart',function(k){l=k.dataTransfer;l.setData(m+'source-uri',c);l.setData(m+'source-title',a.title);n=k.target;if(f){o=n;while(!o.attributes[j]){o=o.parentNode;if(o==b){break;}}}if(f&&o.attributes[j]){p=o.cloneNode(true);l.setData(m+'specific-site',f.n)}else{q=a.getSelection();if(q.type==='Range'||!q.type){p=q.getRangeAt(0).cloneContents();}else{p=n.cloneNode();}}r=a.createElement('div');r.appendChild(p);l.setData('text/x-iri-selected-text',r.textContent.trim());l.setData('text/x-iri-selected-html',r.innerHTML);},false);})();\";\n },\n /* Shortens text to the required length then adds ellipsis */\n shortenText: function(_text, _maxlength) {\n return (_text.length > _maxlength ? (_text.substr(0,_maxlength) + '…') : _text);\n },\n /* Drawing an edit box with an arrow and positioning the edit box according to the position of the node/edge being edited\n * Called by Rkns.Renderer.NodeEditor and Rkns.Renderer.EdgeEditor */\n drawEditBox: function(_options, _coords, _path, _xmargin, _selector) {\n _selector.css({\n width: ( _options.tooltip_width - 2* _options.tooltip_padding )\n });\n var _height = _selector.outerHeight() + 2* _options.tooltip_padding,\n _isLeft = (_coords.x < paper.view.center.x ? 1 : -1),\n _left = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length ),\n _right = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length + _options.tooltip_width ),\n _top = _coords.y - _height / 2;\n if (_top + _height > (paper.view.size.height - _options.tooltip_margin)) {\n _top = Math.max( paper.view.size.height - _options.tooltip_margin, _coords.y + _options.tooltip_arrow_width / 2 ) - _height;\n }\n if (_top < _options.tooltip_margin) {\n _top = Math.min( _options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2 );\n }\n var _bottom = _top + _height;\n /* jshint laxbreak:true */\n _path.segments[0].point\n = _path.segments[7].point\n = _coords.add([_isLeft * _xmargin, 0]);\n _path.segments[1].point.x\n = _path.segments[2].point.x\n = _path.segments[5].point.x\n = _path.segments[6].point.x\n = _left;\n _path.segments[3].point.x\n = _path.segments[4].point.x\n = _right;\n _path.segments[2].point.y\n = _path.segments[3].point.y\n = _top;\n _path.segments[4].point.y\n = _path.segments[5].point.y\n = _bottom;\n _path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2;\n _path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2;\n _path.closed = true;\n _path.fillColor = new paper.GradientColor(new paper.Gradient([_options.tooltip_top_color, _options.tooltip_bottom_color]), [0,_top], [0, _bottom]);\n _selector.css({\n left: (_options.tooltip_padding + Math.min(_left, _right)),\n top: (_options.tooltip_padding + _top)\n });\n return _path;\n }\n};\n})(window);\n\n/* END main.js */\n","(function() {\n \"use strict\";\n var root = this;\n\n var Backbone = root.Backbone;\n\n var Models = root.Rkns.Models = {};\n\n Models.getUID = function(obj) {\n var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,\n function(c) {\n var r = Math.random() * 16 | 0, v = c === 'x' ? r\n : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n if (typeof obj !== 'undefined') {\n return obj.type + \"-\" + guid;\n }\n else {\n return guid;\n }\n };\n\n var RenkanModel = Backbone.RelationalModel.extend({\n idAttribute : \"_id\",\n constructor : function(options) {\n\n if (typeof options !== \"undefined\") {\n options._id = options._id || options.id || Models.getUID(this);\n options.title = options.title || \"\";\n options.description = options.description || \"\";\n options.uri = options.uri || \"\";\n\n if (typeof this.prepare === \"function\") {\n options = this.prepare(options);\n }\n }\n Backbone.RelationalModel.prototype.constructor.call(this, options);\n },\n validate : function() {\n if (!this.type) {\n return \"object has no type\";\n }\n },\n addReference : function(_options, _propName, _list, _id, _default) {\n var _element = _list.get(_id);\n if (typeof _element === \"undefined\" &&\n typeof _default !== \"undefined\") {\n _options[_propName] = _default;\n }\n else {\n _options[_propName] = _element;\n }\n }\n });\n\n // USER\n var User = Models.User = RenkanModel.extend({\n type : \"user\",\n prepare : function(options) {\n options.color = options.color || \"#666666\";\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n color : this.get(\"color\")\n };\n }\n });\n\n // NODE\n var Node = Models.Node = RenkanModel.extend({\n type : \"node\",\n relations : [ {\n type : Backbone.HasOne,\n key : \"created_by\",\n relatedModel : User\n } ],\n prepare : function(options) {\n var project = options.project;\n this.addReference(options, \"created_by\", project.get(\"users\"),\n options.created_by, project.current_user);\n options.description = options.description || \"\";\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n position : this.get(\"position\"),\n image : this.get(\"image\"),\n color : this.get(\"color\"),\n created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n .get(\"_id\") : null,\n size : this.get(\"size\"),\n clip_path : this.get(\"clip_path\"),\n shape : this.get(\"shape\")\n };\n }\n });\n\n // EDGE\n var Edge = Models.Edge = RenkanModel.extend({\n type : \"edge\",\n relations : [ {\n type : Backbone.HasOne,\n key : \"created_by\",\n relatedModel : User\n }, {\n type : Backbone.HasOne,\n key : \"from\",\n relatedModel : Node\n }, {\n type : Backbone.HasOne,\n key : \"to\",\n relatedModel : Node\n } ],\n prepare : function(options) {\n var project = options.project;\n this.addReference(options, \"created_by\", project.get(\"users\"),\n options.created_by, project.current_user);\n this.addReference(options, \"from\", project.get(\"nodes\"),\n options.from);\n this.addReference(options, \"to\", project.get(\"nodes\"), options.to);\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n from : this.get(\"from\") ? this.get(\"from\").get(\"_id\") : null,\n to : this.get(\"to\") ? this.get(\"to\").get(\"_id\") : null,\n color : this.get(\"color\"),\n created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n .get(\"_id\") : null\n };\n }\n });\n\n // View\n var View = Models.View = RenkanModel.extend({\n type : \"view\",\n relations : [ {\n type : Backbone.HasOne,\n key : \"created_by\",\n relatedModel : User\n } ],\n prepare : function(options) {\n var project = options.project;\n this.addReference(options, \"created_by\", project.get(\"users\"),\n options.created_by, project.current_user);\n options.description = options.description || \"\";\n if (typeof options.offset !== \"undefined\") {\n var offset = {};\n if (Array.isArray(options.offset)) {\n offset.x = options.offset[0];\n offset.y = options.offset.length > 1 ? options.offset[1]\n : options.offset[0];\n }\n else if (options.offset.x != null) {\n offset.x = options.offset.x;\n offset.y = options.offset.y;\n }\n options.offset = offset;\n }\n return options;\n },\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n zoom_level : this.get(\"zoom_level\"),\n offset : this.get(\"offset\"),\n title : this.get(\"title\"),\n description : this.get(\"description\"),\n created_by : this.get(\"created_by\") ? this.get(\"created_by\")\n .get(\"_id\") : null\n // Don't need project id\n };\n }\n });\n\n // PROJECT\n var Project = Models.Project = RenkanModel.extend({\n type : \"project\",\n blacklist : [ 'save_status', ],\n relations : [ {\n type : Backbone.HasMany,\n key : \"users\",\n relatedModel : User,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n }, {\n type : Backbone.HasMany,\n key : \"nodes\",\n relatedModel : Node,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n }, {\n type : Backbone.HasMany,\n key : \"edges\",\n relatedModel : Edge,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n }, {\n type : Backbone.HasMany,\n key : \"views\",\n relatedModel : View,\n reverseRelation : {\n key : 'project',\n includeInJSON : '_id'\n }\n } ],\n addUser : function(_props, _options) {\n _props.project = this;\n var _user = User.findOrCreate(_props);\n this.get(\"users\").push(_user, _options);\n return _user;\n },\n addNode : function(_props, _options) {\n _props.project = this;\n var _node = Node.findOrCreate(_props);\n this.get(\"nodes\").push(_node, _options);\n return _node;\n },\n addEdge : function(_props, _options) {\n _props.project = this;\n var _edge = Edge.findOrCreate(_props);\n this.get(\"edges\").push(_edge, _options);\n return _edge;\n },\n addView : function(_props, _options) {\n _props.project = this;\n // TODO: check if need to replace with create only\n var _view = View.findOrCreate(_props);\n // TODO: Should we remember only one view?\n this.get(\"views\").push(_view, _options);\n return _view;\n },\n removeNode : function(_model) {\n this.get(\"nodes\").remove(_model);\n },\n removeEdge : function(_model) {\n this.get(\"edges\").remove(_model);\n },\n validate : function(options) {\n var _project = this;\n _(\n [].concat(options.users, options.nodes, options.edges,\n options.views)).each(function(_item) {\n if (_item) {\n _item.project = _project;\n }\n });\n },\n // Add event handler to remove edges when a node is removed\n initialize : function() {\n var _this = this;\n this.on(\"remove:nodes\", function(_node) {\n _this.get(\"edges\").remove(\n _this.get(\"edges\").filter(\n function(_edge) {\n return _edge.get(\"from\") === _node ||\n _edge.get(\"to\") === _node;\n }));\n });\n },\n toJSON : function() {\n var json = _.clone(this.attributes);\n for ( var attr in json) {\n if ((json[attr] instanceof Backbone.Model) ||\n (json[attr] instanceof Backbone.Collection) ||\n (json[attr] instanceof RenkanModel)) {\n json[attr] = json[attr].toJSON();\n }\n }\n return _.omit(json, this.blacklist);\n }\n });\n\n var RosterUser = Models.RosterUser = Backbone.Model\n .extend({\n type : \"roster_user\",\n idAttribute : \"_id\",\n\n constructor : function(options) {\n\n if (typeof options !== \"undefined\") {\n options._id = options._id ||\n options.id ||\n Models.getUID(this);\n options.title = options.title || \"(untitled \" + this.type + \")\";\n options.description = options.description || \"\";\n options.uri = options.uri || \"\";\n options.project = options.project || null;\n options.site_id = options.site_id || 0;\n\n if (typeof this.prepare === \"function\") {\n options = this.prepare(options);\n }\n }\n Backbone.Model.prototype.constructor.call(this, options);\n },\n\n validate : function() {\n if (!this.type) {\n return \"object has no type\";\n }\n },\n\n prepare : function(options) {\n options.color = options.color || \"#666666\";\n return options;\n },\n\n toJSON : function() {\n return {\n _id : this.get(\"_id\"),\n title : this.get(\"title\"),\n uri : this.get(\"uri\"),\n description : this.get(\"description\"),\n color : this.get(\"color\"),\n project : (this.get(\"project\") != null) ? this.get(\n \"project\").get(\"id\") : null,\n site_id : this.get(\"site_id\")\n };\n }\n });\n\n var UsersList = Models.UsersList = Backbone.Collection.extend({\n model : RosterUser\n });\n\n}).call(window);\n","Rkns.defaults = {\n\n language: (navigator.language || navigator.userLanguage || \"en\"),\n /* GUI Language */\n container: \"renkan\",\n /* GUI Container DOM element ID */\n search: [],\n /* List of Search Engines */\n bins: [],\n /* List of Bins */\n static_url: \"\",\n /* URL for static resources */\n show_bins: true,\n /* Show bins in left column */\n properties: [],\n /* Semantic properties for edges */\n show_editor: true,\n /* Show the graph editor... Setting this to \"false\" only shows the bins part ! */\n read_only: false,\n /* Allows editing of renkan without changing the rest of the GUI. Can be switched on/off on the fly to block/enable editing */\n editor_mode: true,\n /* Switch for Publish/Edit GUI. If editor_mode is false, read_only will be true. */\n manual_save: false,\n /* In snapshot mode, clicking on the floppy will save a snapshot. Otherwise, it will show the connection status */\n show_top_bar: true,\n /* Show the top bar, (title, buttons, users) */\n default_user_color: \"#303030\",\n size_bug_fix: true,\n /* Resize the canvas after load (fixes a bug on iPad and FF Mac) */\n force_resize: false,\n allow_double_click: true,\n /* Allows Double Click to create a node on an empty background */\n zoom_on_scroll: true,\n /* Allows to use the scrollwheel to zoom */\n element_delete_delay: 0,\n /* Delay between clicking on the bin on an element and really deleting it\n Set to 0 for delete confirm */\n autoscale_padding: 50,\n resize: true,\n \n /* zoom options */\n show_zoom: true,\n /* show zoom buttons */\n save_view: true,\n /* show buttons to save view */\n default_view: false,\n /* Allows to load default view (zoom+offset) at start on read_only mode, instead of autoScale. the default_view will be the last */\n \n \n /* TOP BAR BUTTONS */\n show_search_field: true,\n show_user_list: true,\n user_name_editable: true,\n user_color_editable: true,\n show_user_color: true,\n show_save_button: true,\n show_export_button: true,\n show_open_button: false,\n show_addnode_button: true,\n show_addedge_button: true,\n show_bookmarklet: true,\n show_fullscreen_button: true,\n home_button_url: false,\n home_button_title: \"Home\",\n\n /* MINI-MAP OPTIONS */\n\n show_minimap: true,\n /* Show a small map at the bottom right */\n minimap_width: 160,\n minimap_height: 120,\n minimap_padding: 20,\n minimap_background_color: \"#ffffff\",\n minimap_border_color: \"#cccccc\",\n minimap_highlight_color: \"#ffff00\",\n minimap_highlight_weight: 5,\n \n\n /* EDGE/NODE COMMON OPTIONS */\n\n buttons_background: \"#202020\",\n buttons_label_color: \"#c000c0\",\n buttons_label_font_size: 9,\n\n /* NODE DISPLAY OPTIONS */\n\n show_node_circles: true,\n /* Show circles for nodes */\n clip_node_images: true,\n /* Constraint node images to circles */\n node_images_fill_mode: false,\n /* Set to false for \"letterboxing\" (height/width of node adapted to show full image)\n Set to true for \"crop\" (adapted to fill circle) */\n node_size_base: 25,\n node_stroke_width: 2,\n selected_node_stroke_width: 4,\n node_fill_color: \"#ffffff\",\n highlighted_node_fill_color: \"#ffff00\",\n node_label_distance: 5,\n /* Vertical distance between node and label */\n node_label_max_length: 60,\n /* Maximum displayed text length */\n label_untitled_nodes: \"(untitled)\",\n /* Label to display on untitled nodes */\n change_shapes: true,\n /* Change shapes enabled */\n\n /* EDGE DISPLAY OPTIONS */\n\n edge_stroke_width: 2,\n selected_edge_stroke_width: 4,\n edge_label_distance: 0,\n edge_label_max_length: 20,\n edge_arrow_length: 18,\n edge_arrow_width: 12,\n edge_gap_in_bundles: 12,\n label_untitled_edges: \"\",\n\n /* CONTEXTUAL DISPLAY (TOOLTIP OR EDITOR) OPTIONS */\n\n tooltip_width: 275,\n tooltip_padding: 10,\n tooltip_margin: 15,\n tooltip_arrow_length : 20,\n tooltip_arrow_width : 40,\n tooltip_top_color: \"#f0f0f0\",\n tooltip_bottom_color: \"#d0d0d0\",\n tooltip_border_color: \"#808080\",\n tooltip_border_width: 1,\n\n /* NODE EDITOR OPTIONS */\n\n show_node_editor_uri: true,\n show_node_editor_description: true,\n show_node_editor_size: true,\n show_node_editor_color: true,\n show_node_editor_image: true,\n show_node_editor_creator: true,\n allow_image_upload: true,\n uploaded_image_max_kb: 500,\n\n /* NODE TOOLTIP OPTIONS */\n\n show_node_tooltip_uri: true,\n show_node_tooltip_description: true,\n show_node_tooltip_color: true,\n show_node_tooltip_image: true,\n show_node_tooltip_creator: true,\n\n /* EDGE EDITOR OPTIONS */\n\n show_edge_editor_uri: true,\n show_edge_editor_color: true,\n show_edge_editor_direction: true,\n show_edge_editor_nodes: true,\n show_edge_editor_creator: true,\n\n /* EDGE TOOLTIP OPTIONS */\n\n show_edge_tooltip_uri: true,\n show_edge_tooltip_color: true,\n show_edge_tooltip_nodes: true,\n show_edge_tooltip_creator: true\n\n /* */\n\n};\n","Rkns.i18n = {\n fr: {\n \"Edit Node\": \"Édition d’un nœud\",\n \"Edit Edge\": \"Édition d’un lien\",\n \"Title:\": \"Titre :\",\n \"URI:\": \"URI :\",\n \"Description:\": \"Description :\",\n \"From:\": \"De :\",\n \"To:\": \"Vers :\",\n \"Image\": \"Image\",\n \"Image URL:\": \"URL d'Image\",\n \"Choose Image File:\": \"Choisir un fichier image\",\n \"Full Screen\": \"Mode plein écran\",\n \"Add Node\": \"Ajouter un nœud\",\n \"Add Edge\": \"Ajouter un lien\",\n \"Save Project\": \"Enregistrer le projet\",\n \"Open Project\": \"Ouvrir un projet\",\n \"Auto-save enabled\": \"Enregistrement automatique activé\",\n \"Connection lost\": \"Connexion perdue\",\n \"Created by:\": \"Créé par :\",\n \"Zoom In\": \"Agrandir l’échelle\",\n \"Zoom Out\": \"Rapetisser l’échelle\",\n \"Edit\": \"Éditer\",\n \"Remove\": \"Supprimer\",\n \"Cancel deletion\": \"Annuler la suppression\",\n \"Link to another node\": \"Créer un lien\",\n \"Enlarge\": \"Agrandir\",\n \"Shrink\": \"Rétrécir\",\n \"Click on the background canvas to add a node\": \"Cliquer sur le fond du graphe pour rajouter un nœud\",\n \"Click on a first node to start the edge\": \"Cliquer sur un premier nœud pour commencer le lien\",\n \"Click on a second node to complete the edge\": \"Cliquer sur un second nœud pour terminer le lien\",\n \"Wikipedia\": \"Wikipédia\",\n \"Wikipedia in \": \"Wikipédia en \",\n \"French\": \"Français\",\n \"English\": \"Anglais\",\n \"Japanese\": \"Japonais\",\n \"Untitled project\": \"Projet sans titre\",\n \"Lignes de Temps\": \"Lignes de Temps\",\n \"Loading, please wait\": \"Chargement en cours, merci de patienter\",\n \"Edge color:\": \"Couleur :\",\n \"Node color:\": \"Couleur :\",\n \"Choose color\": \"Choisir une couleur\",\n \"Change edge direction\": \"Changer le sens du lien\",\n \"Do you really wish to remove node \": \"Voulez-vous réellement supprimer le nœud \",\n \"Do you really wish to remove edge \": \"Voulez-vous réellement supprimer le lien \",\n \"This file is not an image\": \"Ce fichier n'est pas une image\",\n \"Image size must be under \": \"L'image doit peser moins de \",\n \"Size:\": \"Taille :\",\n \"KB\": \"ko\",\n \"Choose from vocabulary:\": \"Choisir dans un vocabulaire :\",\n \"SKOS Documentation properties\": \"SKOS: Propriétés documentaires\",\n \"has note\": \"a pour note\",\n \"has example\": \"a pour exemple\",\n \"has definition\": \"a pour définition\",\n \"SKOS Semantic relations\": \"SKOS: Relations sémantiques\",\n \"has broader\": \"a pour concept plus large\",\n \"has narrower\": \"a pour concept plus étroit\",\n \"has related\": \"a pour concept apparenté\",\n \"Dublin Core Metadata\": \"Métadonnées Dublin Core\",\n \"has contributor\": \"a pour contributeur\",\n \"covers\": \"couvre\",\n \"created by\": \"créé par\",\n \"has date\": \"a pour date\",\n \"published by\": \"édité par\",\n \"has source\": \"a pour source\",\n \"has subject\": \"a pour sujet\",\n \"Dragged resource\": \"Ressource glisée-déposée\",\n \"Search the Web\": \"Rechercher en ligne\",\n \"Search in Bins\": \"Rechercher dans les chutiers\",\n \"Close bin\": \"Fermer le chutier\",\n \"Refresh bin\": \"Rafraîchir le chutier\",\n \"(untitled)\": \"(sans titre)\",\n \"Select contents:\": \"Sélectionner des contenus :\",\n \"Drag items from this website, drop them in Renkan\": \"Glissez des éléments de ce site web vers Renkan\",\n \"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\": \"Glissez ce bouton vers votre barre de favoris. Ensuite, depuis un site tiers, cliquez dessus pour activer 'Drag-to-Add' puis glissez des éléments de ce site vers Renkan\",\n \"Shapes available\": \"Formes disponibles\",\n \"Circle\": \"Cercle\",\n \"Square\": \"Carré\",\n \"Diamond\": \"Losange\",\n \"Hexagone\": \"Hexagone\",\n \"Ellipse\": \"Ellipse\",\n \"Star\": \"Étoile\",\n \"Zoom Fit\": \"Ajuster le Zoom\",\n \"Download Project\": \"Télécharger le projet\",\n \"Zoom Save\": \"Sauver le Zoom\",\n \"View saved zoom\": \"Restaurer le Zoom\",\n \"Renkan \\'Drag-to-Add\\' bookmarklet\": \"Renkan \\'Deplacer-Pour-Ajouter\\' Signet\",\n \"(unknown user)\":\"(non authentifié)\",\n \"<unknown user>\":\"<non authentifié>\",\n \"Search in graph\":\"Rechercher dans carte\",\n \"Search in \" : \"Chercher dans \"\n }\n};\n","/* Saves the Full JSON at each modification */\n\nRkns.jsonIO = function(_renkan, _opts) {\n var _proj = _renkan.project;\n if (typeof _opts.http_method === \"undefined\") {\n _opts.http_method = 'PUT';\n }\n var _load = function() {\n _renkan.renderer.redrawActive = false;\n _proj.set({\n loading_status : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _proj.set(_data, {\n validate : true\n });\n _proj.set({\n loading_status : false\n });\n _proj.set({\n save_status : 0\n });\n _renkan.renderer.redrawActive = true;\n _renkan.renderer.fixSize();\n });\n };\n var _save = function() {\n _proj.set({\n save_status : 2\n });\n var _data = _proj.toJSON();\n if (!_renkan.read_only) {\n Rkns.$.ajax({\n type : _opts.http_method,\n url : _opts.url,\n contentType : \"application/json\",\n data : JSON.stringify(_data),\n success : function(data, textStatus, jqXHR) {\n _proj.set({\n save_status : 0\n });\n }\n });\n }\n\n };\n var _thrSave = Rkns._.throttle(function() {\n setTimeout(_save, 100);\n }, 1000);\n _proj.on(\"add:nodes add:edges add:users add:views\", function(_model) {\n _model.on(\"change remove\", function(_model) {\n _thrSave();\n });\n _thrSave();\n });\n _proj.on(\"change\", function() {\n if (!(_proj.changedAttributes.length === 1 && _proj\n .hasChanged('save_status'))) {\n _thrSave();\n }\n });\n\n _load();\n};\n","/* Saves the Full JSON once */\n\nRkns.jsonIOSaveOnClick = function(_renkan, _opts) {\n var _proj = _renkan.project,\n _saveWarn = false,\n _onLeave = function() {\n return \"Project not saved\";\n };\n if (typeof _opts.http_method === \"undefined\") {\n _opts.http_method = 'POST';\n }\n var _load = function() {\n var getdata = {},\n rx = /id=([^&#?=]+)/,\n matches = document.location.hash.match(rx);\n if (matches) {\n getdata.id = matches[1];\n }\n Rkns.$.ajax({\n url: _opts.url,\n data: getdata,\n beforeSend: function(){\n \t_proj.set({loading_status:true});\n },\n success: function(_data) {\n _proj.set(_data, {validate: true});\n \t_proj.set({loading_status:false});\n _proj.set({save_status:0});\n \t_renkan.renderer.autoScale();\n }\n });\n };\n var _save = function() {\n _proj.set(\"saved_at\", new Date());\n var _data = _proj.toJSON();\n Rkns.$.ajax({\n type: _opts.http_method,\n url: _opts.url,\n contentType: \"application/json\",\n data: JSON.stringify(_data),\n beforeSend: function(){\n \t_proj.set({save_status:2});\n },\n success: function(data, textStatus, jqXHR) {\n $(window).off(\"beforeunload\", _onLeave);\n _saveWarn = false;\n _proj.set({save_status:0});\n //document.location.hash = \"#id=\" + data.id;\n //$(\".Rk-Notifications\").text(\"Saved as \"+document.location.href).fadeIn().delay(2000).fadeOut();\n }\n });\n };\n var _checkLeave = function() {\n \t_proj.set({save_status:1});\n \t\n var title = _proj.get(\"title\");\n if (title && _proj.get(\"nodes\").length) {\n $(\".Rk-Save-Button\").removeClass(\"disabled\");\n } else {\n $(\".Rk-Save-Button\").addClass(\"disabled\");\n }\n if (title) {\n $(\".Rk-PadTitle\").css(\"border-color\",\"#333333\");\n }\n if (!_saveWarn) {\n _saveWarn = true;\n $(window).on(\"beforeunload\", _onLeave);\n }\n };\n _load();\n _proj.on(\"add:nodes add:edges add:users change\", function(_model) {\n\t _model.on(\"change remove\", function(_model) {\n\t \tif(!(_model.changedAttributes.length === 1 && _model.hasChanged('save_status'))) {\n\t \t\t_checkLeave();\n\t \t}\n\t });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('save_status'))) {\n\t\t _checkLeave();\n \t}\n });\n _renkan.renderer.save = function() {\n if ($(\".Rk-Save-Button\").hasClass(\"disabled\")) {\n if (!_proj.get(\"title\")) {\n $(\".Rk-PadTitle\").css(\"border-color\",\"#ff0000\");\n }\n } else {\n _save();\n }\n };\n};\n","(function(Rkns) {\n\"use strict\";\n\nvar _ = Rkns._;\n\nvar Ldt = Rkns.Ldt = {};\n\nvar Bin = Ldt.Bin = function(_renkan, _opts) {\n if (_opts.ldt_type) {\n var Resclass = Ldt[_opts.ldt_type+\"Bin\"];\n if (Resclass) {\n return new Resclass(_renkan, _opts);\n }\n }\n console.error(\"No such LDT Bin Type\");\n};\n\nvar ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nProjectBin.prototype.tagTemplate = renkanJST['templates/ldtjson-bin/tagtemplate.html'];\n\nProjectBin.prototype.annotationTemplate = renkanJST['templates/ldtjson-bin/annotationtemplate.html'];\n\nProjectBin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.proj_id = _opts.project_id;\n this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n this.title_$.html(_opts.title);\n this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n this.refresh();\n};\n\nProjectBin.prototype.render = function(searchbase) {\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n function highlight(_text) {\n var _e = _(_text).escape();\n return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n }\n function convertTC(_ms) {\n function pad(_n) {\n var _res = _n.toString();\n while (_res.length < 2) {\n _res = '0' + _res;\n }\n return _res;\n }\n var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n _hours = Math.floor(_totalSeconds / 3600),\n _minutes = (Math.floor(_totalSeconds / 60) % 60),\n _seconds = _totalSeconds % 60,\n _res = '';\n if (_hours) {\n _res += pad(_hours) + ':';\n }\n _res += pad(_minutes) + ':' + pad(_seconds);\n return _res;\n }\n\n var _html = '<li><h3>Tags</h3></li>',\n _projtitle = this.data.meta[\"dc:title\"],\n _this = this,\n count = 0;\n _this.title_$.text('LDT Project: \"' + _projtitle + '\"');\n _(_this.data.tags).map(function(_tag) {\n var _title = _tag.meta[\"dc:title\"];\n if (!search.isempty && !search.test(_title)) {\n return;\n }\n count++;\n _html += _this.tagTemplate({\n ldt_platform: _this.ldt_platform,\n title: _title,\n htitle: highlight(_title),\n encodedtitle : encodeURIComponent(_title),\n static_url: _this.renkan.options.static_url\n });\n });\n _html += '<li><h3>Annotations</h3></li>';\n _(_this.data.annotations).map(function(_annotation) {\n var _description = _annotation.content.description,\n _title = _annotation.content.title.replace(_description,\"\");\n if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n return;\n }\n count++;\n var _duration = _annotation.end - _annotation.begin,\n _img = (\n (_annotation.content && _annotation.content.img && _annotation.content.img.src) ?\n _annotation.content.img.src :\n ( _duration ? _this.renkan.options.static_url+\"img/ldt-segment.png\" : _this.renkan.options.static_url+\"img/ldt-point.png\" )\n );\n _html += _this.annotationTemplate({\n ldt_platform: _this.ldt_platform,\n title: _title,\n htitle: highlight(_title),\n description: _description,\n hdescription: highlight(_description),\n start: convertTC(_annotation.begin),\n end: convertTC(_annotation.end),\n duration: convertTC(_duration),\n mediaid: _annotation.media,\n annotationid: _annotation.id,\n image: _img,\n static_url: _this.renkan.options.static_url\n });\n });\n\n this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nProjectBin.prototype.refresh = function() {\n var _this = this;\n Rkns.$.ajax({\n url: this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id,\n dataType: \"jsonp\",\n success: function(_data) {\n _this.data = _data;\n _this.render();\n }\n });\n};\n\nvar Search = Ldt.Search = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.lang = _opts.lang || \"en\";\n};\n\nSearch.prototype.getBgClass = function() {\n return \"Rk-Ldt-Icon\";\n};\n\nSearch.prototype.getSearchTitle = function() {\n return this.renkan.translate(\"Lignes de Temps\");\n};\n\nSearch.prototype.search = function(_q) {\n this.renkan.tabs.push(\n new ResultsBin(this.renkan, {\n search: _q\n })\n );\n};\n\nvar ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nResultsBin.prototype.segmentTemplate = renkanJST['templates/ldtjson-bin/segmenttemplate.html'];\n\nResultsBin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.ldt_platform = _opts.ldt_platform || \"http://ldt.iri.centrepompidou.fr/\";\n this.max_results = _opts.max_results || 50;\n this.search = _opts.search;\n this.title_$.html('Lignes de Temps: \"' + _opts.search + '\"');\n this.title_icon_$.addClass('Rk-Ldt-Title-Icon');\n this.refresh();\n};\n\nResultsBin.prototype.render = function(searchbase) {\n if (!this.data) {\n return;\n }\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n function highlight(_text) {\n return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n }\n function convertTC(_ms) {\n function pad(_n) {\n var _res = _n.toString();\n while (_res.length < 2) {\n _res = '0' + _res;\n }\n return _res;\n }\n var _totalSeconds = Math.abs(Math.floor(_ms/1000)),\n _hours = Math.floor(_totalSeconds / 3600),\n _minutes = (Math.floor(_totalSeconds / 60) % 60),\n _seconds = _totalSeconds % 60,\n _res = '';\n if (_hours) {\n _res += pad(_hours) + ':';\n }\n _res += pad(_minutes) + ':' + pad(_seconds);\n return _res;\n }\n\n var _html = '',\n _this = this,\n count = 0;\n _(this.data.objects).each(function(_segment) {\n var _description = _segment.abstract,\n _title = _segment.title;\n if (!search.isempty && !search.test(_title) && !search.test(_description)) {\n return;\n }\n count++;\n var _duration = _segment.duration,\n _begin = _segment.start_ts,\n _end = + _segment.duration + _begin,\n _img = (\n _duration ?\n _this.renkan.options.static_url + \"img/ldt-segment.png\" :\n _this.renkan.options.static_url + \"img/ldt-point.png\"\n );\n _html += _this.segmentTemplate({\n ldt_platform: _this.ldt_platform,\n title: _title,\n htitle: highlight(_title),\n description: _description,\n hdescription: highlight(_description),\n start: convertTC(_begin),\n end: convertTC(_end),\n duration: convertTC(_duration),\n mediaid: _segment.iri_id,\n //projectid: _segment.project_id,\n //cuttingid: _segment.cutting_id,\n annotationid: _segment.element_id,\n image: _img\n });\n });\n\n this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nResultsBin.prototype.refresh = function() {\n var _this = this;\n Rkns.$.ajax({\n url: this.ldt_platform + 'ldtplatform/api/ldt/1.0/segments/search/',\n data: {\n format: \"jsonp\",\n q: this.search,\n limit: this.max_results\n },\n dataType: \"jsonp\",\n success: function(_data) {\n _this.data = _data;\n _this.render();\n }\n });\n};\n\n})(window.Rkns);\n","Rkns.ResourceList = {};\n\nRkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.ResourceList.Bin.prototype.resultTemplate = Rkns._.template(\n '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\" data-uri=\"<%-url%>\" ' +\n 'data-title=\"<%-title%>\" data-description=\"<%-description%>\" ' +\n '<% if (image) { %>data-image=\"<%- Rkns.Utils.getFullURL(image) %>\"<% } else { %>data-image=\"\"<% } %> >' +\n '<% if (image) { %><img class=\"Rk-ResourceList-Image\" src=\"<%-image%>\"/><% } %><h4 class=\"Rk-ResourceList-Title\">' +\n '<% if (url) { %><a href=\"<%-url%>\" target=\"_blank\"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>' +\n '<% if (description) { %><p class=\"Rk-ResourceList-Description\"><%=hdescription%></p><% } %><% if (image) { %><div style=\"clear: both;\"></div><% } %></li>'\n);\n\nRkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.title_$.html(_opts.title);\n if (_opts.list) {\n this.data = _opts.list;\n }\n this.refresh();\n};\n\nRkns.ResourceList.Bin.prototype.render = function(searchbase) {\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n function highlight(_text) {\n var _e = _(_text).escape();\n return search.isempty ? _e : search.replace(_e, \"<span class='searchmatch'>$1</span>\");\n }\n var _html = \"\",\n _this = this,\n count = 0;\n Rkns._(this.data).each(function(_item) {\n var _element;\n if (typeof _item === \"string\") {\n if (/^(https?:\\/\\/|www)/.test(_item)) {\n _element = { url: _item };\n } else {\n _element = { title: _item.replace(/[:,]?\\s?(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+\\s?/,'').trim() };\n var _match = _item.match(/(https?:\\/\\/|www)[\\d\\w\\/.&?=#%-_]+/);\n if (_match) {\n _element.url = _match[0];\n }\n if (_element.title.length > 80) {\n _element.description = _element.title;\n _element.title = _element.title.replace(/^(.{30,60})\\s.+$/,'$1…');\n }\n }\n } else {\n _element = _item;\n }\n var title = _element.title || (_element.url || \"\").replace(/^https?:\\/\\/(www\\.)?/,'').replace(/^(.{40}).+$/,'$1…'),\n url = _element.url || \"\",\n description = _element.description || \"\",\n image = _element.image || \"\";\n if (url && !/^https?:\\/\\//.test(url)) {\n url = 'http://' + url;\n }\n if (!search.isempty && !search.test(title) && !search.test(description)) {\n return;\n }\n count++;\n _html += _this.resultTemplate({\n url: url,\n title: title,\n htitle: highlight(title),\n image: image,\n description: description,\n hdescription: highlight(description),\n static_url: _this.renkan.options.static_url\n });\n });\n _this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nRkns.ResourceList.Bin.prototype.refresh = function() {\n if (this.data) {\n this.render();\n }\n};\n","Rkns.Wikipedia = {\n};\n\nRkns.Wikipedia.Search = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.lang = _opts.lang || \"en\";\n};\n\nRkns.Wikipedia.Search.prototype.getBgClass = function() {\n return \"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-\" + this.lang;\n};\n\nRkns.Wikipedia.Search.prototype.getSearchTitle = function() {\n var langs = {\n \"fr\": \"French\",\n \"en\": \"English\",\n \"ja\": \"Japanese\"\n };\n if (langs[this.lang]) {\n return this.renkan.translate(\"Wikipedia in \") + this.renkan.translate(langs[this.lang]);\n } else {\n return this.renkan.translate(\"Wikipedia\") + \" [\" + this.lang + \"]\";\n }\n};\n\nRkns.Wikipedia.Search.prototype.search = function(_q) {\n this.renkan.tabs.push(\n new Rkns.Wikipedia.Bin(this.renkan, {\n lang: this.lang,\n search: _q\n })\n );\n};\n\nRkns.Wikipedia.Bin = Rkns.Utils.inherit(Rkns._BaseBin);\n\nRkns.Wikipedia.Bin.prototype.resultTemplate = Rkns._.template(\n '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\" data-uri=\"<%-url%>\" ' +\n 'data-title=\"Wikipedia: <%-title%>\" data-description=\"<%-description%>\" data-image=\"<%- Rkns.Utils.getFullURL( static_url + \\'img/wikipedia.png\\' ) %>\">' +\n '<img class=\"Rk-Wikipedia-Icon\" src=\"<%-static_url%>img/wikipedia.png\"></div><h4 class=\"Rk-Wikipedia-Title\"><a href=\"<%-url%>\" target=\"_blank\"><%=htitle%></a></h4>' +\n '<p class=\"Rk-Wikipedia-Snippet\"><%=hdescription%></p></li>'\n);\n\nRkns.Wikipedia.Bin.prototype._init = function(_renkan, _opts) {\n this.renkan = _renkan;\n this.search = _opts.search;\n this.lang = _opts.lang || \"en\";\n this.title_icon_$.addClass('Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-' + this.lang);\n this.title_$.html(this.search).addClass(\"Rk-Wikipedia-Title\");\n this.refresh();\n};\n\nRkns.Wikipedia.Bin.prototype.render = function(searchbase) {\n var search = searchbase || Rkns.Utils.regexpFromTextOrArray();\n var highlightrx = (search.isempty ? Rkns.Utils.regexpFromTextOrArray(this.search) : search);\n function highlight(_text) {\n return highlightrx.replace(_(_text).escape(), \"<span class='searchmatch'>$1</span>\");\n }\n var _html = \"\",\n _this = this,\n count = 0;\n Rkns._(this.data.query.search).each(function(_result) {\n var title = _result.title,\n url = \"http://\" + _this.lang + \".wikipedia.org/wiki/\" + encodeURI(title.replace(/ /g,\"_\")),\n description = Rkns.$('<div>').html(_result.snippet).text();\n if (!search.isempty && !search.test(title) && !search.test(description)) {\n return;\n }\n count++;\n _html += _this.resultTemplate({\n url: url,\n title: title,\n htitle: highlight(title),\n description: description,\n hdescription: highlight(description),\n static_url: _this.renkan.options.static_url\n });\n });\n _this.main_$.html(_html);\n if (!search.isempty && count) {\n this.count_$.text(count).show();\n } else {\n this.count_$.hide();\n }\n if (!search.isempty && !count) {\n this.$.hide();\n } else {\n this.$.show();\n }\n this.renkan.resizeBins();\n};\n\nRkns.Wikipedia.Bin.prototype.refresh = function() {\n var _this = this;\n Rkns.$.ajax({\n url: \"http://\" + _this.lang + \".wikipedia.org/w/api.php?action=query&list=search&srsearch=\" + encodeURIComponent(this.search) + \"&format=json\",\n dataType: \"jsonp\",\n success: function(_data) {\n _this.data = _data;\n _this.render();\n }\n });\n};\n","\ndefine('renderer/baserepresentation',['jquery', 'underscore'], function ($, _) {\n \n\n /* Rkns.Renderer._BaseRepresentation Class */\n\n /* In Renkan, a \"Representation\" is a sort of ViewModel (in the MVVM paradigm) and bridges the gap between\n * models (written with Backbone.js) and the view (written with Paper.js)\n * Renkan's representations all inherit from Rkns.Renderer._BaseRepresentation '*/\n\n var _BaseRepresentation = function(_renderer, _model) {\n if (typeof _renderer !== \"undefined\") {\n this.renderer = _renderer;\n this.renkan = _renderer.renkan;\n this.project = _renderer.renkan.project;\n this.options = _renderer.renkan.options;\n this.model = _model;\n if (this.model) {\n var _this = this;\n this._changeBinding = function() {\n _this.redraw();\n };\n this._removeBinding = function() {\n _renderer.removeRepresentation(_this);\n _(function() {\n _renderer.redraw();\n }).defer();\n };\n this._selectBinding = function() {\n _this.select();\n };\n this._unselectBinding = function() {\n _this.unselect();\n };\n this.model.on(\"change\", this._changeBinding );\n this.model.on(\"remove\", this._removeBinding );\n this.model.on(\"select\", this._selectBinding );\n this.model.on(\"unselect\", this._unselectBinding );\n }\n }\n };\n\n /* Rkns.Renderer._BaseRepresentation Methods */\n\n _(_BaseRepresentation.prototype).extend({\n _super: function(_func) {\n return _BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1));\n },\n redraw: function() {},\n moveTo: function() {},\n show: function() { return \"BaseRepresentation.show\"; },\n hide: function() {},\n select: function() {\n if (this.model) {\n this.model.trigger(\"selected\");\n }\n },\n unselect: function() {\n if (this.model) {\n this.model.trigger(\"unselected\");\n }\n },\n highlight: function() {},\n unhighlight: function() {},\n mousedown: function() {},\n mouseup: function() {\n if (this.model) {\n this.model.trigger(\"clicked\");\n }\n },\n destroy: function() {\n if (this.model) {\n this.model.off(\"change\", this._changeBinding );\n this.model.off(\"remove\", this._removeBinding );\n this.model.off(\"select\", this._selectBinding );\n this.model.off(\"unselect\", this._unselectBinding );\n }\n }\n });\n\n /* End of Rkns.Renderer._BaseRepresentation Class */\n\n return _BaseRepresentation;\n\n});\n\ndefine('requtils',[], function ($, _) {\n \n return {\n getUtils: function(){\n return window.Rkns.Utils;\n },\n getRenderer: function(){\n return window.Rkns.Renderer;\n }\n };\n\n});\n\n\ndefine('renderer/basebutton',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer._BaseButton Class */\n\n /* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */\n\n var _BaseButton = Utils.inherit(BaseRepresentation);\n\n _(_BaseButton.prototype).extend({\n moveTo: function(_pos) {\n this.sector.moveTo(_pos);\n },\n show: function() {\n this.sector.show();\n },\n hide: function() {\n this.sector.hide();\n },\n select: function() {\n this.sector.select();\n },\n unselect: function(_newTarget) {\n this.sector.unselect();\n if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) {\n this.source_representation.unselect();\n }\n },\n destroy: function() {\n this.sector.destroy();\n }\n });\n\n return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n \n\n /* ShapeBuilder Begin */\n\n var builders = {\n \"circle\":{\n getShape: function() {\n return new paper.Path.Circle([0, 0], 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Circle(center, radius);\n }\n },\n \"rectangle\":{\n getShape: function() {\n return new paper.Path.Rectangle([-2, -2], [2, 2]);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n }\n },\n \"ellipse\":{\n getShape: function() {\n return new paper.Path.Ellipse(new paper.Rectangle([-2, -1], [2, 1]));\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Ellipse(new paper.Rectangle([-radius, -radius/2], [radius*2, radius]));\n }\n },\n \"polygon\":{\n getShape: function() {\n return new paper.Path.RegularPolygon([0, 0], 6, 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.RegularPolygon([0, 0], 6, radius);\n }\n },\n \"diamond\":{\n getShape: function() {\n var d = new paper.Path.Rectangle([-2, -2], [2, 2]);\n d.rotate(45);\n return d;\n },\n getImageShape: function(center, radius) {\n var d = new paper.Path.Rectangle([-radius, -radius], [radius*2, radius*2]);\n d.rotate(45);\n return d;\n }\n },\n \"star\":{\n getShape: function() {\n return new paper.Path.Star([0, 0], 8, 1, 0.7);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.Star([0, 0], 8, radius*1, radius*0.7);\n }\n },\n \"svg\": function(path){\n return {\n getShape: function() {\n return new paper.Path(path);\n },\n getImageShape: function(center, radius) {\n // No calcul for the moment \n return new paper.Path();\n }\n };\n }\n };\n \n var ShapeBuilder = function (shape){\n if(typeof shape===\"undefined\"){\n shape = \"circle\";\n }\n if(shape.substr(0,4)===\"svg:\"){\n return builders.svg(shape.substr(4));\n }\n if(!(shape in builders)){\n shape = \"circle\";\n }\n return builders[shape];\n };\n \n return ShapeBuilder;\n\n});\n\ndefine('renderer/noderepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation', 'renderer/shapebuilder'], function ($, _, requtils, BaseRepresentation, ShapeBuilder) {\n \n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer.Node Class */\n\n /* The representation for the node : A circle, with an image inside and a text label underneath.\n * The circle and the image are drawn on canvas and managed by Paper.js.\n * The text label is an HTML node, managed by jQuery. */\n\n //var NodeRepr = Renderer.Node = Utils.inherit(Renderer._BaseRepresentation);\n var NodeRepr = Utils.inherit(BaseRepresentation);\n\n _(NodeRepr.prototype).extend({\n _init: function() {\n this.renderer.node_layer.activate();\n this.type = \"Node\";\n this.buildShape();\n if (this.options.show_node_circles) {\n this.circle.strokeWidth = this.options.node_stroke_width;\n this.h_ratio = 1;\n } else {\n this.h_ratio = 0;\n }\n this.title = $('<div class=\"Rk-Label\">').appendTo(this.renderer.labels_$);\n\n if (this.options.editor_mode) {\n var Renderer = requtils.getRenderer();\n this.normal_buttons = [\n new Renderer.NodeEditButton(this.renderer, null),\n new Renderer.NodeRemoveButton(this.renderer, null),\n new Renderer.NodeLinkButton(this.renderer, null),\n new Renderer.NodeEnlargeButton(this.renderer, null),\n new Renderer.NodeShrinkButton(this.renderer, null)\n ];\n this.pending_delete_buttons = [\n new Renderer.NodeRevertButton(this.renderer, null)\n ];\n this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n\n for (var i = 0; i < this.all_buttons.length; i++) {\n this.all_buttons[i].source_representation = this;\n }\n this.active_buttons = [];\n } else {\n this.active_buttons = this.all_buttons = [];\n }\n this.last_circle_radius = 1;\n\n if (this.renderer.minimap) {\n this.renderer.minimap.node_layer.activate();\n this.minimap_circle = new paper.Path.Circle([0, 0], 1);\n this.minimap_circle.__representation = this.renderer.minimap.miniframe.__representation;\n this.renderer.minimap.node_group.addChild(this.minimap_circle);\n }\n },\n buildShape: function(){\n if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n this.model.set(\"shape_changed\", false);\n delete this.img;\n }\n if(this.circle){\n this.circle.remove();\n delete this.circle;\n }\n // \"circle\" \"rectangle\" \"ellipse\" \"polygon\" \"star\" \"diamond\"\n this.shapeBuilder = new ShapeBuilder(this.model.get(\"shape\"));\n this.circle = this.shapeBuilder.getShape();\n this.circle.__representation = this;\n this.last_circle_radius = 1;\n },\n redraw: function(_dontRedrawEdges) {\n if(typeof this.model.get(\"shape_changed\")!==\"undefined\" && this.model.get(\"shape_changed\")===true){\n this.buildShape();\n }\n var _model_coords = new paper.Point(this.model.get(\"position\")),\n _baseRadius = this.options.node_size_base * Math.exp((this.model.get(\"size\") || 0) * Utils._NODE_SIZE_STEP);\n if (!this.is_dragging || !this.paper_coords) {\n this.paper_coords = this.renderer.toPaperCoords(_model_coords);\n }\n this.circle_radius = _baseRadius * this.renderer.scale;\n if (this.last_circle_radius !== this.circle_radius) {\n this.all_buttons.forEach(function(b) {\n b.setSectorSize();\n });\n this.circle.scale(this.circle_radius / this.last_circle_radius);\n if (this.node_image) {\n this.node_image.scale(this.circle_radius / this.last_circle_radius);\n }\n }\n this.circle.position = this.paper_coords;\n if (this.node_image) {\n this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n }\n this.last_circle_radius = this.circle_radius;\n\n var old_act_btn = this.active_buttons;\n\n var opacity = 1;\n if (this.model.get(\"delete_scheduled\")) {\n opacity = 0.5;\n this.active_buttons = this.pending_delete_buttons;\n this.circle.dashArray = [2,2];\n } else {\n opacity = 1;\n this.active_buttons = this.normal_buttons;\n this.circle.dashArray = null;\n }\n\n if (this.selected && this.renderer.isEditable()) {\n if (old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n }\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n if (this.node_image) {\n this.node_image.opacity = this.highlighted ? opacity * 0.5 : (opacity - 0.01);\n }\n\n this.circle.fillColor = this.highlighted ? this.options.highlighted_node_fill_color : this.options.node_fill_color;\n\n this.circle.opacity = this.options.show_node_circles ? opacity : 0.01;\n\n var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_nodes) || \"\";\n _text = Utils.shortenText(_text, this.options.node_label_max_length);\n\n if (typeof this.highlighted === \"object\") {\n this.title.html(this.highlighted.replace(_(_text).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n } else {\n this.title.text(_text);\n }\n\n this.title.css({\n left: this.paper_coords.x,\n top: this.paper_coords.y + this.circle_radius * this.h_ratio + this.options.node_label_distance,\n opacity: opacity\n });\n var _color = this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n this.circle.strokeColor = _color;\n var _pc = this.paper_coords;\n this.all_buttons.forEach(function(b) {\n b.moveTo(_pc);\n });\n var lastImage = this.img;\n this.img = this.model.get(\"image\");\n if (this.img && this.img !== lastImage) {\n this.showImage();\n }\n if (this.node_image && !this.img) {\n this.node_image.remove();\n delete this.node_image;\n }\n\n if (this.renderer.minimap) {\n this.minimap_circle.fillColor = _color;\n var minipos = this.renderer.toMinimapCoords(_model_coords),\n miniradius = this.renderer.minimap.scale * _baseRadius,\n minisize = new paper.Size([miniradius, miniradius]);\n this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2));\n }\n\n if (!_dontRedrawEdges) {\n var _this = this;\n _.each(\n this.project.get(\"edges\").filter(\n function (ed) {\n return ((ed.get(\"to\") === _this.model) || (ed.get(\"from\") === _this.model));\n }\n ),\n function(edge, index, list) {\n var repr = _this.renderer.getRepresentationByModel(edge);\n if (repr && typeof repr.from_representation !== \"undefined\" && typeof repr.from_representation.paper_coords !== \"undefined\" && typeof repr.to_representation !== \"undefined\" && typeof repr.to_representation.paper_coords !== \"undefined\") {\n repr.redraw();\n }\n }\n );\n }\n\n },\n showImage: function() {\n var _image = null;\n if (typeof this.renderer.image_cache[this.img] === \"undefined\") {\n _image = new Image();\n this.renderer.image_cache[this.img] = _image;\n _image.src = this.img;\n } else {\n _image = this.renderer.image_cache[this.img];\n }\n if (_image.width) {\n if (this.node_image) {\n this.node_image.remove();\n }\n this.renderer.node_layer.activate();\n var width = _image.width,\n height = _image.height,\n clipPath = this.model.get(\"clip_path\"),\n hasClipPath = (typeof clipPath !== \"undefined\" && clipPath),\n _clip = null,\n baseRadius = null,\n centerPoint = null;\n\n if (hasClipPath) {\n _clip = new paper.Path();\n var instructions = clipPath.match(/[a-z][^a-z]+/gi) || [],\n lastCoords = [0,0],\n minX = Infinity,\n minY = Infinity,\n maxX = -Infinity,\n maxY = -Infinity;\n\n var transformCoords = function(tabc, relative) {\n var newCoords = tabc.slice(1).map(function(v, k) {\n var res = parseFloat(v),\n isY = k % 2;\n if (isY) {\n res = ( res - 0.5 ) * height;\n } else {\n res = ( res - 0.5 ) * width;\n }\n if (relative) {\n res += lastCoords[isY];\n }\n if (isY) {\n minY = Math.min(minY, res);\n maxY = Math.max(maxY, res);\n } else {\n minX = Math.min(minX, res);\n maxX = Math.max(maxX, res);\n }\n return res;\n });\n lastCoords = newCoords.slice(-2);\n return newCoords;\n };\n\n instructions.forEach(function(instr) {\n var coords = instr.match(/([a-z]|[0-9.-]+)/ig) || [\"\"];\n switch(coords[0]) {\n case \"M\":\n _clip.moveTo(transformCoords(coords));\n break;\n case \"m\":\n _clip.moveTo(transformCoords(coords, true));\n break;\n case \"L\":\n _clip.lineTo(transformCoords(coords));\n break;\n case \"l\":\n _clip.lineTo(transformCoords(coords, true));\n break;\n case \"C\":\n _clip.cubicCurveTo(transformCoords(coords));\n break;\n case \"c\":\n _clip.cubicCurveTo(transformCoords(coords, true));\n break;\n case \"Q\":\n _clip.quadraticCurveTo(transformCoords(coords));\n break;\n case \"q\":\n _clip.quadraticCurveTo(transformCoords(coords, true));\n break;\n }\n });\n\n baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](maxX - minX, maxY - minY) / 2;\n centerPoint = new paper.Point((maxX + minX) / 2, (maxY + minY) / 2);\n if (!this.options.show_node_circles) {\n this.h_ratio = (maxY - minY) / (2 * baseRadius);\n }\n } else {\n baseRadius = Math[this.options.node_images_fill_mode ? \"min\" : \"max\"](width, height) / 2;\n centerPoint = new paper.Point(0,0);\n if (!this.options.show_node_circles) {\n this.h_ratio = height / (2 * baseRadius);\n }\n }\n var _raster = new paper.Raster(_image);\n _raster.locked = true; // Disable mouse events on icon\n if (hasClipPath) {\n _raster = new paper.Group(_clip, _raster);\n _raster.opacity = 0.99;\n /* This is a workaround to allow clipping at group level\n * If opacity was set to 1, paper.js would merge all clipping groups in one (known bug).\n */\n _raster.clipped = true;\n _clip.__representation = this;\n }\n if (this.options.clip_node_images) {\n var _circleClip = this.shapeBuilder.getImageShape(centerPoint, baseRadius);\n _raster = new paper.Group(_circleClip, _raster);\n _raster.opacity = 0.99;\n _raster.clipped = true;\n _circleClip.__representation = this;\n }\n this.image_delta = centerPoint.divide(baseRadius);\n this.node_image = _raster;\n this.node_image.__representation = _this;\n this.node_image.scale(this.circle_radius / baseRadius);\n this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));\n this.redraw();\n this.renderer.throttledPaperDraw();\n } else {\n var _this = this;\n $(_image).on(\"load\", function() {\n _this.showImage();\n });\n }\n },\n paperShift: function(_delta) {\n if (this.options.editor_mode) {\n if (!this.renkan.read_only) {\n this.is_dragging = true;\n this.paper_coords = this.paper_coords.add(_delta);\n this.redraw();\n }\n } else {\n this.renderer.paperShift(_delta);\n }\n },\n openEditor: function() {\n this.renderer.removeRepresentationsOfType(\"editor\");\n var _editor = this.renderer.addRepresentation(\"NodeEditor\",null);\n _editor.source_representation = this;\n _editor.draw();\n },\n select: function() {\n this.selected = true;\n this.circle.strokeWidth = this.options.selected_node_stroke_width;\n if (this.renderer.isEditable()) {\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n var _uri = this.model.get(\"uri\");\n if (_uri) {\n $('.Rk-Bin-Item').each(function() {\n var _el = $(this);\n if (_el.attr(\"data-uri\") === _uri) {\n _el.addClass(\"selected\");\n }\n });\n }\n if (!this.options.editor_mode) {\n this.openEditor();\n }\n\n if (this.renderer.minimap) {\n this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;\n this.minimap_circle.strokeColor = this.options.minimap_highlight_color;\n }\n this._super(\"select\");\n },\n hideButtons: function() {\n this.all_buttons.forEach(function(b) {\n b.hide();\n });\n delete(this.buttonTimeout);\n },\n unselect: function(_newTarget) {\n if (!_newTarget || _newTarget.source_representation !== this) {\n this.selected = false;\n var _this = this;\n this.buttons_timeout = setTimeout(function() { _this.hideButtons(); }, 200);\n this.circle.strokeWidth = this.options.node_stroke_width;\n $('.Rk-Bin-Item').removeClass(\"selected\");\n if (this.renderer.minimap) {\n this.minimap_circle.strokeColor = undefined;\n }\n this._super(\"unselect\");\n }\n },\n highlight: function(textToReplace) {\n var hlvalue = textToReplace || true;\n if (this.highlighted === hlvalue) {\n return;\n }\n this.highlighted = hlvalue;\n this.redraw();\n this.renderer.throttledPaperDraw();\n },\n unhighlight: function() {\n if (!this.highlighted) {\n return;\n }\n this.highlighted = false;\n this.redraw();\n this.renderer.throttledPaperDraw();\n },\n saveCoords: function() {\n var _coords = this.renderer.toModelCoords(this.paper_coords),\n _data = {\n position: {\n x: _coords.x,\n y: _coords.y\n }\n };\n if (this.renderer.isEditable()) {\n this.model.set(_data);\n }\n },\n mousedown: function(_event, _isTouch) {\n if (_isTouch) {\n this.renderer.unselectAll();\n this.select();\n }\n },\n mouseup: function(_event, _isTouch) {\n if (this.renderer.is_dragging && this.renderer.isEditable()) {\n this.saveCoords();\n } else {\n if (!_isTouch && !this.model.get(\"delete_scheduled\")) {\n this.openEditor();\n }\n this.model.trigger(\"clicked\");\n }\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.is_dragging = false;\n },\n destroy: function(_event) {\n this._super(\"destroy\");\n this.all_buttons.forEach(function(b) {\n b.destroy();\n });\n this.circle.remove();\n this.title.remove();\n if (this.renderer.minimap) {\n this.minimap_circle.remove();\n }\n if (this.node_image) {\n this.node_image.remove();\n }\n }\n });\n\n return NodeRepr;\n\n});\n\n\ndefine('renderer/edge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* Edge Class Begin */\n\n //var Edge = Renderer.Edge = Utils.inherit(Renderer._BaseRepresentation);\n var Edge = Utils.inherit(BaseRepresentation);\n\n _(Edge.prototype).extend({\n _init: function() {\n this.renderer.edge_layer.activate();\n this.type = \"Edge\";\n this.from_representation = this.renderer.getRepresentationByModel(this.model.get(\"from\"));\n this.to_representation = this.renderer.getRepresentationByModel(this.model.get(\"to\"));\n this.bundle = this.renderer.addToBundles(this);\n this.line = new paper.Path();\n this.line.add([0,0],[0,0],[0,0]);\n this.line.__representation = this;\n this.line.strokeWidth = this.options.edge_stroke_width;\n this.arrow = new paper.Path();\n this.arrow.add(\n [ 0, 0 ],\n [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n [ 0, this.options.edge_arrow_width ]\n );\n this.arrow.__representation = this;\n this.text = $('<div class=\"Rk-Label Rk-Edge-Label\">').appendTo(this.renderer.labels_$);\n this.arrow_angle = 0;\n if (this.options.editor_mode) {\n var Renderer = requtils.getRenderer();\n this.normal_buttons = [\n new Renderer.EdgeEditButton(this.renderer, null),\n new Renderer.EdgeRemoveButton(this.renderer, null)\n ];\n this.pending_delete_buttons = [\n new Renderer.EdgeRevertButton(this.renderer, null)\n ];\n this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);\n for (var i = 0; i < this.all_buttons.length; i++) {\n this.all_buttons[i].source_representation = this;\n }\n this.active_buttons = [];\n } else {\n this.active_buttons = this.all_buttons = [];\n }\n\n if (this.renderer.minimap) {\n this.renderer.minimap.edge_layer.activate();\n this.minimap_line = new paper.Path();\n this.minimap_line.add([0,0],[0,0]);\n this.minimap_line.__representation = this.renderer.minimap.miniframe.__representation;\n this.minimap_line.strokeWidth = 1;\n }\n },\n redraw: function() {\n var from = this.model.get(\"from\"),\n to = this.model.get(\"to\");\n if (!from || !to) {\n return;\n }\n this.from_representation = this.renderer.getRepresentationByModel(from);\n this.to_representation = this.renderer.getRepresentationByModel(to);\n if (typeof this.from_representation === \"undefined\" || typeof this.to_representation === \"undefined\") {\n return;\n }\n var _p0a = this.from_representation.paper_coords,\n _p1a = this.to_representation.paper_coords,\n _v = _p1a.subtract(_p0a),\n _r = _v.length,\n _u = _v.divide(_r),\n _ortho = new paper.Point([- _u.y, _u.x]),\n _group_pos = this.bundle.getPosition(this),\n _delta = _ortho.multiply( this.options.edge_gap_in_bundles * _group_pos ),\n _p0b = _p0a.add(_delta), /* Adding a 4 px difference */\n _p1b = _p1a.add(_delta), /* to differentiate bundled links */\n _a = _v.angle,\n _textdelta = _ortho.multiply(this.options.edge_label_distance),\n _handle = _v.divide(3),\n _color = this.model.get(\"color\") || this.model.get(\"color\") || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n opacity = 1;\n\n if (this.model.get(\"delete_scheduled\") || this.from_representation.model.get(\"delete_scheduled\") || this.to_representation.model.get(\"delete_scheduled\")) {\n opacity = 0.5;\n this.line.dashArray = [2, 2];\n } else {\n opacity = 1;\n this.line.dashArray = null;\n }\n\n var old_act_btn = this.active_buttons;\n\n this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.strokeColor = _color;\n this.line.opacity = opacity;\n this.line.segments[0].point = _p0a;\n this.line.segments[1].point = this.paper_coords;\n this.line.segments[1].handleIn = _handle.multiply(-1);\n this.line.segments[1].handleOut = _handle;\n this.line.segments[2].point = _p1a;\n this.arrow.rotate(_a - this.arrow_angle);\n this.arrow.fillColor = _color;\n this.arrow.opacity = opacity;\n this.arrow.position = this.paper_coords;\n this.arrow_angle = _a;\n if (_a > 90) {\n _a -= 180;\n _textdelta = _textdelta.multiply(-1);\n }\n if (_a < -90) {\n _a += 180;\n _textdelta = _textdelta.multiply(-1);\n }\n var _text = this.model.get(\"title\") || this.renkan.translate(this.options.label_untitled_edges) || \"\";\n _text = Utils.shortenText(_text, this.options.node_label_max_length);\n this.text.text(_text);\n var _textpos = this.paper_coords.add(_textdelta);\n this.text.css({\n left: _textpos.x,\n top: _textpos.y,\n transform: \"rotate(\" + _a + \"deg)\",\n \"-moz-transform\": \"rotate(\" + _a + \"deg)\",\n \"-webkit-transform\": \"rotate(\" + _a + \"deg)\",\n opacity: opacity\n });\n this.text_angle = _a;\n\n var _pc = this.paper_coords;\n this.all_buttons.forEach(function(b) {\n b.moveTo(_pc);\n });\n\n if (this.renderer.minimap) {\n this.minimap_line.strokeColor = _color;\n this.minimap_line.segments[0].point = this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get(\"position\")));\n this.minimap_line.segments[1].point = this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get(\"position\")));\n }\n },\n openEditor: function() {\n this.renderer.removeRepresentationsOfType(\"editor\");\n var _editor = this.renderer.addRepresentation(\"EdgeEditor\",null);\n _editor.source_representation = this;\n _editor.draw();\n },\n select: function() {\n this.selected = true;\n this.line.strokeWidth = this.options.selected_edge_stroke_width;\n if (this.renderer.isEditable()) {\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n if (!this.options.editor_mode) {\n this.openEditor();\n }\n this._super(\"select\");\n },\n unselect: function(_newTarget) {\n if (!_newTarget || _newTarget.source_representation !== this) {\n this.selected = false;\n if (this.options.editor_mode) {\n this.all_buttons.forEach(function(b) {\n b.hide();\n });\n }\n this.line.strokeWidth = this.options.edge_stroke_width;\n this._super(\"unselect\");\n }\n },\n mousedown: function(_event, _isTouch) {\n if (_isTouch) {\n this.renderer.unselectAll();\n this.select();\n }\n },\n mouseup: function(_event, _isTouch) {\n if (!this.renkan.read_only && this.renderer.is_dragging) {\n this.from_representation.saveCoords();\n this.to_representation.saveCoords();\n this.from_representation.is_dragging = false;\n this.to_representation.is_dragging = false;\n } else {\n if (!_isTouch) {\n this.openEditor();\n }\n this.model.trigger(\"clicked\");\n }\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n },\n paperShift: function(_delta) {\n if (this.options.editor_mode) {\n if (!this.options.read_only) {\n this.from_representation.paperShift(_delta);\n this.to_representation.paperShift(_delta);\n }\n } else {\n this.renderer.paperShift(_delta);\n }\n },\n destroy: function() {\n this._super(\"destroy\");\n this.line.remove();\n this.arrow.remove();\n this.text.remove();\n if (this.renderer.minimap) {\n this.minimap_line.remove();\n }\n this.all_buttons.forEach(function(b) {\n b.destroy();\n });\n var _this = this;\n this.bundle.edges = _(this.bundle.edges).reject(function(_edge) {\n return _this === _edge;\n });\n }\n });\n\n return Edge;\n\n});\n\n\n\ndefine('renderer/tempedge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* TempEdge Class Begin */\n\n //var TempEdge = Renderer.TempEdge = Utils.inherit(Renderer._BaseRepresentation);\n var TempEdge = Utils.inherit(BaseRepresentation);\n\n _(TempEdge.prototype).extend({\n _init: function() {\n this.renderer.edge_layer.activate();\n this.type = \"Temp-edge\";\n\n var _color = (this.project.get(\"users\").get(this.renkan.current_user) || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\");\n this.line = new paper.Path();\n this.line.strokeColor = _color;\n this.line.dashArray = [4, 2];\n this.line.strokeWidth = this.options.selected_edge_stroke_width;\n this.line.add([0,0],[0,0]);\n this.line.__representation = this;\n this.arrow = new paper.Path();\n this.arrow.fillColor = _color;\n this.arrow.add(\n [ 0, 0 ],\n [ this.options.edge_arrow_length, this.options.edge_arrow_width / 2 ],\n [ 0, this.options.edge_arrow_width ]\n );\n this.arrow.__representation = this;\n this.arrow_angle = 0;\n },\n redraw: function() {\n var _p0 = this.from_representation.paper_coords,\n _p1 = this.end_pos,\n _a = _p1.subtract(_p0).angle,\n _c = _p0.add(_p1).divide(2);\n this.line.segments[0].point = _p0;\n this.line.segments[1].point = _p1;\n this.arrow.rotate(_a - this.arrow_angle);\n this.arrow.position = _c;\n this.arrow_angle = _a;\n },\n paperShift: function(_delta) {\n if (!this.renderer.isEditable()) {\n this.renderer.removeRepresentation(_this);\n paper.view.draw();\n return;\n }\n this.end_pos = this.end_pos.add(_delta);\n var _hitResult = paper.project.hitTest(this.end_pos);\n this.renderer.findTarget(_hitResult);\n this.redraw();\n },\n mouseup: function(_event, _isTouch) {\n var _hitResult = paper.project.hitTest(_event.point),\n _model = this.from_representation.model,\n _endDrag = true;\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n var _target = _hitResult.item.__representation;\n if (_target.type.substr(0,4) === \"Node\") {\n var _destmodel = _target.model || _target.source_representation.model;\n if (_model !== _destmodel) {\n var _data = {\n id: Utils.getUID('edge'),\n created_by: this.renkan.current_user,\n from: _model,\n to: _destmodel\n };\n if (this.renderer.isEditable()) {\n this.project.addEdge(_data);\n }\n }\n }\n\n if (_model === _target.model || (_target.source_representation && _target.source_representation.model === _model)) {\n _endDrag = false;\n this.renderer.is_dragging = true;\n }\n }\n if (_endDrag) {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.renderer.removeRepresentation(this);\n paper.view.draw();\n }\n },\n destroy: function() {\n this.arrow.remove();\n this.line.remove();\n }\n });\n\n /* TempEdge Class End */\n\n return TempEdge;\n\n});\n\n\ndefine('renderer/baseeditor',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* _BaseEditor Begin */\n //var _BaseEditor = Renderer._BaseEditor = Utils.inherit(Renderer._BaseRepresentation);\n var _BaseEditor = Utils.inherit(BaseRepresentation);\n\n _(_BaseEditor.prototype).extend({\n _init: function() {\n this.renderer.buttons_layer.activate();\n this.type = \"editor\";\n this.editor_block = new paper.Path();\n var _pts = _(_.range(8)).map(function() {return [0,0];});\n this.editor_block.add.apply(this.editor_block, _pts);\n this.editor_block.strokeWidth = this.options.tooltip_border_width;\n this.editor_block.strokeColor = this.options.tooltip_border_color;\n this.editor_block.opacity = 0.8;\n this.editor_$ = $('<div>')\n .appendTo(this.renderer.editor_$)\n .css({\n position: \"absolute\",\n opacity: 0.8\n })\n .hide();\n },\n destroy: function() {\n this.editor_block.remove();\n this.editor_$.remove();\n }\n });\n\n /* _BaseEditor End */\n\n return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeEditor Begin */\n //var NodeEditor = Renderer.NodeEditor = Utils.inherit(Renderer._BaseEditor);\n var NodeEditor = Utils.inherit(BaseEditor);\n\n _(NodeEditor.prototype).extend({\n \t_init: function() {\n \t\tBaseEditor.prototype._init.apply(this);\n \t\tthis.template = this.options.templates['templates/nodeeditor.html'];\n \t\tthis.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];\n \t},\n draw: function() {\n var _model = this.source_representation.model,\n _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate ),\n _image_placeholder = this.options.static_url + \"img/image-placeholder.png\",\n _size = (_model.get(\"size\") || 0);\n this.editor_$\n .html(_template({\n node: {\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n short_uri: Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n description: _model.get(\"description\"),\n image: _model.get(\"image\") || \"\",\n image_placeholder: _image_placeholder,\n color: _model.get(\"color\") || _created_by.get(\"color\"),\n clip_path: _model.get(\"clip_path\") || false,\n created_by_color: _created_by.get(\"color\"),\n created_by_title: _created_by.get(\"title\"),\n size: (_size > 0 ? \"+\" : \"\") + _size,\n shape: _model.get(\"shape\") || \"circle\"\n },\n renkan: this.renkan,\n options: this.options,\n shortenText: Utils.shortenText\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n\n this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n\n this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n if (!_model.get(\"uri\")) {\n return false;\n }\n });\n\n if (this.renderer.isEditable()) {\n\n var onFieldChange = _(function() {\n _(function() {\n if (_this.renderer.isEditable()) {\n var _data = {\n title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n };\n if (_this.options.show_node_editor_uri) {\n _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n }\n if (_this.options.show_node_editor_image) {\n _data.image = _this.editor_$.find(\".Rk-Edit-Image\").val();\n _this.editor_$.find(\".Rk-Edit-ImgPreview\").attr(\"src\", _data.image || _image_placeholder);\n }\n if (_this.options.show_node_editor_description) {\n _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n }\n if (_this.options.change_shapes) {\n if(_model.get(\"shape\")!==_this.editor_$.find(\".Rk-Edit-Shape\").val()){\n _data.shape = _this.editor_$.find(\".Rk-Edit-Shape\").val();\n _data.shape_changed = true;\n }\n }\n _model.set(_data);\n _this.redraw();\n // For an unknown reason, we have to set data twice when we change shape, otherwise the image disappears.\n if(_data.shape_changed===true){\n _model.set(_data);\n }\n } else {\n closeEditor();\n }\n }).defer();\n }).throttle(500);\n \n this.editor_$.on(\"keyup\", function(_e) {\n if (_e.keyCode === 27) {\n closeEditor();\n }\n });\n\n this.editor_$.find(\"input, textarea, select\").on(\"change keyup paste\", onFieldChange);\n\n if(_this.options.allow_image_upload) {\n this.editor_$.find(\".Rk-Edit-Image-File\").change(function() {\n if (this.files.length) {\n var f = this.files[0],\n fr = new FileReader();\n if (f.type.substr(0,5) !== \"image\") {\n alert(_this.renkan.translate(\"This file is not an image\"));\n return;\n }\n if (f.size > (_this.options.uploaded_image_max_kb * 1024)) {\n alert(_this.renkan.translate(\"Image size must be under \") + _this.options.uploaded_image_max_kb + _this.renkan.translate(\"KB\"));\n return;\n }\n fr.onload = function(e) {\n _this.editor_$.find(\".Rk-Edit-Image\").val(e.target.result);\n onFieldChange();\n };\n fr.readAsDataURL(f);\n }\n });\n }\n this.editor_$.find(\".Rk-Edit-Title\")[0].focus();\n\n var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n function(_e) {\n _e.preventDefault();\n _picker.show();\n },\n function(_e) {\n _e.preventDefault();\n _picker.hide();\n }\n );\n\n _picker.find(\"li\").hover(\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n },\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n }\n ).click(function(_e) {\n _e.preventDefault();\n if (_this.renderer.isEditable()) {\n _model.set(\"color\", $(this).attr(\"data-color\"));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n\n var shiftSize = function(n) {\n if (_this.renderer.isEditable()) {\n var _newsize = n+(_model.get(\"size\") || 0);\n _this.editor_$.find(\".Rk-Edit-Size-Value\").text((_newsize > 0 ? \"+\" : \"\") + _newsize);\n _model.set(\"size\", _newsize);\n paper.view.draw();\n } else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\".Rk-Edit-Size-Down\").click(function() {\n shiftSize(-1);\n return false;\n });\n this.editor_$.find(\".Rk-Edit-Size-Up\").click(function() {\n shiftSize(1);\n return false;\n });\n \n this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n \t_this.editor_$.find(\".Rk-Edit-Image\").val('');\n \tonFieldChange();\n return false;\n });\n } else {\n if (typeof this.source_representation.highlighted === \"object\") {\n var titlehtml = this.source_representation.highlighted.replace(_(_model.get(\"title\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>');\n this.editor_$.find(\".Rk-Display-Title\" + (_model.get(\"uri\") ? \" a\" : \"\")).html(titlehtml);\n if (this.options.show_node_tooltip_description) {\n this.editor_$.find(\".Rk-Display-Description\").html(this.source_representation.highlighted.replace(_(_model.get(\"description\")).escape(),'<span class=\"Rk-Highlighted\">$1</span>'));\n }\n }\n }\n this.editor_$.find(\"img\").load(function() {\n _this.redraw();\n });\n },\n redraw: function() {\n var _coords = this.source_representation.paper_coords;\n Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);\n this.editor_$.show();\n paper.view.draw();\n }\n });\n\n /* NodeEditor End */\n\n return NodeEditor;\n\n});\n\n\ndefine('renderer/edgeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeEditor Begin */\n\n //var EdgeEditor = Renderer.EdgeEditor = Utils.inherit(Renderer._BaseEditor);\n var EdgeEditor = Utils.inherit(BaseEditor);\n\n _(EdgeEditor.prototype).extend({\n \t_init: function() {\n \t\tBaseEditor.prototype._init.apply(this);\n \t\tthis.template = this.options.templates['templates/edgeeditor.html'];\n \t\tthis.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html'];\n \t},\n draw: function() {\n var _model = this.source_representation.model,\n _from_model = _model.get(\"from\"),\n _to_model = _model.get(\"to\"),\n _created_by = _model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan),\n _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate);\n this.editor_$\n .html(_template({\n edge: {\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n short_uri: Utils.shortenText((_model.get(\"uri\") || \"\").replace(/^(https?:\\/\\/)?(www\\.)?/,'').replace(/\\/$/,''),40),\n description: _model.get(\"description\"),\n color: _model.get(\"color\") || _created_by.get(\"color\"),\n from_title: _from_model.get(\"title\"),\n to_title: _to_model.get(\"title\"),\n from_color: _from_model.get(\"color\") || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n to_color: _to_model.get(\"color\") || (_to_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n created_by_color: _created_by.get(\"color\"),\n created_by_title: _created_by.get(\"title\")\n },\n renkan: this.renkan,\n shortenText: Utils.shortenText,\n options: this.options\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n this.editor_$.find(\".Rk-CloseX\").click(closeEditor);\n this.editor_$.find(\".Rk-Edit-Goto\").click(function() {\n if (!_model.get(\"uri\")) {\n return false;\n }\n });\n\n if (this.renderer.isEditable()) {\n\n var onFieldChange = _(function() {\n _(function() {\n if (_this.renderer.isEditable()) {\n var _data = {\n title: _this.editor_$.find(\".Rk-Edit-Title\").val()\n };\n if (_this.options.show_edge_editor_uri) {\n _data.uri = _this.editor_$.find(\".Rk-Edit-URI\").val();\n }\n _this.editor_$.find(\".Rk-Edit-Goto\").attr(\"href\",_data.uri || \"#\");\n _model.set(_data);\n paper.view.draw();\n } else {\n closeEditor();\n }\n }).defer();\n }).throttle(500);\n\n this.editor_$.on(\"keyup\", function(_e) {\n if (_e.keyCode === 27) {\n closeEditor();\n }\n });\n\n this.editor_$.find(\"input\").on(\"keyup change paste\", onFieldChange);\n\n this.editor_$.find(\".Rk-Edit-Vocabulary\").change(function() {\n var e = $(this),\n v = e.val();\n if (v) {\n _this.editor_$.find(\".Rk-Edit-Title\").val(e.find(\":selected\").text());\n _this.editor_$.find(\".Rk-Edit-URI\").val(v);\n onFieldChange();\n }\n });\n this.editor_$.find(\".Rk-Edit-Direction\").click(function() {\n if (_this.renderer.isEditable()) {\n _model.set({\n from: _model.get(\"to\"),\n to: _model.get(\"from\")\n });\n _this.draw();\n } else {\n closeEditor();\n }\n });\n\n var _picker = _this.editor_$.find(\".Rk-Edit-ColorPicker\");\n\n this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").hover(\n function(_e) {\n _e.preventDefault();\n _picker.show();\n },\n function(_e) {\n _e.preventDefault();\n _picker.hide();\n }\n );\n\n _picker.find(\"li\").hover(\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", $(this).attr(\"data-color\"));\n },\n function(_e) {\n _e.preventDefault();\n _this.editor_$.find(\".Rk-Edit-Color\").css(\"background\", _model.get(\"color\") || (_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(_this.renkan)).get(\"color\"));\n }\n ).click(function(_e) {\n _e.preventDefault();\n if (_this.renderer.isEditable()) {\n _model.set(\"color\", $(this).attr(\"data-color\"));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n }\n },\n redraw: function() {\n var _coords = this.source_representation.paper_coords;\n Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);\n this.editor_$.show();\n paper.view.draw();\n }\n });\n\n /* EdgeEditor End */\n\n return EdgeEditor;\n\n});\n\n\ndefine('renderer/nodebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* _NodeButton Begin */\n\n //var _NodeButton = Renderer._NodeButton = Utils.inherit(Renderer._BaseButton);\n var _NodeButton = Utils.inherit(BaseButton);\n\n _(_NodeButton.prototype).extend({\n setSectorSize: function() {\n var sectorInner = this.source_representation.circle_radius;\n if (sectorInner !== this.lastSectorInner) {\n if (this.sector) {\n this.sector.destroy();\n }\n this.sector = this.renderer.drawSector(\n this, 1 + sectorInner,\n Utils._NODE_BUTTON_WIDTH + sectorInner,\n this.startAngle,\n this.endAngle,\n 1,\n this.imageName,\n this.renkan.translate(this.text)\n );\n this.lastSectorInner = sectorInner;\n }\n },\n unselect: function() {\n BaseButton.prototype.unselect.apply(this, Array.prototype.slice.call(arguments, 1));\n if(this.source_representation && this.source_representation.buttons_timeout) {\n clearTimeout(this.source_representation.buttons_timeout);\n this.source_representation.hideButtons();\n }\n },\n select: function() {\n if(this.source_representation && this.source_representation.buttons_timeout) {\n clearTimeout(this.source_representation.buttons_timeout);\n }\n this.sector.select();\n },\n });\n\n /* _NodeButton End */\n\n return _NodeButton;\n\n});\n\n\ndefine('renderer/nodeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeEditButton Begin */\n\n //var NodeEditButton = Renderer.NodeEditButton = Utils.inherit(Renderer._NodeButton);\n var NodeEditButton = Utils.inherit(NodeButton);\n\n _(NodeEditButton.prototype).extend({\n _init: function() {\n this.type = \"Node-edit-button\";\n this.lastSectorInner = 0;\n this.startAngle = -135;\n this.endAngle = -45;\n this.imageName = \"edit\";\n this.text = \"Edit\";\n },\n mouseup: function() {\n if (!this.renderer.is_dragging) {\n this.source_representation.openEditor();\n }\n }\n });\n\n /* NodeEditButton End */\n\n return NodeEditButton;\n\n});\n\n\ndefine('renderer/noderemovebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n \n var Utils = requtils.getUtils();\n\n /* NodeRemoveButton Begin */\n\n //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);\n var NodeRemoveButton = Utils.inherit(NodeButton);\n\n _(NodeRemoveButton.prototype).extend({\n _init: function() {\n this.type = \"Node-remove-button\";\n this.lastSectorInner = 0;\n this.startAngle = 0;\n this.endAngle = 90;\n this.imageName = \"remove\";\n this.text = \"Remove\";\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.renderer.removeRepresentationsOfType(\"editor\");\n if (this.renderer.isEditable()) {\n if (this.options.element_delete_delay) {\n var delid = Utils.getUID(\"delete\");\n this.renderer.delete_list.push({\n id: delid,\n time: new Date().valueOf() + this.options.element_delete_delay\n });\n this.source_representation.model.set(\"delete_scheduled\", delid);\n } else {\n if (confirm(this.renkan.translate('Do you really wish to remove node ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n this.project.removeNode(this.source_representation.model);\n }\n }\n }\n }\n });\n\n /* NodeRemoveButton End */\n\n return NodeRemoveButton;\n\n});\n\n\ndefine('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeRevertButton Begin */\n\n //var NodeRevertButton = Renderer.NodeRevertButton = Utils.inherit(Renderer._NodeButton);\n var NodeRevertButton = Utils.inherit(NodeButton);\n\n _(NodeRevertButton.prototype).extend({\n _init: function() {\n this.type = \"Node-revert-button\";\n this.lastSectorInner = 0;\n this.startAngle = -135;\n this.endAngle = 135;\n this.imageName = \"revert\";\n this.text = \"Cancel deletion\";\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n if (this.renderer.isEditable()) {\n this.source_representation.model.unset(\"delete_scheduled\");\n }\n }\n });\n\n /* NodeRevertButton End */\n\n return NodeRevertButton;\n\n});\n\n\ndefine('renderer/nodelinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeLinkButton Begin */\n\n //var NodeLinkButton = Renderer.NodeLinkButton = Utils.inherit(Renderer._NodeButton);\n var NodeLinkButton = Utils.inherit(NodeButton);\n\n _(NodeLinkButton.prototype).extend({\n _init: function() {\n this.type = \"Node-link-button\";\n this.lastSectorInner = 0;\n this.startAngle = 90;\n this.endAngle = 180;\n this.imageName = \"link\";\n this.text = \"Link to another node\";\n },\n mousedown: function(_event, _isTouch) {\n if (this.renderer.isEditable()) {\n var _off = this.renderer.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]);\n this.renderer.click_target = null;\n this.renderer.removeRepresentationsOfType(\"editor\");\n this.renderer.addTempEdge(this.source_representation, _point);\n }\n }\n });\n\n /* NodeLinkButton End */\n\n return NodeLinkButton;\n\n});\n\n\n\ndefine('renderer/nodeenlargebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n \n var Utils = requtils.getUtils();\n\n /* NodeEnlargeButton Begin */\n\n //var NodeEnlargeButton = Renderer.NodeEnlargeButton = Utils.inherit(Renderer._NodeButton);\n var NodeEnlargeButton = Utils.inherit(NodeButton);\n\n _(NodeEnlargeButton.prototype).extend({\n _init: function() {\n this.type = \"Node-enlarge-button\";\n this.lastSectorInner = 0;\n this.startAngle = -45;\n this.endAngle = 0;\n this.imageName = \"enlarge\";\n this.text = \"Enlarge\";\n },\n mouseup: function() {\n var _newsize = 1 + (this.source_representation.model.get(\"size\") || 0);\n this.source_representation.model.set(\"size\", _newsize);\n this.source_representation.select();\n this.select();\n paper.view.draw();\n }\n });\n\n /* NodeEnlargeButton End */\n\n return NodeEnlargeButton;\n\n});\n\n\ndefine('renderer/nodeshrinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* NodeShrinkButton Begin */\n\n //var NodeShrinkButton = Renderer.NodeShrinkButton = Utils.inherit(Renderer._NodeButton);\n var NodeShrinkButton = Utils.inherit(NodeButton);\n\n _(NodeShrinkButton.prototype).extend({\n _init: function() {\n this.type = \"Node-shrink-button\";\n this.lastSectorInner = 0;\n this.startAngle = -180;\n this.endAngle = -135;\n this.imageName = \"shrink\";\n this.text = \"Shrink\";\n },\n mouseup: function() {\n var _newsize = -1 + (this.source_representation.model.get(\"size\") || 0);\n this.source_representation.model.set(\"size\", _newsize);\n this.source_representation.select();\n this.select();\n paper.view.draw();\n }\n });\n\n /* NodeShrinkButton End */\n\n return NodeShrinkButton;\n\n});\n\n\ndefine('renderer/edgeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeEditButton Begin */\n\n //var EdgeEditButton = Renderer.EdgeEditButton = Utils.inherit(Renderer._BaseButton);\n var EdgeEditButton = Utils.inherit(BaseButton);\n\n _(EdgeEditButton.prototype).extend({\n _init: function() {\n this.type = \"Edge-edit-button\";\n this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -270, -90, 1, \"edit\", this.renkan.translate(\"Edit\"));\n },\n mouseup: function() {\n if (!this.renderer.is_dragging) {\n this.source_representation.openEditor();\n }\n }\n });\n\n /* EdgeEditButton End */\n\n return EdgeEditButton;\n\n});\n\n\ndefine('renderer/edgeremovebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeRemoveButton Begin */\n\n //var EdgeRemoveButton = Renderer.EdgeRemoveButton = Utils.inherit(Renderer._BaseButton);\n var EdgeRemoveButton = Utils.inherit(BaseButton);\n\n _(EdgeRemoveButton.prototype).extend({\n _init: function() {\n this.type = \"Edge-remove-button\";\n this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -90, 90, 1, \"remove\", this.renkan.translate(\"Remove\"));\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n this.renderer.removeRepresentationsOfType(\"editor\");\n if (this.renderer.isEditable()) {\n if (this.options.element_delete_delay) {\n var delid = Utils.getUID(\"delete\");\n this.renderer.delete_list.push({\n id: delid,\n time: new Date().valueOf() + this.options.element_delete_delay\n });\n this.source_representation.model.set(\"delete_scheduled\", delid);\n } else {\n if (confirm(this.renkan.translate('Do you really wish to remove edge ') + '\"' + this.source_representation.model.get(\"title\") + '\"?')) {\n this.project.removeEdge(this.source_representation.model);\n }\n }\n }\n }\n });\n\n /* EdgeRemoveButton End */\n\n return EdgeRemoveButton;\n\n});\n\n\ndefine('renderer/edgerevertbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {\n \n\n var Utils = requtils.getUtils();\n\n /* EdgeRevertButton Begin */\n\n //var EdgeRevertButton = Renderer.EdgeRevertButton = Utils.inherit(Renderer._BaseButton);\n var EdgeRevertButton = Utils.inherit(BaseButton);\n\n _(EdgeRevertButton.prototype).extend({\n _init: function() {\n this.type = \"Edge-revert-button\";\n this.sector = this.renderer.drawSector(this, Utils._EDGE_BUTTON_INNER, Utils._EDGE_BUTTON_OUTER, -135, 135, 1, \"revert\", this.renkan.translate(\"Cancel deletion\"));\n },\n mouseup: function() {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n if (this.renderer.isEditable()) {\n this.source_representation.model.unset(\"delete_scheduled\");\n }\n }\n });\n\n /* EdgeRevertButton End */\n\n return EdgeRevertButton;\n\n});\n\n\ndefine('renderer/miniframe',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* MiniFrame Begin */\n\n //var MiniFrame = Renderer.MiniFrame = Utils.inherit(Renderer._BaseRepresentation);\n var MiniFrame = Utils.inherit(BaseRepresentation);\n\n _(MiniFrame.prototype).extend({\n paperShift: function(_delta) {\n this.renderer.offset = this.renderer.offset.subtract(_delta.divide(this.renderer.minimap.scale).multiply(this.renderer.scale));\n this.renderer.redraw();\n },\n mouseup: function(_delta) {\n this.renderer.click_target = null;\n this.renderer.is_dragging = false;\n }\n });\n\n /* MiniFrame End */\n\n return MiniFrame;\n\n});\n\n\ndefine('renderer/scene',['jquery', 'underscore', 'filesaver', 'requtils', 'renderer/miniframe'], function ($, _, filesaver, requtils, MiniFrame) {\n \n\n var Utils = requtils.getUtils();\n\n /* Scene Begin */\n\n var Scene = function(_renkan) {\n this.renkan = _renkan;\n this.$ = $(\".Rk-Render\");\n this.representations = [];\n this.$.html(_renkan.options.templates['templates/scene.html'](_renkan));\n this.onStatusChange();\n this.canvas_$ = this.$.find(\".Rk-Canvas\");\n this.labels_$ = this.$.find(\".Rk-Labels\");\n this.editor_$ = this.$.find(\".Rk-Editor\");\n this.notif_$ = this.$.find(\".Rk-Notifications\");\n paper.setup(this.canvas_$[0]);\n this.scale = 1;\n this.initialScale = 1;\n this.offset = paper.view.center;\n this.totalScroll = 0;\n this.mouse_down = false;\n this.click_target = null;\n this.selected_target = null;\n this.edge_layer = new paper.Layer();\n this.node_layer = new paper.Layer();\n this.buttons_layer = new paper.Layer();\n this.delete_list = [];\n this.redrawActive = true;\n \n if (_renkan.options.show_minimap) {\n this.minimap = {\n background_layer: new paper.Layer(),\n edge_layer: new paper.Layer(),\n node_layer: new paper.Layer(),\n node_group: new paper.Group(),\n size: new paper.Size( _renkan.options.minimap_width, _renkan.options.minimap_height )\n };\n\n this.minimap.background_layer.activate();\n this.minimap.topleft = paper.view.bounds.bottomRight.subtract(this.minimap.size);\n this.minimap.rectangle = new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]), this.minimap.size.add([4,4]));\n this.minimap.rectangle.fillColor = _renkan.options.minimap_background_color;\n this.minimap.rectangle.strokeColor = _renkan.options.minimap_border_color;\n this.minimap.rectangle.strokeWidth = 4;\n this.minimap.offset = new paper.Point(this.minimap.size.divide(2));\n this.minimap.scale = 0.1;\n\n this.minimap.node_layer.activate();\n this.minimap.cliprectangle = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n this.minimap.node_group.addChild(this.minimap.cliprectangle);\n this.minimap.node_group.clipped = true;\n this.minimap.miniframe = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);\n this.minimap.node_group.addChild(this.minimap.miniframe);\n this.minimap.miniframe.fillColor = '#c0c0ff';\n this.minimap.miniframe.opacity = 0.3;\n this.minimap.miniframe.strokeColor = '#000080';\n this.minimap.miniframe.strokeWidth = 2;\n this.minimap.miniframe.__representation = new MiniFrame(this, null);\n }\n\n this.throttledPaperDraw = _(function() {\n paper.view.draw();\n }).throttle(100);\n\n this.bundles = [];\n this.click_mode = false;\n\n var _this = this,\n _allowScroll = true,\n _originalScale = 1,\n _zooming = false,\n _lastTapX = 0,\n _lastTapY = 0;\n\n this.image_cache = {};\n this.icon_cache = {};\n\n ['edit', 'remove', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {\n var img = new Image();\n img.src = _renkan.options.static_url + 'img/' + imgname + '.png';\n _this.icon_cache[imgname] = img;\n });\n\n var throttledMouseMove = _.throttle(function(_event, _isTouch) {\n _this.onMouseMove(_event, _isTouch);\n }, Utils._MOUSEMOVE_RATE);\n\n this.canvas_$.on({\n mousedown: function(_event) {\n _event.preventDefault();\n _this.onMouseDown(_event, false);\n },\n mousemove: function(_event) {\n _event.preventDefault();\n throttledMouseMove(_event, false);\n },\n mouseup: function(_event) {\n _event.preventDefault();\n _this.onMouseUp(_event, false);\n },\n mousewheel: function(_event, _delta) {\n if(_renkan.options.zoom_on_scroll) {\n _event.preventDefault();\n if (_allowScroll) {\n _this.onScroll(_event, _delta);\n }\n }\n },\n touchstart: function(_event) {\n _event.preventDefault();\n var _touches = _event.originalEvent.touches[0];\n if (\n _renkan.options.allow_double_click &&\n new Date() - _lastTap < Utils._DOUBLETAP_DELAY &&\n ( Math.pow(_lastTapX - _touches.pageX, 2) + Math.pow(_lastTapY - _touches.pageY, 2) < Utils._DOUBLETAP_DISTANCE )\n ) {\n _lastTap = 0;\n _this.onDoubleClick(_touches);\n } else {\n _lastTap = new Date();\n _lastTapX = _touches.pageX;\n _lastTapY = _touches.pageY;\n _originalScale = _this.scale;\n _zooming = false;\n _this.onMouseDown(_touches, true);\n }\n },\n touchmove: function(_event) {\n _event.preventDefault();\n _lastTap = 0;\n if (_event.originalEvent.touches.length === 1) {\n _this.onMouseMove(_event.originalEvent.touches[0], true);\n } else {\n if (!_zooming) {\n _this.onMouseUp(_event.originalEvent.touches[0], true);\n _this.click_target = null;\n _this.is_dragging = false;\n _zooming = true;\n }\n if (_event.originalEvent.scale === \"undefined\") {\n return;\n }\n var _newScale = _event.originalEvent.scale * _originalScale,\n _scaleRatio = _newScale / _this.scale,\n _newOffset = new paper.Point([\n _this.canvas_$.width(),\n _this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.offset.multiply( _scaleRatio ));\n _this.setScale(_newScale, _newOffset);\n }\n },\n touchend: function(_event) {\n _event.preventDefault();\n _this.onMouseUp(_event.originalEvent.changedTouches[0], true);\n },\n dblclick: function(_event) {\n _event.preventDefault();\n if (_renkan.options.allow_double_click) {\n _this.onDoubleClick(_event);\n }\n },\n mouseleave: function(_event) {\n _event.preventDefault();\n _this.onMouseUp(_event, false);\n _this.click_target = null;\n _this.is_dragging = false;\n },\n dragover: function(_event) {\n _event.preventDefault();\n },\n dragenter: function(_event) {\n _event.preventDefault();\n _allowScroll = false;\n },\n dragleave: function(_event) {\n _event.preventDefault();\n _allowScroll = true;\n },\n drop: function(_event) {\n _event.preventDefault();\n _allowScroll = true;\n var res = {};\n _(_event.originalEvent.dataTransfer.types).each(function(t) {\n try {\n res[t] = _event.originalEvent.dataTransfer.getData(t);\n } catch(e) {}\n });\n var text = _event.originalEvent.dataTransfer.getData(\"Text\");\n if (typeof text === \"string\") {\n switch(text[0]) {\n case \"{\":\n case \"[\":\n try {\n var data = JSON.parse(text);\n _(res).extend(data);\n }\n catch(e) {\n if (!res[\"text/plain\"]) {\n res[\"text/plain\"] = text;\n }\n }\n break;\n case \"<\":\n if (!res[\"text/html\"]) {\n res[\"text/html\"] = text;\n }\n break;\n default:\n if (!res[\"text/plain\"]) {\n res[\"text/plain\"] = text;\n }\n }\n }\n var url = _event.originalEvent.dataTransfer.getData(\"URL\");\n if (url && !res[\"text/uri-list\"]) {\n res[\"text/uri-list\"] = url;\n }\n _this.dropData(res, _event.originalEvent);\n }\n });\n\n var bindClick = function(selector, fname) {\n _this.$.find(selector).click(function(evt) {\n _this[fname](evt);\n return false;\n });\n };\n\n bindClick(\".Rk-ZoomOut\", \"zoomOut\");\n bindClick(\".Rk-ZoomIn\", \"zoomIn\");\n bindClick(\".Rk-ZoomFit\", \"autoScale\");\n this.$.find(\".Rk-ZoomSave\").click( function() {\n // Save scale and offset point\n _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset } );\n });\n this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n var view = _this.renkan.project.get(\"views\").last();\n if(view){\n _this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n }\n });\n if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n this.$.find(\".Rk-CurrentUser\").mouseenter(\n function() { _this.$.find(\".Rk-UserList\").slideDown(); }\n );\n this.$.find(\".Rk-Users\").mouseleave(\n function() { _this.$.find(\".Rk-UserList\").slideUp(); }\n );\n bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n bindClick(\".Rk-AddNode-Button\", \"addNodeBtn\");\n bindClick(\".Rk-AddEdge-Button\", \"addEdgeBtn\");\n bindClick(\".Rk-Save-Button\", \"save\");\n bindClick(\".Rk-Open-Button\", \"open\");\n bindClick(\".Rk-Export-Button\", \"exportProject\");\n this.$.find(\".Rk-Bookmarklet-Button\")\n /*jshint scripturl:true */\n .attr(\"href\",\"javascript:\" + Utils._BOOKMARKLET_CODE(_renkan))\n .click(function(){\n _this.notif_$\n .text(_renkan.translate(\"Drag this button to your bookmark bar. When on a third-party website, click it to enable drag-and-drop from the website to Renkan.\"))\n .fadeIn()\n .delay(5000)\n .fadeOut();\n return false;\n });\n this.$.find(\".Rk-TopBar-Button\").mouseover(function() {\n $(this).find(\".Rk-TopBar-Tooltip\").show();\n }).mouseout(function() {\n $(this).find(\".Rk-TopBar-Tooltip\").hide();\n });\n bindClick(\".Rk-Fold-Bins\", \"foldBins\");\n\n paper.view.onResize = function(_event) {\n var _ratio,\n newWidth = _event.width,\n newHeight = _event.height;\n\n if (_this.minimap) {\n _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size);\n _this.minimap.rectangle.fitBounds(_this.minimap.topleft.subtract([2,2]), _this.minimap.size.add([4,4]));\n _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size);\n }\n\n var ratioH = newHeight/(newHeight-_event.delta.height),\n ratioW = newWidth/(newWidth-_event.delta.width);\n if (newHeight < newWidth) {\n _ratio = ratioH;\n } else {\n _ratio = ratioW;\n }\n\n _this.resizeZoom(ratioW, ratioH, _ratio);\n\n _this.redraw();\n\n };\n\n var _thRedraw = _.throttle(function() {\n _this.redraw();\n },50);\n\n this.addRepresentations(\"Node\", this.renkan.project.get(\"nodes\"));\n this.addRepresentations(\"Edge\", this.renkan.project.get(\"edges\"));\n this.renkan.project.on(\"change:title\", function() {\n _this.$.find(\".Rk-PadTitle\").val(_renkan.project.get(\"title\"));\n });\n\n this.$.find(\".Rk-PadTitle\").on(\"keyup input paste\", function() {\n _renkan.project.set({\"title\": $(this).val()});\n });\n\n var _thRedrawUsers = _.throttle(function() {\n _this.redrawUsers();\n }, 100);\n\n _thRedrawUsers();\n\n // register model events\n this.renkan.project.on(\"change:save_status\", function(){\n switch (_this.renkan.project.get(\"save_status\")) {\n case 0: //clean\n _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n _this.$.find(\".Rk-Save-Button\").addClass(\"saved\");\n break;\n case 1: //dirty\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saving\");\n _this.$.find(\".Rk-Save-Button\").addClass(\"to-save\");\n break;\n case 2: //saving\n _this.$.find(\".Rk-Save-Button\").removeClass(\"saved\");\n _this.$.find(\".Rk-Save-Button\").removeClass(\"to-save\");\n _this.$.find(\".Rk-Save-Button\").addClass(\"saving\");\n break;\n }\n });\n\n this.renkan.project.on(\"change:loading_status\", function(){\n if (_this.renkan.project.get(\"loading_status\")){\n var animate = _this.$.find(\".loader\").addClass(\"run\");\n var timer = setTimeout(function(){\n _this.$.find(\".loader\").hide(250);\n }, 3000);\n }\n });\n\n this.renkan.project.on(\"add:users remove:users\", _thRedrawUsers);\n\n this.renkan.project.on(\"add:views remove:views\", function(_node) {\n if(_this.renkan.project.get('views').length > 0) {\n _this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n else {\n _this.$.find(\".Rk-ZoomSetSaved\").hide();\n }\n });\n\n this.renkan.project.on(\"add:nodes\", function(_node) {\n _this.addRepresentation(\"Node\", _node);\n if (!_this.renkan.project.get(\"loading_status\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"add:edges\", function(_edge) {\n _this.addRepresentation(\"Edge\", _edge);\n if (!_this.renkan.project.get(\"loading_status\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"change:title\", function(_model, _title) {\n var el = _this.$.find(\".Rk-PadTitle\");\n if (el.is(\"input\")) {\n if (el.val() !== _title) {\n el.val(_title);\n }\n } else {\n el.text(_title);\n }\n });\n\n if (_renkan.options.size_bug_fix) {\n var _delay = (\n typeof _renkan.options.size_bug_fix === \"number\" ?\n _renkan.options.size_bug_fix\n : 500\n );\n window.setTimeout(\n function() {\n _this.fixSize();\n },\n _delay\n );\n }\n\n if (_renkan.options.force_resize) {\n $(window).resize(function() {\n _this.autoScale();\n });\n }\n\n if (_renkan.options.show_user_list && _renkan.options.user_color_editable) {\n var $cpwrapper = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker-Wrapper\"),\n $cplist = this.$.find(\".Rk-Users .Rk-Edit-ColorPicker\");\n\n $cpwrapper.hover(\n function(_e) {\n if (_this.isEditable()) {\n _e.preventDefault();\n $cplist.show();\n }\n },\n function(_e) {\n _e.preventDefault();\n $cplist.hide();\n }\n );\n\n $cplist.find(\"li\").mouseenter(\n function(_e) {\n if (_this.isEditable()) {\n _e.preventDefault();\n _this.$.find(\".Rk-CurrentUser-Color\").css(\"background\", $(this).attr(\"data-color\"));\n }\n }\n );\n }\n\n if (_renkan.options.show_search_field) {\n\n var lastval = '';\n\n this.$.find(\".Rk-GraphSearch-Field\").on(\"keyup change paste input\", function() {\n var $this = $(this),\n val = $this.val();\n if (val === lastval) {\n return;\n }\n lastval = val;\n if (val.length < 2) {\n _renkan.project.get(\"nodes\").each(function(n) {\n _this.getRepresentationByModel(n).unhighlight();\n });\n } else {\n var rxs = Utils.regexpFromTextOrArray(val);\n _renkan.project.get(\"nodes\").each(function(n) {\n if (rxs.test(n.get(\"title\")) || rxs.test(n.get(\"description\"))) {\n _this.getRepresentationByModel(n).highlight(rxs);\n } else {\n _this.getRepresentationByModel(n).unhighlight();\n }\n });\n }\n });\n }\n\n this.redraw();\n\n window.setInterval(function() {\n var _now = new Date().valueOf();\n _this.delete_list.forEach(function(d) {\n if (_now >= d.time) {\n var el = _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id});\n if (el) {\n project.removeNode(el);\n }\n el = _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n if (el) {\n project.removeEdge(el);\n }\n }\n });\n _this.delete_list = _this.delete_list.filter(function(d) {\n return _renkan.project.get(\"nodes\").findWhere({\"delete_scheduled\":d.id}) || _renkan.project.get(\"edges\").findWhere({\"delete_scheduled\":d.id});\n });\n }, 500);\n\n if (this.minimap) {\n window.setInterval(function() {\n _this.rescaleMinimap();\n }, 2000);\n }\n\n };\n\n _(Scene.prototype).extend({\n fixSize: function() {\n if( this.renkan.options.default_view && this.renkan.project.get(\"views\").length > 0) {\n var view = this.renkan.project.get(\"views\").last();\n this.setScale(view.get(\"zoom_level\"), new paper.Point(view.get(\"offset\")));\n }\n else{\n this.autoScale();\n }\n },\n drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) {\n var _options = this.renkan.options,\n _startRads = _startAngle * Math.PI / 180,\n _endRads = _endAngle * Math.PI / 180,\n _img = this.icon_cache[_imgname],\n _startdx = - Math.sin(_startRads),\n _startdy = Math.cos(_startRads),\n _startXIn = Math.cos(_startRads) * _inR + _padding * _startdx,\n _startYIn = Math.sin(_startRads) * _inR + _padding * _startdy,\n _startXOut = Math.cos(_startRads) * _outR + _padding * _startdx,\n _startYOut = Math.sin(_startRads) * _outR + _padding * _startdy,\n _enddx = - Math.sin(_endRads),\n _enddy = Math.cos(_endRads),\n _endXIn = Math.cos(_endRads) * _inR - _padding * _enddx,\n _endYIn = Math.sin(_endRads) * _inR - _padding * _enddy,\n _endXOut = Math.cos(_endRads) * _outR - _padding * _enddx,\n _endYOut = Math.sin(_endRads) * _outR - _padding * _enddy,\n _centerR = (_inR + _outR) / 2,\n _centerRads = (_startRads + _endRads) / 2,\n _centerX = Math.cos(_centerRads) * _centerR,\n _centerY = Math.sin(_centerRads) * _centerR,\n _centerXIn = Math.cos(_centerRads) * _inR,\n _centerXOut = Math.cos(_centerRads) * _outR,\n _centerYIn = Math.sin(_centerRads) * _inR,\n _centerYOut = Math.sin(_centerRads) * _outR,\n _textX = Math.cos(_centerRads) * (_outR + 3),\n _textY = Math.sin(_centerRads) * (_outR + _options.buttons_label_font_size) + _options.buttons_label_font_size / 2;\n this.buttons_layer.activate();\n var _path = new paper.Path();\n _path.add([_startXIn, _startYIn]);\n _path.arcTo([_centerXIn, _centerYIn], [_endXIn, _endYIn]);\n _path.lineTo([_endXOut, _endYOut]);\n _path.arcTo([_centerXOut, _centerYOut], [_startXOut, _startYOut]);\n _path.fillColor = _options.buttons_background;\n _path.opacity = 0.5;\n _path.closed = true;\n _path.__representation = _repr;\n var _text = new paper.PointText(_textX,_textY);\n _text.characterStyle = {\n fontSize: _options.buttons_label_font_size,\n fillColor: _options.buttons_label_color\n };\n if (_textX > 2) {\n _text.paragraphStyle.justification = 'left';\n } else if (_textX < -2) {\n _text.paragraphStyle.justification = 'right';\n } else {\n _text.paragraphStyle.justification = 'center';\n }\n _text.visible = false;\n var _visible = false,\n _restPos = new paper.Point(-200, -200),\n _grp = new paper.Group([_path, _text]),\n //_grp = new paper.Group([_path]),\n _delta = _grp.position,\n _imgdelta = new paper.Point([_centerX, _centerY]),\n _currentPos = new paper.Point(0,0);\n _text.content = _caption;\n // set group pivot to not depend on text visibility that changes the group bounding box.\n _grp.pivot = _grp.bounds.center;\n _grp.visible = false;\n _grp.position = _restPos;\n var _res = {\n show: function() {\n _visible = true;\n _grp.position = _currentPos.add(_delta);\n _grp.visible = true;\n },\n moveTo: function(_point) {\n _currentPos = _point;\n if (_visible) {\n _grp.position = _point.add(_delta);\n }\n },\n hide: function() {\n _visible = false;\n _grp.visible = false;\n _grp.position = _restPos;\n },\n select: function() {\n _path.opacity = 0.8;\n _text.visible = true;\n },\n unselect: function() {\n _path.opacity = 0.5;\n _text.visible = false;\n },\n destroy: function() {\n _grp.remove();\n }\n };\n var showImage = function() {\n var _raster = new paper.Raster(_img);\n _raster.position = _imgdelta.add(_grp.position).subtract(_delta);\n _raster.locked = true; // Disable mouse events on icon\n _grp.addChild(_raster);\n };\n if (_img.width) {\n showImage();\n } else {\n $(_img).on(\"load\",showImage);\n }\n\n return _res;\n },\n addToBundles: function(_edgeRepr) {\n var _bundle = _(this.bundles).find(function(_bundle) {\n return (\n ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation ) ||\n ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation )\n );\n });\n if (typeof _bundle !== \"undefined\") {\n _bundle.edges.push(_edgeRepr);\n } else {\n _bundle = {\n from: _edgeRepr.from_representation,\n to: _edgeRepr.to_representation,\n edges: [ _edgeRepr ],\n getPosition: function(_er) {\n var _dir = (_er.from_representation === this.from) ? 1 : -1;\n return _dir * ( _(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 );\n }\n };\n this.bundles.push(_bundle);\n }\n return _bundle;\n },\n isEditable: function() {\n return (this.renkan.options.editor_mode && !this.renkan.read_only);\n },\n onStatusChange: function() {\n var savebtn = this.$.find(\".Rk-Save-Button\"),\n tip = savebtn.find(\".Rk-TopBar-Tooltip-Contents\");\n if (this.renkan.read_only) {\n savebtn.removeClass(\"disabled Rk-Save-Online\").addClass(\"Rk-Save-ReadOnly\");\n tip.text(this.renkan.translate(\"Connection lost\"));\n } else {\n if (this.renkan.options.manual_save) {\n savebtn.removeClass(\"Rk-Save-ReadOnly Rk-Save-Online\");\n tip.text(this.renkan.translate(\"Save Project\"));\n } else {\n savebtn.removeClass(\"disabled Rk-Save-ReadOnly\").addClass(\"Rk-Save-Online\");\n tip.text(this.renkan.translate(\"Auto-save enabled\"));\n }\n }\n this.redrawUsers();\n },\n setScale: function(_newScale, _offset) {\n if ((_newScale/this.initialScale) > Utils._MIN_SCALE && (_newScale/this.initialScale) < Utils._MAX_SCALE) {\n this.scale = _newScale;\n if (_offset) {\n this.offset = _offset;\n }\n this.redraw();\n }\n },\n autoScale: function(force_view) {\n var nodes = this.renkan.project.get(\"nodes\");\n if (nodes.length > 1) {\n var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n _minx = Math.min.apply(Math, _xx),\n _miny = Math.min.apply(Math, _yy),\n _maxx = Math.max.apply(Math, _xx),\n _maxy = Math.max.apply(Math, _yy);\n var _scale = Math.min( (paper.view.size.width - 2 * this.renkan.options.autoscale_padding) / (_maxx - _minx), (paper.view.size.height - 2 * this.renkan.options.autoscale_padding) / (_maxy - _miny));\n this.initialScale = _scale;\n // Override calculated scale if asked\n if((typeof force_view !== \"undefined\") && parseFloat(force_view.zoom_level)>0 && parseFloat(force_view.offset.x)>0 && parseFloat(force_view.offset.y)>0){\n this.setScale(parseFloat(force_view.zoom_level), new paper.Point(parseFloat(force_view.offset.x), parseFloat(force_view.offset.y)));\n }\n else{\n this.setScale(_scale, paper.view.center.subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale)));\n }\n }\n if (nodes.length === 1) {\n this.setScale(1, paper.view.center.subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y])));\n }\n },\n redrawMiniframe: function() {\n var topleft = this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),\n bottomright = this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));\n this.minimap.miniframe.fitBounds(topleft, bottomright);\n },\n rescaleMinimap: function() {\n var nodes = this.renkan.project.get(\"nodes\");\n if (nodes.length > 1) {\n var _xx = nodes.map(function(_node) { return _node.get(\"position\").x; }),\n _yy = nodes.map(function(_node) { return _node.get(\"position\").y; }),\n _minx = Math.min.apply(Math, _xx),\n _miny = Math.min.apply(Math, _yy),\n _maxx = Math.max.apply(Math, _xx),\n _maxy = Math.max.apply(Math, _yy);\n var _scale = Math.min(\n this.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n this.scale * 0.8 * this.renkan.options.minimap_height / paper.view.bounds.height,\n ( this.renkan.options.minimap_width - 2 * this.renkan.options.minimap_padding ) / (_maxx - _minx),\n ( this.renkan.options.minimap_height - 2 * this.renkan.options.minimap_padding ) / (_maxy - _miny)\n );\n this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale));\n this.minimap.scale = _scale;\n }\n if (nodes.length === 1) {\n this.minimap.scale = 0.1;\n this.minimap.offset = this.minimap.size.divide(2).subtract(new paper.Point([nodes.at(0).get(\"position\").x, nodes.at(0).get(\"position\").y]).multiply(this.minimap.scale));\n }\n this.redraw();\n },\n toPaperCoords: function(_point) {\n return _point.multiply(this.scale).add(this.offset);\n },\n toMinimapCoords: function(_point) {\n return _point.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft);\n },\n toModelCoords: function(_point) {\n return _point.subtract(this.offset).divide(this.scale);\n },\n addRepresentation: function(_type, _model) {\n var RendererType = requtils.getRenderer()[_type];\n var _repr = new RendererType(this, _model);\n this.representations.push(_repr);\n return _repr;\n },\n addRepresentations: function(_type, _collection) {\n var _this = this;\n _collection.forEach(function(_model) {\n _this.addRepresentation(_type, _model);\n });\n },\n userTemplate: _.template(\n '<li class=\"Rk-User\"><span class=\"Rk-UserColor\" style=\"background:<%=background%>;\"></span><%=name%></li>'\n ),\n redrawUsers: function() {\n if (!this.renkan.options.show_user_list) {\n return;\n }\n var allUsers = [].concat((this.renkan.project.current_user_list || {}).models || [], (this.renkan.project.get(\"users\") || {}).models || []),\n ulistHtml = '',\n $userpanel = this.$.find(\".Rk-Users\"),\n $name = $userpanel.find(\".Rk-CurrentUser-Name\"),\n $cpitems = $userpanel.find(\".Rk-Edit-ColorPicker li\"),\n $colorsquare = $userpanel.find(\".Rk-CurrentUser-Color\"),\n _this = this;\n $name.off(\"click\").text(this.renkan.translate(\"<unknown user>\"));\n $cpitems.off(\"mouseleave click\");\n allUsers.forEach(function(_user) {\n if (_user.get(\"_id\") === _this.renkan.current_user) {\n $name.text(_user.get(\"title\"));\n $colorsquare.css(\"background\", _user.get(\"color\"));\n if (_this.isEditable()) {\n\n if (_this.renkan.options.user_name_editable) {\n $name.click(function() {\n var $this = $(this),\n $input = $('<input>').val(_user.get(\"title\")).blur(function() {\n _user.set(\"title\", $(this).val());\n _this.redrawUsers();\n _this.redraw();\n });\n $this.empty().html($input);\n $input.select();\n });\n }\n\n if (_this.renkan.options.user_color_editable) {\n $cpitems.click(\n function(_e) {\n _e.preventDefault();\n if (_this.isEditable()) {\n _user.set(\"color\", $(this).attr(\"data-color\"));\n }\n $(this).parent().hide();\n }\n ).mouseleave(function() {\n $colorsquare.css(\"background\", _user.get(\"color\"));\n });\n }\n }\n\n } else {\n ulistHtml += _this.userTemplate({\n name: _user.get(\"title\"),\n background: _user.get(\"color\")\n });\n }\n });\n $userpanel.find(\".Rk-UserList\").html(ulistHtml);\n },\n removeRepresentation: function(_representation) {\n _representation.destroy();\n this.representations = _(this.representations).reject(\n function(_repr) {\n return _repr === _representation;\n }\n );\n },\n getRepresentationByModel: function(_model) {\n if (!_model) {\n return undefined;\n }\n return _(this.representations).find(function(_repr) {\n return _repr.model === _model;\n });\n },\n removeRepresentationsOfType: function(_type) {\n var _representations = _(this.representations).filter(function(_repr) {\n return _repr.type === _type;\n }),\n _this = this;\n _(_representations).each(function(_repr) {\n _this.removeRepresentation(_repr);\n });\n },\n highlightModel: function(_model) {\n var _repr = this.getRepresentationByModel(_model);\n if (_repr) {\n _repr.highlight();\n }\n },\n unhighlightAll: function(_model) {\n _(this.representations).each(function(_repr) {\n _repr.unhighlight();\n });\n },\n unselectAll: function(_model) {\n _(this.representations).each(function(_repr) {\n _repr.unselect();\n });\n },\n redraw: function() {\n if(! this.redrawActive ) {\n return;\n }\n _(this.representations).each(function(_representation) {\n _representation.redraw(true);\n });\n if (this.minimap) {\n this.redrawMiniframe();\n }\n paper.view.draw();\n },\n addTempEdge: function(_from, _point) {\n var _tmpEdge = this.addRepresentation(\"TempEdge\",null);\n _tmpEdge.end_pos = _point;\n _tmpEdge.from_representation = _from;\n _tmpEdge.redraw();\n this.click_target = _tmpEdge;\n },\n findTarget: function(_hitResult) {\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n var _newTarget = _hitResult.item.__representation;\n if (this.selected_target !== _hitResult.item.__representation) {\n if (this.selected_target) {\n this.selected_target.unselect(_newTarget);\n }\n _newTarget.select(this.selected_target);\n this.selected_target = _newTarget;\n }\n } else {\n if (this.selected_target) {\n this.selected_target.unselect();\n }\n this.selected_target = null;\n }\n },\n paperShift: function(_delta) {\n this.offset = this.offset.add(_delta);\n this.redraw();\n },\n onMouseMove: function(_event) {\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]),\n _delta = _point.subtract(this.last_point);\n this.last_point = _point;\n if (!this.is_dragging && this.mouse_down && _delta.length > Utils._MIN_DRAG_DISTANCE) {\n this.is_dragging = true;\n }\n var _hitResult = paper.project.hitTest(_point);\n if (this.is_dragging) {\n if (this.click_target && typeof this.click_target.paperShift === \"function\") {\n this.click_target.paperShift(_delta);\n } else {\n this.paperShift(_delta);\n }\n } else {\n this.findTarget(_hitResult);\n }\n paper.view.draw();\n },\n onMouseDown: function(_event, _isTouch) {\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]);\n this.last_point = _point;\n this.mouse_down = true;\n if (!this.click_target || this.click_target.type !== \"Temp-edge\") {\n this.removeRepresentationsOfType(\"editor\");\n this.is_dragging = false;\n var _hitResult = paper.project.hitTest(_point);\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n this.click_target = _hitResult.item.__representation;\n this.click_target.mousedown(_event, _isTouch);\n } else {\n this.click_target = null;\n if (this.isEditable() && this.click_mode === Utils._CLICKMODE_ADDNODE) {\n var _coords = this.toModelCoords(_point),\n _data = {\n id: Utils.getUID('node'),\n created_by: this.renkan.current_user,\n position: {\n x: _coords.x,\n y: _coords.y\n }\n };\n _node = this.renkan.project.addNode(_data);\n this.getRepresentationByModel(_node).openEditor();\n }\n }\n }\n if (this.click_mode) {\n if (this.isEditable() && this.click_mode === Utils._CLICKMODE_STARTEDGE && this.click_target && this.click_target.type === \"Node\") {\n this.removeRepresentationsOfType(\"editor\");\n this.addTempEdge(this.click_target, _point);\n this.click_mode = Utils._CLICKMODE_ENDEDGE;\n this.notif_$.fadeOut(function() {\n $(this).html(this.renkan.translate(\"Click on a second node to complete the edge\")).fadeIn();\n });\n } else {\n this.notif_$.hide();\n this.click_mode = false;\n }\n }\n paper.view.draw();\n },\n onMouseUp: function(_event, _isTouch) {\n this.mouse_down = false;\n if (this.click_target) {\n var _off = this.canvas_$.offset();\n this.click_target.mouseup(\n {\n point: new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ])\n },\n _isTouch\n );\n } else {\n this.click_target = null;\n this.is_dragging = false;\n if (_isTouch) {\n this.unselectAll();\n }\n }\n paper.view.draw();\n },\n onScroll: function(_event, _scrolldelta) {\n this.totalScroll += _scrolldelta;\n if (Math.abs(this.totalScroll) >= 1) {\n var _off = this.canvas_$.offset(),\n _delta = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]).subtract(this.offset).multiply( Math.SQRT2 - 1 );\n if (this.totalScroll > 0) {\n this.setScale( this.scale * Math.SQRT2, this.offset.subtract(_delta) );\n } else {\n this.setScale( this.scale * Math.SQRT1_2, this.offset.add(_delta.divide(Math.SQRT2)));\n }\n this.totalScroll = 0;\n }\n },\n onDoubleClick: function(_event) {\n if (!this.isEditable()) {\n return;\n }\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]);\n var _hitResult = paper.project.hitTest(_point);\n if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === \"undefined\")) {\n var _coords = this.toModelCoords(_point),\n _data = {\n id: Utils.getUID('node'),\n created_by: this.renkan.current_user,\n position: {\n x: _coords.x,\n y: _coords.y\n }\n },\n _node = this.renkan.project.addNode(_data);\n this.getRepresentationByModel(_node).openEditor();\n }\n paper.view.draw();\n },\n defaultDropHandler: function(_data) {\n var newNode = {};\n var snippet = \"\";\n switch(_data[\"text/x-iri-specific-site\"]) {\n case \"twitter\":\n snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n var tweetdiv = snippet.find(\".tweet\");\n newNode.title = this.renkan.translate(\"Tweet by \") + tweetdiv.attr(\"data-name\");\n newNode.uri = \"http://twitter.com/\" + tweetdiv.attr(\"data-screen-name\") + \"/status/\" + tweetdiv.attr(\"data-tweet-id\");\n newNode.image = tweetdiv.find(\".avatar\").attr(\"src\");\n newNode.description = tweetdiv.find(\".js-tweet-text:first\").text();\n break;\n case \"google\":\n snippet = $('<div>').html(_data[\"text/x-iri-selected-html\"]);\n newNode.title = snippet.find(\"h3:first\").text().trim();\n newNode.uri = snippet.find(\"h3 a\").attr(\"href\");\n newNode.description = snippet.find(\".st:first\").text().trim();\n break;\n default:\n if (_data[\"text/x-iri-source-uri\"]) {\n newNode.uri = _data[\"text/x-iri-source-uri\"];\n }\n }\n if (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]) {\n newNode.description = (_data[\"text/plain\"] || _data[\"text/x-iri-selected-text\"]).replace(/[\\s\\n]+/gm,' ').trim();\n }\n if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n var _svgimgs = snippet.find(\"image\");\n if (_svgimgs.length) {\n newNode.image = _svgimgs.attr(\"xlink:href\");\n }\n var _svgpaths = snippet.find(\"path\");\n if (_svgpaths.length) {\n newNode.clipPath = _svgpaths.attr(\"d\");\n }\n var _imgs = snippet.find(\"img\");\n if (_imgs.length) {\n newNode.image = _imgs[0].src;\n }\n var _as = snippet.find(\"a\");\n if (_as.length) {\n newNode.uri = _as[0].href;\n }\n newNode.title = snippet.find(\"[title]\").attr(\"title\") || newNode.title;\n newNode.description = snippet.text().replace(/[\\s\\n]+/gm,' ').trim();\n }\n if (_data[\"text/uri-list\"]) {\n newNode.uri = _data[\"text/uri-list\"];\n }\n if (_data[\"text/x-moz-url\"] && !newNode.title) {\n newNode.title = (_data[\"text/x-moz-url\"].split(\"\\n\")[1] || \"\").trim();\n if (newNode.title === newNode.uri) {\n newNode.title = false;\n }\n }\n if (_data[\"text/x-iri-source-title\"] && !newNode.title) {\n newNode.title = _data[\"text/x-iri-source-title\"];\n }\n if (_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]) {\n snippet = $('<div>').html(_data[\"text/html\"] || _data[\"text/x-iri-selected-html\"]);\n newNode.image = snippet.find(\"[data-image]\").attr(\"data-image\") || newNode.image;\n newNode.uri = snippet.find(\"[data-uri]\").attr(\"data-uri\") || newNode.uri;\n newNode.title = snippet.find(\"[data-title]\").attr(\"data-title\") || newNode.title;\n newNode.description = snippet.find(\"[data-description]\").attr(\"data-description\") || newNode.description;\n newNode.clipPath = snippet.find(\"[data-clip-path]\").attr(\"data-clip-path\") || newNode.clipPath;\n }\n\n if (!newNode.title) {\n newNode.title = this.renkan.translate(\"Dragged resource\");\n }\n var fields = [\"title\", \"description\", \"uri\", \"image\"];\n for (var i = 0; i < fields.length; i++) {\n var f = fields[i];\n if (_data[\"text/x-iri-\" + f] || _data[f]) {\n newNode[f] = _data[\"text/x-iri-\" + f] || _data[f];\n }\n if (newNode[f] === \"none\" || newNode[f] === \"null\") {\n newNode[f] = undefined;\n }\n }\n\n if(typeof this.renkan.options.drop_enhancer === \"function\"){\n newNode = this.renkan.options.drop_enhancer(newNode, _data);\n }\n\n return newNode;\n\n },\n dropData: function(_data, _event) {\n if (!this.isEditable()) {\n return;\n }\n if (_data[\"text/json\"] || _data[\"application/json\"]) {\n try {\n var jsondata = JSON.parse(_data[\"text/json\"] || _data[\"application/json\"]);\n _(_data).extend(jsondata);\n }\n catch(e) {}\n }\n\n var newNode = (typeof this.renkan.options.drop_handler === \"undefined\")?this.defaultDropHandler(_data):this.renkan.options.drop_handler(_data);\n\n var _off = this.canvas_$.offset(),\n _point = new paper.Point([\n _event.pageX - _off.left,\n _event.pageY - _off.top\n ]),\n _coords = this.toModelCoords(_point),\n _nodedata = {\n id: Utils.getUID('node'),\n created_by: this.renkan.current_user,\n uri: newNode.uri || \"\",\n title: newNode.title || \"\",\n description: newNode.description || \"\",\n image: newNode.image || \"\",\n color: newNode.color || undefined,\n clip_path: newNode.clipPath || undefined,\n position: {\n x: _coords.x,\n y: _coords.y\n }\n };\n var _node = this.renkan.project.addNode(_nodedata),\n _repr = this.getRepresentationByModel(_node);\n if (_event.type === \"drop\") {\n _repr.openEditor();\n }\n },\n fullScreen: function() {\n var _isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen,\n _el = this.renkan.$[0],\n _requestMethods = [\"requestFullScreen\",\"mozRequestFullScreen\",\"webkitRequestFullScreen\"],\n _cancelMethods = [\"cancelFullScreen\",\"mozCancelFullScreen\",\"webkitCancelFullScreen\"],\n i;\n if (_isFull) {\n for (i = 0; i < _cancelMethods.length; i++) {\n if (typeof document[_cancelMethods[i]] === \"function\") {\n document[_cancelMethods[i]]();\n break;\n }\n }\n var widthAft = this.$.width();\n var heightAft = this.$.height();\n\n if (this.renkan.options.show_top_bar) {\n heightAft -= this.$.find(\".Rk-TopBar\").height();\n }\n if (this.renkan.options.show_bins && (this.renkan.$.find(\".Rk-Bins\").position().left > 0)) {\n widthAft -= this.renkan.$.find(\".Rk-Bins\").width();\n }\n\n paper.view.viewSize = new paper.Size([widthAft, heightAft]);\n\n } else {\n for (i = 0; i < _requestMethods.length; i++) {\n if (typeof _el[_requestMethods[i]] === \"function\") {\n _el[_requestMethods[i]]();\n break;\n }\n }\n this.redraw();\n }\n },\n zoomOut: function() {\n var _newScale = this.scale * Math.SQRT1_2,\n _offset = new paper.Point([\n this.canvas_$.width(),\n this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT1_2 ) ).add(this.offset.multiply( Math.SQRT1_2 ));\n this.setScale( _newScale, _offset );\n },\n zoomIn: function() {\n var _newScale = this.scale * Math.SQRT2,\n _offset = new paper.Point([\n this.canvas_$.width(),\n this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n this.setScale( _newScale, _offset );\n },\n resizeZoom: function(_scaleWidth, _scaleHeight, _ratio) {\n var _newScale = this.scale * _ratio,\n _offset = new paper.Point([\n (this.offset.x * _scaleWidth),\n (this.offset.y * _scaleHeight)\n ]);\n this.setScale( _newScale, _offset );\n },\n addNodeBtn: function() {\n if (this.click_mode === Utils._CLICKMODE_ADDNODE) {\n this.click_mode = false;\n this.notif_$.hide();\n } else {\n this.click_mode = Utils._CLICKMODE_ADDNODE;\n this.notif_$.text(this.renkan.translate(\"Click on the background canvas to add a node\")).fadeIn();\n }\n return false;\n },\n addEdgeBtn: function() {\n if (this.click_mode === Utils._CLICKMODE_STARTEDGE || this.click_mode === Utils._CLICKMODE_ENDEDGE) {\n this.click_mode = false;\n this.notif_$.hide();\n } else {\n this.click_mode = Utils._CLICKMODE_STARTEDGE;\n this.notif_$.text(this.renkan.translate(\"Click on a first node to start the edge\")).fadeIn();\n }\n return false;\n },\n exportProject: function() {\n var projectJSON = this.renkan.project.toJSON(),\n downloadLink = document.createElement(\"a\"),\n projectId = projectJSON.id,\n fileNameToSaveAs = projectId + \".json\";\n\n // clean ids\n delete projectJSON.id;\n delete projectJSON._id;\n delete projectJSON.space_id;\n\n var objId;\n var idsMap = {};\n\n _.each(projectJSON.nodes, function(e,i,l) {\n objId = e.id || e._id;\n delete e._id;\n delete e.id;\n idsMap[objId] = e['@id'] = Utils.getUUID4();\n });\n _.each(projectJSON.edges, function(e,i,l) {\n delete e._id;\n delete e.id;\n e.to = idsMap[e.to];\n e.from = idsMap[e.from];\n });\n _.each(projectJSON.views, function(e,i,l) {\n objId = e.id || e._id;\n delete e._id;\n delete e.id;\n });\n projectJSON.users = [];\n\n var projectJSONStr = JSON.stringify(projectJSON, null, 2);\n var blob = new Blob([projectJSONStr], {type: \"application/json;charset=utf-8\"});\n filesaver(blob,fileNameToSaveAs);\n\n },\n foldBins: function() {\n var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n bins = this.renkan.$.find(\".Rk-Bins\");\n var _this = this,\n sizeBef = _this.canvas_$.width(),\n sizeAft;\n if (bins.position().left < 0) {\n bins.animate({left: 0},250);\n this.$.animate({left: 300},250,function() {\n var w = _this.$.width();\n paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n });\n if ((sizeBef - bins.width()) < bins.height()){\n sizeAft = sizeBef;\n } else {\n sizeAft = sizeBef - bins.width();\n }\n foldBinsButton.html(\"«\");\n } else {\n bins.animate({left: -300},250);\n this.$.animate({left: 0},250,function() {\n var w = _this.$.width();\n paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);\n });\n sizeAft = sizeBef+300;\n foldBinsButton.html(\"»\");\n }\n _this.resizeZoom(1, 1, (sizeAft/sizeBef));\n },\n save: function() { },\n open: function() { }\n });\n\n /* Scene End */\n\n return Scene;\n\n});\n\n\n//Load modules and use them\nif( typeof require.config === \"function\" ) {\n require.config({\n paths: {\n 'jquery':'../lib/jquery/jquery',\n 'underscore':'../lib/underscore/underscore',\n 'filesaver' :'../lib/FileSaver/FileSaver',\n 'requtils':'require-utils'\n }\n });\n}\n\nrequire(['renderer/baserepresentation',\n 'renderer/basebutton',\n 'renderer/noderepr',\n 'renderer/edge',\n 'renderer/tempedge',\n 'renderer/baseeditor',\n 'renderer/nodeeditor',\n 'renderer/edgeeditor',\n 'renderer/nodebutton',\n 'renderer/nodeeditbutton',\n 'renderer/noderemovebutton',\n 'renderer/noderevertbutton',\n 'renderer/nodelinkbutton',\n 'renderer/nodeenlargebutton',\n 'renderer/nodeshrinkbutton',\n 'renderer/edgeeditbutton',\n 'renderer/edgeremovebutton',\n 'renderer/edgerevertbutton',\n 'renderer/miniframe',\n 'renderer/scene'\n ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){\n\n \n\n var Rkns = window.Rkns;\n\n if(typeof Rkns.Renderer === \"undefined\"){\n Rkns.Renderer = {};\n }\n var Renderer = Rkns.Renderer;\n\n Renderer._BaseRepresentation = BaseRepresentation;\n Renderer._BaseButton = BaseButton;\n Renderer.Node = NodeRepr;\n Renderer.Edge = Edge;\n Renderer.TempEdge = TempEdge;\n Renderer._BaseEditor = BaseEditor;\n Renderer.NodeEditor = NodeEditor;\n Renderer.EdgeEditor = EdgeEditor;\n Renderer._NodeButton = NodeButton;\n Renderer.NodeEditButton = NodeEditButton;\n Renderer.NodeRemoveButton = NodeRemoveButton;\n Renderer.NodeRevertButton = NodeRevertButton;\n Renderer.NodeLinkButton = NodeLinkButton;\n Renderer.NodeEnlargeButton = NodeEnlargeButton;\n Renderer.NodeShrinkButton = NodeShrinkButton;\n Renderer.EdgeEditButton = EdgeEditButton;\n Renderer.EdgeRemoveButton = EdgeRemoveButton;\n Renderer.EdgeRevertButton = EdgeRevertButton;\n Renderer.MiniFrame = MiniFrame;\n Renderer.Scene = Scene;\n\n startRenkan();\n});\n\ndefine(\"main-renderer\", function(){});\n\n","this[\"renkanJST\"] = this[\"renkanJST\"] || {};\n\nthis[\"renkanJST\"][\"templates/edgeeditor.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Edge\")) +\n'</span>\\n</h2>\\n<p>\\n\\t<label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n\\t<input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(edge.title) +\n'\" />\\n</p>\\n';\n if (options.show_edge_editor_uri) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(edge.uri) +\n'\" />\\n\\t\\t<a class=\"Rk-Edit-Goto\" href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\"></a>\\n\\t</p>\\n\\t';\n if (options.properties.length) { ;\n__p += '\\n\\t\\t<p>\\n\\t\\t\\t<label>' +\n__e(renkan.translate(\"Choose from vocabulary:\")) +\n'</label>\\n\\t\\t\\t<select class=\"Rk-Edit-Vocabulary\">\\n\\t\\t\\t\\t';\n _(options.properties).each(function(ontology) { ;\n__p += '\\n\\t\\t\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Class\" value=\"\">\\n\\t\\t\\t\\t\\t\\t' +\n__e( renkan.translate(ontology.label) ) +\n'\\n\\t\\t\\t\\t\\t</option>\\n\\t\\t\\t\\t\\t';\n _(ontology.properties).each(function(property) { var uri = ontology[\"base-uri\"] + property.uri; ;\n__p += '\\n\\t\\t\\t\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( uri ) +\n'\"\\n\\t\\t\\t\\t\\t\\t\\t';\n if (uri === edge.uri) { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e( renkan.translate(property.label) ) +\n'\\n\\t\\t\\t\\t\\t\\t</option>\\n\\t\\t\\t\\t\\t';\n }) ;\n__p += '\\n\\t\\t\\t\\t';\n }) ;\n__p += '\\n\\t\\t\\t</select>\\n\\t\\t</p>\\n';\n } } ;\n__p += '\\n';\n if (options.show_edge_editor_color) { ;\n__p += '\\n\\t<div class=\"Rk-Editor-p\">\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Edge color:\")) +\n'</span>\\n\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t<span class=\"Rk-Edit-Color\" style=\"background: <%-edge.color%>;\">\\n\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t</span>\\n\\t\\t\\t' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n\\t\\t\\t<span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n\\t\\t</div>\\n\\t</div>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_direction) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Edit-Direction\">' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'</span>\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_nodes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(edge.from_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n\\t</p>\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: >%-edge.to_color%>;\"></span>\\n\\t\\t' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_creator && edge.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: <%-edge.created_by_color%>;\"></span>\\n\\t\\t' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/edgeeditor_readonly.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">×</span>\\n\\t';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.color ) +\n';\"></span>\\n\\t';\n } ;\n__p += '\\n\\t<span class=\"Rk-Display-Title\">\\n\\t\\t';\n if (edge.uri) { ;\n__p += '\\n\\t\\t\\t<a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t' +\n__e(edge.title) +\n'\\n\\t\\t';\n if (edge.uri) { ;\n__p += ' </a> ';\n } ;\n__p += '\\n\\t</span>\\n</h2>\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n\\t<p class=\"Rk-Display-URI\">\\n\\t\\t<a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">' +\n__e( edge.short_uri ) +\n'</a>\\n\\t</p>\\n';\n } ;\n__p += '\\n<p>' +\n__e(edge.description) +\n'</p>\\n';\n if (options.show_edge_tooltip_nodes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.from_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n\\t</p>\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.to_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_tooltip_creator && edge.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.created_by_color ) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/annotationtemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/player/' +\n((__t = (mediaid)) == null ? '' : __t) +\n'/#id=' +\n((__t = (annotationid)) == null ? '' : __t) +\n'\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\t\\n\\t<img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n\\t<p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/segmenttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/player/' +\n((__t = (mediaid)) == null ? '' : __t) +\n'/#id=' +\n((__t = (annotationid)) == null ? '' : __t) +\n'\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\t\\n\\t<img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n\\t<p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/ldtjson-bin/tagtemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item\" draggable=\"true\"\\n\\tdata-image=\"' +\n__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +\n'\"\\n\\tdata-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/search/?search=' +\n((__t = (encodedtitle)) == null ? '' : __t) +\n'&field=all\"\\n\\tdata-title=\"' +\n__e(title) +\n'\" data-description=\"Tag \\'' +\n__e(title) +\n'\\'\">\\n\\n\\t<img class=\"Rk-Ldt-Tag-Icon\" src=\"' +\n__e(static_url) +\n'img/ldt-tag.png\" />\\n\\t<h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n\\t<div class=\"Rk-Clear\"></div>\\n</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Node\")) +\n'</span>\\n</h2>\\n<p>\\n\\t<label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n\\t<input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(node.title) +\n'\" />\\n</p>\\n';\n if (options.show_node_editor_uri) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(node.uri) +\n'\" />\\n\\t\\t<a class=\"Rk-Edit-Goto\" href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\"></a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_description) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Description:\")) +\n'</label>\\n\\t\\t<textarea class=\"Rk-Edit-Description\">' +\n__e(node.description) +\n'</textarea>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_size) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Size:\")) +\n'</span>\\n\\t\\t<a href=\"#\" class=\"Rk-Edit-Size-Down\">-</a>\\n\\t\\t<span class=\"Rk-Edit-Size-Value\">' +\n__e(node.size) +\n'</span>\\n\\t\\t<a href=\"#\" class=\"Rk-Edit-Size-Up\">+</a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_color) { ;\n__p += '\\n\\t<div class=\"Rk-Editor-p\">\\n\\t\\t<span class=\"Rk-Editor-Label\">\\n\\t\\t' +\n__e(renkan.translate(\"Node color:\")) +\n'</span>\\n\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t<span class=\"Rk-Edit-Color\" style=\"background: ' +\n__e(node.color) +\n';\">\\n\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t</span>\\n\\t\\t\\t' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n\\t\\t\\t<span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n\\t\\t</div>\\n\\t</div>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_image) { ;\n__p += '\\n\\t<div class=\"Rk-Edit-ImgWrap\">\\n\\t\\t<div class=\"Rk-Edit-ImgPreview\">\\n\\t\\t\\t<img src=\"' +\n__e(node.image || node.image_placeholder) +\n'\" />\\n\\t\\t\\t';\n if (node.clip_path) { ;\n__p += '\\n\\t\\t\\t\\t<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\">\\n\\t\\t\\t\\t\\t<path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"' +\n__e( node.clip_path ) +\n'\" />\\n\\t\\t\\t\\t</svg>\\n\\t\\t\\t';\n };\n__p += '\\n\\t\\t</div>\\n\\t</div>\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Image URL:\")) +\n'</label>\\n\\t\\t<div>\\n\\t\\t\\t<a class=\"Rk-Edit-Image-Del\" href=\"#\"></a>\\n\\t\\t\\t<input class=\"Rk-Edit-Image\" type=\"text\" value=\\'' +\n__e(node.image) +\n'\\' />\\n\\t\\t</div>\\n\\t</p>\\n';\n if (options.allow_image_upload) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Choose Image File:\")) +\n'</label>\\n\\t\\t<input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\" />\\n\\t</p>\\n';\n };\n\n } ;\n__p += ' ';\n if (options.show_node_editor_creator && node.has_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.change_shapes) { ;\n__p += '\\n\\t<p>\\n\\t\\t<label>' +\n__e(renkan.translate(\"Shapes available\")) +\n':</label>\\n\\t\\t<select class=\"Rk-Edit-Shape\">\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"circle\"';\n if (node.shape === \"circle\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Circle\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"rectangle\"';\n if (node.shape === \"rectangle\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Square\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"diamond\"';\n if (node.shape === \"diamond\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Diamond\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"polygon\"';\n if (node.shape === \"polygon\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Hexagone\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"ellipse\"';\n if (node.shape === \"ellipse\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Ellipse\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t\\t<option class=\"Rk-Edit-Vocabulary-Property\" value=\"star\"';\n if (node.shape === \"star\") { ;\n__p += ' selected';\n } ;\n__p += '>\\n\\t\\t\\t\\t' +\n__e( renkan.translate(\"Star\") ) +\n'\\n\\t\\t\\t</option>\\n\\t\\t</select>\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor_readonly.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<h2>\\n\\t<span class=\"Rk-CloseX\">×</span>\\n\\t';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.color) +\n';\"></span>\\n\\t';\n } ;\n__p += '\\n\\t<span class=\"Rk-Display-Title\">\\n\\t\\t';\n if (node.uri) { ;\n__p += '\\n\\t\\t\\t<a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t' +\n__e(node.title) +\n'\\n\\t\\t';\n if (node.uri) { ;\n__p += '</a>';\n } ;\n__p += '\\n\\t</span>\\n</h2>\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n\\t<p class=\"Rk-Display-URI\">\\n\\t\\t<a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">' +\n__e(node.short_uri) +\n'</a>\\n\\t</p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_tooltip_description) { ;\n__p += '\\n\\t<p class=\"Rk-Display-Description\">' +\n__e(node.description) +\n'</p>\\n';\n } ;\n__p += ' ';\n if (node.image && options.show_node_tooltip_image) { ;\n__p += '\\n\\t<img class=\"Rk-Display-ImgPreview\" src=\"' +\n__e(node.image) +\n'\" />\\n';\n } ;\n__p += ' ';\n if (node.has_creator && options.show_node_tooltip_creator) { ;\n__p += '\\n\\t<p>\\n\\t\\t<span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n\\t\\t<span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n\\t\\t' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n\\t</p>\\n';\n } ;\n__p += '\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/scene.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n\n if (options.show_top_bar) { ;\n__p += '\\n\\t<div class=\"Rk-TopBar\">\\n\\t\\t<div class=\"loader\"></div>\\n\\t\\t';\n if (!options.editor_mode) { ;\n__p += '\\n\\t\\t\\t<h2 class=\"Rk-PadTitle\">\\n\\t\\t\\t\\t' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n\\t\\t\\t</h2>\\n\\t\\t';\n } else { ;\n__p += '\\n\\t\\t\\t<input type=\"text\" class=\"Rk-PadTitle\" value=\"' +\n__e( project.get('title') || '' ) +\n'\" placeholder=\"' +\n__e(translate('Untitled project')) +\n'\" />\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_user_list) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-Users\">\\n\\t\\t\\t\\t<div class=\"Rk-CurrentUser\">\\n\\t\\t\\t\\t\\t';\n if (options.show_user_color) { ;\n__p += '\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n\\t\\t\\t\\t\\t\\t\\t<span class=\"Rk-CurrentUser-Color\">\\n\\t\\t\\t\\t\\t\\t\\t';\n if (options.user_color_editable) { ;\n__p += '\\n\\t\\t\\t\\t\\t\\t\\t\\t<span class=\"Rk-Edit-ColorTip\"></span>\\n\\t\\t\\t\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t\\t\\t\\t</span>\\n\\t\\t\\t\\t\\t\\t\\t';\n if (options.user_color_editable) { print(colorPicker) } ;\n__p += '\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t\\t<span class=\"Rk-CurrentUser-Name\"><unknown user></span>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t<ul class=\"Rk-UserList\"></ul>\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.home_button_url) {;\n__p += '\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t<a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"' +\n__e( options.home_button_url ) +\n'\">\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t' +\n__e( translate(options.home_button_title) ) +\n'\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</a>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_fullscreen_button) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-FullScreen-Button\">\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Full Screen\")) +\n'\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.editor_mode) { ;\n__p += '\\n\\t\\t\\t';\n if (options.show_addnode_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-AddNode-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Add Node\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_addedge_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-AddEdge-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Add Edge\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_export_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Download Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_save_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Save-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\"></div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_open_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Open-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Open Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t';\n if (options.show_bookmarklet) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</a>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n } else { ;\n__p += '\\n\\t\\t\\t';\n if (options.show_export_button) { ;\n__p += '\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip\">\\n\\t\\t\\t\\t\\t\\t<div class=\"Rk-TopBar-Tooltip-Contents\">\\n\\t\\t\\t\\t\\t\\t\\t' +\n__e(translate(\"Download Project\")) +\n'\\n\\t\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t</div>\\n\\t\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n }; ;\n__p += '\\n\\t\\t';\n if (options.show_search_field) { ;\n__p += '\\n\\t\\t\\t<form action=\"#\" class=\"Rk-GraphSearch-Form\">\\n\\t\\t\\t\\t<input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"' +\n__e( translate('Search in graph') ) +\n'\" />\\n\\t\\t\\t</form>\\n\\t\\t\\t<div class=\"Rk-TopBar-Separator\"></div>\\n\\t\\t';\n } ;\n__p += '\\n\\t</div>\\n';\n } ;\n__p += '\\n<div class=\"Rk-Editing-Space';\n if (!options.show_top_bar) { ;\n__p += ' Rk-Editing-Space-Full';\n } ;\n__p += '\">\\n\\t<div class=\"Rk-Labels\"></div>\\n\\t<canvas class=\"Rk-Canvas\" ';\n if (options.resize) { ;\n__p += ' resize=\"\" ';\n } ;\n__p += '></canvas>\\n\\t<div class=\"Rk-Notifications\"></div>\\n\\t<div class=\"Rk-Editor\">\\n\\t\\t';\n if (options.show_bins) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-Fold-Bins\">«</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t\\t';\n if (options.show_zoom) { ;\n__p += '\\n\\t\\t\\t<div class=\"Rk-ZoomButtons\">\\n\\t\\t\\t\\t<div class=\"Rk-ZoomIn\" title=\"' +\n__e(translate('Zoom In')) +\n'\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-ZoomFit\" title=\"' +\n__e(translate('Zoom Fit')) +\n'\"></div>\\n\\t\\t\\t\\t<div class=\"Rk-ZoomOut\" title=\"' +\n__e(translate('Zoom Out')) +\n'\"></div>\\n\\t\\t\\t\\t';\n if (options.editor_mode && options.save_view) { ;\n__p += '\\n\\t\\t\\t\\t\\t<div class=\"Rk-ZoomSave\" title=\"' +\n__e(translate('Zoom Save')) +\n'\"></div>\\n\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t\\t';\n if (options.save_view) { ;\n__p += '\\n\\t\\t\\t\\t\\t<div class=\"Rk-ZoomSetSaved\" title=\"' +\n__e(translate('View saved zoom')) +\n'\"></div>\\n\\t\\t\\t\\t';\n } ;\n__p += '\\n\\t\\t\\t</div>\\n\\t\\t';\n } ;\n__p += '\\n\\t</div>\\n</div>';\n\n}\nreturn __p\n};"]}
\ No newline at end of file