--- a/client/css/renkan.css Wed Jun 03 19:16:58 2015 +0200
+++ b/client/css/renkan.css Thu Jun 04 10:04:01 2015 +0200
@@ -532,7 +532,7 @@
top: 0;
}
-.Rk-ZoomIn, .Rk-ZoomOut, .Rk-ZoomFit, .Rk-ZoomSave, .Rk-ZoomSetSaved {
+.Rk-ZoomIn, .Rk-ZoomOut, .Rk-ZoomFit, .Rk-ZoomSave, .Rk-ZoomSetSaved, .Rk-ShowHiddenNodes {
width: 21px; height: 20px; background: url(../img/zoombuttons.png); margin: 5px;
}
.Rk-ZoomIn:hover {
@@ -562,6 +562,12 @@
.Rk-ZoomSetSaved:hover {
background-position: -84px -20px;
}
+.Rk-ShowHiddenNodes {
+ background-position: -105px 0;
+}
+.Rk-ShowHiddenNodes:hover {
+ background-position: -105px -20px;
+}
/* Bins */
Binary file client/img/hide.png has changed
Binary file client/img/show.png has changed
Binary file client/img/zoombuttons.png has changed
--- a/client/js/defaults.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/defaults.js Thu Jun 04 10:04:01 2015 +0200
@@ -10,6 +10,10 @@
/* List of Bins */
static_url: "",
/* URL for static resources */
+ popup_editor: true,
+ /* show the node editor as a popup inside the renkan view */
+ editor_panel: 'editor-panel',
+ /* GUI continer DOM element ID of the editor panel */
show_bins: true,
/* Show bins in left column */
properties: [],
--- a/client/js/main-renderer.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/main-renderer.js Thu Jun 04 10:04:01 2015 +0200
@@ -22,6 +22,8 @@
'renderer/nodebutton',
'renderer/nodeeditbutton',
'renderer/noderemovebutton',
+ 'renderer/nodehidebutton',
+ 'renderer/nodeshowbutton',
'renderer/noderevertbutton',
'renderer/nodelinkbutton',
'renderer/nodeenlargebutton',
@@ -31,7 +33,7 @@
'renderer/edgerevertbutton',
'renderer/miniframe',
'renderer/scene'
- ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){
+ ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){
'use strict';
@@ -53,6 +55,8 @@
Renderer._NodeButton = NodeButton;
Renderer.NodeEditButton = NodeEditButton;
Renderer.NodeRemoveButton = NodeRemoveButton;
+ Renderer.NodeHideButton = NodeHideButton;
+ Renderer.NodeShowButton = NodeShowButton;
Renderer.NodeRevertButton = NodeRevertButton;
Renderer.NodeLinkButton = NodeLinkButton;
Renderer.NodeEnlargeButton = NodeEnlargeButton;
--- a/client/js/models.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/models.js Thu Jun 04 10:04:01 2015 +0200
@@ -99,9 +99,8 @@
.get("_id") : null,
size : this.get("size"),
clip_path : this.get("clip_path"),
- shape : this.get("shape"),
- type : this.get("type"),
- hidden : this.get("hidden")
+ shape : this.get("shape"),
+ type : this.get("type")
};
}
});
@@ -182,7 +181,8 @@
title : this.get("title"),
description : this.get("description"),
created_by : this.get("created_by") ? this.get("created_by")
- .get("_id") : null
+ .get("_id") : null,
+ hidden_nodes: this.get("hidden_nodes")
// Don't need project id
};
}
--- a/client/js/renderer/edge.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/edge.js Thu Jun 04 10:04:01 2015 +0200
@@ -13,6 +13,8 @@
_init: function() {
this.renderer.edge_layer.activate();
this.type = "Edge";
+ this.hidden = false;
+ this.ghost = false;
this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from"));
this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to"));
this.bundle = this.renderer.addToBundles(this);
@@ -72,12 +74,15 @@
redraw: function() {
var from = this.model.get("from"),
to = this.model.get("to");
- if (!from || !to) {
+ if (!from || !to || (this.hidden && !this.ghost)) {
return;
}
this.from_representation = this.renderer.getRepresentationByModel(from);
this.to_representation = this.renderer.getRepresentationByModel(to);
- if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined") {
+ if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined" ||
+ (this.from_representation.hidden && !this.from_representation.ghost) ||
+ (this.to_representation.hidden && !this.to_representation.ghost)) {
+ this.hide();
return;
}
var _strokeWidth = this._getStrokeWidth(),
@@ -129,7 +134,7 @@
this.line.strokeWidth = _strokeWidth;
this.line.strokeColor = _color;
this.line.dashArray = _dash;
- this.line.opacity = opacity;
+ this.line.opacity = this.ghost ? 0.3 : opacity;
this.line.segments[0].point = _p0a;
this.line.segments[1].point = this.paper_coords;
this.line.segments[1].handleIn = _handle.multiply(-1);
@@ -138,7 +143,7 @@
this.arrow.scale(_arrow_scale / this.arrow_scale);
this.arrow_scale = _arrow_scale;
this.arrow.fillColor = _color;
- this.arrow.opacity = array_opacity;
+ this.arrow.opacity = this.ghost ? 0.3 : array_opacity; //TODO: magic constant + var name
this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);
this.arrow.position = this.paper_coords;
@@ -161,7 +166,7 @@
transform: "rotate(" + _a + "deg)",
"-moz-transform": "rotate(" + _a + "deg)",
"-webkit-transform": "rotate(" + _a + "deg)",
- opacity: opacity
+ opacity: this.ghost ? 0.3 : opacity
});
this.text_angle = _a;
@@ -176,6 +181,36 @@
this.minimap_line.segments[1].point = this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position")));
}
},
+ hide: function(){
+ this.hidden = true;
+ this.ghost = false;
+
+ this.text.hide();
+ this.line.visible = false;
+ this.arrow.visible = false;
+ this.minimap_line.visible = false;
+ },
+ show: function(ghost){
+ this.ghost = ghost;
+ if (this.ghost) {
+ this.text.css('opacity', 0.3);
+ this.line.opacity = 0.3;
+ this.arrow.opacity = 0.3;
+ this.minimap_line.opacity = 0.3;
+ } else {
+ this.hidden = false;
+
+ this.text.css('opacity', 1);
+ this.line.opacity = 1;
+ this.arrow.opacity = 1;
+ this.minimap_line.opacity = 1;
+ }
+ this.text.show();
+ this.line.visible = true;
+ this.arrow.visible = true;
+ this.minimap_line.visible = true;
+ this.redraw();
+ },
openEditor: function() {
this.renderer.removeRepresentationsOfType("editor");
var _editor = this.renderer.addRepresentation("EdgeEditor",null);
--- a/client/js/renderer/edgeeditor.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/edgeeditor.js Thu Jun 04 10:04:01 2015 +0200
@@ -177,8 +177,10 @@
}
},
redraw: function() {
- var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
+ if (this.options.popup_editor){
+ var _coords = this.source_representation.paper_coords;
+ Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
+ }
this.editor_$.show();
paper.view.draw();
}
--- a/client/js/renderer/nodeeditbutton.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/nodeeditbutton.js Thu Jun 04 10:04:01 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-edit-button";
this.lastSectorInner = 0;
- this.startAngle = -135;
- this.endAngle = -45;
+ this.startAngle = -125;
+ this.endAngle = -55;
this.imageName = "edit";
this.text = "Edit";
},
--- a/client/js/renderer/nodeeditor.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/nodeeditor.js Thu Jun 04 10:04:01 2015 +0200
@@ -12,6 +12,8 @@
_init: function() {
BaseEditor.prototype._init.apply(this);
this.template = this.options.templates['templates/nodeeditor.html'];
+ //this.templates['default']= this.options.templates['templates/nodeeditor.html'];
+ //fusionner avec this.options.node_editor_templates
this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];
},
draw: function() {
@@ -238,8 +240,10 @@
});
},
redraw: function() {
- var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
+ if (this.options.popup_editor){
+ var _coords = this.source_representation.paper_coords;
+ Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
+ }
this.editor_$.show();
paper.view.draw();
}
--- a/client/js/renderer/nodeenlargebutton.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/nodeenlargebutton.js Thu Jun 04 10:04:01 2015 +0200
@@ -14,8 +14,8 @@
_init: function() {
this.type = "Node-enlarge-button";
this.lastSectorInner = 0;
- this.startAngle = -45;
- this.endAngle = 0;
+ this.startAngle = -55;
+ this.endAngle = -10;
this.imageName = "enlarge";
this.text = "Enlarge";
},
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/js/renderer/nodehidebutton.js Thu Jun 04 10:04:01 2015 +0200
@@ -0,0 +1,35 @@
+
+define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+ 'use strict';
+
+ var Utils = requtils.getUtils();
+
+ /* NodeRemoveButton Begin */
+
+ //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);
+ var NodeHideButton = Utils.inherit(NodeButton);
+
+ _(NodeHideButton.prototype).extend({
+ _init: function() {
+ this.type = "Node-hide-button";
+ this.lastSectorInner = 0;
+ this.startAngle = 45;
+ this.endAngle = 90;
+ this.imageName = "hide";
+ this.text = "Hide";
+ },
+ mouseup: function() {
+ this.renderer.click_target = null;
+ this.renderer.is_dragging = false;
+ this.renderer.removeRepresentationsOfType("editor");
+ if (this.renderer.isEditable()) {
+ this.renderer.addHiddenNode(this.source_representation.model);
+ }
+ }
+ }).value();
+
+ /* NodeRemoveButton End */
+
+ return NodeHideButton;
+
+});
--- a/client/js/renderer/nodelinkbutton.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/nodelinkbutton.js Thu Jun 04 10:04:01 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-link-button";
this.lastSectorInner = 0;
- this.startAngle = 90;
- this.endAngle = 180;
+ this.startAngle = 135;
+ this.endAngle = 190;
this.imageName = "link";
this.text = "Link to another node";
},
--- a/client/js/renderer/noderemovebutton.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/noderemovebutton.js Thu Jun 04 10:04:01 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-remove-button";
this.lastSectorInner = 0;
- this.startAngle = 0;
- this.endAngle = 90;
+ this.startAngle = -10;
+ this.endAngle = 45;
this.imageName = "remove";
this.text = "Remove";
},
--- a/client/js/renderer/noderepr.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/noderepr.js Thu Jun 04 10:04:01 2015 +0200
@@ -17,6 +17,8 @@
this.renderer.node_layer.activate();
this.type = "Node";
this.buildShape();
+ this.hidden = false;
+ this.ghost= false;
if (this.options.show_node_circles) {
this.circle.strokeWidth = this.options.node_stroke_width;
this.h_ratio = 1;
@@ -30,6 +32,8 @@
this.normal_buttons = [
new Renderer.NodeEditButton(this.renderer, null),
new Renderer.NodeRemoveButton(this.renderer, null),
+ new Renderer.NodeHideButton(this.renderer, null),
+ new Renderer.NodeShowButton(this.renderer, null),
new Renderer.NodeLinkButton(this.renderer, null),
new Renderer.NodeEnlargeButton(this.renderer, null),
new Renderer.NodeShrinkButton(this.renderer, null)
@@ -116,8 +120,7 @@
this.active_buttons = this.normal_buttons;
this.circle.dashArray = null;
}
-
- if (this.selected && this.renderer.isEditable()) {
+ if (this.selected && this.renderer.isEditable() && !this.ghost) {
if (old_act_btn !== this.active_buttons) {
old_act_btn.forEach(function(b) {
b.hide();
@@ -197,7 +200,11 @@
}
);
}
-
+ if (this.ghost){
+ this.show(true);
+ } else {
+ if (this.hidden) { this.hide(); }
+ }
},
showImage: function() {
var _image = null;
@@ -348,7 +355,7 @@
select: function() {
this.selected = true;
this.circle.strokeWidth = this._getSelectedStrokeWidth();
- if (this.renderer.isEditable()) {
+ if (this.renderer.isEditable() && !this.hidden) {
this.active_buttons.forEach(function(b) {
b.show();
});
@@ -370,6 +377,13 @@
this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;
this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
}
+ //if the node is hidden and the mouse hover it, it appears as a ghost
+ if (this.hidden) {
+ this.show(true);
+ }
+ else {
+ this.showNeighbors(true);
+ }
this._super("select");
},
hideButtons: function() {
@@ -388,9 +402,111 @@
if (this.renderer.minimap) {
this.minimap_circle.strokeColor = undefined;
}
+ //when the mouse don't hover the node anymore, we hide it
+ if (this.hidden) {
+ this.hide();
+ }
+ else {
+ this.hideNeighbors();
+ }
this._super("unselect");
}
},
+ hide: function(){
+ var _this = this;
+ this.ghost = false;
+ this.hidden = true;
+ if (typeof this.node_image !== 'undefined'){
+ this.node_image.opacity = 0;
+ }
+ this.hideButtons();
+ this.circle.opacity = 0;
+ this.title.css('opacity', 0);
+ this.minimap_circle.opacity = 0;
+
+
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return ((ed.get("to") === _this.model) || (ed.get("from") === _this.model));
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge);
+ 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") {
+ repr.hide();
+ }
+ }
+ );
+ this.hideNeighbors();
+ },
+ show: function(ghost){
+ var _this = this;
+ this.ghost = ghost;
+ if (this.ghost){
+ if (typeof this.node_image !== 'undefined'){
+ this.node_image.opacity = 0.3;
+ }
+ this.circle.opacity = 0.3;
+ this.title.css('opacity', 0.3);
+ this.minimap_circle.opacity = 0.3;
+ } else {
+ this.hidden = false;
+ this.redraw();
+ }
+
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return ((ed.get("to") === _this.model) || (ed.get("from") === _this.model));
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge);
+ 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") {
+ repr.show(_this.ghost);
+ }
+ }
+ );
+ },
+ hideNeighbors: function(){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.ghost) {
+ repr.hide();
+ }
+ }
+ );
+ },
+ showNeighbors: function(ghost){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.hidden) {
+ repr.show(ghost);
+ if (!ghost){
+ var indexNode = _this.renderer.hiddenNodes.indexOf(repr.model.id);
+ if (indexNode !== -1){
+ _this.renderer.hiddenNodes.splice(indexNode, 1);
+ }
+ }
+ }
+ }
+ );
+ },
highlight: function(textToReplace) {
var hlvalue = textToReplace || true;
if (this.highlighted === hlvalue) {
@@ -430,10 +546,19 @@
if (this.renderer.is_dragging && this.renderer.isEditable()) {
this.saveCoords();
} else {
- if (!_isTouch && !this.model.get("delete_scheduled")) {
- this.openEditor();
+ if (this.hidden) {
+ var index = this.renderer.hiddenNodes.indexOf(this.model.id);
+ if (index !== -1){
+ this.renderer.hiddenNodes.splice(index, 1);
+ }
+ this.show(false);
+ this.select();
+ } else {
+ if (!_isTouch && !this.model.get("delete_scheduled")) {
+ this.openEditor();
+ }
+ this.model.trigger("clicked");
}
- this.model.trigger("clicked");
}
this.renderer.click_target = null;
this.renderer.is_dragging = false;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/js/renderer/nodeshowbutton.js Thu Jun 04 10:04:01 2015 +0200
@@ -0,0 +1,35 @@
+
+define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+ 'use strict';
+
+ var Utils = requtils.getUtils();
+
+ /* NodeRemoveButton Begin */
+
+ //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);
+ var NodeShowButton = Utils.inherit(NodeButton);
+
+ _(NodeShowButton.prototype).extend({
+ _init: function() {
+ this.type = "Node-show-button";
+ this.lastSectorInner = 0;
+ this.startAngle = 90;
+ this.endAngle = 135;
+ this.imageName = "show";
+ this.text = "Show";
+ },
+ mouseup: function() {
+ this.renderer.click_target = null;
+ this.renderer.is_dragging = false;
+ this.renderer.removeRepresentationsOfType("editor");
+ if (this.renderer.isEditable()) {
+ this.source_representation.showNeighbors(false);
+ }
+ }
+ }).value();
+
+ /* NodeShowButton End */
+
+ return NodeShowButton;
+
+});
--- a/client/js/renderer/nodeshrinkbutton.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/nodeshrinkbutton.js Thu Jun 04 10:04:01 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-shrink-button";
this.lastSectorInner = 0;
- this.startAngle = -180;
- this.endAngle = -135;
+ this.startAngle = -170;
+ this.endAngle = -125;
this.imageName = "shrink";
this.text = "Shrink";
},
--- a/client/js/renderer/scene.js Wed Jun 03 19:16:58 2015 +0200
+++ b/client/js/renderer/scene.js Thu Jun 04 10:04:01 2015 +0200
@@ -14,13 +14,18 @@
this.onStatusChange();
this.canvas_$ = this.$.find(".Rk-Canvas");
this.labels_$ = this.$.find(".Rk-Labels");
- this.editor_$ = this.$.find(".Rk-Editor");
+ if (!_renkan.options.popup_editor){
+ this.editor_$ = $("#" + _renkan.options.editor_panel);
+ }else{
+ this.editor_$ = this.$.find(".Rk-Editor");
+ }
this.notif_$ = this.$.find(".Rk-Notifications");
paper.setup(this.canvas_$[0]);
this.scale = 1;
this.initialScale = 1;
this.offset = paper.view.center;
this.totalScroll = 0;
+ this.hiddenNodes = [];
this.mouse_down = false;
this.click_target = null;
this.selected_target = null;
@@ -78,7 +83,7 @@
this.image_cache = {};
this.icon_cache = {};
- ['edit', 'remove', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {
+ ['edit', 'remove', 'hide', 'show', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {
var img = new Image();
img.src = _renkan.options.static_url + 'img/' + imgname + '.png';
_this.icon_cache[imgname] = img;
@@ -234,14 +239,26 @@
bindClick(".Rk-ZoomFit", "autoScale");
this.$.find(".Rk-ZoomSave").click( function() {
// Save scale and offset point
- _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset } );
+ _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset, hidden_nodes: _this.hiddenNodes } );
});
this.$.find(".Rk-ZoomSetSaved").click( function() {
var view = _this.renkan.project.get("views").last();
if(view){
_this.setScale(view.get("zoom_level"), new paper.Point(view.get("offset")));
+ _this.hiddenNodes = view.get("hidden_nodes") || [];
+ _this.hideNodes();
}
});
+ this.$.find(".Rk-ShowHiddenNodes").mouseenter( function() {
+ _this.showNodes(true);
+ _this.$.find(".Rk-ShowHiddenNodes").mouseleave( function() {
+ _this.hideNodes(false);
+ });
+ });
+ this.$.find(".Rk-ShowHiddenNodes").click( function() {
+ _this.showNodes(false);
+ _this.$.find(".Rk-ShowHiddenNodes").off( "mouseleave" );
+ });
if(this.renkan.project.get("views").length > 0 && this.renkan.options.save_view){
this.$.find(".Rk-ZoomSetSaved").show();
}
@@ -829,6 +846,7 @@
});
},
redraw: function() {
+ var _this = this;
if(! this.redrawActive ) {
return;
}
@@ -847,6 +865,38 @@
_tmpEdge.redraw();
this.click_target = _tmpEdge;
},
+ addHiddenNode: function(_model){
+ this.hideNode(_model);
+ this.hiddenNodes.push(_model.id);
+ },
+ hideNode: function(_model){
+ var _this = this;
+ if (typeof _this.getRepresentationByModel(_model) !== 'undefined'){
+ _this.getRepresentationByModel(_model).hide();
+ }
+ },
+ hideNodes: function(){
+ var _this = this;
+ this.hiddenNodes.forEach(function(_id, index){
+ var node = _this.renkan.project.get("nodes").get(_id);
+ if (typeof node !== 'undefined'){
+ return _this.hideNode(_this.renkan.project.get("nodes").get(_id));
+ }else{
+ _this.hiddenNodes.splice(index, 1);
+ }
+ });
+ paper.view.draw();
+ },
+ showNodes: function(ghost){
+ var _this = this;
+ this.hiddenNodes.forEach(function(_id){
+ _this.getRepresentationByModel(_this.renkan.project.get("nodes").get(_id)).show(ghost);
+ });
+ if (!ghost){
+ this.hiddenNodes = [];
+ }
+ paper.view.draw();
+ },
findTarget: function(_hitResult) {
if (_hitResult && typeof _hitResult.item.__representation !== "undefined") {
var _newTarget = _hitResult.item.__representation;
@@ -977,15 +1027,21 @@
}
},
onDoubleClick: function(_event) {
- if (!this.isEditable()) {
- return;
- }
var _off = this.canvas_$.offset(),
_point = new paper.Point([
_event.pageX - _off.left,
_event.pageY - _off.top
]);
var _hitResult = paper.project.hitTest(_point);
+
+ if (!this.isEditable()) {
+ if (_hitResult && typeof _hitResult.item.__representation !== "undefined") {
+ if (_hitResult.item.__representation.model.get('uri')){
+ window.open(_hitResult.item.__representation.model.get('uri'), '_blank');
+ }
+ }
+ return;
+ }
if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === "undefined")) {
var _coords = this.toModelCoords(_point),
_data = {
--- a/client/templates/scene.html Wed Jun 03 19:16:58 2015 +0200
+++ b/client/templates/scene.html Thu Jun 04 10:04:01 2015 +0200
@@ -145,6 +145,7 @@
<% } %>
<% if (options.save_view) { %>
<div class="Rk-ZoomSetSaved" title="<%-translate('View saved zoom')%>"></div>
+ <div class="Rk-ShowHiddenNodes" title="<%-translate('Show hidden nodes')%>"></div>
<% } %>
</div>
<% } %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/test/test-readonly-div-editor-panel.html Thu Jun 04 10:04:01 2015 +0200
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html lang="fr">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+ <title>RENKAN test in read-only mode : body 100%</title>
+ <meta name="description" content="" />
+ <meta name="author" content="Institut de Recherche et d'Innovation" />
+ <script src="../lib/jquery/jquery.js"></script>
+ <script src="../lib/jquery-mousewheel/jquery.mousewheel.js"></script>
+ <script src="../lib/lodash/lodash.js"></script>
+ <script src="../lib/backbone/backbone.js"></script>
+ <script src="../lib/backbone-relational/backbone-relational.js"></script>
+ <script src="../lib/paper/paper-full.js"></script>
+ <script src="../js/main.js"></script>
+ <script src="../js/dataloader.js"></script>
+ <script src="../js/defaults.js"></script>
+ <script src="../js/i18n.js"></script>
+ <script src="../dist/js/templates.js"></script>
+ <script src="../js/models.js"></script>
+ <script src="../js/full-json.js"></script>
+ <script src="../js/list-bin.js"></script>
+ <script src="../js/ldtjson-bin.js"></script>
+ <script src="../js/wikipedia-bin.js"></script>
+ <script data-main="../js/main-renderer.js" src="../lib/requirejs/require.js"></script>
+ <script type="text/javascript">
+ function startRenkan(){
+ var _renkan = new Rkns.Renkan({
+ editor_mode: false,
+ show_bins: false,
+ static_url: "../",
+ default_view:0,
+ popup_editor:false,
+ editor_panel:'editor-panel'
+ });
+ Rkns.jsonIO(_renkan, {
+ url: "../data/example-cinema-src.json"
+ });
+ };
+ </script>
+ <link rel="stylesheet" href="../css/renkan.css" />
+ <style type="text/css">
+ body{
+ margin: 0 auto;
+ width: 960px;
+ }
+ .header, .footer {
+ font-size: 14px;
+ height: 40px;
+ padding-top: 10px;
+ }
+ .header{
+ height: 100px;
+ }
+ .rnk-container{
+ height: 700px;
+ position: relative;
+ width: 800px;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="header">
+ This is a header with no css override.
+ <ul>
+ <li>list item 1</li>
+ <li>list item 2</li>
+ </ul>
+ <p>This is a paragraphe. This is a <a href="#">link</a>.
+ </div>
+ <div id="editor-panel" style="float: right;">
+ </div>
+ <div class="rnk-container">
+ <div id="renkan"></div>
+ </div>
+ <div class="footer">
+ This is a footer
+ </div>
+ </body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/test/test-writable-simple-div-editor-panel.html Thu Jun 04 10:04:01 2015 +0200
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html lang="fr">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+ <title>Test de Rendu RENKAN</title>
+ <meta name="description" content="" />
+ <meta name="author" content="Institut de Recherche et d'Innovation" />
+ <script src="../lib/jquery/jquery.js"></script>
+ <script src="../lib/jquery-mousewheel/jquery.mousewheel.js"></script>
+ <script src="../lib/lodash/lodash.js"></script>
+ <script src="../lib/backbone/backbone.js"></script>
+ <script src="../lib/backbone-relational/backbone-relational.js"></script>
+ <script src="../lib/paper/paper-full.js"></script>
+ <script src="../js/main.js"></script>
+ <script src="../js/dataloader.js"></script>
+ <script src="../js/models.js"></script>
+ <script src="../js/defaults.js"></script>
+ <script src="../js/i18n.js"></script>
+ <script src="../dist/js/templates.js"></script>
+ <script src="../js/full-json.js"></script>
+ <script src="../js/ldtjson-bin.js"></script>
+ <script src="../js/list-bin.js"></script>
+ <script src="../js/wikipedia-bin.js"></script>
+ <script data-main="../js/main-renderer.js" src="../lib/requirejs/require.js"></script>
+ <script type="text/javascript">
+ function startRenkan(){
+ var _renkan = new Rkns.Renkan({
+ /*property_files: [ "data/properties.json" ],
+ user_id: "u-iri",
+ language: "fr",
+ node_fill_color: false*/
+ show_bins: false,
+ static_url: "../",
+ popup_editor:false,
+ editor_panel:"editor-panel"
+ });
+ Rkns.jsonIO(_renkan, {
+ url: "/simple-persist"
+ });
+ };
+ </script>
+ <link rel="stylesheet" href="../css/renkan.css" />
+ <style type="text/css">
+ body{
+ margin: 0 auto;
+ width: 960px;
+ }
+ .header, .footer {
+ font-size: 14px;
+ height: 40px;
+ padding-top: 10px;
+ }
+ .rnk-container{
+ height: 500px;
+ position: relative;
+ width: 600px;
+ }
+ </style>
+ </head>
+
+ <body>
+ <div class="header">
+ This is a header
+ </div>
+ <div id="editor-panel" style="float: right;">
+ </div>
+ <div class="rnk-container">
+ <div id="renkan"></div>
+ </div>
+ <div class="footer">
+ This is a footer
+ </div>
+ </body>
+</html>
--- a/server/php/basic/public_html/static/lib/renkan/css/renkan.css Wed Jun 03 19:16:58 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/css/renkan.css Thu Jun 04 10:04:01 2015 +0200
@@ -560,7 +560,7 @@
top: 0;
}
-.Rk-ZoomIn, .Rk-ZoomOut, .Rk-ZoomFit, .Rk-ZoomSave, .Rk-ZoomSetSaved {
+.Rk-ZoomIn, .Rk-ZoomOut, .Rk-ZoomFit, .Rk-ZoomSave, .Rk-ZoomSetSaved, .Rk-ShowHiddenNodes {
width: 21px; height: 20px; background: url(../img/zoombuttons.png); margin: 5px;
}
.Rk-ZoomIn:hover {
@@ -590,6 +590,12 @@
.Rk-ZoomSetSaved:hover {
background-position: -84px -20px;
}
+.Rk-ShowHiddenNodes {
+ background-position: -105px 0;
+}
+.Rk-ShowHiddenNodes:hover {
+ background-position: -105px -20px;
+}
/* Bins */
--- a/server/php/basic/public_html/static/lib/renkan/css/renkan.min.css Wed Jun 03 19:16:58 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/css/renkan.min.css Thu Jun 04 10:04:01 2015 +0200
@@ -50,4 +50,4 @@
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
- *//*! renkan - v0.7.11 - Copyright © IRI 2014 */#renkan{overflow:hidden}.Rk-Main h3,.Rk-Main h4,.Rk-Main li,.Rk-Main p,.Rk-Main ul{border:0 none;margin:0;padding:0}.Rk-Main li,.Rk-Main ul{list-style:none}.Rk-Main input::-moz-focus-inner{border:0;padding:0}.Rk-Main table{border-collapse:separate;border-spacing:0}.Rk-Main td,.Rk-Main th{vertical-align:top}.Rk-Main img a{border:none}.Rk-Main{font-size:10px;font-family:Arial,Helvetica,sans-serif;background:#fff;color:#000}.Rk-Main a{color:#6060c0}.Rk-Main{position:absolute;left:0;top:0;right:0;bottom:0}.Rk-Render{position:absolute;top:0;right:0;bottom:0;background:#fff}.Rk-Render-Full{left:0}.Rk-Render-Panel{left:300px}.Rk-TopBar{position:absolute;left:0;top:0;right:0;height:35px;background:#333;background:-moz-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-webkit-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-ms-linear-gradient(top,#505050 5px,#1e1e1e 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#505050', endColorstr='#1e1e1e', GradientType=0)}.Rk-TopBar .loader{display:block;background:none repeat red;width:0;height:4px;overflow:hidden;position:absolute;bottom:0;left:0;transition:width 3s linear;z-index:50}.Rk-TopBar .loader.run{width:100%}.Rk-PadTitle{float:left;font-size:14px;height:16px;margin:4px 5px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;font-weight:700}input.Rk-PadTitle{width:180px}h2.Rk-PadTitle{min-width:180px;max-width:320px;overflow:hidden}.Rk-Users{float:right;width:130px;margin:4px 5px}.Rk-CurrentUser{font-size:13px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;text-align:center}.Rk-CurrentUser-Color{display:inline-block;width:12px;height:12px;border:1px solid #333;margin:-2px 2px;position:relative}.Rk-CurrentUser input{width:95px;padding:1px;border:none;border-radius:2px}.Rk-UserList{box-shadow:0 2px 2px #999;position:relative;z-index:3;display:none;padding-top:8px}.Rk-User{background:#fff;padding:3px;font-size:12px;border-style:solid solid none;border-color:#ccc;border-width:1px}.Rk-TopBar-Button{float:right;background:url(../img/topbarbuttons.png) no-repeat;height:35px;cursor:pointer;position:relative}.Rk-TopBar-Separator{background:#666;background:-moz-linear-gradient(top,#666 20%,#333 80%);background:-webkit-linear-gradient(top,#666 20%,#333 80%);background:-ms-linear-gradient(top,#666 20%,#333 80%);content:"";display:block;height:35px;float:right;width:1px;border-left:1px solid #111;margin:0 3px}.Rk-TopBar-Tooltip{position:absolute;top:31px;left:50%;margin-left:-60px;width:120px;z-index:4;display:none}.Rk-TopBar-Tooltip-Contents{background:#fff;font-size:13px;font-weight:700;color:#6060c0;text-align:center;padding:2px;border-style:none solid solid;border-width:1px;border-color:#ccc;border-bottom-left-radius:2px;border-bottom-right-radius:2px}.Rk-TopBar-Tooltip:before{content:".";display:block;text-indent:-8000px;height:7px;background:url(../img/tooltiparrow.png) center no-repeat;margin:0 1px}.Rk-AddNode-Button{width:30px;background-position:-2px 0}.Rk-AddNode-Button:hover{background-position:-2px -35px}.Rk-FullScreen-Button{width:30px;background-position:-36px 0}.Rk-FullScreen-Button:hover{background-position:-36px -35px}.Rk-AddEdge-Button{width:30px;background-position:-70px 0}.Rk-AddEdge-Button:hover{background-position:-70px -35px}.Rk-Save-Button{width:30px;background-position:-104px 0}.Rk-Save-Button.saving{background-position:-104px 0}.Rk-Save-Button.Rk-Save-Online:hover,.Rk-Save-Button.saved:hover,.Rk-Save-Button:hover{background-position:-104px -35px}.Rk-Save-Button.Rk-Save-Online:active,.Rk-Save-Button.saved:active,.Rk-Save-Button:active{background-position:-104px 0}.Rk-Save-Button.to-save{background-position:-172px -35px}.Rk-Save-Button.Rk-Save-Online,.Rk-Save-Button.saved{background-position:-172px 0}.Rk-Save-Button.Rk-Save-ReadOnly,.Rk-Save-Button.disabled{opacity:.4;cursor:default}.Rk-Export-Button{width:30px;background-position:-274px 0}.Rk-Export-Button.disabled{opacity:.5;cursor:default}.Rk-Export-Button:hover{background-position:-274px -35px}.Rk-Export-Button.disabled:hover{opacity:1;background-position:-274px 0}.Rk-Bookmarklet-Button{width:30px;background-position:-138px 0}.Rk-Bookmarklet-Button.disabled{opacity:.5;cursor:default}.Rk-Bookmarklet-Button:hover{background-position:-138px -35px}.Rk-Bookmarklet-Button.disabled:hover{opacity:1;background-position:-138px 0}.Rk-Home-Button{width:30px;background-position:-206px 0}.Rk-Home-Button:hover{background-position:-206px -35px}.Rk-Open-Button{width:30px;background-position:-240px 0}.Rk-Open-Button:hover{background-position:-240px -35px}.Rk-GraphSearch-Form{float:right;width:185px;position:relative}.Rk-GraphSearch-Form:after,.Rk-GraphSearch-Form:before{position:absolute;display:block;content:".";text-indent:-9999px}.Rk-GraphSearch-Form:before{right:10px;top:20px;width:7px;height:2px;border:none;padding:0;background:#666;transform:rotate(40deg);-webkit-transform:rotate(40deg)}.Rk-GraphSearch-Form:after{right:13px;top:11px;width:6px;height:6px;border-radius:8px;border:2px solid #666}.Rk-GraphSearch-Field{line-height:23px;font-size:14px;height:23px;padding:0 5px;border:none;margin:6px 5px;width:165px;background:#f0f0f0;box-shadow:1px 1px 1px #999 inset;border-radius:5px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Editing-Space{position:absolute;left:0;top:35px;right:0;bottom:0;overflow:hidden;background:-moz-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-webkit-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-ms-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%)}.Rk-Editing-Space-Full{top:0}.Rk-Canvas{position:absolute;left:0;top:0;right:0;bottom:0;z-index:2}.Rk-Canvas[resize]{width:100%;height:100%}.Rk-Highlighted{background:rgba(255,255,0,.5)}.Rk-Labels{position:absolute;left:0;top:0;z-index:1;font-family:"Segoe UI","Helvetica Neue",Arial,Helvetica,sans-serif}.Rk-Label{position:absolute;width:160px;margin-left:-80px;text-align:center;font-size:13px;line-height:13px}.Rk-Edge-Label{font-size:11px;transform-origin:50% 0;-moz-transform-origin:50% 0;-webkit-transform-origin:50% 0;-ms-transform-origin:50% 0}.Rk-Editor{position:absolute;left:0;top:0;z-index:3}.Rk-Notifications{position:absolute;right:15px;top:15px;width:200px;padding:10px;border-radius:8px;display:none;color:#fff;font-size:13px;text-align:center;font-weight:700;background:rgba(20,20,20,.7);background:-moz-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-webkit-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-ms-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#202020', endColorstr='#000000', GradientType=0)}.Rk-CloseX{float:right;cursor:pointer}.Rk-Editor h2{font-size:16px;font-weight:700}.Rk-Editor p,.Rk-Editor-p,.Rk-Editor-p>div{margin:5px 0;font-size:12px;clear:both}.Rk-Editor-Label{float:left;width:80px}a.Rk-Edit-Goto{display:block;float:right;width:18px;height:17px;margin:1px 0;border:none;background:url(../img/goto.png)}.Rk-Edit-Image-File,.Rk-Edit-Title,.Rk-Edit-URI,.Rk-Edit-Vocabulary{font-size:12px;width:250px}.Rk-Edit-Image{font-size:12px;width:220px}.Rk-Edit-Image-Del{display:inline-block;background:url(../img/remove.png);background-size:15px 20px;background-repeat:no-repeat;vertical-align:top;height:20px;width:15px;margin-right:2px}.Rk-Edit-URI{font-size:12px;width:220px}.Rk-Edit-ImgWrap{text-align:center}.Rk-Edit-ImgPreview{display:inline-block;border:1px solid #666;margin:5px auto;position:relative}.Rk-Edit-ImgPreview img{display:inline-block;max-width:253px!important;max-height:200px!important}.Rk-Edit-ImgPreview svg{height:100%;left:0;position:absolute;top:0;width:100%}.Rk-Editor textarea{width:250px;height:120px;resize:none}.Rk-UserColor{display:inline-block;width:12px;height:12px;border:1px solid #666;margin:-2px 2px}.Rk-Edit-Color{display:inline-block;width:10px;height:10px;border:2px solid #333;margin:-2px 2px;position:relative}.Rk-Edit-ColorTip{display:block;width:3px;height:3px;background:#fff;position:absolute;bottom:0;right:0;cursor:pointer}.Rk-Edit-ColorPicker-Wrapper{display:inline-block;position:relative;float:left}.Rk-Edit-ColorPicker{position:absolute;top:-2px;left:15px;width:96px;height:96px;border:1px solid #CCC;padding:5px 4px 4px 5px;background:#fff;border-radius:5px;display:none;z-index:4}.Rk-CurrentUser .Rk-Edit-ColorPicker{left:-105px;top:2px}.Rk-Edit-ColorPicker-Text{color:#303080;font-weight:700}.Rk-Edit-ColorPicker li{float:left;width:11px;height:11px;margin:0 1px 1px 0;cursor:pointer}.Rk-Edit-Dash{float:left;display:inline-block}.Rk-Edit-Size-Btn{font-size:13px;font-weight:700;padding:0 4px;background:#fff;color:#000;border:1px solid #ccc;text-decoration:none}.Rk-Edit-Size-Btn:hover{background:#666}.Rk-Edit-Size-Disp{display:inline-block;padding:0 5px;text-align:center;width:20px}.Rk-Edit-Vocabulary-Class{color:#999;font-style:italic;font-weight:700}.Rk-Edit-Vocabulary-Property{padding-left:20px}.Rk-Edit-Direction{border:1px solid #666;padding:3px 5px;line-height:20px;border-radius:3px;background:#f0f0f0;cursor:pointer}.Rk-Edit-Direction:hover{background:silver}.Rk-Display-Title a{text-decoration:none;color:#000}.Rk-Display-Title a:hover{text-decoration:underline}.Rk-Display-URI{font-style:italic}.Rk-Display-ImgPreview{margin:5px auto;display:block;max-width:255px!important;max-height:260px!important}.Rk-Fold-Bins{position:absolute;top:5px;width:12px;text-align:center;font-size:16px;cursor:pointer;line-height:16px;padding:4px;color:#fff;background:#666;border-radius:0 6px 6px 0;font-weight:700}.Rk-Fold-Bins:hover{background:#333}.Rk-ZoomButtons{position:absolute;left:0;top:35px;cursor:pointer}.Rk-Editing-Space-Full .Rk-ZoomButtons{top:0}.Rk-ZoomFit,.Rk-ZoomIn,.Rk-ZoomOut,.Rk-ZoomSave,.Rk-ZoomSetSaved{width:21px;height:20px;background:url(../img/zoombuttons.png);margin:5px}.Rk-ZoomIn:hover{background-position:0 -20px}.Rk-ZoomFit{background-position:-42px 0}.Rk-ZoomFit:hover{background-position:-42px -20px}.Rk-ZoomOut{background-position:-21px 0}.Rk-ZoomOut:hover{background-position:-21px -20px}.Rk-ZoomSave{background-position:-63px 0}.Rk-ZoomSave:hover{background-position:-63px -20px}.Rk-ZoomSetSaved{background-position:-84px 0;display:none}.Rk-ZoomSetSaved:hover{background-position:-84px -20px}.Rk-Bins{background:#fff;position:absolute;left:0;top:0;width:299px;bottom:0;overflow:hidden;border-right:1px solid #252525}.Rk-Bins-Title{border:0 none;width:290px;height:15px;line-height:15px;margin:0;padding:15px 0 5px 10px;font-size:14px;color:#F0F0F0;background:-moz-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-webkit-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-ms-linear-gradient(top,#1e1e1e 5px,#606060 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1e1e1e', endColorstr='#606060', GradientType=0)}.Rk-Search-Form{padding:0 10px 8px;height:27px;background:#606060}.Rk-Search-Input,.Rk-Search-Select{float:left;margin:0}.Rk-Search-Input{border-top-left-radius:5px;border-bottom-left-radius:5px;border:1px solid #003050;font-size:13px;background:#fff;height:25px;padding:0 5px;line-height:25px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Web-Search-Input{width:190px}.Rk-Bins-Search-Input{width:235px}.Rk-Search-Select{display:inline-block;position:relative;width:45px;border-width:1px;border-color:#003050;border-style:solid none;cursor:pointer;height:25px;background:#fff url(../img/more.png) 30px 10px no-repeat}.Rk-Search-Select:hover{background-color:#3030FF}.Rk-Search-Current{width:40px;height:20px;margin:2px;background-repeat:no-repeat}.Rk-Search-List{width:180px;margin-left:15px;font-size:13px;position:absolute;right:0;top:25px;background:#fff;box-shadow:1px 1px 2px #505050;display:none;border:1px solid #ccc;z-index:2}.Rk-Search-List li{padding:2px 2px 2px 30px;border-top:1px solid #ccc;height:16px;background-color:#fff;background-repeat:no-repeat;cursor:pointer}.Rk-Search-List li:hover{background-color:#3030ff;color:#fff}.Rk-Search-Submit{border:1px solid #003050;height:27px;width:30px;border-top-right-radius:5px;border-bottom-right-radius:5px;background:#333 center no-repeat url(../img/search.png);cursor:pointer}.Rk-Search-Submit:hover{background-color:#999}.Rk-Bin-Title{background:#333;background:-moz-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-webkit-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-ms-linear-gradient(top,#505050 20%,#1e1e1e 80%);font-weight:700;font-size:14px;padding:5px;cursor:pointer;color:#f0f0f0;margin:0;border:0 none}.Rk-Bin-Close{float:right;display:block;font-size:16px;font-weight:700;margin:2px 3px 0;color:#f0f0f0;cursor:pointer;text-shadow:-1px -1px 1px #999,1px 1px 1px #000;text-decoration:none}.Rk-Bin-Close:hover{color:#ffff80}.Rk-Bin-Title:hover{color:#ffffe0;background:#505050;background:-moz-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-webkit-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-ms-linear-gradient(top,#141414 20%,#3c3c3c 80%)}.Rk-Bin-Refresh{width:18px;height:17px;background:url(../img/refresh.png);display:block;float:right;margin-top:4px}.Rk-Bin-Refresh:hover{background-position:-18px 0}.Rk-Bin-Count{float:right;background:#c000a0;color:#FFF;text-shadow:1px 1px 1px #000;display:none;border-radius:4px;padding:1px 3px;font-size:10px;font-weight:700;margin-top:4px}.Rk-Bin-Title-Icon{float:left;width:25px;margin:2px}.Rk-Bin-Main{overflow:auto;background:#fff;background:-moz-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-webkit-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-ms-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%)}.Rk-Bin-Item{cursor:move}.Rk-Bin-Item.hover,.Rk-Bin-Item:hover{background:-moz-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-webkit-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-ms-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d0d0d0', endColorstr='#f3f3f3', GradientType=0)}.Rk-Bin-Item.selected{background:#ffffc0}.Rk-Bin-Main li{padding:2px;border-bottom:1px solid #ccc;clear:both;overflow:hidden}.Rk-Bin-Main h3{font-size:14px;font-style:italic;font-weight:700;text-align:center}.Rk-Bin-Main h4{font-size:12px;font-weight:700}.Rk-Bin-Main p{font-size:11px}.Rk-Bin-Main h4 a{color:#303080}.Rk-Bin-Main .searchmatch{background:#ffff80}.Rk-Wikipedia-Search-Icon{background-image:url(../img/search-logos.png)}.Rk-Wikipedia-Icon{float:left;margin:3px;max-height:48px;max-width:48px}.Rk-Wikipedia-Title-Icon{height:20px;background:url(../img/search-logos.png)}.Rk-Wikipedia-Lang-en{background-position:0 -20px}.Rk-Wikipedia-Lang-fr{background-position:0 -40px}.Rk-Wikipedia-Lang-ja{background-position:0 -60px}.Rk-Wikipedia-Result{min-height:51px}.Rk-Wikipedia-Result h4,.Rk-Wikipedia-Result p{margin-left:54px}.Rk-ResourceList-Image{float:left;max-width:100px;max-height:75px;margin-right:2px}.Rk-Ldt-Icon,.Rk-Ldt-Title-Icon{background:url(../img/search-logos.png);background-position:0 -100px;background-repeat:no-repeat}.Rk-Ldt-Title-Icon{height:20px;margin-top:4px}.Rk-Ldt-Tag-Icon{float:left;margin:0 2px 0 0}.Rk-Ldt-Annotation-Icon{float:left;margin:3px}.Rk-Clear{clear:both}h4.Rk-Bin-Loading{margin:10px;text-align:center;font-size:20px;color:#999}
\ No newline at end of file
+ *//*! renkan - v0.7.11 - Copyright © IRI 2014 */#renkan{overflow:hidden}.Rk-Main h3,.Rk-Main h4,.Rk-Main li,.Rk-Main p,.Rk-Main ul{border:0 none;margin:0;padding:0}.Rk-Main li,.Rk-Main ul{list-style:none}.Rk-Main input::-moz-focus-inner{border:0;padding:0}.Rk-Main table{border-collapse:separate;border-spacing:0}.Rk-Main td,.Rk-Main th{vertical-align:top}.Rk-Main img a{border:none}.Rk-Main{font-size:10px;font-family:Arial,Helvetica,sans-serif;background:#fff;color:#000}.Rk-Main a{color:#6060c0}.Rk-Main{position:absolute;left:0;top:0;right:0;bottom:0}.Rk-Render{position:absolute;top:0;right:0;bottom:0;background:#fff}.Rk-Render-Full{left:0}.Rk-Render-Panel{left:300px}.Rk-TopBar{position:absolute;left:0;top:0;right:0;height:35px;background:#333;background:-moz-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-webkit-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-ms-linear-gradient(top,#505050 5px,#1e1e1e 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#505050', endColorstr='#1e1e1e', GradientType=0)}.Rk-TopBar .loader{display:block;background:none repeat red;width:0;height:4px;overflow:hidden;position:absolute;bottom:0;left:0;transition:width 3s linear;z-index:50}.Rk-TopBar .loader.run{width:100%}.Rk-PadTitle{float:left;font-size:14px;height:16px;margin:4px 5px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;font-weight:700}input.Rk-PadTitle{width:180px}h2.Rk-PadTitle{min-width:180px;max-width:320px;overflow:hidden}.Rk-Users{float:right;width:130px;margin:4px 5px}.Rk-CurrentUser{font-size:13px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;text-align:center}.Rk-CurrentUser-Color{display:inline-block;width:12px;height:12px;border:1px solid #333;margin:-2px 2px;position:relative}.Rk-CurrentUser input{width:95px;padding:1px;border:none;border-radius:2px}.Rk-UserList{box-shadow:0 2px 2px #999;position:relative;z-index:3;display:none;padding-top:8px}.Rk-User{background:#fff;padding:3px;font-size:12px;border-style:solid solid none;border-color:#ccc;border-width:1px}.Rk-TopBar-Button{float:right;background:url(../img/topbarbuttons.png) no-repeat;height:35px;cursor:pointer;position:relative}.Rk-TopBar-Separator{background:#666;background:-moz-linear-gradient(top,#666 20%,#333 80%);background:-webkit-linear-gradient(top,#666 20%,#333 80%);background:-ms-linear-gradient(top,#666 20%,#333 80%);content:"";display:block;height:35px;float:right;width:1px;border-left:1px solid #111;margin:0 3px}.Rk-TopBar-Tooltip{position:absolute;top:31px;left:50%;margin-left:-60px;width:120px;z-index:4;display:none}.Rk-TopBar-Tooltip-Contents{background:#fff;font-size:13px;font-weight:700;color:#6060c0;text-align:center;padding:2px;border-style:none solid solid;border-width:1px;border-color:#ccc;border-bottom-left-radius:2px;border-bottom-right-radius:2px}.Rk-TopBar-Tooltip:before{content:".";display:block;text-indent:-8000px;height:7px;background:url(../img/tooltiparrow.png) center no-repeat;margin:0 1px}.Rk-AddNode-Button{width:30px;background-position:-2px 0}.Rk-AddNode-Button:hover{background-position:-2px -35px}.Rk-FullScreen-Button{width:30px;background-position:-36px 0}.Rk-FullScreen-Button:hover{background-position:-36px -35px}.Rk-AddEdge-Button{width:30px;background-position:-70px 0}.Rk-AddEdge-Button:hover{background-position:-70px -35px}.Rk-Save-Button{width:30px;background-position:-104px 0}.Rk-Save-Button.saving{background-position:-104px 0}.Rk-Save-Button.Rk-Save-Online:hover,.Rk-Save-Button.saved:hover,.Rk-Save-Button:hover{background-position:-104px -35px}.Rk-Save-Button.Rk-Save-Online:active,.Rk-Save-Button.saved:active,.Rk-Save-Button:active{background-position:-104px 0}.Rk-Save-Button.to-save{background-position:-172px -35px}.Rk-Save-Button.Rk-Save-Online,.Rk-Save-Button.saved{background-position:-172px 0}.Rk-Save-Button.Rk-Save-ReadOnly,.Rk-Save-Button.disabled{opacity:.4;cursor:default}.Rk-Export-Button{width:30px;background-position:-274px 0}.Rk-Export-Button.disabled{opacity:.5;cursor:default}.Rk-Export-Button:hover{background-position:-274px -35px}.Rk-Export-Button.disabled:hover{opacity:1;background-position:-274px 0}.Rk-Bookmarklet-Button{width:30px;background-position:-138px 0}.Rk-Bookmarklet-Button.disabled{opacity:.5;cursor:default}.Rk-Bookmarklet-Button:hover{background-position:-138px -35px}.Rk-Bookmarklet-Button.disabled:hover{opacity:1;background-position:-138px 0}.Rk-Home-Button{width:30px;background-position:-206px 0}.Rk-Home-Button:hover{background-position:-206px -35px}.Rk-Open-Button{width:30px;background-position:-240px 0}.Rk-Open-Button:hover{background-position:-240px -35px}.Rk-GraphSearch-Form{float:right;width:185px;position:relative}.Rk-GraphSearch-Form:after,.Rk-GraphSearch-Form:before{position:absolute;display:block;content:".";text-indent:-9999px}.Rk-GraphSearch-Form:before{right:10px;top:20px;width:7px;height:2px;border:none;padding:0;background:#666;transform:rotate(40deg);-webkit-transform:rotate(40deg)}.Rk-GraphSearch-Form:after{right:13px;top:11px;width:6px;height:6px;border-radius:8px;border:2px solid #666}.Rk-GraphSearch-Field{line-height:23px;font-size:14px;height:23px;padding:0 5px;border:none;margin:6px 5px;width:165px;background:#f0f0f0;box-shadow:1px 1px 1px #999 inset;border-radius:5px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Editing-Space{position:absolute;left:0;top:35px;right:0;bottom:0;overflow:hidden;background:-moz-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-webkit-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-ms-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%)}.Rk-Editing-Space-Full{top:0}.Rk-Canvas{position:absolute;left:0;top:0;right:0;bottom:0;z-index:2}.Rk-Canvas[resize]{width:100%;height:100%}.Rk-Highlighted{background:rgba(255,255,0,.5)}.Rk-Labels{position:absolute;left:0;top:0;z-index:1;font-family:"Segoe UI","Helvetica Neue",Arial,Helvetica,sans-serif}.Rk-Label{position:absolute;width:160px;margin-left:-80px;text-align:center;font-size:13px;line-height:13px}.Rk-Edge-Label{font-size:11px;transform-origin:50% 0;-moz-transform-origin:50% 0;-webkit-transform-origin:50% 0;-ms-transform-origin:50% 0}.Rk-Editor{position:absolute;left:0;top:0;z-index:3}.Rk-Notifications{position:absolute;right:15px;top:15px;width:200px;padding:10px;border-radius:8px;display:none;color:#fff;font-size:13px;text-align:center;font-weight:700;background:rgba(20,20,20,.7);background:-moz-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-webkit-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-ms-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#202020', endColorstr='#000000', GradientType=0)}.Rk-CloseX{float:right;cursor:pointer}.Rk-Editor h2{font-size:16px;font-weight:700}.Rk-Editor p,.Rk-Editor-p,.Rk-Editor-p>div{margin:5px 0;font-size:12px;clear:both}.Rk-Editor-Label{float:left;width:80px}a.Rk-Edit-Goto{display:block;float:right;width:18px;height:17px;margin:1px 0;border:none;background:url(../img/goto.png)}.Rk-Edit-Image-File,.Rk-Edit-Title,.Rk-Edit-URI,.Rk-Edit-Vocabulary{font-size:12px;width:250px}.Rk-Edit-Image{font-size:12px;width:220px}.Rk-Edit-Image-Del{display:inline-block;background:url(../img/remove.png);background-size:15px 20px;background-repeat:no-repeat;vertical-align:top;height:20px;width:15px;margin-right:2px}.Rk-Edit-URI{font-size:12px;width:220px}.Rk-Edit-ImgWrap{text-align:center}.Rk-Edit-ImgPreview{display:inline-block;border:1px solid #666;margin:5px auto;position:relative}.Rk-Edit-ImgPreview img{display:inline-block;max-width:253px!important;max-height:200px!important}.Rk-Edit-ImgPreview svg{height:100%;left:0;position:absolute;top:0;width:100%}.Rk-Editor textarea{width:250px;height:120px;resize:none}.Rk-UserColor{display:inline-block;width:12px;height:12px;border:1px solid #666;margin:-2px 2px}.Rk-Edit-Color{display:inline-block;width:10px;height:10px;border:2px solid #333;margin:-2px 2px;position:relative}.Rk-Edit-ColorTip{display:block;width:3px;height:3px;background:#fff;position:absolute;bottom:0;right:0;cursor:pointer}.Rk-Edit-ColorPicker-Wrapper{display:inline-block;position:relative;float:left}.Rk-Edit-ColorPicker{position:absolute;top:-2px;left:15px;width:96px;height:96px;border:1px solid #CCC;padding:5px 4px 4px 5px;background:#fff;border-radius:5px;display:none;z-index:4}.Rk-CurrentUser .Rk-Edit-ColorPicker{left:-105px;top:2px}.Rk-Edit-ColorPicker-Text{color:#303080;font-weight:700}.Rk-Edit-ColorPicker li{float:left;width:11px;height:11px;margin:0 1px 1px 0;cursor:pointer}.Rk-Edit-Dash{float:left;display:inline-block}.Rk-Edit-Size-Btn{font-size:13px;font-weight:700;padding:0 4px;background:#fff;color:#000;border:1px solid #ccc;text-decoration:none}.Rk-Edit-Size-Btn:hover{background:#666}.Rk-Edit-Size-Disp{display:inline-block;padding:0 5px;text-align:center;width:20px}.Rk-Edit-Vocabulary-Class{color:#999;font-style:italic;font-weight:700}.Rk-Edit-Vocabulary-Property{padding-left:20px}.Rk-Edit-Direction{border:1px solid #666;padding:3px 5px;line-height:20px;border-radius:3px;background:#f0f0f0;cursor:pointer}.Rk-Edit-Direction:hover{background:silver}.Rk-Display-Title a{text-decoration:none;color:#000}.Rk-Display-Title a:hover{text-decoration:underline}.Rk-Display-URI{font-style:italic}.Rk-Display-ImgPreview{margin:5px auto;display:block;max-width:255px!important;max-height:260px!important}.Rk-Fold-Bins{position:absolute;top:5px;width:12px;text-align:center;font-size:16px;cursor:pointer;line-height:16px;padding:4px;color:#fff;background:#666;border-radius:0 6px 6px 0;font-weight:700}.Rk-Fold-Bins:hover{background:#333}.Rk-ZoomButtons{position:absolute;left:0;top:35px;cursor:pointer}.Rk-Editing-Space-Full .Rk-ZoomButtons{top:0}.Rk-ShowHiddenNodes,.Rk-ZoomFit,.Rk-ZoomIn,.Rk-ZoomOut,.Rk-ZoomSave,.Rk-ZoomSetSaved{width:21px;height:20px;background:url(../img/zoombuttons.png);margin:5px}.Rk-ZoomIn:hover{background-position:0 -20px}.Rk-ZoomFit{background-position:-42px 0}.Rk-ZoomFit:hover{background-position:-42px -20px}.Rk-ZoomOut{background-position:-21px 0}.Rk-ZoomOut:hover{background-position:-21px -20px}.Rk-ZoomSave{background-position:-63px 0}.Rk-ZoomSave:hover{background-position:-63px -20px}.Rk-ZoomSetSaved{background-position:-84px 0;display:none}.Rk-ZoomSetSaved:hover{background-position:-84px -20px}.Rk-ShowHiddenNodes{background-position:-105px 0}.Rk-ShowHiddenNodes:hover{background-position:-105px -20px}.Rk-Bins{background:#fff;position:absolute;left:0;top:0;width:299px;bottom:0;overflow:hidden;border-right:1px solid #252525}.Rk-Bins-Title{border:0 none;width:290px;height:15px;line-height:15px;margin:0;padding:15px 0 5px 10px;font-size:14px;color:#F0F0F0;background:-moz-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-webkit-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-ms-linear-gradient(top,#1e1e1e 5px,#606060 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1e1e1e', endColorstr='#606060', GradientType=0)}.Rk-Search-Form{padding:0 10px 8px;height:27px;background:#606060}.Rk-Search-Input,.Rk-Search-Select{float:left;margin:0}.Rk-Search-Input{border-top-left-radius:5px;border-bottom-left-radius:5px;border:1px solid #003050;font-size:13px;background:#fff;height:25px;padding:0 5px;line-height:25px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Web-Search-Input{width:190px}.Rk-Bins-Search-Input{width:235px}.Rk-Search-Select{display:inline-block;position:relative;width:45px;border-width:1px;border-color:#003050;border-style:solid none;cursor:pointer;height:25px;background:#fff url(../img/more.png) 30px 10px no-repeat}.Rk-Search-Select:hover{background-color:#3030FF}.Rk-Search-Current{width:40px;height:20px;margin:2px;background-repeat:no-repeat}.Rk-Search-List{width:180px;margin-left:15px;font-size:13px;position:absolute;right:0;top:25px;background:#fff;box-shadow:1px 1px 2px #505050;display:none;border:1px solid #ccc;z-index:2}.Rk-Search-List li{padding:2px 2px 2px 30px;border-top:1px solid #ccc;height:16px;background-color:#fff;background-repeat:no-repeat;cursor:pointer}.Rk-Search-List li:hover{background-color:#3030ff;color:#fff}.Rk-Search-Submit{border:1px solid #003050;height:27px;width:30px;border-top-right-radius:5px;border-bottom-right-radius:5px;background:#333 center no-repeat url(../img/search.png);cursor:pointer}.Rk-Search-Submit:hover{background-color:#999}.Rk-Bin-Title{background:#333;background:-moz-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-webkit-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-ms-linear-gradient(top,#505050 20%,#1e1e1e 80%);font-weight:700;font-size:14px;padding:5px;cursor:pointer;color:#f0f0f0;margin:0;border:0 none}.Rk-Bin-Close{float:right;display:block;font-size:16px;font-weight:700;margin:2px 3px 0;color:#f0f0f0;cursor:pointer;text-shadow:-1px -1px 1px #999,1px 1px 1px #000;text-decoration:none}.Rk-Bin-Close:hover{color:#ffff80}.Rk-Bin-Title:hover{color:#ffffe0;background:#505050;background:-moz-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-webkit-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-ms-linear-gradient(top,#141414 20%,#3c3c3c 80%)}.Rk-Bin-Refresh{width:18px;height:17px;background:url(../img/refresh.png);display:block;float:right;margin-top:4px}.Rk-Bin-Refresh:hover{background-position:-18px 0}.Rk-Bin-Count{float:right;background:#c000a0;color:#FFF;text-shadow:1px 1px 1px #000;display:none;border-radius:4px;padding:1px 3px;font-size:10px;font-weight:700;margin-top:4px}.Rk-Bin-Title-Icon{float:left;width:25px;margin:2px}.Rk-Bin-Main{overflow:auto;background:#fff;background:-moz-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-webkit-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-ms-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%)}.Rk-Bin-Item{cursor:move}.Rk-Bin-Item.hover,.Rk-Bin-Item:hover{background:-moz-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-webkit-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-ms-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d0d0d0', endColorstr='#f3f3f3', GradientType=0)}.Rk-Bin-Item.selected{background:#ffffc0}.Rk-Bin-Main li{padding:2px;border-bottom:1px solid #ccc;clear:both;overflow:hidden}.Rk-Bin-Main h3{font-size:14px;font-style:italic;font-weight:700;text-align:center}.Rk-Bin-Main h4{font-size:12px;font-weight:700}.Rk-Bin-Main p{font-size:11px}.Rk-Bin-Main h4 a{color:#303080}.Rk-Bin-Main .searchmatch{background:#ffff80}.Rk-Wikipedia-Search-Icon{background-image:url(../img/search-logos.png)}.Rk-Wikipedia-Icon{float:left;margin:3px;max-height:48px;max-width:48px}.Rk-Wikipedia-Title-Icon{height:20px;background:url(../img/search-logos.png)}.Rk-Wikipedia-Lang-en{background-position:0 -20px}.Rk-Wikipedia-Lang-fr{background-position:0 -40px}.Rk-Wikipedia-Lang-ja{background-position:0 -60px}.Rk-Wikipedia-Result{min-height:51px}.Rk-Wikipedia-Result h4,.Rk-Wikipedia-Result p{margin-left:54px}.Rk-ResourceList-Image{float:left;max-width:100px;max-height:75px;margin-right:2px}.Rk-Ldt-Icon,.Rk-Ldt-Title-Icon{background:url(../img/search-logos.png);background-position:0 -100px;background-repeat:no-repeat}.Rk-Ldt-Title-Icon{height:20px;margin-top:4px}.Rk-Ldt-Tag-Icon{float:left;margin:0 2px 0 0}.Rk-Ldt-Annotation-Icon{float:left;margin:3px}.Rk-Clear{clear:both}h4.Rk-Bin-Loading{margin:10px;text-align:center;font-size:20px;color:#999}
\ No newline at end of file
Binary file server/php/basic/public_html/static/lib/renkan/img/hide.png has changed
Binary file server/php/basic/public_html/static/lib/renkan/img/show.png has changed
Binary file server/php/basic/public_html/static/lib/renkan/img/zoombuttons.png has changed
Binary file server/php/basic/public_html/static/lib/renkan/img/zoombuttons2.png has changed
--- a/server/php/basic/public_html/static/lib/renkan/js/renkan.js Wed Jun 03 19:16:58 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/js/renkan.js Thu Jun 04 10:04:01 2015 +0200
@@ -719,6 +719,8 @@
if (options.save_view) { ;
__p += '\n <div class="Rk-ZoomSetSaved" title="' +
__e(translate('View saved zoom')) +
+'"></div>\n \t<div class="Rk-ShowHiddenNodes" title="' +
+__e(translate('Show hidden nodes')) +
'"></div>\n ';
} ;
__p += '\n </div>\n ';
@@ -1533,9 +1535,8 @@
.get("_id") : null,
size : this.get("size"),
clip_path : this.get("clip_path"),
- shape : this.get("shape"),
- type : this.get("type"),
- hidden : this.get("hidden")
+ shape : this.get("shape"),
+ type : this.get("type")
};
}
});
@@ -1616,7 +1617,8 @@
title : this.get("title"),
description : this.get("description"),
created_by : this.get("created_by") ? this.get("created_by")
- .get("_id") : null
+ .get("_id") : null,
+ hidden_nodes: this.get("hidden_nodes")
// Don't need project id
};
}
@@ -1808,6 +1810,10 @@
/* List of Bins */
static_url: "",
/* URL for static resources */
+ popup_editor: true,
+ /* show the node editor as a popup inside the renkan view */
+ editor_panel: 'editor-panel',
+ /* GUI continer DOM element ID of the editor panel */
show_bins: true,
/* Show bins in left column */
properties: [],
@@ -2953,6 +2959,8 @@
this.renderer.node_layer.activate();
this.type = "Node";
this.buildShape();
+ this.hidden = false;
+ this.ghost= false;
if (this.options.show_node_circles) {
this.circle.strokeWidth = this.options.node_stroke_width;
this.h_ratio = 1;
@@ -2966,6 +2974,8 @@
this.normal_buttons = [
new Renderer.NodeEditButton(this.renderer, null),
new Renderer.NodeRemoveButton(this.renderer, null),
+ new Renderer.NodeHideButton(this.renderer, null),
+ new Renderer.NodeShowButton(this.renderer, null),
new Renderer.NodeLinkButton(this.renderer, null),
new Renderer.NodeEnlargeButton(this.renderer, null),
new Renderer.NodeShrinkButton(this.renderer, null)
@@ -3052,8 +3062,7 @@
this.active_buttons = this.normal_buttons;
this.circle.dashArray = null;
}
-
- if (this.selected && this.renderer.isEditable()) {
+ if (this.selected && this.renderer.isEditable() && !this.ghost) {
if (old_act_btn !== this.active_buttons) {
old_act_btn.forEach(function(b) {
b.hide();
@@ -3133,7 +3142,11 @@
}
);
}
-
+ if (this.ghost){
+ this.show(true);
+ } else {
+ if (this.hidden) { this.hide(); }
+ }
},
showImage: function() {
var _image = null;
@@ -3284,7 +3297,7 @@
select: function() {
this.selected = true;
this.circle.strokeWidth = this._getSelectedStrokeWidth();
- if (this.renderer.isEditable()) {
+ if (this.renderer.isEditable() && !this.hidden) {
this.active_buttons.forEach(function(b) {
b.show();
});
@@ -3306,6 +3319,13 @@
this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;
this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
}
+ //if the node is hidden and the mouse hover it, it appears as a ghost
+ if (this.hidden) {
+ this.show(true);
+ }
+ else {
+ this.showNeighbors(true);
+ }
this._super("select");
},
hideButtons: function() {
@@ -3324,9 +3344,111 @@
if (this.renderer.minimap) {
this.minimap_circle.strokeColor = undefined;
}
+ //when the mouse don't hover the node anymore, we hide it
+ if (this.hidden) {
+ this.hide();
+ }
+ else {
+ this.hideNeighbors();
+ }
this._super("unselect");
}
},
+ hide: function(){
+ var _this = this;
+ this.ghost = false;
+ this.hidden = true;
+ if (typeof this.node_image !== 'undefined'){
+ this.node_image.opacity = 0;
+ }
+ this.hideButtons();
+ this.circle.opacity = 0;
+ this.title.css('opacity', 0);
+ this.minimap_circle.opacity = 0;
+
+
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return ((ed.get("to") === _this.model) || (ed.get("from") === _this.model));
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge);
+ 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") {
+ repr.hide();
+ }
+ }
+ );
+ this.hideNeighbors();
+ },
+ show: function(ghost){
+ var _this = this;
+ this.ghost = ghost;
+ if (this.ghost){
+ if (typeof this.node_image !== 'undefined'){
+ this.node_image.opacity = 0.3;
+ }
+ this.circle.opacity = 0.3;
+ this.title.css('opacity', 0.3);
+ this.minimap_circle.opacity = 0.3;
+ } else {
+ this.hidden = false;
+ this.redraw();
+ }
+
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return ((ed.get("to") === _this.model) || (ed.get("from") === _this.model));
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge);
+ 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") {
+ repr.show(_this.ghost);
+ }
+ }
+ );
+ },
+ hideNeighbors: function(){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.ghost) {
+ repr.hide();
+ }
+ }
+ );
+ },
+ showNeighbors: function(ghost){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.hidden) {
+ repr.show(ghost);
+ if (!ghost){
+ var indexNode = _this.renderer.hiddenNodes.indexOf(repr.model.id);
+ if (indexNode !== -1){
+ _this.renderer.hiddenNodes.splice(indexNode, 1);
+ }
+ }
+ }
+ }
+ );
+ },
highlight: function(textToReplace) {
var hlvalue = textToReplace || true;
if (this.highlighted === hlvalue) {
@@ -3366,10 +3488,19 @@
if (this.renderer.is_dragging && this.renderer.isEditable()) {
this.saveCoords();
} else {
- if (!_isTouch && !this.model.get("delete_scheduled")) {
- this.openEditor();
+ if (this.hidden) {
+ var index = this.renderer.hiddenNodes.indexOf(this.model.id);
+ if (index !== -1){
+ this.renderer.hiddenNodes.splice(index, 1);
+ }
+ this.show(false);
+ this.select();
+ } else {
+ if (!_isTouch && !this.model.get("delete_scheduled")) {
+ this.openEditor();
+ }
+ this.model.trigger("clicked");
}
- this.model.trigger("clicked");
}
this.renderer.click_target = null;
this.renderer.is_dragging = false;
@@ -3410,6 +3541,8 @@
_init: function() {
this.renderer.edge_layer.activate();
this.type = "Edge";
+ this.hidden = false;
+ this.ghost = false;
this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from"));
this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to"));
this.bundle = this.renderer.addToBundles(this);
@@ -3469,12 +3602,15 @@
redraw: function() {
var from = this.model.get("from"),
to = this.model.get("to");
- if (!from || !to) {
+ if (!from || !to || (this.hidden && !this.ghost)) {
return;
}
this.from_representation = this.renderer.getRepresentationByModel(from);
this.to_representation = this.renderer.getRepresentationByModel(to);
- if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined") {
+ if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined" ||
+ (this.from_representation.hidden && !this.from_representation.ghost) ||
+ (this.to_representation.hidden && !this.to_representation.ghost)) {
+ this.hide();
return;
}
var _strokeWidth = this._getStrokeWidth(),
@@ -3526,7 +3662,7 @@
this.line.strokeWidth = _strokeWidth;
this.line.strokeColor = _color;
this.line.dashArray = _dash;
- this.line.opacity = opacity;
+ this.line.opacity = this.ghost ? 0.3 : opacity;
this.line.segments[0].point = _p0a;
this.line.segments[1].point = this.paper_coords;
this.line.segments[1].handleIn = _handle.multiply(-1);
@@ -3535,7 +3671,7 @@
this.arrow.scale(_arrow_scale / this.arrow_scale);
this.arrow_scale = _arrow_scale;
this.arrow.fillColor = _color;
- this.arrow.opacity = array_opacity;
+ this.arrow.opacity = this.ghost ? 0.3 : array_opacity; //TODO: magic constant + var name
this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);
this.arrow.position = this.paper_coords;
@@ -3558,7 +3694,7 @@
transform: "rotate(" + _a + "deg)",
"-moz-transform": "rotate(" + _a + "deg)",
"-webkit-transform": "rotate(" + _a + "deg)",
- opacity: opacity
+ opacity: this.ghost ? 0.3 : opacity
});
this.text_angle = _a;
@@ -3573,6 +3709,36 @@
this.minimap_line.segments[1].point = this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position")));
}
},
+ hide: function(){
+ this.hidden = true;
+ this.ghost = false;
+
+ this.text.hide();
+ this.line.visible = false;
+ this.arrow.visible = false;
+ this.minimap_line.visible = false;
+ },
+ show: function(ghost){
+ this.ghost = ghost;
+ if (this.ghost) {
+ this.text.css('opacity', 0.3);
+ this.line.opacity = 0.3;
+ this.arrow.opacity = 0.3;
+ this.minimap_line.opacity = 0.3;
+ } else {
+ this.hidden = false;
+
+ this.text.css('opacity', 1);
+ this.line.opacity = 1;
+ this.arrow.opacity = 1;
+ this.minimap_line.opacity = 1;
+ }
+ this.text.show();
+ this.line.visible = true;
+ this.arrow.visible = true;
+ this.minimap_line.visible = true;
+ this.redraw();
+ },
openEditor: function() {
this.renderer.removeRepresentationsOfType("editor");
var _editor = this.renderer.addRepresentation("EdgeEditor",null);
@@ -3812,6 +3978,8 @@
_init: function() {
BaseEditor.prototype._init.apply(this);
this.template = this.options.templates['templates/nodeeditor.html'];
+ //this.templates['default']= this.options.templates['templates/nodeeditor.html'];
+ //fusionner avec this.options.node_editor_templates
this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];
},
draw: function() {
@@ -4038,8 +4206,10 @@
});
},
redraw: function() {
- var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
+ if (this.options.popup_editor){
+ var _coords = this.source_representation.paper_coords;
+ Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
+ }
this.editor_$.show();
paper.view.draw();
}
@@ -4230,8 +4400,10 @@
}
},
redraw: function() {
- var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
+ if (this.options.popup_editor){
+ var _coords = this.source_representation.paper_coords;
+ Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
+ }
this.editor_$.show();
paper.view.draw();
}
@@ -4310,8 +4482,8 @@
_init: function() {
this.type = "Node-edit-button";
this.lastSectorInner = 0;
- this.startAngle = -135;
- this.endAngle = -45;
+ this.startAngle = -125;
+ this.endAngle = -55;
this.imageName = "edit";
this.text = "Edit";
},
@@ -4343,8 +4515,8 @@
_init: function() {
this.type = "Node-remove-button";
this.lastSectorInner = 0;
- this.startAngle = 0;
- this.endAngle = 90;
+ this.startAngle = -10;
+ this.endAngle = 45;
this.imageName = "remove";
this.text = "Remove";
},
@@ -4376,6 +4548,78 @@
});
+define('renderer/nodehidebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+
+
+ var Utils = requtils.getUtils();
+
+ /* NodeRemoveButton Begin */
+
+ //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);
+ var NodeHideButton = Utils.inherit(NodeButton);
+
+ _(NodeHideButton.prototype).extend({
+ _init: function() {
+ this.type = "Node-hide-button";
+ this.lastSectorInner = 0;
+ this.startAngle = 45;
+ this.endAngle = 90;
+ this.imageName = "hide";
+ this.text = "Hide";
+ },
+ mouseup: function() {
+ this.renderer.click_target = null;
+ this.renderer.is_dragging = false;
+ this.renderer.removeRepresentationsOfType("editor");
+ if (this.renderer.isEditable()) {
+ this.renderer.addHiddenNode(this.source_representation.model);
+ }
+ }
+ }).value();
+
+ /* NodeRemoveButton End */
+
+ return NodeHideButton;
+
+});
+
+
+define('renderer/nodeshowbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+
+
+ var Utils = requtils.getUtils();
+
+ /* NodeRemoveButton Begin */
+
+ //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);
+ var NodeShowButton = Utils.inherit(NodeButton);
+
+ _(NodeShowButton.prototype).extend({
+ _init: function() {
+ this.type = "Node-show-button";
+ this.lastSectorInner = 0;
+ this.startAngle = 90;
+ this.endAngle = 135;
+ this.imageName = "show";
+ this.text = "Show";
+ },
+ mouseup: function() {
+ this.renderer.click_target = null;
+ this.renderer.is_dragging = false;
+ this.renderer.removeRepresentationsOfType("editor");
+ if (this.renderer.isEditable()) {
+ this.source_representation.showNeighbors(false);
+ }
+ }
+ }).value();
+
+ /* NodeShowButton End */
+
+ return NodeShowButton;
+
+});
+
+
define('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
@@ -4425,8 +4669,8 @@
_init: function() {
this.type = "Node-link-button";
this.lastSectorInner = 0;
- this.startAngle = 90;
- this.endAngle = 180;
+ this.startAngle = 135;
+ this.endAngle = 190;
this.imageName = "link";
this.text = "Link to another node";
},
@@ -4466,8 +4710,8 @@
_init: function() {
this.type = "Node-enlarge-button";
this.lastSectorInner = 0;
- this.startAngle = -45;
- this.endAngle = 0;
+ this.startAngle = -55;
+ this.endAngle = -10;
this.imageName = "enlarge";
this.text = "Enlarge";
},
@@ -4501,8 +4745,8 @@
_init: function() {
this.type = "Node-shrink-button";
this.lastSectorInner = 0;
- this.startAngle = -180;
- this.endAngle = -135;
+ this.startAngle = -170;
+ this.endAngle = -125;
this.imageName = "shrink";
this.text = "Shrink";
},
@@ -4669,13 +4913,18 @@
this.onStatusChange();
this.canvas_$ = this.$.find(".Rk-Canvas");
this.labels_$ = this.$.find(".Rk-Labels");
- this.editor_$ = this.$.find(".Rk-Editor");
+ if (!_renkan.options.popup_editor){
+ this.editor_$ = $("#" + _renkan.options.editor_panel);
+ }else{
+ this.editor_$ = this.$.find(".Rk-Editor");
+ }
this.notif_$ = this.$.find(".Rk-Notifications");
paper.setup(this.canvas_$[0]);
this.scale = 1;
this.initialScale = 1;
this.offset = paper.view.center;
this.totalScroll = 0;
+ this.hiddenNodes = [];
this.mouse_down = false;
this.click_target = null;
this.selected_target = null;
@@ -4733,7 +4982,7 @@
this.image_cache = {};
this.icon_cache = {};
- ['edit', 'remove', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {
+ ['edit', 'remove', 'hide', 'show', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {
var img = new Image();
img.src = _renkan.options.static_url + 'img/' + imgname + '.png';
_this.icon_cache[imgname] = img;
@@ -4889,13 +5138,25 @@
bindClick(".Rk-ZoomFit", "autoScale");
this.$.find(".Rk-ZoomSave").click( function() {
// Save scale and offset point
- _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset } );
+ _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset, hidden_nodes: _this.hiddenNodes } );
});
this.$.find(".Rk-ZoomSetSaved").click( function() {
var view = _this.renkan.project.get("views").last();
if(view){
_this.setScale(view.get("zoom_level"), new paper.Point(view.get("offset")));
- }
+ _this.hiddenNodes = view.get("hidden_nodes") || [];
+ _this.hideNodes();
+ }
+ });
+ this.$.find(".Rk-ShowHiddenNodes").mouseenter( function() {
+ _this.showNodes(true);
+ _this.$.find(".Rk-ShowHiddenNodes").mouseleave( function() {
+ _this.hideNodes(false);
+ });
+ });
+ this.$.find(".Rk-ShowHiddenNodes").click( function() {
+ _this.showNodes(false);
+ _this.$.find(".Rk-ShowHiddenNodes").off( "mouseleave" );
});
if(this.renkan.project.get("views").length > 0 && this.renkan.options.save_view){
this.$.find(".Rk-ZoomSetSaved").show();
@@ -5484,6 +5745,7 @@
});
},
redraw: function() {
+ var _this = this;
if(! this.redrawActive ) {
return;
}
@@ -5502,6 +5764,38 @@
_tmpEdge.redraw();
this.click_target = _tmpEdge;
},
+ addHiddenNode: function(_model){
+ this.hideNode(_model);
+ this.hiddenNodes.push(_model.id);
+ },
+ hideNode: function(_model){
+ var _this = this;
+ if (typeof _this.getRepresentationByModel(_model) !== 'undefined'){
+ _this.getRepresentationByModel(_model).hide();
+ }
+ },
+ hideNodes: function(){
+ var _this = this;
+ this.hiddenNodes.forEach(function(_id, index){
+ var node = _this.renkan.project.get("nodes").get(_id);
+ if (typeof node !== 'undefined'){
+ return _this.hideNode(_this.renkan.project.get("nodes").get(_id));
+ }else{
+ _this.hiddenNodes.splice(index, 1);
+ }
+ });
+ paper.view.draw();
+ },
+ showNodes: function(ghost){
+ var _this = this;
+ this.hiddenNodes.forEach(function(_id){
+ _this.getRepresentationByModel(_this.renkan.project.get("nodes").get(_id)).show(ghost);
+ });
+ if (!ghost){
+ this.hiddenNodes = [];
+ }
+ paper.view.draw();
+ },
findTarget: function(_hitResult) {
if (_hitResult && typeof _hitResult.item.__representation !== "undefined") {
var _newTarget = _hitResult.item.__representation;
@@ -5632,15 +5926,21 @@
}
},
onDoubleClick: function(_event) {
- if (!this.isEditable()) {
- return;
- }
var _off = this.canvas_$.offset(),
_point = new paper.Point([
_event.pageX - _off.left,
_event.pageY - _off.top
]);
var _hitResult = paper.project.hitTest(_point);
+
+ if (!this.isEditable()) {
+ if (_hitResult && typeof _hitResult.item.__representation !== "undefined") {
+ if (_hitResult.item.__representation.model.get('uri')){
+ window.open(_hitResult.item.__representation.model.get('uri'), '_blank');
+ }
+ }
+ return;
+ }
if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === "undefined")) {
var _coords = this.toModelCoords(_point),
_data = {
@@ -5965,6 +6265,8 @@
'renderer/nodebutton',
'renderer/nodeeditbutton',
'renderer/noderemovebutton',
+ 'renderer/nodehidebutton',
+ 'renderer/nodeshowbutton',
'renderer/noderevertbutton',
'renderer/nodelinkbutton',
'renderer/nodeenlargebutton',
@@ -5974,7 +6276,7 @@
'renderer/edgerevertbutton',
'renderer/miniframe',
'renderer/scene'
- ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){
+ ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){
@@ -5996,6 +6298,8 @@
Renderer._NodeButton = NodeButton;
Renderer.NodeEditButton = NodeEditButton;
Renderer.NodeRemoveButton = NodeRemoveButton;
+ Renderer.NodeHideButton = NodeHideButton;
+ Renderer.NodeShowButton = NodeShowButton;
Renderer.NodeRevertButton = NodeRevertButton;
Renderer.NodeLinkButton = NodeLinkButton;
Renderer.NodeEnlargeButton = NodeEnlargeButton;
--- a/server/php/basic/public_html/static/lib/renkan/js/renkan.min.js Wed Jun 03 19:16:58 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/js/renkan.min.js Thu Jun 04 10:04:01 2015 +0200
@@ -27,9 +27,9 @@
/*! renkan - v0.9.1 - Copyright © IRI 2015 */
-this.renkanJST=this.renkanJST||{},this.renkanJST["templates/colorpicker.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li data-color="'+(null==(__t=c)?"":__t)+'" style="background: '+(null==(__t=c)?"":__t)+'"></li>';return __p},this.renkanJST["templates/edgeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Edge"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(edge.title)+'" />\n</p>\n',options.show_edge_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(edge.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(edge.uri)+'" target="_blank"></a>\n </p>\n ',options.properties.length&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose from vocabulary:"))+'</label>\n <select class="Rk-Edit-Vocabulary">\n ',_.each(options.properties,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Class" value="">\n '+__e(renkan.translate(a.label))+"\n </option>\n ",_.each(a.properties,function(b){var c=a["base-uri"]+b.uri;__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(c)+'"\n ',c===edge.uri&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(b.label))+"\n </option>\n "}),__p+="\n "}),__p+="\n </select>\n </p>\n")),__p+="\n",options.show_edge_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_edge_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Edge color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: <%-edge.color%>;">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_edge_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(edge.dash)+" />\n </div>\n "),__p+="\n ",options.show_edge_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(edge.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n ",options.show_edge_editor_style_arrow&&(__p+='\n <div id="Rk-Editor-p-arrow">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Arrow:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Arrow" class="Rk-Edit-Arrow" '+__e(edge.arrow)+" />\n </div>\n "),__p+="\n </div>\n"),__p+="\n",options.show_edge_editor_direction&&(__p+='\n <p>\n <span class="Rk-Edit-Direction">'+__e(renkan.translate("Change edge direction"))+"</span>\n </p>\n"),__p+="\n",options.show_edge_editor_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_editor_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: <%-edge.created_by_color%>;"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/edgeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_edge_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(edge.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',edge.uri&&(__p+='\n <a href="'+__e(edge.uri)+'" target="_blank">\n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" </a> "),__p+="\n </span>\n</h2>\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(edge.uri)+'" target="_blank">'+__e(edge.short_uri)+"</a>\n </p>\n"),__p+="\n<p>"+__e(edge.description)+"</p>\n",options.show_edge_tooltip_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.to_color)+';"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_tooltip_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.created_by_color)+';"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/ldtjson-bin/annotationtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/segmenttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/tagtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/ldt-tag.png"))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/search/?search="+(null==(__t=encodedtitle)?"":__t)+'&field=all"\n data-title="'+__e(title)+'" data-description="Tag \''+__e(title)+'\'">\n\n <img class="Rk-Ldt-Tag-Icon" src="'+__e(static_url)+'img/ldt-tag.png" />\n <h4>'+(null==(__t=htitle)?"":__t)+'</h4>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/list-bin.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="'+__e(title)+'"\n data-description="'+__e(description)+'"\n ',__p+=image?'\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n ':'\n data-image=""\n ',__p+="\n>",image&&(__p+='\n <img class="Rk-ResourceList-Image" src="'+__e(image)+'" />\n'),__p+='\n<h4 class="Rk-ResourceList-Title">\n ',url&&(__p+='\n <a href="'+__e(url)+'" target="_blank">\n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+="</a>"),__p+="\n </h4>\n ",description&&(__p+='\n <p class="Rk-ResourceList-Description">'+(null==(__t=hdescription)?"":__t)+"</p>\n "),__p+="\n ",image&&(__p+='\n <div style="clear: both;"></div>\n '),__p+="\n</li>\n";return __p},this.renkanJST["templates/main.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)options.show_bins&&(__p+='\n <div class="Rk-Bins">\n <div class="Rk-Bins-Head">\n <h2 class="Rk-Bins-Title">'+__e(translate("Select contents:"))+'</h2>\n <form class="Rk-Web-Search-Form Rk-Search-Form">\n <input class="Rk-Web-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search the Web"))+'" />\n <div class="Rk-Search-Select">\n <div class="Rk-Search-Current"></div>\n <ul class="Rk-Search-List"></ul>\n </div>\n <input type="submit" value=""\n class="Rk-Web-Search-Submit Rk-Search-Submit" title="'+__e(translate("Search the Web"))+'" />\n </form>\n <form class="Rk-Bins-Search-Form Rk-Search-Form">\n <input class="Rk-Bins-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search in Bins"))+'" /> <input\n type="submit" value=""\n class="Rk-Bins-Search-Submit Rk-Search-Submit"\n title="'+__e(translate("Search in Bins"))+'" />\n </form>\n </div>\n <ul class="Rk-Bin-List"></ul>\n </div>\n'),__p+=" ",options.show_editor&&(__p+='\n <div class="Rk-Render Rk-Render-',__p+=options.show_bins?"Panel":"Full",__p+='"></div>\n'),__p+="\n";return __p},this.renkanJST["templates/nodeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='\n<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Node"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n</p>\n',options.show_node_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(node.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(node.uri)+'" target="_blank"></a>\n </p>\n'),__p+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+'</label>\n <textarea class="Rk-Edit-Description">'+__e(node.description)+"</textarea>\n </p>\n"),__p+=" ",options.show_node_editor_size&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Size:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Size-Value">'+__e(node.size)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Up">+</a>\n </p>\n'),__p+=" ",options.show_node_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_node_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">\n '+__e(renkan.translate("Node color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: '+__e(node.color)+';">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_node_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(node.dash)+" />\n </div>\n "),__p+="\n ",options.show_node_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(node.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n </div>\n"),__p+=" ",options.show_node_editor_image&&(__p+='\n <div class="Rk-Edit-ImgWrap">\n <div class="Rk-Edit-ImgPreview">\n <img src="'+__e(node.image||node.image_placeholder)+'" />\n ',node.clip_path&&(__p+='\n <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n <path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="'+__e(node.clip_path)+'" />\n </svg>\n '),__p+="\n </div>\n </div>\n <p>\n <label>"+__e(renkan.translate("Image URL:"))+'</label>\n <div>\n <a class="Rk-Edit-Image-Del" href="#"></a>\n <input class="Rk-Edit-Image" type="text" value=\''+__e(node.image)+"' />\n </div>\n </p>\n",options.allow_image_upload&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose Image File:"))+'</label>\n <input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n </p>\n')),__p+=" ",options.show_node_editor_creator&&node.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+=" ",options.change_shapes&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Shapes available"))+':</label>\n <select class="Rk-Edit-Shape">\n ',_.each(shapes,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.shape===a&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(a.charAt(0).toUpperCase()+a.substring(1)))+"\n </option>\n "}),__p+="\n </select>\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/nodeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_node_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(node.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',node.uri&&(__p+='\n <a href="'+__e(node.uri)+'" target="_blank">\n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+="</a>"),__p+="\n </span>\n</h2>\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(node.uri)+'" target="_blank">'+__e(node.short_uri)+"</a>\n </p>\n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n <p class="Rk-Display-Description">'+__e(node.description)+"</p>\n"),__p+=" ",node.image&&options.show_node_tooltip_image&&(__p+='\n <img class="Rk-Display-ImgPreview" src="'+__e(node.image)+'" />\n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/scene.html"]=function(obj){function print(){__p+=__j.call(arguments,"")}obj||(obj={});var __p="",__e=_.escape,__j=Array.prototype.join;with(obj)options.show_top_bar&&(__p+='\n <div class="Rk-TopBar">\n <div class="loader"></div>\n ',__p+=options.editor_mode?'\n <input type="text" class="Rk-PadTitle" value="'+__e(project.get("title")||"")+'" placeholder="'+__e(translate("Untitled project"))+'" />\n ':'\n <h2 class="Rk-PadTitle">\n '+__e(project.get("title")||translate("Untitled project"))+"\n </h2>\n ",__p+="\n ",options.show_user_list&&(__p+='\n <div class="Rk-Users">\n <div class="Rk-CurrentUser">\n ',options.show_user_color&&(__p+='\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-CurrentUser-Color">\n ',options.user_color_editable&&(__p+='\n <span class="Rk-Edit-ColorTip"></span>\n '),__p+="\n </span>\n ",options.user_color_editable&&print(colorPicker),__p+="\n </div>\n "),__p+='\n <span class="Rk-CurrentUser-Name"><unknown user></span>\n </div>\n <ul class="Rk-UserList"></ul>\n </div>\n '),__p+="\n ",options.home_button_url&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Home-Button" href="'+__e(options.home_button_url)+'">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate(options.home_button_title))+"\n </div>\n </div>\n </a>\n "),__p+="\n ",options.show_fullscreen_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-FullScreen-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Full Screen"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.editor_mode?(__p+="\n ",options.show_addnode_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddNode-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Node"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_addedge_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddEdge-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Edge"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_save_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Save-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents"></div>\n </div>\n </div>\n '),__p+="\n ",options.show_open_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Open-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Open Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_bookmarklet&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Renkan 'Drag-to-Add' bookmarklet"))+'\n </div>\n </div>\n </a>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "):(__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+'\n </div>\n </div>\n </div>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "),__p+="\n ",options.show_search_field&&(__p+='\n <form action="#" class="Rk-GraphSearch-Form">\n <input type="search" class="Rk-GraphSearch-Field" placeholder="'+__e(translate("Search in graph"))+'" />\n </form>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n </div>\n"),__p+='\n<div class="Rk-Editing-Space',options.show_top_bar||(__p+=" Rk-Editing-Space-Full"),__p+='">\n <div class="Rk-Labels"></div>\n <canvas class="Rk-Canvas" ',options.resize&&(__p+=' resize="" '),__p+='></canvas>\n <div class="Rk-Notifications"></div>\n <div class="Rk-Editor">\n ',options.show_bins&&(__p+='\n <div class="Rk-Fold-Bins">«</div>\n '),__p+="\n ",options.show_zoom&&(__p+='\n <div class="Rk-ZoomButtons">\n <div class="Rk-ZoomIn" title="'+__e(translate("Zoom In"))+'"></div>\n <div class="Rk-ZoomFit" title="'+__e(translate("Zoom Fit"))+'"></div>\n <div class="Rk-ZoomOut" title="'+__e(translate("Zoom Out"))+'"></div>\n ',options.editor_mode&&options.save_view&&(__p+='\n <div class="Rk-ZoomSave" title="'+__e(translate("Zoom Save"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved zoom"))+'"></div>\n '),__p+="\n </div>\n "),__p+="\n </div>\n</div>\n";return __p},this.renkanJST["templates/search.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li class="'+(null==(__t=className)?"":__t)+'" data-key="'+(null==(__t=key)?"":__t)+'">'+(null==(__t=title)?"":__t)+"</li>";return __p},this.renkanJST["templates/wikipedia-bin/resulttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="Wikipedia: '+__e(title)+'"\n data-description="'+__e(description)+'"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/wikipedia.png"))+'">\n\n <img class="Rk-Wikipedia-Icon" src="'+__e(static_url)+'img/wikipedia.png">\n <h4 class="Rk-Wikipedia-Title">\n <a href="'+__e(url)+'" target="_blank">'+(null==(__t=htitle)?"":__t)+'</a>\n </h4>\n <p class="Rk-Wikipedia-Snippet">'+(null==(__t=hdescription)?"":__t)+"</p>\n</li>\n";return __p},function(a){"use strict";"object"!=typeof a.Rkns&&(a.Rkns={});var b=a.Rkns,c=b.$=a.jQuery,d=b._=a._;b.pickerColors=["#8f1919","#a80000","#d82626","#ff0000","#e87c7c","#ff6565","#f7d3d3","#fecccc","#8f5419","#a85400","#d87f26","#ff7f00","#e8b27c","#ffb265","#f7e5d3","#fee5cc","#8f8f19","#a8a800","#d8d826","#feff00","#e8e87c","#feff65","#f7f7d3","#fefecc","#198f19","#00a800","#26d826","#00ff00","#7ce87c","#65ff65","#d3f7d3","#ccfecc","#198f8f","#00a8a8","#26d8d8","#00feff","#7ce8e8","#65feff","#d3f7f7","#ccfefe","#19198f","#0000a8","#2626d8","#0000ff","#7c7ce8","#6565ff","#d3d3f7","#ccccfe","#8f198f","#a800a8","#d826d8","#ff00fe","#e87ce8","#ff65fe","#f7d3f7","#feccfe","#000000","#242424","#484848","#6d6d6d","#919191","#b6b6b6","#dadada","#ffffff"],b.__renkans=[];var e=b._BaseBin=function(a,c){if("undefined"!=typeof a){this.renkan=a,this.renkan.$.find(".Rk-Bin-Main").hide(),this.$=b.$("<li>").addClass("Rk-Bin").appendTo(a.$.find(".Rk-Bin-List")),this.title_icon_$=b.$("<span>").addClass("Rk-Bin-Title-Icon").appendTo(this.$);var d=this;b.$("<a>").attr({href:"#",title:a.translate("Close bin")}).addClass("Rk-Bin-Close").html("×").appendTo(this.$).click(function(){return d.destroy(),a.$.find(".Rk-Bin-Main:visible").length||a.$.find(".Rk-Bin-Main:last").slideDown(),a.resizeBins(),!1}),b.$("<a>").attr({href:"#",title:a.translate("Refresh bin")}).addClass("Rk-Bin-Refresh").appendTo(this.$).click(function(){return d.refresh(),!1}),this.count_$=b.$("<div>").addClass("Rk-Bin-Count").appendTo(this.$),this.title_$=b.$("<h2>").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("<div>").addClass("Rk-Bin-Main").appendTo(this.$).html('<h4 class="Rk-Bin-Loading">'+a.translate("Loading, please wait")+"</h4>"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return'<ul class="Rk-Edit-ColorPicker">'+b.pickerColors.map(function(b){return a({c:b})}).join("")+"</ul>"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageX<c.left+d&&b.pageY>=c.top&&b.pageY<c.top+f)if(j)e.renderer.onMouseMove(b,!0);else{j=!0;var g=document.createElement("div");g.appendChild(this.cloneNode(!0)),e.renderer.dropData({"text/html":g.innerHTML},b),e.renderer.onMouseDown(b,!0)}}).on("touchend",".Rk-Bin-Item",function(a){j&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),j=!1}).on("dragstart",".Rk-Bin-Item",function(a){var b=document.createElement("div");b.appendChild(this.cloneNode(!0));try{a.originalEvent.dataTransfer.setData("text/html",b.innerHTML)}catch(c){a.originalEvent.dataTransfer.setData("text",b.innerHTML)}}),b.$(window).resize(function(){e.resizeBins()});var k=!1,l="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==l){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==k&&(k=c.source,d.each(e.tabs,function(a){a.render(c)}))}}),this.$.find(".Rk-Bins-Search-Form").submit(function(){return!1})};f.prototype.translate=function(a){return b.i18n[this.options.language]&&b.i18n[this.options.language][a]?b.i18n[this.options.language][a]:this.options.language.length>2&&b.i18n[this.options.language.substr(0,2)]&&b.i18n[this.options.language.substr(0,2)][a]?b.i18n[this.options.language.substr(0,2)][a]:a},f.prototype.onStatusChange=function(){this.renderer.onStatusChange()},f.prototype.setSearchEngine=function(a){this.search_engine=this.search_engines[a],this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current "+this.search_engine.getBgClass());for(var b=this.search_engine.getBgClass().split(" "),c="",d=0;d<b.length;d++)c+="."+b[d];this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder",this.translate("Search in ")+this.$.find(".Rk-Search-List "+c).html())},f.prototype.resizeBins=function(){var a=+this.$.find(".Rk-Bins-Head").outerHeight();this.$.find(".Rk-Bin-Title:visible").each(function(){a+=b.$(this).outerHeight()
-}),this.$.find(".Rk-Bin-Main").css({height:this.$.find(".Rk-Bins").height()-a})};var g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})};b.Utils={getUUID4:g,getUID:function(){function a(a){return 10>a?"0"+a:a}var b=new Date,c=0,d=b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1)+"-"+a(b.getUTCDate())+"-"+g();return function(a){for(var b=(++c).toString(16),e="undefined"==typeof a?"":a+"-";b.length<4;)b="0"+b;return e+d+"-"+b}}(),getFullURL:function(a){if("undefined"==typeof a||null==a)return"";if(/https?:\/\//.test(a))return a;var b=new Image;b.src=a;var c=b.src;return b.src=null,c},inherit:function(a,b){var c=function(){"function"==typeof b&&b.apply(this,Array.prototype.slice.call(arguments,0)),a.apply(this,Array.prototype.slice.call(arguments,0)),"function"!=typeof this._init||this._initialized||(this._init.apply(this,Array.prototype.slice.call(arguments,0)),this._initialized=!0)};return d.extend(c.prototype,a.prototype),c},regexpFromTextOrArray:function(){function a(a){function b(a){return function(b,c){a=a.replace(h[b],c)}}for(var e=a.toLowerCase().replace(g,""),i="",j=0;j<e.length;j++){j&&(i+=f+"*");var k=e[j];d.each(c,b(k)),i+=k}return i}function b(c){switch(typeof c){case"string":return a(c);case"object":var e="";return d.each(c,function(a){var c=b(a);c&&(e&&(e+="|"),e+=c)}),e}return""}var c=["[aáàâä]","[cç]","[eéèêë]","[iíìîï]","[oóòôö]","[uùûü]"],e=[String.fromCharCode(768),String.fromCharCode(769),String.fromCharCode(770),String.fromCharCode(771),String.fromCharCode(807),"{","}","(",")","[","]","【","】","、","・","‥","。","「","」","『","』","〜",":","!","?"," ",","," ",";","(",")",".","*","+","\\","?","|","{","}","[","]","^","#","/"],f="[\\"+e.join("\\")+"]",g=new RegExp(f,"gm"),h=d.map(c,function(a){return new RegExp(a)});return function(a){var c=b(a);if(c){var d=new RegExp(c,"im"),e=new RegExp("("+c+")","igm");return{isempty:!1,source:c,test:function(a){return d.test(a)},replace:function(a,b){return a.replace(e,b)}}}return{isempty:!0,source:"",test:function(){return!0},replace:function(){return text}}}}(),_MIN_DRAG_DISTANCE:2,_NODE_BUTTON_WIDTH:40,_EDGE_BUTTON_INNER:2,_EDGE_BUTTON_OUTER:40,_CLICKMODE_ADDNODE:1,_CLICKMODE_STARTEDGE:2,_CLICKMODE_ENDEDGE:3,_NODE_SIZE_STEP:Math.LN2/4,_MIN_SCALE:.05,_MAX_SCALE:20,_MOUSEMOVE_RATE:80,_DOUBLETAP_DELAY:800,_DOUBLETAP_DISTANCE:400,_USER_PLACEHOLDER:function(a){return{color:a.options.default_user_color,title:a.translate("(unknown user)"),get:function(a){return this[a]||!1}}},_BOOKMARKLET_CODE:function(a){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;\">"+a.translate("Drag items from this website, drop them in Renkan").replace(/ /g,"_")+"</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);})();"},shortenText:function(a,b){return a.length>b?a.substr(0,b)+"…":a},drawEditBox:function(a,b,c,d,e){e.css({width:a.tooltip_width-2*a.tooltip_padding});var f=e.outerHeight()+2*a.tooltip_padding,g=b.x<paper.view.center.x?1:-1,h=b.x+g*(d+a.tooltip_arrow_length),i=b.x+g*(d+a.tooltip_arrow_length+a.tooltip_width),j=b.y-f/2;j+f>paper.view.size.height-a.tooltip_margin&&(j=Math.max(paper.view.size.height-a.tooltip_margin,b.y+a.tooltip_arrow_width/2)-f),j<a.tooltip_margin&&(j=Math.min(a.tooltip_margin,b.y-a.tooltip_arrow_width/2));var k=j+f;return c.segments[0].point=c.segments[7].point=b.add([g*d,0]),c.segments[1].point.x=c.segments[2].point.x=c.segments[5].point.x=c.segments[6].point.x=h,c.segments[3].point.x=c.segments[4].point.x=i,c.segments[2].point.y=c.segments[3].point.y=j,c.segments[4].point.y=c.segments[5].point.y=k,c.segments[1].point.y=b.y-a.tooltip_arrow_width/2,c.segments[6].point.y=b.y+a.tooltip_arrow_width/2,c.closed=!0,c.fillColor=new paper.GradientColor(new paper.Gradient([a.tooltip_top_color,a.tooltip_bottom_color]),[0,j],[0,k]),e.css({left:a.tooltip_padding+Math.min(h,i),top:a.tooltip_padding+j}),c},increaseBrightness:function(a,b){a=a.replace(/^\s*#|\s*$/g,""),3===a.length&&(a=a.replace(/(.)/g,"$1$1"));var c=parseInt(a.substr(0,2),16),d=parseInt(a.substr(2,2),16),e=parseInt(a.substr(4,2),16);return"#"+(0|256+c+(256-c)*b/100).toString(16).substr(1)+(0|256+d+(256-d)*b/100).toString(16).substr(1)+(0|256+e+(256-e)*b/100).toString(16).substr(1)}}}(window),function(a){"use strict";var b=a.Rkns.DataLoader={converters:{from1to2:function(a){var b,c;if("undefined"!=typeof a.nodes)for(b=0,c=a.nodes.length;c>b;b++){var d=a.nodes[b];d.color?(console.log("node color : ",d.color),d.style={color:d.color}):d.style={}}if("undefined"!=typeof a.edges)for(b=0,c=a.edges.length;c>b;b++){var e=a.edges[b];e.style=e.color?{color:e.color}:{}}return a.schema_version="2",a}}};b.Loader=function(a,c){this.project=a,this.dataConverters=_.defaults(c.converters||{},b.converters)},b.Loader.prototype.convert=function(a){var b=this.project.getSchemaVersion(a),c=this.project.getSchemaVersion();if(b!==c){var d="from"+b+"to"+c;"function"==typeof this.dataConverters[d]&&(console.log("Apply conversion function :",d),a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){console.log(a),this.project.set(this.convert(a),{validate:!0})}}(window),function(a){"use strict";var b=a.Backbone,c=a.Rkns.Models={};c.getUID=function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)});return"undefined"!=typeof a?a.type+"-"+b:b};{var d=b.RelationalModel.extend({idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"",a.description=a.description||"",a.uri=a.uri||"","function"==typeof this.prepare&&(a=this.prepare(a))),b.RelationalModel.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},addReference:function(a,b,c,d,e){var f=c.get(d);a[b]="undefined"==typeof f&&"undefined"!=typeof e?e:f}}),e=c.User=d.extend({type:"user",prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color")}}}),f=c.Node=d.extend({type:"node",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),position:this.get("position"),image:this.get("image"),style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,size:this.get("size"),clip_path:this.get("clip_path"),shape:this.get("shape"),type:this.get("type"),hidden:this.get("hidden")}}}),g=c.Edge=d.extend({type:"edge",relations:[{type:b.HasOne,key:"created_by",relatedModel:e},{type:b.HasOne,key:"from",relatedModel:f},{type:b.HasOne,key:"to",relatedModel:f}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),this.addReference(a,"from",b.get("nodes"),a.from),this.addReference(a,"to",b.get("nodes"),a.to),a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),from:this.get("from")?this.get("from").get("_id"):null,to:this.get("to")?this.get("to").get("_id"):null,style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),h=c.View=d.extend({type:"view",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;if(this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"","undefined"!=typeof a.offset){var c={};Array.isArray(a.offset)?(c.x=a.offset[0],c.y=a.offset.length>1?a.offset[1]:a.offset[0]):null!=a.offset.x&&(c.x=a.offset.x,c.y=a.offset.y),a.offset=c}return a},toJSON:function(){return{_id:this.get("_id"),zoom_level:this.get("zoom_level"),offset:this.get("offset"),title:this.get("title"),description:this.get("description"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),i=(c.Project=d.extend({schema_version:"2",type:"project",blacklist:["saveStatus","loadingStatus"],relations:[{type:b.HasMany,key:"users",relatedModel:e,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"nodes",relatedModel:f,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"edges",relatedModel:g,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"views",relatedModel:h,reverseRelation:{key:"project",includeInJSON:"_id"}}],addUser:function(a,b){a.project=this;var c=e.findOrCreate(a);return this.get("users").push(c,b),c},addNode:function(a,b){a.project=this;var c=f.findOrCreate(a);return this.get("nodes").push(c,b),c},addEdge:function(a,b){a.project=this;var c=g.findOrCreate(a);return this.get("edges").push(c,b),c},addView:function(a,b){a.project=this;var c=h.findOrCreate(a);return this.get("views").push(c,b),c},removeNode:function(a){this.get("nodes").remove(a)},removeEdge:function(a){this.get("edges").remove(a)},validate:function(a){var b=this;_.each([].concat(a.users,a.nodes,a.edges,a.views),function(a){a&&(a.project=b)})},getSchemaVersion:function(a){var b=a;"undefined"==typeof b&&(b=this);var c=b.schema_version;return c?c:1},initialize:function(){var a=this;this.on("remove:nodes",function(b){a.get("edges").remove(a.get("edges").filter(function(a){return a.get("from")===b||a.get("to")===b}))})},toJSON:function(){var a=_.clone(this.attributes);for(var c in a)(a[c]instanceof b.Model||a[c]instanceof b.Collection||a[c]instanceof d)&&(a[c]=a[c].toJSON());return _.omit(a,this.blacklist)}}),c.RosterUser=b.Model.extend({type:"roster_user",idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"(untitled "+this.type+")",a.description=a.description||"",a.uri=a.uri||"",a.project=a.project||null,a.site_id=a.site_id||0,"function"==typeof this.prepare&&(a=this.prepare(a))),b.Model.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color"),project:null!=this.get("project")?this.get("project").get("id"):null,site_id:this.get("site_id")}}}));c.UsersList=b.Collection.extend({model:i})}}(window),Rkns.defaults={language:navigator.language||navigator.userLanguage||"en",container:"renkan",search:[],bins:[],static_url:"",show_bins:!0,properties:[],show_editor:!0,read_only:!1,editor_mode:!0,manual_save:!1,show_top_bar:!0,default_user_color:"#303030",size_bug_fix:!0,force_resize:!1,allow_double_click:!0,zoom_on_scroll:!0,element_delete_delay:0,autoscale_padding:50,resize:!0,show_zoom:!0,save_view:!0,default_view:!1,show_search_field:!0,show_user_list:!0,user_name_editable:!0,user_color_editable:!0,show_user_color:!0,show_save_button:!0,show_export_button:!0,show_open_button:!1,show_addnode_button:!0,show_addedge_button:!0,show_bookmarklet:!0,show_fullscreen_button:!0,home_button_url:!1,home_button_title:"Home",show_minimap:!0,minimap_width:160,minimap_height:120,minimap_padding:20,minimap_background_color:"#ffffff",minimap_border_color:"#cccccc",minimap_highlight_color:"#ffff00",minimap_highlight_weight:5,buttons_background:"#202020",buttons_label_color:"#c000c0",buttons_label_font_size:9,default_dash_array:[4,5],show_node_circles:!0,clip_node_images:!0,node_images_fill_mode:!1,node_size_base:25,node_stroke_width:2,node_stroke_max_width:12,selected_node_stroke_width:4,selected_node_stroke_max_width:24,node_stroke_witdh_scale:5,node_fill_color:"#ffffff",highlighted_node_fill_color:"#ffff00",node_label_distance:5,node_label_max_length:60,label_untitled_nodes:"(untitled)",change_shapes:!0,edge_stroke_width:2,edge_stroke_max_width:12,selected_edge_stroke_width:4,selected_edge_stroke_max_width:24,edge_stroke_witdh_scale:5,edge_label_distance:0,edge_label_max_length:20,edge_arrow_length:18,edge_arrow_width:12,edge_arrow_max_width:32,edge_gap_in_bundles:12,label_untitled_edges:"",tooltip_width:275,tooltip_padding:10,tooltip_margin:15,tooltip_arrow_length:20,tooltip_arrow_width:40,tooltip_top_color:"#f0f0f0",tooltip_bottom_color:"#d0d0d0",tooltip_border_color:"#808080",tooltip_border_width:1,show_node_editor_uri:!0,show_node_editor_description:!0,show_node_editor_size:!0,show_node_editor_style:!0,show_node_editor_style_color:!0,show_node_editor_style_dash:!0,show_node_editor_style_thickness:!0,show_node_editor_image:!0,show_node_editor_creator:!0,allow_image_upload:!0,uploaded_image_max_kb:500,show_node_tooltip_uri:!0,show_node_tooltip_description:!0,show_node_tooltip_color:!0,show_node_tooltip_image:!0,show_node_tooltip_creator:!0,show_edge_editor_uri:!0,show_edge_editor_style:!0,show_edge_editor_style_color:!0,show_edge_editor_style_dash:!0,show_edge_editor_style_thickness:!0,show_edge_editor_style_arrow:!0,show_edge_editor_direction:!0,show_edge_editor_nodes:!0,show_edge_editor_creator:!0,show_edge_tooltip_uri:!0,show_edge_tooltip_color:!0,show_edge_tooltip_nodes:!0,show_edge_tooltip_creator:!0},Rkns.i18n={fr:{"Edit Node":"Édition d’un nœud","Edit Edge":"Édition d’un lien","Title:":"Titre :","URI:":"URI :","Description:":"Description :","From:":"De :","To:":"Vers :",Image:"Image","Image URL:":"URL d'Image","Choose Image File:":"Choisir un fichier image","Full Screen":"Mode plein écran","Add Node":"Ajouter un nœud","Add Edge":"Ajouter un lien","Save Project":"Enregistrer le projet","Open Project":"Ouvrir un projet","Auto-save enabled":"Enregistrement automatique activé","Connection lost":"Connexion perdue","Created by:":"Créé par :","Zoom In":"Agrandir l’échelle","Zoom Out":"Rapetisser l’échelle",Edit:"Éditer",Remove:"Supprimer","Cancel deletion":"Annuler la suppression","Link to another node":"Créer un lien",Enlarge:"Agrandir",Shrink:"Rétrécir","Click on the background canvas to add a node":"Cliquer sur le fond du graphe pour rajouter un nœud","Click on a first node to start the edge":"Cliquer sur un premier nœud pour commencer le lien","Click on a second node to complete the edge":"Cliquer sur un second nœud pour terminer le lien",Wikipedia:"Wikipédia","Wikipedia in ":"Wikipédia en ",French:"Français",English:"Anglais",Japanese:"Japonais","Untitled project":"Projet sans titre","Lignes de Temps":"Lignes de Temps","Loading, please wait":"Chargement en cours, merci de patienter","Edge color:":"Couleur :","Dash:":"Point. :","Thickness:":"Epaisseur :","Arrow:":"Flèche :","Node color:":"Couleur :","Choose color":"Choisir une couleur","Change edge direction":"Changer le sens du lien","Do you really wish to remove node ":"Voulez-vous réellement supprimer le nœud ","Do you really wish to remove edge ":"Voulez-vous réellement supprimer le lien ","This file is not an image":"Ce fichier n'est pas une image","Image size must be under ":"L'image doit peser moins de ","Size:":"Taille :",KB:"ko","Choose from vocabulary:":"Choisir dans un vocabulaire :","SKOS Documentation properties":"SKOS: Propriétés documentaires","has note":"a pour note","has example":"a pour exemple","has definition":"a pour définition","SKOS Semantic relations":"SKOS: Relations sémantiques","has broader":"a pour concept plus large","has narrower":"a pour concept plus étroit","has related":"a pour concept apparenté","Dublin Core Metadata":"Métadonnées Dublin Core","has contributor":"a pour contributeur",covers:"couvre","created by":"créé par","has date":"a pour date","published by":"édité par","has source":"a pour source","has subject":"a pour sujet","Dragged resource":"Ressource glisée-déposée","Search the Web":"Rechercher en ligne","Search in Bins":"Rechercher dans les chutiers","Close bin":"Fermer le chutier","Refresh bin":"Rafraîchir le chutier","(untitled)":"(sans titre)","Select contents:":"Sélectionner des contenus :","Drag items from this website, drop them in Renkan":"Glissez des éléments de ce site web vers 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.":"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","Shapes available":"Formes disponibles",Circle:"Cercle",Square:"Carré",Diamond:"Losange",Hexagone:"Hexagone",Ellipse:"Ellipse",Star:"Étoile",Cloud:"Nuage",Triangle:"Triangle","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Zoom Save":"Sauver le Zoom","View saved zoom":"Restaurer le Zoom","Renkan 'Drag-to-Add' bookmarklet":"Renkan 'Deplacer-Pour-Ajouter' Signet","(unknown user)":"(non authentifié)","<unknown user>":"<non authentifié>","Search in graph":"Rechercher dans carte","Search in ":"Chercher dans "}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){a.renderer.redrawActive=!1,c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.redrawActive=!0,a.renderer.fixSize()})},e=function(){c.set({saveStatus:2});var d=c.toJSON();a.read_only||Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(d),success:function(){c.set({saveStatus:0})}})},f=Rkns._.throttle(function(){setTimeout(e,100)},1e3);c.on("add:nodes add:edges add:users add:views",function(a){a.on("change remove",function(){f()}),f()}),c.on("change",function(){1===c.changedAttributes.length&&c.hasChanged("saveStatus")||f()}),d()},Rkns.jsonIOSaveOnClick=function(a,b){var c=a.project,d=!1,e=function(){return"Project not saved"};"undefined"==typeof b.http_method&&(b.http_method="POST");var f=function(){var d={},e=/id=([^&#?=]+)/,f=document.location.hash.match(e);f&&(d.id=f[1]),Rkns.$.ajax({url:b.url,data:d,beforeSend:function(){c.set({loadingStatus:!0})},success:function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.autoScale()}})},g=function(){c.set("saved_at",new Date);var a=c.toJSON();Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(a),beforeSend:function(){c.set({saveStatus:2})},success:function(){$(window).off("beforeunload",e),d=!1,c.set({saveStatus:0})}})},h=function(){c.set({saveStatus:1});var a=c.get("title");a&&c.get("nodes").length?$(".Rk-Save-Button").removeClass("disabled"):$(".Rk-Save-Button").addClass("disabled"),a&&$(".Rk-PadTitle").css("border-color","#333333"),d||(d=!0,$(window).on("beforeunload",e))};f(),c.on("add:nodes add:edges add:users change",function(a){a.on("change remove",function(a){1===a.changedAttributes.length&&a.hasChanged("saveStatus")||h()}),1===c.changedAttributes.length&&c.hasChanged("saveStatus")||h()}),a.renderer.save=function(){$(".Rk-Save-Button").hasClass("disabled")?c.get("title")||$(".Rk-PadTitle").css("border-color","#ff0000"):g()}},function(a){"use strict";var b=a._,c=a.Ldt={},d=(c.Bin=function(a,b){if(b.ldt_type){var d=c[b.ldt_type+"Bin"];if(d)return new d(a,b)}console.error("No such LDT Bin Type")},c.ProjectBin=a.Utils.inherit(a._BaseBin));d.prototype.tagTemplate=renkanJST["templates/ldtjson-bin/tagtemplate.html"],d.prototype.annotationTemplate=renkanJST["templates/ldtjson-bin/annotationtemplate.html"],d.prototype._init=function(a,b){this.renkan=a,this.proj_id=b.project_id,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.title_$.html(b.title),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},d.prototype.render=function(c){function d(a){var c=b(a).escape();return f.isempty?c:f.replace(c,"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}var f=c||a.Utils.regexpFromTextOrArray(),g="<li><h3>Tags</h3></li>",h=this.data.meta["dc:title"],i=this,j=0;i.title_$.text('LDT Project: "'+h+'"'),b.map(i.data.tags,function(a){var b=a.meta["dc:title"];(f.isempty||f.test(b))&&(j++,g+=i.tagTemplate({ldt_platform:i.ldt_platform,title:b,htitle:d(b),encodedtitle:encodeURIComponent(b),static_url:i.renkan.options.static_url}))}),g+="<li><h3>Annotations</h3></li>",b.map(i.data.annotations,function(a){var b=a.content.description,c=a.content.title.replace(b,"");if(f.isempty||f.test(c)||f.test(b)){j++;var h=a.end-a.begin,k=a.content&&a.content.img&&a.content.img.src?a.content.img.src:h?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";g+=i.annotationTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(a.begin),end:e(a.end),duration:e(h),mediaid:a.media,annotationid:a.id,image:k,static_url:i.renkan.options.static_url})}}),this.main_$.html(g),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()},d.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/ldt/cljson/id/"+this.proj_id,dataType:"jsonp",success:function(a){b.data=a,b.render()}})};var e=c.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"};e.prototype.getBgClass=function(){return"Rk-Ldt-Icon"},e.prototype.getSearchTitle=function(){return this.renkan.translate("Lignes de Temps")},e.prototype.search=function(a){this.renkan.tabs.push(new f(this.renkan,{search:a}))};var f=c.ResultsBin=a.Utils.inherit(a._BaseBin);f.prototype.segmentTemplate=renkanJST["templates/ldtjson-bin/segmenttemplate.html"],f.prototype._init=function(a,b){this.renkan=a,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.max_results=b.max_results||50,this.search=b.search,this.title_$.html('Lignes de Temps: "'+b.search+'"'),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},f.prototype.render=function(c){function d(a){return g.replace(b(a).escape(),"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}if(this.data){var f=c||a.Utils.regexpFromTextOrArray(),g=f.isempty?a.Utils.regexpFromTextOrArray(this.search):f,h="",i=this,j=0;b.each(this.data.objects,function(a){var b=a["abstract"],c=a.title;if(f.isempty||f.test(c)||f.test(b)){j++;var g=a.duration,k=a.start_ts,l=+a.duration+k,m=g?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";h+=i.segmentTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(k),end:e(l),duration:e(g),mediaid:a.iri_id,annotationid:a.element_id,image:m})}}),this.main_$.html(h),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()}},f.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/api/ldt/1.0/segments/search/",data:{format:"jsonp",q:this.search,limit:this.max_results},dataType:"jsonp",success:function(a){b.data=a,b.render()}})}}(window.Rkns),Rkns.ResourceList={},Rkns.ResourceList.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.ResourceList.Bin.prototype.resultTemplate=renkanJST["templates/list-bin.html"],Rkns.ResourceList.Bin.prototype._init=function(a,b){this.renkan=a,this.title_$.html(b.title),b.list&&(this.data=b.list),this.refresh()},Rkns.ResourceList.Bin.prototype.render=function(a){function b(a){var b=_(a).escape();return c.isempty?b:c.replace(b,"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d="",e=this,f=0;Rkns._.each(this.data,function(a){var g;if("string"==typeof a)if(/^(https?:\/\/|www)/.test(a))g={url:a};else{g={title:a.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,"").trim()};var h=a.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);h&&(g.url=h[0]),g.title.length>80&&(g.description=g.title,g.title=g.title.replace(/^(.{30,60})\s.+$/,"$1…"))}else g=a;var i=g.title||(g.url||"").replace(/^https?:\/\/(www\.)?/,"").replace(/^(.{40}).+$/,"$1…"),j=g.url||"",k=g.description||"",l=g.image||"";j&&!/^https?:\/\//.test(j)&&(j="http://"+j),(c.isempty||c.test(i)||c.test(k))&&(f++,d+=e.resultTemplate({url:j,title:i,htitle:b(i),image:l,description:k,hdescription:b(k),static_url:e.renkan.options.static_url}))}),e.main_$.html(d),!c.isempty&&f?this.count_$.text(f).show():this.count_$.hide(),c.isempty||f?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.ResourceList.Bin.prototype.refresh=function(){this.data&&this.render()},Rkns.Wikipedia={},Rkns.Wikipedia.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"},Rkns.Wikipedia.Search.prototype.getBgClass=function(){return"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-"+this.lang},Rkns.Wikipedia.Search.prototype.getSearchTitle=function(){var a={fr:"French",en:"English",ja:"Japanese"};return a[this.lang]?this.renkan.translate("Wikipedia in ")+this.renkan.translate(a[this.lang]):this.renkan.translate("Wikipedia")+" ["+this.lang+"]"},Rkns.Wikipedia.Search.prototype.search=function(a){this.renkan.tabs.push(new Rkns.Wikipedia.Bin(this.renkan,{lang:this.lang,search:a}))},Rkns.Wikipedia.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.Wikipedia.Bin.prototype.resultTemplate=renkanJST["templates/wikipedia-bin/resulttemplate.html"],Rkns.Wikipedia.Bin.prototype._init=function(a,b){this.renkan=a,this.search=b.search,this.lang=b.lang||"en",this.title_icon_$.addClass("Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-"+this.lang),this.title_$.html(this.search).addClass("Rk-Wikipedia-Title"),this.refresh()},Rkns.Wikipedia.Bin.prototype.render=function(a){function b(a){return d.replace(_(a).escape(),"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d=c.isempty?Rkns.Utils.regexpFromTextOrArray(this.search):c,e="",f=this,g=0;Rkns._.each(this.data.query.search,function(a){var d=a.title,h="http://"+f.lang+".wikipedia.org/wiki/"+encodeURI(d.replace(/ /g,"_")),i=Rkns.$("<div>").html(a.snippet).text();(c.isempty||c.test(d)||c.test(i))&&(g++,e+=f.resultTemplate({url:h,title:d,htitle:b(d),description:i,hdescription:b(i),static_url:f.renkan.options.static_url}))}),f.main_$.html(e),!c.isempty&&g?this.count_$.text(g).show():this.count_$.hide(),c.isempty||g?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.Wikipedia.Bin.prototype.refresh=function(){var a=this;Rkns.$.ajax({url:"http://"+a.lang+".wikipedia.org/w/api.php?action=query&list=search&srsearch="+encodeURIComponent(this.search)+"&format=json",dataType:"jsonp",success:function(b){a.data=b,a.render()}})},define("renderer/baserepresentation",["jquery","underscore"],function(a,b){var c=function(a,c){if("undefined"!=typeof a&&(this.renderer=a,this.renkan=a.renkan,this.project=a.renkan.project,this.options=a.renkan.options,this.model=c,this.model)){var d=this;this._changeBinding=function(){d.redraw({change:!0})},this._removeBinding=function(){a.removeRepresentation(d),b.defer(function(){a.redraw()})},this._selectBinding=function(){d.select()},this._unselectBinding=function(){d.unselect()},this.model.on("change",this._changeBinding),this.model.on("remove",this._removeBinding),this.model.on("select",this._selectBinding),this.model.on("unselect",this._unselectBinding)}};return b(c.prototype).extend({_super:function(a){return c.prototype[a].apply(this,Array.prototype.slice.call(arguments,1))},redraw:function(){},moveTo:function(){},show:function(){return"BaseRepresentation.show"},hide:function(){},select:function(){this.model&&this.model.trigger("selected")},unselect:function(){this.model&&this.model.trigger("unselected")},highlight:function(){},unhighlight:function(){},mousedown:function(){},mouseup:function(){this.model&&this.model.trigger("clicked")},destroy:function(){this.model&&(this.model.off("change",this._changeBinding),this.model.off("remove",this._removeBinding),this.model.off("select",this._selectBinding),this.model.off("unselect",this._unselectBinding))}}).value(),c}),define("requtils",[],function(){return{getUtils:function(){return window.Rkns.Utils},getRenderer:function(){return window.Rkns.Renderer}}}),define("renderer/basebutton",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({moveTo:function(a){this.sector.moveTo(a)},show:function(){this.sector.show()},hide:function(){this.sector.hide()},select:function(){this.sector.select()},unselect:function(a){this.sector.unselect(),(!a||a!==this.source_representation&&a.source_representation!==this.source_representation)&&this.source_representation.unselect()},destroy:function(){this.sector.destroy()}}).value(),f}),define("renderer/shapebuilder",[],function(){var a="M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z",b={circle:{getShape:function(){return new paper.Path.Circle([0,0],1)},getImageShape:function(a,b){return new paper.Path.Circle(a,b)}},rectangle:{getShape:function(){return new paper.Path.Rectangle([-2,-2],[2,2])},getImageShape:function(a,b){return new paper.Path.Rectangle([-b,-b],[2*b,2*b])
-}},ellipse:{getShape:function(){return new paper.Path.Ellipse(new paper.Rectangle([-2,-1],[2,1]))},getImageShape:function(a,b){return new paper.Path.Ellipse(new paper.Rectangle([-b,-b/2],[2*b,b]))}},polygon:{getShape:function(){return new paper.Path.RegularPolygon([0,0],6,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,6,b)}},diamond:{getShape:function(){var a=new paper.Path.Rectangle([-Math.SQRT2,-Math.SQRT2],[Math.SQRT2,Math.SQRT2]);return a.rotate(45),a},getImageShape:function(a,b){var c=new paper.Path.Rectangle([-b*Math.SQRT2/2,-b*Math.SQRT2/2],[b*Math.SQRT2,b*Math.SQRT2]);return c.rotate(45),c}},star:{getShape:function(){return new paper.Path.Star([0,0],8,1,.7)},getImageShape:function(a,b){return new paper.Path.Star(a,8,1*b,.7*b)}},cloud:{getShape:function(){var b=new paper.Path(a);return b},getImageShape:function(b,c){var d=new paper.Path(a);return d.scale(c),d.translate(b),d}},triangle:{getShape:function(){return new paper.Path.RegularPolygon([0,0],3,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,3,b)}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(){return new paper.Path}}}},c=function(a){return(null===a||"undefined"==typeof a)&&(a="circle"),"svg:"===a.substr(0,4)?b.svg(a.substr(4)):(a in b||(a="circle"),b[a])};return c.builders=b,c}),define("renderer/noderepr",["jquery","underscore","requtils","renderer/baserepresentation","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){if(this.renderer.node_layer.activate(),this.type="Node",this.buildShape(),this.options.show_node_circles?(this.circle.strokeWidth=this.options.node_stroke_width,this.h_ratio=1):this.h_ratio=0,this.title=a('<div class="Rk-Label">').appendTo(this.renderer.labels_$),this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.NodeEditButton(this.renderer,null),new b.NodeRemoveButton(this.renderer,null),new b.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.pending_delete_buttons=[new b.NodeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.last_circle_radius=1,this.renderer.minimap&&(this.renderer.minimap.node_layer.activate(),this.minimap_circle=new paper.Path.Circle([0,0],1),this.minimap_circle.__representation=this.renderer.minimap.miniframe.__representation,this.renderer.minimap.node_group.addChild(this.minimap_circle))},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.node_stroke_width+(a-1)*(this.options.node_stroke_max_width-this.options.node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_node_stroke_width+(a-1)*(this.options.selected_node_stroke_max_width-this.options.selected_node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},buildShape:function(){"shape"in this.model.changed&&delete this.img,this.circle&&(this.circle.remove(),delete this.circle),this.shapeBuilder=new e(this.model.get("shape")),this.circle=this.shapeBuilder.getShape(),this.circle.__representation=this,this.circle.sendToBack(),this.last_circle_radius=1},redraw:function(a){"shape"in this.model.changed&&"change"in a&&a.change&&this.buildShape();var c=new paper.Point(this.model.get("position")),d=this.options.node_size_base*Math.exp((this.model.get("size")||0)*f._NODE_SIZE_STEP);this.is_dragging&&this.paper_coords||(this.paper_coords=this.renderer.toPaperCoords(c)),this.circle_radius=d*this.renderer.scale,this.last_circle_radius!==this.circle_radius&&(this.all_buttons.forEach(function(a){a.setSectorSize()}),this.circle.scale(this.circle_radius/this.last_circle_radius),this.node_image&&this.node_image.scale(this.circle_radius/this.last_circle_radius)),this.circle.position=this.paper_coords,this.node_image&&(this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius))),this.last_circle_radius=this.circle_radius;var e=this.active_buttons,g=1;this.model.get("delete_scheduled")?(g=.5,this.active_buttons=this.pending_delete_buttons,this.circle.dashArray=[2,2]):(g=1,this.active_buttons=this.normal_buttons,this.circle.dashArray=null),this.selected&&this.renderer.isEditable()&&(e!==this.active_buttons&&e.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.node_image&&(this.node_image.opacity=this.highlighted?.5*g:g-.01),this.circle.fillColor=this.highlighted?this.options.highlighted_node_fill_color:this.options.node_fill_color,this.circle.opacity=this.options.show_node_circles?g:.01;var h=this.model.get("title")||this.renkan.translate(this.options.label_untitled_nodes)||"";h=f.shortenText(h,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(h).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(h);var i=this._getStrokeWidth();this.title.css({left:this.paper_coords.x,top:this.paper_coords.y+this.circle_radius*this.h_ratio+this.options.node_label_distance+.5*i,opacity:g});var j=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),k=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=i,this.circle.strokeColor=j,this.circle.dashArray=k;var l=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(l)});var m=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==m&&(this.showImage(),this.circle&&this.circle.sendToBack()),this.node_image&&!this.img&&(this.node_image.remove(),delete this.node_image),this.renderer.minimap){this.minimap_circle.fillColor=j;var n=this.renderer.toMinimapCoords(c),o=this.renderer.minimap.scale*d,p=new paper.Size([o,o]);this.minimap_circle.fitBounds(n.subtract(p),p.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var q=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===q.model||a.get("from")===q.model}),function(a){var b=q.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.redraw()})}},showImage:function(){var b=null;if("undefined"==typeof this.renderer.image_cache[this.img]?(b=new Image,this.renderer.image_cache[this.img]=b,b.src=this.img):b=this.renderer.image_cache[this.img],b.width){this.node_image&&this.node_image.remove(),this.renderer.node_layer.activate();var c=b.width,d=b.height,e=this.model.get("clip_path"),f="undefined"!=typeof e&&e,g=null,h=null,i=null;if(f){g=new paper.Path;var j=e.match(/[a-z][^a-z]+/gi)||[],k=[0,0],l=1/0,m=1/0,n=-1/0,o=-1/0,p=function(a,b){var e=a.slice(1).map(function(a,e){var f=parseFloat(a),g=e%2;return f=g?(f-.5)*d:(f-.5)*c,b&&(f+=k[g]),g?(m=Math.min(m,f),o=Math.max(o,f)):(l=Math.min(l,f),n=Math.max(n,f)),f});return k=e.slice(-2),e};j.forEach(function(a){var b=a.match(/([a-z]|[0-9.-]+)/gi)||[""];switch(b[0]){case"M":g.moveTo(p(b));break;case"m":g.moveTo(p(b,!0));break;case"L":g.lineTo(p(b));break;case"l":g.lineTo(p(b,!0));break;case"C":g.cubicCurveTo(p(b));break;case"c":g.cubicCurveTo(p(b,!0));break;case"Q":g.quadraticCurveTo(p(b));break;case"q":g.quadraticCurveTo(p(b,!0))}}),h=Math[this.options.node_images_fill_mode?"min":"max"](n-l,o-m)/2,i=new paper.Point((n+l)/2,(o+m)/2),this.options.show_node_circles||(this.h_ratio=(o-m)/(2*h))}else h=Math[this.options.node_images_fill_mode?"min":"max"](c,d)/2,i=new paper.Point(0,0),this.options.show_node_circles||(this.h_ratio=d/(2*h));var q=new paper.Raster(b);if(q.locked=!0,f&&(q=new paper.Group(g,q),q.opacity=.99,q.clipped=!0,g.__representation=this),this.options.clip_node_images){var r=this.shapeBuilder.getImageShape(i,h);q=new paper.Group(r,q),q.opacity=.99,q.clipped=!0,r.__representation=this}this.image_delta=i.divide(h),this.node_image=q,this.node_image.__representation=s,this.node_image.scale(this.circle_radius/h),this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)),this.node_image.insertAbove(this.circle)}else{var s=this;a(b).on("load",function(){s.showImage()})}},paperShift:function(a){this.options.editor_mode?this.renkan.read_only||(this.is_dragging=!0,this.paper_coords=this.paper_coords.add(a),this.redraw()):this.renderer.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.circle.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()});var b=this.model.get("uri");b&&a(".Rk-Bin-Item").each(function(){var c=a(this);c.attr("data-uri")===b&&c.addClass("selected")}),this.options.editor_mode||this.openEditor(),this.renderer.minimap&&(this.minimap_circle.strokeWidth=this.options.minimap_highlight_weight,this.minimap_circle.strokeColor=this.options.minimap_highlight_color),this._super("select")},hideButtons:function(){this.all_buttons.forEach(function(a){a.hide()}),delete this.buttonTimeout},unselect:function(b){if(!b||b.source_representation!==this){this.selected=!1;var c=this;this.buttons_timeout=setTimeout(function(){c.hideButtons()},200),this.circle.strokeWidth=this._getStrokeWidth(),a(".Rk-Bin-Item").removeClass("selected"),this.renderer.minimap&&(this.minimap_circle.strokeColor=void 0),this._super("unselect")}},highlight:function(a){var b=a||!0;this.highlighted!==b&&(this.highlighted=b,this.redraw(),this.renderer.throttledPaperDraw())},unhighlight:function(){this.highlighted&&(this.highlighted=!1,this.redraw(),this.renderer.throttledPaperDraw())},saveCoords:function(){var a=this.renderer.toModelCoords(this.paper_coords),b={position:{x:a.x,y:a.y}};this.renderer.isEditable()&&this.model.set(b)},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){this.renderer.is_dragging&&this.renderer.isEditable()?this.saveCoords():(b||this.model.get("delete_scheduled")||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1,this.is_dragging=!1},destroy:function(){this._super("destroy"),this.all_buttons.forEach(function(a){a.destroy()}),this.circle.remove(),this.title.remove(),this.renderer.minimap&&this.minimap_circle.remove(),this.node_image&&this.node_image.remove()}}).value(),g}),define("renderer/edge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){if(this.renderer.edge_layer.activate(),this.type="Edge",this.from_representation=this.renderer.getRepresentationByModel(this.model.get("from")),this.to_representation=this.renderer.getRepresentationByModel(this.model.get("to")),this.bundle=this.renderer.addToBundles(this),this.line=new paper.Path,this.line.add([0,0],[0,0],[0,0]),this.line.__representation=this,this.line.strokeWidth=this.options.edge_stroke_width,this.arrow_scale=1,this.arrow=new paper.Path,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.pivot=new paper.Point([this.options.edge_arrow_length/2,this.options.edge_arrow_width/2]),this.arrow.__representation=this,this.text=a('<div class="Rk-Label Rk-Edge-Label">').appendTo(this.renderer.labels_$),this.arrow_angle=0,this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.EdgeEditButton(this.renderer,null),new b.EdgeRemoveButton(this.renderer,null)],this.pending_delete_buttons=[new b.EdgeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.renderer.minimap&&(this.renderer.minimap.edge_layer.activate(),this.minimap_line=new paper.Path,this.minimap_line.add([0,0],[0,0]),this.minimap_line.__representation=this.renderer.minimap.miniframe.__representation,this.minimap_line.strokeWidth=1)},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.edge_stroke_width+(a-1)*(this.options.edge_stroke_max_width-this.options.edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_edge_stroke_width+(a-1)*(this.options.selected_edge_stroke_max_width-this.options.selected_edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getArrowScale:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return 1+(a-1)*(this.options.edge_arrow_max_width/this.options.edge_arrow_width-1)/(this.options.edge_stroke_witdh_scale-1)},redraw:function(){var a=this.model.get("from"),b=this.model.get("to");if(a&&b&&(this.from_representation=this.renderer.getRepresentationByModel(a),this.to_representation=this.renderer.getRepresentationByModel(b),"undefined"!=typeof this.from_representation&&"undefined"!=typeof this.to_representation)){var c=this._getStrokeWidth(),d=this._getArrowScale(),f=this.from_representation.paper_coords,g=this.to_representation.paper_coords,h=g.subtract(f),i=h.length,j=h.divide(i),k=new paper.Point([-j.y,j.x]),l=this.bundle.getPosition(this),m=k.multiply(this.options.edge_gap_in_bundles*l),n=f.add(m),o=g.add(m),p=h.angle,q=k.multiply(this.options.edge_label_distance+.5*d*this.options.edge_arrow_width),r=h.divide(3),s=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),t=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null,u=1;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(u=.5,this.line.dashArray=[2,2]):(u=1,this.line.dashArray=null);var v=this.active_buttons,w=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow?u:0;this.active_buttons=this.model.get("delete_scheduled")?this.pending_delete_buttons:this.normal_buttons,this.selected&&this.renderer.isEditable()&&v!==this.active_buttons&&(v.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.paper_coords=n.add(o).divide(2),this.line.strokeWidth=c,this.line.strokeColor=s,this.line.dashArray=t,this.line.opacity=u,this.line.segments[0].point=f,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=r.multiply(-1),this.line.segments[1].handleOut=r,this.line.segments[2].point=g,this.arrow.scale(d/this.arrow_scale),this.arrow_scale=d,this.arrow.fillColor=s,this.arrow.opacity=w,this.arrow.rotate(p-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=p,p>90&&(p-=180,q=q.multiply(-1)),-90>p&&(p+=180,q=q.multiply(-1));var x=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";x=e.shortenText(x,this.options.node_label_max_length),this.text.text(x);var y=this.paper_coords.add(q);this.text.css({left:y.x,top:y.y,transform:"rotate("+p+"deg)","-moz-transform":"rotate("+p+"deg)","-webkit-transform":"rotate("+p+"deg)",opacity:u}),this.text_angle=p;var z=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(z)}),this.renderer.minimap&&(this.minimap_line.strokeColor=s,this.minimap_line.segments[0].point=this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get("position"))),this.minimap_line.segments[1].point=this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position"))))}},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("EdgeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.line.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()}),this.options.editor_mode||this.openEditor(),this._super("select")},unselect:function(a){a&&a.source_representation===this||(this.selected=!1,this.options.editor_mode&&this.all_buttons.forEach(function(a){a.hide()}),this.line.strokeWidth=this._getStrokeWidth(),this._super("unselect"))},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){!this.renkan.read_only&&this.renderer.is_dragging?(this.from_representation.saveCoords(),this.to_representation.saveCoords(),this.from_representation.is_dragging=!1,this.to_representation.is_dragging=!1):(b||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1},paperShift:function(a){this.options.editor_mode?this.options.read_only||(this.from_representation.paperShift(a),this.to_representation.paperShift(a)):this.renderer.paperShift(a)},destroy:function(){this._super("destroy"),this.line.remove(),this.arrow.remove(),this.text.remove(),this.renderer.minimap&&this.minimap_line.remove(),this.all_buttons.forEach(function(a){a.destroy()});var a=this;this.bundle.edges=b.reject(this.bundle.edges,function(b){return a===b})}}).value(),f}),define("renderer/tempedge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.edge_layer.activate(),this.type="Temp-edge";var a=(this.project.get("users").get(this.renkan.current_user)||e._USER_PLACEHOLDER(this.renkan)).get("color");this.line=new paper.Path,this.line.strokeColor=a,this.line.dashArray=[4,2],this.line.strokeWidth=this.options.selected_edge_stroke_width,this.line.add([0,0],[0,0]),this.line.__representation=this,this.arrow=new paper.Path,this.arrow.fillColor=a,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.arrow_angle=0},redraw:function(){var a=this.from_representation.paper_coords,b=this.end_pos,c=b.subtract(a).angle,d=a.add(b).divide(2);this.line.segments[0].point=a,this.line.segments[1].point=b,this.arrow.rotate(c-this.arrow_angle),this.arrow.position=d,this.arrow_angle=c},paperShift:function(a){if(!this.renderer.isEditable())return this.renderer.removeRepresentation(_this),void paper.view.draw();this.end_pos=this.end_pos.add(a);var b=paper.project.hitTest(this.end_pos);this.renderer.findTarget(b),this.redraw()},mouseup:function(a){var b=paper.project.hitTest(a.point),c=this.from_representation.model,d=!0;if(b&&"undefined"!=typeof b.item.__representation){var f=b.item.__representation;if("Node"===f.type.substr(0,4)){var g=f.model||f.source_representation.model;if(c!==g){var h={id:e.getUID("edge"),created_by:this.renkan.current_user,from:c,to:g};this.renderer.isEditable()&&this.project.addEdge(h)}}(c===f.model||f.source_representation&&f.source_representation.model===c)&&(d=!1,this.renderer.is_dragging=!0)}d&&(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentation(this),paper.view.draw())},destroy:function(){this.arrow.remove(),this.line.remove()}}).value(),f}),define("renderer/baseeditor",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.buttons_layer.activate(),this.type="editor",this.editor_block=new paper.Path;var c=b.map(b.range(8),function(){return[0,0]});this.editor_block.add.apply(this.editor_block,c),this.editor_block.strokeWidth=this.options.tooltip_border_width,this.editor_block.strokeColor=this.options.tooltip_border_color,this.editor_block.opacity=.8,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:.8}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/nodeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/nodeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("created_by")||f._USER_PLACEHOLDER(this.renkan),g=this.renderer.isEditable()?this.template:this.readOnlyTemplate,h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:f.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),image:c.get("image")||"",image_placeholder:h,color:c.has("style")&&c.get("style").color||d.get("color"),thickness:c.has("style")&&c.get("style").thickness||1,dash:c.has("style")&&c.get("style").dash?"checked":"",clip_path:c.get("clip_path")||!1,created_by_color:d.get("color"),created_by_title:d.get("title"),size:(i>0?"+":"")+i,shape:c.get("shape")||"circle"},renkan:this.renkan,options:this.options,shortenText:f.shortenText,shapes:b(e.builders).omit("svg").keys().value()})),this.redraw();var j=this,k=function(){j.editor_$.off("keyup"),j.editor_$.find("input, textarea, select").off("change keyup paste"),j.editor_$.find(".Rk-Edit-Image-File").off("change"),j.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off("hover"),j.editor_$.find(".Rk-Edit-Size-Btn").off("click"),j.editor_$.find(".Rk-Edit-Image-Del").off("click"),j.editor_$.find(".Rk-Edit-ColorPicker").find("li").off("hover click"),j.editor_$.find(".Rk-CloseX").off("click"),j.editor_$.find(".Rk-Edit-Goto").off("click"),j.renderer.removeRepresentation(j),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(k),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var l=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={title:j.editor_$.find(".Rk-Edit-Title").val()};if(j.options.show_node_editor_uri&&(a.uri=j.editor_$.find(".Rk-Edit-URI").val(),j.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#")),j.options.show_node_editor_image&&(a.image=j.editor_$.find(".Rk-Edit-Image").val(),j.editor_$.find(".Rk-Edit-ImgPreview").attr("src",a.image||h)),j.options.show_node_editor_description&&(a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_style){var d=j.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d})}j.options.change_shapes&&c.get("shape")!==j.editor_$.find(".Rk-Edit-Shape").val()&&(a.shape=j.editor_$.find(".Rk-Edit-Shape").val()),c.set(a),j.redraw()}else k()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&k()}),this.editor_$.find("input, textarea, select").on("change keyup paste",l),j.options.allow_image_upload&&this.editor_$.find(".Rk-Edit-Image-File").change(function(){if(this.files.length){var a=this.files[0],b=new FileReader;if("image"!==a.type.substr(0,5))return void alert(j.renkan.translate("This file is not an image"));if(a.size>1024*j.options.uploaded_image_max_kb)return void alert(j.renkan.translate("Image size must be under ")+j.options.uploaded_image_max_kb+j.renkan.translate("KB"));b.onload=function(a){j.editor_$.find(".Rk-Edit-Image").val(a.target.result),l()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var m=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),m.show()},function(a){a.preventDefault(),m.hide()}),m.find("li").hover(function(b){b.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||f._USER_PLACEHOLDER(j.renkan)).get("color"))}).click(function(d){d.preventDefault(),j.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),m.hide(),paper.view.draw()):k()});var n=function(a){if(j.renderer.isEditable()){var b=a+(c.get("size")||0);j.editor_$.find("#Rk-Edit-Size-Value").text((b>0?"+":"")+b),c.set("size",b),paper.view.draw()}else k()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return n(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return n(1),!1});var o=function(a){if(j.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>j.options.node_stroke_witdh_scale&&(e=j.options.node_stroke_witdh_scale),e!==d&&(j.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else k()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return o(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return o(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),l(),!1})}else if("object"==typeof this.source_representation.highlighted){var p=this.source_representation.highlighted.replace(b(c.get("title")).escape(),'<span class="Rk-Highlighted">$1</span>');this.editor_$.find(".Rk-Display-Title"+(c.get("uri")?" a":"")).html(p),this.options.show_node_tooltip_description&&this.editor_$.find(".Rk-Display-Description").html(this.source_representation.highlighted.replace(b(c.get("description")).escape(),'<span class="Rk-Highlighted">$1</span>'))}this.editor_$.find("img").load(function(){j.redraw()})},redraw:function(){var a=this.source_representation.paper_coords;f.drawEditBox(this.options,a,this.editor_block,.75*this.source_representation.circle_radius,this.editor_$),this.editor_$.show(),paper.view.draw()}}).value(),g}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/edgeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/edgeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("from"),f=c.get("to"),g=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),h=this.renderer.isEditable()?this.template:this.readOnlyTemplate;this.editor_$.html(h({edge:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),color:c.has("style")&&c.get("style").color||g.get("color"),dash:c.has("style")&&c.get("style").dash?"checked":"",arrow:c.has("style")&&c.get("style").arrow||!c.has("style")||"undefined"==typeof c.get("style").arrow?"checked":"",thickness:c.has("style")&&c.get("style").thickness||1,from_title:d.get("title"),to_title:f.get("title"),from_color:d.has("style")&&d.get("style").color||(d.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),to_color:f.has("style")&&f.get("style").color||(f.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),created_by_color:g.get("color"),created_by_title:g.get("title")},renkan:this.renkan,shortenText:e.shortenText,options:this.options})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),i.editor_$.find(".Rk-Edit-Size-Btn").off("click"),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b.throttle(function(){b.defer(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};if(i.options.show_edge_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val()),i.options.show_node_editor_style){var d=i.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d});var e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{arrow:e})}i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#"),c.set(a),paper.view.draw()}else j()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input").on("keyup change paste",k),this.editor_$.find(".Rk-Edit-Vocabulary").change(function(){var b=a(this),c=b.val();c&&(i.editor_$.find(".Rk-Edit-Title").val(b.find(":selected").text()),i.editor_$.find(".Rk-Edit-URI").val(c),k())}),this.editor_$.find(".Rk-Edit-Direction").click(function(){i.renderer.isEditable()?(c.set({from:c.get("to"),to:c.get("from")}),i.draw()):j()});var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(d){d.preventDefault(),i.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),l.hide(),paper.view.draw()):j()});var m=function(a){if(i.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>i.options.node_stroke_witdh_scale&&(e=i.options.node_stroke_witdh_scale),e!==d&&(i.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else j()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return m(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return m(1),!1})}},redraw:function(){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,5,this.editor_$),this.editor_$.show(),paper.view.draw()}}).value(),f}),define("renderer/nodebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({setSectorSize:function(){var a=this.source_representation.circle_radius;a!==this.lastSectorInner&&(this.sector&&this.sector.destroy(),this.sector=this.renderer.drawSector(this,1+a,e._NODE_BUTTON_WIDTH+a,this.startAngle,this.endAngle,1,this.imageName,this.renkan.translate(this.text)),this.lastSectorInner=a)},unselect:function(){d.prototype.unselect.apply(this,Array.prototype.slice.call(arguments,1)),this.source_representation&&this.source_representation.buttons_timeout&&(clearTimeout(this.source_representation.buttons_timeout),this.source_representation.hideButtons())},select:function(){this.source_representation&&this.source_representation.buttons_timeout&&clearTimeout(this.source_representation.buttons_timeout),this.sector.select()}}).value(),f}),define("renderer/nodeeditbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-edit-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=-45,this.imageName="edit",this.text="Edit"
-},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/noderemovebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-remove-button",this.lastSectorInner=0,this.startAngle=0,this.endAngle=90,this.imageName="remove",this.text="Remove"},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove node ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeNode(this.source_representation.model)}}).value(),f}),define("renderer/noderevertbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-revert-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=135,this.imageName="revert",this.text="Cancel deletion"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/nodelinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-link-button",this.lastSectorInner=0,this.startAngle=90,this.endAngle=180,this.imageName="link",this.text="Link to another node"},mousedown:function(a){if(this.renderer.isEditable()){var b=this.renderer.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,c)}}}).value(),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-enlarge-button",this.lastSectorInner=0,this.startAngle=-45,this.endAngle=0,this.imageName="enlarge",this.text="Enlarge"},mouseup:function(){var a=1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/nodeshrinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-shrink-button",this.lastSectorInner=0,this.startAngle=-180,this.endAngle=-135,this.imageName="shrink",this.text="Shrink"},mouseup:function(){var a=-1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/edgeeditbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-edit-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-270,-90,1,"edit",this.renkan.translate("Edit"))},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/edgeremovebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-remove-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-90,90,1,"remove",this.renkan.translate("Remove"))},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove edge ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeEdge(this.source_representation.model)}}).value(),f}),define("renderer/edgerevertbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-revert-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-135,135,1,"revert",this.renkan.translate("Cancel deletion"))},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/miniframe",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({paperShift:function(a){this.renderer.offset=this.renderer.offset.subtract(a.divide(this.renderer.minimap.scale).multiply(this.renderer.scale)),this.renderer.redraw()},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1}}).value(),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe"],function(a,b,c,d,e){var f=d.getUtils(),g=function(c){this.renkan=c,this.$=a(".Rk-Render"),this.representations=[],this.$.html(c.options.templates["templates/scene.html"](c)),this.onStatusChange(),this.canvas_$=this.$.find(".Rk-Canvas"),this.labels_$=this.$.find(".Rk-Labels"),this.editor_$=this.$.find(".Rk-Editor"),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.totalScroll=0,this.mouse_down=!1,this.click_target=null,this.selected_target=null,this.edge_layer=new paper.Layer,this.node_layer=new paper.Layer,this.buttons_layer=new paper.Layer,this.delete_list=[],this.redrawActive=!0,c.options.show_minimap&&(this.minimap={background_layer:new paper.Layer,edge_layer:new paper.Layer,node_layer:new paper.Layer,node_group:new paper.Group,size:new paper.Size(c.options.minimap_width,c.options.minimap_height)},this.minimap.background_layer.activate(),this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle=new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.rectangle.fillColor=c.options.minimap_background_color,this.minimap.rectangle.strokeColor=c.options.minimap_border_color,this.minimap.rectangle.strokeWidth=4,this.minimap.offset=new paper.Point(this.minimap.size.divide(2)),this.minimap.scale=.1,this.minimap.node_layer.activate(),this.minimap.cliprectangle=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.cliprectangle),this.minimap.node_group.clipped=!0,this.minimap.miniframe=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.miniframe),this.minimap.miniframe.fillColor="#c0c0ff",this.minimap.miniframe.opacity=.3,this.minimap.miniframe.strokeColor="#000080",this.minimap.miniframe.strokeWidth=2,this.minimap.miniframe.__representation=new e(this,null)),this.throttledPaperDraw=b(function(){paper.view.draw()}).throttle(100).value(),this.bundles=[],this.click_mode=!1;var d=this,g=!0,h=1,i=!1,j=0,k=0;this.image_cache={},this.icon_cache={},["edit","remove","link","enlarge","shrink","revert"].forEach(function(a){var b=new Image;b.src=c.options.static_url+"img/"+a+".png",d.icon_cache[a]=b});var l=b.throttle(function(a,b){d.onMouseMove(a,b)},f._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),l(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),g&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-_lastTap<f._DOUBLETAP_DELAY&&Math.pow(j-b.pageX,2)+Math.pow(k-b.pageY,2)<f._DOUBLETAP_DISTANCE?(_lastTap=0,d.onDoubleClick(b)):(_lastTap=new Date,j=b.pageX,k=b.pageY,h=d.scale,i=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),_lastTap=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(i||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,i=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*h,c=b/d.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.offset.multiply(c));d.setScale(b,e)}},touchend:function(a){a.preventDefault(),d.onMouseUp(a.originalEvent.changedTouches[0],!0)},dblclick:function(a){a.preventDefault(),c.options.allow_double_click&&d.onDoubleClick(a)},mouseleave:function(a){a.preventDefault(),d.onMouseUp(a,!1),d.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),g=!1},dragleave:function(a){a.preventDefault(),g=!0},drop:function(a){a.preventDefault(),g=!0;var c={};b.each(a.originalEvent.dataTransfer.types,function(b){try{c[b]=a.originalEvent.dataTransfer.getData(b)}catch(d){}});var e=a.originalEvent.dataTransfer.getData("Text");if("string"==typeof e)switch(e[0]){case"{":case"[":try{var f=JSON.parse(e);b.extend(c,f)}catch(h){c["text/plain"]||(c["text/plain"]=e)}break;case"<":c["text/html"]||(c["text/html"]=e);break;default:c["text/plain"]||(c["text/plain"]=e)}var i=a.originalEvent.dataTransfer.getData("URL");i&&!c["text/uri-list"]&&(c["text/uri-list"]=i),d.dropData(c,a.originalEvent)}});var m=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};m(".Rk-ZoomOut","zoomOut"),m(".Rk-ZoomIn","zoomIn"),m(".Rk-ZoomFit","autoScale"),this.$.find(".Rk-ZoomSave").click(function(){d.renkan.project.addView({zoom_level:d.scale,offset:d.offset})}),this.$.find(".Rk-ZoomSetSaved").click(function(){var a=d.renkan.project.get("views").last();a&&d.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show(),this.$.find(".Rk-CurrentUser").mouseenter(function(){d.$.find(".Rk-UserList").slideDown()}),this.$.find(".Rk-Users").mouseleave(function(){d.$.find(".Rk-UserList").slideUp()}),m(".Rk-FullScreen-Button","fullScreen"),m(".Rk-AddNode-Button","addNodeBtn"),m(".Rk-AddEdge-Button","addEdgeBtn"),m(".Rk-Save-Button","save"),m(".Rk-Open-Button","open"),m(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+f._BOOKMARKLET_CODE(c)).click(function(){return d.notif_$.text(c.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.")).fadeIn().delay(5e3).fadeOut(),!1}),this.$.find(".Rk-TopBar-Button").mouseover(function(){a(this).find(".Rk-TopBar-Tooltip").show()}).mouseout(function(){a(this).find(".Rk-TopBar-Tooltip").hide()}),m(".Rk-Fold-Bins","foldBins"),paper.view.onResize=function(a){var b,c=a.width,e=a.height;d.minimap&&(d.minimap.topleft=paper.view.bounds.bottomRight.subtract(d.minimap.size),d.minimap.rectangle.fitBounds(d.minimap.topleft.subtract([2,2]),d.minimap.size.add([4,4])),d.minimap.cliprectangle.fitBounds(d.minimap.topleft,d.minimap.size));var f=e/(e-a.delta.height),g=c/(c-a.delta.width);b=c>e?f:g,d.resizeZoom(g,f,b),d.redraw()};var n=b.throttle(function(){d.redraw()},50);this.addRepresentations("Node",this.renkan.project.get("nodes")),this.addRepresentations("Edge",this.renkan.project.get("edges")),this.renkan.project.on("change:title",function(){d.$.find(".Rk-PadTitle").val(c.project.get("title"))}),this.$.find(".Rk-PadTitle").on("keyup input paste",function(){c.project.set({title:a(this).val()})});var o=b.throttle(function(){d.redrawUsers()},100);if(o(),this.renkan.project.on("change:saveStatus",function(){switch(d.renkan.project.get("saveStatus")){case 0:d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("saved");break;case 1:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("to-save");break;case 2:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").addClass("saving")}}),this.renkan.project.on("change:loadingStatus",function(){if(d.renkan.project.get("loadingStatus")){d.$.find(".loader").addClass("run"),setTimeout(function(){d.$.find(".loader").hide(250)},3e3)}}),this.renkan.project.on("add:users remove:users",o),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>0?d.$.find(".Rk-ZoomSetSaved").show():d.$.find(".Rk-ZoomSetSaved").hide()}),this.renkan.project.on("add:nodes",function(a){d.addRepresentation("Node",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("change:title",function(a,b){var c=d.$.find(".Rk-PadTitle");c.is("input")?c.val()!==b&&c.val(b):c.text(b)}),c.options.size_bug_fix){var p="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},p)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var q=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),r=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");q.hover(function(a){d.isEditable()&&(a.preventDefault(),r.show())},function(a){a.preventDefault(),r.hide()}),r.find("li").mouseenter(function(b){d.isEditable()&&(b.preventDefault(),d.$.find(".Rk-CurrentUser-Color").css("background",a(this).attr("data-color")))})}if(c.options.show_search_field){var s="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==s)if(s=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var g=f.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){g.test(a.get("title"))||g.test(a.get("description"))?d.getRepresentationByModel(a).highlight(g):d.getRepresentationByModel(a).unhighlight()})}})}this.redraw(),window.setInterval(function(){var a=(new Date).valueOf();d.delete_list.forEach(function(b){if(a>=b.time){var d=c.project.get("nodes").findWhere({delete_scheduled:b.id});d&&project.removeNode(d),d=c.project.get("edges").findWhere({delete_scheduled:b.id}),d&&project.removeEdge(d)}}),d.delete_list=d.delete_list.filter(function(a){return c.project.get("nodes").findWhere({delete_scheduled:a.id})||c.project.get("edges").findWhere({delete_scheduled:a.id})})},500),this.minimap&&window.setInterval(function(){d.rescaleMinimap()},2e3)};return b(g.prototype).extend({fixSize:function(){if(this.renkan.options.default_view&&this.renkan.project.get("views").length>0){var a=this.renkan.project.get("views").last();this.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}else this.autoScale()},drawSector:function(b,c,d,e,f,g,h,i){var j=this.renkan.options,k=e*Math.PI/180,l=f*Math.PI/180,m=this.icon_cache[h],n=-Math.sin(k),o=Math.cos(k),p=Math.cos(k)*c+g*n,q=Math.sin(k)*c+g*o,r=Math.cos(k)*d+g*n,s=Math.sin(k)*d+g*o,t=-Math.sin(l),u=Math.cos(l),v=Math.cos(l)*c-g*t,w=Math.sin(l)*c-g*u,x=Math.cos(l)*d-g*t,y=Math.sin(l)*d-g*u,z=(c+d)/2,A=(k+l)/2,B=Math.cos(A)*z,C=Math.sin(A)*z,D=Math.cos(A)*c,E=Math.cos(A)*d,F=Math.sin(A)*c,G=Math.sin(A)*d,H=Math.cos(A)*(d+3),I=Math.sin(A)*(d+j.buttons_label_font_size)+j.buttons_label_font_size/2;this.buttons_layer.activate();var J=new paper.Path;J.add([p,q]),J.arcTo([D,F],[v,w]),J.lineTo([x,y]),J.arcTo([E,G],[r,s]),J.fillColor=j.buttons_background,J.opacity=.5,J.closed=!0,J.__representation=b;var K=new paper.PointText(H,I);K.characterStyle={fontSize:j.buttons_label_font_size,fillColor:j.buttons_label_color},K.paragraphStyle.justification=H>2?"left":-2>H?"right":"center",K.visible=!1;var L=!1,M=new paper.Point(-200,-200),N=new paper.Group([J,K]),O=N.position,P=new paper.Point([B,C]),Q=new paper.Point(0,0);K.content=i,N.pivot=N.bounds.center,N.visible=!1,N.position=M;var R={show:function(){L=!0,N.position=Q.add(O),N.visible=!0},moveTo:function(a){Q=a,L&&(N.position=a.add(O))},hide:function(){L=!1,N.visible=!1,N.position=M},select:function(){J.opacity=.8,K.visible=!0},unselect:function(){J.opacity=.5,K.visible=!1},destroy:function(){N.remove()}},S=function(){var a=new paper.Raster(m);a.position=P.add(N.position).subtract(O),a.locked=!0,N.addChild(a)};return m.width?S():a(m).on("load",S),R},addToBundles:function(a){var c=b(this.bundles).find(function(b){return b.from===a.from_representation&&b.to===a.to_representation||b.from===a.to_representation&&b.to===a.from_representation});return"undefined"!=typeof c?c.edges.push(a):(c={from:a.from_representation,to:a.to_representation,edges:[a],getPosition:function(a){var c=a.from_representation===this.from?1:-1;return c*(b(this.edges).indexOf(a)-(this.edges.length-1)/2)}},this.bundles.push(c)),c},isEditable:function(){return this.renkan.options.editor_mode&&!this.renkan.read_only},onStatusChange:function(){var a=this.$.find(".Rk-Save-Button"),b=a.find(".Rk-TopBar-Tooltip-Contents");this.renkan.read_only?(a.removeClass("disabled Rk-Save-Online").addClass("Rk-Save-ReadOnly"),b.text(this.renkan.translate("Connection lost"))):this.renkan.options.manual_save?(a.removeClass("Rk-Save-ReadOnly Rk-Save-Online"),b.text(this.renkan.translate("Save Project"))):(a.removeClass("disabled Rk-Save-ReadOnly").addClass("Rk-Save-Online"),b.text(this.renkan.translate("Auto-save enabled"))),this.redrawUsers()},setScale:function(a,b){a/this.initialScale>f._MIN_SCALE&&a/this.initialScale<f._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.redraw())},autoScale:function(a){var b=this.renkan.project.get("nodes");if(b.length>1){var c=b.map(function(a){return a.get("position").x}),d=b.map(function(a){return a.get("position").y}),e=Math.min.apply(Math,c),f=Math.min.apply(Math,d),g=Math.max.apply(Math,c),h=Math.max.apply(Math,d),i=Math.min((paper.view.size.width-2*this.renkan.options.autoscale_padding)/(g-e),(paper.view.size.height-2*this.renkan.options.autoscale_padding)/(h-f));this.initialScale=i,"undefined"!=typeof a&&parseFloat(a.zoom_level)>0&&parseFloat(a.offset.x)>0&&parseFloat(a.offset.y)>0?this.setScale(parseFloat(a.zoom_level),new paper.Point(parseFloat(a.offset.x),parseFloat(a.offset.y))):this.setScale(i,paper.view.center.subtract(new paper.Point([(g+e)/2,(h+f)/2]).multiply(i)))}1===b.length&&this.setScale(1,paper.view.center.subtract(new paper.Point([b.at(0).get("position").x,b.at(0).get("position").y])))},redrawMiniframe:function(){var a=this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),b=this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));this.minimap.miniframe.fitBounds(a,b)},rescaleMinimap:function(){var a=this.renkan.project.get("nodes");if(a.length>1){var b=a.map(function(a){return a.get("position").x}),c=a.map(function(a){return a.get("position").y}),d=Math.min.apply(Math,b),e=Math.min.apply(Math,c),f=Math.max.apply(Math,b),g=Math.max.apply(Math,c),h=Math.min(.8*this.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.scale*this.renkan.options.minimap_height/paper.view.bounds.height,(this.renkan.options.minimap_width-2*this.renkan.options.minimap_padding)/(f-d),(this.renkan.options.minimap_height-2*this.renkan.options.minimap_padding)/(g-e));this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([(f+d)/2,(g+e)/2]).multiply(h)),this.minimap.scale=h}1===a.length&&(this.minimap.scale=.1,this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([a.at(0).get("position").x,a.at(0).get("position").y]).multiply(this.minimap.scale))),this.redraw()},toPaperCoords:function(a){return a.multiply(this.scale).add(this.offset)},toMinimapCoords:function(a){return a.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft)},toModelCoords:function(a){return a.subtract(this.offset).divide(this.scale)},addRepresentation:function(a,b){var c=d.getRenderer()[a],e=new c(this,b);return this.representations.push(e),e},addRepresentations:function(a,b){var c=this;b.forEach(function(b){c.addRepresentation(a,b)})},userTemplate:b.template('<li class="Rk-User"><span class="Rk-UserColor" style="background:<%=background%>;"></span><%=name%></li>'),redrawUsers:function(){if(this.renkan.options.show_user_list){var b=[].concat((this.renkan.project.current_user_list||{}).models||[],(this.renkan.project.get("users")||{}).models||[]),c="",d=this.$.find(".Rk-Users"),e=d.find(".Rk-CurrentUser-Name"),f=d.find(".Rk-Edit-ColorPicker li"),g=d.find(".Rk-CurrentUser-Color"),h=this;e.off("click").text(this.renkan.translate("<unknown user>")),f.off("mouseleave click"),b.forEach(function(b){b.get("_id")===h.renkan.current_user?(e.text(b.get("title")),g.css("background",b.get("color")),h.isEditable()&&(h.renkan.options.user_name_editable&&e.click(function(){var c=a(this),d=a("<input>").val(b.get("title")).blur(function(){b.set("title",a(this).val()),h.redrawUsers(),h.redraw()});c.empty().html(d),d.select()}),h.renkan.options.user_color_editable&&f.click(function(c){c.preventDefault(),h.isEditable()&&b.set("color",a(this).attr("data-color")),a(this).parent().hide()}).mouseleave(function(){g.css("background",b.get("color"))}))):c+=h.userTemplate({name:b.get("title"),background:b.get("color")})}),d.find(".Rk-UserList").html(c)}},removeRepresentation:function(a){a.destroy(),this.representations=b.reject(this.representations,function(b){return b===a})},getRepresentationByModel:function(a){return a?b.find(this.representations,function(b){return b.model===a}):void 0},removeRepresentationsOfType:function(a){var c=b.filter(this.representations,function(b){return b.type===a}),d=this;b.each(c,function(a){d.removeRepresentation(a)})},highlightModel:function(a){var b=this.getRepresentationByModel(a);b&&b.highlight()},unhighlightAll:function(){b.each(this.representations,function(a){a.unhighlight()})},unselectAll:function(){b.each(this.representations,function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b.each(this.representations,function(a){a.redraw({dontRedrawEdges:!0})}),this.minimap&&this.redrawMiniframe(),paper.view.draw())},addTempEdge:function(a,b){var c=this.addRepresentation("TempEdge",null);c.end_pos=b,c.from_representation=a,c.redraw(),this.click_target=c},findTarget:function(a){if(a&&"undefined"!=typeof a.item.__representation){var b=a.item.__representation;this.selected_target!==a.item.__representation&&(this.selected_target&&this.selected_target.unselect(b),b.select(this.selected_target),this.selected_target=b)}else this.selected_target&&this.selected_target.unselect(),this.selected_target=null},paperShift:function(a){this.offset=this.offset.add(a),this.redraw()},onMouseMove:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=c.subtract(this.last_point);this.last_point=c,!this.is_dragging&&this.mouse_down&&d.length>f._MIN_DRAG_DISTANCE&&(this.is_dragging=!0);var e=paper.project.hitTest(c);this.is_dragging?this.click_target&&"function"==typeof this.click_target.paperShift?this.click_target.paperShift(d):this.paperShift(d):this.findTarget(e),paper.view.draw()},onMouseDown:function(b,c){var d=this.canvas_$.offset(),e=new paper.Point([b.pageX-d.left,b.pageY-d.top]);if(this.last_point=e,this.mouse_down=!0,!this.click_target||"Temp-edge"!==this.click_target.type){this.removeRepresentationsOfType("editor"),this.is_dragging=!1;var g=paper.project.hitTest(e);if(g&&"undefined"!=typeof g.item.__representation)this.click_target=g.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===f._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}};_node=this.renkan.project.addNode(i),this.getRepresentationByModel(_node).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===f._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=f._CLICKMODE_ENDEDGE,this.notif_$.fadeOut(function(){a(this).html(this.renkan.translate("Click on a second node to complete the edge")).fadeIn()})):(this.notif_$.hide(),this.click_mode=!1)),paper.view.draw()},onMouseUp:function(a,b){if(this.mouse_down=!1,this.click_target){var c=this.canvas_$.offset();this.click_target.mouseup({point:new paper.Point([a.pageX-c.left,a.pageY-c.top])},b)}else this.click_target=null,this.is_dragging=!1,b&&this.unselectAll();paper.view.draw()},onScroll:function(a,b){if(this.totalScroll+=b,Math.abs(this.totalScroll)>=1){var c=this.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]).subtract(this.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.setScale(this.scale*Math.SQRT2,this.offset.subtract(d)):this.setScale(this.scale*Math.SQRT1_2,this.offset.add(d.divide(Math.SQRT2))),this.totalScroll=0}},onDoubleClick:function(a){if(this.isEditable()){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=paper.project.hitTest(c);if(this.isEditable()&&(!d||"undefined"==typeof d.item.__representation)){var e=this.toModelCoords(c),g={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(g);this.getRepresentationByModel(h).openEditor()}paper.view.draw()}},defaultDropHandler:function(b){var c={},d="";switch(b["text/x-iri-specific-site"]){case"twitter":d=a("<div>").html(b["text/x-iri-selected-html"]);var e=d.find(".tweet");c.title=this.renkan.translate("Tweet by ")+e.attr("data-name"),c.uri="http://twitter.com/"+e.attr("data-screen-name")+"/status/"+e.attr("data-tweet-id"),c.image=e.find(".avatar").attr("src"),c.description=e.find(".js-tweet-text:first").text();break;case"google":d=a("<div>").html(b["text/x-iri-selected-html"]),c.title=d.find("h3:first").text().trim(),c.uri=d.find("h3 a").attr("href"),c.description=d.find(".st:first").text().trim();break;default:b["text/x-iri-source-uri"]&&(c.uri=b["text/x-iri-source-uri"])}if((b["text/plain"]||b["text/x-iri-selected-text"])&&(c.description=(b["text/plain"]||b["text/x-iri-selected-text"]).replace(/[\s\n]+/gm," ").trim()),b["text/html"]||b["text/x-iri-selected-html"]){d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]);var f=d.find("image");f.length&&(c.image=f.attr("xlink:href"));var g=d.find("path");g.length&&(c.clipPath=g.attr("d"));var h=d.find("img");h.length&&(c.image=h[0].src);var i=d.find("a");i.length&&(c.uri=i[0].href),c.title=d.find("[title]").attr("title")||c.title,c.description=d.text().replace(/[\s\n]+/gm," ").trim()}b["text/uri-list"]&&(c.uri=b["text/uri-list"]),b["text/x-moz-url"]&&!c.title&&(c.title=(b["text/x-moz-url"].split("\n")[1]||"").trim(),c.title===c.uri&&(c.title=!1)),b["text/x-iri-source-title"]&&!c.title&&(c.title=b["text/x-iri-source-title"]),(b["text/html"]||b["text/x-iri-selected-html"])&&(d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]),c.image=d.find("[data-image]").attr("data-image")||c.image,c.uri=d.find("[data-uri]").attr("data-uri")||c.uri,c.title=d.find("[data-title]").attr("data-title")||c.title,c.description=d.find("[data-description]").attr("data-description")||c.description,c.clipPath=d.find("[data-clip-path]").attr("data-clip-path")||c.clipPath),c.title||(c.title=this.renkan.translate("Dragged resource"));for(var j=["title","description","uri","image"],k=0;k<j.length;k++){var l=j[k];(b["text/x-iri-"+l]||b[l])&&(c[l]=b["text/x-iri-"+l]||b[l]),("none"===c[l]||"null"===c[l])&&(c[l]=void 0)}return"function"==typeof this.renkan.options.drop_enhancer&&(c=this.renkan.options.drop_enhancer(c,b)),c},dropData:function(a,c){if(this.isEditable()){if(a["text/json"]||a["application/json"])try{var d=JSON.parse(a["text/json"]||a["application/json"]);b.extend(a,d)}catch(e){}var g="undefined"==typeof this.renkan.options.drop_handler?this.defaultDropHandler(a):this.renkan.options.drop_handler(a),h=this.canvas_$.offset(),i=new paper.Point([c.pageX-h.left,c.pageY-h.top]),j=this.toModelCoords(i),k={id:f.getUID("node"),created_by:this.renkan.current_user,uri:g.uri||"",title:g.title||"",description:g.description||"",image:g.image||"",color:g.color||void 0,clip_path:g.clipPath||void 0,position:{x:j.x,y:j.y}},l=this.renkan.project.addNode(k),m=this.getRepresentationByModel(l);"drop"===c.type&&m.openEditor()}},fullScreen:function(){var a,b=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen,c=this.renkan.$[0],d=["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],e=["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"];if(b){for(a=0;a<e.length;a++)if("function"==typeof document[e[a]]){document[e[a]]();break}var f=this.$.width(),g=this.$.height();this.renkan.options.show_top_bar&&(g-=this.$.find(".Rk-TopBar").height()),this.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(f-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([f,g])}else{for(a=0;a<d.length;a++)if("function"==typeof c[d[a]]){c[d[a]]();break}this.redraw()}},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT1_2)).add(this.offset.multiply(Math.SQRT1_2));this.setScale(a,b)},zoomIn:function(){var a=this.scale*Math.SQRT2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT2)).add(this.offset.multiply(Math.SQRT2));this.setScale(a,b)},resizeZoom:function(a,b,c){var d=this.scale*c,e=new paper.Point([this.offset.x*a,this.offset.y*b]);this.setScale(d,e)},addNodeBtn:function(){return this.click_mode===f._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_ADDNODE,this.notif_$.text(this.renkan.translate("Click on the background canvas to add a node")).fadeIn()),!1},addEdgeBtn:function(){return this.click_mode===f._CLICKMODE_STARTEDGE||this.click_mode===f._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_STARTEDGE,this.notif_$.text(this.renkan.translate("Click on a first node to start the edge")).fadeIn()),!1},exportProject:function(){var a=this.renkan.project.toJSON(),d=(document.createElement("a"),a.id),e=d+".json";delete a.id,delete a._id,delete a.space_id;var g,h={};b.each(a.nodes,function(a){g=a.id||a._id,delete a._id,delete a.id,h[g]=a["@id"]=f.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=h[a.to],a.from=h[a.from]}),b.each(a.views,function(a){g=a.id||a._id,delete a._id,delete a.id}),a.users=[];var i=JSON.stringify(a,null,2),j=new Blob([i],{type:"application/json;charset=utf-8"});c(j,e)},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=this,e=d.canvas_$.width();c.position().left<0?(c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e-c.width()<c.height()?e:e-c.width(),b.html("«")):(c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])
-}),a=e+300,b.html("»")),d.resizeZoom(1,1,a/e)},save:function(){},open:function(){}}).value(),g}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils"}}),require(["renderer/baserepresentation","renderer/basebutton","renderer/noderepr","renderer/edge","renderer/tempedge","renderer/baseeditor","renderer/nodeeditor","renderer/edgeeditor","renderer/nodebutton","renderer/nodeeditbutton","renderer/noderemovebutton","renderer/noderevertbutton","renderer/nodelinkbutton","renderer/nodeenlargebutton","renderer/nodeshrinkbutton","renderer/edgeeditbutton","renderer/edgeremovebutton","renderer/edgerevertbutton","renderer/miniframe","renderer/scene"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t){var u=window.Rkns;"undefined"==typeof u.Renderer&&(u.Renderer={});var v=u.Renderer;v._BaseRepresentation=a,v._BaseButton=b,v.Node=c,v.Edge=d,v.TempEdge=e,v._BaseEditor=f,v.NodeEditor=g,v.EdgeEditor=h,v._NodeButton=i,v.NodeEditButton=j,v.NodeRemoveButton=k,v.NodeRevertButton=l,v.NodeLinkButton=m,v.NodeEnlargeButton=n,v.NodeShrinkButton=o,v.EdgeEditButton=p,v.EdgeRemoveButton=q,v.EdgeRevertButton=r,v.MiniFrame=s,v.Scene=t,startRenkan()}),define("main-renderer",function(){});
+this.renkanJST=this.renkanJST||{},this.renkanJST["templates/colorpicker.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li data-color="'+(null==(__t=c)?"":__t)+'" style="background: '+(null==(__t=c)?"":__t)+'"></li>';return __p},this.renkanJST["templates/edgeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Edge"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(edge.title)+'" />\n</p>\n',options.show_edge_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(edge.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(edge.uri)+'" target="_blank"></a>\n </p>\n ',options.properties.length&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose from vocabulary:"))+'</label>\n <select class="Rk-Edit-Vocabulary">\n ',_.each(options.properties,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Class" value="">\n '+__e(renkan.translate(a.label))+"\n </option>\n ",_.each(a.properties,function(b){var c=a["base-uri"]+b.uri;__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(c)+'"\n ',c===edge.uri&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(b.label))+"\n </option>\n "}),__p+="\n "}),__p+="\n </select>\n </p>\n")),__p+="\n",options.show_edge_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_edge_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Edge color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: <%-edge.color%>;">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_edge_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(edge.dash)+" />\n </div>\n "),__p+="\n ",options.show_edge_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(edge.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n ",options.show_edge_editor_style_arrow&&(__p+='\n <div id="Rk-Editor-p-arrow">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Arrow:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Arrow" class="Rk-Edit-Arrow" '+__e(edge.arrow)+" />\n </div>\n "),__p+="\n </div>\n"),__p+="\n",options.show_edge_editor_direction&&(__p+='\n <p>\n <span class="Rk-Edit-Direction">'+__e(renkan.translate("Change edge direction"))+"</span>\n </p>\n"),__p+="\n",options.show_edge_editor_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_editor_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: <%-edge.created_by_color%>;"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/edgeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_edge_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(edge.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',edge.uri&&(__p+='\n <a href="'+__e(edge.uri)+'" target="_blank">\n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" </a> "),__p+="\n </span>\n</h2>\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(edge.uri)+'" target="_blank">'+__e(edge.short_uri)+"</a>\n </p>\n"),__p+="\n<p>"+__e(edge.description)+"</p>\n",options.show_edge_tooltip_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.to_color)+';"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_tooltip_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.created_by_color)+';"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/ldtjson-bin/annotationtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/segmenttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/tagtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/ldt-tag.png"))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/search/?search="+(null==(__t=encodedtitle)?"":__t)+'&field=all"\n data-title="'+__e(title)+'" data-description="Tag \''+__e(title)+'\'">\n\n <img class="Rk-Ldt-Tag-Icon" src="'+__e(static_url)+'img/ldt-tag.png" />\n <h4>'+(null==(__t=htitle)?"":__t)+'</h4>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/list-bin.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="'+__e(title)+'"\n data-description="'+__e(description)+'"\n ',__p+=image?'\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n ':'\n data-image=""\n ',__p+="\n>",image&&(__p+='\n <img class="Rk-ResourceList-Image" src="'+__e(image)+'" />\n'),__p+='\n<h4 class="Rk-ResourceList-Title">\n ',url&&(__p+='\n <a href="'+__e(url)+'" target="_blank">\n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+="</a>"),__p+="\n </h4>\n ",description&&(__p+='\n <p class="Rk-ResourceList-Description">'+(null==(__t=hdescription)?"":__t)+"</p>\n "),__p+="\n ",image&&(__p+='\n <div style="clear: both;"></div>\n '),__p+="\n</li>\n";return __p},this.renkanJST["templates/main.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)options.show_bins&&(__p+='\n <div class="Rk-Bins">\n <div class="Rk-Bins-Head">\n <h2 class="Rk-Bins-Title">'+__e(translate("Select contents:"))+'</h2>\n <form class="Rk-Web-Search-Form Rk-Search-Form">\n <input class="Rk-Web-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search the Web"))+'" />\n <div class="Rk-Search-Select">\n <div class="Rk-Search-Current"></div>\n <ul class="Rk-Search-List"></ul>\n </div>\n <input type="submit" value=""\n class="Rk-Web-Search-Submit Rk-Search-Submit" title="'+__e(translate("Search the Web"))+'" />\n </form>\n <form class="Rk-Bins-Search-Form Rk-Search-Form">\n <input class="Rk-Bins-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search in Bins"))+'" /> <input\n type="submit" value=""\n class="Rk-Bins-Search-Submit Rk-Search-Submit"\n title="'+__e(translate("Search in Bins"))+'" />\n </form>\n </div>\n <ul class="Rk-Bin-List"></ul>\n </div>\n'),__p+=" ",options.show_editor&&(__p+='\n <div class="Rk-Render Rk-Render-',__p+=options.show_bins?"Panel":"Full",__p+='"></div>\n'),__p+="\n";return __p},this.renkanJST["templates/nodeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='\n<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Node"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n</p>\n',options.show_node_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(node.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(node.uri)+'" target="_blank"></a>\n </p>\n'),__p+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+'</label>\n <textarea class="Rk-Edit-Description">'+__e(node.description)+"</textarea>\n </p>\n"),__p+=" ",options.show_node_editor_size&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Size:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Size-Value">'+__e(node.size)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Up">+</a>\n </p>\n'),__p+=" ",options.show_node_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_node_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">\n '+__e(renkan.translate("Node color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: '+__e(node.color)+';">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_node_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(node.dash)+" />\n </div>\n "),__p+="\n ",options.show_node_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(node.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n </div>\n"),__p+=" ",options.show_node_editor_image&&(__p+='\n <div class="Rk-Edit-ImgWrap">\n <div class="Rk-Edit-ImgPreview">\n <img src="'+__e(node.image||node.image_placeholder)+'" />\n ',node.clip_path&&(__p+='\n <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n <path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="'+__e(node.clip_path)+'" />\n </svg>\n '),__p+="\n </div>\n </div>\n <p>\n <label>"+__e(renkan.translate("Image URL:"))+'</label>\n <div>\n <a class="Rk-Edit-Image-Del" href="#"></a>\n <input class="Rk-Edit-Image" type="text" value=\''+__e(node.image)+"' />\n </div>\n </p>\n",options.allow_image_upload&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose Image File:"))+'</label>\n <input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n </p>\n')),__p+=" ",options.show_node_editor_creator&&node.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+=" ",options.change_shapes&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Shapes available"))+':</label>\n <select class="Rk-Edit-Shape">\n ',_.each(shapes,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.shape===a&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(a.charAt(0).toUpperCase()+a.substring(1)))+"\n </option>\n "}),__p+="\n </select>\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/nodeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_node_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(node.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',node.uri&&(__p+='\n <a href="'+__e(node.uri)+'" target="_blank">\n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+="</a>"),__p+="\n </span>\n</h2>\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(node.uri)+'" target="_blank">'+__e(node.short_uri)+"</a>\n </p>\n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n <p class="Rk-Display-Description">'+__e(node.description)+"</p>\n"),__p+=" ",node.image&&options.show_node_tooltip_image&&(__p+='\n <img class="Rk-Display-ImgPreview" src="'+__e(node.image)+'" />\n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/scene.html"]=function(obj){function print(){__p+=__j.call(arguments,"")}obj||(obj={});var __p="",__e=_.escape,__j=Array.prototype.join;with(obj)options.show_top_bar&&(__p+='\n <div class="Rk-TopBar">\n <div class="loader"></div>\n ',__p+=options.editor_mode?'\n <input type="text" class="Rk-PadTitle" value="'+__e(project.get("title")||"")+'" placeholder="'+__e(translate("Untitled project"))+'" />\n ':'\n <h2 class="Rk-PadTitle">\n '+__e(project.get("title")||translate("Untitled project"))+"\n </h2>\n ",__p+="\n ",options.show_user_list&&(__p+='\n <div class="Rk-Users">\n <div class="Rk-CurrentUser">\n ',options.show_user_color&&(__p+='\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-CurrentUser-Color">\n ',options.user_color_editable&&(__p+='\n <span class="Rk-Edit-ColorTip"></span>\n '),__p+="\n </span>\n ",options.user_color_editable&&print(colorPicker),__p+="\n </div>\n "),__p+='\n <span class="Rk-CurrentUser-Name"><unknown user></span>\n </div>\n <ul class="Rk-UserList"></ul>\n </div>\n '),__p+="\n ",options.home_button_url&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Home-Button" href="'+__e(options.home_button_url)+'">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate(options.home_button_title))+"\n </div>\n </div>\n </a>\n "),__p+="\n ",options.show_fullscreen_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-FullScreen-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Full Screen"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.editor_mode?(__p+="\n ",options.show_addnode_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddNode-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Node"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_addedge_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddEdge-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Edge"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_save_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Save-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents"></div>\n </div>\n </div>\n '),__p+="\n ",options.show_open_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Open-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Open Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_bookmarklet&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Renkan 'Drag-to-Add' bookmarklet"))+'\n </div>\n </div>\n </a>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "):(__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+'\n </div>\n </div>\n </div>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "),__p+="\n ",options.show_search_field&&(__p+='\n <form action="#" class="Rk-GraphSearch-Form">\n <input type="search" class="Rk-GraphSearch-Field" placeholder="'+__e(translate("Search in graph"))+'" />\n </form>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n </div>\n"),__p+='\n<div class="Rk-Editing-Space',options.show_top_bar||(__p+=" Rk-Editing-Space-Full"),__p+='">\n <div class="Rk-Labels"></div>\n <canvas class="Rk-Canvas" ',options.resize&&(__p+=' resize="" '),__p+='></canvas>\n <div class="Rk-Notifications"></div>\n <div class="Rk-Editor">\n ',options.show_bins&&(__p+='\n <div class="Rk-Fold-Bins">«</div>\n '),__p+="\n ",options.show_zoom&&(__p+='\n <div class="Rk-ZoomButtons">\n <div class="Rk-ZoomIn" title="'+__e(translate("Zoom In"))+'"></div>\n <div class="Rk-ZoomFit" title="'+__e(translate("Zoom Fit"))+'"></div>\n <div class="Rk-ZoomOut" title="'+__e(translate("Zoom Out"))+'"></div>\n ',options.editor_mode&&options.save_view&&(__p+='\n <div class="Rk-ZoomSave" title="'+__e(translate("Zoom Save"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved zoom"))+'"></div>\n <div class="Rk-ShowHiddenNodes" title="'+__e(translate("Show hidden nodes"))+'"></div>\n '),__p+="\n </div>\n "),__p+="\n </div>\n</div>\n";return __p},this.renkanJST["templates/search.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li class="'+(null==(__t=className)?"":__t)+'" data-key="'+(null==(__t=key)?"":__t)+'">'+(null==(__t=title)?"":__t)+"</li>";return __p},this.renkanJST["templates/wikipedia-bin/resulttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="Wikipedia: '+__e(title)+'"\n data-description="'+__e(description)+'"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/wikipedia.png"))+'">\n\n <img class="Rk-Wikipedia-Icon" src="'+__e(static_url)+'img/wikipedia.png">\n <h4 class="Rk-Wikipedia-Title">\n <a href="'+__e(url)+'" target="_blank">'+(null==(__t=htitle)?"":__t)+'</a>\n </h4>\n <p class="Rk-Wikipedia-Snippet">'+(null==(__t=hdescription)?"":__t)+"</p>\n</li>\n";return __p},function(a){"use strict";"object"!=typeof a.Rkns&&(a.Rkns={});var b=a.Rkns,c=b.$=a.jQuery,d=b._=a._;b.pickerColors=["#8f1919","#a80000","#d82626","#ff0000","#e87c7c","#ff6565","#f7d3d3","#fecccc","#8f5419","#a85400","#d87f26","#ff7f00","#e8b27c","#ffb265","#f7e5d3","#fee5cc","#8f8f19","#a8a800","#d8d826","#feff00","#e8e87c","#feff65","#f7f7d3","#fefecc","#198f19","#00a800","#26d826","#00ff00","#7ce87c","#65ff65","#d3f7d3","#ccfecc","#198f8f","#00a8a8","#26d8d8","#00feff","#7ce8e8","#65feff","#d3f7f7","#ccfefe","#19198f","#0000a8","#2626d8","#0000ff","#7c7ce8","#6565ff","#d3d3f7","#ccccfe","#8f198f","#a800a8","#d826d8","#ff00fe","#e87ce8","#ff65fe","#f7d3f7","#feccfe","#000000","#242424","#484848","#6d6d6d","#919191","#b6b6b6","#dadada","#ffffff"],b.__renkans=[];var e=b._BaseBin=function(a,c){if("undefined"!=typeof a){this.renkan=a,this.renkan.$.find(".Rk-Bin-Main").hide(),this.$=b.$("<li>").addClass("Rk-Bin").appendTo(a.$.find(".Rk-Bin-List")),this.title_icon_$=b.$("<span>").addClass("Rk-Bin-Title-Icon").appendTo(this.$);var d=this;b.$("<a>").attr({href:"#",title:a.translate("Close bin")}).addClass("Rk-Bin-Close").html("×").appendTo(this.$).click(function(){return d.destroy(),a.$.find(".Rk-Bin-Main:visible").length||a.$.find(".Rk-Bin-Main:last").slideDown(),a.resizeBins(),!1}),b.$("<a>").attr({href:"#",title:a.translate("Refresh bin")}).addClass("Rk-Bin-Refresh").appendTo(this.$).click(function(){return d.refresh(),!1}),this.count_$=b.$("<div>").addClass("Rk-Bin-Count").appendTo(this.$),this.title_$=b.$("<h2>").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("<div>").addClass("Rk-Bin-Main").appendTo(this.$).html('<h4 class="Rk-Bin-Loading">'+a.translate("Loading, please wait")+"</h4>"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return'<ul class="Rk-Edit-ColorPicker">'+b.pickerColors.map(function(b){return a({c:b})}).join("")+"</ul>"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageX<c.left+d&&b.pageY>=c.top&&b.pageY<c.top+f)if(j)e.renderer.onMouseMove(b,!0);else{j=!0;var g=document.createElement("div");g.appendChild(this.cloneNode(!0)),e.renderer.dropData({"text/html":g.innerHTML},b),e.renderer.onMouseDown(b,!0)}}).on("touchend",".Rk-Bin-Item",function(a){j&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),j=!1}).on("dragstart",".Rk-Bin-Item",function(a){var b=document.createElement("div");b.appendChild(this.cloneNode(!0));try{a.originalEvent.dataTransfer.setData("text/html",b.innerHTML)}catch(c){a.originalEvent.dataTransfer.setData("text",b.innerHTML)}}),b.$(window).resize(function(){e.resizeBins()});var k=!1,l="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==l){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==k&&(k=c.source,d.each(e.tabs,function(a){a.render(c)}))}}),this.$.find(".Rk-Bins-Search-Form").submit(function(){return!1})};f.prototype.translate=function(a){return b.i18n[this.options.language]&&b.i18n[this.options.language][a]?b.i18n[this.options.language][a]:this.options.language.length>2&&b.i18n[this.options.language.substr(0,2)]&&b.i18n[this.options.language.substr(0,2)][a]?b.i18n[this.options.language.substr(0,2)][a]:a},f.prototype.onStatusChange=function(){this.renderer.onStatusChange()},f.prototype.setSearchEngine=function(a){this.search_engine=this.search_engines[a],this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current "+this.search_engine.getBgClass());for(var b=this.search_engine.getBgClass().split(" "),c="",d=0;d<b.length;d++)c+="."+b[d];this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder",this.translate("Search in ")+this.$.find(".Rk-Search-List "+c).html())
+},f.prototype.resizeBins=function(){var a=+this.$.find(".Rk-Bins-Head").outerHeight();this.$.find(".Rk-Bin-Title:visible").each(function(){a+=b.$(this).outerHeight()}),this.$.find(".Rk-Bin-Main").css({height:this.$.find(".Rk-Bins").height()-a})};var g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})};b.Utils={getUUID4:g,getUID:function(){function a(a){return 10>a?"0"+a:a}var b=new Date,c=0,d=b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1)+"-"+a(b.getUTCDate())+"-"+g();return function(a){for(var b=(++c).toString(16),e="undefined"==typeof a?"":a+"-";b.length<4;)b="0"+b;return e+d+"-"+b}}(),getFullURL:function(a){if("undefined"==typeof a||null==a)return"";if(/https?:\/\//.test(a))return a;var b=new Image;b.src=a;var c=b.src;return b.src=null,c},inherit:function(a,b){var c=function(){"function"==typeof b&&b.apply(this,Array.prototype.slice.call(arguments,0)),a.apply(this,Array.prototype.slice.call(arguments,0)),"function"!=typeof this._init||this._initialized||(this._init.apply(this,Array.prototype.slice.call(arguments,0)),this._initialized=!0)};return d.extend(c.prototype,a.prototype),c},regexpFromTextOrArray:function(){function a(a){function b(a){return function(b,c){a=a.replace(h[b],c)}}for(var e=a.toLowerCase().replace(g,""),i="",j=0;j<e.length;j++){j&&(i+=f+"*");var k=e[j];d.each(c,b(k)),i+=k}return i}function b(c){switch(typeof c){case"string":return a(c);case"object":var e="";return d.each(c,function(a){var c=b(a);c&&(e&&(e+="|"),e+=c)}),e}return""}var c=["[aáàâä]","[cç]","[eéèêë]","[iíìîï]","[oóòôö]","[uùûü]"],e=[String.fromCharCode(768),String.fromCharCode(769),String.fromCharCode(770),String.fromCharCode(771),String.fromCharCode(807),"{","}","(",")","[","]","【","】","、","・","‥","。","「","」","『","』","〜",":","!","?"," ",","," ",";","(",")",".","*","+","\\","?","|","{","}","[","]","^","#","/"],f="[\\"+e.join("\\")+"]",g=new RegExp(f,"gm"),h=d.map(c,function(a){return new RegExp(a)});return function(a){var c=b(a);if(c){var d=new RegExp(c,"im"),e=new RegExp("("+c+")","igm");return{isempty:!1,source:c,test:function(a){return d.test(a)},replace:function(a,b){return a.replace(e,b)}}}return{isempty:!0,source:"",test:function(){return!0},replace:function(){return text}}}}(),_MIN_DRAG_DISTANCE:2,_NODE_BUTTON_WIDTH:40,_EDGE_BUTTON_INNER:2,_EDGE_BUTTON_OUTER:40,_CLICKMODE_ADDNODE:1,_CLICKMODE_STARTEDGE:2,_CLICKMODE_ENDEDGE:3,_NODE_SIZE_STEP:Math.LN2/4,_MIN_SCALE:.05,_MAX_SCALE:20,_MOUSEMOVE_RATE:80,_DOUBLETAP_DELAY:800,_DOUBLETAP_DISTANCE:400,_USER_PLACEHOLDER:function(a){return{color:a.options.default_user_color,title:a.translate("(unknown user)"),get:function(a){return this[a]||!1}}},_BOOKMARKLET_CODE:function(a){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;\">"+a.translate("Drag items from this website, drop them in Renkan").replace(/ /g,"_")+"</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);})();"},shortenText:function(a,b){return a.length>b?a.substr(0,b)+"…":a},drawEditBox:function(a,b,c,d,e){e.css({width:a.tooltip_width-2*a.tooltip_padding});var f=e.outerHeight()+2*a.tooltip_padding,g=b.x<paper.view.center.x?1:-1,h=b.x+g*(d+a.tooltip_arrow_length),i=b.x+g*(d+a.tooltip_arrow_length+a.tooltip_width),j=b.y-f/2;j+f>paper.view.size.height-a.tooltip_margin&&(j=Math.max(paper.view.size.height-a.tooltip_margin,b.y+a.tooltip_arrow_width/2)-f),j<a.tooltip_margin&&(j=Math.min(a.tooltip_margin,b.y-a.tooltip_arrow_width/2));var k=j+f;return c.segments[0].point=c.segments[7].point=b.add([g*d,0]),c.segments[1].point.x=c.segments[2].point.x=c.segments[5].point.x=c.segments[6].point.x=h,c.segments[3].point.x=c.segments[4].point.x=i,c.segments[2].point.y=c.segments[3].point.y=j,c.segments[4].point.y=c.segments[5].point.y=k,c.segments[1].point.y=b.y-a.tooltip_arrow_width/2,c.segments[6].point.y=b.y+a.tooltip_arrow_width/2,c.closed=!0,c.fillColor=new paper.GradientColor(new paper.Gradient([a.tooltip_top_color,a.tooltip_bottom_color]),[0,j],[0,k]),e.css({left:a.tooltip_padding+Math.min(h,i),top:a.tooltip_padding+j}),c},increaseBrightness:function(a,b){a=a.replace(/^\s*#|\s*$/g,""),3===a.length&&(a=a.replace(/(.)/g,"$1$1"));var c=parseInt(a.substr(0,2),16),d=parseInt(a.substr(2,2),16),e=parseInt(a.substr(4,2),16);return"#"+(0|256+c+(256-c)*b/100).toString(16).substr(1)+(0|256+d+(256-d)*b/100).toString(16).substr(1)+(0|256+e+(256-e)*b/100).toString(16).substr(1)}}}(window),function(a){"use strict";var b=a.Rkns.DataLoader={converters:{from1to2:function(a){var b,c;if("undefined"!=typeof a.nodes)for(b=0,c=a.nodes.length;c>b;b++){var d=a.nodes[b];d.color?(console.log("node color : ",d.color),d.style={color:d.color}):d.style={}}if("undefined"!=typeof a.edges)for(b=0,c=a.edges.length;c>b;b++){var e=a.edges[b];e.style=e.color?{color:e.color}:{}}return a.schema_version="2",a}}};b.Loader=function(a,c){this.project=a,this.dataConverters=_.defaults(c.converters||{},b.converters)},b.Loader.prototype.convert=function(a){var b=this.project.getSchemaVersion(a),c=this.project.getSchemaVersion();if(b!==c){var d="from"+b+"to"+c;"function"==typeof this.dataConverters[d]&&(console.log("Apply conversion function :",d),a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){console.log(a),this.project.set(this.convert(a),{validate:!0})}}(window),function(a){"use strict";var b=a.Backbone,c=a.Rkns.Models={};c.getUID=function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)});return"undefined"!=typeof a?a.type+"-"+b:b};{var d=b.RelationalModel.extend({idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"",a.description=a.description||"",a.uri=a.uri||"","function"==typeof this.prepare&&(a=this.prepare(a))),b.RelationalModel.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},addReference:function(a,b,c,d,e){var f=c.get(d);a[b]="undefined"==typeof f&&"undefined"!=typeof e?e:f}}),e=c.User=d.extend({type:"user",prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color")}}}),f=c.Node=d.extend({type:"node",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),position:this.get("position"),image:this.get("image"),style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,size:this.get("size"),clip_path:this.get("clip_path"),shape:this.get("shape"),type:this.get("type")}}}),g=c.Edge=d.extend({type:"edge",relations:[{type:b.HasOne,key:"created_by",relatedModel:e},{type:b.HasOne,key:"from",relatedModel:f},{type:b.HasOne,key:"to",relatedModel:f}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),this.addReference(a,"from",b.get("nodes"),a.from),this.addReference(a,"to",b.get("nodes"),a.to),a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),from:this.get("from")?this.get("from").get("_id"):null,to:this.get("to")?this.get("to").get("_id"):null,style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),h=c.View=d.extend({type:"view",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;if(this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"","undefined"!=typeof a.offset){var c={};Array.isArray(a.offset)?(c.x=a.offset[0],c.y=a.offset.length>1?a.offset[1]:a.offset[0]):null!=a.offset.x&&(c.x=a.offset.x,c.y=a.offset.y),a.offset=c}return a},toJSON:function(){return{_id:this.get("_id"),zoom_level:this.get("zoom_level"),offset:this.get("offset"),title:this.get("title"),description:this.get("description"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,hidden_nodes:this.get("hidden_nodes")}}}),i=(c.Project=d.extend({schema_version:"2",type:"project",blacklist:["saveStatus","loadingStatus"],relations:[{type:b.HasMany,key:"users",relatedModel:e,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"nodes",relatedModel:f,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"edges",relatedModel:g,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"views",relatedModel:h,reverseRelation:{key:"project",includeInJSON:"_id"}}],addUser:function(a,b){a.project=this;var c=e.findOrCreate(a);return this.get("users").push(c,b),c},addNode:function(a,b){a.project=this;var c=f.findOrCreate(a);return this.get("nodes").push(c,b),c},addEdge:function(a,b){a.project=this;var c=g.findOrCreate(a);return this.get("edges").push(c,b),c},addView:function(a,b){a.project=this;var c=h.findOrCreate(a);return this.get("views").push(c,b),c},removeNode:function(a){this.get("nodes").remove(a)},removeEdge:function(a){this.get("edges").remove(a)},validate:function(a){var b=this;_.each([].concat(a.users,a.nodes,a.edges,a.views),function(a){a&&(a.project=b)})},getSchemaVersion:function(a){var b=a;"undefined"==typeof b&&(b=this);var c=b.schema_version;return c?c:1},initialize:function(){var a=this;this.on("remove:nodes",function(b){a.get("edges").remove(a.get("edges").filter(function(a){return a.get("from")===b||a.get("to")===b}))})},toJSON:function(){var a=_.clone(this.attributes);for(var c in a)(a[c]instanceof b.Model||a[c]instanceof b.Collection||a[c]instanceof d)&&(a[c]=a[c].toJSON());return _.omit(a,this.blacklist)}}),c.RosterUser=b.Model.extend({type:"roster_user",idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"(untitled "+this.type+")",a.description=a.description||"",a.uri=a.uri||"",a.project=a.project||null,a.site_id=a.site_id||0,"function"==typeof this.prepare&&(a=this.prepare(a))),b.Model.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color"),project:null!=this.get("project")?this.get("project").get("id"):null,site_id:this.get("site_id")}}}));c.UsersList=b.Collection.extend({model:i})}}(window),Rkns.defaults={language:navigator.language||navigator.userLanguage||"en",container:"renkan",search:[],bins:[],static_url:"",popup_editor:!0,editor_panel:"editor-panel",show_bins:!0,properties:[],show_editor:!0,read_only:!1,editor_mode:!0,manual_save:!1,show_top_bar:!0,default_user_color:"#303030",size_bug_fix:!0,force_resize:!1,allow_double_click:!0,zoom_on_scroll:!0,element_delete_delay:0,autoscale_padding:50,resize:!0,show_zoom:!0,save_view:!0,default_view:!1,show_search_field:!0,show_user_list:!0,user_name_editable:!0,user_color_editable:!0,show_user_color:!0,show_save_button:!0,show_export_button:!0,show_open_button:!1,show_addnode_button:!0,show_addedge_button:!0,show_bookmarklet:!0,show_fullscreen_button:!0,home_button_url:!1,home_button_title:"Home",show_minimap:!0,minimap_width:160,minimap_height:120,minimap_padding:20,minimap_background_color:"#ffffff",minimap_border_color:"#cccccc",minimap_highlight_color:"#ffff00",minimap_highlight_weight:5,buttons_background:"#202020",buttons_label_color:"#c000c0",buttons_label_font_size:9,default_dash_array:[4,5],show_node_circles:!0,clip_node_images:!0,node_images_fill_mode:!1,node_size_base:25,node_stroke_width:2,node_stroke_max_width:12,selected_node_stroke_width:4,selected_node_stroke_max_width:24,node_stroke_witdh_scale:5,node_fill_color:"#ffffff",highlighted_node_fill_color:"#ffff00",node_label_distance:5,node_label_max_length:60,label_untitled_nodes:"(untitled)",change_shapes:!0,edge_stroke_width:2,edge_stroke_max_width:12,selected_edge_stroke_width:4,selected_edge_stroke_max_width:24,edge_stroke_witdh_scale:5,edge_label_distance:0,edge_label_max_length:20,edge_arrow_length:18,edge_arrow_width:12,edge_arrow_max_width:32,edge_gap_in_bundles:12,label_untitled_edges:"",tooltip_width:275,tooltip_padding:10,tooltip_margin:15,tooltip_arrow_length:20,tooltip_arrow_width:40,tooltip_top_color:"#f0f0f0",tooltip_bottom_color:"#d0d0d0",tooltip_border_color:"#808080",tooltip_border_width:1,show_node_editor_uri:!0,show_node_editor_description:!0,show_node_editor_size:!0,show_node_editor_style:!0,show_node_editor_style_color:!0,show_node_editor_style_dash:!0,show_node_editor_style_thickness:!0,show_node_editor_image:!0,show_node_editor_creator:!0,allow_image_upload:!0,uploaded_image_max_kb:500,show_node_tooltip_uri:!0,show_node_tooltip_description:!0,show_node_tooltip_color:!0,show_node_tooltip_image:!0,show_node_tooltip_creator:!0,show_edge_editor_uri:!0,show_edge_editor_style:!0,show_edge_editor_style_color:!0,show_edge_editor_style_dash:!0,show_edge_editor_style_thickness:!0,show_edge_editor_style_arrow:!0,show_edge_editor_direction:!0,show_edge_editor_nodes:!0,show_edge_editor_creator:!0,show_edge_tooltip_uri:!0,show_edge_tooltip_color:!0,show_edge_tooltip_nodes:!0,show_edge_tooltip_creator:!0},Rkns.i18n={fr:{"Edit Node":"Édition d’un nœud","Edit Edge":"Édition d’un lien","Title:":"Titre :","URI:":"URI :","Description:":"Description :","From:":"De :","To:":"Vers :",Image:"Image","Image URL:":"URL d'Image","Choose Image File:":"Choisir un fichier image","Full Screen":"Mode plein écran","Add Node":"Ajouter un nœud","Add Edge":"Ajouter un lien","Save Project":"Enregistrer le projet","Open Project":"Ouvrir un projet","Auto-save enabled":"Enregistrement automatique activé","Connection lost":"Connexion perdue","Created by:":"Créé par :","Zoom In":"Agrandir l’échelle","Zoom Out":"Rapetisser l’échelle",Edit:"Éditer",Remove:"Supprimer","Cancel deletion":"Annuler la suppression","Link to another node":"Créer un lien",Enlarge:"Agrandir",Shrink:"Rétrécir","Click on the background canvas to add a node":"Cliquer sur le fond du graphe pour rajouter un nœud","Click on a first node to start the edge":"Cliquer sur un premier nœud pour commencer le lien","Click on a second node to complete the edge":"Cliquer sur un second nœud pour terminer le lien",Wikipedia:"Wikipédia","Wikipedia in ":"Wikipédia en ",French:"Français",English:"Anglais",Japanese:"Japonais","Untitled project":"Projet sans titre","Lignes de Temps":"Lignes de Temps","Loading, please wait":"Chargement en cours, merci de patienter","Edge color:":"Couleur :","Dash:":"Point. :","Thickness:":"Epaisseur :","Arrow:":"Flèche :","Node color:":"Couleur :","Choose color":"Choisir une couleur","Change edge direction":"Changer le sens du lien","Do you really wish to remove node ":"Voulez-vous réellement supprimer le nœud ","Do you really wish to remove edge ":"Voulez-vous réellement supprimer le lien ","This file is not an image":"Ce fichier n'est pas une image","Image size must be under ":"L'image doit peser moins de ","Size:":"Taille :",KB:"ko","Choose from vocabulary:":"Choisir dans un vocabulaire :","SKOS Documentation properties":"SKOS: Propriétés documentaires","has note":"a pour note","has example":"a pour exemple","has definition":"a pour définition","SKOS Semantic relations":"SKOS: Relations sémantiques","has broader":"a pour concept plus large","has narrower":"a pour concept plus étroit","has related":"a pour concept apparenté","Dublin Core Metadata":"Métadonnées Dublin Core","has contributor":"a pour contributeur",covers:"couvre","created by":"créé par","has date":"a pour date","published by":"édité par","has source":"a pour source","has subject":"a pour sujet","Dragged resource":"Ressource glisée-déposée","Search the Web":"Rechercher en ligne","Search in Bins":"Rechercher dans les chutiers","Close bin":"Fermer le chutier","Refresh bin":"Rafraîchir le chutier","(untitled)":"(sans titre)","Select contents:":"Sélectionner des contenus :","Drag items from this website, drop them in Renkan":"Glissez des éléments de ce site web vers 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.":"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","Shapes available":"Formes disponibles",Circle:"Cercle",Square:"Carré",Diamond:"Losange",Hexagone:"Hexagone",Ellipse:"Ellipse",Star:"Étoile",Cloud:"Nuage",Triangle:"Triangle","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Zoom Save":"Sauver le Zoom","View saved zoom":"Restaurer le Zoom","Renkan 'Drag-to-Add' bookmarklet":"Renkan 'Deplacer-Pour-Ajouter' Signet","(unknown user)":"(non authentifié)","<unknown user>":"<non authentifié>","Search in graph":"Rechercher dans carte","Search in ":"Chercher dans "}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){a.renderer.redrawActive=!1,c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.redrawActive=!0,a.renderer.fixSize()})},e=function(){c.set({saveStatus:2});var d=c.toJSON();a.read_only||Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(d),success:function(){c.set({saveStatus:0})}})},f=Rkns._.throttle(function(){setTimeout(e,100)},1e3);c.on("add:nodes add:edges add:users add:views",function(a){a.on("change remove",function(){f()}),f()}),c.on("change",function(){1===c.changedAttributes.length&&c.hasChanged("saveStatus")||f()}),d()},Rkns.jsonIOSaveOnClick=function(a,b){var c=a.project,d=!1,e=function(){return"Project not saved"};"undefined"==typeof b.http_method&&(b.http_method="POST");var f=function(){var d={},e=/id=([^&#?=]+)/,f=document.location.hash.match(e);f&&(d.id=f[1]),Rkns.$.ajax({url:b.url,data:d,beforeSend:function(){c.set({loadingStatus:!0})},success:function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.autoScale()}})},g=function(){c.set("saved_at",new Date);var a=c.toJSON();Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(a),beforeSend:function(){c.set({saveStatus:2})},success:function(){$(window).off("beforeunload",e),d=!1,c.set({saveStatus:0})}})},h=function(){c.set({saveStatus:1});var a=c.get("title");a&&c.get("nodes").length?$(".Rk-Save-Button").removeClass("disabled"):$(".Rk-Save-Button").addClass("disabled"),a&&$(".Rk-PadTitle").css("border-color","#333333"),d||(d=!0,$(window).on("beforeunload",e))};f(),c.on("add:nodes add:edges add:users change",function(a){a.on("change remove",function(a){1===a.changedAttributes.length&&a.hasChanged("saveStatus")||h()}),1===c.changedAttributes.length&&c.hasChanged("saveStatus")||h()}),a.renderer.save=function(){$(".Rk-Save-Button").hasClass("disabled")?c.get("title")||$(".Rk-PadTitle").css("border-color","#ff0000"):g()}},function(a){"use strict";var b=a._,c=a.Ldt={},d=(c.Bin=function(a,b){if(b.ldt_type){var d=c[b.ldt_type+"Bin"];if(d)return new d(a,b)}console.error("No such LDT Bin Type")},c.ProjectBin=a.Utils.inherit(a._BaseBin));d.prototype.tagTemplate=renkanJST["templates/ldtjson-bin/tagtemplate.html"],d.prototype.annotationTemplate=renkanJST["templates/ldtjson-bin/annotationtemplate.html"],d.prototype._init=function(a,b){this.renkan=a,this.proj_id=b.project_id,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.title_$.html(b.title),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},d.prototype.render=function(c){function d(a){var c=b(a).escape();return f.isempty?c:f.replace(c,"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}var f=c||a.Utils.regexpFromTextOrArray(),g="<li><h3>Tags</h3></li>",h=this.data.meta["dc:title"],i=this,j=0;i.title_$.text('LDT Project: "'+h+'"'),b.map(i.data.tags,function(a){var b=a.meta["dc:title"];(f.isempty||f.test(b))&&(j++,g+=i.tagTemplate({ldt_platform:i.ldt_platform,title:b,htitle:d(b),encodedtitle:encodeURIComponent(b),static_url:i.renkan.options.static_url}))}),g+="<li><h3>Annotations</h3></li>",b.map(i.data.annotations,function(a){var b=a.content.description,c=a.content.title.replace(b,"");if(f.isempty||f.test(c)||f.test(b)){j++;var h=a.end-a.begin,k=a.content&&a.content.img&&a.content.img.src?a.content.img.src:h?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";g+=i.annotationTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(a.begin),end:e(a.end),duration:e(h),mediaid:a.media,annotationid:a.id,image:k,static_url:i.renkan.options.static_url})}}),this.main_$.html(g),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()},d.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/ldt/cljson/id/"+this.proj_id,dataType:"jsonp",success:function(a){b.data=a,b.render()}})};var e=c.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"};e.prototype.getBgClass=function(){return"Rk-Ldt-Icon"},e.prototype.getSearchTitle=function(){return this.renkan.translate("Lignes de Temps")},e.prototype.search=function(a){this.renkan.tabs.push(new f(this.renkan,{search:a}))};var f=c.ResultsBin=a.Utils.inherit(a._BaseBin);f.prototype.segmentTemplate=renkanJST["templates/ldtjson-bin/segmenttemplate.html"],f.prototype._init=function(a,b){this.renkan=a,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.max_results=b.max_results||50,this.search=b.search,this.title_$.html('Lignes de Temps: "'+b.search+'"'),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},f.prototype.render=function(c){function d(a){return g.replace(b(a).escape(),"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}if(this.data){var f=c||a.Utils.regexpFromTextOrArray(),g=f.isempty?a.Utils.regexpFromTextOrArray(this.search):f,h="",i=this,j=0;b.each(this.data.objects,function(a){var b=a["abstract"],c=a.title;if(f.isempty||f.test(c)||f.test(b)){j++;var g=a.duration,k=a.start_ts,l=+a.duration+k,m=g?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";h+=i.segmentTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(k),end:e(l),duration:e(g),mediaid:a.iri_id,annotationid:a.element_id,image:m})}}),this.main_$.html(h),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()}},f.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/api/ldt/1.0/segments/search/",data:{format:"jsonp",q:this.search,limit:this.max_results},dataType:"jsonp",success:function(a){b.data=a,b.render()}})}}(window.Rkns),Rkns.ResourceList={},Rkns.ResourceList.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.ResourceList.Bin.prototype.resultTemplate=renkanJST["templates/list-bin.html"],Rkns.ResourceList.Bin.prototype._init=function(a,b){this.renkan=a,this.title_$.html(b.title),b.list&&(this.data=b.list),this.refresh()},Rkns.ResourceList.Bin.prototype.render=function(a){function b(a){var b=_(a).escape();return c.isempty?b:c.replace(b,"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d="",e=this,f=0;Rkns._.each(this.data,function(a){var g;if("string"==typeof a)if(/^(https?:\/\/|www)/.test(a))g={url:a};else{g={title:a.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,"").trim()};var h=a.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);h&&(g.url=h[0]),g.title.length>80&&(g.description=g.title,g.title=g.title.replace(/^(.{30,60})\s.+$/,"$1…"))}else g=a;var i=g.title||(g.url||"").replace(/^https?:\/\/(www\.)?/,"").replace(/^(.{40}).+$/,"$1…"),j=g.url||"",k=g.description||"",l=g.image||"";j&&!/^https?:\/\//.test(j)&&(j="http://"+j),(c.isempty||c.test(i)||c.test(k))&&(f++,d+=e.resultTemplate({url:j,title:i,htitle:b(i),image:l,description:k,hdescription:b(k),static_url:e.renkan.options.static_url}))}),e.main_$.html(d),!c.isempty&&f?this.count_$.text(f).show():this.count_$.hide(),c.isempty||f?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.ResourceList.Bin.prototype.refresh=function(){this.data&&this.render()},Rkns.Wikipedia={},Rkns.Wikipedia.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"},Rkns.Wikipedia.Search.prototype.getBgClass=function(){return"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-"+this.lang},Rkns.Wikipedia.Search.prototype.getSearchTitle=function(){var a={fr:"French",en:"English",ja:"Japanese"};return a[this.lang]?this.renkan.translate("Wikipedia in ")+this.renkan.translate(a[this.lang]):this.renkan.translate("Wikipedia")+" ["+this.lang+"]"},Rkns.Wikipedia.Search.prototype.search=function(a){this.renkan.tabs.push(new Rkns.Wikipedia.Bin(this.renkan,{lang:this.lang,search:a}))},Rkns.Wikipedia.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.Wikipedia.Bin.prototype.resultTemplate=renkanJST["templates/wikipedia-bin/resulttemplate.html"],Rkns.Wikipedia.Bin.prototype._init=function(a,b){this.renkan=a,this.search=b.search,this.lang=b.lang||"en",this.title_icon_$.addClass("Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-"+this.lang),this.title_$.html(this.search).addClass("Rk-Wikipedia-Title"),this.refresh()},Rkns.Wikipedia.Bin.prototype.render=function(a){function b(a){return d.replace(_(a).escape(),"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d=c.isempty?Rkns.Utils.regexpFromTextOrArray(this.search):c,e="",f=this,g=0;Rkns._.each(this.data.query.search,function(a){var d=a.title,h="http://"+f.lang+".wikipedia.org/wiki/"+encodeURI(d.replace(/ /g,"_")),i=Rkns.$("<div>").html(a.snippet).text();(c.isempty||c.test(d)||c.test(i))&&(g++,e+=f.resultTemplate({url:h,title:d,htitle:b(d),description:i,hdescription:b(i),static_url:f.renkan.options.static_url}))}),f.main_$.html(e),!c.isempty&&g?this.count_$.text(g).show():this.count_$.hide(),c.isempty||g?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.Wikipedia.Bin.prototype.refresh=function(){var a=this;Rkns.$.ajax({url:"http://"+a.lang+".wikipedia.org/w/api.php?action=query&list=search&srsearch="+encodeURIComponent(this.search)+"&format=json",dataType:"jsonp",success:function(b){a.data=b,a.render()}})},define("renderer/baserepresentation",["jquery","underscore"],function(a,b){var c=function(a,c){if("undefined"!=typeof a&&(this.renderer=a,this.renkan=a.renkan,this.project=a.renkan.project,this.options=a.renkan.options,this.model=c,this.model)){var d=this;this._changeBinding=function(){d.redraw({change:!0})},this._removeBinding=function(){a.removeRepresentation(d),b.defer(function(){a.redraw()})},this._selectBinding=function(){d.select()},this._unselectBinding=function(){d.unselect()},this.model.on("change",this._changeBinding),this.model.on("remove",this._removeBinding),this.model.on("select",this._selectBinding),this.model.on("unselect",this._unselectBinding)}};return b(c.prototype).extend({_super:function(a){return c.prototype[a].apply(this,Array.prototype.slice.call(arguments,1))},redraw:function(){},moveTo:function(){},show:function(){return"BaseRepresentation.show"},hide:function(){},select:function(){this.model&&this.model.trigger("selected")},unselect:function(){this.model&&this.model.trigger("unselected")},highlight:function(){},unhighlight:function(){},mousedown:function(){},mouseup:function(){this.model&&this.model.trigger("clicked")},destroy:function(){this.model&&(this.model.off("change",this._changeBinding),this.model.off("remove",this._removeBinding),this.model.off("select",this._selectBinding),this.model.off("unselect",this._unselectBinding))}}).value(),c}),define("requtils",[],function(){return{getUtils:function(){return window.Rkns.Utils},getRenderer:function(){return window.Rkns.Renderer}}}),define("renderer/basebutton",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({moveTo:function(a){this.sector.moveTo(a)},show:function(){this.sector.show()},hide:function(){this.sector.hide()},select:function(){this.sector.select()},unselect:function(a){this.sector.unselect(),(!a||a!==this.source_representation&&a.source_representation!==this.source_representation)&&this.source_representation.unselect()},destroy:function(){this.sector.destroy()}}).value(),f}),define("renderer/shapebuilder",[],function(){var a="M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z",b={circle:{getShape:function(){return new paper.Path.Circle([0,0],1)
+},getImageShape:function(a,b){return new paper.Path.Circle(a,b)}},rectangle:{getShape:function(){return new paper.Path.Rectangle([-2,-2],[2,2])},getImageShape:function(a,b){return new paper.Path.Rectangle([-b,-b],[2*b,2*b])}},ellipse:{getShape:function(){return new paper.Path.Ellipse(new paper.Rectangle([-2,-1],[2,1]))},getImageShape:function(a,b){return new paper.Path.Ellipse(new paper.Rectangle([-b,-b/2],[2*b,b]))}},polygon:{getShape:function(){return new paper.Path.RegularPolygon([0,0],6,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,6,b)}},diamond:{getShape:function(){var a=new paper.Path.Rectangle([-Math.SQRT2,-Math.SQRT2],[Math.SQRT2,Math.SQRT2]);return a.rotate(45),a},getImageShape:function(a,b){var c=new paper.Path.Rectangle([-b*Math.SQRT2/2,-b*Math.SQRT2/2],[b*Math.SQRT2,b*Math.SQRT2]);return c.rotate(45),c}},star:{getShape:function(){return new paper.Path.Star([0,0],8,1,.7)},getImageShape:function(a,b){return new paper.Path.Star(a,8,1*b,.7*b)}},cloud:{getShape:function(){var b=new paper.Path(a);return b},getImageShape:function(b,c){var d=new paper.Path(a);return d.scale(c),d.translate(b),d}},triangle:{getShape:function(){return new paper.Path.RegularPolygon([0,0],3,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,3,b)}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(){return new paper.Path}}}},c=function(a){return(null===a||"undefined"==typeof a)&&(a="circle"),"svg:"===a.substr(0,4)?b.svg(a.substr(4)):(a in b||(a="circle"),b[a])};return c.builders=b,c}),define("renderer/noderepr",["jquery","underscore","requtils","renderer/baserepresentation","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){if(this.renderer.node_layer.activate(),this.type="Node",this.buildShape(),this.hidden=!1,this.ghost=!1,this.options.show_node_circles?(this.circle.strokeWidth=this.options.node_stroke_width,this.h_ratio=1):this.h_ratio=0,this.title=a('<div class="Rk-Label">').appendTo(this.renderer.labels_$),this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.NodeEditButton(this.renderer,null),new b.NodeRemoveButton(this.renderer,null),new b.NodeHideButton(this.renderer,null),new b.NodeShowButton(this.renderer,null),new b.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.pending_delete_buttons=[new b.NodeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.last_circle_radius=1,this.renderer.minimap&&(this.renderer.minimap.node_layer.activate(),this.minimap_circle=new paper.Path.Circle([0,0],1),this.minimap_circle.__representation=this.renderer.minimap.miniframe.__representation,this.renderer.minimap.node_group.addChild(this.minimap_circle))},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.node_stroke_width+(a-1)*(this.options.node_stroke_max_width-this.options.node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_node_stroke_width+(a-1)*(this.options.selected_node_stroke_max_width-this.options.selected_node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},buildShape:function(){"shape"in this.model.changed&&delete this.img,this.circle&&(this.circle.remove(),delete this.circle),this.shapeBuilder=new e(this.model.get("shape")),this.circle=this.shapeBuilder.getShape(),this.circle.__representation=this,this.circle.sendToBack(),this.last_circle_radius=1},redraw:function(a){"shape"in this.model.changed&&"change"in a&&a.change&&this.buildShape();var c=new paper.Point(this.model.get("position")),d=this.options.node_size_base*Math.exp((this.model.get("size")||0)*f._NODE_SIZE_STEP);this.is_dragging&&this.paper_coords||(this.paper_coords=this.renderer.toPaperCoords(c)),this.circle_radius=d*this.renderer.scale,this.last_circle_radius!==this.circle_radius&&(this.all_buttons.forEach(function(a){a.setSectorSize()}),this.circle.scale(this.circle_radius/this.last_circle_radius),this.node_image&&this.node_image.scale(this.circle_radius/this.last_circle_radius)),this.circle.position=this.paper_coords,this.node_image&&(this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius))),this.last_circle_radius=this.circle_radius;var e=this.active_buttons,g=1;this.model.get("delete_scheduled")?(g=.5,this.active_buttons=this.pending_delete_buttons,this.circle.dashArray=[2,2]):(g=1,this.active_buttons=this.normal_buttons,this.circle.dashArray=null),this.selected&&this.renderer.isEditable()&&!this.ghost&&(e!==this.active_buttons&&e.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.node_image&&(this.node_image.opacity=this.highlighted?.5*g:g-.01),this.circle.fillColor=this.highlighted?this.options.highlighted_node_fill_color:this.options.node_fill_color,this.circle.opacity=this.options.show_node_circles?g:.01;var h=this.model.get("title")||this.renkan.translate(this.options.label_untitled_nodes)||"";h=f.shortenText(h,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(h).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(h);var i=this._getStrokeWidth();this.title.css({left:this.paper_coords.x,top:this.paper_coords.y+this.circle_radius*this.h_ratio+this.options.node_label_distance+.5*i,opacity:g});var j=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),k=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=i,this.circle.strokeColor=j,this.circle.dashArray=k;var l=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(l)});var m=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==m&&(this.showImage(),this.circle&&this.circle.sendToBack()),this.node_image&&!this.img&&(this.node_image.remove(),delete this.node_image),this.renderer.minimap){this.minimap_circle.fillColor=j;var n=this.renderer.toMinimapCoords(c),o=this.renderer.minimap.scale*d,p=new paper.Size([o,o]);this.minimap_circle.fitBounds(n.subtract(p),p.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var q=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===q.model||a.get("from")===q.model}),function(a){var b=q.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.redraw()})}this.ghost?this.show(!0):this.hidden&&this.hide()},showImage:function(){var b=null;if("undefined"==typeof this.renderer.image_cache[this.img]?(b=new Image,this.renderer.image_cache[this.img]=b,b.src=this.img):b=this.renderer.image_cache[this.img],b.width){this.node_image&&this.node_image.remove(),this.renderer.node_layer.activate();var c=b.width,d=b.height,e=this.model.get("clip_path"),f="undefined"!=typeof e&&e,g=null,h=null,i=null;if(f){g=new paper.Path;var j=e.match(/[a-z][^a-z]+/gi)||[],k=[0,0],l=1/0,m=1/0,n=-1/0,o=-1/0,p=function(a,b){var e=a.slice(1).map(function(a,e){var f=parseFloat(a),g=e%2;return f=g?(f-.5)*d:(f-.5)*c,b&&(f+=k[g]),g?(m=Math.min(m,f),o=Math.max(o,f)):(l=Math.min(l,f),n=Math.max(n,f)),f});return k=e.slice(-2),e};j.forEach(function(a){var b=a.match(/([a-z]|[0-9.-]+)/gi)||[""];switch(b[0]){case"M":g.moveTo(p(b));break;case"m":g.moveTo(p(b,!0));break;case"L":g.lineTo(p(b));break;case"l":g.lineTo(p(b,!0));break;case"C":g.cubicCurveTo(p(b));break;case"c":g.cubicCurveTo(p(b,!0));break;case"Q":g.quadraticCurveTo(p(b));break;case"q":g.quadraticCurveTo(p(b,!0))}}),h=Math[this.options.node_images_fill_mode?"min":"max"](n-l,o-m)/2,i=new paper.Point((n+l)/2,(o+m)/2),this.options.show_node_circles||(this.h_ratio=(o-m)/(2*h))}else h=Math[this.options.node_images_fill_mode?"min":"max"](c,d)/2,i=new paper.Point(0,0),this.options.show_node_circles||(this.h_ratio=d/(2*h));var q=new paper.Raster(b);if(q.locked=!0,f&&(q=new paper.Group(g,q),q.opacity=.99,q.clipped=!0,g.__representation=this),this.options.clip_node_images){var r=this.shapeBuilder.getImageShape(i,h);q=new paper.Group(r,q),q.opacity=.99,q.clipped=!0,r.__representation=this}this.image_delta=i.divide(h),this.node_image=q,this.node_image.__representation=s,this.node_image.scale(this.circle_radius/h),this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)),this.node_image.insertAbove(this.circle)}else{var s=this;a(b).on("load",function(){s.showImage()})}},paperShift:function(a){this.options.editor_mode?this.renkan.read_only||(this.is_dragging=!0,this.paper_coords=this.paper_coords.add(a),this.redraw()):this.renderer.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.circle.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&!this.hidden&&this.active_buttons.forEach(function(a){a.show()});var b=this.model.get("uri");b&&a(".Rk-Bin-Item").each(function(){var c=a(this);c.attr("data-uri")===b&&c.addClass("selected")}),this.options.editor_mode||this.openEditor(),this.renderer.minimap&&(this.minimap_circle.strokeWidth=this.options.minimap_highlight_weight,this.minimap_circle.strokeColor=this.options.minimap_highlight_color),this.hidden?this.show(!0):this.showNeighbors(!0),this._super("select")},hideButtons:function(){this.all_buttons.forEach(function(a){a.hide()}),delete this.buttonTimeout},unselect:function(b){if(!b||b.source_representation!==this){this.selected=!1;var c=this;this.buttons_timeout=setTimeout(function(){c.hideButtons()},200),this.circle.strokeWidth=this._getStrokeWidth(),a(".Rk-Bin-Item").removeClass("selected"),this.renderer.minimap&&(this.minimap_circle.strokeColor=void 0),this.hidden?this.hide():this.hideNeighbors(),this._super("unselect")}},hide:function(){var a=this;this.ghost=!1,this.hidden=!0,"undefined"!=typeof this.node_image&&(this.node_image.opacity=0),this.hideButtons(),this.circle.opacity=0,this.title.css("opacity",0),this.minimap_circle.opacity=0,b.each(this.project.get("edges").filter(function(b){return b.get("to")===a.model||b.get("from")===a.model}),function(b){var c=a.renderer.getRepresentationByModel(b);c&&"undefined"!=typeof c.from_representation&&"undefined"!=typeof c.from_representation.paper_coords&&"undefined"!=typeof c.to_representation&&"undefined"!=typeof c.to_representation.paper_coords&&c.hide()}),this.hideNeighbors()},show:function(a){var c=this;this.ghost=a,this.ghost?("undefined"!=typeof this.node_image&&(this.node_image.opacity=.3),this.circle.opacity=.3,this.title.css("opacity",.3),this.minimap_circle.opacity=.3):(this.hidden=!1,this.redraw()),b.each(this.project.get("edges").filter(function(a){return a.get("to")===c.model||a.get("from")===c.model}),function(a){var b=c.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.show(c.ghost)})},hideNeighbors:function(){var a=this;b.each(this.project.get("edges").filter(function(b){return b.get("from")===a.model}),function(b){var c=a.renderer.getRepresentationByModel(b.get("to"));c&&c.ghost&&c.hide()})},showNeighbors:function(a){var c=this;b.each(this.project.get("edges").filter(function(a){return a.get("from")===c.model}),function(b){var d=c.renderer.getRepresentationByModel(b.get("to"));if(d&&d.hidden&&(d.show(a),!a)){var e=c.renderer.hiddenNodes.indexOf(d.model.id);-1!==e&&c.renderer.hiddenNodes.splice(e,1)}})},highlight:function(a){var b=a||!0;this.highlighted!==b&&(this.highlighted=b,this.redraw(),this.renderer.throttledPaperDraw())},unhighlight:function(){this.highlighted&&(this.highlighted=!1,this.redraw(),this.renderer.throttledPaperDraw())},saveCoords:function(){var a=this.renderer.toModelCoords(this.paper_coords),b={position:{x:a.x,y:a.y}};this.renderer.isEditable()&&this.model.set(b)},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){if(this.renderer.is_dragging&&this.renderer.isEditable())this.saveCoords();else if(this.hidden){var c=this.renderer.hiddenNodes.indexOf(this.model.id);-1!==c&&this.renderer.hiddenNodes.splice(c,1),this.show(!1),this.select()}else b||this.model.get("delete_scheduled")||this.openEditor(),this.model.trigger("clicked");this.renderer.click_target=null,this.renderer.is_dragging=!1,this.is_dragging=!1},destroy:function(){this._super("destroy"),this.all_buttons.forEach(function(a){a.destroy()}),this.circle.remove(),this.title.remove(),this.renderer.minimap&&this.minimap_circle.remove(),this.node_image&&this.node_image.remove()}}).value(),g}),define("renderer/edge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){if(this.renderer.edge_layer.activate(),this.type="Edge",this.hidden=!1,this.ghost=!1,this.from_representation=this.renderer.getRepresentationByModel(this.model.get("from")),this.to_representation=this.renderer.getRepresentationByModel(this.model.get("to")),this.bundle=this.renderer.addToBundles(this),this.line=new paper.Path,this.line.add([0,0],[0,0],[0,0]),this.line.__representation=this,this.line.strokeWidth=this.options.edge_stroke_width,this.arrow_scale=1,this.arrow=new paper.Path,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.pivot=new paper.Point([this.options.edge_arrow_length/2,this.options.edge_arrow_width/2]),this.arrow.__representation=this,this.text=a('<div class="Rk-Label Rk-Edge-Label">').appendTo(this.renderer.labels_$),this.arrow_angle=0,this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.EdgeEditButton(this.renderer,null),new b.EdgeRemoveButton(this.renderer,null)],this.pending_delete_buttons=[new b.EdgeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.renderer.minimap&&(this.renderer.minimap.edge_layer.activate(),this.minimap_line=new paper.Path,this.minimap_line.add([0,0],[0,0]),this.minimap_line.__representation=this.renderer.minimap.miniframe.__representation,this.minimap_line.strokeWidth=1)},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.edge_stroke_width+(a-1)*(this.options.edge_stroke_max_width-this.options.edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_edge_stroke_width+(a-1)*(this.options.selected_edge_stroke_max_width-this.options.selected_edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getArrowScale:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return 1+(a-1)*(this.options.edge_arrow_max_width/this.options.edge_arrow_width-1)/(this.options.edge_stroke_witdh_scale-1)},redraw:function(){var a=this.model.get("from"),b=this.model.get("to");if(a&&b&&(!this.hidden||this.ghost)){if(this.from_representation=this.renderer.getRepresentationByModel(a),this.to_representation=this.renderer.getRepresentationByModel(b),"undefined"==typeof this.from_representation||"undefined"==typeof this.to_representation||this.from_representation.hidden&&!this.from_representation.ghost||this.to_representation.hidden&&!this.to_representation.ghost)return void this.hide();var c=this._getStrokeWidth(),d=this._getArrowScale(),f=this.from_representation.paper_coords,g=this.to_representation.paper_coords,h=g.subtract(f),i=h.length,j=h.divide(i),k=new paper.Point([-j.y,j.x]),l=this.bundle.getPosition(this),m=k.multiply(this.options.edge_gap_in_bundles*l),n=f.add(m),o=g.add(m),p=h.angle,q=k.multiply(this.options.edge_label_distance+.5*d*this.options.edge_arrow_width),r=h.divide(3),s=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),t=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null,u=1;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(u=.5,this.line.dashArray=[2,2]):(u=1,this.line.dashArray=null);var v=this.active_buttons,w=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow?u:0;this.active_buttons=this.model.get("delete_scheduled")?this.pending_delete_buttons:this.normal_buttons,this.selected&&this.renderer.isEditable()&&v!==this.active_buttons&&(v.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.paper_coords=n.add(o).divide(2),this.line.strokeWidth=c,this.line.strokeColor=s,this.line.dashArray=t,this.line.opacity=this.ghost?.3:u,this.line.segments[0].point=f,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=r.multiply(-1),this.line.segments[1].handleOut=r,this.line.segments[2].point=g,this.arrow.scale(d/this.arrow_scale),this.arrow_scale=d,this.arrow.fillColor=s,this.arrow.opacity=this.ghost?.3:w,this.arrow.rotate(p-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=p,p>90&&(p-=180,q=q.multiply(-1)),-90>p&&(p+=180,q=q.multiply(-1));var x=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";x=e.shortenText(x,this.options.node_label_max_length),this.text.text(x);var y=this.paper_coords.add(q);this.text.css({left:y.x,top:y.y,transform:"rotate("+p+"deg)","-moz-transform":"rotate("+p+"deg)","-webkit-transform":"rotate("+p+"deg)",opacity:this.ghost?.3:u}),this.text_angle=p;var z=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(z)}),this.renderer.minimap&&(this.minimap_line.strokeColor=s,this.minimap_line.segments[0].point=this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get("position"))),this.minimap_line.segments[1].point=this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position"))))}},hide:function(){this.hidden=!0,this.ghost=!1,this.text.hide(),this.line.visible=!1,this.arrow.visible=!1,this.minimap_line.visible=!1},show:function(a){this.ghost=a,this.ghost?(this.text.css("opacity",.3),this.line.opacity=.3,this.arrow.opacity=.3,this.minimap_line.opacity=.3):(this.hidden=!1,this.text.css("opacity",1),this.line.opacity=1,this.arrow.opacity=1,this.minimap_line.opacity=1),this.text.show(),this.line.visible=!0,this.arrow.visible=!0,this.minimap_line.visible=!0,this.redraw()},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("EdgeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.line.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()}),this.options.editor_mode||this.openEditor(),this._super("select")},unselect:function(a){a&&a.source_representation===this||(this.selected=!1,this.options.editor_mode&&this.all_buttons.forEach(function(a){a.hide()}),this.line.strokeWidth=this._getStrokeWidth(),this._super("unselect"))},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){!this.renkan.read_only&&this.renderer.is_dragging?(this.from_representation.saveCoords(),this.to_representation.saveCoords(),this.from_representation.is_dragging=!1,this.to_representation.is_dragging=!1):(b||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1},paperShift:function(a){this.options.editor_mode?this.options.read_only||(this.from_representation.paperShift(a),this.to_representation.paperShift(a)):this.renderer.paperShift(a)},destroy:function(){this._super("destroy"),this.line.remove(),this.arrow.remove(),this.text.remove(),this.renderer.minimap&&this.minimap_line.remove(),this.all_buttons.forEach(function(a){a.destroy()});var a=this;this.bundle.edges=b.reject(this.bundle.edges,function(b){return a===b})}}).value(),f}),define("renderer/tempedge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.edge_layer.activate(),this.type="Temp-edge";var a=(this.project.get("users").get(this.renkan.current_user)||e._USER_PLACEHOLDER(this.renkan)).get("color");this.line=new paper.Path,this.line.strokeColor=a,this.line.dashArray=[4,2],this.line.strokeWidth=this.options.selected_edge_stroke_width,this.line.add([0,0],[0,0]),this.line.__representation=this,this.arrow=new paper.Path,this.arrow.fillColor=a,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.arrow_angle=0},redraw:function(){var a=this.from_representation.paper_coords,b=this.end_pos,c=b.subtract(a).angle,d=a.add(b).divide(2);this.line.segments[0].point=a,this.line.segments[1].point=b,this.arrow.rotate(c-this.arrow_angle),this.arrow.position=d,this.arrow_angle=c},paperShift:function(a){if(!this.renderer.isEditable())return this.renderer.removeRepresentation(_this),void paper.view.draw();this.end_pos=this.end_pos.add(a);var b=paper.project.hitTest(this.end_pos);this.renderer.findTarget(b),this.redraw()},mouseup:function(a){var b=paper.project.hitTest(a.point),c=this.from_representation.model,d=!0;if(b&&"undefined"!=typeof b.item.__representation){var f=b.item.__representation;if("Node"===f.type.substr(0,4)){var g=f.model||f.source_representation.model;if(c!==g){var h={id:e.getUID("edge"),created_by:this.renkan.current_user,from:c,to:g};this.renderer.isEditable()&&this.project.addEdge(h)}}(c===f.model||f.source_representation&&f.source_representation.model===c)&&(d=!1,this.renderer.is_dragging=!0)}d&&(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentation(this),paper.view.draw())},destroy:function(){this.arrow.remove(),this.line.remove()}}).value(),f}),define("renderer/baseeditor",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.buttons_layer.activate(),this.type="editor",this.editor_block=new paper.Path;var c=b.map(b.range(8),function(){return[0,0]});this.editor_block.add.apply(this.editor_block,c),this.editor_block.strokeWidth=this.options.tooltip_border_width,this.editor_block.strokeColor=this.options.tooltip_border_color,this.editor_block.opacity=.8,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:.8}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/nodeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/nodeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("created_by")||f._USER_PLACEHOLDER(this.renkan),g=this.renderer.isEditable()?this.template:this.readOnlyTemplate,h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:f.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),image:c.get("image")||"",image_placeholder:h,color:c.has("style")&&c.get("style").color||d.get("color"),thickness:c.has("style")&&c.get("style").thickness||1,dash:c.has("style")&&c.get("style").dash?"checked":"",clip_path:c.get("clip_path")||!1,created_by_color:d.get("color"),created_by_title:d.get("title"),size:(i>0?"+":"")+i,shape:c.get("shape")||"circle"},renkan:this.renkan,options:this.options,shortenText:f.shortenText,shapes:b(e.builders).omit("svg").keys().value()})),this.redraw();var j=this,k=function(){j.editor_$.off("keyup"),j.editor_$.find("input, textarea, select").off("change keyup paste"),j.editor_$.find(".Rk-Edit-Image-File").off("change"),j.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off("hover"),j.editor_$.find(".Rk-Edit-Size-Btn").off("click"),j.editor_$.find(".Rk-Edit-Image-Del").off("click"),j.editor_$.find(".Rk-Edit-ColorPicker").find("li").off("hover click"),j.editor_$.find(".Rk-CloseX").off("click"),j.editor_$.find(".Rk-Edit-Goto").off("click"),j.renderer.removeRepresentation(j),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(k),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var l=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={title:j.editor_$.find(".Rk-Edit-Title").val()};if(j.options.show_node_editor_uri&&(a.uri=j.editor_$.find(".Rk-Edit-URI").val(),j.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#")),j.options.show_node_editor_image&&(a.image=j.editor_$.find(".Rk-Edit-Image").val(),j.editor_$.find(".Rk-Edit-ImgPreview").attr("src",a.image||h)),j.options.show_node_editor_description&&(a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_style){var d=j.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d})}j.options.change_shapes&&c.get("shape")!==j.editor_$.find(".Rk-Edit-Shape").val()&&(a.shape=j.editor_$.find(".Rk-Edit-Shape").val()),c.set(a),j.redraw()}else k()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&k()}),this.editor_$.find("input, textarea, select").on("change keyup paste",l),j.options.allow_image_upload&&this.editor_$.find(".Rk-Edit-Image-File").change(function(){if(this.files.length){var a=this.files[0],b=new FileReader;if("image"!==a.type.substr(0,5))return void alert(j.renkan.translate("This file is not an image"));if(a.size>1024*j.options.uploaded_image_max_kb)return void alert(j.renkan.translate("Image size must be under ")+j.options.uploaded_image_max_kb+j.renkan.translate("KB"));b.onload=function(a){j.editor_$.find(".Rk-Edit-Image").val(a.target.result),l()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var m=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),m.show()},function(a){a.preventDefault(),m.hide()}),m.find("li").hover(function(b){b.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||f._USER_PLACEHOLDER(j.renkan)).get("color"))}).click(function(d){d.preventDefault(),j.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),m.hide(),paper.view.draw()):k()});var n=function(a){if(j.renderer.isEditable()){var b=a+(c.get("size")||0);j.editor_$.find("#Rk-Edit-Size-Value").text((b>0?"+":"")+b),c.set("size",b),paper.view.draw()}else k()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return n(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return n(1),!1});var o=function(a){if(j.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>j.options.node_stroke_witdh_scale&&(e=j.options.node_stroke_witdh_scale),e!==d&&(j.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else k()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return o(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return o(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),l(),!1})}else if("object"==typeof this.source_representation.highlighted){var p=this.source_representation.highlighted.replace(b(c.get("title")).escape(),'<span class="Rk-Highlighted">$1</span>');this.editor_$.find(".Rk-Display-Title"+(c.get("uri")?" a":"")).html(p),this.options.show_node_tooltip_description&&this.editor_$.find(".Rk-Display-Description").html(this.source_representation.highlighted.replace(b(c.get("description")).escape(),'<span class="Rk-Highlighted">$1</span>'))}this.editor_$.find("img").load(function(){j.redraw()})},redraw:function(){if(this.options.popup_editor){var a=this.source_representation.paper_coords;f.drawEditBox(this.options,a,this.editor_block,.75*this.source_representation.circle_radius,this.editor_$)}this.editor_$.show(),paper.view.draw()}}).value(),g}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/edgeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/edgeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("from"),f=c.get("to"),g=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),h=this.renderer.isEditable()?this.template:this.readOnlyTemplate;this.editor_$.html(h({edge:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),color:c.has("style")&&c.get("style").color||g.get("color"),dash:c.has("style")&&c.get("style").dash?"checked":"",arrow:c.has("style")&&c.get("style").arrow||!c.has("style")||"undefined"==typeof c.get("style").arrow?"checked":"",thickness:c.has("style")&&c.get("style").thickness||1,from_title:d.get("title"),to_title:f.get("title"),from_color:d.has("style")&&d.get("style").color||(d.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),to_color:f.has("style")&&f.get("style").color||(f.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),created_by_color:g.get("color"),created_by_title:g.get("title")},renkan:this.renkan,shortenText:e.shortenText,options:this.options})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),i.editor_$.find(".Rk-Edit-Size-Btn").off("click"),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b.throttle(function(){b.defer(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};if(i.options.show_edge_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val()),i.options.show_node_editor_style){var d=i.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d});var e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");
+a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{arrow:e})}i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#"),c.set(a),paper.view.draw()}else j()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input").on("keyup change paste",k),this.editor_$.find(".Rk-Edit-Vocabulary").change(function(){var b=a(this),c=b.val();c&&(i.editor_$.find(".Rk-Edit-Title").val(b.find(":selected").text()),i.editor_$.find(".Rk-Edit-URI").val(c),k())}),this.editor_$.find(".Rk-Edit-Direction").click(function(){i.renderer.isEditable()?(c.set({from:c.get("to"),to:c.get("from")}),i.draw()):j()});var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(d){d.preventDefault(),i.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),l.hide(),paper.view.draw()):j()});var m=function(a){if(i.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>i.options.node_stroke_witdh_scale&&(e=i.options.node_stroke_witdh_scale),e!==d&&(i.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else j()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return m(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return m(1),!1})}},redraw:function(){if(this.options.popup_editor){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,5,this.editor_$)}this.editor_$.show(),paper.view.draw()}}).value(),f}),define("renderer/nodebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({setSectorSize:function(){var a=this.source_representation.circle_radius;a!==this.lastSectorInner&&(this.sector&&this.sector.destroy(),this.sector=this.renderer.drawSector(this,1+a,e._NODE_BUTTON_WIDTH+a,this.startAngle,this.endAngle,1,this.imageName,this.renkan.translate(this.text)),this.lastSectorInner=a)},unselect:function(){d.prototype.unselect.apply(this,Array.prototype.slice.call(arguments,1)),this.source_representation&&this.source_representation.buttons_timeout&&(clearTimeout(this.source_representation.buttons_timeout),this.source_representation.hideButtons())},select:function(){this.source_representation&&this.source_representation.buttons_timeout&&clearTimeout(this.source_representation.buttons_timeout),this.sector.select()}}).value(),f}),define("renderer/nodeeditbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-edit-button",this.lastSectorInner=0,this.startAngle=-125,this.endAngle=-55,this.imageName="edit",this.text="Edit"},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/noderemovebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-remove-button",this.lastSectorInner=0,this.startAngle=-10,this.endAngle=45,this.imageName="remove",this.text="Remove"},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove node ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeNode(this.source_representation.model)}}).value(),f}),define("renderer/nodehidebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-hide-button",this.lastSectorInner=0,this.startAngle=45,this.endAngle=90,this.imageName="hide",this.text="Hide"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable()&&this.renderer.addHiddenNode(this.source_representation.model)}}).value(),f}),define("renderer/nodeshowbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-show-button",this.lastSectorInner=0,this.startAngle=90,this.endAngle=135,this.imageName="show",this.text="Show"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable()&&this.source_representation.showNeighbors(!1)}}).value(),f}),define("renderer/noderevertbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-revert-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=135,this.imageName="revert",this.text="Cancel deletion"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/nodelinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-link-button",this.lastSectorInner=0,this.startAngle=135,this.endAngle=190,this.imageName="link",this.text="Link to another node"},mousedown:function(a){if(this.renderer.isEditable()){var b=this.renderer.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,c)}}}).value(),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-enlarge-button",this.lastSectorInner=0,this.startAngle=-55,this.endAngle=-10,this.imageName="enlarge",this.text="Enlarge"},mouseup:function(){var a=1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/nodeshrinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-shrink-button",this.lastSectorInner=0,this.startAngle=-170,this.endAngle=-125,this.imageName="shrink",this.text="Shrink"},mouseup:function(){var a=-1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/edgeeditbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-edit-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-270,-90,1,"edit",this.renkan.translate("Edit"))},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/edgeremovebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-remove-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-90,90,1,"remove",this.renkan.translate("Remove"))},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove edge ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeEdge(this.source_representation.model)}}).value(),f}),define("renderer/edgerevertbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-revert-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-135,135,1,"revert",this.renkan.translate("Cancel deletion"))},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/miniframe",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({paperShift:function(a){this.renderer.offset=this.renderer.offset.subtract(a.divide(this.renderer.minimap.scale).multiply(this.renderer.scale)),this.renderer.redraw()},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1}}).value(),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe"],function(a,b,c,d,e){var f=d.getUtils(),g=function(c){this.renkan=c,this.$=a(".Rk-Render"),this.representations=[],this.$.html(c.options.templates["templates/scene.html"](c)),this.onStatusChange(),this.canvas_$=this.$.find(".Rk-Canvas"),this.labels_$=this.$.find(".Rk-Labels"),this.editor_$=c.options.popup_editor?this.$.find(".Rk-Editor"):a("#"+c.options.editor_panel),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.totalScroll=0,this.hiddenNodes=[],this.mouse_down=!1,this.click_target=null,this.selected_target=null,this.edge_layer=new paper.Layer,this.node_layer=new paper.Layer,this.buttons_layer=new paper.Layer,this.delete_list=[],this.redrawActive=!0,c.options.show_minimap&&(this.minimap={background_layer:new paper.Layer,edge_layer:new paper.Layer,node_layer:new paper.Layer,node_group:new paper.Group,size:new paper.Size(c.options.minimap_width,c.options.minimap_height)},this.minimap.background_layer.activate(),this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle=new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.rectangle.fillColor=c.options.minimap_background_color,this.minimap.rectangle.strokeColor=c.options.minimap_border_color,this.minimap.rectangle.strokeWidth=4,this.minimap.offset=new paper.Point(this.minimap.size.divide(2)),this.minimap.scale=.1,this.minimap.node_layer.activate(),this.minimap.cliprectangle=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.cliprectangle),this.minimap.node_group.clipped=!0,this.minimap.miniframe=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.miniframe),this.minimap.miniframe.fillColor="#c0c0ff",this.minimap.miniframe.opacity=.3,this.minimap.miniframe.strokeColor="#000080",this.minimap.miniframe.strokeWidth=2,this.minimap.miniframe.__representation=new e(this,null)),this.throttledPaperDraw=b(function(){paper.view.draw()}).throttle(100).value(),this.bundles=[],this.click_mode=!1;var d=this,g=!0,h=1,i=!1,j=0,k=0;this.image_cache={},this.icon_cache={},["edit","remove","hide","show","link","enlarge","shrink","revert"].forEach(function(a){var b=new Image;b.src=c.options.static_url+"img/"+a+".png",d.icon_cache[a]=b});var l=b.throttle(function(a,b){d.onMouseMove(a,b)},f._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),l(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),g&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-_lastTap<f._DOUBLETAP_DELAY&&Math.pow(j-b.pageX,2)+Math.pow(k-b.pageY,2)<f._DOUBLETAP_DISTANCE?(_lastTap=0,d.onDoubleClick(b)):(_lastTap=new Date,j=b.pageX,k=b.pageY,h=d.scale,i=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),_lastTap=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(i||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,i=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*h,c=b/d.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.offset.multiply(c));d.setScale(b,e)}},touchend:function(a){a.preventDefault(),d.onMouseUp(a.originalEvent.changedTouches[0],!0)},dblclick:function(a){a.preventDefault(),c.options.allow_double_click&&d.onDoubleClick(a)},mouseleave:function(a){a.preventDefault(),d.onMouseUp(a,!1),d.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),g=!1},dragleave:function(a){a.preventDefault(),g=!0},drop:function(a){a.preventDefault(),g=!0;var c={};b.each(a.originalEvent.dataTransfer.types,function(b){try{c[b]=a.originalEvent.dataTransfer.getData(b)}catch(d){}});var e=a.originalEvent.dataTransfer.getData("Text");if("string"==typeof e)switch(e[0]){case"{":case"[":try{var f=JSON.parse(e);b.extend(c,f)}catch(h){c["text/plain"]||(c["text/plain"]=e)}break;case"<":c["text/html"]||(c["text/html"]=e);break;default:c["text/plain"]||(c["text/plain"]=e)}var i=a.originalEvent.dataTransfer.getData("URL");i&&!c["text/uri-list"]&&(c["text/uri-list"]=i),d.dropData(c,a.originalEvent)}});var m=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};m(".Rk-ZoomOut","zoomOut"),m(".Rk-ZoomIn","zoomIn"),m(".Rk-ZoomFit","autoScale"),this.$.find(".Rk-ZoomSave").click(function(){d.renkan.project.addView({zoom_level:d.scale,offset:d.offset,hidden_nodes:d.hiddenNodes})}),this.$.find(".Rk-ZoomSetSaved").click(function(){var a=d.renkan.project.get("views").last();a&&(d.setScale(a.get("zoom_level"),new paper.Point(a.get("offset"))),d.hiddenNodes=a.get("hidden_nodes")||[],d.hideNodes())}),this.$.find(".Rk-ShowHiddenNodes").mouseenter(function(){d.showNodes(!0),d.$.find(".Rk-ShowHiddenNodes").mouseleave(function(){d.hideNodes(!1)})}),this.$.find(".Rk-ShowHiddenNodes").click(function(){d.showNodes(!1),d.$.find(".Rk-ShowHiddenNodes").off("mouseleave")}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show(),this.$.find(".Rk-CurrentUser").mouseenter(function(){d.$.find(".Rk-UserList").slideDown()}),this.$.find(".Rk-Users").mouseleave(function(){d.$.find(".Rk-UserList").slideUp()}),m(".Rk-FullScreen-Button","fullScreen"),m(".Rk-AddNode-Button","addNodeBtn"),m(".Rk-AddEdge-Button","addEdgeBtn"),m(".Rk-Save-Button","save"),m(".Rk-Open-Button","open"),m(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+f._BOOKMARKLET_CODE(c)).click(function(){return d.notif_$.text(c.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.")).fadeIn().delay(5e3).fadeOut(),!1}),this.$.find(".Rk-TopBar-Button").mouseover(function(){a(this).find(".Rk-TopBar-Tooltip").show()}).mouseout(function(){a(this).find(".Rk-TopBar-Tooltip").hide()}),m(".Rk-Fold-Bins","foldBins"),paper.view.onResize=function(a){var b,c=a.width,e=a.height;d.minimap&&(d.minimap.topleft=paper.view.bounds.bottomRight.subtract(d.minimap.size),d.minimap.rectangle.fitBounds(d.minimap.topleft.subtract([2,2]),d.minimap.size.add([4,4])),d.minimap.cliprectangle.fitBounds(d.minimap.topleft,d.minimap.size));var f=e/(e-a.delta.height),g=c/(c-a.delta.width);b=c>e?f:g,d.resizeZoom(g,f,b),d.redraw()};var n=b.throttle(function(){d.redraw()},50);this.addRepresentations("Node",this.renkan.project.get("nodes")),this.addRepresentations("Edge",this.renkan.project.get("edges")),this.renkan.project.on("change:title",function(){d.$.find(".Rk-PadTitle").val(c.project.get("title"))}),this.$.find(".Rk-PadTitle").on("keyup input paste",function(){c.project.set({title:a(this).val()})});var o=b.throttle(function(){d.redrawUsers()},100);if(o(),this.renkan.project.on("change:saveStatus",function(){switch(d.renkan.project.get("saveStatus")){case 0:d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("saved");break;case 1:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("to-save");break;case 2:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").addClass("saving")}}),this.renkan.project.on("change:loadingStatus",function(){if(d.renkan.project.get("loadingStatus")){d.$.find(".loader").addClass("run"),setTimeout(function(){d.$.find(".loader").hide(250)},3e3)}}),this.renkan.project.on("add:users remove:users",o),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>0?d.$.find(".Rk-ZoomSetSaved").show():d.$.find(".Rk-ZoomSetSaved").hide()}),this.renkan.project.on("add:nodes",function(a){d.addRepresentation("Node",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("change:title",function(a,b){var c=d.$.find(".Rk-PadTitle");c.is("input")?c.val()!==b&&c.val(b):c.text(b)}),c.options.size_bug_fix){var p="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},p)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var q=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),r=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");q.hover(function(a){d.isEditable()&&(a.preventDefault(),r.show())},function(a){a.preventDefault(),r.hide()}),r.find("li").mouseenter(function(b){d.isEditable()&&(b.preventDefault(),d.$.find(".Rk-CurrentUser-Color").css("background",a(this).attr("data-color")))})}if(c.options.show_search_field){var s="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==s)if(s=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var g=f.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){g.test(a.get("title"))||g.test(a.get("description"))?d.getRepresentationByModel(a).highlight(g):d.getRepresentationByModel(a).unhighlight()})}})}this.redraw(),window.setInterval(function(){var a=(new Date).valueOf();d.delete_list.forEach(function(b){if(a>=b.time){var d=c.project.get("nodes").findWhere({delete_scheduled:b.id});d&&project.removeNode(d),d=c.project.get("edges").findWhere({delete_scheduled:b.id}),d&&project.removeEdge(d)}}),d.delete_list=d.delete_list.filter(function(a){return c.project.get("nodes").findWhere({delete_scheduled:a.id})||c.project.get("edges").findWhere({delete_scheduled:a.id})})},500),this.minimap&&window.setInterval(function(){d.rescaleMinimap()},2e3)};return b(g.prototype).extend({fixSize:function(){if(this.renkan.options.default_view&&this.renkan.project.get("views").length>0){var a=this.renkan.project.get("views").last();this.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}else this.autoScale()},drawSector:function(b,c,d,e,f,g,h,i){var j=this.renkan.options,k=e*Math.PI/180,l=f*Math.PI/180,m=this.icon_cache[h],n=-Math.sin(k),o=Math.cos(k),p=Math.cos(k)*c+g*n,q=Math.sin(k)*c+g*o,r=Math.cos(k)*d+g*n,s=Math.sin(k)*d+g*o,t=-Math.sin(l),u=Math.cos(l),v=Math.cos(l)*c-g*t,w=Math.sin(l)*c-g*u,x=Math.cos(l)*d-g*t,y=Math.sin(l)*d-g*u,z=(c+d)/2,A=(k+l)/2,B=Math.cos(A)*z,C=Math.sin(A)*z,D=Math.cos(A)*c,E=Math.cos(A)*d,F=Math.sin(A)*c,G=Math.sin(A)*d,H=Math.cos(A)*(d+3),I=Math.sin(A)*(d+j.buttons_label_font_size)+j.buttons_label_font_size/2;this.buttons_layer.activate();var J=new paper.Path;J.add([p,q]),J.arcTo([D,F],[v,w]),J.lineTo([x,y]),J.arcTo([E,G],[r,s]),J.fillColor=j.buttons_background,J.opacity=.5,J.closed=!0,J.__representation=b;var K=new paper.PointText(H,I);K.characterStyle={fontSize:j.buttons_label_font_size,fillColor:j.buttons_label_color},K.paragraphStyle.justification=H>2?"left":-2>H?"right":"center",K.visible=!1;var L=!1,M=new paper.Point(-200,-200),N=new paper.Group([J,K]),O=N.position,P=new paper.Point([B,C]),Q=new paper.Point(0,0);K.content=i,N.pivot=N.bounds.center,N.visible=!1,N.position=M;var R={show:function(){L=!0,N.position=Q.add(O),N.visible=!0},moveTo:function(a){Q=a,L&&(N.position=a.add(O))},hide:function(){L=!1,N.visible=!1,N.position=M},select:function(){J.opacity=.8,K.visible=!0},unselect:function(){J.opacity=.5,K.visible=!1},destroy:function(){N.remove()}},S=function(){var a=new paper.Raster(m);a.position=P.add(N.position).subtract(O),a.locked=!0,N.addChild(a)};return m.width?S():a(m).on("load",S),R},addToBundles:function(a){var c=b(this.bundles).find(function(b){return b.from===a.from_representation&&b.to===a.to_representation||b.from===a.to_representation&&b.to===a.from_representation});return"undefined"!=typeof c?c.edges.push(a):(c={from:a.from_representation,to:a.to_representation,edges:[a],getPosition:function(a){var c=a.from_representation===this.from?1:-1;return c*(b(this.edges).indexOf(a)-(this.edges.length-1)/2)}},this.bundles.push(c)),c},isEditable:function(){return this.renkan.options.editor_mode&&!this.renkan.read_only},onStatusChange:function(){var a=this.$.find(".Rk-Save-Button"),b=a.find(".Rk-TopBar-Tooltip-Contents");this.renkan.read_only?(a.removeClass("disabled Rk-Save-Online").addClass("Rk-Save-ReadOnly"),b.text(this.renkan.translate("Connection lost"))):this.renkan.options.manual_save?(a.removeClass("Rk-Save-ReadOnly Rk-Save-Online"),b.text(this.renkan.translate("Save Project"))):(a.removeClass("disabled Rk-Save-ReadOnly").addClass("Rk-Save-Online"),b.text(this.renkan.translate("Auto-save enabled"))),this.redrawUsers()},setScale:function(a,b){a/this.initialScale>f._MIN_SCALE&&a/this.initialScale<f._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.redraw())},autoScale:function(a){var b=this.renkan.project.get("nodes");if(b.length>1){var c=b.map(function(a){return a.get("position").x}),d=b.map(function(a){return a.get("position").y}),e=Math.min.apply(Math,c),f=Math.min.apply(Math,d),g=Math.max.apply(Math,c),h=Math.max.apply(Math,d),i=Math.min((paper.view.size.width-2*this.renkan.options.autoscale_padding)/(g-e),(paper.view.size.height-2*this.renkan.options.autoscale_padding)/(h-f));this.initialScale=i,"undefined"!=typeof a&&parseFloat(a.zoom_level)>0&&parseFloat(a.offset.x)>0&&parseFloat(a.offset.y)>0?this.setScale(parseFloat(a.zoom_level),new paper.Point(parseFloat(a.offset.x),parseFloat(a.offset.y))):this.setScale(i,paper.view.center.subtract(new paper.Point([(g+e)/2,(h+f)/2]).multiply(i)))}1===b.length&&this.setScale(1,paper.view.center.subtract(new paper.Point([b.at(0).get("position").x,b.at(0).get("position").y])))},redrawMiniframe:function(){var a=this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),b=this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));this.minimap.miniframe.fitBounds(a,b)},rescaleMinimap:function(){var a=this.renkan.project.get("nodes");if(a.length>1){var b=a.map(function(a){return a.get("position").x}),c=a.map(function(a){return a.get("position").y}),d=Math.min.apply(Math,b),e=Math.min.apply(Math,c),f=Math.max.apply(Math,b),g=Math.max.apply(Math,c),h=Math.min(.8*this.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.scale*this.renkan.options.minimap_height/paper.view.bounds.height,(this.renkan.options.minimap_width-2*this.renkan.options.minimap_padding)/(f-d),(this.renkan.options.minimap_height-2*this.renkan.options.minimap_padding)/(g-e));this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([(f+d)/2,(g+e)/2]).multiply(h)),this.minimap.scale=h}1===a.length&&(this.minimap.scale=.1,this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([a.at(0).get("position").x,a.at(0).get("position").y]).multiply(this.minimap.scale))),this.redraw()},toPaperCoords:function(a){return a.multiply(this.scale).add(this.offset)},toMinimapCoords:function(a){return a.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft)},toModelCoords:function(a){return a.subtract(this.offset).divide(this.scale)},addRepresentation:function(a,b){var c=d.getRenderer()[a],e=new c(this,b);return this.representations.push(e),e},addRepresentations:function(a,b){var c=this;b.forEach(function(b){c.addRepresentation(a,b)})},userTemplate:b.template('<li class="Rk-User"><span class="Rk-UserColor" style="background:<%=background%>;"></span><%=name%></li>'),redrawUsers:function(){if(this.renkan.options.show_user_list){var b=[].concat((this.renkan.project.current_user_list||{}).models||[],(this.renkan.project.get("users")||{}).models||[]),c="",d=this.$.find(".Rk-Users"),e=d.find(".Rk-CurrentUser-Name"),f=d.find(".Rk-Edit-ColorPicker li"),g=d.find(".Rk-CurrentUser-Color"),h=this;e.off("click").text(this.renkan.translate("<unknown user>")),f.off("mouseleave click"),b.forEach(function(b){b.get("_id")===h.renkan.current_user?(e.text(b.get("title")),g.css("background",b.get("color")),h.isEditable()&&(h.renkan.options.user_name_editable&&e.click(function(){var c=a(this),d=a("<input>").val(b.get("title")).blur(function(){b.set("title",a(this).val()),h.redrawUsers(),h.redraw()});c.empty().html(d),d.select()}),h.renkan.options.user_color_editable&&f.click(function(c){c.preventDefault(),h.isEditable()&&b.set("color",a(this).attr("data-color")),a(this).parent().hide()}).mouseleave(function(){g.css("background",b.get("color"))}))):c+=h.userTemplate({name:b.get("title"),background:b.get("color")})}),d.find(".Rk-UserList").html(c)}},removeRepresentation:function(a){a.destroy(),this.representations=b.reject(this.representations,function(b){return b===a})},getRepresentationByModel:function(a){return a?b.find(this.representations,function(b){return b.model===a}):void 0},removeRepresentationsOfType:function(a){var c=b.filter(this.representations,function(b){return b.type===a}),d=this;b.each(c,function(a){d.removeRepresentation(a)})},highlightModel:function(a){var b=this.getRepresentationByModel(a);b&&b.highlight()},unhighlightAll:function(){b.each(this.representations,function(a){a.unhighlight()})},unselectAll:function(){b.each(this.representations,function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b.each(this.representations,function(a){a.redraw({dontRedrawEdges:!0})}),this.minimap&&this.redrawMiniframe(),paper.view.draw())},addTempEdge:function(a,b){var c=this.addRepresentation("TempEdge",null);c.end_pos=b,c.from_representation=a,c.redraw(),this.click_target=c},addHiddenNode:function(a){this.hideNode(a),this.hiddenNodes.push(a.id)},hideNode:function(a){var b=this;"undefined"!=typeof b.getRepresentationByModel(a)&&b.getRepresentationByModel(a).hide()},hideNodes:function(){var a=this;this.hiddenNodes.forEach(function(b,c){var d=a.renkan.project.get("nodes").get(b);return"undefined"!=typeof d?a.hideNode(a.renkan.project.get("nodes").get(b)):void a.hiddenNodes.splice(c,1)}),paper.view.draw()},showNodes:function(a){var b=this;this.hiddenNodes.forEach(function(c){b.getRepresentationByModel(b.renkan.project.get("nodes").get(c)).show(a)}),a||(this.hiddenNodes=[]),paper.view.draw()},findTarget:function(a){if(a&&"undefined"!=typeof a.item.__representation){var b=a.item.__representation;this.selected_target!==a.item.__representation&&(this.selected_target&&this.selected_target.unselect(b),b.select(this.selected_target),this.selected_target=b)}else this.selected_target&&this.selected_target.unselect(),this.selected_target=null},paperShift:function(a){this.offset=this.offset.add(a),this.redraw()},onMouseMove:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=c.subtract(this.last_point);this.last_point=c,!this.is_dragging&&this.mouse_down&&d.length>f._MIN_DRAG_DISTANCE&&(this.is_dragging=!0);var e=paper.project.hitTest(c);this.is_dragging?this.click_target&&"function"==typeof this.click_target.paperShift?this.click_target.paperShift(d):this.paperShift(d):this.findTarget(e),paper.view.draw()},onMouseDown:function(b,c){var d=this.canvas_$.offset(),e=new paper.Point([b.pageX-d.left,b.pageY-d.top]);if(this.last_point=e,this.mouse_down=!0,!this.click_target||"Temp-edge"!==this.click_target.type){this.removeRepresentationsOfType("editor"),this.is_dragging=!1;var g=paper.project.hitTest(e);if(g&&"undefined"!=typeof g.item.__representation)this.click_target=g.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===f._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}};_node=this.renkan.project.addNode(i),this.getRepresentationByModel(_node).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===f._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=f._CLICKMODE_ENDEDGE,this.notif_$.fadeOut(function(){a(this).html(this.renkan.translate("Click on a second node to complete the edge")).fadeIn()})):(this.notif_$.hide(),this.click_mode=!1)),paper.view.draw()},onMouseUp:function(a,b){if(this.mouse_down=!1,this.click_target){var c=this.canvas_$.offset();this.click_target.mouseup({point:new paper.Point([a.pageX-c.left,a.pageY-c.top])},b)}else this.click_target=null,this.is_dragging=!1,b&&this.unselectAll();paper.view.draw()},onScroll:function(a,b){if(this.totalScroll+=b,Math.abs(this.totalScroll)>=1){var c=this.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]).subtract(this.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.setScale(this.scale*Math.SQRT2,this.offset.subtract(d)):this.setScale(this.scale*Math.SQRT1_2,this.offset.add(d.divide(Math.SQRT2))),this.totalScroll=0}},onDoubleClick:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=paper.project.hitTest(c);if(!this.isEditable())return void(d&&"undefined"!=typeof d.item.__representation&&d.item.__representation.model.get("uri")&&window.open(d.item.__representation.model.get("uri"),"_blank"));if(this.isEditable()&&(!d||"undefined"==typeof d.item.__representation)){var e=this.toModelCoords(c),g={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(g);this.getRepresentationByModel(h).openEditor()}paper.view.draw()},defaultDropHandler:function(b){var c={},d="";switch(b["text/x-iri-specific-site"]){case"twitter":d=a("<div>").html(b["text/x-iri-selected-html"]);var e=d.find(".tweet");
+c.title=this.renkan.translate("Tweet by ")+e.attr("data-name"),c.uri="http://twitter.com/"+e.attr("data-screen-name")+"/status/"+e.attr("data-tweet-id"),c.image=e.find(".avatar").attr("src"),c.description=e.find(".js-tweet-text:first").text();break;case"google":d=a("<div>").html(b["text/x-iri-selected-html"]),c.title=d.find("h3:first").text().trim(),c.uri=d.find("h3 a").attr("href"),c.description=d.find(".st:first").text().trim();break;default:b["text/x-iri-source-uri"]&&(c.uri=b["text/x-iri-source-uri"])}if((b["text/plain"]||b["text/x-iri-selected-text"])&&(c.description=(b["text/plain"]||b["text/x-iri-selected-text"]).replace(/[\s\n]+/gm," ").trim()),b["text/html"]||b["text/x-iri-selected-html"]){d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]);var f=d.find("image");f.length&&(c.image=f.attr("xlink:href"));var g=d.find("path");g.length&&(c.clipPath=g.attr("d"));var h=d.find("img");h.length&&(c.image=h[0].src);var i=d.find("a");i.length&&(c.uri=i[0].href),c.title=d.find("[title]").attr("title")||c.title,c.description=d.text().replace(/[\s\n]+/gm," ").trim()}b["text/uri-list"]&&(c.uri=b["text/uri-list"]),b["text/x-moz-url"]&&!c.title&&(c.title=(b["text/x-moz-url"].split("\n")[1]||"").trim(),c.title===c.uri&&(c.title=!1)),b["text/x-iri-source-title"]&&!c.title&&(c.title=b["text/x-iri-source-title"]),(b["text/html"]||b["text/x-iri-selected-html"])&&(d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]),c.image=d.find("[data-image]").attr("data-image")||c.image,c.uri=d.find("[data-uri]").attr("data-uri")||c.uri,c.title=d.find("[data-title]").attr("data-title")||c.title,c.description=d.find("[data-description]").attr("data-description")||c.description,c.clipPath=d.find("[data-clip-path]").attr("data-clip-path")||c.clipPath),c.title||(c.title=this.renkan.translate("Dragged resource"));for(var j=["title","description","uri","image"],k=0;k<j.length;k++){var l=j[k];(b["text/x-iri-"+l]||b[l])&&(c[l]=b["text/x-iri-"+l]||b[l]),("none"===c[l]||"null"===c[l])&&(c[l]=void 0)}return"function"==typeof this.renkan.options.drop_enhancer&&(c=this.renkan.options.drop_enhancer(c,b)),c},dropData:function(a,c){if(this.isEditable()){if(a["text/json"]||a["application/json"])try{var d=JSON.parse(a["text/json"]||a["application/json"]);b.extend(a,d)}catch(e){}var g="undefined"==typeof this.renkan.options.drop_handler?this.defaultDropHandler(a):this.renkan.options.drop_handler(a),h=this.canvas_$.offset(),i=new paper.Point([c.pageX-h.left,c.pageY-h.top]),j=this.toModelCoords(i),k={id:f.getUID("node"),created_by:this.renkan.current_user,uri:g.uri||"",title:g.title||"",description:g.description||"",image:g.image||"",color:g.color||void 0,clip_path:g.clipPath||void 0,position:{x:j.x,y:j.y}},l=this.renkan.project.addNode(k),m=this.getRepresentationByModel(l);"drop"===c.type&&m.openEditor()}},fullScreen:function(){var a,b=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen,c=this.renkan.$[0],d=["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],e=["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"];if(b){for(a=0;a<e.length;a++)if("function"==typeof document[e[a]]){document[e[a]]();break}var f=this.$.width(),g=this.$.height();this.renkan.options.show_top_bar&&(g-=this.$.find(".Rk-TopBar").height()),this.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(f-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([f,g])}else{for(a=0;a<d.length;a++)if("function"==typeof c[d[a]]){c[d[a]]();break}this.redraw()}},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT1_2)).add(this.offset.multiply(Math.SQRT1_2));this.setScale(a,b)},zoomIn:function(){var a=this.scale*Math.SQRT2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT2)).add(this.offset.multiply(Math.SQRT2));this.setScale(a,b)},resizeZoom:function(a,b,c){var d=this.scale*c,e=new paper.Point([this.offset.x*a,this.offset.y*b]);this.setScale(d,e)},addNodeBtn:function(){return this.click_mode===f._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_ADDNODE,this.notif_$.text(this.renkan.translate("Click on the background canvas to add a node")).fadeIn()),!1},addEdgeBtn:function(){return this.click_mode===f._CLICKMODE_STARTEDGE||this.click_mode===f._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_STARTEDGE,this.notif_$.text(this.renkan.translate("Click on a first node to start the edge")).fadeIn()),!1},exportProject:function(){var a=this.renkan.project.toJSON(),d=(document.createElement("a"),a.id),e=d+".json";delete a.id,delete a._id,delete a.space_id;var g,h={};b.each(a.nodes,function(a){g=a.id||a._id,delete a._id,delete a.id,h[g]=a["@id"]=f.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=h[a.to],a.from=h[a.from]}),b.each(a.views,function(a){g=a.id||a._id,delete a._id,delete a.id}),a.users=[];var i=JSON.stringify(a,null,2),j=new Blob([i],{type:"application/json;charset=utf-8"});c(j,e)},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=this,e=d.canvas_$.width();c.position().left<0?(c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e-c.width()<c.height()?e:e-c.width(),b.html("«")):(c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e+300,b.html("»")),d.resizeZoom(1,1,a/e)},save:function(){},open:function(){}}).value(),g}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils"}}),require(["renderer/baserepresentation","renderer/basebutton","renderer/noderepr","renderer/edge","renderer/tempedge","renderer/baseeditor","renderer/nodeeditor","renderer/edgeeditor","renderer/nodebutton","renderer/nodeeditbutton","renderer/noderemovebutton","renderer/nodehidebutton","renderer/nodeshowbutton","renderer/noderevertbutton","renderer/nodelinkbutton","renderer/nodeenlargebutton","renderer/nodeshrinkbutton","renderer/edgeeditbutton","renderer/edgeremovebutton","renderer/edgerevertbutton","renderer/miniframe","renderer/scene"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v){var w=window.Rkns;"undefined"==typeof w.Renderer&&(w.Renderer={});var x=w.Renderer;x._BaseRepresentation=a,x._BaseButton=b,x.Node=c,x.Edge=d,x.TempEdge=e,x._BaseEditor=f,x.NodeEditor=g,x.EdgeEditor=h,x._NodeButton=i,x.NodeEditButton=j,x.NodeRemoveButton=k,x.NodeHideButton=l,x.NodeShowButton=m,x.NodeRevertButton=n,x.NodeLinkButton=o,x.NodeEnlargeButton=p,x.NodeShrinkButton=q,x.EdgeEditButton=r,x.EdgeRemoveButton=s,x.EdgeRevertButton=t,x.MiniFrame=u,x.Scene=v,startRenkan()}),define("main-renderer",function(){});
//# sourceMappingURL=renkan.min.map
\ No newline at end of file
--- a/server/php/basic/public_html/static/lib/renkan/js/renkan.min.map Wed Jun 03 19:16:58 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/js/renkan.min.map Thu Jun 04 10:04:01 2015 +0200
@@ -1,1 +1,1 @@
-{"version":3,"file":"renkan.min.js","sources":["templates.js","../../js/main.js","../../js/dataloader.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":["this","obj","__t","__p","_","escape","__e","Array","prototype","join","renkan","translate","edge","title","options","show_edge_editor_uri","uri","properties","length","each","ontology","label","property","show_edge_editor_style","show_edge_editor_style_color","show_edge_editor_style_dash","dash","show_edge_editor_style_thickness","thickness","show_edge_editor_style_arrow","arrow","show_edge_editor_direction","show_edge_editor_nodes","from_color","shortenText","from_title","to_title","show_edge_editor_creator","has_creator","created_by_title","show_edge_tooltip_color","color","show_edge_tooltip_uri","short_uri","description","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","static_url","url","show_bins","show_editor","node","show_node_editor_uri","show_node_editor_description","show_node_editor_size","size","show_node_editor_style","show_node_editor_style_color","show_node_editor_style_dash","show_node_editor_style_thickness","show_node_editor_image","image_placeholder","clip_path","allow_image_upload","show_node_editor_creator","change_shapes","shapes","shape","charAt","toUpperCase","substring","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","print","__j","call","arguments","show_top_bar","editor_mode","project","get","show_user_list","show_user_color","user_color_editable","colorPicker","home_button_url","home_button_title","show_fullscreen_button","show_addnode_button","show_addedge_button","show_export_button","show_save_button","show_open_button","show_bookmarklet","show_search_field","resize","show_zoom","save_view","root","$","jQuery","pickerColors","__renkans","_BaseBin","_renkan","_opts","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","html","click","destroy","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","detach","Renkan","push","defaults","templates","renkanJST","template","property_files","f","getJSON","data","concat","read_only","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","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","where","_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","lastsearch","lastval","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","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","slice","_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","default_user_color","_BOOKMARKLET_CODE","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","converters","from1to2","len","nodes","console","log","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","Backbone","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","prepare","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","hidden","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","views","_item","t","version","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","manual_save","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","default_view","user_name_editable","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","default_dash_array","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","node_stroke_max_width","selected_node_stroke_width","selected_node_stroke_max_width","node_stroke_witdh_scale","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","edge_stroke_width","edge_stroke_max_width","selected_edge_stroke_width","selected_edge_stroke_max_width","edge_stroke_witdh_scale","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_arrow_max_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","uploaded_image_max_kb","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:","Dash:","Thickness:","Arrow:","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","Cloud","Triangle","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","loadingStatus","_data","saveStatus","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","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","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","change","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","value","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","cloud_path","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","SQRT2","rotate","star","cloud","path","scale","triangle","svg","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","_getStrokeWidth","has","_getSelectedStrokeWidth","changed","shapeBuilder","sendToBack","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","forEach","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_strokeWidth","_color","_dash","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","dontRedrawEdges","ed","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","insertAbove","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","hideButtons","buttons_timeout","undefined","textToReplace","hlvalue","throttledPaperDraw","saveCoords","toModelCoords","_event","_isTouch","unselectAll","click_target","edge_layer","bundle","addToBundles","line","arrow_scale","pivot","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_getArrowScale","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","array_opacity","handleIn","handleOut","bounds","_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","keys","closeEditor","onFieldChange","assign","keyCode","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","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","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","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","_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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,KAAgB,UAAIA,KAAgB,cAEpCA,KAAgB,UAAE,8BAAgC,SAASC,KAC3DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,EAAUC,GAAEC,OAC3B,KAAMJ,IACNE,KAAO,oBACS,OAAdD,IAAM,GAAe,GAAKA,KAC5B,yBACgB,OAAdA,IAAM,GAAe,GAAKA,KAC5B,SAGA,OAAOC,MAGPH,KAAgB,UAAE,6BAA+B,SAASC,KAC1DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,GAAIG,IAAMF,EAAEC,MAAcE,OAAMC,UAAUC,KAEzD,KAAMR,IACNE,KAAO,mDACPG,IAAII,OAAOC,UAAU,cACrB,mCACAL,IAAII,OAAOC,UAAU,WACrB,iEACAL,IAAIM,KAAKC,OACT,eACKC,QAAQC,uBACbZ,KAAO,6BACPG,IAAII,OAAOC,UAAU,SACrB,mEACAL,IAAIM,KAAKI,KACT,+CACAV,IAAIM,KAAKI,KACT,yCACKF,QAAQG,WAAWC,SACxBf,KAAO,qCACPG,IAAII,OAAOC,UAAU,4BACrB,8EACCP,EAAEe,KAAKL,QAAQG,WAAY,SAASG,GACrCjB,KAAO,qGACPG,IAAKI,OAAOC,UAAUS,EAASC,QAC/B,wDACCjB,EAAEe,KAAKC,EAASH,WAAY,SAASK,GAAY,GAAIN,GAAMI,EAAS,YAAcE,EAASN,GAC5Fb,MAAO,gFACPG,IAAKU,GACL,kCACKA,IAAQJ,KAAKI,MAClBb,KAAO,aAEPA,KAAO,kCACPG,IAAKI,OAAOC,UAAUW,EAASD,QAC/B,8DAEAlB,KAAO,uBAEPA,KAAO,4CAEPA,KAAO,KACFW,QAA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BAAnB+/B,SAAQC,QACfD,QAAQC,QACJC,OACIC,OAAS,uBACTC,WAAa,uBACbrN,UAAa,6BACblQ,SAAW,mBAKvBmd,SAAS,8BACA,sBACA,oBACA,gBACA,oBACA,sBACA,sBACA,sBACA,sBACA,0BACA,4BACA,4BACA,0BACA,6BACA,4BACA,0BACA,4BACA,4BACA,qBACA,kBACG,SAASld,EAAoB6O,EAAYhN,EAAU7V,EAAM4f,EAAUkB,EAAYC,EAAY2B,EAAYY,EAAYjN,EAAgBC,EAAkBK,EAAkBJ,EAAgBC,EAAmBC,EAAkBqH,EAAgBC,EAAkBC,EAAkBgG,EAAW7yB,GAInS,GAAI1H,GAAOoF,OAAOpF,IAEU,oBAAlBA,GAAKyH,WACXzH,EAAKyH,YAET,IAAIA,GAAWzH,EAAKyH,QAEpBA,GAASuhB,oBAAsBuB,EAC/B9iB,EAAS+iB,YAAc4O,EACvB3xB,EAASuO,KAAOoW,EAChB3kB,EAAS8O,KAAOA,EAChB9O,EAAS0uB,SAAWA,EACpB1uB,EAASsvB,YAAcM,EACvB5vB,EAAS6vB,WAAaA,EACtB7vB,EAASwxB,WAAaA,EACtBxxB,EAAS4xB,YAAcQ,EACvBpyB,EAASmlB,eAAiBA,EAC1BnlB,EAASolB,iBAAmBA,EAC5BplB,EAASylB,iBAAmBA,EAC5BzlB,EAASqlB,eAAiBA,EAC1BrlB,EAASslB,kBAAoBA,EAC7BtlB,EAASulB,iBAAmBA,EAC5BvlB,EAAS4sB,eAAiBA,EAC1B5sB,EAAS6sB,iBAAmBA,EAC5B7sB,EAAS8sB,iBAAmBA,EAC5B9sB,EAAS8yB,UAAYA,EACrB9yB,EAASC,MAAQA,EAEjBogC,gBAGJ/e,OAAO,gBAAiB","sourcesContent":["this[\"renkanJST\"] = this[\"renkanJST\"] || {};\n\nthis[\"renkanJST\"][\"templates/colorpicker.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li data-color=\"' +\n((__t = (c)) == null ? '' : __t) +\n'\" style=\"background: ' +\n((__t = (c)) == null ? '' : __t) +\n'\"></li>';\n\n}\nreturn __p\n};\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 <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Edge\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(edge.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n ';\n if (options.properties.length) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose from vocabulary:\")) +\n'</label>\\n <select class=\"Rk-Edit-Vocabulary\">\\n ';\n _.each(options.properties, function(ontology) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Class\" value=\"\">\\n ' +\n__e( renkan.translate(ontology.label) ) +\n'\\n </option>\\n ';\n _.each(ontology.properties, function(property) { var uri = ontology[\"base-uri\"] + property.uri; ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( uri ) +\n'\"\\n ';\n if (uri === edge.uri) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(property.label) ) +\n'\\n </option>\\n ';\n }) ;\n__p += '\\n ';\n }) ;\n__p += '\\n </select>\\n </p>\\n';\n } } ;\n__p += '\\n';\n if (options.show_edge_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_edge_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Edge color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: <%-edge.color%>;\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( edge.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e( edge.thickness ) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_arrow) { ;\n__p += '\\n <div id=\"Rk-Editor-p-arrow\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Arrow:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Arrow\" class=\"Rk-Edit-Arrow\" ' +\n__e( edge.arrow ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_direction) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Edit-Direction\">' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'</span>\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(edge.from_color) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: >%-edge.to_color%>;\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: <%-edge.created_by_color%>;\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.color ) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (edge.uri) { ;\n__p += '\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' </a> ';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">' +\n__e( edge.short_uri ) +\n'</a>\\n </p>\\n';\n } ;\n__p += '\\n<p>' +\n__e(edge.description) +\n'</p>\\n';\n if (options.show_edge_tooltip_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.from_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.to_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_tooltip_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.created_by_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +\n'\"\\n data-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/search/?search=' +\n((__t = (encodedtitle)) == null ? '' : __t) +\n'&field=all\"\\n data-title=\"' +\n__e(title) +\n'\" data-description=\"Tag \\'' +\n__e(title) +\n'\\'\">\\n\\n <img class=\"Rk-Ldt-Tag-Icon\" src=\"' +\n__e(static_url) +\n'img/ldt-tag.png\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/list-bin.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n ';\n if (image) { ;\n__p += '\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n ';\n } else { ;\n__p += '\\n data-image=\"\"\\n ';\n } ;\n__p += '\\n>';\n if (image) { ;\n__p += '\\n <img class=\"Rk-ResourceList-Image\" src=\"' +\n__e(image) +\n'\" />\\n';\n } ;\n__p += '\\n<h4 class=\"Rk-ResourceList-Title\">\\n ';\n if (url) { ;\n__p += '\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '</a>';\n } ;\n__p += '\\n </h4>\\n ';\n if (description) { ;\n__p += '\\n <p class=\"Rk-ResourceList-Description\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n ';\n } ;\n__p += '\\n ';\n if (image) { ;\n__p += '\\n <div style=\"clear: both;\"></div>\\n ';\n } ;\n__p += '\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/main.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_bins) { ;\n__p += '\\n <div class=\"Rk-Bins\">\\n <div class=\"Rk-Bins-Head\">\\n <h2 class=\"Rk-Bins-Title\">' +\n__e( translate(\"Select contents:\")) +\n'</h2>\\n <form class=\"Rk-Web-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n <div class=\"Rk-Search-Select\">\\n <div class=\"Rk-Search-Current\"></div>\\n <ul class=\"Rk-Search-List\"></ul>\\n </div>\\n <input type=\"submit\" value=\"\"\\n class=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n </form>\\n <form class=\"Rk-Bins-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search in Bins') ) +\n'\" /> <input\\n type=\"submit\" value=\"\"\\n class=\"Rk-Bins-Search-Submit Rk-Search-Submit\"\\n title=\"' +\n__e( translate('Search in Bins') ) +\n'\" />\\n </form>\\n </div>\\n <ul class=\"Rk-Bin-List\"></ul>\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_editor) { ;\n__p += '\\n <div class=\"Rk-Render Rk-Render-';\n if (options.show_bins) { ;\n__p += 'Panel';\n } else { ;\n__p += 'Full';\n } ;\n__p += '\"></div>\\n';\n } ;\n__p += '\\n';\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\n //TODO: change class to id ;\n__p += '\\n<h2>\\n <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Node\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(node.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_description) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Description:\")) +\n'</label>\\n <textarea class=\"Rk-Edit-Description\">' +\n__e(node.description) +\n'</textarea>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_size) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Size:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Size-Value\">' +\n__e(node.size) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Up\">+</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_node_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">\\n ' +\n__e(renkan.translate(\"Node color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: ' +\n__e(node.color) +\n';\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( node.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e(node.thickness) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_image) { ;\n__p += '\\n <div class=\"Rk-Edit-ImgWrap\">\\n <div class=\"Rk-Edit-ImgPreview\">\\n <img src=\"' +\n__e(node.image || node.image_placeholder) +\n'\" />\\n ';\n if (node.clip_path) { ;\n__p += '\\n <svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\">\\n <path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"' +\n__e( node.clip_path ) +\n'\" />\\n </svg>\\n ';\n };\n__p += '\\n </div>\\n </div>\\n <p>\\n <label>' +\n__e(renkan.translate(\"Image URL:\")) +\n'</label>\\n <div>\\n <a class=\"Rk-Edit-Image-Del\" href=\"#\"></a>\\n <input class=\"Rk-Edit-Image\" type=\"text\" value=\\'' +\n__e(node.image) +\n'\\' />\\n </div>\\n </p>\\n';\n if (options.allow_image_upload) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose Image File:\")) +\n'</label>\\n <input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\" />\\n </p>\\n';\n };\n\n } ;\n__p += ' ';\n if (options.show_node_editor_creator && node.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.change_shapes) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Shapes available\")) +\n':</label>\\n <select class=\"Rk-Edit-Shape\">\\n ';\n _.each(shapes, function(shape) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( shape ) +\n'\"';\n if (node.shape === shape) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(shape.charAt(0).toUpperCase() + shape.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.color) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (node.uri) { ;\n__p += '\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '</a>';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">' +\n__e(node.short_uri) +\n'</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_tooltip_description) { ;\n__p += '\\n <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 <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 <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </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 <div class=\"Rk-TopBar\">\\n <div class=\"loader\"></div>\\n ';\n if (!options.editor_mode) { ;\n__p += '\\n <h2 class=\"Rk-PadTitle\">\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n </h2>\\n ';\n } else { ;\n__p += '\\n <input type=\"text\" class=\"Rk-PadTitle\" value=\"' +\n__e( project.get('title') || '' ) +\n'\" placeholder=\"' +\n__e(translate('Untitled project')) +\n'\" />\\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n <div class=\"Rk-Users\">\\n <div class=\"Rk-CurrentUser\">\\n ';\n if (options.show_user_color) { ;\n__p += '\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-CurrentUser-Color\">\\n ';\n if (options.user_color_editable) { ;\n__p += '\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n ';\n } ;\n__p += '\\n </span>\\n ';\n if (options.user_color_editable) { print(colorPicker) } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-CurrentUser-Name\"><unknown user></span>\\n </div>\\n <ul class=\"Rk-UserList\"></ul>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.home_button_url) {;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"' +\n__e( options.home_button_url ) +\n'\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e( translate(options.home_button_title) ) +\n'\\n </div>\\n </div>\\n </a>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_fullscreen_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-FullScreen-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Full Screen\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.editor_mode) { ;\n__p += '\\n ';\n if (options.show_addnode_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddNode-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Node\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_addedge_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddEdge-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Edge\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_save_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Save-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\"></div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_open_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Open-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Open Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_bookmarklet) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")) +\n'\\n </div>\\n </div>\\n </a>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n } else { ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n }; ;\n__p += '\\n ';\n if (options.show_search_field) { ;\n__p += '\\n <form action=\"#\" class=\"Rk-GraphSearch-Form\">\\n <input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"' +\n__e( translate('Search in graph') ) +\n'\" />\\n </form>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n </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 <div class=\"Rk-Labels\"></div>\\n <canvas class=\"Rk-Canvas\" ';\n if (options.resize) { ;\n__p += ' resize=\"\" ';\n } ;\n__p += '></canvas>\\n <div class=\"Rk-Notifications\"></div>\\n <div class=\"Rk-Editor\">\\n ';\n if (options.show_bins) { ;\n__p += '\\n <div class=\"Rk-Fold-Bins\">«</div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_zoom) { ;\n__p += '\\n <div class=\"Rk-ZoomButtons\">\\n <div class=\"Rk-ZoomIn\" title=\"' +\n__e(translate('Zoom In')) +\n'\"></div>\\n <div class=\"Rk-ZoomFit\" title=\"' +\n__e(translate('Zoom Fit')) +\n'\"></div>\\n <div class=\"Rk-ZoomOut\" title=\"' +\n__e(translate('Zoom Out')) +\n'\"></div>\\n ';\n if (options.editor_mode && options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSave\" title=\"' +\n__e(translate('Zoom Save')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n ';\n if (options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSetSaved\" title=\"' +\n__e(translate('View saved zoom')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n</div>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/search.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"' +\n((__t = ( className )) == null ? '' : __t) +\n'\" data-key=\"' +\n((__t = ( key )) == null ? '' : __t) +\n'\">' +\n((__t = ( title )) == null ? '' : __t) +\n'</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/wikipedia-bin/resulttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"Wikipedia: ' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL( static_url + 'img/wikipedia.png' ) ) +\n'\">\\n\\n <img class=\"Rk-Wikipedia-Icon\" src=\"' +\n__e(static_url) +\n'img/wikipedia.png\">\\n <h4 class=\"Rk-Wikipedia-Title\">\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">' +\n((__t = (htitle)) == null ? '' : __t) +\n'</a>\\n </h4>\\n <p class=\"Rk-Wikipedia-Snippet\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n</li>\\n';\n\n}\nreturn __p\n};","/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n \"use strict\";\n\n if (typeof root.Rkns !== \"object\") {\n root.Rkns = {};\n }\n\n var Rkns = root.Rkns;\n var $ = Rkns.$ = root.jQuery;\n var _ = Rkns._ = root._;\n\n Rkns.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 ];\n\n Rkns.__renkans = [];\n\n var _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\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).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 = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<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 = _path.segments[7].point = _coords.add([_isLeft * _xmargin, 0]);\n _path.segments[1].point.x = _path.segments[2].point.x = _path.segments[5].point.x = _path.segments[6].point.x = _left;\n _path.segments[3].point.x = _path.segments[4].point.x = _right;\n _path.segments[2].point.y = _path.segments[3].point.y = _top;\n _path.segments[4].point.y = _path.segments[5].point.y = _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 // from http://stackoverflow.com/a/6444043\n increaseBrightness: function (hex, percent){\n // strip the leading # if it's there\n hex = hex.replace(/^\\s*#|\\s*$/g, '');\n\n // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`\n if(hex.length === 3){\n hex = hex.replace(/(.)/g, '$1$1');\n }\n\n var r = parseInt(hex.substr(0, 2), 16),\n g = parseInt(hex.substr(2, 2), 16),\n b = parseInt(hex.substr(4, 2), 16);\n\n return '#' +\n ((0|(1<<8) + r + (256 - r) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + g + (256 - g) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + b + (256 - b) * percent / 100).toString(16)).substr(1);\n }\n };\n})(window);\n\n/* END main.js */\n","(function(root) {\n\n \"use strict\";\n\n var DataLoader = root.Rkns.DataLoader = {\n converters: {\n from1to2: function(data) {\n\n var i, len;\n if(typeof data.nodes !== 'undefined') {\n for(i=0, len=data.nodes.length; i<len; i++) {\n var node = data.nodes[i];\n if(node.color) {\n console.log(\"node color : \", node.color);\n node.style = {\n color: node.color,\n };\n }\n else {\n node.style = {};\n }\n }\n }\n if(typeof data.edges !== 'undefined') {\n for(i=0, len=data.edges.length; i<len; i++) {\n var edge = data.edges[i];\n if(edge.color) {\n edge.style = {\n color: edge.color,\n };\n }\n else {\n edge.style = {};\n }\n }\n }\n\n data.schema_version = \"2\";\n\n return data;\n },\n }\n };\n\n\n DataLoader.Loader = function(project, options) {\n this.project = project;\n this.dataConverters = _.defaults(options.converters || {}, DataLoader.converters);\n };\n\n\n DataLoader.Loader.prototype.convert = function(data) {\n var schemaVersionFrom = this.project.getSchemaVersion(data);\n var schemaVersionTo = this.project.getSchemaVersion();\n\n if (schemaVersionFrom !== schemaVersionTo) {\n var converterName = \"from\" + schemaVersionFrom + \"to\" + schemaVersionTo;\n if (typeof this.dataConverters[converterName] === 'function') {\n console.log(\"Apply conversion function :\", converterName);\n data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n console.log(data);\n this.project.set(this.convert(data), {\n validate: true\n });\n };\n\n})(window);\n","(function(root) {\n \"use strict\";\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 style : this.get(\"style\"),\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 type : this.get(\"type\"),\n hidden : this.get(\"hidden\")\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 style : this.get(\"style\"),\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 schema_version : \"2\",\n type : \"project\",\n blacklist : [ 'saveStatus', 'loadingStatus'],\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 _.each(\n [].concat(options.users, options.nodes, options.edges,options.views),\n function(_item) {\n if (_item) {\n _item.project = _project;\n }\n }\n );\n },\n getSchemaVersion : function(data) {\n var t = data;\n if(typeof(t) === \"undefined\") {\n t = this;\n }\n var version = t.schema_version;\n if(!version) {\n return 1;\n }\n else {\n return version;\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})(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 default_dash_array : [4, 5],\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 node_stroke_max_width: 12,\n selected_node_stroke_width: 4,\n selected_node_stroke_max_width: 24,\n node_stroke_witdh_scale: 5,\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 edge_stroke_max_width: 12,\n selected_edge_stroke_width: 4,\n selected_edge_stroke_max_width: 24,\n edge_stroke_witdh_scale: 5,\n\n edge_label_distance: 0,\n edge_label_max_length: 20,\n edge_arrow_length: 18,\n edge_arrow_width: 12,\n edge_arrow_max_width: 32,\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_style: true,\n show_node_editor_style_color: true,\n show_node_editor_style_dash: true,\n show_node_editor_style_thickness: 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_style: true,\n show_edge_editor_style_color: true,\n show_edge_editor_style_dash: true,\n show_edge_editor_style_thickness: true,\n show_edge_editor_style_arrow: 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 \"Dash:\": \"Point. :\",\n \"Thickness:\": \"Epaisseur :\",\n \"Arrow:\": \"Flèche :\",\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 \"Cloud\": \"Nuage\",\n \"Triangle\": \"Triangle\",\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 loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\n _renkan.renderer.redrawActive = true;\n _renkan.renderer.fixSize();\n });\n };\n var _save = function() {\n _proj.set({\n saveStatus : 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 saveStatus : 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('saveStatus'))) {\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({loadingStatus:true});\n },\n success: function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({loadingStatus:false});\n _proj.set({saveStatus:0});\n _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({saveStatus:2});\n },\n success: function(data, textStatus, jqXHR) {\n $(window).off(\"beforeunload\", _onLeave);\n _saveWarn = false;\n _proj.set({saveStatus: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({saveStatus:1});\n\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('saveStatus'))) {\n\t \t\t_checkLeave();\n\t \t}\n\t });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('saveStatus'))) {\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 _.map(_this.data.tags,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 _.map(_this.data.annotations,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 _.each(this.data.objects,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 = renkanJST['templates/list-bin.html'];\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._.each(this.data,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 = renkanJST['templates/wikipedia-bin/resulttemplate.html'];\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._.each(this.data.query.search, 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({change: true});\n };\n this._removeBinding = function() {\n _renderer.removeRepresentation(_this);\n _.defer(function() {\n _renderer.redraw();\n });\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 }).value();\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 }).value();\n\n return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n \n\n var cloud_path = \"M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z\";\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(center, 6, radius);\n }\n },\n \"diamond\":{\n getShape: function() {\n var d = new paper.Path.Rectangle([-Math.SQRT2, -Math.SQRT2], [Math.SQRT2, Math.SQRT2]);\n d.rotate(45);\n return d;\n },\n getImageShape: function(center, radius) {\n var d = new paper.Path.Rectangle([-radius*Math.SQRT2/2, -radius*Math.SQRT2/2], [radius*Math.SQRT2, radius*Math.SQRT2]);\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(center, 8, radius*1, radius*0.7);\n }\n },\n \"cloud\": {\n getShape: function() {\n var path = new paper.Path(cloud_path);\n return path;\n\n },\n getImageShape: function(center, radius) {\n var path = new paper.Path(cloud_path);\n path.scale(radius);\n path.translate(center);\n return path;\n }\n },\n \"triangle\": {\n getShape: function() {\n return new paper.Path.RegularPolygon([0,0], 3, 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.RegularPolygon(center, 3, radius);\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(shape === null || 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 ShapeBuilder.builders = builders;\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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.node_stroke_width + (thickness-1) * (this.options.node_stroke_max_width - this.options.node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_node_stroke_width + (thickness-1) * (this.options.selected_node_stroke_max_width - this.options.selected_node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n buildShape: function(){\n if( 'shape' in this.model.changed ) {\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.circle.sendToBack();\n this.last_circle_radius = 1;\n },\n redraw: function(options) {\n if( 'shape' in this.model.changed && 'change' in options && options.change ) {\n //if( 'shape' in this.model.changed ) {\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 var _strokeWidth = this._getStrokeWidth();\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 + 0.5*_strokeWidth,\n opacity: opacity\n });\n var _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null;\n this.circle.strokeWidth = _strokeWidth;\n this.circle.strokeColor = _color;\n this.circle.dashArray = _dash;\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 if(this.circle) {\n this.circle.sendToBack();\n }\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 (typeof options === 'undefined' || !('dontRedrawEdges' in options) || !options.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.node_image.insertAbove(this.circle);\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._getSelectedStrokeWidth();\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._getStrokeWidth();\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 }).value();\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_scale = 1;\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.pivot = new paper.Point([ this.options.edge_arrow_length / 2, this.options.edge_arrow_width / 2 ]);\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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.edge_stroke_width + (thickness-1) * (this.options.edge_stroke_max_width - this.options.edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_edge_stroke_width + (thickness-1) * (this.options.selected_edge_stroke_max_width - this.options.selected_edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getArrowScale: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return 1 + (thickness-1) * ((this.options.edge_arrow_max_width / this.options.edge_arrow_width) - 1) / (this.options.edge_stroke_witdh_scale-1);\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 _strokeWidth = this._getStrokeWidth(),\n _arrow_scale = this._getArrowScale(),\n _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 + 0.5 * _arrow_scale * this.options.edge_arrow_width),\n _handle = _v.divide(3),\n _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null,\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 var array_opacity =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) || !this.model.has(\"style\") || (typeof this.model.get(\"style\").arrow === 'undefined') ? opacity : 0;\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\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.strokeWidth = _strokeWidth;\n this.line.strokeColor = _color;\n this.line.dashArray = _dash;\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.scale(_arrow_scale / this.arrow_scale);\n this.arrow_scale = _arrow_scale;\n this.arrow.fillColor = _color;\n this.arrow.opacity = array_opacity;\n this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);\n this.arrow.position = this.paper_coords;\n\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._getSelectedStrokeWidth();\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._getStrokeWidth();\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 = _.reject(this.bundle.edges, function(_edge) {\n return _this === _edge;\n });\n }\n }).value();\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 }).value();\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 = _.map(_.range(8), 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 }).value();\n\n /* _BaseEditor End */\n\n return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder'], function ($, _, requtils, BaseEditor, ShapeBuilder) {\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/nodeeditor.html'];\n this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\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 shapes : _(ShapeBuilder.builders).omit('svg').keys().value(),\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.editor_$.off(\"keyup\");\n _this.editor_$.find(\"input, textarea, select\").off(\"change keyup paste\");\n _this.editor_$.find(\".Rk-Edit-Image-File\").off('change');\n _this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").off('hover');\n _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\n _this.editor_$.find(\".Rk-Edit-Image-Del\").off('click');\n _this.editor_$.find(\".Rk-Edit-ColorPicker\").find(\"li\").off('hover click');\n _this.editor_$.find(\".Rk-CloseX\").off('click');\n _this.editor_$.find(\".Rk-Edit-Goto\").off('click');\n\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 = _.throttle(function() {\n _.defer(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.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\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 }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {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 var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\n });\n\n this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n _this.editor_$.find(\".Rk-Edit-Image\").val('');\n onFieldChange();\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 }).value();\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/edgeeditor.html'];\n this.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\n arrow: (_model.has(\"style\") && _model.get(\"style\").arrow) || !_model.has(\"style\") || (typeof _model.get(\"style\").arrow === 'undefined') ? \"checked\" : \"\",\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n from_title: _from_model.get(\"title\"),\n to_title: _to_model.get(\"title\"),\n from_color: (_from_model.has(\"style\") && _from_model.get(\"style\").color) || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n to_color: (_to_model.has(\"style\") && _to_model.get(\"style\").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 _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\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 = _.throttle(function() {\n _.defer(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 if (_this.options.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\n var arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {arrow: arrow});\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 });\n },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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {color: $(this).attr(\"data-color\")}));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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).value();\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 _.each(_event.originalEvent.dataTransfer.types, 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 _.extend(res,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:saveStatus\", function(){\n switch (_this.renkan.project.get(\"saveStatus\")) {\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:loadingStatus\", function(){\n if (_this.renkan.project.get(\"loadingStatus\")){\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(\"loadingStatus\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"add:edges\", function(_edge) {\n _this.addRepresentation(\"Edge\", _edge);\n if (!_this.renkan.project.get(\"loadingStatus\")){\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 = _.reject(this.representations,\n function(_repr) {\n return _repr === _representation;\n }\n );\n },\n getRepresentationByModel: function(_model) {\n if (!_model) {\n return undefined;\n }\n return _.find(this.representations, function(_repr) {\n return _repr.model === _model;\n });\n },\n removeRepresentationsOfType: function(_type) {\n var _representations = _.filter(this.representations,function(_repr) {\n return _repr.type === _type;\n }),\n _this = this;\n _.each(_representations, 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 _.each(this.representations, function(_repr) {\n _repr.unhighlight();\n });\n },\n unselectAll: function(_model) {\n _.each(this.representations, function(_repr) {\n _repr.unselect();\n });\n },\n redraw: function() {\n if(! this.redrawActive ) {\n return;\n }\n _.each(this.representations, function(_representation) {\n _representation.redraw({ dontRedrawEdges: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 _.extend(_data,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 }).value();\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/lodash/lodash',\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":["templates.js","../../js/main.js","../../js/dataloader.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":["this","obj","__t","__p","_","escape","__e","Array","prototype","join","renkan","translate","edge","title","options","show_edge_editor_uri","uri","properties","length","each","ontology","label","property","show_edge_editor_style","show_edge_editor_style_color","show_edge_editor_style_dash","dash","show_edge_editor_style_thickness","thickness","show_edge_editor_style_arrow","arrow","show_edge_editor_direction","show_edge_editor_nodes","from_color","shortenText","from_title","to_title","show_edge_editor_creator","has_creator","created_by_title","show_edge_tooltip_color","color","show_edge_tooltip_uri","short_uri","description","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","static_url","url","show_bins","show_editor","node","show_node_editor_uri","show_node_editor_description","show_node_editor_size","size","show_node_editor_style","show_node_editor_style_color","show_node_editor_style_dash","show_node_editor_style_thickness","show_node_editor_image","image_placeholder","clip_path","allow_image_upload","show_node_editor_creator","change_shapes","shapes","shape","charAt","toUpperCase","substring","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","print","__j","call","arguments","show_top_bar","editor_mode","project","get","show_user_list","show_user_color","user_color_editable","colorPicker","home_button_url","home_button_title","show_fullscreen_button","show_addnode_button","show_addedge_button","show_export_button","show_save_button","show_open_button","show_bookmarklet","show_search_field","resize","show_zoom","save_view","root","$","jQuery","pickerColors","__renkans","_BaseBin","_renkan","_opts","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","html","click","destroy","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","detach","Renkan","push","defaults","templates","renkanJST","template","property_files","f","getJSON","data","concat","read_only","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","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","where","_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","lastsearch","lastval","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","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","slice","_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","default_user_color","_BOOKMARKLET_CODE","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","converters","from1to2","len","nodes","console","log","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","Backbone","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","prepare","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","Edge","from","to","View","isArray","zoom_level","hidden_nodes","RosterUser","blacklist","HasMany","reverseRelation","includeInJSON","_props","_user","findOrCreate","addNode","_node","addEdge","_edge","addView","_view","removeNode","remove","removeEdge","_project","users","views","_item","t","version","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","popup_editor","editor_panel","manual_save","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","default_view","user_name_editable","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","default_dash_array","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","node_stroke_max_width","selected_node_stroke_width","selected_node_stroke_max_width","node_stroke_witdh_scale","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","edge_stroke_width","edge_stroke_max_width","selected_edge_stroke_width","selected_edge_stroke_max_width","edge_stroke_witdh_scale","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_arrow_max_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","uploaded_image_max_kb","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:","Dash:","Thickness:","Arrow:","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","Cloud","Triangle","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","loadingStatus","_data","saveStatus","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","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","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","change","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","value","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","cloud_path","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","SQRT2","rotate","star","cloud","path","scale","triangle","svg","ShapeBuilder","NodeRepr","node_layer","activate","buildShape","hidden","ghost","strokeWidth","h_ratio","labels_$","normal_buttons","NodeEditButton","NodeRemoveButton","NodeHideButton","NodeShowButton","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","pending_delete_buttons","NodeRevertButton","all_buttons","active_buttons","last_circle_radius","minimap","minimap_circle","__representation","miniframe","node_group","addChild","_getStrokeWidth","has","_getSelectedStrokeWidth","changed","shapeBuilder","sendToBack","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","forEach","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_strokeWidth","_color","_dash","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","dontRedrawEdges","ed","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","insertAbove","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","showNeighbors","hideButtons","buttons_timeout","undefined","hideNeighbors","indexNode","hiddenNodes","indexOf","splice","textToReplace","hlvalue","throttledPaperDraw","saveCoords","toModelCoords","_event","_isTouch","unselectAll","index","click_target","edge_layer","bundle","addToBundles","line","arrow_scale","pivot","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_getArrowScale","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","array_opacity","handleIn","handleOut","bounds","_textpos","transform","-moz-transform","-webkit-transform","text_angle","visible","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","keys","closeEditor","onFieldChange","assign","keyCode","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","clearTimeout","NodeButton","delid","delete_list","time","valueOf","confirm","addHiddenNode","unset","_off","_point","addTempEdge","MiniFrame","filesaver","representations","notif_$","setup","initialScale","totalScroll","mouse_down","selected_target","Layer","background_layer","topleft","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","getData","parse","bindClick","selector","fname","evt","last","hideNodes","showNodes","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","_restPos","_grp","_imgdelta","_currentPos","_edgeRepr","_bundle","_er","_dir","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","hideNode","last_point","_scrolldelta","SQRT1_2","open","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","require","config","paths","jquery","underscore","startRenkan"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,KAAgB,UAAIA,KAAgB,cAEpCA,KAAgB,UAAE,8BAAgC,SAASC,KAC3DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,EAAUC,GAAEC,OAC3B,KAAMJ,IACNE,KAAO,oBACS,OAAdD,IAAM,GAAe,GAAKA,KAC5B,yBACgB,OAAdA,IAAM,GAAe,GAAKA,KAC5B,SAGA,OAAOC,MAGPH,KAAgB,UAAE,6BAA+B,SAASC,KAC1DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,GAAIG,IAAMF,EAAEC,MAAcE,OAAMC,UAAUC,KAEzD,KAAMR,IACNE,KAAO,mDACPG,IAAII,OAAOC,UAAU,cACrB,mCACAL,IAAII,OAAOC,UAAU,WACrB,iEACAL,IAAIM,KAAKC,OACT,eACKC,QAAQC,uBACbZ,KAAO,6BACPG,IAAII,OAAOC,UAAU,SACrB,mEACAL,IAAIM,KAAKI,KACT,+CACAV,IAAIM,KAAKI,KACT,yCACKF,QAAQG,WAAWC,SACxBf,KAAO,qCACPG,IAAII,OAAOC,UAAU,4BACrB,8EACCP,EAAEe,KAAKL,QAAQG,WAAY,SAASG,GACrCjB,KAAO,qGACPG,IAAKI,OAAOC,UAAUS,EAASC,QAC/B,wDACCjB,EAAEe,KAAKC,EAASH,WAAY,SAASK,GAAY,GAAIN,GAAMI,EAAS,YAAcE,EAASN,GAC5Fb,MAAO,gFACPG,IAAKU,GACL,kCACKA,IAAQJ,KAAKI,MAClBb,KAAO,aAEPA,KAAO,kCACPG,IAAKI,OAAOC,UAAUW,EAASD,QAC/B,8DAEAlB,KAAO,uBAEPA,KAAO,4CAEPA,KAA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,WAAaA,EACtBtyB,EAAS0yB,YAAcQ,EACvBlzB,EAASulB,eAAiBA,EAC1BvlB,EAASwlB,iBAAmBA,EAC5BxlB,EAASylB,eAAiBA,EAC1BzlB,EAAS0lB,eAAiBA,EAC1B1lB,EAAS+lB,iBAAmBA,EAC5B/lB,EAAS2lB,eAAiBA,EAC1B3lB,EAAS4lB,kBAAoBA,EAC7B5lB,EAAS6lB,iBAAmBA,EAC5B7lB,EAASytB,eAAiBA,EAC1BztB,EAAS0tB,iBAAmBA,EAC5B1tB,EAAS2tB,iBAAmBA,EAC5B3tB,EAAS6zB,UAAYA,EACrB7zB,EAASC,MAAQA,EAEjBohC,gBAGJ7f,OAAO,gBAAiB","sourcesContent":["this[\"renkanJST\"] = this[\"renkanJST\"] || {};\n\nthis[\"renkanJST\"][\"templates/colorpicker.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li data-color=\"' +\n((__t = (c)) == null ? '' : __t) +\n'\" style=\"background: ' +\n((__t = (c)) == null ? '' : __t) +\n'\"></li>';\n\n}\nreturn __p\n};\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 <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Edge\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(edge.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n ';\n if (options.properties.length) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose from vocabulary:\")) +\n'</label>\\n <select class=\"Rk-Edit-Vocabulary\">\\n ';\n _.each(options.properties, function(ontology) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Class\" value=\"\">\\n ' +\n__e( renkan.translate(ontology.label) ) +\n'\\n </option>\\n ';\n _.each(ontology.properties, function(property) { var uri = ontology[\"base-uri\"] + property.uri; ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( uri ) +\n'\"\\n ';\n if (uri === edge.uri) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(property.label) ) +\n'\\n </option>\\n ';\n }) ;\n__p += '\\n ';\n }) ;\n__p += '\\n </select>\\n </p>\\n';\n } } ;\n__p += '\\n';\n if (options.show_edge_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_edge_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Edge color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: <%-edge.color%>;\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( edge.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e( edge.thickness ) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_arrow) { ;\n__p += '\\n <div id=\"Rk-Editor-p-arrow\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Arrow:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Arrow\" class=\"Rk-Edit-Arrow\" ' +\n__e( edge.arrow ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_direction) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Edit-Direction\">' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'</span>\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(edge.from_color) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: >%-edge.to_color%>;\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: <%-edge.created_by_color%>;\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.color ) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (edge.uri) { ;\n__p += '\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' </a> ';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">' +\n__e( edge.short_uri ) +\n'</a>\\n </p>\\n';\n } ;\n__p += '\\n<p>' +\n__e(edge.description) +\n'</p>\\n';\n if (options.show_edge_tooltip_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.from_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.to_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_tooltip_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.created_by_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +\n'\"\\n data-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/search/?search=' +\n((__t = (encodedtitle)) == null ? '' : __t) +\n'&field=all\"\\n data-title=\"' +\n__e(title) +\n'\" data-description=\"Tag \\'' +\n__e(title) +\n'\\'\">\\n\\n <img class=\"Rk-Ldt-Tag-Icon\" src=\"' +\n__e(static_url) +\n'img/ldt-tag.png\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/list-bin.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n ';\n if (image) { ;\n__p += '\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n ';\n } else { ;\n__p += '\\n data-image=\"\"\\n ';\n } ;\n__p += '\\n>';\n if (image) { ;\n__p += '\\n <img class=\"Rk-ResourceList-Image\" src=\"' +\n__e(image) +\n'\" />\\n';\n } ;\n__p += '\\n<h4 class=\"Rk-ResourceList-Title\">\\n ';\n if (url) { ;\n__p += '\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '</a>';\n } ;\n__p += '\\n </h4>\\n ';\n if (description) { ;\n__p += '\\n <p class=\"Rk-ResourceList-Description\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n ';\n } ;\n__p += '\\n ';\n if (image) { ;\n__p += '\\n <div style=\"clear: both;\"></div>\\n ';\n } ;\n__p += '\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/main.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_bins) { ;\n__p += '\\n <div class=\"Rk-Bins\">\\n <div class=\"Rk-Bins-Head\">\\n <h2 class=\"Rk-Bins-Title\">' +\n__e( translate(\"Select contents:\")) +\n'</h2>\\n <form class=\"Rk-Web-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n <div class=\"Rk-Search-Select\">\\n <div class=\"Rk-Search-Current\"></div>\\n <ul class=\"Rk-Search-List\"></ul>\\n </div>\\n <input type=\"submit\" value=\"\"\\n class=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n </form>\\n <form class=\"Rk-Bins-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search in Bins') ) +\n'\" /> <input\\n type=\"submit\" value=\"\"\\n class=\"Rk-Bins-Search-Submit Rk-Search-Submit\"\\n title=\"' +\n__e( translate('Search in Bins') ) +\n'\" />\\n </form>\\n </div>\\n <ul class=\"Rk-Bin-List\"></ul>\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_editor) { ;\n__p += '\\n <div class=\"Rk-Render Rk-Render-';\n if (options.show_bins) { ;\n__p += 'Panel';\n } else { ;\n__p += 'Full';\n } ;\n__p += '\"></div>\\n';\n } ;\n__p += '\\n';\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\n //TODO: change class to id ;\n__p += '\\n<h2>\\n <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Node\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(node.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_description) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Description:\")) +\n'</label>\\n <textarea class=\"Rk-Edit-Description\">' +\n__e(node.description) +\n'</textarea>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_size) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Size:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Size-Value\">' +\n__e(node.size) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Up\">+</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_node_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">\\n ' +\n__e(renkan.translate(\"Node color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: ' +\n__e(node.color) +\n';\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( node.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e(node.thickness) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_image) { ;\n__p += '\\n <div class=\"Rk-Edit-ImgWrap\">\\n <div class=\"Rk-Edit-ImgPreview\">\\n <img src=\"' +\n__e(node.image || node.image_placeholder) +\n'\" />\\n ';\n if (node.clip_path) { ;\n__p += '\\n <svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\">\\n <path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"' +\n__e( node.clip_path ) +\n'\" />\\n </svg>\\n ';\n };\n__p += '\\n </div>\\n </div>\\n <p>\\n <label>' +\n__e(renkan.translate(\"Image URL:\")) +\n'</label>\\n <div>\\n <a class=\"Rk-Edit-Image-Del\" href=\"#\"></a>\\n <input class=\"Rk-Edit-Image\" type=\"text\" value=\\'' +\n__e(node.image) +\n'\\' />\\n </div>\\n </p>\\n';\n if (options.allow_image_upload) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose Image File:\")) +\n'</label>\\n <input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\" />\\n </p>\\n';\n };\n\n } ;\n__p += ' ';\n if (options.show_node_editor_creator && node.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.change_shapes) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Shapes available\")) +\n':</label>\\n <select class=\"Rk-Edit-Shape\">\\n ';\n _.each(shapes, function(shape) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( shape ) +\n'\"';\n if (node.shape === shape) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(shape.charAt(0).toUpperCase() + shape.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.color) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (node.uri) { ;\n__p += '\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '</a>';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">' +\n__e(node.short_uri) +\n'</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_tooltip_description) { ;\n__p += '\\n <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 <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 <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </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 <div class=\"Rk-TopBar\">\\n <div class=\"loader\"></div>\\n ';\n if (!options.editor_mode) { ;\n__p += '\\n <h2 class=\"Rk-PadTitle\">\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n </h2>\\n ';\n } else { ;\n__p += '\\n <input type=\"text\" class=\"Rk-PadTitle\" value=\"' +\n__e( project.get('title') || '' ) +\n'\" placeholder=\"' +\n__e(translate('Untitled project')) +\n'\" />\\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n <div class=\"Rk-Users\">\\n <div class=\"Rk-CurrentUser\">\\n ';\n if (options.show_user_color) { ;\n__p += '\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-CurrentUser-Color\">\\n ';\n if (options.user_color_editable) { ;\n__p += '\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n ';\n } ;\n__p += '\\n </span>\\n ';\n if (options.user_color_editable) { print(colorPicker) } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-CurrentUser-Name\"><unknown user></span>\\n </div>\\n <ul class=\"Rk-UserList\"></ul>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.home_button_url) {;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"' +\n__e( options.home_button_url ) +\n'\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e( translate(options.home_button_title) ) +\n'\\n </div>\\n </div>\\n </a>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_fullscreen_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-FullScreen-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Full Screen\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.editor_mode) { ;\n__p += '\\n ';\n if (options.show_addnode_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddNode-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Node\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_addedge_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddEdge-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Edge\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_save_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Save-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\"></div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_open_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Open-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Open Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_bookmarklet) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")) +\n'\\n </div>\\n </div>\\n </a>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n } else { ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n }; ;\n__p += '\\n ';\n if (options.show_search_field) { ;\n__p += '\\n <form action=\"#\" class=\"Rk-GraphSearch-Form\">\\n <input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"' +\n__e( translate('Search in graph') ) +\n'\" />\\n </form>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n </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 <div class=\"Rk-Labels\"></div>\\n <canvas class=\"Rk-Canvas\" ';\n if (options.resize) { ;\n__p += ' resize=\"\" ';\n } ;\n__p += '></canvas>\\n <div class=\"Rk-Notifications\"></div>\\n <div class=\"Rk-Editor\">\\n ';\n if (options.show_bins) { ;\n__p += '\\n <div class=\"Rk-Fold-Bins\">«</div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_zoom) { ;\n__p += '\\n <div class=\"Rk-ZoomButtons\">\\n <div class=\"Rk-ZoomIn\" title=\"' +\n__e(translate('Zoom In')) +\n'\"></div>\\n <div class=\"Rk-ZoomFit\" title=\"' +\n__e(translate('Zoom Fit')) +\n'\"></div>\\n <div class=\"Rk-ZoomOut\" title=\"' +\n__e(translate('Zoom Out')) +\n'\"></div>\\n ';\n if (options.editor_mode && options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSave\" title=\"' +\n__e(translate('Zoom Save')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n ';\n if (options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSetSaved\" title=\"' +\n__e(translate('View saved zoom')) +\n'\"></div>\\n \\t<div class=\"Rk-ShowHiddenNodes\" title=\"' +\n__e(translate('Show hidden nodes')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n</div>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/search.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"' +\n((__t = ( className )) == null ? '' : __t) +\n'\" data-key=\"' +\n((__t = ( key )) == null ? '' : __t) +\n'\">' +\n((__t = ( title )) == null ? '' : __t) +\n'</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/wikipedia-bin/resulttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"Wikipedia: ' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL( static_url + 'img/wikipedia.png' ) ) +\n'\">\\n\\n <img class=\"Rk-Wikipedia-Icon\" src=\"' +\n__e(static_url) +\n'img/wikipedia.png\">\\n <h4 class=\"Rk-Wikipedia-Title\">\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">' +\n((__t = (htitle)) == null ? '' : __t) +\n'</a>\\n </h4>\\n <p class=\"Rk-Wikipedia-Snippet\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n</li>\\n';\n\n}\nreturn __p\n};","/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n \"use strict\";\n\n if (typeof root.Rkns !== \"object\") {\n root.Rkns = {};\n }\n\n var Rkns = root.Rkns;\n var $ = Rkns.$ = root.jQuery;\n var _ = Rkns._ = root._;\n\n Rkns.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 ];\n\n Rkns.__renkans = [];\n\n var _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\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).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 = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<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 = _path.segments[7].point = _coords.add([_isLeft * _xmargin, 0]);\n _path.segments[1].point.x = _path.segments[2].point.x = _path.segments[5].point.x = _path.segments[6].point.x = _left;\n _path.segments[3].point.x = _path.segments[4].point.x = _right;\n _path.segments[2].point.y = _path.segments[3].point.y = _top;\n _path.segments[4].point.y = _path.segments[5].point.y = _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 // from http://stackoverflow.com/a/6444043\n increaseBrightness: function (hex, percent){\n // strip the leading # if it's there\n hex = hex.replace(/^\\s*#|\\s*$/g, '');\n\n // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`\n if(hex.length === 3){\n hex = hex.replace(/(.)/g, '$1$1');\n }\n\n var r = parseInt(hex.substr(0, 2), 16),\n g = parseInt(hex.substr(2, 2), 16),\n b = parseInt(hex.substr(4, 2), 16);\n\n return '#' +\n ((0|(1<<8) + r + (256 - r) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + g + (256 - g) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + b + (256 - b) * percent / 100).toString(16)).substr(1);\n }\n };\n})(window);\n\n/* END main.js */\n","(function(root) {\n\n \"use strict\";\n\n var DataLoader = root.Rkns.DataLoader = {\n converters: {\n from1to2: function(data) {\n\n var i, len;\n if(typeof data.nodes !== 'undefined') {\n for(i=0, len=data.nodes.length; i<len; i++) {\n var node = data.nodes[i];\n if(node.color) {\n console.log(\"node color : \", node.color);\n node.style = {\n color: node.color,\n };\n }\n else {\n node.style = {};\n }\n }\n }\n if(typeof data.edges !== 'undefined') {\n for(i=0, len=data.edges.length; i<len; i++) {\n var edge = data.edges[i];\n if(edge.color) {\n edge.style = {\n color: edge.color,\n };\n }\n else {\n edge.style = {};\n }\n }\n }\n\n data.schema_version = \"2\";\n\n return data;\n },\n }\n };\n\n\n DataLoader.Loader = function(project, options) {\n this.project = project;\n this.dataConverters = _.defaults(options.converters || {}, DataLoader.converters);\n };\n\n\n DataLoader.Loader.prototype.convert = function(data) {\n var schemaVersionFrom = this.project.getSchemaVersion(data);\n var schemaVersionTo = this.project.getSchemaVersion();\n\n if (schemaVersionFrom !== schemaVersionTo) {\n var converterName = \"from\" + schemaVersionFrom + \"to\" + schemaVersionTo;\n if (typeof this.dataConverters[converterName] === 'function') {\n console.log(\"Apply conversion function :\", converterName);\n data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n console.log(data);\n this.project.set(this.convert(data), {\n validate: true\n });\n };\n\n})(window);\n","(function(root) {\n \"use strict\";\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 style : this.get(\"style\"),\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 type : this.get(\"type\")\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 style : this.get(\"style\"),\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 hidden_nodes: this.get(\"hidden_nodes\")\n // Don't need project id\n };\n }\n });\n\n // PROJECT\n var Project = Models.Project = RenkanModel.extend({\n schema_version : \"2\",\n type : \"project\",\n blacklist : [ 'saveStatus', 'loadingStatus'],\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 _.each(\n [].concat(options.users, options.nodes, options.edges,options.views),\n function(_item) {\n if (_item) {\n _item.project = _project;\n }\n }\n );\n },\n getSchemaVersion : function(data) {\n var t = data;\n if(typeof(t) === \"undefined\") {\n t = this;\n }\n var version = t.schema_version;\n if(!version) {\n return 1;\n }\n else {\n return version;\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})(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 popup_editor: true,\n /* show the node editor as a popup inside the renkan view */\n editor_panel: 'editor-panel',\n /* GUI continer DOM element ID of the editor panel */\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 default_dash_array : [4, 5],\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 node_stroke_max_width: 12,\n selected_node_stroke_width: 4,\n selected_node_stroke_max_width: 24,\n node_stroke_witdh_scale: 5,\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 edge_stroke_max_width: 12,\n selected_edge_stroke_width: 4,\n selected_edge_stroke_max_width: 24,\n edge_stroke_witdh_scale: 5,\n\n edge_label_distance: 0,\n edge_label_max_length: 20,\n edge_arrow_length: 18,\n edge_arrow_width: 12,\n edge_arrow_max_width: 32,\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_style: true,\n show_node_editor_style_color: true,\n show_node_editor_style_dash: true,\n show_node_editor_style_thickness: 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_style: true,\n show_edge_editor_style_color: true,\n show_edge_editor_style_dash: true,\n show_edge_editor_style_thickness: true,\n show_edge_editor_style_arrow: 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 \"Dash:\": \"Point. :\",\n \"Thickness:\": \"Epaisseur :\",\n \"Arrow:\": \"Flèche :\",\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 \"Cloud\": \"Nuage\",\n \"Triangle\": \"Triangle\",\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 loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\n _renkan.renderer.redrawActive = true;\n _renkan.renderer.fixSize();\n });\n };\n var _save = function() {\n _proj.set({\n saveStatus : 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 saveStatus : 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('saveStatus'))) {\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({loadingStatus:true});\n },\n success: function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({loadingStatus:false});\n _proj.set({saveStatus:0});\n _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({saveStatus:2});\n },\n success: function(data, textStatus, jqXHR) {\n $(window).off(\"beforeunload\", _onLeave);\n _saveWarn = false;\n _proj.set({saveStatus: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({saveStatus:1});\n\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('saveStatus'))) {\n\t \t\t_checkLeave();\n\t \t}\n\t });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('saveStatus'))) {\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 _.map(_this.data.tags,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 _.map(_this.data.annotations,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 _.each(this.data.objects,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 = renkanJST['templates/list-bin.html'];\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._.each(this.data,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 = renkanJST['templates/wikipedia-bin/resulttemplate.html'];\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._.each(this.data.query.search, 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({change: true});\n };\n this._removeBinding = function() {\n _renderer.removeRepresentation(_this);\n _.defer(function() {\n _renderer.redraw();\n });\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 }).value();\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 }).value();\n\n return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n \n\n var cloud_path = \"M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z\";\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(center, 6, radius);\n }\n },\n \"diamond\":{\n getShape: function() {\n var d = new paper.Path.Rectangle([-Math.SQRT2, -Math.SQRT2], [Math.SQRT2, Math.SQRT2]);\n d.rotate(45);\n return d;\n },\n getImageShape: function(center, radius) {\n var d = new paper.Path.Rectangle([-radius*Math.SQRT2/2, -radius*Math.SQRT2/2], [radius*Math.SQRT2, radius*Math.SQRT2]);\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(center, 8, radius*1, radius*0.7);\n }\n },\n \"cloud\": {\n getShape: function() {\n var path = new paper.Path(cloud_path);\n return path;\n\n },\n getImageShape: function(center, radius) {\n var path = new paper.Path(cloud_path);\n path.scale(radius);\n path.translate(center);\n return path;\n }\n },\n \"triangle\": {\n getShape: function() {\n return new paper.Path.RegularPolygon([0,0], 3, 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.RegularPolygon(center, 3, radius);\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(shape === null || 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 ShapeBuilder.builders = builders;\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 this.hidden = false;\n this.ghost= false;\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.NodeHideButton(this.renderer, null),\n new Renderer.NodeShowButton(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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.node_stroke_width + (thickness-1) * (this.options.node_stroke_max_width - this.options.node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_node_stroke_width + (thickness-1) * (this.options.selected_node_stroke_max_width - this.options.selected_node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n buildShape: function(){\n if( 'shape' in this.model.changed ) {\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.circle.sendToBack();\n this.last_circle_radius = 1;\n },\n redraw: function(options) {\n if( 'shape' in this.model.changed && 'change' in options && options.change ) {\n //if( 'shape' in this.model.changed ) {\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 if (this.selected && this.renderer.isEditable() && !this.ghost) {\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 var _strokeWidth = this._getStrokeWidth();\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 + 0.5*_strokeWidth,\n opacity: opacity\n });\n var _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null;\n this.circle.strokeWidth = _strokeWidth;\n this.circle.strokeColor = _color;\n this.circle.dashArray = _dash;\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 if(this.circle) {\n this.circle.sendToBack();\n }\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 (typeof options === 'undefined' || !('dontRedrawEdges' in options) || !options.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 if (this.ghost){\n this.show(true);\n } else {\n if (this.hidden) { this.hide(); }\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.node_image.insertAbove(this.circle);\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._getSelectedStrokeWidth();\n if (this.renderer.isEditable() && !this.hidden) {\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 //if the node is hidden and the mouse hover it, it appears as a ghost\n if (this.hidden) {\n this.show(true);\n }\n else {\n this.showNeighbors(true);\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._getStrokeWidth();\n $('.Rk-Bin-Item').removeClass(\"selected\");\n if (this.renderer.minimap) {\n this.minimap_circle.strokeColor = undefined;\n }\n //when the mouse don't hover the node anymore, we hide it\n if (this.hidden) {\n this.hide();\n }\n else {\n this.hideNeighbors();\n }\n this._super(\"unselect\");\n }\n },\n hide: function(){\n var _this = this;\n this.ghost = false;\n this.hidden = true;\n if (typeof this.node_image !== 'undefined'){\n this.node_image.opacity = 0; \n }\n this.hideButtons();\n this.circle.opacity = 0;\n this.title.css('opacity', 0);\n this.minimap_circle.opacity = 0;\n \n \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.hide();\n }\n }\n );\n this.hideNeighbors();\n },\n show: function(ghost){\n var _this = this;\n this.ghost = ghost;\n if (this.ghost){\n if (typeof this.node_image !== 'undefined'){\n this.node_image.opacity = 0.3;\n }\n this.circle.opacity = 0.3;\n this.title.css('opacity', 0.3);\n this.minimap_circle.opacity = 0.3;\n } else {\n this.hidden = false;\n this.redraw();\n }\n \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.show(_this.ghost);\n }\n }\n ); \n },\n hideNeighbors: function(){\n var _this = this;\n _.each(\n this.project.get(\"edges\").filter(\n function (ed) {\n return (ed.get(\"from\") === _this.model);\n }\n ),\n function(edge, index, list) {\n var repr = _this.renderer.getRepresentationByModel(edge.get(\"to\"));\n if (repr && repr.ghost) {\n repr.hide();\n }\n }\n );\n },\n showNeighbors: function(ghost){\n var _this = this;\n _.each(\n this.project.get(\"edges\").filter(\n function (ed) {\n return (ed.get(\"from\") === _this.model);\n }\n ),\n function(edge, index, list) {\n var repr = _this.renderer.getRepresentationByModel(edge.get(\"to\"));\n if (repr && repr.hidden) {\n repr.show(ghost);\n if (!ghost){\n var indexNode = _this.renderer.hiddenNodes.indexOf(repr.model.id);\n if (indexNode !== -1){\n _this.renderer.hiddenNodes.splice(indexNode, 1);\n }\n }\n }\n }\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 (this.hidden) {\n var index = this.renderer.hiddenNodes.indexOf(this.model.id);\n if (index !== -1){\n this.renderer.hiddenNodes.splice(index, 1);\n }\n this.show(false);\n this.select();\n } else {\n if (!_isTouch && !this.model.get(\"delete_scheduled\")) {\n this.openEditor();\n }\n this.model.trigger(\"clicked\");\n }\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 }).value();\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.hidden = false;\n this.ghost = false;\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_scale = 1;\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.pivot = new paper.Point([ this.options.edge_arrow_length / 2, this.options.edge_arrow_width / 2 ]);\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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.edge_stroke_width + (thickness-1) * (this.options.edge_stroke_max_width - this.options.edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_edge_stroke_width + (thickness-1) * (this.options.selected_edge_stroke_max_width - this.options.selected_edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getArrowScale: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return 1 + (thickness-1) * ((this.options.edge_arrow_max_width / this.options.edge_arrow_width) - 1) / (this.options.edge_stroke_witdh_scale-1);\n },\n redraw: function() {\n var from = this.model.get(\"from\"),\n to = this.model.get(\"to\");\n if (!from || !to || (this.hidden && !this.ghost)) {\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 (this.from_representation.hidden && !this.from_representation.ghost) ||\n (this.to_representation.hidden && !this.to_representation.ghost)) {\n this.hide();\n return;\n }\n var _strokeWidth = this._getStrokeWidth(),\n _arrow_scale = this._getArrowScale(),\n _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 + 0.5 * _arrow_scale * this.options.edge_arrow_width),\n _handle = _v.divide(3),\n _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null,\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 var array_opacity =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) || !this.model.has(\"style\") || (typeof this.model.get(\"style\").arrow === 'undefined') ? opacity : 0;\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\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.strokeWidth = _strokeWidth;\n this.line.strokeColor = _color;\n this.line.dashArray = _dash;\n this.line.opacity = this.ghost ? 0.3 : 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.scale(_arrow_scale / this.arrow_scale);\n this.arrow_scale = _arrow_scale;\n this.arrow.fillColor = _color;\n this.arrow.opacity = this.ghost ? 0.3 : array_opacity; //TODO: magic constant + var name\n this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);\n this.arrow.position = this.paper_coords;\n\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: this.ghost ? 0.3 : 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 hide: function(){\n this.hidden = true;\n this.ghost = false;\n \n this.text.hide();\n this.line.visible = false;\n this.arrow.visible = false;\n this.minimap_line.visible = false;\n },\n show: function(ghost){\n this.ghost = ghost;\n if (this.ghost) {\n this.text.css('opacity', 0.3);\n this.line.opacity = 0.3;\n this.arrow.opacity = 0.3;\n this.minimap_line.opacity = 0.3;\n } else {\n this.hidden = false;\n \n this.text.css('opacity', 1);\n this.line.opacity = 1;\n this.arrow.opacity = 1;\n this.minimap_line.opacity = 1;\n }\n this.text.show();\n this.line.visible = true;\n this.arrow.visible = true;\n this.minimap_line.visible = true;\n this.redraw();\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._getSelectedStrokeWidth();\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._getStrokeWidth();\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 = _.reject(this.bundle.edges, function(_edge) {\n return _this === _edge;\n });\n }\n }).value();\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 }).value();\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 = _.map(_.range(8), 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 }).value();\n\n /* _BaseEditor End */\n\n return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder'], function ($, _, requtils, BaseEditor, ShapeBuilder) {\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/nodeeditor.html'];\n //this.templates['default']= this.options.templates['templates/nodeeditor.html'];\n //fusionner avec this.options.node_editor_templates\n this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\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 shapes : _(ShapeBuilder.builders).omit('svg').keys().value(),\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.editor_$.off(\"keyup\");\n _this.editor_$.find(\"input, textarea, select\").off(\"change keyup paste\");\n _this.editor_$.find(\".Rk-Edit-Image-File\").off('change');\n _this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").off('hover');\n _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\n _this.editor_$.find(\".Rk-Edit-Image-Del\").off('click');\n _this.editor_$.find(\".Rk-Edit-ColorPicker\").find(\"li\").off('hover click');\n _this.editor_$.find(\".Rk-CloseX\").off('click');\n _this.editor_$.find(\".Rk-Edit-Goto\").off('click');\n\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 = _.throttle(function() {\n _.defer(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.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\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 }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {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 var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\n });\n\n this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n _this.editor_$.find(\".Rk-Edit-Image\").val('');\n onFieldChange();\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 if (this.options.popup_editor){\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 }\n this.editor_$.show();\n paper.view.draw();\n }\n }).value();\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/edgeeditor.html'];\n this.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\n arrow: (_model.has(\"style\") && _model.get(\"style\").arrow) || !_model.has(\"style\") || (typeof _model.get(\"style\").arrow === 'undefined') ? \"checked\" : \"\",\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n from_title: _from_model.get(\"title\"),\n to_title: _to_model.get(\"title\"),\n from_color: (_from_model.has(\"style\") && _from_model.get(\"style\").color) || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n to_color: (_to_model.has(\"style\") && _to_model.get(\"style\").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 _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\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 = _.throttle(function() {\n _.defer(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 if (_this.options.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\n var arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {arrow: arrow});\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 });\n },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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {color: $(this).attr(\"data-color\")}));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\n });\n }\n },\n redraw: function() {\n if (this.options.popup_editor){\n var _coords = this.source_representation.paper_coords;\n Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);\n }\n this.editor_$.show();\n paper.view.draw();\n }\n }).value();\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 }).value();\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 = -125;\n this.endAngle = -55;\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 }).value();\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 = -10;\n this.endAngle = 45;\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 }).value();\n\n /* NodeRemoveButton End */\n\n return NodeRemoveButton;\n\n});\n\n\ndefine('renderer/nodehidebutton',['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 NodeHideButton = Utils.inherit(NodeButton);\n\n _(NodeHideButton.prototype).extend({\n _init: function() {\n this.type = \"Node-hide-button\";\n this.lastSectorInner = 0;\n this.startAngle = 45;\n this.endAngle = 90;\n this.imageName = \"hide\";\n this.text = \"Hide\";\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 this.renderer.addHiddenNode(this.source_representation.model);\n }\n }\n }).value();\n\n /* NodeRemoveButton End */\n\n return NodeHideButton;\n\n});\n\n\ndefine('renderer/nodeshowbutton',['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 NodeShowButton = Utils.inherit(NodeButton);\n\n _(NodeShowButton.prototype).extend({\n _init: function() {\n this.type = \"Node-show-button\";\n this.lastSectorInner = 0;\n this.startAngle = 90;\n this.endAngle = 135;\n this.imageName = \"show\";\n this.text = \"Show\";\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 this.source_representation.showNeighbors(false);\n }\n }\n }).value();\n\n /* NodeShowButton End */\n\n return NodeShowButton;\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 }).value();\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 = 135;\n this.endAngle = 190;\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 }).value();\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 = -55;\n this.endAngle = -10;\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 }).value();\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 = -170;\n this.endAngle = -125;\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 if (!_renkan.options.popup_editor){\n this.editor_$ = $(\"#\" + _renkan.options.editor_panel);\n }else{\n this.editor_$ = this.$.find(\".Rk-Editor\");\n }\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.hiddenNodes = [];\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).value();\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', 'hide', 'show', '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 _.each(_event.originalEvent.dataTransfer.types, 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 _.extend(res,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, hidden_nodes: _this.hiddenNodes } );\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 _this.hiddenNodes = view.get(\"hidden_nodes\") || [];\n _this.hideNodes();\n }\n });\n this.$.find(\".Rk-ShowHiddenNodes\").mouseenter( function() {\n _this.showNodes(true);\n _this.$.find(\".Rk-ShowHiddenNodes\").mouseleave( function() {\n _this.hideNodes(false);\n });\n });\n this.$.find(\".Rk-ShowHiddenNodes\").click( function() {\n _this.showNodes(false);\n _this.$.find(\".Rk-ShowHiddenNodes\").off( \"mouseleave\" ); \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:saveStatus\", function(){\n switch (_this.renkan.project.get(\"saveStatus\")) {\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:loadingStatus\", function(){\n if (_this.renkan.project.get(\"loadingStatus\")){\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(\"loadingStatus\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"add:edges\", function(_edge) {\n _this.addRepresentation(\"Edge\", _edge);\n if (!_this.renkan.project.get(\"loadingStatus\")){\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 = _.reject(this.representations,\n function(_repr) {\n return _repr === _representation;\n }\n );\n },\n getRepresentationByModel: function(_model) {\n if (!_model) {\n return undefined;\n }\n return _.find(this.representations, function(_repr) {\n return _repr.model === _model;\n });\n },\n removeRepresentationsOfType: function(_type) {\n var _representations = _.filter(this.representations,function(_repr) {\n return _repr.type === _type;\n }),\n _this = this;\n _.each(_representations, 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 _.each(this.representations, function(_repr) {\n _repr.unhighlight();\n });\n },\n unselectAll: function(_model) {\n _.each(this.representations, function(_repr) {\n _repr.unselect();\n });\n },\n redraw: function() {\n var _this = this;\n if(! this.redrawActive ) {\n return;\n }\n _.each(this.representations, function(_representation) {\n _representation.redraw({ dontRedrawEdges: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 addHiddenNode: function(_model){\n this.hideNode(_model);\n this.hiddenNodes.push(_model.id);\n },\n hideNode: function(_model){\n var _this = this;\n if (typeof _this.getRepresentationByModel(_model) !== 'undefined'){\n _this.getRepresentationByModel(_model).hide();\n }\n },\n hideNodes: function(){\n var _this = this;\n this.hiddenNodes.forEach(function(_id, index){\n var node = _this.renkan.project.get(\"nodes\").get(_id);\n if (typeof node !== 'undefined'){\n return _this.hideNode(_this.renkan.project.get(\"nodes\").get(_id));\n }else{\n _this.hiddenNodes.splice(index, 1);\n }\n });\n paper.view.draw();\n },\n showNodes: function(ghost){\n var _this = this;\n this.hiddenNodes.forEach(function(_id){\n _this.getRepresentationByModel(_this.renkan.project.get(\"nodes\").get(_id)).show(ghost);\n });\n if (!ghost){\n this.hiddenNodes = [];\n }\n paper.view.draw();\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 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 \n if (!this.isEditable()) {\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n if (_hitResult.item.__representation.model.get('uri')){\n window.open(_hitResult.item.__representation.model.get('uri'), '_blank');\n }\n }\n return;\n }\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 _.extend(_data,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 }).value();\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/lodash/lodash',\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/nodehidebutton',\n 'renderer/nodeshowbutton',\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, NodeHideButton, NodeShowButton, 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.NodeHideButton = NodeHideButton;\n Renderer.NodeShowButton = NodeShowButton;\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
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.css Wed Jun 03 19:16:58 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.css Thu Jun 04 10:04:01 2015 +0200
@@ -560,7 +560,7 @@
top: 0;
}
-.Rk-ZoomIn, .Rk-ZoomOut, .Rk-ZoomFit, .Rk-ZoomSave, .Rk-ZoomSetSaved {
+.Rk-ZoomIn, .Rk-ZoomOut, .Rk-ZoomFit, .Rk-ZoomSave, .Rk-ZoomSetSaved, .Rk-ShowHiddenNodes {
width: 21px; height: 20px; background: url(../img/zoombuttons.png); margin: 5px;
}
.Rk-ZoomIn:hover {
@@ -590,6 +590,12 @@
.Rk-ZoomSetSaved:hover {
background-position: -84px -20px;
}
+.Rk-ShowHiddenNodes {
+ background-position: -105px 0;
+}
+.Rk-ShowHiddenNodes:hover {
+ background-position: -105px -20px;
+}
/* Bins */
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.min.css Wed Jun 03 19:16:58 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.min.css Thu Jun 04 10:04:01 2015 +0200
@@ -50,4 +50,4 @@
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
- *//*! renkan - v0.7.11 - Copyright © IRI 2014 */#renkan{overflow:hidden}.Rk-Main h3,.Rk-Main h4,.Rk-Main li,.Rk-Main p,.Rk-Main ul{border:0 none;margin:0;padding:0}.Rk-Main li,.Rk-Main ul{list-style:none}.Rk-Main input::-moz-focus-inner{border:0;padding:0}.Rk-Main table{border-collapse:separate;border-spacing:0}.Rk-Main td,.Rk-Main th{vertical-align:top}.Rk-Main img a{border:none}.Rk-Main{font-size:10px;font-family:Arial,Helvetica,sans-serif;background:#fff;color:#000}.Rk-Main a{color:#6060c0}.Rk-Main{position:absolute;left:0;top:0;right:0;bottom:0}.Rk-Render{position:absolute;top:0;right:0;bottom:0;background:#fff}.Rk-Render-Full{left:0}.Rk-Render-Panel{left:300px}.Rk-TopBar{position:absolute;left:0;top:0;right:0;height:35px;background:#333;background:-moz-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-webkit-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-ms-linear-gradient(top,#505050 5px,#1e1e1e 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#505050', endColorstr='#1e1e1e', GradientType=0)}.Rk-TopBar .loader{display:block;background:none repeat red;width:0;height:4px;overflow:hidden;position:absolute;bottom:0;left:0;transition:width 3s linear;z-index:50}.Rk-TopBar .loader.run{width:100%}.Rk-PadTitle{float:left;font-size:14px;height:16px;margin:4px 5px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;font-weight:700}input.Rk-PadTitle{width:180px}h2.Rk-PadTitle{min-width:180px;max-width:320px;overflow:hidden}.Rk-Users{float:right;width:130px;margin:4px 5px}.Rk-CurrentUser{font-size:13px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;text-align:center}.Rk-CurrentUser-Color{display:inline-block;width:12px;height:12px;border:1px solid #333;margin:-2px 2px;position:relative}.Rk-CurrentUser input{width:95px;padding:1px;border:none;border-radius:2px}.Rk-UserList{box-shadow:0 2px 2px #999;position:relative;z-index:3;display:none;padding-top:8px}.Rk-User{background:#fff;padding:3px;font-size:12px;border-style:solid solid none;border-color:#ccc;border-width:1px}.Rk-TopBar-Button{float:right;background:url(../img/topbarbuttons.png) no-repeat;height:35px;cursor:pointer;position:relative}.Rk-TopBar-Separator{background:#666;background:-moz-linear-gradient(top,#666 20%,#333 80%);background:-webkit-linear-gradient(top,#666 20%,#333 80%);background:-ms-linear-gradient(top,#666 20%,#333 80%);content:"";display:block;height:35px;float:right;width:1px;border-left:1px solid #111;margin:0 3px}.Rk-TopBar-Tooltip{position:absolute;top:31px;left:50%;margin-left:-60px;width:120px;z-index:4;display:none}.Rk-TopBar-Tooltip-Contents{background:#fff;font-size:13px;font-weight:700;color:#6060c0;text-align:center;padding:2px;border-style:none solid solid;border-width:1px;border-color:#ccc;border-bottom-left-radius:2px;border-bottom-right-radius:2px}.Rk-TopBar-Tooltip:before{content:".";display:block;text-indent:-8000px;height:7px;background:url(../img/tooltiparrow.png) center no-repeat;margin:0 1px}.Rk-AddNode-Button{width:30px;background-position:-2px 0}.Rk-AddNode-Button:hover{background-position:-2px -35px}.Rk-FullScreen-Button{width:30px;background-position:-36px 0}.Rk-FullScreen-Button:hover{background-position:-36px -35px}.Rk-AddEdge-Button{width:30px;background-position:-70px 0}.Rk-AddEdge-Button:hover{background-position:-70px -35px}.Rk-Save-Button{width:30px;background-position:-104px 0}.Rk-Save-Button.saving{background-position:-104px 0}.Rk-Save-Button.Rk-Save-Online:hover,.Rk-Save-Button.saved:hover,.Rk-Save-Button:hover{background-position:-104px -35px}.Rk-Save-Button.Rk-Save-Online:active,.Rk-Save-Button.saved:active,.Rk-Save-Button:active{background-position:-104px 0}.Rk-Save-Button.to-save{background-position:-172px -35px}.Rk-Save-Button.Rk-Save-Online,.Rk-Save-Button.saved{background-position:-172px 0}.Rk-Save-Button.Rk-Save-ReadOnly,.Rk-Save-Button.disabled{opacity:.4;cursor:default}.Rk-Export-Button{width:30px;background-position:-274px 0}.Rk-Export-Button.disabled{opacity:.5;cursor:default}.Rk-Export-Button:hover{background-position:-274px -35px}.Rk-Export-Button.disabled:hover{opacity:1;background-position:-274px 0}.Rk-Bookmarklet-Button{width:30px;background-position:-138px 0}.Rk-Bookmarklet-Button.disabled{opacity:.5;cursor:default}.Rk-Bookmarklet-Button:hover{background-position:-138px -35px}.Rk-Bookmarklet-Button.disabled:hover{opacity:1;background-position:-138px 0}.Rk-Home-Button{width:30px;background-position:-206px 0}.Rk-Home-Button:hover{background-position:-206px -35px}.Rk-Open-Button{width:30px;background-position:-240px 0}.Rk-Open-Button:hover{background-position:-240px -35px}.Rk-GraphSearch-Form{float:right;width:185px;position:relative}.Rk-GraphSearch-Form:after,.Rk-GraphSearch-Form:before{position:absolute;display:block;content:".";text-indent:-9999px}.Rk-GraphSearch-Form:before{right:10px;top:20px;width:7px;height:2px;border:none;padding:0;background:#666;transform:rotate(40deg);-webkit-transform:rotate(40deg)}.Rk-GraphSearch-Form:after{right:13px;top:11px;width:6px;height:6px;border-radius:8px;border:2px solid #666}.Rk-GraphSearch-Field{line-height:23px;font-size:14px;height:23px;padding:0 5px;border:none;margin:6px 5px;width:165px;background:#f0f0f0;box-shadow:1px 1px 1px #999 inset;border-radius:5px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Editing-Space{position:absolute;left:0;top:35px;right:0;bottom:0;overflow:hidden;background:-moz-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-webkit-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-ms-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%)}.Rk-Editing-Space-Full{top:0}.Rk-Canvas{position:absolute;left:0;top:0;right:0;bottom:0;z-index:2}.Rk-Canvas[resize]{width:100%;height:100%}.Rk-Highlighted{background:rgba(255,255,0,.5)}.Rk-Labels{position:absolute;left:0;top:0;z-index:1;font-family:"Segoe UI","Helvetica Neue",Arial,Helvetica,sans-serif}.Rk-Label{position:absolute;width:160px;margin-left:-80px;text-align:center;font-size:13px;line-height:13px}.Rk-Edge-Label{font-size:11px;transform-origin:50% 0;-moz-transform-origin:50% 0;-webkit-transform-origin:50% 0;-ms-transform-origin:50% 0}.Rk-Editor{position:absolute;left:0;top:0;z-index:3}.Rk-Notifications{position:absolute;right:15px;top:15px;width:200px;padding:10px;border-radius:8px;display:none;color:#fff;font-size:13px;text-align:center;font-weight:700;background:rgba(20,20,20,.7);background:-moz-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-webkit-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-ms-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#202020', endColorstr='#000000', GradientType=0)}.Rk-CloseX{float:right;cursor:pointer}.Rk-Editor h2{font-size:16px;font-weight:700}.Rk-Editor p,.Rk-Editor-p,.Rk-Editor-p>div{margin:5px 0;font-size:12px;clear:both}.Rk-Editor-Label{float:left;width:80px}a.Rk-Edit-Goto{display:block;float:right;width:18px;height:17px;margin:1px 0;border:none;background:url(../img/goto.png)}.Rk-Edit-Image-File,.Rk-Edit-Title,.Rk-Edit-URI,.Rk-Edit-Vocabulary{font-size:12px;width:250px}.Rk-Edit-Image{font-size:12px;width:220px}.Rk-Edit-Image-Del{display:inline-block;background:url(../img/remove.png);background-size:15px 20px;background-repeat:no-repeat;vertical-align:top;height:20px;width:15px;margin-right:2px}.Rk-Edit-URI{font-size:12px;width:220px}.Rk-Edit-ImgWrap{text-align:center}.Rk-Edit-ImgPreview{display:inline-block;border:1px solid #666;margin:5px auto;position:relative}.Rk-Edit-ImgPreview img{display:inline-block;max-width:253px!important;max-height:200px!important}.Rk-Edit-ImgPreview svg{height:100%;left:0;position:absolute;top:0;width:100%}.Rk-Editor textarea{width:250px;height:120px;resize:none}.Rk-UserColor{display:inline-block;width:12px;height:12px;border:1px solid #666;margin:-2px 2px}.Rk-Edit-Color{display:inline-block;width:10px;height:10px;border:2px solid #333;margin:-2px 2px;position:relative}.Rk-Edit-ColorTip{display:block;width:3px;height:3px;background:#fff;position:absolute;bottom:0;right:0;cursor:pointer}.Rk-Edit-ColorPicker-Wrapper{display:inline-block;position:relative;float:left}.Rk-Edit-ColorPicker{position:absolute;top:-2px;left:15px;width:96px;height:96px;border:1px solid #CCC;padding:5px 4px 4px 5px;background:#fff;border-radius:5px;display:none;z-index:4}.Rk-CurrentUser .Rk-Edit-ColorPicker{left:-105px;top:2px}.Rk-Edit-ColorPicker-Text{color:#303080;font-weight:700}.Rk-Edit-ColorPicker li{float:left;width:11px;height:11px;margin:0 1px 1px 0;cursor:pointer}.Rk-Edit-Dash{float:left;display:inline-block}.Rk-Edit-Size-Btn{font-size:13px;font-weight:700;padding:0 4px;background:#fff;color:#000;border:1px solid #ccc;text-decoration:none}.Rk-Edit-Size-Btn:hover{background:#666}.Rk-Edit-Size-Disp{display:inline-block;padding:0 5px;text-align:center;width:20px}.Rk-Edit-Vocabulary-Class{color:#999;font-style:italic;font-weight:700}.Rk-Edit-Vocabulary-Property{padding-left:20px}.Rk-Edit-Direction{border:1px solid #666;padding:3px 5px;line-height:20px;border-radius:3px;background:#f0f0f0;cursor:pointer}.Rk-Edit-Direction:hover{background:silver}.Rk-Display-Title a{text-decoration:none;color:#000}.Rk-Display-Title a:hover{text-decoration:underline}.Rk-Display-URI{font-style:italic}.Rk-Display-ImgPreview{margin:5px auto;display:block;max-width:255px!important;max-height:260px!important}.Rk-Fold-Bins{position:absolute;top:5px;width:12px;text-align:center;font-size:16px;cursor:pointer;line-height:16px;padding:4px;color:#fff;background:#666;border-radius:0 6px 6px 0;font-weight:700}.Rk-Fold-Bins:hover{background:#333}.Rk-ZoomButtons{position:absolute;left:0;top:35px;cursor:pointer}.Rk-Editing-Space-Full .Rk-ZoomButtons{top:0}.Rk-ZoomFit,.Rk-ZoomIn,.Rk-ZoomOut,.Rk-ZoomSave,.Rk-ZoomSetSaved{width:21px;height:20px;background:url(../img/zoombuttons.png);margin:5px}.Rk-ZoomIn:hover{background-position:0 -20px}.Rk-ZoomFit{background-position:-42px 0}.Rk-ZoomFit:hover{background-position:-42px -20px}.Rk-ZoomOut{background-position:-21px 0}.Rk-ZoomOut:hover{background-position:-21px -20px}.Rk-ZoomSave{background-position:-63px 0}.Rk-ZoomSave:hover{background-position:-63px -20px}.Rk-ZoomSetSaved{background-position:-84px 0;display:none}.Rk-ZoomSetSaved:hover{background-position:-84px -20px}.Rk-Bins{background:#fff;position:absolute;left:0;top:0;width:299px;bottom:0;overflow:hidden;border-right:1px solid #252525}.Rk-Bins-Title{border:0 none;width:290px;height:15px;line-height:15px;margin:0;padding:15px 0 5px 10px;font-size:14px;color:#F0F0F0;background:-moz-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-webkit-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-ms-linear-gradient(top,#1e1e1e 5px,#606060 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1e1e1e', endColorstr='#606060', GradientType=0)}.Rk-Search-Form{padding:0 10px 8px;height:27px;background:#606060}.Rk-Search-Input,.Rk-Search-Select{float:left;margin:0}.Rk-Search-Input{border-top-left-radius:5px;border-bottom-left-radius:5px;border:1px solid #003050;font-size:13px;background:#fff;height:25px;padding:0 5px;line-height:25px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Web-Search-Input{width:190px}.Rk-Bins-Search-Input{width:235px}.Rk-Search-Select{display:inline-block;position:relative;width:45px;border-width:1px;border-color:#003050;border-style:solid none;cursor:pointer;height:25px;background:#fff url(../img/more.png) 30px 10px no-repeat}.Rk-Search-Select:hover{background-color:#3030FF}.Rk-Search-Current{width:40px;height:20px;margin:2px;background-repeat:no-repeat}.Rk-Search-List{width:180px;margin-left:15px;font-size:13px;position:absolute;right:0;top:25px;background:#fff;box-shadow:1px 1px 2px #505050;display:none;border:1px solid #ccc;z-index:2}.Rk-Search-List li{padding:2px 2px 2px 30px;border-top:1px solid #ccc;height:16px;background-color:#fff;background-repeat:no-repeat;cursor:pointer}.Rk-Search-List li:hover{background-color:#3030ff;color:#fff}.Rk-Search-Submit{border:1px solid #003050;height:27px;width:30px;border-top-right-radius:5px;border-bottom-right-radius:5px;background:#333 center no-repeat url(../img/search.png);cursor:pointer}.Rk-Search-Submit:hover{background-color:#999}.Rk-Bin-Title{background:#333;background:-moz-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-webkit-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-ms-linear-gradient(top,#505050 20%,#1e1e1e 80%);font-weight:700;font-size:14px;padding:5px;cursor:pointer;color:#f0f0f0;margin:0;border:0 none}.Rk-Bin-Close{float:right;display:block;font-size:16px;font-weight:700;margin:2px 3px 0;color:#f0f0f0;cursor:pointer;text-shadow:-1px -1px 1px #999,1px 1px 1px #000;text-decoration:none}.Rk-Bin-Close:hover{color:#ffff80}.Rk-Bin-Title:hover{color:#ffffe0;background:#505050;background:-moz-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-webkit-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-ms-linear-gradient(top,#141414 20%,#3c3c3c 80%)}.Rk-Bin-Refresh{width:18px;height:17px;background:url(../img/refresh.png);display:block;float:right;margin-top:4px}.Rk-Bin-Refresh:hover{background-position:-18px 0}.Rk-Bin-Count{float:right;background:#c000a0;color:#FFF;text-shadow:1px 1px 1px #000;display:none;border-radius:4px;padding:1px 3px;font-size:10px;font-weight:700;margin-top:4px}.Rk-Bin-Title-Icon{float:left;width:25px;margin:2px}.Rk-Bin-Main{overflow:auto;background:#fff;background:-moz-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-webkit-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-ms-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%)}.Rk-Bin-Item{cursor:move}.Rk-Bin-Item.hover,.Rk-Bin-Item:hover{background:-moz-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-webkit-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-ms-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d0d0d0', endColorstr='#f3f3f3', GradientType=0)}.Rk-Bin-Item.selected{background:#ffffc0}.Rk-Bin-Main li{padding:2px;border-bottom:1px solid #ccc;clear:both;overflow:hidden}.Rk-Bin-Main h3{font-size:14px;font-style:italic;font-weight:700;text-align:center}.Rk-Bin-Main h4{font-size:12px;font-weight:700}.Rk-Bin-Main p{font-size:11px}.Rk-Bin-Main h4 a{color:#303080}.Rk-Bin-Main .searchmatch{background:#ffff80}.Rk-Wikipedia-Search-Icon{background-image:url(../img/search-logos.png)}.Rk-Wikipedia-Icon{float:left;margin:3px;max-height:48px;max-width:48px}.Rk-Wikipedia-Title-Icon{height:20px;background:url(../img/search-logos.png)}.Rk-Wikipedia-Lang-en{background-position:0 -20px}.Rk-Wikipedia-Lang-fr{background-position:0 -40px}.Rk-Wikipedia-Lang-ja{background-position:0 -60px}.Rk-Wikipedia-Result{min-height:51px}.Rk-Wikipedia-Result h4,.Rk-Wikipedia-Result p{margin-left:54px}.Rk-ResourceList-Image{float:left;max-width:100px;max-height:75px;margin-right:2px}.Rk-Ldt-Icon,.Rk-Ldt-Title-Icon{background:url(../img/search-logos.png);background-position:0 -100px;background-repeat:no-repeat}.Rk-Ldt-Title-Icon{height:20px;margin-top:4px}.Rk-Ldt-Tag-Icon{float:left;margin:0 2px 0 0}.Rk-Ldt-Annotation-Icon{float:left;margin:3px}.Rk-Clear{clear:both}h4.Rk-Bin-Loading{margin:10px;text-align:center;font-size:20px;color:#999}
\ No newline at end of file
+ *//*! renkan - v0.7.11 - Copyright © IRI 2014 */#renkan{overflow:hidden}.Rk-Main h3,.Rk-Main h4,.Rk-Main li,.Rk-Main p,.Rk-Main ul{border:0 none;margin:0;padding:0}.Rk-Main li,.Rk-Main ul{list-style:none}.Rk-Main input::-moz-focus-inner{border:0;padding:0}.Rk-Main table{border-collapse:separate;border-spacing:0}.Rk-Main td,.Rk-Main th{vertical-align:top}.Rk-Main img a{border:none}.Rk-Main{font-size:10px;font-family:Arial,Helvetica,sans-serif;background:#fff;color:#000}.Rk-Main a{color:#6060c0}.Rk-Main{position:absolute;left:0;top:0;right:0;bottom:0}.Rk-Render{position:absolute;top:0;right:0;bottom:0;background:#fff}.Rk-Render-Full{left:0}.Rk-Render-Panel{left:300px}.Rk-TopBar{position:absolute;left:0;top:0;right:0;height:35px;background:#333;background:-moz-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-webkit-linear-gradient(top,#505050 5px,#1e1e1e 30px);background:-ms-linear-gradient(top,#505050 5px,#1e1e1e 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#505050', endColorstr='#1e1e1e', GradientType=0)}.Rk-TopBar .loader{display:block;background:none repeat red;width:0;height:4px;overflow:hidden;position:absolute;bottom:0;left:0;transition:width 3s linear;z-index:50}.Rk-TopBar .loader.run{width:100%}.Rk-PadTitle{float:left;font-size:14px;height:16px;margin:4px 5px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;font-weight:700}input.Rk-PadTitle{width:180px}h2.Rk-PadTitle{min-width:180px;max-width:320px;overflow:hidden}.Rk-Users{float:right;width:130px;margin:4px 5px}.Rk-CurrentUser{font-size:13px;background:#666;padding:4px;border:1px solid #333;border-radius:3px;box-shadow:0 1px 0 #505050;color:#fff;text-align:center}.Rk-CurrentUser-Color{display:inline-block;width:12px;height:12px;border:1px solid #333;margin:-2px 2px;position:relative}.Rk-CurrentUser input{width:95px;padding:1px;border:none;border-radius:2px}.Rk-UserList{box-shadow:0 2px 2px #999;position:relative;z-index:3;display:none;padding-top:8px}.Rk-User{background:#fff;padding:3px;font-size:12px;border-style:solid solid none;border-color:#ccc;border-width:1px}.Rk-TopBar-Button{float:right;background:url(../img/topbarbuttons.png) no-repeat;height:35px;cursor:pointer;position:relative}.Rk-TopBar-Separator{background:#666;background:-moz-linear-gradient(top,#666 20%,#333 80%);background:-webkit-linear-gradient(top,#666 20%,#333 80%);background:-ms-linear-gradient(top,#666 20%,#333 80%);content:"";display:block;height:35px;float:right;width:1px;border-left:1px solid #111;margin:0 3px}.Rk-TopBar-Tooltip{position:absolute;top:31px;left:50%;margin-left:-60px;width:120px;z-index:4;display:none}.Rk-TopBar-Tooltip-Contents{background:#fff;font-size:13px;font-weight:700;color:#6060c0;text-align:center;padding:2px;border-style:none solid solid;border-width:1px;border-color:#ccc;border-bottom-left-radius:2px;border-bottom-right-radius:2px}.Rk-TopBar-Tooltip:before{content:".";display:block;text-indent:-8000px;height:7px;background:url(../img/tooltiparrow.png) center no-repeat;margin:0 1px}.Rk-AddNode-Button{width:30px;background-position:-2px 0}.Rk-AddNode-Button:hover{background-position:-2px -35px}.Rk-FullScreen-Button{width:30px;background-position:-36px 0}.Rk-FullScreen-Button:hover{background-position:-36px -35px}.Rk-AddEdge-Button{width:30px;background-position:-70px 0}.Rk-AddEdge-Button:hover{background-position:-70px -35px}.Rk-Save-Button{width:30px;background-position:-104px 0}.Rk-Save-Button.saving{background-position:-104px 0}.Rk-Save-Button.Rk-Save-Online:hover,.Rk-Save-Button.saved:hover,.Rk-Save-Button:hover{background-position:-104px -35px}.Rk-Save-Button.Rk-Save-Online:active,.Rk-Save-Button.saved:active,.Rk-Save-Button:active{background-position:-104px 0}.Rk-Save-Button.to-save{background-position:-172px -35px}.Rk-Save-Button.Rk-Save-Online,.Rk-Save-Button.saved{background-position:-172px 0}.Rk-Save-Button.Rk-Save-ReadOnly,.Rk-Save-Button.disabled{opacity:.4;cursor:default}.Rk-Export-Button{width:30px;background-position:-274px 0}.Rk-Export-Button.disabled{opacity:.5;cursor:default}.Rk-Export-Button:hover{background-position:-274px -35px}.Rk-Export-Button.disabled:hover{opacity:1;background-position:-274px 0}.Rk-Bookmarklet-Button{width:30px;background-position:-138px 0}.Rk-Bookmarklet-Button.disabled{opacity:.5;cursor:default}.Rk-Bookmarklet-Button:hover{background-position:-138px -35px}.Rk-Bookmarklet-Button.disabled:hover{opacity:1;background-position:-138px 0}.Rk-Home-Button{width:30px;background-position:-206px 0}.Rk-Home-Button:hover{background-position:-206px -35px}.Rk-Open-Button{width:30px;background-position:-240px 0}.Rk-Open-Button:hover{background-position:-240px -35px}.Rk-GraphSearch-Form{float:right;width:185px;position:relative}.Rk-GraphSearch-Form:after,.Rk-GraphSearch-Form:before{position:absolute;display:block;content:".";text-indent:-9999px}.Rk-GraphSearch-Form:before{right:10px;top:20px;width:7px;height:2px;border:none;padding:0;background:#666;transform:rotate(40deg);-webkit-transform:rotate(40deg)}.Rk-GraphSearch-Form:after{right:13px;top:11px;width:6px;height:6px;border-radius:8px;border:2px solid #666}.Rk-GraphSearch-Field{line-height:23px;font-size:14px;height:23px;padding:0 5px;border:none;margin:6px 5px;width:165px;background:#f0f0f0;box-shadow:1px 1px 1px #999 inset;border-radius:5px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Editing-Space{position:absolute;left:0;top:35px;right:0;bottom:0;overflow:hidden;background:-moz-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-webkit-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%);background:-ms-radial-gradient(center,circle,#fff 40%,#e0e0e0 90%)}.Rk-Editing-Space-Full{top:0}.Rk-Canvas{position:absolute;left:0;top:0;right:0;bottom:0;z-index:2}.Rk-Canvas[resize]{width:100%;height:100%}.Rk-Highlighted{background:rgba(255,255,0,.5)}.Rk-Labels{position:absolute;left:0;top:0;z-index:1;font-family:"Segoe UI","Helvetica Neue",Arial,Helvetica,sans-serif}.Rk-Label{position:absolute;width:160px;margin-left:-80px;text-align:center;font-size:13px;line-height:13px}.Rk-Edge-Label{font-size:11px;transform-origin:50% 0;-moz-transform-origin:50% 0;-webkit-transform-origin:50% 0;-ms-transform-origin:50% 0}.Rk-Editor{position:absolute;left:0;top:0;z-index:3}.Rk-Notifications{position:absolute;right:15px;top:15px;width:200px;padding:10px;border-radius:8px;display:none;color:#fff;font-size:13px;text-align:center;font-weight:700;background:rgba(20,20,20,.7);background:-moz-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-webkit-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);background:-ms-linear-gradient(top,rgba(40,40,40,.7)20%,rgba(0,0,0,.7)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#202020', endColorstr='#000000', GradientType=0)}.Rk-CloseX{float:right;cursor:pointer}.Rk-Editor h2{font-size:16px;font-weight:700}.Rk-Editor p,.Rk-Editor-p,.Rk-Editor-p>div{margin:5px 0;font-size:12px;clear:both}.Rk-Editor-Label{float:left;width:80px}a.Rk-Edit-Goto{display:block;float:right;width:18px;height:17px;margin:1px 0;border:none;background:url(../img/goto.png)}.Rk-Edit-Image-File,.Rk-Edit-Title,.Rk-Edit-URI,.Rk-Edit-Vocabulary{font-size:12px;width:250px}.Rk-Edit-Image{font-size:12px;width:220px}.Rk-Edit-Image-Del{display:inline-block;background:url(../img/remove.png);background-size:15px 20px;background-repeat:no-repeat;vertical-align:top;height:20px;width:15px;margin-right:2px}.Rk-Edit-URI{font-size:12px;width:220px}.Rk-Edit-ImgWrap{text-align:center}.Rk-Edit-ImgPreview{display:inline-block;border:1px solid #666;margin:5px auto;position:relative}.Rk-Edit-ImgPreview img{display:inline-block;max-width:253px!important;max-height:200px!important}.Rk-Edit-ImgPreview svg{height:100%;left:0;position:absolute;top:0;width:100%}.Rk-Editor textarea{width:250px;height:120px;resize:none}.Rk-UserColor{display:inline-block;width:12px;height:12px;border:1px solid #666;margin:-2px 2px}.Rk-Edit-Color{display:inline-block;width:10px;height:10px;border:2px solid #333;margin:-2px 2px;position:relative}.Rk-Edit-ColorTip{display:block;width:3px;height:3px;background:#fff;position:absolute;bottom:0;right:0;cursor:pointer}.Rk-Edit-ColorPicker-Wrapper{display:inline-block;position:relative;float:left}.Rk-Edit-ColorPicker{position:absolute;top:-2px;left:15px;width:96px;height:96px;border:1px solid #CCC;padding:5px 4px 4px 5px;background:#fff;border-radius:5px;display:none;z-index:4}.Rk-CurrentUser .Rk-Edit-ColorPicker{left:-105px;top:2px}.Rk-Edit-ColorPicker-Text{color:#303080;font-weight:700}.Rk-Edit-ColorPicker li{float:left;width:11px;height:11px;margin:0 1px 1px 0;cursor:pointer}.Rk-Edit-Dash{float:left;display:inline-block}.Rk-Edit-Size-Btn{font-size:13px;font-weight:700;padding:0 4px;background:#fff;color:#000;border:1px solid #ccc;text-decoration:none}.Rk-Edit-Size-Btn:hover{background:#666}.Rk-Edit-Size-Disp{display:inline-block;padding:0 5px;text-align:center;width:20px}.Rk-Edit-Vocabulary-Class{color:#999;font-style:italic;font-weight:700}.Rk-Edit-Vocabulary-Property{padding-left:20px}.Rk-Edit-Direction{border:1px solid #666;padding:3px 5px;line-height:20px;border-radius:3px;background:#f0f0f0;cursor:pointer}.Rk-Edit-Direction:hover{background:silver}.Rk-Display-Title a{text-decoration:none;color:#000}.Rk-Display-Title a:hover{text-decoration:underline}.Rk-Display-URI{font-style:italic}.Rk-Display-ImgPreview{margin:5px auto;display:block;max-width:255px!important;max-height:260px!important}.Rk-Fold-Bins{position:absolute;top:5px;width:12px;text-align:center;font-size:16px;cursor:pointer;line-height:16px;padding:4px;color:#fff;background:#666;border-radius:0 6px 6px 0;font-weight:700}.Rk-Fold-Bins:hover{background:#333}.Rk-ZoomButtons{position:absolute;left:0;top:35px;cursor:pointer}.Rk-Editing-Space-Full .Rk-ZoomButtons{top:0}.Rk-ShowHiddenNodes,.Rk-ZoomFit,.Rk-ZoomIn,.Rk-ZoomOut,.Rk-ZoomSave,.Rk-ZoomSetSaved{width:21px;height:20px;background:url(../img/zoombuttons.png);margin:5px}.Rk-ZoomIn:hover{background-position:0 -20px}.Rk-ZoomFit{background-position:-42px 0}.Rk-ZoomFit:hover{background-position:-42px -20px}.Rk-ZoomOut{background-position:-21px 0}.Rk-ZoomOut:hover{background-position:-21px -20px}.Rk-ZoomSave{background-position:-63px 0}.Rk-ZoomSave:hover{background-position:-63px -20px}.Rk-ZoomSetSaved{background-position:-84px 0;display:none}.Rk-ZoomSetSaved:hover{background-position:-84px -20px}.Rk-ShowHiddenNodes{background-position:-105px 0}.Rk-ShowHiddenNodes:hover{background-position:-105px -20px}.Rk-Bins{background:#fff;position:absolute;left:0;top:0;width:299px;bottom:0;overflow:hidden;border-right:1px solid #252525}.Rk-Bins-Title{border:0 none;width:290px;height:15px;line-height:15px;margin:0;padding:15px 0 5px 10px;font-size:14px;color:#F0F0F0;background:-moz-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-webkit-linear-gradient(top,#1e1e1e 5px,#606060 30px);background:-ms-linear-gradient(top,#1e1e1e 5px,#606060 30px);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1e1e1e', endColorstr='#606060', GradientType=0)}.Rk-Search-Form{padding:0 10px 8px;height:27px;background:#606060}.Rk-Search-Input,.Rk-Search-Select{float:left;margin:0}.Rk-Search-Input{border-top-left-radius:5px;border-bottom-left-radius:5px;border:1px solid #003050;font-size:13px;background:#fff;height:25px;padding:0 5px;line-height:25px;-webkit-appearance:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.Rk-Web-Search-Input{width:190px}.Rk-Bins-Search-Input{width:235px}.Rk-Search-Select{display:inline-block;position:relative;width:45px;border-width:1px;border-color:#003050;border-style:solid none;cursor:pointer;height:25px;background:#fff url(../img/more.png) 30px 10px no-repeat}.Rk-Search-Select:hover{background-color:#3030FF}.Rk-Search-Current{width:40px;height:20px;margin:2px;background-repeat:no-repeat}.Rk-Search-List{width:180px;margin-left:15px;font-size:13px;position:absolute;right:0;top:25px;background:#fff;box-shadow:1px 1px 2px #505050;display:none;border:1px solid #ccc;z-index:2}.Rk-Search-List li{padding:2px 2px 2px 30px;border-top:1px solid #ccc;height:16px;background-color:#fff;background-repeat:no-repeat;cursor:pointer}.Rk-Search-List li:hover{background-color:#3030ff;color:#fff}.Rk-Search-Submit{border:1px solid #003050;height:27px;width:30px;border-top-right-radius:5px;border-bottom-right-radius:5px;background:#333 center no-repeat url(../img/search.png);cursor:pointer}.Rk-Search-Submit:hover{background-color:#999}.Rk-Bin-Title{background:#333;background:-moz-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-webkit-linear-gradient(top,#505050 20%,#1e1e1e 80%);background:-ms-linear-gradient(top,#505050 20%,#1e1e1e 80%);font-weight:700;font-size:14px;padding:5px;cursor:pointer;color:#f0f0f0;margin:0;border:0 none}.Rk-Bin-Close{float:right;display:block;font-size:16px;font-weight:700;margin:2px 3px 0;color:#f0f0f0;cursor:pointer;text-shadow:-1px -1px 1px #999,1px 1px 1px #000;text-decoration:none}.Rk-Bin-Close:hover{color:#ffff80}.Rk-Bin-Title:hover{color:#ffffe0;background:#505050;background:-moz-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-webkit-linear-gradient(top,#141414 20%,#3c3c3c 80%);background:-ms-linear-gradient(top,#141414 20%,#3c3c3c 80%)}.Rk-Bin-Refresh{width:18px;height:17px;background:url(../img/refresh.png);display:block;float:right;margin-top:4px}.Rk-Bin-Refresh:hover{background-position:-18px 0}.Rk-Bin-Count{float:right;background:#c000a0;color:#FFF;text-shadow:1px 1px 1px #000;display:none;border-radius:4px;padding:1px 3px;font-size:10px;font-weight:700;margin-top:4px}.Rk-Bin-Title-Icon{float:left;width:25px;margin:2px}.Rk-Bin-Main{overflow:auto;background:#fff;background:-moz-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-webkit-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%);background:-ms-linear-gradient(top,#e0e0e0 0,#FFF 2%,#FFF 98%,#e0e0e0 100%)}.Rk-Bin-Item{cursor:move}.Rk-Bin-Item.hover,.Rk-Bin-Item:hover{background:-moz-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-webkit-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);background:-ms-linear-gradient(top,rgba(0,0,0,.1)20%,rgba(128,128,128,.1)80%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#d0d0d0', endColorstr='#f3f3f3', GradientType=0)}.Rk-Bin-Item.selected{background:#ffffc0}.Rk-Bin-Main li{padding:2px;border-bottom:1px solid #ccc;clear:both;overflow:hidden}.Rk-Bin-Main h3{font-size:14px;font-style:italic;font-weight:700;text-align:center}.Rk-Bin-Main h4{font-size:12px;font-weight:700}.Rk-Bin-Main p{font-size:11px}.Rk-Bin-Main h4 a{color:#303080}.Rk-Bin-Main .searchmatch{background:#ffff80}.Rk-Wikipedia-Search-Icon{background-image:url(../img/search-logos.png)}.Rk-Wikipedia-Icon{float:left;margin:3px;max-height:48px;max-width:48px}.Rk-Wikipedia-Title-Icon{height:20px;background:url(../img/search-logos.png)}.Rk-Wikipedia-Lang-en{background-position:0 -20px}.Rk-Wikipedia-Lang-fr{background-position:0 -40px}.Rk-Wikipedia-Lang-ja{background-position:0 -60px}.Rk-Wikipedia-Result{min-height:51px}.Rk-Wikipedia-Result h4,.Rk-Wikipedia-Result p{margin-left:54px}.Rk-ResourceList-Image{float:left;max-width:100px;max-height:75px;margin-right:2px}.Rk-Ldt-Icon,.Rk-Ldt-Title-Icon{background:url(../img/search-logos.png);background-position:0 -100px;background-repeat:no-repeat}.Rk-Ldt-Title-Icon{height:20px;margin-top:4px}.Rk-Ldt-Tag-Icon{float:left;margin:0 2px 0 0}.Rk-Ldt-Annotation-Icon{float:left;margin:3px}.Rk-Clear{clear:both}h4.Rk-Bin-Loading{margin:10px;text-align:center;font-size:20px;color:#999}
\ No newline at end of file
Binary file server/python/django/renkanmanager/static/renkanmanager/lib/renkan/img/hide.png has changed
Binary file server/python/django/renkanmanager/static/renkanmanager/lib/renkan/img/show.png has changed
Binary file server/python/django/renkanmanager/static/renkanmanager/lib/renkan/img/zoombuttons.png has changed
Binary file server/python/django/renkanmanager/static/renkanmanager/lib/renkan/img/zoombuttons2.png has changed
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.js Wed Jun 03 19:16:58 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.js Thu Jun 04 10:04:01 2015 +0200
@@ -719,6 +719,8 @@
if (options.save_view) { ;
__p += '\n <div class="Rk-ZoomSetSaved" title="' +
__e(translate('View saved zoom')) +
+'"></div>\n \t<div class="Rk-ShowHiddenNodes" title="' +
+__e(translate('Show hidden nodes')) +
'"></div>\n ';
} ;
__p += '\n </div>\n ';
@@ -1533,9 +1535,8 @@
.get("_id") : null,
size : this.get("size"),
clip_path : this.get("clip_path"),
- shape : this.get("shape"),
- type : this.get("type"),
- hidden : this.get("hidden")
+ shape : this.get("shape"),
+ type : this.get("type")
};
}
});
@@ -1616,7 +1617,8 @@
title : this.get("title"),
description : this.get("description"),
created_by : this.get("created_by") ? this.get("created_by")
- .get("_id") : null
+ .get("_id") : null,
+ hidden_nodes: this.get("hidden_nodes")
// Don't need project id
};
}
@@ -1808,6 +1810,10 @@
/* List of Bins */
static_url: "",
/* URL for static resources */
+ popup_editor: true,
+ /* show the node editor as a popup inside the renkan view */
+ editor_panel: 'editor-panel',
+ /* GUI continer DOM element ID of the editor panel */
show_bins: true,
/* Show bins in left column */
properties: [],
@@ -2953,6 +2959,8 @@
this.renderer.node_layer.activate();
this.type = "Node";
this.buildShape();
+ this.hidden = false;
+ this.ghost= false;
if (this.options.show_node_circles) {
this.circle.strokeWidth = this.options.node_stroke_width;
this.h_ratio = 1;
@@ -2966,6 +2974,8 @@
this.normal_buttons = [
new Renderer.NodeEditButton(this.renderer, null),
new Renderer.NodeRemoveButton(this.renderer, null),
+ new Renderer.NodeHideButton(this.renderer, null),
+ new Renderer.NodeShowButton(this.renderer, null),
new Renderer.NodeLinkButton(this.renderer, null),
new Renderer.NodeEnlargeButton(this.renderer, null),
new Renderer.NodeShrinkButton(this.renderer, null)
@@ -3052,8 +3062,7 @@
this.active_buttons = this.normal_buttons;
this.circle.dashArray = null;
}
-
- if (this.selected && this.renderer.isEditable()) {
+ if (this.selected && this.renderer.isEditable() && !this.ghost) {
if (old_act_btn !== this.active_buttons) {
old_act_btn.forEach(function(b) {
b.hide();
@@ -3133,7 +3142,11 @@
}
);
}
-
+ if (this.ghost){
+ this.show(true);
+ } else {
+ if (this.hidden) { this.hide(); }
+ }
},
showImage: function() {
var _image = null;
@@ -3284,7 +3297,7 @@
select: function() {
this.selected = true;
this.circle.strokeWidth = this._getSelectedStrokeWidth();
- if (this.renderer.isEditable()) {
+ if (this.renderer.isEditable() && !this.hidden) {
this.active_buttons.forEach(function(b) {
b.show();
});
@@ -3306,6 +3319,13 @@
this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;
this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
}
+ //if the node is hidden and the mouse hover it, it appears as a ghost
+ if (this.hidden) {
+ this.show(true);
+ }
+ else {
+ this.showNeighbors(true);
+ }
this._super("select");
},
hideButtons: function() {
@@ -3324,9 +3344,111 @@
if (this.renderer.minimap) {
this.minimap_circle.strokeColor = undefined;
}
+ //when the mouse don't hover the node anymore, we hide it
+ if (this.hidden) {
+ this.hide();
+ }
+ else {
+ this.hideNeighbors();
+ }
this._super("unselect");
}
},
+ hide: function(){
+ var _this = this;
+ this.ghost = false;
+ this.hidden = true;
+ if (typeof this.node_image !== 'undefined'){
+ this.node_image.opacity = 0;
+ }
+ this.hideButtons();
+ this.circle.opacity = 0;
+ this.title.css('opacity', 0);
+ this.minimap_circle.opacity = 0;
+
+
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return ((ed.get("to") === _this.model) || (ed.get("from") === _this.model));
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge);
+ 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") {
+ repr.hide();
+ }
+ }
+ );
+ this.hideNeighbors();
+ },
+ show: function(ghost){
+ var _this = this;
+ this.ghost = ghost;
+ if (this.ghost){
+ if (typeof this.node_image !== 'undefined'){
+ this.node_image.opacity = 0.3;
+ }
+ this.circle.opacity = 0.3;
+ this.title.css('opacity', 0.3);
+ this.minimap_circle.opacity = 0.3;
+ } else {
+ this.hidden = false;
+ this.redraw();
+ }
+
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return ((ed.get("to") === _this.model) || (ed.get("from") === _this.model));
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge);
+ 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") {
+ repr.show(_this.ghost);
+ }
+ }
+ );
+ },
+ hideNeighbors: function(){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.ghost) {
+ repr.hide();
+ }
+ }
+ );
+ },
+ showNeighbors: function(ghost){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.hidden) {
+ repr.show(ghost);
+ if (!ghost){
+ var indexNode = _this.renderer.hiddenNodes.indexOf(repr.model.id);
+ if (indexNode !== -1){
+ _this.renderer.hiddenNodes.splice(indexNode, 1);
+ }
+ }
+ }
+ }
+ );
+ },
highlight: function(textToReplace) {
var hlvalue = textToReplace || true;
if (this.highlighted === hlvalue) {
@@ -3366,10 +3488,19 @@
if (this.renderer.is_dragging && this.renderer.isEditable()) {
this.saveCoords();
} else {
- if (!_isTouch && !this.model.get("delete_scheduled")) {
- this.openEditor();
+ if (this.hidden) {
+ var index = this.renderer.hiddenNodes.indexOf(this.model.id);
+ if (index !== -1){
+ this.renderer.hiddenNodes.splice(index, 1);
+ }
+ this.show(false);
+ this.select();
+ } else {
+ if (!_isTouch && !this.model.get("delete_scheduled")) {
+ this.openEditor();
+ }
+ this.model.trigger("clicked");
}
- this.model.trigger("clicked");
}
this.renderer.click_target = null;
this.renderer.is_dragging = false;
@@ -3410,6 +3541,8 @@
_init: function() {
this.renderer.edge_layer.activate();
this.type = "Edge";
+ this.hidden = false;
+ this.ghost = false;
this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from"));
this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to"));
this.bundle = this.renderer.addToBundles(this);
@@ -3469,12 +3602,15 @@
redraw: function() {
var from = this.model.get("from"),
to = this.model.get("to");
- if (!from || !to) {
+ if (!from || !to || (this.hidden && !this.ghost)) {
return;
}
this.from_representation = this.renderer.getRepresentationByModel(from);
this.to_representation = this.renderer.getRepresentationByModel(to);
- if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined") {
+ if (typeof this.from_representation === "undefined" || typeof this.to_representation === "undefined" ||
+ (this.from_representation.hidden && !this.from_representation.ghost) ||
+ (this.to_representation.hidden && !this.to_representation.ghost)) {
+ this.hide();
return;
}
var _strokeWidth = this._getStrokeWidth(),
@@ -3526,7 +3662,7 @@
this.line.strokeWidth = _strokeWidth;
this.line.strokeColor = _color;
this.line.dashArray = _dash;
- this.line.opacity = opacity;
+ this.line.opacity = this.ghost ? 0.3 : opacity;
this.line.segments[0].point = _p0a;
this.line.segments[1].point = this.paper_coords;
this.line.segments[1].handleIn = _handle.multiply(-1);
@@ -3535,7 +3671,7 @@
this.arrow.scale(_arrow_scale / this.arrow_scale);
this.arrow_scale = _arrow_scale;
this.arrow.fillColor = _color;
- this.arrow.opacity = array_opacity;
+ this.arrow.opacity = this.ghost ? 0.3 : array_opacity; //TODO: magic constant + var name
this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);
this.arrow.position = this.paper_coords;
@@ -3558,7 +3694,7 @@
transform: "rotate(" + _a + "deg)",
"-moz-transform": "rotate(" + _a + "deg)",
"-webkit-transform": "rotate(" + _a + "deg)",
- opacity: opacity
+ opacity: this.ghost ? 0.3 : opacity
});
this.text_angle = _a;
@@ -3573,6 +3709,36 @@
this.minimap_line.segments[1].point = this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position")));
}
},
+ hide: function(){
+ this.hidden = true;
+ this.ghost = false;
+
+ this.text.hide();
+ this.line.visible = false;
+ this.arrow.visible = false;
+ this.minimap_line.visible = false;
+ },
+ show: function(ghost){
+ this.ghost = ghost;
+ if (this.ghost) {
+ this.text.css('opacity', 0.3);
+ this.line.opacity = 0.3;
+ this.arrow.opacity = 0.3;
+ this.minimap_line.opacity = 0.3;
+ } else {
+ this.hidden = false;
+
+ this.text.css('opacity', 1);
+ this.line.opacity = 1;
+ this.arrow.opacity = 1;
+ this.minimap_line.opacity = 1;
+ }
+ this.text.show();
+ this.line.visible = true;
+ this.arrow.visible = true;
+ this.minimap_line.visible = true;
+ this.redraw();
+ },
openEditor: function() {
this.renderer.removeRepresentationsOfType("editor");
var _editor = this.renderer.addRepresentation("EdgeEditor",null);
@@ -3812,6 +3978,8 @@
_init: function() {
BaseEditor.prototype._init.apply(this);
this.template = this.options.templates['templates/nodeeditor.html'];
+ //this.templates['default']= this.options.templates['templates/nodeeditor.html'];
+ //fusionner avec this.options.node_editor_templates
this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];
},
draw: function() {
@@ -4038,8 +4206,10 @@
});
},
redraw: function() {
- var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
+ if (this.options.popup_editor){
+ var _coords = this.source_representation.paper_coords;
+ Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
+ }
this.editor_$.show();
paper.view.draw();
}
@@ -4230,8 +4400,10 @@
}
},
redraw: function() {
- var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
+ if (this.options.popup_editor){
+ var _coords = this.source_representation.paper_coords;
+ Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
+ }
this.editor_$.show();
paper.view.draw();
}
@@ -4310,8 +4482,8 @@
_init: function() {
this.type = "Node-edit-button";
this.lastSectorInner = 0;
- this.startAngle = -135;
- this.endAngle = -45;
+ this.startAngle = -125;
+ this.endAngle = -55;
this.imageName = "edit";
this.text = "Edit";
},
@@ -4343,8 +4515,8 @@
_init: function() {
this.type = "Node-remove-button";
this.lastSectorInner = 0;
- this.startAngle = 0;
- this.endAngle = 90;
+ this.startAngle = -10;
+ this.endAngle = 45;
this.imageName = "remove";
this.text = "Remove";
},
@@ -4376,6 +4548,78 @@
});
+define('renderer/nodehidebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+
+
+ var Utils = requtils.getUtils();
+
+ /* NodeRemoveButton Begin */
+
+ //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);
+ var NodeHideButton = Utils.inherit(NodeButton);
+
+ _(NodeHideButton.prototype).extend({
+ _init: function() {
+ this.type = "Node-hide-button";
+ this.lastSectorInner = 0;
+ this.startAngle = 45;
+ this.endAngle = 90;
+ this.imageName = "hide";
+ this.text = "Hide";
+ },
+ mouseup: function() {
+ this.renderer.click_target = null;
+ this.renderer.is_dragging = false;
+ this.renderer.removeRepresentationsOfType("editor");
+ if (this.renderer.isEditable()) {
+ this.renderer.addHiddenNode(this.source_representation.model);
+ }
+ }
+ }).value();
+
+ /* NodeRemoveButton End */
+
+ return NodeHideButton;
+
+});
+
+
+define('renderer/nodeshowbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+
+
+ var Utils = requtils.getUtils();
+
+ /* NodeRemoveButton Begin */
+
+ //var NodeRemoveButton = Renderer.NodeRemoveButton = Utils.inherit(Renderer._NodeButton);
+ var NodeShowButton = Utils.inherit(NodeButton);
+
+ _(NodeShowButton.prototype).extend({
+ _init: function() {
+ this.type = "Node-show-button";
+ this.lastSectorInner = 0;
+ this.startAngle = 90;
+ this.endAngle = 135;
+ this.imageName = "show";
+ this.text = "Show";
+ },
+ mouseup: function() {
+ this.renderer.click_target = null;
+ this.renderer.is_dragging = false;
+ this.renderer.removeRepresentationsOfType("editor");
+ if (this.renderer.isEditable()) {
+ this.source_representation.showNeighbors(false);
+ }
+ }
+ }).value();
+
+ /* NodeShowButton End */
+
+ return NodeShowButton;
+
+});
+
+
define('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
@@ -4425,8 +4669,8 @@
_init: function() {
this.type = "Node-link-button";
this.lastSectorInner = 0;
- this.startAngle = 90;
- this.endAngle = 180;
+ this.startAngle = 135;
+ this.endAngle = 190;
this.imageName = "link";
this.text = "Link to another node";
},
@@ -4466,8 +4710,8 @@
_init: function() {
this.type = "Node-enlarge-button";
this.lastSectorInner = 0;
- this.startAngle = -45;
- this.endAngle = 0;
+ this.startAngle = -55;
+ this.endAngle = -10;
this.imageName = "enlarge";
this.text = "Enlarge";
},
@@ -4501,8 +4745,8 @@
_init: function() {
this.type = "Node-shrink-button";
this.lastSectorInner = 0;
- this.startAngle = -180;
- this.endAngle = -135;
+ this.startAngle = -170;
+ this.endAngle = -125;
this.imageName = "shrink";
this.text = "Shrink";
},
@@ -4669,13 +4913,18 @@
this.onStatusChange();
this.canvas_$ = this.$.find(".Rk-Canvas");
this.labels_$ = this.$.find(".Rk-Labels");
- this.editor_$ = this.$.find(".Rk-Editor");
+ if (!_renkan.options.popup_editor){
+ this.editor_$ = $("#" + _renkan.options.editor_panel);
+ }else{
+ this.editor_$ = this.$.find(".Rk-Editor");
+ }
this.notif_$ = this.$.find(".Rk-Notifications");
paper.setup(this.canvas_$[0]);
this.scale = 1;
this.initialScale = 1;
this.offset = paper.view.center;
this.totalScroll = 0;
+ this.hiddenNodes = [];
this.mouse_down = false;
this.click_target = null;
this.selected_target = null;
@@ -4733,7 +4982,7 @@
this.image_cache = {};
this.icon_cache = {};
- ['edit', 'remove', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {
+ ['edit', 'remove', 'hide', 'show', 'link', 'enlarge', 'shrink', 'revert' ].forEach(function(imgname) {
var img = new Image();
img.src = _renkan.options.static_url + 'img/' + imgname + '.png';
_this.icon_cache[imgname] = img;
@@ -4889,13 +5138,25 @@
bindClick(".Rk-ZoomFit", "autoScale");
this.$.find(".Rk-ZoomSave").click( function() {
// Save scale and offset point
- _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset } );
+ _this.renkan.project.addView( { zoom_level:_this.scale, offset:_this.offset, hidden_nodes: _this.hiddenNodes } );
});
this.$.find(".Rk-ZoomSetSaved").click( function() {
var view = _this.renkan.project.get("views").last();
if(view){
_this.setScale(view.get("zoom_level"), new paper.Point(view.get("offset")));
- }
+ _this.hiddenNodes = view.get("hidden_nodes") || [];
+ _this.hideNodes();
+ }
+ });
+ this.$.find(".Rk-ShowHiddenNodes").mouseenter( function() {
+ _this.showNodes(true);
+ _this.$.find(".Rk-ShowHiddenNodes").mouseleave( function() {
+ _this.hideNodes(false);
+ });
+ });
+ this.$.find(".Rk-ShowHiddenNodes").click( function() {
+ _this.showNodes(false);
+ _this.$.find(".Rk-ShowHiddenNodes").off( "mouseleave" );
});
if(this.renkan.project.get("views").length > 0 && this.renkan.options.save_view){
this.$.find(".Rk-ZoomSetSaved").show();
@@ -5484,6 +5745,7 @@
});
},
redraw: function() {
+ var _this = this;
if(! this.redrawActive ) {
return;
}
@@ -5502,6 +5764,38 @@
_tmpEdge.redraw();
this.click_target = _tmpEdge;
},
+ addHiddenNode: function(_model){
+ this.hideNode(_model);
+ this.hiddenNodes.push(_model.id);
+ },
+ hideNode: function(_model){
+ var _this = this;
+ if (typeof _this.getRepresentationByModel(_model) !== 'undefined'){
+ _this.getRepresentationByModel(_model).hide();
+ }
+ },
+ hideNodes: function(){
+ var _this = this;
+ this.hiddenNodes.forEach(function(_id, index){
+ var node = _this.renkan.project.get("nodes").get(_id);
+ if (typeof node !== 'undefined'){
+ return _this.hideNode(_this.renkan.project.get("nodes").get(_id));
+ }else{
+ _this.hiddenNodes.splice(index, 1);
+ }
+ });
+ paper.view.draw();
+ },
+ showNodes: function(ghost){
+ var _this = this;
+ this.hiddenNodes.forEach(function(_id){
+ _this.getRepresentationByModel(_this.renkan.project.get("nodes").get(_id)).show(ghost);
+ });
+ if (!ghost){
+ this.hiddenNodes = [];
+ }
+ paper.view.draw();
+ },
findTarget: function(_hitResult) {
if (_hitResult && typeof _hitResult.item.__representation !== "undefined") {
var _newTarget = _hitResult.item.__representation;
@@ -5632,15 +5926,21 @@
}
},
onDoubleClick: function(_event) {
- if (!this.isEditable()) {
- return;
- }
var _off = this.canvas_$.offset(),
_point = new paper.Point([
_event.pageX - _off.left,
_event.pageY - _off.top
]);
var _hitResult = paper.project.hitTest(_point);
+
+ if (!this.isEditable()) {
+ if (_hitResult && typeof _hitResult.item.__representation !== "undefined") {
+ if (_hitResult.item.__representation.model.get('uri')){
+ window.open(_hitResult.item.__representation.model.get('uri'), '_blank');
+ }
+ }
+ return;
+ }
if (this.isEditable() && (!_hitResult || typeof _hitResult.item.__representation === "undefined")) {
var _coords = this.toModelCoords(_point),
_data = {
@@ -5965,6 +6265,8 @@
'renderer/nodebutton',
'renderer/nodeeditbutton',
'renderer/noderemovebutton',
+ 'renderer/nodehidebutton',
+ 'renderer/nodeshowbutton',
'renderer/noderevertbutton',
'renderer/nodelinkbutton',
'renderer/nodeenlargebutton',
@@ -5974,7 +6276,7 @@
'renderer/edgerevertbutton',
'renderer/miniframe',
'renderer/scene'
- ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){
+ ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){
@@ -5996,6 +6298,8 @@
Renderer._NodeButton = NodeButton;
Renderer.NodeEditButton = NodeEditButton;
Renderer.NodeRemoveButton = NodeRemoveButton;
+ Renderer.NodeHideButton = NodeHideButton;
+ Renderer.NodeShowButton = NodeShowButton;
Renderer.NodeRevertButton = NodeRevertButton;
Renderer.NodeLinkButton = NodeLinkButton;
Renderer.NodeEnlargeButton = NodeEnlargeButton;
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.js Wed Jun 03 19:16:58 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.js Thu Jun 04 10:04:01 2015 +0200
@@ -27,9 +27,9 @@
/*! renkan - v0.9.1 - Copyright © IRI 2015 */
-this.renkanJST=this.renkanJST||{},this.renkanJST["templates/colorpicker.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li data-color="'+(null==(__t=c)?"":__t)+'" style="background: '+(null==(__t=c)?"":__t)+'"></li>';return __p},this.renkanJST["templates/edgeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Edge"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(edge.title)+'" />\n</p>\n',options.show_edge_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(edge.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(edge.uri)+'" target="_blank"></a>\n </p>\n ',options.properties.length&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose from vocabulary:"))+'</label>\n <select class="Rk-Edit-Vocabulary">\n ',_.each(options.properties,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Class" value="">\n '+__e(renkan.translate(a.label))+"\n </option>\n ",_.each(a.properties,function(b){var c=a["base-uri"]+b.uri;__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(c)+'"\n ',c===edge.uri&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(b.label))+"\n </option>\n "}),__p+="\n "}),__p+="\n </select>\n </p>\n")),__p+="\n",options.show_edge_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_edge_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Edge color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: <%-edge.color%>;">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_edge_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(edge.dash)+" />\n </div>\n "),__p+="\n ",options.show_edge_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(edge.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n ",options.show_edge_editor_style_arrow&&(__p+='\n <div id="Rk-Editor-p-arrow">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Arrow:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Arrow" class="Rk-Edit-Arrow" '+__e(edge.arrow)+" />\n </div>\n "),__p+="\n </div>\n"),__p+="\n",options.show_edge_editor_direction&&(__p+='\n <p>\n <span class="Rk-Edit-Direction">'+__e(renkan.translate("Change edge direction"))+"</span>\n </p>\n"),__p+="\n",options.show_edge_editor_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_editor_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: <%-edge.created_by_color%>;"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/edgeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_edge_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(edge.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',edge.uri&&(__p+='\n <a href="'+__e(edge.uri)+'" target="_blank">\n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" </a> "),__p+="\n </span>\n</h2>\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(edge.uri)+'" target="_blank">'+__e(edge.short_uri)+"</a>\n </p>\n"),__p+="\n<p>"+__e(edge.description)+"</p>\n",options.show_edge_tooltip_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.to_color)+';"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_tooltip_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.created_by_color)+';"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/ldtjson-bin/annotationtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/segmenttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/tagtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/ldt-tag.png"))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/search/?search="+(null==(__t=encodedtitle)?"":__t)+'&field=all"\n data-title="'+__e(title)+'" data-description="Tag \''+__e(title)+'\'">\n\n <img class="Rk-Ldt-Tag-Icon" src="'+__e(static_url)+'img/ldt-tag.png" />\n <h4>'+(null==(__t=htitle)?"":__t)+'</h4>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/list-bin.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="'+__e(title)+'"\n data-description="'+__e(description)+'"\n ',__p+=image?'\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n ':'\n data-image=""\n ',__p+="\n>",image&&(__p+='\n <img class="Rk-ResourceList-Image" src="'+__e(image)+'" />\n'),__p+='\n<h4 class="Rk-ResourceList-Title">\n ',url&&(__p+='\n <a href="'+__e(url)+'" target="_blank">\n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+="</a>"),__p+="\n </h4>\n ",description&&(__p+='\n <p class="Rk-ResourceList-Description">'+(null==(__t=hdescription)?"":__t)+"</p>\n "),__p+="\n ",image&&(__p+='\n <div style="clear: both;"></div>\n '),__p+="\n</li>\n";return __p},this.renkanJST["templates/main.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)options.show_bins&&(__p+='\n <div class="Rk-Bins">\n <div class="Rk-Bins-Head">\n <h2 class="Rk-Bins-Title">'+__e(translate("Select contents:"))+'</h2>\n <form class="Rk-Web-Search-Form Rk-Search-Form">\n <input class="Rk-Web-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search the Web"))+'" />\n <div class="Rk-Search-Select">\n <div class="Rk-Search-Current"></div>\n <ul class="Rk-Search-List"></ul>\n </div>\n <input type="submit" value=""\n class="Rk-Web-Search-Submit Rk-Search-Submit" title="'+__e(translate("Search the Web"))+'" />\n </form>\n <form class="Rk-Bins-Search-Form Rk-Search-Form">\n <input class="Rk-Bins-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search in Bins"))+'" /> <input\n type="submit" value=""\n class="Rk-Bins-Search-Submit Rk-Search-Submit"\n title="'+__e(translate("Search in Bins"))+'" />\n </form>\n </div>\n <ul class="Rk-Bin-List"></ul>\n </div>\n'),__p+=" ",options.show_editor&&(__p+='\n <div class="Rk-Render Rk-Render-',__p+=options.show_bins?"Panel":"Full",__p+='"></div>\n'),__p+="\n";return __p},this.renkanJST["templates/nodeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='\n<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Node"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n</p>\n',options.show_node_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(node.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(node.uri)+'" target="_blank"></a>\n </p>\n'),__p+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+'</label>\n <textarea class="Rk-Edit-Description">'+__e(node.description)+"</textarea>\n </p>\n"),__p+=" ",options.show_node_editor_size&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Size:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Size-Value">'+__e(node.size)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Up">+</a>\n </p>\n'),__p+=" ",options.show_node_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_node_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">\n '+__e(renkan.translate("Node color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: '+__e(node.color)+';">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_node_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(node.dash)+" />\n </div>\n "),__p+="\n ",options.show_node_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(node.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n </div>\n"),__p+=" ",options.show_node_editor_image&&(__p+='\n <div class="Rk-Edit-ImgWrap">\n <div class="Rk-Edit-ImgPreview">\n <img src="'+__e(node.image||node.image_placeholder)+'" />\n ',node.clip_path&&(__p+='\n <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n <path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="'+__e(node.clip_path)+'" />\n </svg>\n '),__p+="\n </div>\n </div>\n <p>\n <label>"+__e(renkan.translate("Image URL:"))+'</label>\n <div>\n <a class="Rk-Edit-Image-Del" href="#"></a>\n <input class="Rk-Edit-Image" type="text" value=\''+__e(node.image)+"' />\n </div>\n </p>\n",options.allow_image_upload&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose Image File:"))+'</label>\n <input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n </p>\n')),__p+=" ",options.show_node_editor_creator&&node.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+=" ",options.change_shapes&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Shapes available"))+':</label>\n <select class="Rk-Edit-Shape">\n ',_.each(shapes,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.shape===a&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(a.charAt(0).toUpperCase()+a.substring(1)))+"\n </option>\n "}),__p+="\n </select>\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/nodeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_node_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(node.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',node.uri&&(__p+='\n <a href="'+__e(node.uri)+'" target="_blank">\n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+="</a>"),__p+="\n </span>\n</h2>\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(node.uri)+'" target="_blank">'+__e(node.short_uri)+"</a>\n </p>\n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n <p class="Rk-Display-Description">'+__e(node.description)+"</p>\n"),__p+=" ",node.image&&options.show_node_tooltip_image&&(__p+='\n <img class="Rk-Display-ImgPreview" src="'+__e(node.image)+'" />\n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/scene.html"]=function(obj){function print(){__p+=__j.call(arguments,"")}obj||(obj={});var __p="",__e=_.escape,__j=Array.prototype.join;with(obj)options.show_top_bar&&(__p+='\n <div class="Rk-TopBar">\n <div class="loader"></div>\n ',__p+=options.editor_mode?'\n <input type="text" class="Rk-PadTitle" value="'+__e(project.get("title")||"")+'" placeholder="'+__e(translate("Untitled project"))+'" />\n ':'\n <h2 class="Rk-PadTitle">\n '+__e(project.get("title")||translate("Untitled project"))+"\n </h2>\n ",__p+="\n ",options.show_user_list&&(__p+='\n <div class="Rk-Users">\n <div class="Rk-CurrentUser">\n ',options.show_user_color&&(__p+='\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-CurrentUser-Color">\n ',options.user_color_editable&&(__p+='\n <span class="Rk-Edit-ColorTip"></span>\n '),__p+="\n </span>\n ",options.user_color_editable&&print(colorPicker),__p+="\n </div>\n "),__p+='\n <span class="Rk-CurrentUser-Name"><unknown user></span>\n </div>\n <ul class="Rk-UserList"></ul>\n </div>\n '),__p+="\n ",options.home_button_url&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Home-Button" href="'+__e(options.home_button_url)+'">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate(options.home_button_title))+"\n </div>\n </div>\n </a>\n "),__p+="\n ",options.show_fullscreen_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-FullScreen-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Full Screen"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.editor_mode?(__p+="\n ",options.show_addnode_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddNode-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Node"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_addedge_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddEdge-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Edge"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_save_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Save-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents"></div>\n </div>\n </div>\n '),__p+="\n ",options.show_open_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Open-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Open Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_bookmarklet&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Renkan 'Drag-to-Add' bookmarklet"))+'\n </div>\n </div>\n </a>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "):(__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+'\n </div>\n </div>\n </div>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "),__p+="\n ",options.show_search_field&&(__p+='\n <form action="#" class="Rk-GraphSearch-Form">\n <input type="search" class="Rk-GraphSearch-Field" placeholder="'+__e(translate("Search in graph"))+'" />\n </form>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n </div>\n"),__p+='\n<div class="Rk-Editing-Space',options.show_top_bar||(__p+=" Rk-Editing-Space-Full"),__p+='">\n <div class="Rk-Labels"></div>\n <canvas class="Rk-Canvas" ',options.resize&&(__p+=' resize="" '),__p+='></canvas>\n <div class="Rk-Notifications"></div>\n <div class="Rk-Editor">\n ',options.show_bins&&(__p+='\n <div class="Rk-Fold-Bins">«</div>\n '),__p+="\n ",options.show_zoom&&(__p+='\n <div class="Rk-ZoomButtons">\n <div class="Rk-ZoomIn" title="'+__e(translate("Zoom In"))+'"></div>\n <div class="Rk-ZoomFit" title="'+__e(translate("Zoom Fit"))+'"></div>\n <div class="Rk-ZoomOut" title="'+__e(translate("Zoom Out"))+'"></div>\n ',options.editor_mode&&options.save_view&&(__p+='\n <div class="Rk-ZoomSave" title="'+__e(translate("Zoom Save"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved zoom"))+'"></div>\n '),__p+="\n </div>\n "),__p+="\n </div>\n</div>\n";return __p},this.renkanJST["templates/search.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li class="'+(null==(__t=className)?"":__t)+'" data-key="'+(null==(__t=key)?"":__t)+'">'+(null==(__t=title)?"":__t)+"</li>";return __p},this.renkanJST["templates/wikipedia-bin/resulttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="Wikipedia: '+__e(title)+'"\n data-description="'+__e(description)+'"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/wikipedia.png"))+'">\n\n <img class="Rk-Wikipedia-Icon" src="'+__e(static_url)+'img/wikipedia.png">\n <h4 class="Rk-Wikipedia-Title">\n <a href="'+__e(url)+'" target="_blank">'+(null==(__t=htitle)?"":__t)+'</a>\n </h4>\n <p class="Rk-Wikipedia-Snippet">'+(null==(__t=hdescription)?"":__t)+"</p>\n</li>\n";return __p},function(a){"use strict";"object"!=typeof a.Rkns&&(a.Rkns={});var b=a.Rkns,c=b.$=a.jQuery,d=b._=a._;b.pickerColors=["#8f1919","#a80000","#d82626","#ff0000","#e87c7c","#ff6565","#f7d3d3","#fecccc","#8f5419","#a85400","#d87f26","#ff7f00","#e8b27c","#ffb265","#f7e5d3","#fee5cc","#8f8f19","#a8a800","#d8d826","#feff00","#e8e87c","#feff65","#f7f7d3","#fefecc","#198f19","#00a800","#26d826","#00ff00","#7ce87c","#65ff65","#d3f7d3","#ccfecc","#198f8f","#00a8a8","#26d8d8","#00feff","#7ce8e8","#65feff","#d3f7f7","#ccfefe","#19198f","#0000a8","#2626d8","#0000ff","#7c7ce8","#6565ff","#d3d3f7","#ccccfe","#8f198f","#a800a8","#d826d8","#ff00fe","#e87ce8","#ff65fe","#f7d3f7","#feccfe","#000000","#242424","#484848","#6d6d6d","#919191","#b6b6b6","#dadada","#ffffff"],b.__renkans=[];var e=b._BaseBin=function(a,c){if("undefined"!=typeof a){this.renkan=a,this.renkan.$.find(".Rk-Bin-Main").hide(),this.$=b.$("<li>").addClass("Rk-Bin").appendTo(a.$.find(".Rk-Bin-List")),this.title_icon_$=b.$("<span>").addClass("Rk-Bin-Title-Icon").appendTo(this.$);var d=this;b.$("<a>").attr({href:"#",title:a.translate("Close bin")}).addClass("Rk-Bin-Close").html("×").appendTo(this.$).click(function(){return d.destroy(),a.$.find(".Rk-Bin-Main:visible").length||a.$.find(".Rk-Bin-Main:last").slideDown(),a.resizeBins(),!1}),b.$("<a>").attr({href:"#",title:a.translate("Refresh bin")}).addClass("Rk-Bin-Refresh").appendTo(this.$).click(function(){return d.refresh(),!1}),this.count_$=b.$("<div>").addClass("Rk-Bin-Count").appendTo(this.$),this.title_$=b.$("<h2>").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("<div>").addClass("Rk-Bin-Main").appendTo(this.$).html('<h4 class="Rk-Bin-Loading">'+a.translate("Loading, please wait")+"</h4>"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return'<ul class="Rk-Edit-ColorPicker">'+b.pickerColors.map(function(b){return a({c:b})}).join("")+"</ul>"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageX<c.left+d&&b.pageY>=c.top&&b.pageY<c.top+f)if(j)e.renderer.onMouseMove(b,!0);else{j=!0;var g=document.createElement("div");g.appendChild(this.cloneNode(!0)),e.renderer.dropData({"text/html":g.innerHTML},b),e.renderer.onMouseDown(b,!0)}}).on("touchend",".Rk-Bin-Item",function(a){j&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),j=!1}).on("dragstart",".Rk-Bin-Item",function(a){var b=document.createElement("div");b.appendChild(this.cloneNode(!0));try{a.originalEvent.dataTransfer.setData("text/html",b.innerHTML)}catch(c){a.originalEvent.dataTransfer.setData("text",b.innerHTML)}}),b.$(window).resize(function(){e.resizeBins()});var k=!1,l="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==l){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==k&&(k=c.source,d.each(e.tabs,function(a){a.render(c)}))}}),this.$.find(".Rk-Bins-Search-Form").submit(function(){return!1})};f.prototype.translate=function(a){return b.i18n[this.options.language]&&b.i18n[this.options.language][a]?b.i18n[this.options.language][a]:this.options.language.length>2&&b.i18n[this.options.language.substr(0,2)]&&b.i18n[this.options.language.substr(0,2)][a]?b.i18n[this.options.language.substr(0,2)][a]:a},f.prototype.onStatusChange=function(){this.renderer.onStatusChange()},f.prototype.setSearchEngine=function(a){this.search_engine=this.search_engines[a],this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current "+this.search_engine.getBgClass());for(var b=this.search_engine.getBgClass().split(" "),c="",d=0;d<b.length;d++)c+="."+b[d];this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder",this.translate("Search in ")+this.$.find(".Rk-Search-List "+c).html())},f.prototype.resizeBins=function(){var a=+this.$.find(".Rk-Bins-Head").outerHeight();this.$.find(".Rk-Bin-Title:visible").each(function(){a+=b.$(this).outerHeight()
-}),this.$.find(".Rk-Bin-Main").css({height:this.$.find(".Rk-Bins").height()-a})};var g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})};b.Utils={getUUID4:g,getUID:function(){function a(a){return 10>a?"0"+a:a}var b=new Date,c=0,d=b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1)+"-"+a(b.getUTCDate())+"-"+g();return function(a){for(var b=(++c).toString(16),e="undefined"==typeof a?"":a+"-";b.length<4;)b="0"+b;return e+d+"-"+b}}(),getFullURL:function(a){if("undefined"==typeof a||null==a)return"";if(/https?:\/\//.test(a))return a;var b=new Image;b.src=a;var c=b.src;return b.src=null,c},inherit:function(a,b){var c=function(){"function"==typeof b&&b.apply(this,Array.prototype.slice.call(arguments,0)),a.apply(this,Array.prototype.slice.call(arguments,0)),"function"!=typeof this._init||this._initialized||(this._init.apply(this,Array.prototype.slice.call(arguments,0)),this._initialized=!0)};return d.extend(c.prototype,a.prototype),c},regexpFromTextOrArray:function(){function a(a){function b(a){return function(b,c){a=a.replace(h[b],c)}}for(var e=a.toLowerCase().replace(g,""),i="",j=0;j<e.length;j++){j&&(i+=f+"*");var k=e[j];d.each(c,b(k)),i+=k}return i}function b(c){switch(typeof c){case"string":return a(c);case"object":var e="";return d.each(c,function(a){var c=b(a);c&&(e&&(e+="|"),e+=c)}),e}return""}var c=["[aáàâä]","[cç]","[eéèêë]","[iíìîï]","[oóòôö]","[uùûü]"],e=[String.fromCharCode(768),String.fromCharCode(769),String.fromCharCode(770),String.fromCharCode(771),String.fromCharCode(807),"{","}","(",")","[","]","【","】","、","・","‥","。","「","」","『","』","〜",":","!","?"," ",","," ",";","(",")",".","*","+","\\","?","|","{","}","[","]","^","#","/"],f="[\\"+e.join("\\")+"]",g=new RegExp(f,"gm"),h=d.map(c,function(a){return new RegExp(a)});return function(a){var c=b(a);if(c){var d=new RegExp(c,"im"),e=new RegExp("("+c+")","igm");return{isempty:!1,source:c,test:function(a){return d.test(a)},replace:function(a,b){return a.replace(e,b)}}}return{isempty:!0,source:"",test:function(){return!0},replace:function(){return text}}}}(),_MIN_DRAG_DISTANCE:2,_NODE_BUTTON_WIDTH:40,_EDGE_BUTTON_INNER:2,_EDGE_BUTTON_OUTER:40,_CLICKMODE_ADDNODE:1,_CLICKMODE_STARTEDGE:2,_CLICKMODE_ENDEDGE:3,_NODE_SIZE_STEP:Math.LN2/4,_MIN_SCALE:.05,_MAX_SCALE:20,_MOUSEMOVE_RATE:80,_DOUBLETAP_DELAY:800,_DOUBLETAP_DISTANCE:400,_USER_PLACEHOLDER:function(a){return{color:a.options.default_user_color,title:a.translate("(unknown user)"),get:function(a){return this[a]||!1}}},_BOOKMARKLET_CODE:function(a){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;\">"+a.translate("Drag items from this website, drop them in Renkan").replace(/ /g,"_")+"</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);})();"},shortenText:function(a,b){return a.length>b?a.substr(0,b)+"…":a},drawEditBox:function(a,b,c,d,e){e.css({width:a.tooltip_width-2*a.tooltip_padding});var f=e.outerHeight()+2*a.tooltip_padding,g=b.x<paper.view.center.x?1:-1,h=b.x+g*(d+a.tooltip_arrow_length),i=b.x+g*(d+a.tooltip_arrow_length+a.tooltip_width),j=b.y-f/2;j+f>paper.view.size.height-a.tooltip_margin&&(j=Math.max(paper.view.size.height-a.tooltip_margin,b.y+a.tooltip_arrow_width/2)-f),j<a.tooltip_margin&&(j=Math.min(a.tooltip_margin,b.y-a.tooltip_arrow_width/2));var k=j+f;return c.segments[0].point=c.segments[7].point=b.add([g*d,0]),c.segments[1].point.x=c.segments[2].point.x=c.segments[5].point.x=c.segments[6].point.x=h,c.segments[3].point.x=c.segments[4].point.x=i,c.segments[2].point.y=c.segments[3].point.y=j,c.segments[4].point.y=c.segments[5].point.y=k,c.segments[1].point.y=b.y-a.tooltip_arrow_width/2,c.segments[6].point.y=b.y+a.tooltip_arrow_width/2,c.closed=!0,c.fillColor=new paper.GradientColor(new paper.Gradient([a.tooltip_top_color,a.tooltip_bottom_color]),[0,j],[0,k]),e.css({left:a.tooltip_padding+Math.min(h,i),top:a.tooltip_padding+j}),c},increaseBrightness:function(a,b){a=a.replace(/^\s*#|\s*$/g,""),3===a.length&&(a=a.replace(/(.)/g,"$1$1"));var c=parseInt(a.substr(0,2),16),d=parseInt(a.substr(2,2),16),e=parseInt(a.substr(4,2),16);return"#"+(0|256+c+(256-c)*b/100).toString(16).substr(1)+(0|256+d+(256-d)*b/100).toString(16).substr(1)+(0|256+e+(256-e)*b/100).toString(16).substr(1)}}}(window),function(a){"use strict";var b=a.Rkns.DataLoader={converters:{from1to2:function(a){var b,c;if("undefined"!=typeof a.nodes)for(b=0,c=a.nodes.length;c>b;b++){var d=a.nodes[b];d.color?(console.log("node color : ",d.color),d.style={color:d.color}):d.style={}}if("undefined"!=typeof a.edges)for(b=0,c=a.edges.length;c>b;b++){var e=a.edges[b];e.style=e.color?{color:e.color}:{}}return a.schema_version="2",a}}};b.Loader=function(a,c){this.project=a,this.dataConverters=_.defaults(c.converters||{},b.converters)},b.Loader.prototype.convert=function(a){var b=this.project.getSchemaVersion(a),c=this.project.getSchemaVersion();if(b!==c){var d="from"+b+"to"+c;"function"==typeof this.dataConverters[d]&&(console.log("Apply conversion function :",d),a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){console.log(a),this.project.set(this.convert(a),{validate:!0})}}(window),function(a){"use strict";var b=a.Backbone,c=a.Rkns.Models={};c.getUID=function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)});return"undefined"!=typeof a?a.type+"-"+b:b};{var d=b.RelationalModel.extend({idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"",a.description=a.description||"",a.uri=a.uri||"","function"==typeof this.prepare&&(a=this.prepare(a))),b.RelationalModel.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},addReference:function(a,b,c,d,e){var f=c.get(d);a[b]="undefined"==typeof f&&"undefined"!=typeof e?e:f}}),e=c.User=d.extend({type:"user",prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color")}}}),f=c.Node=d.extend({type:"node",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),position:this.get("position"),image:this.get("image"),style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,size:this.get("size"),clip_path:this.get("clip_path"),shape:this.get("shape"),type:this.get("type"),hidden:this.get("hidden")}}}),g=c.Edge=d.extend({type:"edge",relations:[{type:b.HasOne,key:"created_by",relatedModel:e},{type:b.HasOne,key:"from",relatedModel:f},{type:b.HasOne,key:"to",relatedModel:f}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),this.addReference(a,"from",b.get("nodes"),a.from),this.addReference(a,"to",b.get("nodes"),a.to),a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),from:this.get("from")?this.get("from").get("_id"):null,to:this.get("to")?this.get("to").get("_id"):null,style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),h=c.View=d.extend({type:"view",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;if(this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"","undefined"!=typeof a.offset){var c={};Array.isArray(a.offset)?(c.x=a.offset[0],c.y=a.offset.length>1?a.offset[1]:a.offset[0]):null!=a.offset.x&&(c.x=a.offset.x,c.y=a.offset.y),a.offset=c}return a},toJSON:function(){return{_id:this.get("_id"),zoom_level:this.get("zoom_level"),offset:this.get("offset"),title:this.get("title"),description:this.get("description"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),i=(c.Project=d.extend({schema_version:"2",type:"project",blacklist:["saveStatus","loadingStatus"],relations:[{type:b.HasMany,key:"users",relatedModel:e,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"nodes",relatedModel:f,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"edges",relatedModel:g,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"views",relatedModel:h,reverseRelation:{key:"project",includeInJSON:"_id"}}],addUser:function(a,b){a.project=this;var c=e.findOrCreate(a);return this.get("users").push(c,b),c},addNode:function(a,b){a.project=this;var c=f.findOrCreate(a);return this.get("nodes").push(c,b),c},addEdge:function(a,b){a.project=this;var c=g.findOrCreate(a);return this.get("edges").push(c,b),c},addView:function(a,b){a.project=this;var c=h.findOrCreate(a);return this.get("views").push(c,b),c},removeNode:function(a){this.get("nodes").remove(a)},removeEdge:function(a){this.get("edges").remove(a)},validate:function(a){var b=this;_.each([].concat(a.users,a.nodes,a.edges,a.views),function(a){a&&(a.project=b)})},getSchemaVersion:function(a){var b=a;"undefined"==typeof b&&(b=this);var c=b.schema_version;return c?c:1},initialize:function(){var a=this;this.on("remove:nodes",function(b){a.get("edges").remove(a.get("edges").filter(function(a){return a.get("from")===b||a.get("to")===b}))})},toJSON:function(){var a=_.clone(this.attributes);for(var c in a)(a[c]instanceof b.Model||a[c]instanceof b.Collection||a[c]instanceof d)&&(a[c]=a[c].toJSON());return _.omit(a,this.blacklist)}}),c.RosterUser=b.Model.extend({type:"roster_user",idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"(untitled "+this.type+")",a.description=a.description||"",a.uri=a.uri||"",a.project=a.project||null,a.site_id=a.site_id||0,"function"==typeof this.prepare&&(a=this.prepare(a))),b.Model.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color"),project:null!=this.get("project")?this.get("project").get("id"):null,site_id:this.get("site_id")}}}));c.UsersList=b.Collection.extend({model:i})}}(window),Rkns.defaults={language:navigator.language||navigator.userLanguage||"en",container:"renkan",search:[],bins:[],static_url:"",show_bins:!0,properties:[],show_editor:!0,read_only:!1,editor_mode:!0,manual_save:!1,show_top_bar:!0,default_user_color:"#303030",size_bug_fix:!0,force_resize:!1,allow_double_click:!0,zoom_on_scroll:!0,element_delete_delay:0,autoscale_padding:50,resize:!0,show_zoom:!0,save_view:!0,default_view:!1,show_search_field:!0,show_user_list:!0,user_name_editable:!0,user_color_editable:!0,show_user_color:!0,show_save_button:!0,show_export_button:!0,show_open_button:!1,show_addnode_button:!0,show_addedge_button:!0,show_bookmarklet:!0,show_fullscreen_button:!0,home_button_url:!1,home_button_title:"Home",show_minimap:!0,minimap_width:160,minimap_height:120,minimap_padding:20,minimap_background_color:"#ffffff",minimap_border_color:"#cccccc",minimap_highlight_color:"#ffff00",minimap_highlight_weight:5,buttons_background:"#202020",buttons_label_color:"#c000c0",buttons_label_font_size:9,default_dash_array:[4,5],show_node_circles:!0,clip_node_images:!0,node_images_fill_mode:!1,node_size_base:25,node_stroke_width:2,node_stroke_max_width:12,selected_node_stroke_width:4,selected_node_stroke_max_width:24,node_stroke_witdh_scale:5,node_fill_color:"#ffffff",highlighted_node_fill_color:"#ffff00",node_label_distance:5,node_label_max_length:60,label_untitled_nodes:"(untitled)",change_shapes:!0,edge_stroke_width:2,edge_stroke_max_width:12,selected_edge_stroke_width:4,selected_edge_stroke_max_width:24,edge_stroke_witdh_scale:5,edge_label_distance:0,edge_label_max_length:20,edge_arrow_length:18,edge_arrow_width:12,edge_arrow_max_width:32,edge_gap_in_bundles:12,label_untitled_edges:"",tooltip_width:275,tooltip_padding:10,tooltip_margin:15,tooltip_arrow_length:20,tooltip_arrow_width:40,tooltip_top_color:"#f0f0f0",tooltip_bottom_color:"#d0d0d0",tooltip_border_color:"#808080",tooltip_border_width:1,show_node_editor_uri:!0,show_node_editor_description:!0,show_node_editor_size:!0,show_node_editor_style:!0,show_node_editor_style_color:!0,show_node_editor_style_dash:!0,show_node_editor_style_thickness:!0,show_node_editor_image:!0,show_node_editor_creator:!0,allow_image_upload:!0,uploaded_image_max_kb:500,show_node_tooltip_uri:!0,show_node_tooltip_description:!0,show_node_tooltip_color:!0,show_node_tooltip_image:!0,show_node_tooltip_creator:!0,show_edge_editor_uri:!0,show_edge_editor_style:!0,show_edge_editor_style_color:!0,show_edge_editor_style_dash:!0,show_edge_editor_style_thickness:!0,show_edge_editor_style_arrow:!0,show_edge_editor_direction:!0,show_edge_editor_nodes:!0,show_edge_editor_creator:!0,show_edge_tooltip_uri:!0,show_edge_tooltip_color:!0,show_edge_tooltip_nodes:!0,show_edge_tooltip_creator:!0},Rkns.i18n={fr:{"Edit Node":"Édition d’un nœud","Edit Edge":"Édition d’un lien","Title:":"Titre :","URI:":"URI :","Description:":"Description :","From:":"De :","To:":"Vers :",Image:"Image","Image URL:":"URL d'Image","Choose Image File:":"Choisir un fichier image","Full Screen":"Mode plein écran","Add Node":"Ajouter un nœud","Add Edge":"Ajouter un lien","Save Project":"Enregistrer le projet","Open Project":"Ouvrir un projet","Auto-save enabled":"Enregistrement automatique activé","Connection lost":"Connexion perdue","Created by:":"Créé par :","Zoom In":"Agrandir l’échelle","Zoom Out":"Rapetisser l’échelle",Edit:"Éditer",Remove:"Supprimer","Cancel deletion":"Annuler la suppression","Link to another node":"Créer un lien",Enlarge:"Agrandir",Shrink:"Rétrécir","Click on the background canvas to add a node":"Cliquer sur le fond du graphe pour rajouter un nœud","Click on a first node to start the edge":"Cliquer sur un premier nœud pour commencer le lien","Click on a second node to complete the edge":"Cliquer sur un second nœud pour terminer le lien",Wikipedia:"Wikipédia","Wikipedia in ":"Wikipédia en ",French:"Français",English:"Anglais",Japanese:"Japonais","Untitled project":"Projet sans titre","Lignes de Temps":"Lignes de Temps","Loading, please wait":"Chargement en cours, merci de patienter","Edge color:":"Couleur :","Dash:":"Point. :","Thickness:":"Epaisseur :","Arrow:":"Flèche :","Node color:":"Couleur :","Choose color":"Choisir une couleur","Change edge direction":"Changer le sens du lien","Do you really wish to remove node ":"Voulez-vous réellement supprimer le nœud ","Do you really wish to remove edge ":"Voulez-vous réellement supprimer le lien ","This file is not an image":"Ce fichier n'est pas une image","Image size must be under ":"L'image doit peser moins de ","Size:":"Taille :",KB:"ko","Choose from vocabulary:":"Choisir dans un vocabulaire :","SKOS Documentation properties":"SKOS: Propriétés documentaires","has note":"a pour note","has example":"a pour exemple","has definition":"a pour définition","SKOS Semantic relations":"SKOS: Relations sémantiques","has broader":"a pour concept plus large","has narrower":"a pour concept plus étroit","has related":"a pour concept apparenté","Dublin Core Metadata":"Métadonnées Dublin Core","has contributor":"a pour contributeur",covers:"couvre","created by":"créé par","has date":"a pour date","published by":"édité par","has source":"a pour source","has subject":"a pour sujet","Dragged resource":"Ressource glisée-déposée","Search the Web":"Rechercher en ligne","Search in Bins":"Rechercher dans les chutiers","Close bin":"Fermer le chutier","Refresh bin":"Rafraîchir le chutier","(untitled)":"(sans titre)","Select contents:":"Sélectionner des contenus :","Drag items from this website, drop them in Renkan":"Glissez des éléments de ce site web vers 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.":"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","Shapes available":"Formes disponibles",Circle:"Cercle",Square:"Carré",Diamond:"Losange",Hexagone:"Hexagone",Ellipse:"Ellipse",Star:"Étoile",Cloud:"Nuage",Triangle:"Triangle","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Zoom Save":"Sauver le Zoom","View saved zoom":"Restaurer le Zoom","Renkan 'Drag-to-Add' bookmarklet":"Renkan 'Deplacer-Pour-Ajouter' Signet","(unknown user)":"(non authentifié)","<unknown user>":"<non authentifié>","Search in graph":"Rechercher dans carte","Search in ":"Chercher dans "}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){a.renderer.redrawActive=!1,c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.redrawActive=!0,a.renderer.fixSize()})},e=function(){c.set({saveStatus:2});var d=c.toJSON();a.read_only||Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(d),success:function(){c.set({saveStatus:0})}})},f=Rkns._.throttle(function(){setTimeout(e,100)},1e3);c.on("add:nodes add:edges add:users add:views",function(a){a.on("change remove",function(){f()}),f()}),c.on("change",function(){1===c.changedAttributes.length&&c.hasChanged("saveStatus")||f()}),d()},Rkns.jsonIOSaveOnClick=function(a,b){var c=a.project,d=!1,e=function(){return"Project not saved"};"undefined"==typeof b.http_method&&(b.http_method="POST");var f=function(){var d={},e=/id=([^&#?=]+)/,f=document.location.hash.match(e);f&&(d.id=f[1]),Rkns.$.ajax({url:b.url,data:d,beforeSend:function(){c.set({loadingStatus:!0})},success:function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.autoScale()}})},g=function(){c.set("saved_at",new Date);var a=c.toJSON();Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(a),beforeSend:function(){c.set({saveStatus:2})},success:function(){$(window).off("beforeunload",e),d=!1,c.set({saveStatus:0})}})},h=function(){c.set({saveStatus:1});var a=c.get("title");a&&c.get("nodes").length?$(".Rk-Save-Button").removeClass("disabled"):$(".Rk-Save-Button").addClass("disabled"),a&&$(".Rk-PadTitle").css("border-color","#333333"),d||(d=!0,$(window).on("beforeunload",e))};f(),c.on("add:nodes add:edges add:users change",function(a){a.on("change remove",function(a){1===a.changedAttributes.length&&a.hasChanged("saveStatus")||h()}),1===c.changedAttributes.length&&c.hasChanged("saveStatus")||h()}),a.renderer.save=function(){$(".Rk-Save-Button").hasClass("disabled")?c.get("title")||$(".Rk-PadTitle").css("border-color","#ff0000"):g()}},function(a){"use strict";var b=a._,c=a.Ldt={},d=(c.Bin=function(a,b){if(b.ldt_type){var d=c[b.ldt_type+"Bin"];if(d)return new d(a,b)}console.error("No such LDT Bin Type")},c.ProjectBin=a.Utils.inherit(a._BaseBin));d.prototype.tagTemplate=renkanJST["templates/ldtjson-bin/tagtemplate.html"],d.prototype.annotationTemplate=renkanJST["templates/ldtjson-bin/annotationtemplate.html"],d.prototype._init=function(a,b){this.renkan=a,this.proj_id=b.project_id,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.title_$.html(b.title),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},d.prototype.render=function(c){function d(a){var c=b(a).escape();return f.isempty?c:f.replace(c,"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}var f=c||a.Utils.regexpFromTextOrArray(),g="<li><h3>Tags</h3></li>",h=this.data.meta["dc:title"],i=this,j=0;i.title_$.text('LDT Project: "'+h+'"'),b.map(i.data.tags,function(a){var b=a.meta["dc:title"];(f.isempty||f.test(b))&&(j++,g+=i.tagTemplate({ldt_platform:i.ldt_platform,title:b,htitle:d(b),encodedtitle:encodeURIComponent(b),static_url:i.renkan.options.static_url}))}),g+="<li><h3>Annotations</h3></li>",b.map(i.data.annotations,function(a){var b=a.content.description,c=a.content.title.replace(b,"");if(f.isempty||f.test(c)||f.test(b)){j++;var h=a.end-a.begin,k=a.content&&a.content.img&&a.content.img.src?a.content.img.src:h?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";g+=i.annotationTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(a.begin),end:e(a.end),duration:e(h),mediaid:a.media,annotationid:a.id,image:k,static_url:i.renkan.options.static_url})}}),this.main_$.html(g),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()},d.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/ldt/cljson/id/"+this.proj_id,dataType:"jsonp",success:function(a){b.data=a,b.render()}})};var e=c.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"};e.prototype.getBgClass=function(){return"Rk-Ldt-Icon"},e.prototype.getSearchTitle=function(){return this.renkan.translate("Lignes de Temps")},e.prototype.search=function(a){this.renkan.tabs.push(new f(this.renkan,{search:a}))};var f=c.ResultsBin=a.Utils.inherit(a._BaseBin);f.prototype.segmentTemplate=renkanJST["templates/ldtjson-bin/segmenttemplate.html"],f.prototype._init=function(a,b){this.renkan=a,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.max_results=b.max_results||50,this.search=b.search,this.title_$.html('Lignes de Temps: "'+b.search+'"'),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},f.prototype.render=function(c){function d(a){return g.replace(b(a).escape(),"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}if(this.data){var f=c||a.Utils.regexpFromTextOrArray(),g=f.isempty?a.Utils.regexpFromTextOrArray(this.search):f,h="",i=this,j=0;b.each(this.data.objects,function(a){var b=a["abstract"],c=a.title;if(f.isempty||f.test(c)||f.test(b)){j++;var g=a.duration,k=a.start_ts,l=+a.duration+k,m=g?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";h+=i.segmentTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(k),end:e(l),duration:e(g),mediaid:a.iri_id,annotationid:a.element_id,image:m})}}),this.main_$.html(h),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()}},f.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/api/ldt/1.0/segments/search/",data:{format:"jsonp",q:this.search,limit:this.max_results},dataType:"jsonp",success:function(a){b.data=a,b.render()}})}}(window.Rkns),Rkns.ResourceList={},Rkns.ResourceList.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.ResourceList.Bin.prototype.resultTemplate=renkanJST["templates/list-bin.html"],Rkns.ResourceList.Bin.prototype._init=function(a,b){this.renkan=a,this.title_$.html(b.title),b.list&&(this.data=b.list),this.refresh()},Rkns.ResourceList.Bin.prototype.render=function(a){function b(a){var b=_(a).escape();return c.isempty?b:c.replace(b,"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d="",e=this,f=0;Rkns._.each(this.data,function(a){var g;if("string"==typeof a)if(/^(https?:\/\/|www)/.test(a))g={url:a};else{g={title:a.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,"").trim()};var h=a.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);h&&(g.url=h[0]),g.title.length>80&&(g.description=g.title,g.title=g.title.replace(/^(.{30,60})\s.+$/,"$1…"))}else g=a;var i=g.title||(g.url||"").replace(/^https?:\/\/(www\.)?/,"").replace(/^(.{40}).+$/,"$1…"),j=g.url||"",k=g.description||"",l=g.image||"";j&&!/^https?:\/\//.test(j)&&(j="http://"+j),(c.isempty||c.test(i)||c.test(k))&&(f++,d+=e.resultTemplate({url:j,title:i,htitle:b(i),image:l,description:k,hdescription:b(k),static_url:e.renkan.options.static_url}))}),e.main_$.html(d),!c.isempty&&f?this.count_$.text(f).show():this.count_$.hide(),c.isempty||f?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.ResourceList.Bin.prototype.refresh=function(){this.data&&this.render()},Rkns.Wikipedia={},Rkns.Wikipedia.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"},Rkns.Wikipedia.Search.prototype.getBgClass=function(){return"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-"+this.lang},Rkns.Wikipedia.Search.prototype.getSearchTitle=function(){var a={fr:"French",en:"English",ja:"Japanese"};return a[this.lang]?this.renkan.translate("Wikipedia in ")+this.renkan.translate(a[this.lang]):this.renkan.translate("Wikipedia")+" ["+this.lang+"]"},Rkns.Wikipedia.Search.prototype.search=function(a){this.renkan.tabs.push(new Rkns.Wikipedia.Bin(this.renkan,{lang:this.lang,search:a}))},Rkns.Wikipedia.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.Wikipedia.Bin.prototype.resultTemplate=renkanJST["templates/wikipedia-bin/resulttemplate.html"],Rkns.Wikipedia.Bin.prototype._init=function(a,b){this.renkan=a,this.search=b.search,this.lang=b.lang||"en",this.title_icon_$.addClass("Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-"+this.lang),this.title_$.html(this.search).addClass("Rk-Wikipedia-Title"),this.refresh()},Rkns.Wikipedia.Bin.prototype.render=function(a){function b(a){return d.replace(_(a).escape(),"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d=c.isempty?Rkns.Utils.regexpFromTextOrArray(this.search):c,e="",f=this,g=0;Rkns._.each(this.data.query.search,function(a){var d=a.title,h="http://"+f.lang+".wikipedia.org/wiki/"+encodeURI(d.replace(/ /g,"_")),i=Rkns.$("<div>").html(a.snippet).text();(c.isempty||c.test(d)||c.test(i))&&(g++,e+=f.resultTemplate({url:h,title:d,htitle:b(d),description:i,hdescription:b(i),static_url:f.renkan.options.static_url}))}),f.main_$.html(e),!c.isempty&&g?this.count_$.text(g).show():this.count_$.hide(),c.isempty||g?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.Wikipedia.Bin.prototype.refresh=function(){var a=this;Rkns.$.ajax({url:"http://"+a.lang+".wikipedia.org/w/api.php?action=query&list=search&srsearch="+encodeURIComponent(this.search)+"&format=json",dataType:"jsonp",success:function(b){a.data=b,a.render()}})},define("renderer/baserepresentation",["jquery","underscore"],function(a,b){var c=function(a,c){if("undefined"!=typeof a&&(this.renderer=a,this.renkan=a.renkan,this.project=a.renkan.project,this.options=a.renkan.options,this.model=c,this.model)){var d=this;this._changeBinding=function(){d.redraw({change:!0})},this._removeBinding=function(){a.removeRepresentation(d),b.defer(function(){a.redraw()})},this._selectBinding=function(){d.select()},this._unselectBinding=function(){d.unselect()},this.model.on("change",this._changeBinding),this.model.on("remove",this._removeBinding),this.model.on("select",this._selectBinding),this.model.on("unselect",this._unselectBinding)}};return b(c.prototype).extend({_super:function(a){return c.prototype[a].apply(this,Array.prototype.slice.call(arguments,1))},redraw:function(){},moveTo:function(){},show:function(){return"BaseRepresentation.show"},hide:function(){},select:function(){this.model&&this.model.trigger("selected")},unselect:function(){this.model&&this.model.trigger("unselected")},highlight:function(){},unhighlight:function(){},mousedown:function(){},mouseup:function(){this.model&&this.model.trigger("clicked")},destroy:function(){this.model&&(this.model.off("change",this._changeBinding),this.model.off("remove",this._removeBinding),this.model.off("select",this._selectBinding),this.model.off("unselect",this._unselectBinding))}}).value(),c}),define("requtils",[],function(){return{getUtils:function(){return window.Rkns.Utils},getRenderer:function(){return window.Rkns.Renderer}}}),define("renderer/basebutton",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({moveTo:function(a){this.sector.moveTo(a)},show:function(){this.sector.show()},hide:function(){this.sector.hide()},select:function(){this.sector.select()},unselect:function(a){this.sector.unselect(),(!a||a!==this.source_representation&&a.source_representation!==this.source_representation)&&this.source_representation.unselect()},destroy:function(){this.sector.destroy()}}).value(),f}),define("renderer/shapebuilder",[],function(){var a="M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z",b={circle:{getShape:function(){return new paper.Path.Circle([0,0],1)},getImageShape:function(a,b){return new paper.Path.Circle(a,b)}},rectangle:{getShape:function(){return new paper.Path.Rectangle([-2,-2],[2,2])},getImageShape:function(a,b){return new paper.Path.Rectangle([-b,-b],[2*b,2*b])
-}},ellipse:{getShape:function(){return new paper.Path.Ellipse(new paper.Rectangle([-2,-1],[2,1]))},getImageShape:function(a,b){return new paper.Path.Ellipse(new paper.Rectangle([-b,-b/2],[2*b,b]))}},polygon:{getShape:function(){return new paper.Path.RegularPolygon([0,0],6,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,6,b)}},diamond:{getShape:function(){var a=new paper.Path.Rectangle([-Math.SQRT2,-Math.SQRT2],[Math.SQRT2,Math.SQRT2]);return a.rotate(45),a},getImageShape:function(a,b){var c=new paper.Path.Rectangle([-b*Math.SQRT2/2,-b*Math.SQRT2/2],[b*Math.SQRT2,b*Math.SQRT2]);return c.rotate(45),c}},star:{getShape:function(){return new paper.Path.Star([0,0],8,1,.7)},getImageShape:function(a,b){return new paper.Path.Star(a,8,1*b,.7*b)}},cloud:{getShape:function(){var b=new paper.Path(a);return b},getImageShape:function(b,c){var d=new paper.Path(a);return d.scale(c),d.translate(b),d}},triangle:{getShape:function(){return new paper.Path.RegularPolygon([0,0],3,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,3,b)}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(){return new paper.Path}}}},c=function(a){return(null===a||"undefined"==typeof a)&&(a="circle"),"svg:"===a.substr(0,4)?b.svg(a.substr(4)):(a in b||(a="circle"),b[a])};return c.builders=b,c}),define("renderer/noderepr",["jquery","underscore","requtils","renderer/baserepresentation","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){if(this.renderer.node_layer.activate(),this.type="Node",this.buildShape(),this.options.show_node_circles?(this.circle.strokeWidth=this.options.node_stroke_width,this.h_ratio=1):this.h_ratio=0,this.title=a('<div class="Rk-Label">').appendTo(this.renderer.labels_$),this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.NodeEditButton(this.renderer,null),new b.NodeRemoveButton(this.renderer,null),new b.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.pending_delete_buttons=[new b.NodeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.last_circle_radius=1,this.renderer.minimap&&(this.renderer.minimap.node_layer.activate(),this.minimap_circle=new paper.Path.Circle([0,0],1),this.minimap_circle.__representation=this.renderer.minimap.miniframe.__representation,this.renderer.minimap.node_group.addChild(this.minimap_circle))},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.node_stroke_width+(a-1)*(this.options.node_stroke_max_width-this.options.node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_node_stroke_width+(a-1)*(this.options.selected_node_stroke_max_width-this.options.selected_node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},buildShape:function(){"shape"in this.model.changed&&delete this.img,this.circle&&(this.circle.remove(),delete this.circle),this.shapeBuilder=new e(this.model.get("shape")),this.circle=this.shapeBuilder.getShape(),this.circle.__representation=this,this.circle.sendToBack(),this.last_circle_radius=1},redraw:function(a){"shape"in this.model.changed&&"change"in a&&a.change&&this.buildShape();var c=new paper.Point(this.model.get("position")),d=this.options.node_size_base*Math.exp((this.model.get("size")||0)*f._NODE_SIZE_STEP);this.is_dragging&&this.paper_coords||(this.paper_coords=this.renderer.toPaperCoords(c)),this.circle_radius=d*this.renderer.scale,this.last_circle_radius!==this.circle_radius&&(this.all_buttons.forEach(function(a){a.setSectorSize()}),this.circle.scale(this.circle_radius/this.last_circle_radius),this.node_image&&this.node_image.scale(this.circle_radius/this.last_circle_radius)),this.circle.position=this.paper_coords,this.node_image&&(this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius))),this.last_circle_radius=this.circle_radius;var e=this.active_buttons,g=1;this.model.get("delete_scheduled")?(g=.5,this.active_buttons=this.pending_delete_buttons,this.circle.dashArray=[2,2]):(g=1,this.active_buttons=this.normal_buttons,this.circle.dashArray=null),this.selected&&this.renderer.isEditable()&&(e!==this.active_buttons&&e.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.node_image&&(this.node_image.opacity=this.highlighted?.5*g:g-.01),this.circle.fillColor=this.highlighted?this.options.highlighted_node_fill_color:this.options.node_fill_color,this.circle.opacity=this.options.show_node_circles?g:.01;var h=this.model.get("title")||this.renkan.translate(this.options.label_untitled_nodes)||"";h=f.shortenText(h,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(h).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(h);var i=this._getStrokeWidth();this.title.css({left:this.paper_coords.x,top:this.paper_coords.y+this.circle_radius*this.h_ratio+this.options.node_label_distance+.5*i,opacity:g});var j=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),k=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=i,this.circle.strokeColor=j,this.circle.dashArray=k;var l=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(l)});var m=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==m&&(this.showImage(),this.circle&&this.circle.sendToBack()),this.node_image&&!this.img&&(this.node_image.remove(),delete this.node_image),this.renderer.minimap){this.minimap_circle.fillColor=j;var n=this.renderer.toMinimapCoords(c),o=this.renderer.minimap.scale*d,p=new paper.Size([o,o]);this.minimap_circle.fitBounds(n.subtract(p),p.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var q=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===q.model||a.get("from")===q.model}),function(a){var b=q.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.redraw()})}},showImage:function(){var b=null;if("undefined"==typeof this.renderer.image_cache[this.img]?(b=new Image,this.renderer.image_cache[this.img]=b,b.src=this.img):b=this.renderer.image_cache[this.img],b.width){this.node_image&&this.node_image.remove(),this.renderer.node_layer.activate();var c=b.width,d=b.height,e=this.model.get("clip_path"),f="undefined"!=typeof e&&e,g=null,h=null,i=null;if(f){g=new paper.Path;var j=e.match(/[a-z][^a-z]+/gi)||[],k=[0,0],l=1/0,m=1/0,n=-1/0,o=-1/0,p=function(a,b){var e=a.slice(1).map(function(a,e){var f=parseFloat(a),g=e%2;return f=g?(f-.5)*d:(f-.5)*c,b&&(f+=k[g]),g?(m=Math.min(m,f),o=Math.max(o,f)):(l=Math.min(l,f),n=Math.max(n,f)),f});return k=e.slice(-2),e};j.forEach(function(a){var b=a.match(/([a-z]|[0-9.-]+)/gi)||[""];switch(b[0]){case"M":g.moveTo(p(b));break;case"m":g.moveTo(p(b,!0));break;case"L":g.lineTo(p(b));break;case"l":g.lineTo(p(b,!0));break;case"C":g.cubicCurveTo(p(b));break;case"c":g.cubicCurveTo(p(b,!0));break;case"Q":g.quadraticCurveTo(p(b));break;case"q":g.quadraticCurveTo(p(b,!0))}}),h=Math[this.options.node_images_fill_mode?"min":"max"](n-l,o-m)/2,i=new paper.Point((n+l)/2,(o+m)/2),this.options.show_node_circles||(this.h_ratio=(o-m)/(2*h))}else h=Math[this.options.node_images_fill_mode?"min":"max"](c,d)/2,i=new paper.Point(0,0),this.options.show_node_circles||(this.h_ratio=d/(2*h));var q=new paper.Raster(b);if(q.locked=!0,f&&(q=new paper.Group(g,q),q.opacity=.99,q.clipped=!0,g.__representation=this),this.options.clip_node_images){var r=this.shapeBuilder.getImageShape(i,h);q=new paper.Group(r,q),q.opacity=.99,q.clipped=!0,r.__representation=this}this.image_delta=i.divide(h),this.node_image=q,this.node_image.__representation=s,this.node_image.scale(this.circle_radius/h),this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)),this.node_image.insertAbove(this.circle)}else{var s=this;a(b).on("load",function(){s.showImage()})}},paperShift:function(a){this.options.editor_mode?this.renkan.read_only||(this.is_dragging=!0,this.paper_coords=this.paper_coords.add(a),this.redraw()):this.renderer.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.circle.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()});var b=this.model.get("uri");b&&a(".Rk-Bin-Item").each(function(){var c=a(this);c.attr("data-uri")===b&&c.addClass("selected")}),this.options.editor_mode||this.openEditor(),this.renderer.minimap&&(this.minimap_circle.strokeWidth=this.options.minimap_highlight_weight,this.minimap_circle.strokeColor=this.options.minimap_highlight_color),this._super("select")},hideButtons:function(){this.all_buttons.forEach(function(a){a.hide()}),delete this.buttonTimeout},unselect:function(b){if(!b||b.source_representation!==this){this.selected=!1;var c=this;this.buttons_timeout=setTimeout(function(){c.hideButtons()},200),this.circle.strokeWidth=this._getStrokeWidth(),a(".Rk-Bin-Item").removeClass("selected"),this.renderer.minimap&&(this.minimap_circle.strokeColor=void 0),this._super("unselect")}},highlight:function(a){var b=a||!0;this.highlighted!==b&&(this.highlighted=b,this.redraw(),this.renderer.throttledPaperDraw())},unhighlight:function(){this.highlighted&&(this.highlighted=!1,this.redraw(),this.renderer.throttledPaperDraw())},saveCoords:function(){var a=this.renderer.toModelCoords(this.paper_coords),b={position:{x:a.x,y:a.y}};this.renderer.isEditable()&&this.model.set(b)},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){this.renderer.is_dragging&&this.renderer.isEditable()?this.saveCoords():(b||this.model.get("delete_scheduled")||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1,this.is_dragging=!1},destroy:function(){this._super("destroy"),this.all_buttons.forEach(function(a){a.destroy()}),this.circle.remove(),this.title.remove(),this.renderer.minimap&&this.minimap_circle.remove(),this.node_image&&this.node_image.remove()}}).value(),g}),define("renderer/edge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){if(this.renderer.edge_layer.activate(),this.type="Edge",this.from_representation=this.renderer.getRepresentationByModel(this.model.get("from")),this.to_representation=this.renderer.getRepresentationByModel(this.model.get("to")),this.bundle=this.renderer.addToBundles(this),this.line=new paper.Path,this.line.add([0,0],[0,0],[0,0]),this.line.__representation=this,this.line.strokeWidth=this.options.edge_stroke_width,this.arrow_scale=1,this.arrow=new paper.Path,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.pivot=new paper.Point([this.options.edge_arrow_length/2,this.options.edge_arrow_width/2]),this.arrow.__representation=this,this.text=a('<div class="Rk-Label Rk-Edge-Label">').appendTo(this.renderer.labels_$),this.arrow_angle=0,this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.EdgeEditButton(this.renderer,null),new b.EdgeRemoveButton(this.renderer,null)],this.pending_delete_buttons=[new b.EdgeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.renderer.minimap&&(this.renderer.minimap.edge_layer.activate(),this.minimap_line=new paper.Path,this.minimap_line.add([0,0],[0,0]),this.minimap_line.__representation=this.renderer.minimap.miniframe.__representation,this.minimap_line.strokeWidth=1)},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.edge_stroke_width+(a-1)*(this.options.edge_stroke_max_width-this.options.edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_edge_stroke_width+(a-1)*(this.options.selected_edge_stroke_max_width-this.options.selected_edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getArrowScale:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return 1+(a-1)*(this.options.edge_arrow_max_width/this.options.edge_arrow_width-1)/(this.options.edge_stroke_witdh_scale-1)},redraw:function(){var a=this.model.get("from"),b=this.model.get("to");if(a&&b&&(this.from_representation=this.renderer.getRepresentationByModel(a),this.to_representation=this.renderer.getRepresentationByModel(b),"undefined"!=typeof this.from_representation&&"undefined"!=typeof this.to_representation)){var c=this._getStrokeWidth(),d=this._getArrowScale(),f=this.from_representation.paper_coords,g=this.to_representation.paper_coords,h=g.subtract(f),i=h.length,j=h.divide(i),k=new paper.Point([-j.y,j.x]),l=this.bundle.getPosition(this),m=k.multiply(this.options.edge_gap_in_bundles*l),n=f.add(m),o=g.add(m),p=h.angle,q=k.multiply(this.options.edge_label_distance+.5*d*this.options.edge_arrow_width),r=h.divide(3),s=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),t=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null,u=1;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(u=.5,this.line.dashArray=[2,2]):(u=1,this.line.dashArray=null);var v=this.active_buttons,w=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow?u:0;this.active_buttons=this.model.get("delete_scheduled")?this.pending_delete_buttons:this.normal_buttons,this.selected&&this.renderer.isEditable()&&v!==this.active_buttons&&(v.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.paper_coords=n.add(o).divide(2),this.line.strokeWidth=c,this.line.strokeColor=s,this.line.dashArray=t,this.line.opacity=u,this.line.segments[0].point=f,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=r.multiply(-1),this.line.segments[1].handleOut=r,this.line.segments[2].point=g,this.arrow.scale(d/this.arrow_scale),this.arrow_scale=d,this.arrow.fillColor=s,this.arrow.opacity=w,this.arrow.rotate(p-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=p,p>90&&(p-=180,q=q.multiply(-1)),-90>p&&(p+=180,q=q.multiply(-1));var x=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";x=e.shortenText(x,this.options.node_label_max_length),this.text.text(x);var y=this.paper_coords.add(q);this.text.css({left:y.x,top:y.y,transform:"rotate("+p+"deg)","-moz-transform":"rotate("+p+"deg)","-webkit-transform":"rotate("+p+"deg)",opacity:u}),this.text_angle=p;var z=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(z)}),this.renderer.minimap&&(this.minimap_line.strokeColor=s,this.minimap_line.segments[0].point=this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get("position"))),this.minimap_line.segments[1].point=this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position"))))}},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("EdgeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.line.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()}),this.options.editor_mode||this.openEditor(),this._super("select")},unselect:function(a){a&&a.source_representation===this||(this.selected=!1,this.options.editor_mode&&this.all_buttons.forEach(function(a){a.hide()}),this.line.strokeWidth=this._getStrokeWidth(),this._super("unselect"))},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){!this.renkan.read_only&&this.renderer.is_dragging?(this.from_representation.saveCoords(),this.to_representation.saveCoords(),this.from_representation.is_dragging=!1,this.to_representation.is_dragging=!1):(b||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1},paperShift:function(a){this.options.editor_mode?this.options.read_only||(this.from_representation.paperShift(a),this.to_representation.paperShift(a)):this.renderer.paperShift(a)},destroy:function(){this._super("destroy"),this.line.remove(),this.arrow.remove(),this.text.remove(),this.renderer.minimap&&this.minimap_line.remove(),this.all_buttons.forEach(function(a){a.destroy()});var a=this;this.bundle.edges=b.reject(this.bundle.edges,function(b){return a===b})}}).value(),f}),define("renderer/tempedge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.edge_layer.activate(),this.type="Temp-edge";var a=(this.project.get("users").get(this.renkan.current_user)||e._USER_PLACEHOLDER(this.renkan)).get("color");this.line=new paper.Path,this.line.strokeColor=a,this.line.dashArray=[4,2],this.line.strokeWidth=this.options.selected_edge_stroke_width,this.line.add([0,0],[0,0]),this.line.__representation=this,this.arrow=new paper.Path,this.arrow.fillColor=a,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.arrow_angle=0},redraw:function(){var a=this.from_representation.paper_coords,b=this.end_pos,c=b.subtract(a).angle,d=a.add(b).divide(2);this.line.segments[0].point=a,this.line.segments[1].point=b,this.arrow.rotate(c-this.arrow_angle),this.arrow.position=d,this.arrow_angle=c},paperShift:function(a){if(!this.renderer.isEditable())return this.renderer.removeRepresentation(_this),void paper.view.draw();this.end_pos=this.end_pos.add(a);var b=paper.project.hitTest(this.end_pos);this.renderer.findTarget(b),this.redraw()},mouseup:function(a){var b=paper.project.hitTest(a.point),c=this.from_representation.model,d=!0;if(b&&"undefined"!=typeof b.item.__representation){var f=b.item.__representation;if("Node"===f.type.substr(0,4)){var g=f.model||f.source_representation.model;if(c!==g){var h={id:e.getUID("edge"),created_by:this.renkan.current_user,from:c,to:g};this.renderer.isEditable()&&this.project.addEdge(h)}}(c===f.model||f.source_representation&&f.source_representation.model===c)&&(d=!1,this.renderer.is_dragging=!0)}d&&(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentation(this),paper.view.draw())},destroy:function(){this.arrow.remove(),this.line.remove()}}).value(),f}),define("renderer/baseeditor",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.buttons_layer.activate(),this.type="editor",this.editor_block=new paper.Path;var c=b.map(b.range(8),function(){return[0,0]});this.editor_block.add.apply(this.editor_block,c),this.editor_block.strokeWidth=this.options.tooltip_border_width,this.editor_block.strokeColor=this.options.tooltip_border_color,this.editor_block.opacity=.8,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:.8}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/nodeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/nodeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("created_by")||f._USER_PLACEHOLDER(this.renkan),g=this.renderer.isEditable()?this.template:this.readOnlyTemplate,h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:f.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),image:c.get("image")||"",image_placeholder:h,color:c.has("style")&&c.get("style").color||d.get("color"),thickness:c.has("style")&&c.get("style").thickness||1,dash:c.has("style")&&c.get("style").dash?"checked":"",clip_path:c.get("clip_path")||!1,created_by_color:d.get("color"),created_by_title:d.get("title"),size:(i>0?"+":"")+i,shape:c.get("shape")||"circle"},renkan:this.renkan,options:this.options,shortenText:f.shortenText,shapes:b(e.builders).omit("svg").keys().value()})),this.redraw();var j=this,k=function(){j.editor_$.off("keyup"),j.editor_$.find("input, textarea, select").off("change keyup paste"),j.editor_$.find(".Rk-Edit-Image-File").off("change"),j.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off("hover"),j.editor_$.find(".Rk-Edit-Size-Btn").off("click"),j.editor_$.find(".Rk-Edit-Image-Del").off("click"),j.editor_$.find(".Rk-Edit-ColorPicker").find("li").off("hover click"),j.editor_$.find(".Rk-CloseX").off("click"),j.editor_$.find(".Rk-Edit-Goto").off("click"),j.renderer.removeRepresentation(j),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(k),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var l=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={title:j.editor_$.find(".Rk-Edit-Title").val()};if(j.options.show_node_editor_uri&&(a.uri=j.editor_$.find(".Rk-Edit-URI").val(),j.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#")),j.options.show_node_editor_image&&(a.image=j.editor_$.find(".Rk-Edit-Image").val(),j.editor_$.find(".Rk-Edit-ImgPreview").attr("src",a.image||h)),j.options.show_node_editor_description&&(a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_style){var d=j.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d})}j.options.change_shapes&&c.get("shape")!==j.editor_$.find(".Rk-Edit-Shape").val()&&(a.shape=j.editor_$.find(".Rk-Edit-Shape").val()),c.set(a),j.redraw()}else k()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&k()}),this.editor_$.find("input, textarea, select").on("change keyup paste",l),j.options.allow_image_upload&&this.editor_$.find(".Rk-Edit-Image-File").change(function(){if(this.files.length){var a=this.files[0],b=new FileReader;if("image"!==a.type.substr(0,5))return void alert(j.renkan.translate("This file is not an image"));if(a.size>1024*j.options.uploaded_image_max_kb)return void alert(j.renkan.translate("Image size must be under ")+j.options.uploaded_image_max_kb+j.renkan.translate("KB"));b.onload=function(a){j.editor_$.find(".Rk-Edit-Image").val(a.target.result),l()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var m=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),m.show()},function(a){a.preventDefault(),m.hide()}),m.find("li").hover(function(b){b.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||f._USER_PLACEHOLDER(j.renkan)).get("color"))}).click(function(d){d.preventDefault(),j.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),m.hide(),paper.view.draw()):k()});var n=function(a){if(j.renderer.isEditable()){var b=a+(c.get("size")||0);j.editor_$.find("#Rk-Edit-Size-Value").text((b>0?"+":"")+b),c.set("size",b),paper.view.draw()}else k()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return n(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return n(1),!1});var o=function(a){if(j.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>j.options.node_stroke_witdh_scale&&(e=j.options.node_stroke_witdh_scale),e!==d&&(j.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else k()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return o(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return o(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),l(),!1})}else if("object"==typeof this.source_representation.highlighted){var p=this.source_representation.highlighted.replace(b(c.get("title")).escape(),'<span class="Rk-Highlighted">$1</span>');this.editor_$.find(".Rk-Display-Title"+(c.get("uri")?" a":"")).html(p),this.options.show_node_tooltip_description&&this.editor_$.find(".Rk-Display-Description").html(this.source_representation.highlighted.replace(b(c.get("description")).escape(),'<span class="Rk-Highlighted">$1</span>'))}this.editor_$.find("img").load(function(){j.redraw()})},redraw:function(){var a=this.source_representation.paper_coords;f.drawEditBox(this.options,a,this.editor_block,.75*this.source_representation.circle_radius,this.editor_$),this.editor_$.show(),paper.view.draw()}}).value(),g}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/edgeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/edgeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("from"),f=c.get("to"),g=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),h=this.renderer.isEditable()?this.template:this.readOnlyTemplate;this.editor_$.html(h({edge:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),color:c.has("style")&&c.get("style").color||g.get("color"),dash:c.has("style")&&c.get("style").dash?"checked":"",arrow:c.has("style")&&c.get("style").arrow||!c.has("style")||"undefined"==typeof c.get("style").arrow?"checked":"",thickness:c.has("style")&&c.get("style").thickness||1,from_title:d.get("title"),to_title:f.get("title"),from_color:d.has("style")&&d.get("style").color||(d.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),to_color:f.has("style")&&f.get("style").color||(f.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),created_by_color:g.get("color"),created_by_title:g.get("title")},renkan:this.renkan,shortenText:e.shortenText,options:this.options})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),i.editor_$.find(".Rk-Edit-Size-Btn").off("click"),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b.throttle(function(){b.defer(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};if(i.options.show_edge_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val()),i.options.show_node_editor_style){var d=i.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d});var e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{arrow:e})}i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#"),c.set(a),paper.view.draw()}else j()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input").on("keyup change paste",k),this.editor_$.find(".Rk-Edit-Vocabulary").change(function(){var b=a(this),c=b.val();c&&(i.editor_$.find(".Rk-Edit-Title").val(b.find(":selected").text()),i.editor_$.find(".Rk-Edit-URI").val(c),k())}),this.editor_$.find(".Rk-Edit-Direction").click(function(){i.renderer.isEditable()?(c.set({from:c.get("to"),to:c.get("from")}),i.draw()):j()});var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(d){d.preventDefault(),i.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),l.hide(),paper.view.draw()):j()});var m=function(a){if(i.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>i.options.node_stroke_witdh_scale&&(e=i.options.node_stroke_witdh_scale),e!==d&&(i.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else j()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return m(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return m(1),!1})}},redraw:function(){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,5,this.editor_$),this.editor_$.show(),paper.view.draw()}}).value(),f}),define("renderer/nodebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({setSectorSize:function(){var a=this.source_representation.circle_radius;a!==this.lastSectorInner&&(this.sector&&this.sector.destroy(),this.sector=this.renderer.drawSector(this,1+a,e._NODE_BUTTON_WIDTH+a,this.startAngle,this.endAngle,1,this.imageName,this.renkan.translate(this.text)),this.lastSectorInner=a)},unselect:function(){d.prototype.unselect.apply(this,Array.prototype.slice.call(arguments,1)),this.source_representation&&this.source_representation.buttons_timeout&&(clearTimeout(this.source_representation.buttons_timeout),this.source_representation.hideButtons())},select:function(){this.source_representation&&this.source_representation.buttons_timeout&&clearTimeout(this.source_representation.buttons_timeout),this.sector.select()}}).value(),f}),define("renderer/nodeeditbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-edit-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=-45,this.imageName="edit",this.text="Edit"
-},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/noderemovebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-remove-button",this.lastSectorInner=0,this.startAngle=0,this.endAngle=90,this.imageName="remove",this.text="Remove"},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove node ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeNode(this.source_representation.model)}}).value(),f}),define("renderer/noderevertbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-revert-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=135,this.imageName="revert",this.text="Cancel deletion"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/nodelinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-link-button",this.lastSectorInner=0,this.startAngle=90,this.endAngle=180,this.imageName="link",this.text="Link to another node"},mousedown:function(a){if(this.renderer.isEditable()){var b=this.renderer.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,c)}}}).value(),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-enlarge-button",this.lastSectorInner=0,this.startAngle=-45,this.endAngle=0,this.imageName="enlarge",this.text="Enlarge"},mouseup:function(){var a=1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/nodeshrinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-shrink-button",this.lastSectorInner=0,this.startAngle=-180,this.endAngle=-135,this.imageName="shrink",this.text="Shrink"},mouseup:function(){var a=-1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/edgeeditbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-edit-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-270,-90,1,"edit",this.renkan.translate("Edit"))},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/edgeremovebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-remove-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-90,90,1,"remove",this.renkan.translate("Remove"))},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove edge ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeEdge(this.source_representation.model)}}).value(),f}),define("renderer/edgerevertbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-revert-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-135,135,1,"revert",this.renkan.translate("Cancel deletion"))},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/miniframe",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({paperShift:function(a){this.renderer.offset=this.renderer.offset.subtract(a.divide(this.renderer.minimap.scale).multiply(this.renderer.scale)),this.renderer.redraw()},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1}}).value(),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe"],function(a,b,c,d,e){var f=d.getUtils(),g=function(c){this.renkan=c,this.$=a(".Rk-Render"),this.representations=[],this.$.html(c.options.templates["templates/scene.html"](c)),this.onStatusChange(),this.canvas_$=this.$.find(".Rk-Canvas"),this.labels_$=this.$.find(".Rk-Labels"),this.editor_$=this.$.find(".Rk-Editor"),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.totalScroll=0,this.mouse_down=!1,this.click_target=null,this.selected_target=null,this.edge_layer=new paper.Layer,this.node_layer=new paper.Layer,this.buttons_layer=new paper.Layer,this.delete_list=[],this.redrawActive=!0,c.options.show_minimap&&(this.minimap={background_layer:new paper.Layer,edge_layer:new paper.Layer,node_layer:new paper.Layer,node_group:new paper.Group,size:new paper.Size(c.options.minimap_width,c.options.minimap_height)},this.minimap.background_layer.activate(),this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle=new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.rectangle.fillColor=c.options.minimap_background_color,this.minimap.rectangle.strokeColor=c.options.minimap_border_color,this.minimap.rectangle.strokeWidth=4,this.minimap.offset=new paper.Point(this.minimap.size.divide(2)),this.minimap.scale=.1,this.minimap.node_layer.activate(),this.minimap.cliprectangle=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.cliprectangle),this.minimap.node_group.clipped=!0,this.minimap.miniframe=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.miniframe),this.minimap.miniframe.fillColor="#c0c0ff",this.minimap.miniframe.opacity=.3,this.minimap.miniframe.strokeColor="#000080",this.minimap.miniframe.strokeWidth=2,this.minimap.miniframe.__representation=new e(this,null)),this.throttledPaperDraw=b(function(){paper.view.draw()}).throttle(100).value(),this.bundles=[],this.click_mode=!1;var d=this,g=!0,h=1,i=!1,j=0,k=0;this.image_cache={},this.icon_cache={},["edit","remove","link","enlarge","shrink","revert"].forEach(function(a){var b=new Image;b.src=c.options.static_url+"img/"+a+".png",d.icon_cache[a]=b});var l=b.throttle(function(a,b){d.onMouseMove(a,b)},f._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),l(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),g&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-_lastTap<f._DOUBLETAP_DELAY&&Math.pow(j-b.pageX,2)+Math.pow(k-b.pageY,2)<f._DOUBLETAP_DISTANCE?(_lastTap=0,d.onDoubleClick(b)):(_lastTap=new Date,j=b.pageX,k=b.pageY,h=d.scale,i=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),_lastTap=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(i||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,i=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*h,c=b/d.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.offset.multiply(c));d.setScale(b,e)}},touchend:function(a){a.preventDefault(),d.onMouseUp(a.originalEvent.changedTouches[0],!0)},dblclick:function(a){a.preventDefault(),c.options.allow_double_click&&d.onDoubleClick(a)},mouseleave:function(a){a.preventDefault(),d.onMouseUp(a,!1),d.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),g=!1},dragleave:function(a){a.preventDefault(),g=!0},drop:function(a){a.preventDefault(),g=!0;var c={};b.each(a.originalEvent.dataTransfer.types,function(b){try{c[b]=a.originalEvent.dataTransfer.getData(b)}catch(d){}});var e=a.originalEvent.dataTransfer.getData("Text");if("string"==typeof e)switch(e[0]){case"{":case"[":try{var f=JSON.parse(e);b.extend(c,f)}catch(h){c["text/plain"]||(c["text/plain"]=e)}break;case"<":c["text/html"]||(c["text/html"]=e);break;default:c["text/plain"]||(c["text/plain"]=e)}var i=a.originalEvent.dataTransfer.getData("URL");i&&!c["text/uri-list"]&&(c["text/uri-list"]=i),d.dropData(c,a.originalEvent)}});var m=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};m(".Rk-ZoomOut","zoomOut"),m(".Rk-ZoomIn","zoomIn"),m(".Rk-ZoomFit","autoScale"),this.$.find(".Rk-ZoomSave").click(function(){d.renkan.project.addView({zoom_level:d.scale,offset:d.offset})}),this.$.find(".Rk-ZoomSetSaved").click(function(){var a=d.renkan.project.get("views").last();a&&d.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show(),this.$.find(".Rk-CurrentUser").mouseenter(function(){d.$.find(".Rk-UserList").slideDown()}),this.$.find(".Rk-Users").mouseleave(function(){d.$.find(".Rk-UserList").slideUp()}),m(".Rk-FullScreen-Button","fullScreen"),m(".Rk-AddNode-Button","addNodeBtn"),m(".Rk-AddEdge-Button","addEdgeBtn"),m(".Rk-Save-Button","save"),m(".Rk-Open-Button","open"),m(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+f._BOOKMARKLET_CODE(c)).click(function(){return d.notif_$.text(c.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.")).fadeIn().delay(5e3).fadeOut(),!1}),this.$.find(".Rk-TopBar-Button").mouseover(function(){a(this).find(".Rk-TopBar-Tooltip").show()}).mouseout(function(){a(this).find(".Rk-TopBar-Tooltip").hide()}),m(".Rk-Fold-Bins","foldBins"),paper.view.onResize=function(a){var b,c=a.width,e=a.height;d.minimap&&(d.minimap.topleft=paper.view.bounds.bottomRight.subtract(d.minimap.size),d.minimap.rectangle.fitBounds(d.minimap.topleft.subtract([2,2]),d.minimap.size.add([4,4])),d.minimap.cliprectangle.fitBounds(d.minimap.topleft,d.minimap.size));var f=e/(e-a.delta.height),g=c/(c-a.delta.width);b=c>e?f:g,d.resizeZoom(g,f,b),d.redraw()};var n=b.throttle(function(){d.redraw()},50);this.addRepresentations("Node",this.renkan.project.get("nodes")),this.addRepresentations("Edge",this.renkan.project.get("edges")),this.renkan.project.on("change:title",function(){d.$.find(".Rk-PadTitle").val(c.project.get("title"))}),this.$.find(".Rk-PadTitle").on("keyup input paste",function(){c.project.set({title:a(this).val()})});var o=b.throttle(function(){d.redrawUsers()},100);if(o(),this.renkan.project.on("change:saveStatus",function(){switch(d.renkan.project.get("saveStatus")){case 0:d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("saved");break;case 1:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("to-save");break;case 2:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").addClass("saving")}}),this.renkan.project.on("change:loadingStatus",function(){if(d.renkan.project.get("loadingStatus")){d.$.find(".loader").addClass("run"),setTimeout(function(){d.$.find(".loader").hide(250)},3e3)}}),this.renkan.project.on("add:users remove:users",o),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>0?d.$.find(".Rk-ZoomSetSaved").show():d.$.find(".Rk-ZoomSetSaved").hide()}),this.renkan.project.on("add:nodes",function(a){d.addRepresentation("Node",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("change:title",function(a,b){var c=d.$.find(".Rk-PadTitle");c.is("input")?c.val()!==b&&c.val(b):c.text(b)}),c.options.size_bug_fix){var p="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},p)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var q=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),r=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");q.hover(function(a){d.isEditable()&&(a.preventDefault(),r.show())},function(a){a.preventDefault(),r.hide()}),r.find("li").mouseenter(function(b){d.isEditable()&&(b.preventDefault(),d.$.find(".Rk-CurrentUser-Color").css("background",a(this).attr("data-color")))})}if(c.options.show_search_field){var s="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==s)if(s=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var g=f.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){g.test(a.get("title"))||g.test(a.get("description"))?d.getRepresentationByModel(a).highlight(g):d.getRepresentationByModel(a).unhighlight()})}})}this.redraw(),window.setInterval(function(){var a=(new Date).valueOf();d.delete_list.forEach(function(b){if(a>=b.time){var d=c.project.get("nodes").findWhere({delete_scheduled:b.id});d&&project.removeNode(d),d=c.project.get("edges").findWhere({delete_scheduled:b.id}),d&&project.removeEdge(d)}}),d.delete_list=d.delete_list.filter(function(a){return c.project.get("nodes").findWhere({delete_scheduled:a.id})||c.project.get("edges").findWhere({delete_scheduled:a.id})})},500),this.minimap&&window.setInterval(function(){d.rescaleMinimap()},2e3)};return b(g.prototype).extend({fixSize:function(){if(this.renkan.options.default_view&&this.renkan.project.get("views").length>0){var a=this.renkan.project.get("views").last();this.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}else this.autoScale()},drawSector:function(b,c,d,e,f,g,h,i){var j=this.renkan.options,k=e*Math.PI/180,l=f*Math.PI/180,m=this.icon_cache[h],n=-Math.sin(k),o=Math.cos(k),p=Math.cos(k)*c+g*n,q=Math.sin(k)*c+g*o,r=Math.cos(k)*d+g*n,s=Math.sin(k)*d+g*o,t=-Math.sin(l),u=Math.cos(l),v=Math.cos(l)*c-g*t,w=Math.sin(l)*c-g*u,x=Math.cos(l)*d-g*t,y=Math.sin(l)*d-g*u,z=(c+d)/2,A=(k+l)/2,B=Math.cos(A)*z,C=Math.sin(A)*z,D=Math.cos(A)*c,E=Math.cos(A)*d,F=Math.sin(A)*c,G=Math.sin(A)*d,H=Math.cos(A)*(d+3),I=Math.sin(A)*(d+j.buttons_label_font_size)+j.buttons_label_font_size/2;this.buttons_layer.activate();var J=new paper.Path;J.add([p,q]),J.arcTo([D,F],[v,w]),J.lineTo([x,y]),J.arcTo([E,G],[r,s]),J.fillColor=j.buttons_background,J.opacity=.5,J.closed=!0,J.__representation=b;var K=new paper.PointText(H,I);K.characterStyle={fontSize:j.buttons_label_font_size,fillColor:j.buttons_label_color},K.paragraphStyle.justification=H>2?"left":-2>H?"right":"center",K.visible=!1;var L=!1,M=new paper.Point(-200,-200),N=new paper.Group([J,K]),O=N.position,P=new paper.Point([B,C]),Q=new paper.Point(0,0);K.content=i,N.pivot=N.bounds.center,N.visible=!1,N.position=M;var R={show:function(){L=!0,N.position=Q.add(O),N.visible=!0},moveTo:function(a){Q=a,L&&(N.position=a.add(O))},hide:function(){L=!1,N.visible=!1,N.position=M},select:function(){J.opacity=.8,K.visible=!0},unselect:function(){J.opacity=.5,K.visible=!1},destroy:function(){N.remove()}},S=function(){var a=new paper.Raster(m);a.position=P.add(N.position).subtract(O),a.locked=!0,N.addChild(a)};return m.width?S():a(m).on("load",S),R},addToBundles:function(a){var c=b(this.bundles).find(function(b){return b.from===a.from_representation&&b.to===a.to_representation||b.from===a.to_representation&&b.to===a.from_representation});return"undefined"!=typeof c?c.edges.push(a):(c={from:a.from_representation,to:a.to_representation,edges:[a],getPosition:function(a){var c=a.from_representation===this.from?1:-1;return c*(b(this.edges).indexOf(a)-(this.edges.length-1)/2)}},this.bundles.push(c)),c},isEditable:function(){return this.renkan.options.editor_mode&&!this.renkan.read_only},onStatusChange:function(){var a=this.$.find(".Rk-Save-Button"),b=a.find(".Rk-TopBar-Tooltip-Contents");this.renkan.read_only?(a.removeClass("disabled Rk-Save-Online").addClass("Rk-Save-ReadOnly"),b.text(this.renkan.translate("Connection lost"))):this.renkan.options.manual_save?(a.removeClass("Rk-Save-ReadOnly Rk-Save-Online"),b.text(this.renkan.translate("Save Project"))):(a.removeClass("disabled Rk-Save-ReadOnly").addClass("Rk-Save-Online"),b.text(this.renkan.translate("Auto-save enabled"))),this.redrawUsers()},setScale:function(a,b){a/this.initialScale>f._MIN_SCALE&&a/this.initialScale<f._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.redraw())},autoScale:function(a){var b=this.renkan.project.get("nodes");if(b.length>1){var c=b.map(function(a){return a.get("position").x}),d=b.map(function(a){return a.get("position").y}),e=Math.min.apply(Math,c),f=Math.min.apply(Math,d),g=Math.max.apply(Math,c),h=Math.max.apply(Math,d),i=Math.min((paper.view.size.width-2*this.renkan.options.autoscale_padding)/(g-e),(paper.view.size.height-2*this.renkan.options.autoscale_padding)/(h-f));this.initialScale=i,"undefined"!=typeof a&&parseFloat(a.zoom_level)>0&&parseFloat(a.offset.x)>0&&parseFloat(a.offset.y)>0?this.setScale(parseFloat(a.zoom_level),new paper.Point(parseFloat(a.offset.x),parseFloat(a.offset.y))):this.setScale(i,paper.view.center.subtract(new paper.Point([(g+e)/2,(h+f)/2]).multiply(i)))}1===b.length&&this.setScale(1,paper.view.center.subtract(new paper.Point([b.at(0).get("position").x,b.at(0).get("position").y])))},redrawMiniframe:function(){var a=this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),b=this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));this.minimap.miniframe.fitBounds(a,b)},rescaleMinimap:function(){var a=this.renkan.project.get("nodes");if(a.length>1){var b=a.map(function(a){return a.get("position").x}),c=a.map(function(a){return a.get("position").y}),d=Math.min.apply(Math,b),e=Math.min.apply(Math,c),f=Math.max.apply(Math,b),g=Math.max.apply(Math,c),h=Math.min(.8*this.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.scale*this.renkan.options.minimap_height/paper.view.bounds.height,(this.renkan.options.minimap_width-2*this.renkan.options.minimap_padding)/(f-d),(this.renkan.options.minimap_height-2*this.renkan.options.minimap_padding)/(g-e));this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([(f+d)/2,(g+e)/2]).multiply(h)),this.minimap.scale=h}1===a.length&&(this.minimap.scale=.1,this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([a.at(0).get("position").x,a.at(0).get("position").y]).multiply(this.minimap.scale))),this.redraw()},toPaperCoords:function(a){return a.multiply(this.scale).add(this.offset)},toMinimapCoords:function(a){return a.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft)},toModelCoords:function(a){return a.subtract(this.offset).divide(this.scale)},addRepresentation:function(a,b){var c=d.getRenderer()[a],e=new c(this,b);return this.representations.push(e),e},addRepresentations:function(a,b){var c=this;b.forEach(function(b){c.addRepresentation(a,b)})},userTemplate:b.template('<li class="Rk-User"><span class="Rk-UserColor" style="background:<%=background%>;"></span><%=name%></li>'),redrawUsers:function(){if(this.renkan.options.show_user_list){var b=[].concat((this.renkan.project.current_user_list||{}).models||[],(this.renkan.project.get("users")||{}).models||[]),c="",d=this.$.find(".Rk-Users"),e=d.find(".Rk-CurrentUser-Name"),f=d.find(".Rk-Edit-ColorPicker li"),g=d.find(".Rk-CurrentUser-Color"),h=this;e.off("click").text(this.renkan.translate("<unknown user>")),f.off("mouseleave click"),b.forEach(function(b){b.get("_id")===h.renkan.current_user?(e.text(b.get("title")),g.css("background",b.get("color")),h.isEditable()&&(h.renkan.options.user_name_editable&&e.click(function(){var c=a(this),d=a("<input>").val(b.get("title")).blur(function(){b.set("title",a(this).val()),h.redrawUsers(),h.redraw()});c.empty().html(d),d.select()}),h.renkan.options.user_color_editable&&f.click(function(c){c.preventDefault(),h.isEditable()&&b.set("color",a(this).attr("data-color")),a(this).parent().hide()}).mouseleave(function(){g.css("background",b.get("color"))}))):c+=h.userTemplate({name:b.get("title"),background:b.get("color")})}),d.find(".Rk-UserList").html(c)}},removeRepresentation:function(a){a.destroy(),this.representations=b.reject(this.representations,function(b){return b===a})},getRepresentationByModel:function(a){return a?b.find(this.representations,function(b){return b.model===a}):void 0},removeRepresentationsOfType:function(a){var c=b.filter(this.representations,function(b){return b.type===a}),d=this;b.each(c,function(a){d.removeRepresentation(a)})},highlightModel:function(a){var b=this.getRepresentationByModel(a);b&&b.highlight()},unhighlightAll:function(){b.each(this.representations,function(a){a.unhighlight()})},unselectAll:function(){b.each(this.representations,function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b.each(this.representations,function(a){a.redraw({dontRedrawEdges:!0})}),this.minimap&&this.redrawMiniframe(),paper.view.draw())},addTempEdge:function(a,b){var c=this.addRepresentation("TempEdge",null);c.end_pos=b,c.from_representation=a,c.redraw(),this.click_target=c},findTarget:function(a){if(a&&"undefined"!=typeof a.item.__representation){var b=a.item.__representation;this.selected_target!==a.item.__representation&&(this.selected_target&&this.selected_target.unselect(b),b.select(this.selected_target),this.selected_target=b)}else this.selected_target&&this.selected_target.unselect(),this.selected_target=null},paperShift:function(a){this.offset=this.offset.add(a),this.redraw()},onMouseMove:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=c.subtract(this.last_point);this.last_point=c,!this.is_dragging&&this.mouse_down&&d.length>f._MIN_DRAG_DISTANCE&&(this.is_dragging=!0);var e=paper.project.hitTest(c);this.is_dragging?this.click_target&&"function"==typeof this.click_target.paperShift?this.click_target.paperShift(d):this.paperShift(d):this.findTarget(e),paper.view.draw()},onMouseDown:function(b,c){var d=this.canvas_$.offset(),e=new paper.Point([b.pageX-d.left,b.pageY-d.top]);if(this.last_point=e,this.mouse_down=!0,!this.click_target||"Temp-edge"!==this.click_target.type){this.removeRepresentationsOfType("editor"),this.is_dragging=!1;var g=paper.project.hitTest(e);if(g&&"undefined"!=typeof g.item.__representation)this.click_target=g.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===f._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}};_node=this.renkan.project.addNode(i),this.getRepresentationByModel(_node).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===f._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=f._CLICKMODE_ENDEDGE,this.notif_$.fadeOut(function(){a(this).html(this.renkan.translate("Click on a second node to complete the edge")).fadeIn()})):(this.notif_$.hide(),this.click_mode=!1)),paper.view.draw()},onMouseUp:function(a,b){if(this.mouse_down=!1,this.click_target){var c=this.canvas_$.offset();this.click_target.mouseup({point:new paper.Point([a.pageX-c.left,a.pageY-c.top])},b)}else this.click_target=null,this.is_dragging=!1,b&&this.unselectAll();paper.view.draw()},onScroll:function(a,b){if(this.totalScroll+=b,Math.abs(this.totalScroll)>=1){var c=this.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]).subtract(this.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.setScale(this.scale*Math.SQRT2,this.offset.subtract(d)):this.setScale(this.scale*Math.SQRT1_2,this.offset.add(d.divide(Math.SQRT2))),this.totalScroll=0}},onDoubleClick:function(a){if(this.isEditable()){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=paper.project.hitTest(c);if(this.isEditable()&&(!d||"undefined"==typeof d.item.__representation)){var e=this.toModelCoords(c),g={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(g);this.getRepresentationByModel(h).openEditor()}paper.view.draw()}},defaultDropHandler:function(b){var c={},d="";switch(b["text/x-iri-specific-site"]){case"twitter":d=a("<div>").html(b["text/x-iri-selected-html"]);var e=d.find(".tweet");c.title=this.renkan.translate("Tweet by ")+e.attr("data-name"),c.uri="http://twitter.com/"+e.attr("data-screen-name")+"/status/"+e.attr("data-tweet-id"),c.image=e.find(".avatar").attr("src"),c.description=e.find(".js-tweet-text:first").text();break;case"google":d=a("<div>").html(b["text/x-iri-selected-html"]),c.title=d.find("h3:first").text().trim(),c.uri=d.find("h3 a").attr("href"),c.description=d.find(".st:first").text().trim();break;default:b["text/x-iri-source-uri"]&&(c.uri=b["text/x-iri-source-uri"])}if((b["text/plain"]||b["text/x-iri-selected-text"])&&(c.description=(b["text/plain"]||b["text/x-iri-selected-text"]).replace(/[\s\n]+/gm," ").trim()),b["text/html"]||b["text/x-iri-selected-html"]){d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]);var f=d.find("image");f.length&&(c.image=f.attr("xlink:href"));var g=d.find("path");g.length&&(c.clipPath=g.attr("d"));var h=d.find("img");h.length&&(c.image=h[0].src);var i=d.find("a");i.length&&(c.uri=i[0].href),c.title=d.find("[title]").attr("title")||c.title,c.description=d.text().replace(/[\s\n]+/gm," ").trim()}b["text/uri-list"]&&(c.uri=b["text/uri-list"]),b["text/x-moz-url"]&&!c.title&&(c.title=(b["text/x-moz-url"].split("\n")[1]||"").trim(),c.title===c.uri&&(c.title=!1)),b["text/x-iri-source-title"]&&!c.title&&(c.title=b["text/x-iri-source-title"]),(b["text/html"]||b["text/x-iri-selected-html"])&&(d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]),c.image=d.find("[data-image]").attr("data-image")||c.image,c.uri=d.find("[data-uri]").attr("data-uri")||c.uri,c.title=d.find("[data-title]").attr("data-title")||c.title,c.description=d.find("[data-description]").attr("data-description")||c.description,c.clipPath=d.find("[data-clip-path]").attr("data-clip-path")||c.clipPath),c.title||(c.title=this.renkan.translate("Dragged resource"));for(var j=["title","description","uri","image"],k=0;k<j.length;k++){var l=j[k];(b["text/x-iri-"+l]||b[l])&&(c[l]=b["text/x-iri-"+l]||b[l]),("none"===c[l]||"null"===c[l])&&(c[l]=void 0)}return"function"==typeof this.renkan.options.drop_enhancer&&(c=this.renkan.options.drop_enhancer(c,b)),c},dropData:function(a,c){if(this.isEditable()){if(a["text/json"]||a["application/json"])try{var d=JSON.parse(a["text/json"]||a["application/json"]);b.extend(a,d)}catch(e){}var g="undefined"==typeof this.renkan.options.drop_handler?this.defaultDropHandler(a):this.renkan.options.drop_handler(a),h=this.canvas_$.offset(),i=new paper.Point([c.pageX-h.left,c.pageY-h.top]),j=this.toModelCoords(i),k={id:f.getUID("node"),created_by:this.renkan.current_user,uri:g.uri||"",title:g.title||"",description:g.description||"",image:g.image||"",color:g.color||void 0,clip_path:g.clipPath||void 0,position:{x:j.x,y:j.y}},l=this.renkan.project.addNode(k),m=this.getRepresentationByModel(l);"drop"===c.type&&m.openEditor()}},fullScreen:function(){var a,b=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen,c=this.renkan.$[0],d=["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],e=["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"];if(b){for(a=0;a<e.length;a++)if("function"==typeof document[e[a]]){document[e[a]]();break}var f=this.$.width(),g=this.$.height();this.renkan.options.show_top_bar&&(g-=this.$.find(".Rk-TopBar").height()),this.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(f-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([f,g])}else{for(a=0;a<d.length;a++)if("function"==typeof c[d[a]]){c[d[a]]();break}this.redraw()}},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT1_2)).add(this.offset.multiply(Math.SQRT1_2));this.setScale(a,b)},zoomIn:function(){var a=this.scale*Math.SQRT2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT2)).add(this.offset.multiply(Math.SQRT2));this.setScale(a,b)},resizeZoom:function(a,b,c){var d=this.scale*c,e=new paper.Point([this.offset.x*a,this.offset.y*b]);this.setScale(d,e)},addNodeBtn:function(){return this.click_mode===f._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_ADDNODE,this.notif_$.text(this.renkan.translate("Click on the background canvas to add a node")).fadeIn()),!1},addEdgeBtn:function(){return this.click_mode===f._CLICKMODE_STARTEDGE||this.click_mode===f._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_STARTEDGE,this.notif_$.text(this.renkan.translate("Click on a first node to start the edge")).fadeIn()),!1},exportProject:function(){var a=this.renkan.project.toJSON(),d=(document.createElement("a"),a.id),e=d+".json";delete a.id,delete a._id,delete a.space_id;var g,h={};b.each(a.nodes,function(a){g=a.id||a._id,delete a._id,delete a.id,h[g]=a["@id"]=f.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=h[a.to],a.from=h[a.from]}),b.each(a.views,function(a){g=a.id||a._id,delete a._id,delete a.id}),a.users=[];var i=JSON.stringify(a,null,2),j=new Blob([i],{type:"application/json;charset=utf-8"});c(j,e)},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=this,e=d.canvas_$.width();c.position().left<0?(c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e-c.width()<c.height()?e:e-c.width(),b.html("«")):(c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])
-}),a=e+300,b.html("»")),d.resizeZoom(1,1,a/e)},save:function(){},open:function(){}}).value(),g}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils"}}),require(["renderer/baserepresentation","renderer/basebutton","renderer/noderepr","renderer/edge","renderer/tempedge","renderer/baseeditor","renderer/nodeeditor","renderer/edgeeditor","renderer/nodebutton","renderer/nodeeditbutton","renderer/noderemovebutton","renderer/noderevertbutton","renderer/nodelinkbutton","renderer/nodeenlargebutton","renderer/nodeshrinkbutton","renderer/edgeeditbutton","renderer/edgeremovebutton","renderer/edgerevertbutton","renderer/miniframe","renderer/scene"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t){var u=window.Rkns;"undefined"==typeof u.Renderer&&(u.Renderer={});var v=u.Renderer;v._BaseRepresentation=a,v._BaseButton=b,v.Node=c,v.Edge=d,v.TempEdge=e,v._BaseEditor=f,v.NodeEditor=g,v.EdgeEditor=h,v._NodeButton=i,v.NodeEditButton=j,v.NodeRemoveButton=k,v.NodeRevertButton=l,v.NodeLinkButton=m,v.NodeEnlargeButton=n,v.NodeShrinkButton=o,v.EdgeEditButton=p,v.EdgeRemoveButton=q,v.EdgeRevertButton=r,v.MiniFrame=s,v.Scene=t,startRenkan()}),define("main-renderer",function(){});
+this.renkanJST=this.renkanJST||{},this.renkanJST["templates/colorpicker.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li data-color="'+(null==(__t=c)?"":__t)+'" style="background: '+(null==(__t=c)?"":__t)+'"></li>';return __p},this.renkanJST["templates/edgeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Edge"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(edge.title)+'" />\n</p>\n',options.show_edge_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(edge.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(edge.uri)+'" target="_blank"></a>\n </p>\n ',options.properties.length&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose from vocabulary:"))+'</label>\n <select class="Rk-Edit-Vocabulary">\n ',_.each(options.properties,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Class" value="">\n '+__e(renkan.translate(a.label))+"\n </option>\n ",_.each(a.properties,function(b){var c=a["base-uri"]+b.uri;__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(c)+'"\n ',c===edge.uri&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(b.label))+"\n </option>\n "}),__p+="\n "}),__p+="\n </select>\n </p>\n")),__p+="\n",options.show_edge_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_edge_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Edge color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: <%-edge.color%>;">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_edge_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(edge.dash)+" />\n </div>\n "),__p+="\n ",options.show_edge_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(edge.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n ",options.show_edge_editor_style_arrow&&(__p+='\n <div id="Rk-Editor-p-arrow">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Arrow:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Arrow" class="Rk-Edit-Arrow" '+__e(edge.arrow)+" />\n </div>\n "),__p+="\n </div>\n"),__p+="\n",options.show_edge_editor_direction&&(__p+='\n <p>\n <span class="Rk-Edit-Direction">'+__e(renkan.translate("Change edge direction"))+"</span>\n </p>\n"),__p+="\n",options.show_edge_editor_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: >%-edge.to_color%>;"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_editor_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: <%-edge.created_by_color%>;"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/edgeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_edge_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(edge.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',edge.uri&&(__p+='\n <a href="'+__e(edge.uri)+'" target="_blank">\n '),__p+="\n "+__e(edge.title)+"\n ",edge.uri&&(__p+=" </a> "),__p+="\n </span>\n</h2>\n",options.show_edge_tooltip_uri&&edge.uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(edge.uri)+'" target="_blank">'+__e(edge.short_uri)+"</a>\n </p>\n"),__p+="\n<p>"+__e(edge.description)+"</p>\n",options.show_edge_tooltip_nodes&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("From:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.from_color)+';"></span>\n '+__e(shortenText(edge.from_title,25))+'\n </p>\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("To:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.to_color)+';"></span>\n '+__e(shortenText(edge.to_title,25))+"\n </p>\n"),__p+="\n",options.show_edge_tooltip_creator&&edge.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(edge.created_by_color)+';"></span>\n '+__e(shortenText(edge.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/ldtjson-bin/annotationtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/segmenttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/player/"+(null==(__t=mediaid)?"":__t)+"/#id="+(null==(__t=annotationid)?"":__t)+'"\n data-title="'+__e(title)+'" data-description="'+__e(description)+'">\n\n <img class="Rk-Ldt-Annotation-Icon" src="'+(null==(__t=image)?"":__t)+'" />\n <h4>'+(null==(__t=htitle)?"":__t)+"</h4>\n <p>"+(null==(__t=hdescription)?"":__t)+"</p>\n <p>Start: "+(null==(__t=start)?"":__t)+", End: "+(null==(__t=end)?"":__t)+", Duration: "+(null==(__t=duration)?"":__t)+'</p>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/ldtjson-bin/tagtemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Bin-Item" draggable="true"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/ldt-tag.png"))+'"\n data-uri="'+(null==(__t=ldt_platform)?"":__t)+"ldtplatform/ldt/front/search/?search="+(null==(__t=encodedtitle)?"":__t)+'&field=all"\n data-title="'+__e(title)+'" data-description="Tag \''+__e(title)+'\'">\n\n <img class="Rk-Ldt-Tag-Icon" src="'+__e(static_url)+'img/ldt-tag.png" />\n <h4>'+(null==(__t=htitle)?"":__t)+'</h4>\n <div class="Rk-Clear"></div>\n</li>\n';return __p},this.renkanJST["templates/list-bin.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="'+__e(title)+'"\n data-description="'+__e(description)+'"\n ',__p+=image?'\n data-image="'+__e(Rkns.Utils.getFullURL(image))+'"\n ':'\n data-image=""\n ',__p+="\n>",image&&(__p+='\n <img class="Rk-ResourceList-Image" src="'+__e(image)+'" />\n'),__p+='\n<h4 class="Rk-ResourceList-Title">\n ',url&&(__p+='\n <a href="'+__e(url)+'" target="_blank">\n '),__p+="\n "+(null==(__t=htitle)?"":__t)+"\n ",url&&(__p+="</a>"),__p+="\n </h4>\n ",description&&(__p+='\n <p class="Rk-ResourceList-Description">'+(null==(__t=hdescription)?"":__t)+"</p>\n "),__p+="\n ",image&&(__p+='\n <div style="clear: both;"></div>\n '),__p+="\n</li>\n";return __p},this.renkanJST["templates/main.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)options.show_bins&&(__p+='\n <div class="Rk-Bins">\n <div class="Rk-Bins-Head">\n <h2 class="Rk-Bins-Title">'+__e(translate("Select contents:"))+'</h2>\n <form class="Rk-Web-Search-Form Rk-Search-Form">\n <input class="Rk-Web-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search the Web"))+'" />\n <div class="Rk-Search-Select">\n <div class="Rk-Search-Current"></div>\n <ul class="Rk-Search-List"></ul>\n </div>\n <input type="submit" value=""\n class="Rk-Web-Search-Submit Rk-Search-Submit" title="'+__e(translate("Search the Web"))+'" />\n </form>\n <form class="Rk-Bins-Search-Form Rk-Search-Form">\n <input class="Rk-Bins-Search-Input Rk-Search-Input" type="search"\n placeholder="'+__e(translate("Search in Bins"))+'" /> <input\n type="submit" value=""\n class="Rk-Bins-Search-Submit Rk-Search-Submit"\n title="'+__e(translate("Search in Bins"))+'" />\n </form>\n </div>\n <ul class="Rk-Bin-List"></ul>\n </div>\n'),__p+=" ",options.show_editor&&(__p+='\n <div class="Rk-Render Rk-Render-',__p+=options.show_bins?"Panel":"Full",__p+='"></div>\n'),__p+="\n";return __p},this.renkanJST["templates/nodeeditor.html"]=function(obj){obj||(obj={});{var __t,__p="",__e=_.escape;Array.prototype.join}with(obj)__p+='\n<h2>\n <span class="Rk-CloseX">×</span>'+__e(renkan.translate("Edit Node"))+"</span>\n</h2>\n<p>\n <label>"+__e(renkan.translate("Title:"))+'</label>\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n</p>\n',options.show_node_editor_uri&&(__p+="\n <p>\n <label>"+__e(renkan.translate("URI:"))+'</label>\n <input class="Rk-Edit-URI" type="text" value="'+__e(node.uri)+'" />\n <a class="Rk-Edit-Goto" href="'+__e(node.uri)+'" target="_blank"></a>\n </p>\n'),__p+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+'</label>\n <textarea class="Rk-Edit-Description">'+__e(node.description)+"</textarea>\n </p>\n"),__p+=" ",options.show_node_editor_size&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Size:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Size-Value">'+__e(node.size)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Size-Up">+</a>\n </p>\n'),__p+=" ",options.show_node_editor_style&&(__p+='\n <div class="Rk-Editor-p">\n ',options.show_node_editor_style_color&&(__p+='\n <div id="Rk-Editor-p-color">\n <span class="Rk-Editor-Label">\n '+__e(renkan.translate("Node color:"))+'</span>\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-Edit-Color" style="background: '+__e(node.color)+';">\n <span class="Rk-Edit-ColorTip"></span>\n </span>\n '+(null==(__t=renkan.colorPicker)?"":__t)+'\n <span class="Rk-Edit-ColorPicker-Text">'+__e(renkan.translate("Choose color"))+"</span>\n </div>\n </div>\n "),__p+="\n ",options.show_node_editor_style_dash&&(__p+='\n <div id="Rk-Editor-p-dash">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Dash:"))+'</span>\n <input type="checkbox" name="Rk-Edit-Dash" class="Rk-Edit-Dash" '+__e(node.dash)+" />\n </div>\n "),__p+="\n ",options.show_node_editor_style_thickness&&(__p+='\n <div id="Rk-Editor-p-thickness">\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Thickness:"))+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Down">-</a>\n <span class="Rk-Edit-Size-Disp" id="Rk-Edit-Thickness-Value">'+__e(node.thickness)+'</span>\n <a href="#" class="Rk-Edit-Size-Btn" id="Rk-Edit-Thickness-Up">+</a>\n </div>\n '),__p+="\n </div>\n"),__p+=" ",options.show_node_editor_image&&(__p+='\n <div class="Rk-Edit-ImgWrap">\n <div class="Rk-Edit-ImgPreview">\n <img src="'+__e(node.image||node.image_placeholder)+'" />\n ',node.clip_path&&(__p+='\n <svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none">\n <path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="'+__e(node.clip_path)+'" />\n </svg>\n '),__p+="\n </div>\n </div>\n <p>\n <label>"+__e(renkan.translate("Image URL:"))+'</label>\n <div>\n <a class="Rk-Edit-Image-Del" href="#"></a>\n <input class="Rk-Edit-Image" type="text" value=\''+__e(node.image)+"' />\n </div>\n </p>\n",options.allow_image_upload&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Choose Image File:"))+'</label>\n <input class="Rk-Edit-Image-File" type="file" accept="image/*" />\n </p>\n')),__p+=" ",options.show_node_editor_creator&&node.has_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+=" ",options.change_shapes&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Shapes available"))+':</label>\n <select class="Rk-Edit-Shape">\n ',_.each(shapes,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.shape===a&&(__p+=" selected"),__p+=">\n "+__e(renkan.translate(a.charAt(0).toUpperCase()+a.substring(1)))+"\n </option>\n "}),__p+="\n </select>\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/nodeeditor_readonly.html"]=function(obj){obj||(obj={});{var __p="",__e=_.escape;Array.prototype.join}with(obj)__p+='<h2>\n <span class="Rk-CloseX">×</span>\n ',options.show_node_tooltip_color&&(__p+='\n <span class="Rk-UserColor" style="background: '+__e(node.color)+';"></span>\n '),__p+='\n <span class="Rk-Display-Title">\n ',node.uri&&(__p+='\n <a href="'+__e(node.uri)+'" target="_blank">\n '),__p+="\n "+__e(node.title)+"\n ",node.uri&&(__p+="</a>"),__p+="\n </span>\n</h2>\n",node.uri&&options.show_node_tooltip_uri&&(__p+='\n <p class="Rk-Display-URI">\n <a href="'+__e(node.uri)+'" target="_blank">'+__e(node.short_uri)+"</a>\n </p>\n"),__p+=" ",options.show_node_tooltip_description&&(__p+='\n <p class="Rk-Display-Description">'+__e(node.description)+"</p>\n"),__p+=" ",node.image&&options.show_node_tooltip_image&&(__p+='\n <img class="Rk-Display-ImgPreview" src="'+__e(node.image)+'" />\n'),__p+=" ",node.has_creator&&options.show_node_tooltip_creator&&(__p+='\n <p>\n <span class="Rk-Editor-Label">'+__e(renkan.translate("Created by:"))+'</span>\n <span class="Rk-UserColor" style="background: '+__e(node.created_by_color)+';"></span>\n '+__e(shortenText(node.created_by_title,25))+"\n </p>\n"),__p+="\n";return __p},this.renkanJST["templates/scene.html"]=function(obj){function print(){__p+=__j.call(arguments,"")}obj||(obj={});var __p="",__e=_.escape,__j=Array.prototype.join;with(obj)options.show_top_bar&&(__p+='\n <div class="Rk-TopBar">\n <div class="loader"></div>\n ',__p+=options.editor_mode?'\n <input type="text" class="Rk-PadTitle" value="'+__e(project.get("title")||"")+'" placeholder="'+__e(translate("Untitled project"))+'" />\n ':'\n <h2 class="Rk-PadTitle">\n '+__e(project.get("title")||translate("Untitled project"))+"\n </h2>\n ",__p+="\n ",options.show_user_list&&(__p+='\n <div class="Rk-Users">\n <div class="Rk-CurrentUser">\n ',options.show_user_color&&(__p+='\n <div class="Rk-Edit-ColorPicker-Wrapper">\n <span class="Rk-CurrentUser-Color">\n ',options.user_color_editable&&(__p+='\n <span class="Rk-Edit-ColorTip"></span>\n '),__p+="\n </span>\n ",options.user_color_editable&&print(colorPicker),__p+="\n </div>\n "),__p+='\n <span class="Rk-CurrentUser-Name"><unknown user></span>\n </div>\n <ul class="Rk-UserList"></ul>\n </div>\n '),__p+="\n ",options.home_button_url&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Home-Button" href="'+__e(options.home_button_url)+'">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate(options.home_button_title))+"\n </div>\n </div>\n </a>\n "),__p+="\n ",options.show_fullscreen_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-FullScreen-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Full Screen"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.editor_mode?(__p+="\n ",options.show_addnode_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddNode-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Node"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_addedge_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-AddEdge-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Add Edge"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_save_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Save-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents"></div>\n </div>\n </div>\n '),__p+="\n ",options.show_open_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Open-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Open Project"))+"\n </div>\n </div>\n </div>\n "),__p+="\n ",options.show_bookmarklet&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Renkan 'Drag-to-Add' bookmarklet"))+'\n </div>\n </div>\n </a>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "):(__p+="\n ",options.show_export_button&&(__p+='\n <div class="Rk-TopBar-Separator"></div>\n <div class="Rk-TopBar-Button Rk-Export-Button">\n <div class="Rk-TopBar-Tooltip">\n <div class="Rk-TopBar-Tooltip-Contents">\n '+__e(translate("Download Project"))+'\n </div>\n </div>\n </div>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n "),__p+="\n ",options.show_search_field&&(__p+='\n <form action="#" class="Rk-GraphSearch-Form">\n <input type="search" class="Rk-GraphSearch-Field" placeholder="'+__e(translate("Search in graph"))+'" />\n </form>\n <div class="Rk-TopBar-Separator"></div>\n '),__p+="\n </div>\n"),__p+='\n<div class="Rk-Editing-Space',options.show_top_bar||(__p+=" Rk-Editing-Space-Full"),__p+='">\n <div class="Rk-Labels"></div>\n <canvas class="Rk-Canvas" ',options.resize&&(__p+=' resize="" '),__p+='></canvas>\n <div class="Rk-Notifications"></div>\n <div class="Rk-Editor">\n ',options.show_bins&&(__p+='\n <div class="Rk-Fold-Bins">«</div>\n '),__p+="\n ",options.show_zoom&&(__p+='\n <div class="Rk-ZoomButtons">\n <div class="Rk-ZoomIn" title="'+__e(translate("Zoom In"))+'"></div>\n <div class="Rk-ZoomFit" title="'+__e(translate("Zoom Fit"))+'"></div>\n <div class="Rk-ZoomOut" title="'+__e(translate("Zoom Out"))+'"></div>\n ',options.editor_mode&&options.save_view&&(__p+='\n <div class="Rk-ZoomSave" title="'+__e(translate("Zoom Save"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved zoom"))+'"></div>\n <div class="Rk-ShowHiddenNodes" title="'+__e(translate("Show hidden nodes"))+'"></div>\n '),__p+="\n </div>\n "),__p+="\n </div>\n</div>\n";return __p},this.renkanJST["templates/search.html"]=function(obj){obj||(obj={});{var __t,__p="";_.escape}with(obj)__p+='<li class="'+(null==(__t=className)?"":__t)+'" data-key="'+(null==(__t=key)?"":__t)+'">'+(null==(__t=title)?"":__t)+"</li>";return __p},this.renkanJST["templates/wikipedia-bin/resulttemplate.html"]=function(obj){obj||(obj={});var __t,__p="",__e=_.escape;with(obj)__p+='<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true"\n data-uri="'+__e(url)+'" data-title="Wikipedia: '+__e(title)+'"\n data-description="'+__e(description)+'"\n data-image="'+__e(Rkns.Utils.getFullURL(static_url+"img/wikipedia.png"))+'">\n\n <img class="Rk-Wikipedia-Icon" src="'+__e(static_url)+'img/wikipedia.png">\n <h4 class="Rk-Wikipedia-Title">\n <a href="'+__e(url)+'" target="_blank">'+(null==(__t=htitle)?"":__t)+'</a>\n </h4>\n <p class="Rk-Wikipedia-Snippet">'+(null==(__t=hdescription)?"":__t)+"</p>\n</li>\n";return __p},function(a){"use strict";"object"!=typeof a.Rkns&&(a.Rkns={});var b=a.Rkns,c=b.$=a.jQuery,d=b._=a._;b.pickerColors=["#8f1919","#a80000","#d82626","#ff0000","#e87c7c","#ff6565","#f7d3d3","#fecccc","#8f5419","#a85400","#d87f26","#ff7f00","#e8b27c","#ffb265","#f7e5d3","#fee5cc","#8f8f19","#a8a800","#d8d826","#feff00","#e8e87c","#feff65","#f7f7d3","#fefecc","#198f19","#00a800","#26d826","#00ff00","#7ce87c","#65ff65","#d3f7d3","#ccfecc","#198f8f","#00a8a8","#26d8d8","#00feff","#7ce8e8","#65feff","#d3f7f7","#ccfefe","#19198f","#0000a8","#2626d8","#0000ff","#7c7ce8","#6565ff","#d3d3f7","#ccccfe","#8f198f","#a800a8","#d826d8","#ff00fe","#e87ce8","#ff65fe","#f7d3f7","#feccfe","#000000","#242424","#484848","#6d6d6d","#919191","#b6b6b6","#dadada","#ffffff"],b.__renkans=[];var e=b._BaseBin=function(a,c){if("undefined"!=typeof a){this.renkan=a,this.renkan.$.find(".Rk-Bin-Main").hide(),this.$=b.$("<li>").addClass("Rk-Bin").appendTo(a.$.find(".Rk-Bin-List")),this.title_icon_$=b.$("<span>").addClass("Rk-Bin-Title-Icon").appendTo(this.$);var d=this;b.$("<a>").attr({href:"#",title:a.translate("Close bin")}).addClass("Rk-Bin-Close").html("×").appendTo(this.$).click(function(){return d.destroy(),a.$.find(".Rk-Bin-Main:visible").length||a.$.find(".Rk-Bin-Main:last").slideDown(),a.resizeBins(),!1}),b.$("<a>").attr({href:"#",title:a.translate("Refresh bin")}).addClass("Rk-Bin-Refresh").appendTo(this.$).click(function(){return d.refresh(),!1}),this.count_$=b.$("<div>").addClass("Rk-Bin-Count").appendTo(this.$),this.title_$=b.$("<h2>").addClass("Rk-Bin-Title").appendTo(this.$),this.main_$=b.$("<div>").addClass("Rk-Bin-Main").appendTo(this.$).html('<h4 class="Rk-Bin-Loading">'+a.translate("Loading, please wait")+"</h4>"),this.title_$.html(c.title||"(new bin)"),this.renkan.resizeBins(),c.auto_refresh&&window.setInterval(function(){d.refresh()},c.auto_refresh)}};e.prototype.destroy=function(){this.$.detach(),this.renkan.resizeBins()};var f=b.Renkan=function(a){var e=this;if(b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:renkanJST}),this.template=renkanJST["templates/main.html"],d.each(this.options.property_files,function(a){b.$.getJSON(a,function(a){e.options.properties=e.options.properties.concat(a)})}),this.read_only=this.options.read_only||!this.options.editor_mode,this.project=new b.Models.Project,this.dataloader=new b.DataLoader.Loader(this.project,this.options),this.setCurrentUser=function(a,b){this.project.addUser({_id:a,title:b}),this.current_user=a,this.renderer.redrawUsers()},"undefined"!=typeof this.options.user_id&&(this.current_user=this.options.user_id),this.$=b.$("#"+this.options.container),this.$.addClass("Rk-Main").html(this.template(this)),this.tabs=[],this.search_engines=[],this.current_user_list=new b.Models.UsersList,this.current_user_list.on("add remove",function(){this.renderer&&this.renderer.redrawUsers()}),this.colorPicker=function(){var a=renkanJST["templates/colorpicker.html"];return'<ul class="Rk-Edit-ColorPicker">'+b.pickerColors.map(function(b){return a({c:b})}).join("")+"</ul>"}(),this.options.show_editor&&(this.renderer=new b.Renderer.Scene(this)),this.options.search.length){var f=renkanJST["templates/search.html"],g=this.$.find(".Rk-Search-List"),h=this.$.find(".Rk-Web-Search-Input"),i=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),g.html(d(this.search_engines).map(function(a,b){return f({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),g.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),i.submit()}),i.submit(function(){if(h.val()){var a=e.search_engine;a.search(h.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){g.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){g.hide()}),this.setSearchEngine(0)}else this.$.find(".Rk-Web-Search-Form").detach();d.each(this.options.bins,function(a){b[a.type]&&b[a.type].Bin&&e.tabs.push(new b[a.type].Bin(e,a))});var j=!1;this.$.find(".Rk-Bins").on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon",function(){var a=b.$(this).siblings(".Rk-Bin-Main");a.is(":hidden")&&(e.$.find(".Rk-Bin-Main").slideUp(),a.slideDown())}),this.options.show_editor&&this.$.find(".Rk-Bins").on("mouseover",".Rk-Bin-Item",function(){var a=b.$(this);if(a&&c(a).attr("data-uri")){var f=e.project.get("nodes").where({uri:c(a).attr("data-uri")});d.each(f,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(){try{this.dragDrop()}catch(a){}}).on("touchstart",".Rk-Bin-Item",function(){j=!1}).on("touchmove",".Rk-Bin-Item",function(a){a.preventDefault();var b=a.originalEvent.changedTouches[0],c=e.renderer.canvas_$.offset(),d=e.renderer.canvas_$.width(),f=e.renderer.canvas_$.height();if(b.pageX>=c.left&&b.pageX<c.left+d&&b.pageY>=c.top&&b.pageY<c.top+f)if(j)e.renderer.onMouseMove(b,!0);else{j=!0;var g=document.createElement("div");g.appendChild(this.cloneNode(!0)),e.renderer.dropData({"text/html":g.innerHTML},b),e.renderer.onMouseDown(b,!0)}}).on("touchend",".Rk-Bin-Item",function(a){j&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),j=!1}).on("dragstart",".Rk-Bin-Item",function(a){var b=document.createElement("div");b.appendChild(this.cloneNode(!0));try{a.originalEvent.dataTransfer.setData("text/html",b.innerHTML)}catch(c){a.originalEvent.dataTransfer.setData("text",b.innerHTML)}}),b.$(window).resize(function(){e.resizeBins()});var k=!1,l="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==l){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==k&&(k=c.source,d.each(e.tabs,function(a){a.render(c)}))}}),this.$.find(".Rk-Bins-Search-Form").submit(function(){return!1})};f.prototype.translate=function(a){return b.i18n[this.options.language]&&b.i18n[this.options.language][a]?b.i18n[this.options.language][a]:this.options.language.length>2&&b.i18n[this.options.language.substr(0,2)]&&b.i18n[this.options.language.substr(0,2)][a]?b.i18n[this.options.language.substr(0,2)][a]:a},f.prototype.onStatusChange=function(){this.renderer.onStatusChange()},f.prototype.setSearchEngine=function(a){this.search_engine=this.search_engines[a],this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current "+this.search_engine.getBgClass());for(var b=this.search_engine.getBgClass().split(" "),c="",d=0;d<b.length;d++)c+="."+b[d];this.$.find(".Rk-Web-Search-Input.Rk-Search-Input").attr("placeholder",this.translate("Search in ")+this.$.find(".Rk-Search-List "+c).html())
+},f.prototype.resizeBins=function(){var a=+this.$.find(".Rk-Bins-Head").outerHeight();this.$.find(".Rk-Bin-Title:visible").each(function(){a+=b.$(this).outerHeight()}),this.$.find(".Rk-Bin-Main").css({height:this.$.find(".Rk-Bins").height()-a})};var g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})};b.Utils={getUUID4:g,getUID:function(){function a(a){return 10>a?"0"+a:a}var b=new Date,c=0,d=b.getUTCFullYear()+"-"+a(b.getUTCMonth()+1)+"-"+a(b.getUTCDate())+"-"+g();return function(a){for(var b=(++c).toString(16),e="undefined"==typeof a?"":a+"-";b.length<4;)b="0"+b;return e+d+"-"+b}}(),getFullURL:function(a){if("undefined"==typeof a||null==a)return"";if(/https?:\/\//.test(a))return a;var b=new Image;b.src=a;var c=b.src;return b.src=null,c},inherit:function(a,b){var c=function(){"function"==typeof b&&b.apply(this,Array.prototype.slice.call(arguments,0)),a.apply(this,Array.prototype.slice.call(arguments,0)),"function"!=typeof this._init||this._initialized||(this._init.apply(this,Array.prototype.slice.call(arguments,0)),this._initialized=!0)};return d.extend(c.prototype,a.prototype),c},regexpFromTextOrArray:function(){function a(a){function b(a){return function(b,c){a=a.replace(h[b],c)}}for(var e=a.toLowerCase().replace(g,""),i="",j=0;j<e.length;j++){j&&(i+=f+"*");var k=e[j];d.each(c,b(k)),i+=k}return i}function b(c){switch(typeof c){case"string":return a(c);case"object":var e="";return d.each(c,function(a){var c=b(a);c&&(e&&(e+="|"),e+=c)}),e}return""}var c=["[aáàâä]","[cç]","[eéèêë]","[iíìîï]","[oóòôö]","[uùûü]"],e=[String.fromCharCode(768),String.fromCharCode(769),String.fromCharCode(770),String.fromCharCode(771),String.fromCharCode(807),"{","}","(",")","[","]","【","】","、","・","‥","。","「","」","『","』","〜",":","!","?"," ",","," ",";","(",")",".","*","+","\\","?","|","{","}","[","]","^","#","/"],f="[\\"+e.join("\\")+"]",g=new RegExp(f,"gm"),h=d.map(c,function(a){return new RegExp(a)});return function(a){var c=b(a);if(c){var d=new RegExp(c,"im"),e=new RegExp("("+c+")","igm");return{isempty:!1,source:c,test:function(a){return d.test(a)},replace:function(a,b){return a.replace(e,b)}}}return{isempty:!0,source:"",test:function(){return!0},replace:function(){return text}}}}(),_MIN_DRAG_DISTANCE:2,_NODE_BUTTON_WIDTH:40,_EDGE_BUTTON_INNER:2,_EDGE_BUTTON_OUTER:40,_CLICKMODE_ADDNODE:1,_CLICKMODE_STARTEDGE:2,_CLICKMODE_ENDEDGE:3,_NODE_SIZE_STEP:Math.LN2/4,_MIN_SCALE:.05,_MAX_SCALE:20,_MOUSEMOVE_RATE:80,_DOUBLETAP_DELAY:800,_DOUBLETAP_DISTANCE:400,_USER_PLACEHOLDER:function(a){return{color:a.options.default_user_color,title:a.translate("(unknown user)"),get:function(a){return this[a]||!1}}},_BOOKMARKLET_CODE:function(a){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;\">"+a.translate("Drag items from this website, drop them in Renkan").replace(/ /g,"_")+"</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);})();"},shortenText:function(a,b){return a.length>b?a.substr(0,b)+"…":a},drawEditBox:function(a,b,c,d,e){e.css({width:a.tooltip_width-2*a.tooltip_padding});var f=e.outerHeight()+2*a.tooltip_padding,g=b.x<paper.view.center.x?1:-1,h=b.x+g*(d+a.tooltip_arrow_length),i=b.x+g*(d+a.tooltip_arrow_length+a.tooltip_width),j=b.y-f/2;j+f>paper.view.size.height-a.tooltip_margin&&(j=Math.max(paper.view.size.height-a.tooltip_margin,b.y+a.tooltip_arrow_width/2)-f),j<a.tooltip_margin&&(j=Math.min(a.tooltip_margin,b.y-a.tooltip_arrow_width/2));var k=j+f;return c.segments[0].point=c.segments[7].point=b.add([g*d,0]),c.segments[1].point.x=c.segments[2].point.x=c.segments[5].point.x=c.segments[6].point.x=h,c.segments[3].point.x=c.segments[4].point.x=i,c.segments[2].point.y=c.segments[3].point.y=j,c.segments[4].point.y=c.segments[5].point.y=k,c.segments[1].point.y=b.y-a.tooltip_arrow_width/2,c.segments[6].point.y=b.y+a.tooltip_arrow_width/2,c.closed=!0,c.fillColor=new paper.GradientColor(new paper.Gradient([a.tooltip_top_color,a.tooltip_bottom_color]),[0,j],[0,k]),e.css({left:a.tooltip_padding+Math.min(h,i),top:a.tooltip_padding+j}),c},increaseBrightness:function(a,b){a=a.replace(/^\s*#|\s*$/g,""),3===a.length&&(a=a.replace(/(.)/g,"$1$1"));var c=parseInt(a.substr(0,2),16),d=parseInt(a.substr(2,2),16),e=parseInt(a.substr(4,2),16);return"#"+(0|256+c+(256-c)*b/100).toString(16).substr(1)+(0|256+d+(256-d)*b/100).toString(16).substr(1)+(0|256+e+(256-e)*b/100).toString(16).substr(1)}}}(window),function(a){"use strict";var b=a.Rkns.DataLoader={converters:{from1to2:function(a){var b,c;if("undefined"!=typeof a.nodes)for(b=0,c=a.nodes.length;c>b;b++){var d=a.nodes[b];d.color?(console.log("node color : ",d.color),d.style={color:d.color}):d.style={}}if("undefined"!=typeof a.edges)for(b=0,c=a.edges.length;c>b;b++){var e=a.edges[b];e.style=e.color?{color:e.color}:{}}return a.schema_version="2",a}}};b.Loader=function(a,c){this.project=a,this.dataConverters=_.defaults(c.converters||{},b.converters)},b.Loader.prototype.convert=function(a){var b=this.project.getSchemaVersion(a),c=this.project.getSchemaVersion();if(b!==c){var d="from"+b+"to"+c;"function"==typeof this.dataConverters[d]&&(console.log("Apply conversion function :",d),a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){console.log(a),this.project.set(this.convert(a),{validate:!0})}}(window),function(a){"use strict";var b=a.Backbone,c=a.Rkns.Models={};c.getUID=function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)});return"undefined"!=typeof a?a.type+"-"+b:b};{var d=b.RelationalModel.extend({idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"",a.description=a.description||"",a.uri=a.uri||"","function"==typeof this.prepare&&(a=this.prepare(a))),b.RelationalModel.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},addReference:function(a,b,c,d,e){var f=c.get(d);a[b]="undefined"==typeof f&&"undefined"!=typeof e?e:f}}),e=c.User=d.extend({type:"user",prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color")}}}),f=c.Node=d.extend({type:"node",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),position:this.get("position"),image:this.get("image"),style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,size:this.get("size"),clip_path:this.get("clip_path"),shape:this.get("shape"),type:this.get("type")}}}),g=c.Edge=d.extend({type:"edge",relations:[{type:b.HasOne,key:"created_by",relatedModel:e},{type:b.HasOne,key:"from",relatedModel:f},{type:b.HasOne,key:"to",relatedModel:f}],prepare:function(a){var b=a.project;return this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),this.addReference(a,"from",b.get("nodes"),a.from),this.addReference(a,"to",b.get("nodes"),a.to),a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),from:this.get("from")?this.get("from").get("_id"):null,to:this.get("to")?this.get("to").get("_id"):null,style:this.get("style"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null}}}),h=c.View=d.extend({type:"view",relations:[{type:b.HasOne,key:"created_by",relatedModel:e}],prepare:function(a){var b=a.project;if(this.addReference(a,"created_by",b.get("users"),a.created_by,b.current_user),a.description=a.description||"","undefined"!=typeof a.offset){var c={};Array.isArray(a.offset)?(c.x=a.offset[0],c.y=a.offset.length>1?a.offset[1]:a.offset[0]):null!=a.offset.x&&(c.x=a.offset.x,c.y=a.offset.y),a.offset=c}return a},toJSON:function(){return{_id:this.get("_id"),zoom_level:this.get("zoom_level"),offset:this.get("offset"),title:this.get("title"),description:this.get("description"),created_by:this.get("created_by")?this.get("created_by").get("_id"):null,hidden_nodes:this.get("hidden_nodes")}}}),i=(c.Project=d.extend({schema_version:"2",type:"project",blacklist:["saveStatus","loadingStatus"],relations:[{type:b.HasMany,key:"users",relatedModel:e,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"nodes",relatedModel:f,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"edges",relatedModel:g,reverseRelation:{key:"project",includeInJSON:"_id"}},{type:b.HasMany,key:"views",relatedModel:h,reverseRelation:{key:"project",includeInJSON:"_id"}}],addUser:function(a,b){a.project=this;var c=e.findOrCreate(a);return this.get("users").push(c,b),c},addNode:function(a,b){a.project=this;var c=f.findOrCreate(a);return this.get("nodes").push(c,b),c},addEdge:function(a,b){a.project=this;var c=g.findOrCreate(a);return this.get("edges").push(c,b),c},addView:function(a,b){a.project=this;var c=h.findOrCreate(a);return this.get("views").push(c,b),c},removeNode:function(a){this.get("nodes").remove(a)},removeEdge:function(a){this.get("edges").remove(a)},validate:function(a){var b=this;_.each([].concat(a.users,a.nodes,a.edges,a.views),function(a){a&&(a.project=b)})},getSchemaVersion:function(a){var b=a;"undefined"==typeof b&&(b=this);var c=b.schema_version;return c?c:1},initialize:function(){var a=this;this.on("remove:nodes",function(b){a.get("edges").remove(a.get("edges").filter(function(a){return a.get("from")===b||a.get("to")===b}))})},toJSON:function(){var a=_.clone(this.attributes);for(var c in a)(a[c]instanceof b.Model||a[c]instanceof b.Collection||a[c]instanceof d)&&(a[c]=a[c].toJSON());return _.omit(a,this.blacklist)}}),c.RosterUser=b.Model.extend({type:"roster_user",idAttribute:"_id",constructor:function(a){"undefined"!=typeof a&&(a._id=a._id||a.id||c.getUID(this),a.title=a.title||"(untitled "+this.type+")",a.description=a.description||"",a.uri=a.uri||"",a.project=a.project||null,a.site_id=a.site_id||0,"function"==typeof this.prepare&&(a=this.prepare(a))),b.Model.prototype.constructor.call(this,a)},validate:function(){return this.type?void 0:"object has no type"},prepare:function(a){return a.color=a.color||"#666666",a},toJSON:function(){return{_id:this.get("_id"),title:this.get("title"),uri:this.get("uri"),description:this.get("description"),color:this.get("color"),project:null!=this.get("project")?this.get("project").get("id"):null,site_id:this.get("site_id")}}}));c.UsersList=b.Collection.extend({model:i})}}(window),Rkns.defaults={language:navigator.language||navigator.userLanguage||"en",container:"renkan",search:[],bins:[],static_url:"",popup_editor:!0,editor_panel:"editor-panel",show_bins:!0,properties:[],show_editor:!0,read_only:!1,editor_mode:!0,manual_save:!1,show_top_bar:!0,default_user_color:"#303030",size_bug_fix:!0,force_resize:!1,allow_double_click:!0,zoom_on_scroll:!0,element_delete_delay:0,autoscale_padding:50,resize:!0,show_zoom:!0,save_view:!0,default_view:!1,show_search_field:!0,show_user_list:!0,user_name_editable:!0,user_color_editable:!0,show_user_color:!0,show_save_button:!0,show_export_button:!0,show_open_button:!1,show_addnode_button:!0,show_addedge_button:!0,show_bookmarklet:!0,show_fullscreen_button:!0,home_button_url:!1,home_button_title:"Home",show_minimap:!0,minimap_width:160,minimap_height:120,minimap_padding:20,minimap_background_color:"#ffffff",minimap_border_color:"#cccccc",minimap_highlight_color:"#ffff00",minimap_highlight_weight:5,buttons_background:"#202020",buttons_label_color:"#c000c0",buttons_label_font_size:9,default_dash_array:[4,5],show_node_circles:!0,clip_node_images:!0,node_images_fill_mode:!1,node_size_base:25,node_stroke_width:2,node_stroke_max_width:12,selected_node_stroke_width:4,selected_node_stroke_max_width:24,node_stroke_witdh_scale:5,node_fill_color:"#ffffff",highlighted_node_fill_color:"#ffff00",node_label_distance:5,node_label_max_length:60,label_untitled_nodes:"(untitled)",change_shapes:!0,edge_stroke_width:2,edge_stroke_max_width:12,selected_edge_stroke_width:4,selected_edge_stroke_max_width:24,edge_stroke_witdh_scale:5,edge_label_distance:0,edge_label_max_length:20,edge_arrow_length:18,edge_arrow_width:12,edge_arrow_max_width:32,edge_gap_in_bundles:12,label_untitled_edges:"",tooltip_width:275,tooltip_padding:10,tooltip_margin:15,tooltip_arrow_length:20,tooltip_arrow_width:40,tooltip_top_color:"#f0f0f0",tooltip_bottom_color:"#d0d0d0",tooltip_border_color:"#808080",tooltip_border_width:1,show_node_editor_uri:!0,show_node_editor_description:!0,show_node_editor_size:!0,show_node_editor_style:!0,show_node_editor_style_color:!0,show_node_editor_style_dash:!0,show_node_editor_style_thickness:!0,show_node_editor_image:!0,show_node_editor_creator:!0,allow_image_upload:!0,uploaded_image_max_kb:500,show_node_tooltip_uri:!0,show_node_tooltip_description:!0,show_node_tooltip_color:!0,show_node_tooltip_image:!0,show_node_tooltip_creator:!0,show_edge_editor_uri:!0,show_edge_editor_style:!0,show_edge_editor_style_color:!0,show_edge_editor_style_dash:!0,show_edge_editor_style_thickness:!0,show_edge_editor_style_arrow:!0,show_edge_editor_direction:!0,show_edge_editor_nodes:!0,show_edge_editor_creator:!0,show_edge_tooltip_uri:!0,show_edge_tooltip_color:!0,show_edge_tooltip_nodes:!0,show_edge_tooltip_creator:!0},Rkns.i18n={fr:{"Edit Node":"Édition d’un nœud","Edit Edge":"Édition d’un lien","Title:":"Titre :","URI:":"URI :","Description:":"Description :","From:":"De :","To:":"Vers :",Image:"Image","Image URL:":"URL d'Image","Choose Image File:":"Choisir un fichier image","Full Screen":"Mode plein écran","Add Node":"Ajouter un nœud","Add Edge":"Ajouter un lien","Save Project":"Enregistrer le projet","Open Project":"Ouvrir un projet","Auto-save enabled":"Enregistrement automatique activé","Connection lost":"Connexion perdue","Created by:":"Créé par :","Zoom In":"Agrandir l’échelle","Zoom Out":"Rapetisser l’échelle",Edit:"Éditer",Remove:"Supprimer","Cancel deletion":"Annuler la suppression","Link to another node":"Créer un lien",Enlarge:"Agrandir",Shrink:"Rétrécir","Click on the background canvas to add a node":"Cliquer sur le fond du graphe pour rajouter un nœud","Click on a first node to start the edge":"Cliquer sur un premier nœud pour commencer le lien","Click on a second node to complete the edge":"Cliquer sur un second nœud pour terminer le lien",Wikipedia:"Wikipédia","Wikipedia in ":"Wikipédia en ",French:"Français",English:"Anglais",Japanese:"Japonais","Untitled project":"Projet sans titre","Lignes de Temps":"Lignes de Temps","Loading, please wait":"Chargement en cours, merci de patienter","Edge color:":"Couleur :","Dash:":"Point. :","Thickness:":"Epaisseur :","Arrow:":"Flèche :","Node color:":"Couleur :","Choose color":"Choisir une couleur","Change edge direction":"Changer le sens du lien","Do you really wish to remove node ":"Voulez-vous réellement supprimer le nœud ","Do you really wish to remove edge ":"Voulez-vous réellement supprimer le lien ","This file is not an image":"Ce fichier n'est pas une image","Image size must be under ":"L'image doit peser moins de ","Size:":"Taille :",KB:"ko","Choose from vocabulary:":"Choisir dans un vocabulaire :","SKOS Documentation properties":"SKOS: Propriétés documentaires","has note":"a pour note","has example":"a pour exemple","has definition":"a pour définition","SKOS Semantic relations":"SKOS: Relations sémantiques","has broader":"a pour concept plus large","has narrower":"a pour concept plus étroit","has related":"a pour concept apparenté","Dublin Core Metadata":"Métadonnées Dublin Core","has contributor":"a pour contributeur",covers:"couvre","created by":"créé par","has date":"a pour date","published by":"édité par","has source":"a pour source","has subject":"a pour sujet","Dragged resource":"Ressource glisée-déposée","Search the Web":"Rechercher en ligne","Search in Bins":"Rechercher dans les chutiers","Close bin":"Fermer le chutier","Refresh bin":"Rafraîchir le chutier","(untitled)":"(sans titre)","Select contents:":"Sélectionner des contenus :","Drag items from this website, drop them in Renkan":"Glissez des éléments de ce site web vers 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.":"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","Shapes available":"Formes disponibles",Circle:"Cercle",Square:"Carré",Diamond:"Losange",Hexagone:"Hexagone",Ellipse:"Ellipse",Star:"Étoile",Cloud:"Nuage",Triangle:"Triangle","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Zoom Save":"Sauver le Zoom","View saved zoom":"Restaurer le Zoom","Renkan 'Drag-to-Add' bookmarklet":"Renkan 'Deplacer-Pour-Ajouter' Signet","(unknown user)":"(non authentifié)","<unknown user>":"<non authentifié>","Search in graph":"Rechercher dans carte","Search in ":"Chercher dans "}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){a.renderer.redrawActive=!1,c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.redrawActive=!0,a.renderer.fixSize()})},e=function(){c.set({saveStatus:2});var d=c.toJSON();a.read_only||Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(d),success:function(){c.set({saveStatus:0})}})},f=Rkns._.throttle(function(){setTimeout(e,100)},1e3);c.on("add:nodes add:edges add:users add:views",function(a){a.on("change remove",function(){f()}),f()}),c.on("change",function(){1===c.changedAttributes.length&&c.hasChanged("saveStatus")||f()}),d()},Rkns.jsonIOSaveOnClick=function(a,b){var c=a.project,d=!1,e=function(){return"Project not saved"};"undefined"==typeof b.http_method&&(b.http_method="POST");var f=function(){var d={},e=/id=([^&#?=]+)/,f=document.location.hash.match(e);f&&(d.id=f[1]),Rkns.$.ajax({url:b.url,data:d,beforeSend:function(){c.set({loadingStatus:!0})},success:function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0}),a.renderer.autoScale()}})},g=function(){c.set("saved_at",new Date);var a=c.toJSON();Rkns.$.ajax({type:b.http_method,url:b.url,contentType:"application/json",data:JSON.stringify(a),beforeSend:function(){c.set({saveStatus:2})},success:function(){$(window).off("beforeunload",e),d=!1,c.set({saveStatus:0})}})},h=function(){c.set({saveStatus:1});var a=c.get("title");a&&c.get("nodes").length?$(".Rk-Save-Button").removeClass("disabled"):$(".Rk-Save-Button").addClass("disabled"),a&&$(".Rk-PadTitle").css("border-color","#333333"),d||(d=!0,$(window).on("beforeunload",e))};f(),c.on("add:nodes add:edges add:users change",function(a){a.on("change remove",function(a){1===a.changedAttributes.length&&a.hasChanged("saveStatus")||h()}),1===c.changedAttributes.length&&c.hasChanged("saveStatus")||h()}),a.renderer.save=function(){$(".Rk-Save-Button").hasClass("disabled")?c.get("title")||$(".Rk-PadTitle").css("border-color","#ff0000"):g()}},function(a){"use strict";var b=a._,c=a.Ldt={},d=(c.Bin=function(a,b){if(b.ldt_type){var d=c[b.ldt_type+"Bin"];if(d)return new d(a,b)}console.error("No such LDT Bin Type")},c.ProjectBin=a.Utils.inherit(a._BaseBin));d.prototype.tagTemplate=renkanJST["templates/ldtjson-bin/tagtemplate.html"],d.prototype.annotationTemplate=renkanJST["templates/ldtjson-bin/annotationtemplate.html"],d.prototype._init=function(a,b){this.renkan=a,this.proj_id=b.project_id,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.title_$.html(b.title),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},d.prototype.render=function(c){function d(a){var c=b(a).escape();return f.isempty?c:f.replace(c,"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}var f=c||a.Utils.regexpFromTextOrArray(),g="<li><h3>Tags</h3></li>",h=this.data.meta["dc:title"],i=this,j=0;i.title_$.text('LDT Project: "'+h+'"'),b.map(i.data.tags,function(a){var b=a.meta["dc:title"];(f.isempty||f.test(b))&&(j++,g+=i.tagTemplate({ldt_platform:i.ldt_platform,title:b,htitle:d(b),encodedtitle:encodeURIComponent(b),static_url:i.renkan.options.static_url}))}),g+="<li><h3>Annotations</h3></li>",b.map(i.data.annotations,function(a){var b=a.content.description,c=a.content.title.replace(b,"");if(f.isempty||f.test(c)||f.test(b)){j++;var h=a.end-a.begin,k=a.content&&a.content.img&&a.content.img.src?a.content.img.src:h?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";g+=i.annotationTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(a.begin),end:e(a.end),duration:e(h),mediaid:a.media,annotationid:a.id,image:k,static_url:i.renkan.options.static_url})}}),this.main_$.html(g),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()},d.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/ldt/cljson/id/"+this.proj_id,dataType:"jsonp",success:function(a){b.data=a,b.render()}})};var e=c.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"};e.prototype.getBgClass=function(){return"Rk-Ldt-Icon"},e.prototype.getSearchTitle=function(){return this.renkan.translate("Lignes de Temps")},e.prototype.search=function(a){this.renkan.tabs.push(new f(this.renkan,{search:a}))};var f=c.ResultsBin=a.Utils.inherit(a._BaseBin);f.prototype.segmentTemplate=renkanJST["templates/ldtjson-bin/segmenttemplate.html"],f.prototype._init=function(a,b){this.renkan=a,this.ldt_platform=b.ldt_platform||"http://ldt.iri.centrepompidou.fr/",this.max_results=b.max_results||50,this.search=b.search,this.title_$.html('Lignes de Temps: "'+b.search+'"'),this.title_icon_$.addClass("Rk-Ldt-Title-Icon"),this.refresh()},f.prototype.render=function(c){function d(a){return g.replace(b(a).escape(),"<span class='searchmatch'>$1</span>")}function e(a){function b(a){for(var b=a.toString();b.length<2;)b="0"+b;return b}var c=Math.abs(Math.floor(a/1e3)),d=Math.floor(c/3600),e=Math.floor(c/60)%60,f=c%60,g="";return d&&(g+=b(d)+":"),g+=b(e)+":"+b(f)}if(this.data){var f=c||a.Utils.regexpFromTextOrArray(),g=f.isempty?a.Utils.regexpFromTextOrArray(this.search):f,h="",i=this,j=0;b.each(this.data.objects,function(a){var b=a["abstract"],c=a.title;if(f.isempty||f.test(c)||f.test(b)){j++;var g=a.duration,k=a.start_ts,l=+a.duration+k,m=g?i.renkan.options.static_url+"img/ldt-segment.png":i.renkan.options.static_url+"img/ldt-point.png";h+=i.segmentTemplate({ldt_platform:i.ldt_platform,title:c,htitle:d(c),description:b,hdescription:d(b),start:e(k),end:e(l),duration:e(g),mediaid:a.iri_id,annotationid:a.element_id,image:m})}}),this.main_$.html(h),!f.isempty&&j?this.count_$.text(j).show():this.count_$.hide(),f.isempty||j?this.$.show():this.$.hide(),this.renkan.resizeBins()}},f.prototype.refresh=function(){var b=this;a.$.ajax({url:this.ldt_platform+"ldtplatform/api/ldt/1.0/segments/search/",data:{format:"jsonp",q:this.search,limit:this.max_results},dataType:"jsonp",success:function(a){b.data=a,b.render()}})}}(window.Rkns),Rkns.ResourceList={},Rkns.ResourceList.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.ResourceList.Bin.prototype.resultTemplate=renkanJST["templates/list-bin.html"],Rkns.ResourceList.Bin.prototype._init=function(a,b){this.renkan=a,this.title_$.html(b.title),b.list&&(this.data=b.list),this.refresh()},Rkns.ResourceList.Bin.prototype.render=function(a){function b(a){var b=_(a).escape();return c.isempty?b:c.replace(b,"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d="",e=this,f=0;Rkns._.each(this.data,function(a){var g;if("string"==typeof a)if(/^(https?:\/\/|www)/.test(a))g={url:a};else{g={title:a.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,"").trim()};var h=a.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);h&&(g.url=h[0]),g.title.length>80&&(g.description=g.title,g.title=g.title.replace(/^(.{30,60})\s.+$/,"$1…"))}else g=a;var i=g.title||(g.url||"").replace(/^https?:\/\/(www\.)?/,"").replace(/^(.{40}).+$/,"$1…"),j=g.url||"",k=g.description||"",l=g.image||"";j&&!/^https?:\/\//.test(j)&&(j="http://"+j),(c.isempty||c.test(i)||c.test(k))&&(f++,d+=e.resultTemplate({url:j,title:i,htitle:b(i),image:l,description:k,hdescription:b(k),static_url:e.renkan.options.static_url}))}),e.main_$.html(d),!c.isempty&&f?this.count_$.text(f).show():this.count_$.hide(),c.isempty||f?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.ResourceList.Bin.prototype.refresh=function(){this.data&&this.render()},Rkns.Wikipedia={},Rkns.Wikipedia.Search=function(a,b){this.renkan=a,this.lang=b.lang||"en"},Rkns.Wikipedia.Search.prototype.getBgClass=function(){return"Rk-Wikipedia-Search-Icon Rk-Wikipedia-Lang-"+this.lang},Rkns.Wikipedia.Search.prototype.getSearchTitle=function(){var a={fr:"French",en:"English",ja:"Japanese"};return a[this.lang]?this.renkan.translate("Wikipedia in ")+this.renkan.translate(a[this.lang]):this.renkan.translate("Wikipedia")+" ["+this.lang+"]"},Rkns.Wikipedia.Search.prototype.search=function(a){this.renkan.tabs.push(new Rkns.Wikipedia.Bin(this.renkan,{lang:this.lang,search:a}))},Rkns.Wikipedia.Bin=Rkns.Utils.inherit(Rkns._BaseBin),Rkns.Wikipedia.Bin.prototype.resultTemplate=renkanJST["templates/wikipedia-bin/resulttemplate.html"],Rkns.Wikipedia.Bin.prototype._init=function(a,b){this.renkan=a,this.search=b.search,this.lang=b.lang||"en",this.title_icon_$.addClass("Rk-Wikipedia-Title-Icon Rk-Wikipedia-Lang-"+this.lang),this.title_$.html(this.search).addClass("Rk-Wikipedia-Title"),this.refresh()},Rkns.Wikipedia.Bin.prototype.render=function(a){function b(a){return d.replace(_(a).escape(),"<span class='searchmatch'>$1</span>")}var c=a||Rkns.Utils.regexpFromTextOrArray(),d=c.isempty?Rkns.Utils.regexpFromTextOrArray(this.search):c,e="",f=this,g=0;Rkns._.each(this.data.query.search,function(a){var d=a.title,h="http://"+f.lang+".wikipedia.org/wiki/"+encodeURI(d.replace(/ /g,"_")),i=Rkns.$("<div>").html(a.snippet).text();(c.isempty||c.test(d)||c.test(i))&&(g++,e+=f.resultTemplate({url:h,title:d,htitle:b(d),description:i,hdescription:b(i),static_url:f.renkan.options.static_url}))}),f.main_$.html(e),!c.isempty&&g?this.count_$.text(g).show():this.count_$.hide(),c.isempty||g?this.$.show():this.$.hide(),this.renkan.resizeBins()},Rkns.Wikipedia.Bin.prototype.refresh=function(){var a=this;Rkns.$.ajax({url:"http://"+a.lang+".wikipedia.org/w/api.php?action=query&list=search&srsearch="+encodeURIComponent(this.search)+"&format=json",dataType:"jsonp",success:function(b){a.data=b,a.render()}})},define("renderer/baserepresentation",["jquery","underscore"],function(a,b){var c=function(a,c){if("undefined"!=typeof a&&(this.renderer=a,this.renkan=a.renkan,this.project=a.renkan.project,this.options=a.renkan.options,this.model=c,this.model)){var d=this;this._changeBinding=function(){d.redraw({change:!0})},this._removeBinding=function(){a.removeRepresentation(d),b.defer(function(){a.redraw()})},this._selectBinding=function(){d.select()},this._unselectBinding=function(){d.unselect()},this.model.on("change",this._changeBinding),this.model.on("remove",this._removeBinding),this.model.on("select",this._selectBinding),this.model.on("unselect",this._unselectBinding)}};return b(c.prototype).extend({_super:function(a){return c.prototype[a].apply(this,Array.prototype.slice.call(arguments,1))},redraw:function(){},moveTo:function(){},show:function(){return"BaseRepresentation.show"},hide:function(){},select:function(){this.model&&this.model.trigger("selected")},unselect:function(){this.model&&this.model.trigger("unselected")},highlight:function(){},unhighlight:function(){},mousedown:function(){},mouseup:function(){this.model&&this.model.trigger("clicked")},destroy:function(){this.model&&(this.model.off("change",this._changeBinding),this.model.off("remove",this._removeBinding),this.model.off("select",this._selectBinding),this.model.off("unselect",this._unselectBinding))}}).value(),c}),define("requtils",[],function(){return{getUtils:function(){return window.Rkns.Utils},getRenderer:function(){return window.Rkns.Renderer}}}),define("renderer/basebutton",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({moveTo:function(a){this.sector.moveTo(a)},show:function(){this.sector.show()},hide:function(){this.sector.hide()},select:function(){this.sector.select()},unselect:function(a){this.sector.unselect(),(!a||a!==this.source_representation&&a.source_representation!==this.source_representation)&&this.source_representation.unselect()},destroy:function(){this.sector.destroy()}}).value(),f}),define("renderer/shapebuilder",[],function(){var a="M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z",b={circle:{getShape:function(){return new paper.Path.Circle([0,0],1)
+},getImageShape:function(a,b){return new paper.Path.Circle(a,b)}},rectangle:{getShape:function(){return new paper.Path.Rectangle([-2,-2],[2,2])},getImageShape:function(a,b){return new paper.Path.Rectangle([-b,-b],[2*b,2*b])}},ellipse:{getShape:function(){return new paper.Path.Ellipse(new paper.Rectangle([-2,-1],[2,1]))},getImageShape:function(a,b){return new paper.Path.Ellipse(new paper.Rectangle([-b,-b/2],[2*b,b]))}},polygon:{getShape:function(){return new paper.Path.RegularPolygon([0,0],6,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,6,b)}},diamond:{getShape:function(){var a=new paper.Path.Rectangle([-Math.SQRT2,-Math.SQRT2],[Math.SQRT2,Math.SQRT2]);return a.rotate(45),a},getImageShape:function(a,b){var c=new paper.Path.Rectangle([-b*Math.SQRT2/2,-b*Math.SQRT2/2],[b*Math.SQRT2,b*Math.SQRT2]);return c.rotate(45),c}},star:{getShape:function(){return new paper.Path.Star([0,0],8,1,.7)},getImageShape:function(a,b){return new paper.Path.Star(a,8,1*b,.7*b)}},cloud:{getShape:function(){var b=new paper.Path(a);return b},getImageShape:function(b,c){var d=new paper.Path(a);return d.scale(c),d.translate(b),d}},triangle:{getShape:function(){return new paper.Path.RegularPolygon([0,0],3,1)},getImageShape:function(a,b){return new paper.Path.RegularPolygon(a,3,b)}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(){return new paper.Path}}}},c=function(a){return(null===a||"undefined"==typeof a)&&(a="circle"),"svg:"===a.substr(0,4)?b.svg(a.substr(4)):(a in b||(a="circle"),b[a])};return c.builders=b,c}),define("renderer/noderepr",["jquery","underscore","requtils","renderer/baserepresentation","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){if(this.renderer.node_layer.activate(),this.type="Node",this.buildShape(),this.hidden=!1,this.ghost=!1,this.options.show_node_circles?(this.circle.strokeWidth=this.options.node_stroke_width,this.h_ratio=1):this.h_ratio=0,this.title=a('<div class="Rk-Label">').appendTo(this.renderer.labels_$),this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.NodeEditButton(this.renderer,null),new b.NodeRemoveButton(this.renderer,null),new b.NodeHideButton(this.renderer,null),new b.NodeShowButton(this.renderer,null),new b.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.pending_delete_buttons=[new b.NodeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.last_circle_radius=1,this.renderer.minimap&&(this.renderer.minimap.node_layer.activate(),this.minimap_circle=new paper.Path.Circle([0,0],1),this.minimap_circle.__representation=this.renderer.minimap.miniframe.__representation,this.renderer.minimap.node_group.addChild(this.minimap_circle))},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.node_stroke_width+(a-1)*(this.options.node_stroke_max_width-this.options.node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_node_stroke_width+(a-1)*(this.options.selected_node_stroke_max_width-this.options.selected_node_stroke_width)/(this.options.node_stroke_witdh_scale-1)},buildShape:function(){"shape"in this.model.changed&&delete this.img,this.circle&&(this.circle.remove(),delete this.circle),this.shapeBuilder=new e(this.model.get("shape")),this.circle=this.shapeBuilder.getShape(),this.circle.__representation=this,this.circle.sendToBack(),this.last_circle_radius=1},redraw:function(a){"shape"in this.model.changed&&"change"in a&&a.change&&this.buildShape();var c=new paper.Point(this.model.get("position")),d=this.options.node_size_base*Math.exp((this.model.get("size")||0)*f._NODE_SIZE_STEP);this.is_dragging&&this.paper_coords||(this.paper_coords=this.renderer.toPaperCoords(c)),this.circle_radius=d*this.renderer.scale,this.last_circle_radius!==this.circle_radius&&(this.all_buttons.forEach(function(a){a.setSectorSize()}),this.circle.scale(this.circle_radius/this.last_circle_radius),this.node_image&&this.node_image.scale(this.circle_radius/this.last_circle_radius)),this.circle.position=this.paper_coords,this.node_image&&(this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius))),this.last_circle_radius=this.circle_radius;var e=this.active_buttons,g=1;this.model.get("delete_scheduled")?(g=.5,this.active_buttons=this.pending_delete_buttons,this.circle.dashArray=[2,2]):(g=1,this.active_buttons=this.normal_buttons,this.circle.dashArray=null),this.selected&&this.renderer.isEditable()&&!this.ghost&&(e!==this.active_buttons&&e.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.node_image&&(this.node_image.opacity=this.highlighted?.5*g:g-.01),this.circle.fillColor=this.highlighted?this.options.highlighted_node_fill_color:this.options.node_fill_color,this.circle.opacity=this.options.show_node_circles?g:.01;var h=this.model.get("title")||this.renkan.translate(this.options.label_untitled_nodes)||"";h=f.shortenText(h,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(h).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(h);var i=this._getStrokeWidth();this.title.css({left:this.paper_coords.x,top:this.paper_coords.y+this.circle_radius*this.h_ratio+this.options.node_label_distance+.5*i,opacity:g});var j=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),k=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=i,this.circle.strokeColor=j,this.circle.dashArray=k;var l=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(l)});var m=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==m&&(this.showImage(),this.circle&&this.circle.sendToBack()),this.node_image&&!this.img&&(this.node_image.remove(),delete this.node_image),this.renderer.minimap){this.minimap_circle.fillColor=j;var n=this.renderer.toMinimapCoords(c),o=this.renderer.minimap.scale*d,p=new paper.Size([o,o]);this.minimap_circle.fitBounds(n.subtract(p),p.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var q=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===q.model||a.get("from")===q.model}),function(a){var b=q.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.redraw()})}this.ghost?this.show(!0):this.hidden&&this.hide()},showImage:function(){var b=null;if("undefined"==typeof this.renderer.image_cache[this.img]?(b=new Image,this.renderer.image_cache[this.img]=b,b.src=this.img):b=this.renderer.image_cache[this.img],b.width){this.node_image&&this.node_image.remove(),this.renderer.node_layer.activate();var c=b.width,d=b.height,e=this.model.get("clip_path"),f="undefined"!=typeof e&&e,g=null,h=null,i=null;if(f){g=new paper.Path;var j=e.match(/[a-z][^a-z]+/gi)||[],k=[0,0],l=1/0,m=1/0,n=-1/0,o=-1/0,p=function(a,b){var e=a.slice(1).map(function(a,e){var f=parseFloat(a),g=e%2;return f=g?(f-.5)*d:(f-.5)*c,b&&(f+=k[g]),g?(m=Math.min(m,f),o=Math.max(o,f)):(l=Math.min(l,f),n=Math.max(n,f)),f});return k=e.slice(-2),e};j.forEach(function(a){var b=a.match(/([a-z]|[0-9.-]+)/gi)||[""];switch(b[0]){case"M":g.moveTo(p(b));break;case"m":g.moveTo(p(b,!0));break;case"L":g.lineTo(p(b));break;case"l":g.lineTo(p(b,!0));break;case"C":g.cubicCurveTo(p(b));break;case"c":g.cubicCurveTo(p(b,!0));break;case"Q":g.quadraticCurveTo(p(b));break;case"q":g.quadraticCurveTo(p(b,!0))}}),h=Math[this.options.node_images_fill_mode?"min":"max"](n-l,o-m)/2,i=new paper.Point((n+l)/2,(o+m)/2),this.options.show_node_circles||(this.h_ratio=(o-m)/(2*h))}else h=Math[this.options.node_images_fill_mode?"min":"max"](c,d)/2,i=new paper.Point(0,0),this.options.show_node_circles||(this.h_ratio=d/(2*h));var q=new paper.Raster(b);if(q.locked=!0,f&&(q=new paper.Group(g,q),q.opacity=.99,q.clipped=!0,g.__representation=this),this.options.clip_node_images){var r=this.shapeBuilder.getImageShape(i,h);q=new paper.Group(r,q),q.opacity=.99,q.clipped=!0,r.__representation=this}this.image_delta=i.divide(h),this.node_image=q,this.node_image.__representation=s,this.node_image.scale(this.circle_radius/h),this.node_image.position=this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)),this.node_image.insertAbove(this.circle)}else{var s=this;a(b).on("load",function(){s.showImage()})}},paperShift:function(a){this.options.editor_mode?this.renkan.read_only||(this.is_dragging=!0,this.paper_coords=this.paper_coords.add(a),this.redraw()):this.renderer.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.circle.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&!this.hidden&&this.active_buttons.forEach(function(a){a.show()});var b=this.model.get("uri");b&&a(".Rk-Bin-Item").each(function(){var c=a(this);c.attr("data-uri")===b&&c.addClass("selected")}),this.options.editor_mode||this.openEditor(),this.renderer.minimap&&(this.minimap_circle.strokeWidth=this.options.minimap_highlight_weight,this.minimap_circle.strokeColor=this.options.minimap_highlight_color),this.hidden?this.show(!0):this.showNeighbors(!0),this._super("select")},hideButtons:function(){this.all_buttons.forEach(function(a){a.hide()}),delete this.buttonTimeout},unselect:function(b){if(!b||b.source_representation!==this){this.selected=!1;var c=this;this.buttons_timeout=setTimeout(function(){c.hideButtons()},200),this.circle.strokeWidth=this._getStrokeWidth(),a(".Rk-Bin-Item").removeClass("selected"),this.renderer.minimap&&(this.minimap_circle.strokeColor=void 0),this.hidden?this.hide():this.hideNeighbors(),this._super("unselect")}},hide:function(){var a=this;this.ghost=!1,this.hidden=!0,"undefined"!=typeof this.node_image&&(this.node_image.opacity=0),this.hideButtons(),this.circle.opacity=0,this.title.css("opacity",0),this.minimap_circle.opacity=0,b.each(this.project.get("edges").filter(function(b){return b.get("to")===a.model||b.get("from")===a.model}),function(b){var c=a.renderer.getRepresentationByModel(b);c&&"undefined"!=typeof c.from_representation&&"undefined"!=typeof c.from_representation.paper_coords&&"undefined"!=typeof c.to_representation&&"undefined"!=typeof c.to_representation.paper_coords&&c.hide()}),this.hideNeighbors()},show:function(a){var c=this;this.ghost=a,this.ghost?("undefined"!=typeof this.node_image&&(this.node_image.opacity=.3),this.circle.opacity=.3,this.title.css("opacity",.3),this.minimap_circle.opacity=.3):(this.hidden=!1,this.redraw()),b.each(this.project.get("edges").filter(function(a){return a.get("to")===c.model||a.get("from")===c.model}),function(a){var b=c.renderer.getRepresentationByModel(a);b&&"undefined"!=typeof b.from_representation&&"undefined"!=typeof b.from_representation.paper_coords&&"undefined"!=typeof b.to_representation&&"undefined"!=typeof b.to_representation.paper_coords&&b.show(c.ghost)})},hideNeighbors:function(){var a=this;b.each(this.project.get("edges").filter(function(b){return b.get("from")===a.model}),function(b){var c=a.renderer.getRepresentationByModel(b.get("to"));c&&c.ghost&&c.hide()})},showNeighbors:function(a){var c=this;b.each(this.project.get("edges").filter(function(a){return a.get("from")===c.model}),function(b){var d=c.renderer.getRepresentationByModel(b.get("to"));if(d&&d.hidden&&(d.show(a),!a)){var e=c.renderer.hiddenNodes.indexOf(d.model.id);-1!==e&&c.renderer.hiddenNodes.splice(e,1)}})},highlight:function(a){var b=a||!0;this.highlighted!==b&&(this.highlighted=b,this.redraw(),this.renderer.throttledPaperDraw())},unhighlight:function(){this.highlighted&&(this.highlighted=!1,this.redraw(),this.renderer.throttledPaperDraw())},saveCoords:function(){var a=this.renderer.toModelCoords(this.paper_coords),b={position:{x:a.x,y:a.y}};this.renderer.isEditable()&&this.model.set(b)},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){if(this.renderer.is_dragging&&this.renderer.isEditable())this.saveCoords();else if(this.hidden){var c=this.renderer.hiddenNodes.indexOf(this.model.id);-1!==c&&this.renderer.hiddenNodes.splice(c,1),this.show(!1),this.select()}else b||this.model.get("delete_scheduled")||this.openEditor(),this.model.trigger("clicked");this.renderer.click_target=null,this.renderer.is_dragging=!1,this.is_dragging=!1},destroy:function(){this._super("destroy"),this.all_buttons.forEach(function(a){a.destroy()}),this.circle.remove(),this.title.remove(),this.renderer.minimap&&this.minimap_circle.remove(),this.node_image&&this.node_image.remove()}}).value(),g}),define("renderer/edge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){if(this.renderer.edge_layer.activate(),this.type="Edge",this.hidden=!1,this.ghost=!1,this.from_representation=this.renderer.getRepresentationByModel(this.model.get("from")),this.to_representation=this.renderer.getRepresentationByModel(this.model.get("to")),this.bundle=this.renderer.addToBundles(this),this.line=new paper.Path,this.line.add([0,0],[0,0],[0,0]),this.line.__representation=this,this.line.strokeWidth=this.options.edge_stroke_width,this.arrow_scale=1,this.arrow=new paper.Path,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.pivot=new paper.Point([this.options.edge_arrow_length/2,this.options.edge_arrow_width/2]),this.arrow.__representation=this,this.text=a('<div class="Rk-Label Rk-Edge-Label">').appendTo(this.renderer.labels_$),this.arrow_angle=0,this.options.editor_mode){var b=c.getRenderer();this.normal_buttons=[new b.EdgeEditButton(this.renderer,null),new b.EdgeRemoveButton(this.renderer,null)],this.pending_delete_buttons=[new b.EdgeRevertButton(this.renderer,null)],this.all_buttons=this.normal_buttons.concat(this.pending_delete_buttons);for(var d=0;d<this.all_buttons.length;d++)this.all_buttons[d].source_representation=this;this.active_buttons=[]}else this.active_buttons=this.all_buttons=[];this.renderer.minimap&&(this.renderer.minimap.edge_layer.activate(),this.minimap_line=new paper.Path,this.minimap_line.add([0,0],[0,0]),this.minimap_line.__representation=this.renderer.minimap.miniframe.__representation,this.minimap_line.strokeWidth=1)},_getStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.edge_stroke_width+(a-1)*(this.options.edge_stroke_max_width-this.options.edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getSelectedStrokeWidth:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return this.options.selected_edge_stroke_width+(a-1)*(this.options.selected_edge_stroke_max_width-this.options.selected_edge_stroke_width)/(this.options.edge_stroke_witdh_scale-1)},_getArrowScale:function(){var a=this.model.has("style")&&this.model.get("style").thickness||1;return 1+(a-1)*(this.options.edge_arrow_max_width/this.options.edge_arrow_width-1)/(this.options.edge_stroke_witdh_scale-1)},redraw:function(){var a=this.model.get("from"),b=this.model.get("to");if(a&&b&&(!this.hidden||this.ghost)){if(this.from_representation=this.renderer.getRepresentationByModel(a),this.to_representation=this.renderer.getRepresentationByModel(b),"undefined"==typeof this.from_representation||"undefined"==typeof this.to_representation||this.from_representation.hidden&&!this.from_representation.ghost||this.to_representation.hidden&&!this.to_representation.ghost)return void this.hide();var c=this._getStrokeWidth(),d=this._getArrowScale(),f=this.from_representation.paper_coords,g=this.to_representation.paper_coords,h=g.subtract(f),i=h.length,j=h.divide(i),k=new paper.Point([-j.y,j.x]),l=this.bundle.getPosition(this),m=k.multiply(this.options.edge_gap_in_bundles*l),n=f.add(m),o=g.add(m),p=h.angle,q=k.multiply(this.options.edge_label_distance+.5*d*this.options.edge_arrow_width),r=h.divide(3),s=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),t=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null,u=1;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(u=.5,this.line.dashArray=[2,2]):(u=1,this.line.dashArray=null);var v=this.active_buttons,w=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow?u:0;this.active_buttons=this.model.get("delete_scheduled")?this.pending_delete_buttons:this.normal_buttons,this.selected&&this.renderer.isEditable()&&v!==this.active_buttons&&(v.forEach(function(a){a.hide()}),this.active_buttons.forEach(function(a){a.show()})),this.paper_coords=n.add(o).divide(2),this.line.strokeWidth=c,this.line.strokeColor=s,this.line.dashArray=t,this.line.opacity=this.ghost?.3:u,this.line.segments[0].point=f,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=r.multiply(-1),this.line.segments[1].handleOut=r,this.line.segments[2].point=g,this.arrow.scale(d/this.arrow_scale),this.arrow_scale=d,this.arrow.fillColor=s,this.arrow.opacity=this.ghost?.3:w,this.arrow.rotate(p-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=p,p>90&&(p-=180,q=q.multiply(-1)),-90>p&&(p+=180,q=q.multiply(-1));var x=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";x=e.shortenText(x,this.options.node_label_max_length),this.text.text(x);var y=this.paper_coords.add(q);this.text.css({left:y.x,top:y.y,transform:"rotate("+p+"deg)","-moz-transform":"rotate("+p+"deg)","-webkit-transform":"rotate("+p+"deg)",opacity:this.ghost?.3:u}),this.text_angle=p;var z=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(z)}),this.renderer.minimap&&(this.minimap_line.strokeColor=s,this.minimap_line.segments[0].point=this.renderer.toMinimapCoords(new paper.Point(this.from_representation.model.get("position"))),this.minimap_line.segments[1].point=this.renderer.toMinimapCoords(new paper.Point(this.to_representation.model.get("position"))))}},hide:function(){this.hidden=!0,this.ghost=!1,this.text.hide(),this.line.visible=!1,this.arrow.visible=!1,this.minimap_line.visible=!1},show:function(a){this.ghost=a,this.ghost?(this.text.css("opacity",.3),this.line.opacity=.3,this.arrow.opacity=.3,this.minimap_line.opacity=.3):(this.hidden=!1,this.text.css("opacity",1),this.line.opacity=1,this.arrow.opacity=1,this.minimap_line.opacity=1),this.text.show(),this.line.visible=!0,this.arrow.visible=!0,this.minimap_line.visible=!0,this.redraw()},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("EdgeEditor",null);a.source_representation=this,a.draw()},select:function(){this.selected=!0,this.line.strokeWidth=this._getSelectedStrokeWidth(),this.renderer.isEditable()&&this.active_buttons.forEach(function(a){a.show()}),this.options.editor_mode||this.openEditor(),this._super("select")},unselect:function(a){a&&a.source_representation===this||(this.selected=!1,this.options.editor_mode&&this.all_buttons.forEach(function(a){a.hide()}),this.line.strokeWidth=this._getStrokeWidth(),this._super("unselect"))},mousedown:function(a,b){b&&(this.renderer.unselectAll(),this.select())},mouseup:function(a,b){!this.renkan.read_only&&this.renderer.is_dragging?(this.from_representation.saveCoords(),this.to_representation.saveCoords(),this.from_representation.is_dragging=!1,this.to_representation.is_dragging=!1):(b||this.openEditor(),this.model.trigger("clicked")),this.renderer.click_target=null,this.renderer.is_dragging=!1},paperShift:function(a){this.options.editor_mode?this.options.read_only||(this.from_representation.paperShift(a),this.to_representation.paperShift(a)):this.renderer.paperShift(a)},destroy:function(){this._super("destroy"),this.line.remove(),this.arrow.remove(),this.text.remove(),this.renderer.minimap&&this.minimap_line.remove(),this.all_buttons.forEach(function(a){a.destroy()});var a=this;this.bundle.edges=b.reject(this.bundle.edges,function(b){return a===b})}}).value(),f}),define("renderer/tempedge",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.edge_layer.activate(),this.type="Temp-edge";var a=(this.project.get("users").get(this.renkan.current_user)||e._USER_PLACEHOLDER(this.renkan)).get("color");this.line=new paper.Path,this.line.strokeColor=a,this.line.dashArray=[4,2],this.line.strokeWidth=this.options.selected_edge_stroke_width,this.line.add([0,0],[0,0]),this.line.__representation=this,this.arrow=new paper.Path,this.arrow.fillColor=a,this.arrow.add([0,0],[this.options.edge_arrow_length,this.options.edge_arrow_width/2],[0,this.options.edge_arrow_width]),this.arrow.__representation=this,this.arrow_angle=0},redraw:function(){var a=this.from_representation.paper_coords,b=this.end_pos,c=b.subtract(a).angle,d=a.add(b).divide(2);this.line.segments[0].point=a,this.line.segments[1].point=b,this.arrow.rotate(c-this.arrow_angle),this.arrow.position=d,this.arrow_angle=c},paperShift:function(a){if(!this.renderer.isEditable())return this.renderer.removeRepresentation(_this),void paper.view.draw();this.end_pos=this.end_pos.add(a);var b=paper.project.hitTest(this.end_pos);this.renderer.findTarget(b),this.redraw()},mouseup:function(a){var b=paper.project.hitTest(a.point),c=this.from_representation.model,d=!0;if(b&&"undefined"!=typeof b.item.__representation){var f=b.item.__representation;if("Node"===f.type.substr(0,4)){var g=f.model||f.source_representation.model;if(c!==g){var h={id:e.getUID("edge"),created_by:this.renkan.current_user,from:c,to:g};this.renderer.isEditable()&&this.project.addEdge(h)}}(c===f.model||f.source_representation&&f.source_representation.model===c)&&(d=!1,this.renderer.is_dragging=!0)}d&&(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentation(this),paper.view.draw())},destroy:function(){this.arrow.remove(),this.line.remove()}}).value(),f}),define("renderer/baseeditor",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.renderer.buttons_layer.activate(),this.type="editor",this.editor_block=new paper.Path;var c=b.map(b.range(8),function(){return[0,0]});this.editor_block.add.apply(this.editor_block,c),this.editor_block.strokeWidth=this.options.tooltip_border_width,this.editor_block.strokeColor=this.options.tooltip_border_color,this.editor_block.opacity=.8,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:.8}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder"],function(a,b,c,d,e){var f=c.getUtils(),g=f.inherit(d);return b(g.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/nodeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/nodeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("created_by")||f._USER_PLACEHOLDER(this.renkan),g=this.renderer.isEditable()?this.template:this.readOnlyTemplate,h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:f.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),image:c.get("image")||"",image_placeholder:h,color:c.has("style")&&c.get("style").color||d.get("color"),thickness:c.has("style")&&c.get("style").thickness||1,dash:c.has("style")&&c.get("style").dash?"checked":"",clip_path:c.get("clip_path")||!1,created_by_color:d.get("color"),created_by_title:d.get("title"),size:(i>0?"+":"")+i,shape:c.get("shape")||"circle"},renkan:this.renkan,options:this.options,shortenText:f.shortenText,shapes:b(e.builders).omit("svg").keys().value()})),this.redraw();var j=this,k=function(){j.editor_$.off("keyup"),j.editor_$.find("input, textarea, select").off("change keyup paste"),j.editor_$.find(".Rk-Edit-Image-File").off("change"),j.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off("hover"),j.editor_$.find(".Rk-Edit-Size-Btn").off("click"),j.editor_$.find(".Rk-Edit-Image-Del").off("click"),j.editor_$.find(".Rk-Edit-ColorPicker").find("li").off("hover click"),j.editor_$.find(".Rk-CloseX").off("click"),j.editor_$.find(".Rk-Edit-Goto").off("click"),j.renderer.removeRepresentation(j),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(k),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var l=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={title:j.editor_$.find(".Rk-Edit-Title").val()};if(j.options.show_node_editor_uri&&(a.uri=j.editor_$.find(".Rk-Edit-URI").val(),j.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#")),j.options.show_node_editor_image&&(a.image=j.editor_$.find(".Rk-Edit-Image").val(),j.editor_$.find(".Rk-Edit-ImgPreview").attr("src",a.image||h)),j.options.show_node_editor_description&&(a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_style){var d=j.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d})}j.options.change_shapes&&c.get("shape")!==j.editor_$.find(".Rk-Edit-Shape").val()&&(a.shape=j.editor_$.find(".Rk-Edit-Shape").val()),c.set(a),j.redraw()}else k()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&k()}),this.editor_$.find("input, textarea, select").on("change keyup paste",l),j.options.allow_image_upload&&this.editor_$.find(".Rk-Edit-Image-File").change(function(){if(this.files.length){var a=this.files[0],b=new FileReader;if("image"!==a.type.substr(0,5))return void alert(j.renkan.translate("This file is not an image"));if(a.size>1024*j.options.uploaded_image_max_kb)return void alert(j.renkan.translate("Image size must be under ")+j.options.uploaded_image_max_kb+j.renkan.translate("KB"));b.onload=function(a){j.editor_$.find(".Rk-Edit-Image").val(a.target.result),l()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var m=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),m.show()},function(a){a.preventDefault(),m.hide()}),m.find("li").hover(function(b){b.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),j.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||f._USER_PLACEHOLDER(j.renkan)).get("color"))}).click(function(d){d.preventDefault(),j.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),m.hide(),paper.view.draw()):k()});var n=function(a){if(j.renderer.isEditable()){var b=a+(c.get("size")||0);j.editor_$.find("#Rk-Edit-Size-Value").text((b>0?"+":"")+b),c.set("size",b),paper.view.draw()}else k()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return n(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return n(1),!1});var o=function(a){if(j.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>j.options.node_stroke_witdh_scale&&(e=j.options.node_stroke_witdh_scale),e!==d&&(j.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else k()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return o(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return o(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),l(),!1})}else if("object"==typeof this.source_representation.highlighted){var p=this.source_representation.highlighted.replace(b(c.get("title")).escape(),'<span class="Rk-Highlighted">$1</span>');this.editor_$.find(".Rk-Display-Title"+(c.get("uri")?" a":"")).html(p),this.options.show_node_tooltip_description&&this.editor_$.find(".Rk-Display-Description").html(this.source_representation.highlighted.replace(b(c.get("description")).escape(),'<span class="Rk-Highlighted">$1</span>'))}this.editor_$.find("img").load(function(){j.redraw()})},redraw:function(){if(this.options.popup_editor){var a=this.source_representation.paper_coords;f.drawEditBox(this.options,a,this.editor_block,.75*this.source_representation.circle_radius,this.editor_$)}this.editor_$.show(),paper.view.draw()}}).value(),g}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){d.prototype._init.apply(this),this.template=this.options.templates["templates/edgeeditor.html"],this.readOnlyTemplate=this.options.templates["templates/edgeeditor_readonly.html"]},draw:function(){var c=this.source_representation.model,d=c.get("from"),f=c.get("to"),g=c.get("created_by")||e._USER_PLACEHOLDER(this.renkan),h=this.renderer.isEditable()?this.template:this.readOnlyTemplate;this.editor_$.html(h({edge:{has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),short_uri:e.shortenText((c.get("uri")||"").replace(/^(https?:\/\/)?(www\.)?/,"").replace(/\/$/,""),40),description:c.get("description"),color:c.has("style")&&c.get("style").color||g.get("color"),dash:c.has("style")&&c.get("style").dash?"checked":"",arrow:c.has("style")&&c.get("style").arrow||!c.has("style")||"undefined"==typeof c.get("style").arrow?"checked":"",thickness:c.has("style")&&c.get("style").thickness||1,from_title:d.get("title"),to_title:f.get("title"),from_color:d.has("style")&&d.get("style").color||(d.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),to_color:f.has("style")&&f.get("style").color||(f.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),created_by_color:g.get("color"),created_by_title:g.get("title")},renkan:this.renkan,shortenText:e.shortenText,options:this.options})),this.redraw();var i=this,j=function(){i.renderer.removeRepresentation(i),i.editor_$.find(".Rk-Edit-Size-Btn").off("click"),paper.view.draw()};if(this.editor_$.find(".Rk-CloseX").click(j),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var k=b.throttle(function(){b.defer(function(){if(i.renderer.isEditable()){var a={title:i.editor_$.find(".Rk-Edit-Title").val()};if(i.options.show_edge_editor_uri&&(a.uri=i.editor_$.find(".Rk-Edit-URI").val()),i.options.show_node_editor_style){var d=i.editor_$.find(".Rk-Edit-Dash").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d});var e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");
+a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{arrow:e})}i.editor_$.find(".Rk-Edit-Goto").attr("href",a.uri||"#"),c.set(a),paper.view.draw()}else j()})},500);this.editor_$.on("keyup",function(a){27===a.keyCode&&j()}),this.editor_$.find("input").on("keyup change paste",k),this.editor_$.find(".Rk-Edit-Vocabulary").change(function(){var b=a(this),c=b.val();c&&(i.editor_$.find(".Rk-Edit-Title").val(b.find(":selected").text()),i.editor_$.find(".Rk-Edit-URI").val(c),k())}),this.editor_$.find(".Rk-Edit-Direction").click(function(){i.renderer.isEditable()?(c.set({from:c.get("to"),to:c.get("from")}),i.draw()):j()});var l=i.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),l.show()},function(a){a.preventDefault(),l.hide()}),l.find("li").hover(function(b){b.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",a(this).attr("data-color"))},function(a){a.preventDefault(),i.editor_$.find(".Rk-Edit-Color").css("background",c.has("style")&&c.get("style").color||(c.get("created_by")||e._USER_PLACEHOLDER(i.renkan)).get("color"))}).click(function(d){d.preventDefault(),i.renderer.isEditable()?(c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{color:a(this).attr("data-color")})),l.hide(),paper.view.draw()):j()});var m=function(a){if(i.renderer.isEditable()){var d=c.has("style")&&c.get("style").thickness||1,e=a+d;1>e?e=1:e>i.options.node_stroke_witdh_scale&&(e=i.options.node_stroke_witdh_scale),e!==d&&(i.editor_$.find("#Rk-Edit-Thickness-Value").text(e),c.set("style",b.assign(c.has("style")&&b.clone(c.get("style"))||{},{thickness:e})),paper.view.draw())}else j()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return m(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return m(1),!1})}},redraw:function(){if(this.options.popup_editor){var a=this.source_representation.paper_coords;e.drawEditBox(this.options,a,this.editor_block,5,this.editor_$)}this.editor_$.show(),paper.view.draw()}}).value(),f}),define("renderer/nodebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({setSectorSize:function(){var a=this.source_representation.circle_radius;a!==this.lastSectorInner&&(this.sector&&this.sector.destroy(),this.sector=this.renderer.drawSector(this,1+a,e._NODE_BUTTON_WIDTH+a,this.startAngle,this.endAngle,1,this.imageName,this.renkan.translate(this.text)),this.lastSectorInner=a)},unselect:function(){d.prototype.unselect.apply(this,Array.prototype.slice.call(arguments,1)),this.source_representation&&this.source_representation.buttons_timeout&&(clearTimeout(this.source_representation.buttons_timeout),this.source_representation.hideButtons())},select:function(){this.source_representation&&this.source_representation.buttons_timeout&&clearTimeout(this.source_representation.buttons_timeout),this.sector.select()}}).value(),f}),define("renderer/nodeeditbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-edit-button",this.lastSectorInner=0,this.startAngle=-125,this.endAngle=-55,this.imageName="edit",this.text="Edit"},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/noderemovebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-remove-button",this.lastSectorInner=0,this.startAngle=-10,this.endAngle=45,this.imageName="remove",this.text="Remove"},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove node ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeNode(this.source_representation.model)}}).value(),f}),define("renderer/nodehidebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-hide-button",this.lastSectorInner=0,this.startAngle=45,this.endAngle=90,this.imageName="hide",this.text="Hide"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable()&&this.renderer.addHiddenNode(this.source_representation.model)}}).value(),f}),define("renderer/nodeshowbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-show-button",this.lastSectorInner=0,this.startAngle=90,this.endAngle=135,this.imageName="show",this.text="Show"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable()&&this.source_representation.showNeighbors(!1)}}).value(),f}),define("renderer/noderevertbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-revert-button",this.lastSectorInner=0,this.startAngle=-135,this.endAngle=135,this.imageName="revert",this.text="Cancel deletion"},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/nodelinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-link-button",this.lastSectorInner=0,this.startAngle=135,this.endAngle=190,this.imageName="link",this.text="Link to another node"},mousedown:function(a){if(this.renderer.isEditable()){var b=this.renderer.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,c)}}}).value(),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-enlarge-button",this.lastSectorInner=0,this.startAngle=-55,this.endAngle=-10,this.imageName="enlarge",this.text="Enlarge"},mouseup:function(){var a=1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/nodeshrinkbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Node-shrink-button",this.lastSectorInner=0,this.startAngle=-170,this.endAngle=-125,this.imageName="shrink",this.text="Shrink"},mouseup:function(){var a=-1+(this.source_representation.model.get("size")||0);this.source_representation.model.set("size",a),this.source_representation.select(),this.select(),paper.view.draw()}}).value(),f}),define("renderer/edgeeditbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-edit-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-270,-90,1,"edit",this.renkan.translate("Edit"))},mouseup:function(){this.renderer.is_dragging||this.source_representation.openEditor()}}).value(),f}),define("renderer/edgeremovebutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-remove-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-90,90,1,"remove",this.renkan.translate("Remove"))},mouseup:function(){if(this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.removeRepresentationsOfType("editor"),this.renderer.isEditable())if(this.options.element_delete_delay){var a=e.getUID("delete");this.renderer.delete_list.push({id:a,time:(new Date).valueOf()+this.options.element_delete_delay}),this.source_representation.model.set("delete_scheduled",a)}else confirm(this.renkan.translate("Do you really wish to remove edge ")+'"'+this.source_representation.model.get("title")+'"?')&&this.project.removeEdge(this.source_representation.model)}}).value(),f}),define("renderer/edgerevertbutton",["jquery","underscore","requtils","renderer/basebutton"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){this.type="Edge-revert-button",this.sector=this.renderer.drawSector(this,e._EDGE_BUTTON_INNER,e._EDGE_BUTTON_OUTER,-135,135,1,"revert",this.renkan.translate("Cancel deletion"))},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1,this.renderer.isEditable()&&this.source_representation.model.unset("delete_scheduled")}}).value(),f}),define("renderer/miniframe",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({paperShift:function(a){this.renderer.offset=this.renderer.offset.subtract(a.divide(this.renderer.minimap.scale).multiply(this.renderer.scale)),this.renderer.redraw()},mouseup:function(){this.renderer.click_target=null,this.renderer.is_dragging=!1}}).value(),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe"],function(a,b,c,d,e){var f=d.getUtils(),g=function(c){this.renkan=c,this.$=a(".Rk-Render"),this.representations=[],this.$.html(c.options.templates["templates/scene.html"](c)),this.onStatusChange(),this.canvas_$=this.$.find(".Rk-Canvas"),this.labels_$=this.$.find(".Rk-Labels"),this.editor_$=c.options.popup_editor?this.$.find(".Rk-Editor"):a("#"+c.options.editor_panel),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.totalScroll=0,this.hiddenNodes=[],this.mouse_down=!1,this.click_target=null,this.selected_target=null,this.edge_layer=new paper.Layer,this.node_layer=new paper.Layer,this.buttons_layer=new paper.Layer,this.delete_list=[],this.redrawActive=!0,c.options.show_minimap&&(this.minimap={background_layer:new paper.Layer,edge_layer:new paper.Layer,node_layer:new paper.Layer,node_group:new paper.Group,size:new paper.Size(c.options.minimap_width,c.options.minimap_height)},this.minimap.background_layer.activate(),this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle=new paper.Path.Rectangle(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.rectangle.fillColor=c.options.minimap_background_color,this.minimap.rectangle.strokeColor=c.options.minimap_border_color,this.minimap.rectangle.strokeWidth=4,this.minimap.offset=new paper.Point(this.minimap.size.divide(2)),this.minimap.scale=.1,this.minimap.node_layer.activate(),this.minimap.cliprectangle=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.cliprectangle),this.minimap.node_group.clipped=!0,this.minimap.miniframe=new paper.Path.Rectangle(this.minimap.topleft,this.minimap.size),this.minimap.node_group.addChild(this.minimap.miniframe),this.minimap.miniframe.fillColor="#c0c0ff",this.minimap.miniframe.opacity=.3,this.minimap.miniframe.strokeColor="#000080",this.minimap.miniframe.strokeWidth=2,this.minimap.miniframe.__representation=new e(this,null)),this.throttledPaperDraw=b(function(){paper.view.draw()}).throttle(100).value(),this.bundles=[],this.click_mode=!1;var d=this,g=!0,h=1,i=!1,j=0,k=0;this.image_cache={},this.icon_cache={},["edit","remove","hide","show","link","enlarge","shrink","revert"].forEach(function(a){var b=new Image;b.src=c.options.static_url+"img/"+a+".png",d.icon_cache[a]=b});var l=b.throttle(function(a,b){d.onMouseMove(a,b)},f._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),l(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),g&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-_lastTap<f._DOUBLETAP_DELAY&&Math.pow(j-b.pageX,2)+Math.pow(k-b.pageY,2)<f._DOUBLETAP_DISTANCE?(_lastTap=0,d.onDoubleClick(b)):(_lastTap=new Date,j=b.pageX,k=b.pageY,h=d.scale,i=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),_lastTap=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(i||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,i=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*h,c=b/d.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.offset.multiply(c));d.setScale(b,e)}},touchend:function(a){a.preventDefault(),d.onMouseUp(a.originalEvent.changedTouches[0],!0)},dblclick:function(a){a.preventDefault(),c.options.allow_double_click&&d.onDoubleClick(a)},mouseleave:function(a){a.preventDefault(),d.onMouseUp(a,!1),d.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),g=!1},dragleave:function(a){a.preventDefault(),g=!0},drop:function(a){a.preventDefault(),g=!0;var c={};b.each(a.originalEvent.dataTransfer.types,function(b){try{c[b]=a.originalEvent.dataTransfer.getData(b)}catch(d){}});var e=a.originalEvent.dataTransfer.getData("Text");if("string"==typeof e)switch(e[0]){case"{":case"[":try{var f=JSON.parse(e);b.extend(c,f)}catch(h){c["text/plain"]||(c["text/plain"]=e)}break;case"<":c["text/html"]||(c["text/html"]=e);break;default:c["text/plain"]||(c["text/plain"]=e)}var i=a.originalEvent.dataTransfer.getData("URL");i&&!c["text/uri-list"]&&(c["text/uri-list"]=i),d.dropData(c,a.originalEvent)}});var m=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};m(".Rk-ZoomOut","zoomOut"),m(".Rk-ZoomIn","zoomIn"),m(".Rk-ZoomFit","autoScale"),this.$.find(".Rk-ZoomSave").click(function(){d.renkan.project.addView({zoom_level:d.scale,offset:d.offset,hidden_nodes:d.hiddenNodes})}),this.$.find(".Rk-ZoomSetSaved").click(function(){var a=d.renkan.project.get("views").last();a&&(d.setScale(a.get("zoom_level"),new paper.Point(a.get("offset"))),d.hiddenNodes=a.get("hidden_nodes")||[],d.hideNodes())}),this.$.find(".Rk-ShowHiddenNodes").mouseenter(function(){d.showNodes(!0),d.$.find(".Rk-ShowHiddenNodes").mouseleave(function(){d.hideNodes(!1)})}),this.$.find(".Rk-ShowHiddenNodes").click(function(){d.showNodes(!1),d.$.find(".Rk-ShowHiddenNodes").off("mouseleave")}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show(),this.$.find(".Rk-CurrentUser").mouseenter(function(){d.$.find(".Rk-UserList").slideDown()}),this.$.find(".Rk-Users").mouseleave(function(){d.$.find(".Rk-UserList").slideUp()}),m(".Rk-FullScreen-Button","fullScreen"),m(".Rk-AddNode-Button","addNodeBtn"),m(".Rk-AddEdge-Button","addEdgeBtn"),m(".Rk-Save-Button","save"),m(".Rk-Open-Button","open"),m(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+f._BOOKMARKLET_CODE(c)).click(function(){return d.notif_$.text(c.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.")).fadeIn().delay(5e3).fadeOut(),!1}),this.$.find(".Rk-TopBar-Button").mouseover(function(){a(this).find(".Rk-TopBar-Tooltip").show()}).mouseout(function(){a(this).find(".Rk-TopBar-Tooltip").hide()}),m(".Rk-Fold-Bins","foldBins"),paper.view.onResize=function(a){var b,c=a.width,e=a.height;d.minimap&&(d.minimap.topleft=paper.view.bounds.bottomRight.subtract(d.minimap.size),d.minimap.rectangle.fitBounds(d.minimap.topleft.subtract([2,2]),d.minimap.size.add([4,4])),d.minimap.cliprectangle.fitBounds(d.minimap.topleft,d.minimap.size));var f=e/(e-a.delta.height),g=c/(c-a.delta.width);b=c>e?f:g,d.resizeZoom(g,f,b),d.redraw()};var n=b.throttle(function(){d.redraw()},50);this.addRepresentations("Node",this.renkan.project.get("nodes")),this.addRepresentations("Edge",this.renkan.project.get("edges")),this.renkan.project.on("change:title",function(){d.$.find(".Rk-PadTitle").val(c.project.get("title"))}),this.$.find(".Rk-PadTitle").on("keyup input paste",function(){c.project.set({title:a(this).val()})});var o=b.throttle(function(){d.redrawUsers()},100);if(o(),this.renkan.project.on("change:saveStatus",function(){switch(d.renkan.project.get("saveStatus")){case 0:d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("saved");break;case 1:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("saving"),d.$.find(".Rk-Save-Button").addClass("to-save");break;case 2:d.$.find(".Rk-Save-Button").removeClass("saved"),d.$.find(".Rk-Save-Button").removeClass("to-save"),d.$.find(".Rk-Save-Button").addClass("saving")}}),this.renkan.project.on("change:loadingStatus",function(){if(d.renkan.project.get("loadingStatus")){d.$.find(".loader").addClass("run"),setTimeout(function(){d.$.find(".loader").hide(250)},3e3)}}),this.renkan.project.on("add:users remove:users",o),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>0?d.$.find(".Rk-ZoomSetSaved").show():d.$.find(".Rk-ZoomSetSaved").hide()}),this.renkan.project.on("add:nodes",function(a){d.addRepresentation("Node",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||n()}),this.renkan.project.on("change:title",function(a,b){var c=d.$.find(".Rk-PadTitle");c.is("input")?c.val()!==b&&c.val(b):c.text(b)}),c.options.size_bug_fix){var p="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},p)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var q=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),r=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");q.hover(function(a){d.isEditable()&&(a.preventDefault(),r.show())},function(a){a.preventDefault(),r.hide()}),r.find("li").mouseenter(function(b){d.isEditable()&&(b.preventDefault(),d.$.find(".Rk-CurrentUser-Color").css("background",a(this).attr("data-color")))})}if(c.options.show_search_field){var s="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==s)if(s=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var g=f.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){g.test(a.get("title"))||g.test(a.get("description"))?d.getRepresentationByModel(a).highlight(g):d.getRepresentationByModel(a).unhighlight()})}})}this.redraw(),window.setInterval(function(){var a=(new Date).valueOf();d.delete_list.forEach(function(b){if(a>=b.time){var d=c.project.get("nodes").findWhere({delete_scheduled:b.id});d&&project.removeNode(d),d=c.project.get("edges").findWhere({delete_scheduled:b.id}),d&&project.removeEdge(d)}}),d.delete_list=d.delete_list.filter(function(a){return c.project.get("nodes").findWhere({delete_scheduled:a.id})||c.project.get("edges").findWhere({delete_scheduled:a.id})})},500),this.minimap&&window.setInterval(function(){d.rescaleMinimap()},2e3)};return b(g.prototype).extend({fixSize:function(){if(this.renkan.options.default_view&&this.renkan.project.get("views").length>0){var a=this.renkan.project.get("views").last();this.setScale(a.get("zoom_level"),new paper.Point(a.get("offset")))}else this.autoScale()},drawSector:function(b,c,d,e,f,g,h,i){var j=this.renkan.options,k=e*Math.PI/180,l=f*Math.PI/180,m=this.icon_cache[h],n=-Math.sin(k),o=Math.cos(k),p=Math.cos(k)*c+g*n,q=Math.sin(k)*c+g*o,r=Math.cos(k)*d+g*n,s=Math.sin(k)*d+g*o,t=-Math.sin(l),u=Math.cos(l),v=Math.cos(l)*c-g*t,w=Math.sin(l)*c-g*u,x=Math.cos(l)*d-g*t,y=Math.sin(l)*d-g*u,z=(c+d)/2,A=(k+l)/2,B=Math.cos(A)*z,C=Math.sin(A)*z,D=Math.cos(A)*c,E=Math.cos(A)*d,F=Math.sin(A)*c,G=Math.sin(A)*d,H=Math.cos(A)*(d+3),I=Math.sin(A)*(d+j.buttons_label_font_size)+j.buttons_label_font_size/2;this.buttons_layer.activate();var J=new paper.Path;J.add([p,q]),J.arcTo([D,F],[v,w]),J.lineTo([x,y]),J.arcTo([E,G],[r,s]),J.fillColor=j.buttons_background,J.opacity=.5,J.closed=!0,J.__representation=b;var K=new paper.PointText(H,I);K.characterStyle={fontSize:j.buttons_label_font_size,fillColor:j.buttons_label_color},K.paragraphStyle.justification=H>2?"left":-2>H?"right":"center",K.visible=!1;var L=!1,M=new paper.Point(-200,-200),N=new paper.Group([J,K]),O=N.position,P=new paper.Point([B,C]),Q=new paper.Point(0,0);K.content=i,N.pivot=N.bounds.center,N.visible=!1,N.position=M;var R={show:function(){L=!0,N.position=Q.add(O),N.visible=!0},moveTo:function(a){Q=a,L&&(N.position=a.add(O))},hide:function(){L=!1,N.visible=!1,N.position=M},select:function(){J.opacity=.8,K.visible=!0},unselect:function(){J.opacity=.5,K.visible=!1},destroy:function(){N.remove()}},S=function(){var a=new paper.Raster(m);a.position=P.add(N.position).subtract(O),a.locked=!0,N.addChild(a)};return m.width?S():a(m).on("load",S),R},addToBundles:function(a){var c=b(this.bundles).find(function(b){return b.from===a.from_representation&&b.to===a.to_representation||b.from===a.to_representation&&b.to===a.from_representation});return"undefined"!=typeof c?c.edges.push(a):(c={from:a.from_representation,to:a.to_representation,edges:[a],getPosition:function(a){var c=a.from_representation===this.from?1:-1;return c*(b(this.edges).indexOf(a)-(this.edges.length-1)/2)}},this.bundles.push(c)),c},isEditable:function(){return this.renkan.options.editor_mode&&!this.renkan.read_only},onStatusChange:function(){var a=this.$.find(".Rk-Save-Button"),b=a.find(".Rk-TopBar-Tooltip-Contents");this.renkan.read_only?(a.removeClass("disabled Rk-Save-Online").addClass("Rk-Save-ReadOnly"),b.text(this.renkan.translate("Connection lost"))):this.renkan.options.manual_save?(a.removeClass("Rk-Save-ReadOnly Rk-Save-Online"),b.text(this.renkan.translate("Save Project"))):(a.removeClass("disabled Rk-Save-ReadOnly").addClass("Rk-Save-Online"),b.text(this.renkan.translate("Auto-save enabled"))),this.redrawUsers()},setScale:function(a,b){a/this.initialScale>f._MIN_SCALE&&a/this.initialScale<f._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.redraw())},autoScale:function(a){var b=this.renkan.project.get("nodes");if(b.length>1){var c=b.map(function(a){return a.get("position").x}),d=b.map(function(a){return a.get("position").y}),e=Math.min.apply(Math,c),f=Math.min.apply(Math,d),g=Math.max.apply(Math,c),h=Math.max.apply(Math,d),i=Math.min((paper.view.size.width-2*this.renkan.options.autoscale_padding)/(g-e),(paper.view.size.height-2*this.renkan.options.autoscale_padding)/(h-f));this.initialScale=i,"undefined"!=typeof a&&parseFloat(a.zoom_level)>0&&parseFloat(a.offset.x)>0&&parseFloat(a.offset.y)>0?this.setScale(parseFloat(a.zoom_level),new paper.Point(parseFloat(a.offset.x),parseFloat(a.offset.y))):this.setScale(i,paper.view.center.subtract(new paper.Point([(g+e)/2,(h+f)/2]).multiply(i)))}1===b.length&&this.setScale(1,paper.view.center.subtract(new paper.Point([b.at(0).get("position").x,b.at(0).get("position").y])))},redrawMiniframe:function(){var a=this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),b=this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));this.minimap.miniframe.fitBounds(a,b)},rescaleMinimap:function(){var a=this.renkan.project.get("nodes");if(a.length>1){var b=a.map(function(a){return a.get("position").x}),c=a.map(function(a){return a.get("position").y}),d=Math.min.apply(Math,b),e=Math.min.apply(Math,c),f=Math.max.apply(Math,b),g=Math.max.apply(Math,c),h=Math.min(.8*this.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.scale*this.renkan.options.minimap_height/paper.view.bounds.height,(this.renkan.options.minimap_width-2*this.renkan.options.minimap_padding)/(f-d),(this.renkan.options.minimap_height-2*this.renkan.options.minimap_padding)/(g-e));this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([(f+d)/2,(g+e)/2]).multiply(h)),this.minimap.scale=h}1===a.length&&(this.minimap.scale=.1,this.minimap.offset=this.minimap.size.divide(2).subtract(new paper.Point([a.at(0).get("position").x,a.at(0).get("position").y]).multiply(this.minimap.scale))),this.redraw()},toPaperCoords:function(a){return a.multiply(this.scale).add(this.offset)},toMinimapCoords:function(a){return a.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft)},toModelCoords:function(a){return a.subtract(this.offset).divide(this.scale)},addRepresentation:function(a,b){var c=d.getRenderer()[a],e=new c(this,b);return this.representations.push(e),e},addRepresentations:function(a,b){var c=this;b.forEach(function(b){c.addRepresentation(a,b)})},userTemplate:b.template('<li class="Rk-User"><span class="Rk-UserColor" style="background:<%=background%>;"></span><%=name%></li>'),redrawUsers:function(){if(this.renkan.options.show_user_list){var b=[].concat((this.renkan.project.current_user_list||{}).models||[],(this.renkan.project.get("users")||{}).models||[]),c="",d=this.$.find(".Rk-Users"),e=d.find(".Rk-CurrentUser-Name"),f=d.find(".Rk-Edit-ColorPicker li"),g=d.find(".Rk-CurrentUser-Color"),h=this;e.off("click").text(this.renkan.translate("<unknown user>")),f.off("mouseleave click"),b.forEach(function(b){b.get("_id")===h.renkan.current_user?(e.text(b.get("title")),g.css("background",b.get("color")),h.isEditable()&&(h.renkan.options.user_name_editable&&e.click(function(){var c=a(this),d=a("<input>").val(b.get("title")).blur(function(){b.set("title",a(this).val()),h.redrawUsers(),h.redraw()});c.empty().html(d),d.select()}),h.renkan.options.user_color_editable&&f.click(function(c){c.preventDefault(),h.isEditable()&&b.set("color",a(this).attr("data-color")),a(this).parent().hide()}).mouseleave(function(){g.css("background",b.get("color"))}))):c+=h.userTemplate({name:b.get("title"),background:b.get("color")})}),d.find(".Rk-UserList").html(c)}},removeRepresentation:function(a){a.destroy(),this.representations=b.reject(this.representations,function(b){return b===a})},getRepresentationByModel:function(a){return a?b.find(this.representations,function(b){return b.model===a}):void 0},removeRepresentationsOfType:function(a){var c=b.filter(this.representations,function(b){return b.type===a}),d=this;b.each(c,function(a){d.removeRepresentation(a)})},highlightModel:function(a){var b=this.getRepresentationByModel(a);b&&b.highlight()},unhighlightAll:function(){b.each(this.representations,function(a){a.unhighlight()})},unselectAll:function(){b.each(this.representations,function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b.each(this.representations,function(a){a.redraw({dontRedrawEdges:!0})}),this.minimap&&this.redrawMiniframe(),paper.view.draw())},addTempEdge:function(a,b){var c=this.addRepresentation("TempEdge",null);c.end_pos=b,c.from_representation=a,c.redraw(),this.click_target=c},addHiddenNode:function(a){this.hideNode(a),this.hiddenNodes.push(a.id)},hideNode:function(a){var b=this;"undefined"!=typeof b.getRepresentationByModel(a)&&b.getRepresentationByModel(a).hide()},hideNodes:function(){var a=this;this.hiddenNodes.forEach(function(b,c){var d=a.renkan.project.get("nodes").get(b);return"undefined"!=typeof d?a.hideNode(a.renkan.project.get("nodes").get(b)):void a.hiddenNodes.splice(c,1)}),paper.view.draw()},showNodes:function(a){var b=this;this.hiddenNodes.forEach(function(c){b.getRepresentationByModel(b.renkan.project.get("nodes").get(c)).show(a)}),a||(this.hiddenNodes=[]),paper.view.draw()},findTarget:function(a){if(a&&"undefined"!=typeof a.item.__representation){var b=a.item.__representation;this.selected_target!==a.item.__representation&&(this.selected_target&&this.selected_target.unselect(b),b.select(this.selected_target),this.selected_target=b)}else this.selected_target&&this.selected_target.unselect(),this.selected_target=null},paperShift:function(a){this.offset=this.offset.add(a),this.redraw()},onMouseMove:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=c.subtract(this.last_point);this.last_point=c,!this.is_dragging&&this.mouse_down&&d.length>f._MIN_DRAG_DISTANCE&&(this.is_dragging=!0);var e=paper.project.hitTest(c);this.is_dragging?this.click_target&&"function"==typeof this.click_target.paperShift?this.click_target.paperShift(d):this.paperShift(d):this.findTarget(e),paper.view.draw()},onMouseDown:function(b,c){var d=this.canvas_$.offset(),e=new paper.Point([b.pageX-d.left,b.pageY-d.top]);if(this.last_point=e,this.mouse_down=!0,!this.click_target||"Temp-edge"!==this.click_target.type){this.removeRepresentationsOfType("editor"),this.is_dragging=!1;var g=paper.project.hitTest(e);if(g&&"undefined"!=typeof g.item.__representation)this.click_target=g.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===f._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}};_node=this.renkan.project.addNode(i),this.getRepresentationByModel(_node).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===f._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=f._CLICKMODE_ENDEDGE,this.notif_$.fadeOut(function(){a(this).html(this.renkan.translate("Click on a second node to complete the edge")).fadeIn()})):(this.notif_$.hide(),this.click_mode=!1)),paper.view.draw()},onMouseUp:function(a,b){if(this.mouse_down=!1,this.click_target){var c=this.canvas_$.offset();this.click_target.mouseup({point:new paper.Point([a.pageX-c.left,a.pageY-c.top])},b)}else this.click_target=null,this.is_dragging=!1,b&&this.unselectAll();paper.view.draw()},onScroll:function(a,b){if(this.totalScroll+=b,Math.abs(this.totalScroll)>=1){var c=this.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]).subtract(this.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.setScale(this.scale*Math.SQRT2,this.offset.subtract(d)):this.setScale(this.scale*Math.SQRT1_2,this.offset.add(d.divide(Math.SQRT2))),this.totalScroll=0}},onDoubleClick:function(a){var b=this.canvas_$.offset(),c=new paper.Point([a.pageX-b.left,a.pageY-b.top]),d=paper.project.hitTest(c);if(!this.isEditable())return void(d&&"undefined"!=typeof d.item.__representation&&d.item.__representation.model.get("uri")&&window.open(d.item.__representation.model.get("uri"),"_blank"));if(this.isEditable()&&(!d||"undefined"==typeof d.item.__representation)){var e=this.toModelCoords(c),g={id:f.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(g);this.getRepresentationByModel(h).openEditor()}paper.view.draw()},defaultDropHandler:function(b){var c={},d="";switch(b["text/x-iri-specific-site"]){case"twitter":d=a("<div>").html(b["text/x-iri-selected-html"]);var e=d.find(".tweet");
+c.title=this.renkan.translate("Tweet by ")+e.attr("data-name"),c.uri="http://twitter.com/"+e.attr("data-screen-name")+"/status/"+e.attr("data-tweet-id"),c.image=e.find(".avatar").attr("src"),c.description=e.find(".js-tweet-text:first").text();break;case"google":d=a("<div>").html(b["text/x-iri-selected-html"]),c.title=d.find("h3:first").text().trim(),c.uri=d.find("h3 a").attr("href"),c.description=d.find(".st:first").text().trim();break;default:b["text/x-iri-source-uri"]&&(c.uri=b["text/x-iri-source-uri"])}if((b["text/plain"]||b["text/x-iri-selected-text"])&&(c.description=(b["text/plain"]||b["text/x-iri-selected-text"]).replace(/[\s\n]+/gm," ").trim()),b["text/html"]||b["text/x-iri-selected-html"]){d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]);var f=d.find("image");f.length&&(c.image=f.attr("xlink:href"));var g=d.find("path");g.length&&(c.clipPath=g.attr("d"));var h=d.find("img");h.length&&(c.image=h[0].src);var i=d.find("a");i.length&&(c.uri=i[0].href),c.title=d.find("[title]").attr("title")||c.title,c.description=d.text().replace(/[\s\n]+/gm," ").trim()}b["text/uri-list"]&&(c.uri=b["text/uri-list"]),b["text/x-moz-url"]&&!c.title&&(c.title=(b["text/x-moz-url"].split("\n")[1]||"").trim(),c.title===c.uri&&(c.title=!1)),b["text/x-iri-source-title"]&&!c.title&&(c.title=b["text/x-iri-source-title"]),(b["text/html"]||b["text/x-iri-selected-html"])&&(d=a("<div>").html(b["text/html"]||b["text/x-iri-selected-html"]),c.image=d.find("[data-image]").attr("data-image")||c.image,c.uri=d.find("[data-uri]").attr("data-uri")||c.uri,c.title=d.find("[data-title]").attr("data-title")||c.title,c.description=d.find("[data-description]").attr("data-description")||c.description,c.clipPath=d.find("[data-clip-path]").attr("data-clip-path")||c.clipPath),c.title||(c.title=this.renkan.translate("Dragged resource"));for(var j=["title","description","uri","image"],k=0;k<j.length;k++){var l=j[k];(b["text/x-iri-"+l]||b[l])&&(c[l]=b["text/x-iri-"+l]||b[l]),("none"===c[l]||"null"===c[l])&&(c[l]=void 0)}return"function"==typeof this.renkan.options.drop_enhancer&&(c=this.renkan.options.drop_enhancer(c,b)),c},dropData:function(a,c){if(this.isEditable()){if(a["text/json"]||a["application/json"])try{var d=JSON.parse(a["text/json"]||a["application/json"]);b.extend(a,d)}catch(e){}var g="undefined"==typeof this.renkan.options.drop_handler?this.defaultDropHandler(a):this.renkan.options.drop_handler(a),h=this.canvas_$.offset(),i=new paper.Point([c.pageX-h.left,c.pageY-h.top]),j=this.toModelCoords(i),k={id:f.getUID("node"),created_by:this.renkan.current_user,uri:g.uri||"",title:g.title||"",description:g.description||"",image:g.image||"",color:g.color||void 0,clip_path:g.clipPath||void 0,position:{x:j.x,y:j.y}},l=this.renkan.project.addNode(k),m=this.getRepresentationByModel(l);"drop"===c.type&&m.openEditor()}},fullScreen:function(){var a,b=document.fullScreen||document.mozFullScreen||document.webkitIsFullScreen,c=this.renkan.$[0],d=["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],e=["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"];if(b){for(a=0;a<e.length;a++)if("function"==typeof document[e[a]]){document[e[a]]();break}var f=this.$.width(),g=this.$.height();this.renkan.options.show_top_bar&&(g-=this.$.find(".Rk-TopBar").height()),this.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(f-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([f,g])}else{for(a=0;a<d.length;a++)if("function"==typeof c[d[a]]){c[d[a]]();break}this.redraw()}},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT1_2)).add(this.offset.multiply(Math.SQRT1_2));this.setScale(a,b)},zoomIn:function(){var a=this.scale*Math.SQRT2,b=new paper.Point([this.canvas_$.width(),this.canvas_$.height()]).multiply(.5*(1-Math.SQRT2)).add(this.offset.multiply(Math.SQRT2));this.setScale(a,b)},resizeZoom:function(a,b,c){var d=this.scale*c,e=new paper.Point([this.offset.x*a,this.offset.y*b]);this.setScale(d,e)},addNodeBtn:function(){return this.click_mode===f._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_ADDNODE,this.notif_$.text(this.renkan.translate("Click on the background canvas to add a node")).fadeIn()),!1},addEdgeBtn:function(){return this.click_mode===f._CLICKMODE_STARTEDGE||this.click_mode===f._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=f._CLICKMODE_STARTEDGE,this.notif_$.text(this.renkan.translate("Click on a first node to start the edge")).fadeIn()),!1},exportProject:function(){var a=this.renkan.project.toJSON(),d=(document.createElement("a"),a.id),e=d+".json";delete a.id,delete a._id,delete a.space_id;var g,h={};b.each(a.nodes,function(a){g=a.id||a._id,delete a._id,delete a.id,h[g]=a["@id"]=f.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=h[a.to],a.from=h[a.from]}),b.each(a.views,function(a){g=a.id||a._id,delete a._id,delete a.id}),a.users=[];var i=JSON.stringify(a,null,2),j=new Blob([i],{type:"application/json;charset=utf-8"});c(j,e)},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=this,e=d.canvas_$.width();c.position().left<0?(c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e-c.width()<c.height()?e:e-c.width(),b.html("«")):(c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=d.$.width();paper.view.viewSize=new paper.Size([a,d.canvas_$.height()])}),a=e+300,b.html("»")),d.resizeZoom(1,1,a/e)},save:function(){},open:function(){}}).value(),g}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils"}}),require(["renderer/baserepresentation","renderer/basebutton","renderer/noderepr","renderer/edge","renderer/tempedge","renderer/baseeditor","renderer/nodeeditor","renderer/edgeeditor","renderer/nodebutton","renderer/nodeeditbutton","renderer/noderemovebutton","renderer/nodehidebutton","renderer/nodeshowbutton","renderer/noderevertbutton","renderer/nodelinkbutton","renderer/nodeenlargebutton","renderer/nodeshrinkbutton","renderer/edgeeditbutton","renderer/edgeremovebutton","renderer/edgerevertbutton","renderer/miniframe","renderer/scene"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v){var w=window.Rkns;"undefined"==typeof w.Renderer&&(w.Renderer={});var x=w.Renderer;x._BaseRepresentation=a,x._BaseButton=b,x.Node=c,x.Edge=d,x.TempEdge=e,x._BaseEditor=f,x.NodeEditor=g,x.EdgeEditor=h,x._NodeButton=i,x.NodeEditButton=j,x.NodeRemoveButton=k,x.NodeHideButton=l,x.NodeShowButton=m,x.NodeRevertButton=n,x.NodeLinkButton=o,x.NodeEnlargeButton=p,x.NodeShrinkButton=q,x.EdgeEditButton=r,x.EdgeRemoveButton=s,x.EdgeRevertButton=t,x.MiniFrame=u,x.Scene=v,startRenkan()}),define("main-renderer",function(){});
//# sourceMappingURL=renkan.min.map
\ No newline at end of file
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map Wed Jun 03 19:16:58 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map Thu Jun 04 10:04:01 2015 +0200
@@ -1,1 +1,1 @@
-{"version":3,"file":"renkan.min.js","sources":["templates.js","../../js/main.js","../../js/dataloader.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":["this","obj","__t","__p","_","escape","__e","Array","prototype","join","renkan","translate","edge","title","options","show_edge_editor_uri","uri","properties","length","each","ontology","label","property","show_edge_editor_style","show_edge_editor_style_color","show_edge_editor_style_dash","dash","show_edge_editor_style_thickness","thickness","show_edge_editor_style_arrow","arrow","show_edge_editor_direction","show_edge_editor_nodes","from_color","shortenText","from_title","to_title","show_edge_editor_creator","has_creator","created_by_title","show_edge_tooltip_color","color","show_edge_tooltip_uri","short_uri","description","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","static_url","url","show_bins","show_editor","node","show_node_editor_uri","show_node_editor_description","show_node_editor_size","size","show_node_editor_style","show_node_editor_style_color","show_node_editor_style_dash","show_node_editor_style_thickness","show_node_editor_image","image_placeholder","clip_path","allow_image_upload","show_node_editor_creator","change_shapes","shapes","shape","charAt","toUpperCase","substring","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","print","__j","call","arguments","show_top_bar","editor_mode","project","get","show_user_list","show_user_color","user_color_editable","colorPicker","home_button_url","home_button_title","show_fullscreen_button","show_addnode_button","show_addedge_button","show_export_button","show_save_button","show_open_button","show_bookmarklet","show_search_field","resize","show_zoom","save_view","root","$","jQuery","pickerColors","__renkans","_BaseBin","_renkan","_opts","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","html","click","destroy","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","detach","Renkan","push","defaults","templates","renkanJST","template","property_files","f","getJSON","data","concat","read_only","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","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","where","_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","lastsearch","lastval","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","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","slice","_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","default_user_color","_BOOKMARKLET_CODE","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","converters","from1to2","len","nodes","console","log","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","Backbone","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","prepare","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","hidden","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","views","_item","t","version","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","manual_save","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","default_view","user_name_editable","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","default_dash_array","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","node_stroke_max_width","selected_node_stroke_width","selected_node_stroke_max_width","node_stroke_witdh_scale","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","edge_stroke_width","edge_stroke_max_width","selected_edge_stroke_width","selected_edge_stroke_max_width","edge_stroke_witdh_scale","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_arrow_max_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","uploaded_image_max_kb","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:","Dash:","Thickness:","Arrow:","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","Cloud","Triangle","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","loadingStatus","_data","saveStatus","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","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","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","change","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","value","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","cloud_path","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","SQRT2","rotate","star","cloud","path","scale","triangle","svg","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","_getStrokeWidth","has","_getSelectedStrokeWidth","changed","shapeBuilder","sendToBack","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","forEach","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_strokeWidth","_color","_dash","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","dontRedrawEdges","ed","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","insertAbove","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","hideButtons","buttons_timeout","undefined","textToReplace","hlvalue","throttledPaperDraw","saveCoords","toModelCoords","_event","_isTouch","unselectAll","click_target","edge_layer","bundle","addToBundles","line","arrow_scale","pivot","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_getArrowScale","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","array_opacity","handleIn","handleOut","bounds","_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","keys","closeEditor","onFieldChange","assign","keyCode","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","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","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","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","_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","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,KAAgB,UAAIA,KAAgB,cAEpCA,KAAgB,UAAE,8BAAgC,SAASC,KAC3DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,EAAUC,GAAEC,OAC3B,KAAMJ,IACNE,KAAO,oBACS,OAAdD,IAAM,GAAe,GAAKA,KAC5B,yBACgB,OAAdA,IAAM,GAAe,GAAKA,KAC5B,SAGA,OAAOC,MAGPH,KAAgB,UAAE,6BAA+B,SAASC,KAC1DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,GAAIG,IAAMF,EAAEC,MAAcE,OAAMC,UAAUC,KAEzD,KAAMR,IACNE,KAAO,mDACPG,IAAII,OAAOC,UAAU,cACrB,mCACAL,IAAII,OAAOC,UAAU,WACrB,iEACAL,IAAIM,KAAKC,OACT,eACKC,QAAQC,uBACbZ,KAAO,6BACPG,IAAII,OAAOC,UAAU,SACrB,mEACAL,IAAIM,KAAKI,KACT,+CACAV,IAAIM,KAAKI,KACT,yCACKF,QAAQG,WAAWC,SACxBf,KAAO,qCACPG,IAAII,OAAOC,UAAU,4BACrB,8EACCP,EAAEe,KAAKL,QAAQG,WAAY,SAASG,GACrCjB,KAAO,qGACPG,IAAKI,OAAOC,UAAUS,EAASC,QAC/B,wDACCjB,EAAEe,KAAKC,EAASH,WAAY,SAASK,GAAY,GAAIN,GAAMI,EAAS,YAAcE,EAASN,GAC5Fb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AAO,gBAAiB","sourcesContent":["this[\"renkanJST\"] = this[\"renkanJST\"] || {};\n\nthis[\"renkanJST\"][\"templates/colorpicker.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li data-color=\"' +\n((__t = (c)) == null ? '' : __t) +\n'\" style=\"background: ' +\n((__t = (c)) == null ? '' : __t) +\n'\"></li>';\n\n}\nreturn __p\n};\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 <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Edge\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(edge.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n ';\n if (options.properties.length) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose from vocabulary:\")) +\n'</label>\\n <select class=\"Rk-Edit-Vocabulary\">\\n ';\n _.each(options.properties, function(ontology) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Class\" value=\"\">\\n ' +\n__e( renkan.translate(ontology.label) ) +\n'\\n </option>\\n ';\n _.each(ontology.properties, function(property) { var uri = ontology[\"base-uri\"] + property.uri; ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( uri ) +\n'\"\\n ';\n if (uri === edge.uri) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(property.label) ) +\n'\\n </option>\\n ';\n }) ;\n__p += '\\n ';\n }) ;\n__p += '\\n </select>\\n </p>\\n';\n } } ;\n__p += '\\n';\n if (options.show_edge_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_edge_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Edge color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: <%-edge.color%>;\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( edge.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e( edge.thickness ) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_arrow) { ;\n__p += '\\n <div id=\"Rk-Editor-p-arrow\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Arrow:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Arrow\" class=\"Rk-Edit-Arrow\" ' +\n__e( edge.arrow ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_direction) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Edit-Direction\">' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'</span>\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(edge.from_color) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: >%-edge.to_color%>;\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: <%-edge.created_by_color%>;\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.color ) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (edge.uri) { ;\n__p += '\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' </a> ';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">' +\n__e( edge.short_uri ) +\n'</a>\\n </p>\\n';\n } ;\n__p += '\\n<p>' +\n__e(edge.description) +\n'</p>\\n';\n if (options.show_edge_tooltip_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.from_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.to_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_tooltip_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.created_by_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +\n'\"\\n data-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/search/?search=' +\n((__t = (encodedtitle)) == null ? '' : __t) +\n'&field=all\"\\n data-title=\"' +\n__e(title) +\n'\" data-description=\"Tag \\'' +\n__e(title) +\n'\\'\">\\n\\n <img class=\"Rk-Ldt-Tag-Icon\" src=\"' +\n__e(static_url) +\n'img/ldt-tag.png\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/list-bin.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n ';\n if (image) { ;\n__p += '\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n ';\n } else { ;\n__p += '\\n data-image=\"\"\\n ';\n } ;\n__p += '\\n>';\n if (image) { ;\n__p += '\\n <img class=\"Rk-ResourceList-Image\" src=\"' +\n__e(image) +\n'\" />\\n';\n } ;\n__p += '\\n<h4 class=\"Rk-ResourceList-Title\">\\n ';\n if (url) { ;\n__p += '\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '</a>';\n } ;\n__p += '\\n </h4>\\n ';\n if (description) { ;\n__p += '\\n <p class=\"Rk-ResourceList-Description\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n ';\n } ;\n__p += '\\n ';\n if (image) { ;\n__p += '\\n <div style=\"clear: both;\"></div>\\n ';\n } ;\n__p += '\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/main.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_bins) { ;\n__p += '\\n <div class=\"Rk-Bins\">\\n <div class=\"Rk-Bins-Head\">\\n <h2 class=\"Rk-Bins-Title\">' +\n__e( translate(\"Select contents:\")) +\n'</h2>\\n <form class=\"Rk-Web-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n <div class=\"Rk-Search-Select\">\\n <div class=\"Rk-Search-Current\"></div>\\n <ul class=\"Rk-Search-List\"></ul>\\n </div>\\n <input type=\"submit\" value=\"\"\\n class=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n </form>\\n <form class=\"Rk-Bins-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search in Bins') ) +\n'\" /> <input\\n type=\"submit\" value=\"\"\\n class=\"Rk-Bins-Search-Submit Rk-Search-Submit\"\\n title=\"' +\n__e( translate('Search in Bins') ) +\n'\" />\\n </form>\\n </div>\\n <ul class=\"Rk-Bin-List\"></ul>\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_editor) { ;\n__p += '\\n <div class=\"Rk-Render Rk-Render-';\n if (options.show_bins) { ;\n__p += 'Panel';\n } else { ;\n__p += 'Full';\n } ;\n__p += '\"></div>\\n';\n } ;\n__p += '\\n';\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\n //TODO: change class to id ;\n__p += '\\n<h2>\\n <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Node\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(node.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_description) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Description:\")) +\n'</label>\\n <textarea class=\"Rk-Edit-Description\">' +\n__e(node.description) +\n'</textarea>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_size) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Size:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Size-Value\">' +\n__e(node.size) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Up\">+</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_node_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">\\n ' +\n__e(renkan.translate(\"Node color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: ' +\n__e(node.color) +\n';\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( node.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e(node.thickness) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_image) { ;\n__p += '\\n <div class=\"Rk-Edit-ImgWrap\">\\n <div class=\"Rk-Edit-ImgPreview\">\\n <img src=\"' +\n__e(node.image || node.image_placeholder) +\n'\" />\\n ';\n if (node.clip_path) { ;\n__p += '\\n <svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\">\\n <path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"' +\n__e( node.clip_path ) +\n'\" />\\n </svg>\\n ';\n };\n__p += '\\n </div>\\n </div>\\n <p>\\n <label>' +\n__e(renkan.translate(\"Image URL:\")) +\n'</label>\\n <div>\\n <a class=\"Rk-Edit-Image-Del\" href=\"#\"></a>\\n <input class=\"Rk-Edit-Image\" type=\"text\" value=\\'' +\n__e(node.image) +\n'\\' />\\n </div>\\n </p>\\n';\n if (options.allow_image_upload) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose Image File:\")) +\n'</label>\\n <input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\" />\\n </p>\\n';\n };\n\n } ;\n__p += ' ';\n if (options.show_node_editor_creator && node.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.change_shapes) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Shapes available\")) +\n':</label>\\n <select class=\"Rk-Edit-Shape\">\\n ';\n _.each(shapes, function(shape) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( shape ) +\n'\"';\n if (node.shape === shape) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(shape.charAt(0).toUpperCase() + shape.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.color) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (node.uri) { ;\n__p += '\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '</a>';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">' +\n__e(node.short_uri) +\n'</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_tooltip_description) { ;\n__p += '\\n <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 <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 <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </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 <div class=\"Rk-TopBar\">\\n <div class=\"loader\"></div>\\n ';\n if (!options.editor_mode) { ;\n__p += '\\n <h2 class=\"Rk-PadTitle\">\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n </h2>\\n ';\n } else { ;\n__p += '\\n <input type=\"text\" class=\"Rk-PadTitle\" value=\"' +\n__e( project.get('title') || '' ) +\n'\" placeholder=\"' +\n__e(translate('Untitled project')) +\n'\" />\\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n <div class=\"Rk-Users\">\\n <div class=\"Rk-CurrentUser\">\\n ';\n if (options.show_user_color) { ;\n__p += '\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-CurrentUser-Color\">\\n ';\n if (options.user_color_editable) { ;\n__p += '\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n ';\n } ;\n__p += '\\n </span>\\n ';\n if (options.user_color_editable) { print(colorPicker) } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-CurrentUser-Name\"><unknown user></span>\\n </div>\\n <ul class=\"Rk-UserList\"></ul>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.home_button_url) {;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"' +\n__e( options.home_button_url ) +\n'\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e( translate(options.home_button_title) ) +\n'\\n </div>\\n </div>\\n </a>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_fullscreen_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-FullScreen-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Full Screen\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.editor_mode) { ;\n__p += '\\n ';\n if (options.show_addnode_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddNode-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Node\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_addedge_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddEdge-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Edge\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_save_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Save-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\"></div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_open_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Open-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Open Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_bookmarklet) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")) +\n'\\n </div>\\n </div>\\n </a>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n } else { ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n }; ;\n__p += '\\n ';\n if (options.show_search_field) { ;\n__p += '\\n <form action=\"#\" class=\"Rk-GraphSearch-Form\">\\n <input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"' +\n__e( translate('Search in graph') ) +\n'\" />\\n </form>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n </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 <div class=\"Rk-Labels\"></div>\\n <canvas class=\"Rk-Canvas\" ';\n if (options.resize) { ;\n__p += ' resize=\"\" ';\n } ;\n__p += '></canvas>\\n <div class=\"Rk-Notifications\"></div>\\n <div class=\"Rk-Editor\">\\n ';\n if (options.show_bins) { ;\n__p += '\\n <div class=\"Rk-Fold-Bins\">«</div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_zoom) { ;\n__p += '\\n <div class=\"Rk-ZoomButtons\">\\n <div class=\"Rk-ZoomIn\" title=\"' +\n__e(translate('Zoom In')) +\n'\"></div>\\n <div class=\"Rk-ZoomFit\" title=\"' +\n__e(translate('Zoom Fit')) +\n'\"></div>\\n <div class=\"Rk-ZoomOut\" title=\"' +\n__e(translate('Zoom Out')) +\n'\"></div>\\n ';\n if (options.editor_mode && options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSave\" title=\"' +\n__e(translate('Zoom Save')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n ';\n if (options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSetSaved\" title=\"' +\n__e(translate('View saved zoom')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n</div>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/search.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"' +\n((__t = ( className )) == null ? '' : __t) +\n'\" data-key=\"' +\n((__t = ( key )) == null ? '' : __t) +\n'\">' +\n((__t = ( title )) == null ? '' : __t) +\n'</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/wikipedia-bin/resulttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"Wikipedia: ' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL( static_url + 'img/wikipedia.png' ) ) +\n'\">\\n\\n <img class=\"Rk-Wikipedia-Icon\" src=\"' +\n__e(static_url) +\n'img/wikipedia.png\">\\n <h4 class=\"Rk-Wikipedia-Title\">\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">' +\n((__t = (htitle)) == null ? '' : __t) +\n'</a>\\n </h4>\\n <p class=\"Rk-Wikipedia-Snippet\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n</li>\\n';\n\n}\nreturn __p\n};","/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n \"use strict\";\n\n if (typeof root.Rkns !== \"object\") {\n root.Rkns = {};\n }\n\n var Rkns = root.Rkns;\n var $ = Rkns.$ = root.jQuery;\n var _ = Rkns._ = root._;\n\n Rkns.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 ];\n\n Rkns.__renkans = [];\n\n var _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\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).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 = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<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 = _path.segments[7].point = _coords.add([_isLeft * _xmargin, 0]);\n _path.segments[1].point.x = _path.segments[2].point.x = _path.segments[5].point.x = _path.segments[6].point.x = _left;\n _path.segments[3].point.x = _path.segments[4].point.x = _right;\n _path.segments[2].point.y = _path.segments[3].point.y = _top;\n _path.segments[4].point.y = _path.segments[5].point.y = _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 // from http://stackoverflow.com/a/6444043\n increaseBrightness: function (hex, percent){\n // strip the leading # if it's there\n hex = hex.replace(/^\\s*#|\\s*$/g, '');\n\n // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`\n if(hex.length === 3){\n hex = hex.replace(/(.)/g, '$1$1');\n }\n\n var r = parseInt(hex.substr(0, 2), 16),\n g = parseInt(hex.substr(2, 2), 16),\n b = parseInt(hex.substr(4, 2), 16);\n\n return '#' +\n ((0|(1<<8) + r + (256 - r) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + g + (256 - g) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + b + (256 - b) * percent / 100).toString(16)).substr(1);\n }\n };\n})(window);\n\n/* END main.js */\n","(function(root) {\n\n \"use strict\";\n\n var DataLoader = root.Rkns.DataLoader = {\n converters: {\n from1to2: function(data) {\n\n var i, len;\n if(typeof data.nodes !== 'undefined') {\n for(i=0, len=data.nodes.length; i<len; i++) {\n var node = data.nodes[i];\n if(node.color) {\n console.log(\"node color : \", node.color);\n node.style = {\n color: node.color,\n };\n }\n else {\n node.style = {};\n }\n }\n }\n if(typeof data.edges !== 'undefined') {\n for(i=0, len=data.edges.length; i<len; i++) {\n var edge = data.edges[i];\n if(edge.color) {\n edge.style = {\n color: edge.color,\n };\n }\n else {\n edge.style = {};\n }\n }\n }\n\n data.schema_version = \"2\";\n\n return data;\n },\n }\n };\n\n\n DataLoader.Loader = function(project, options) {\n this.project = project;\n this.dataConverters = _.defaults(options.converters || {}, DataLoader.converters);\n };\n\n\n DataLoader.Loader.prototype.convert = function(data) {\n var schemaVersionFrom = this.project.getSchemaVersion(data);\n var schemaVersionTo = this.project.getSchemaVersion();\n\n if (schemaVersionFrom !== schemaVersionTo) {\n var converterName = \"from\" + schemaVersionFrom + \"to\" + schemaVersionTo;\n if (typeof this.dataConverters[converterName] === 'function') {\n console.log(\"Apply conversion function :\", converterName);\n data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n console.log(data);\n this.project.set(this.convert(data), {\n validate: true\n });\n };\n\n})(window);\n","(function(root) {\n \"use strict\";\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 style : this.get(\"style\"),\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 type : this.get(\"type\"),\n hidden : this.get(\"hidden\")\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 style : this.get(\"style\"),\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 schema_version : \"2\",\n type : \"project\",\n blacklist : [ 'saveStatus', 'loadingStatus'],\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 _.each(\n [].concat(options.users, options.nodes, options.edges,options.views),\n function(_item) {\n if (_item) {\n _item.project = _project;\n }\n }\n );\n },\n getSchemaVersion : function(data) {\n var t = data;\n if(typeof(t) === \"undefined\") {\n t = this;\n }\n var version = t.schema_version;\n if(!version) {\n return 1;\n }\n else {\n return version;\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})(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 default_dash_array : [4, 5],\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 node_stroke_max_width: 12,\n selected_node_stroke_width: 4,\n selected_node_stroke_max_width: 24,\n node_stroke_witdh_scale: 5,\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 edge_stroke_max_width: 12,\n selected_edge_stroke_width: 4,\n selected_edge_stroke_max_width: 24,\n edge_stroke_witdh_scale: 5,\n\n edge_label_distance: 0,\n edge_label_max_length: 20,\n edge_arrow_length: 18,\n edge_arrow_width: 12,\n edge_arrow_max_width: 32,\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_style: true,\n show_node_editor_style_color: true,\n show_node_editor_style_dash: true,\n show_node_editor_style_thickness: 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_style: true,\n show_edge_editor_style_color: true,\n show_edge_editor_style_dash: true,\n show_edge_editor_style_thickness: true,\n show_edge_editor_style_arrow: 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 \"Dash:\": \"Point. :\",\n \"Thickness:\": \"Epaisseur :\",\n \"Arrow:\": \"Flèche :\",\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 \"Cloud\": \"Nuage\",\n \"Triangle\": \"Triangle\",\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 loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\n _renkan.renderer.redrawActive = true;\n _renkan.renderer.fixSize();\n });\n };\n var _save = function() {\n _proj.set({\n saveStatus : 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 saveStatus : 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('saveStatus'))) {\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({loadingStatus:true});\n },\n success: function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({loadingStatus:false});\n _proj.set({saveStatus:0});\n _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({saveStatus:2});\n },\n success: function(data, textStatus, jqXHR) {\n $(window).off(\"beforeunload\", _onLeave);\n _saveWarn = false;\n _proj.set({saveStatus: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({saveStatus:1});\n\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('saveStatus'))) {\n\t \t\t_checkLeave();\n\t \t}\n\t });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('saveStatus'))) {\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 _.map(_this.data.tags,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 _.map(_this.data.annotations,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 _.each(this.data.objects,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 = renkanJST['templates/list-bin.html'];\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._.each(this.data,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 = renkanJST['templates/wikipedia-bin/resulttemplate.html'];\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._.each(this.data.query.search, 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({change: true});\n };\n this._removeBinding = function() {\n _renderer.removeRepresentation(_this);\n _.defer(function() {\n _renderer.redraw();\n });\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 }).value();\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 }).value();\n\n return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n \n\n var cloud_path = \"M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z\";\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(center, 6, radius);\n }\n },\n \"diamond\":{\n getShape: function() {\n var d = new paper.Path.Rectangle([-Math.SQRT2, -Math.SQRT2], [Math.SQRT2, Math.SQRT2]);\n d.rotate(45);\n return d;\n },\n getImageShape: function(center, radius) {\n var d = new paper.Path.Rectangle([-radius*Math.SQRT2/2, -radius*Math.SQRT2/2], [radius*Math.SQRT2, radius*Math.SQRT2]);\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(center, 8, radius*1, radius*0.7);\n }\n },\n \"cloud\": {\n getShape: function() {\n var path = new paper.Path(cloud_path);\n return path;\n\n },\n getImageShape: function(center, radius) {\n var path = new paper.Path(cloud_path);\n path.scale(radius);\n path.translate(center);\n return path;\n }\n },\n \"triangle\": {\n getShape: function() {\n return new paper.Path.RegularPolygon([0,0], 3, 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.RegularPolygon(center, 3, radius);\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(shape === null || 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 ShapeBuilder.builders = builders;\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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.node_stroke_width + (thickness-1) * (this.options.node_stroke_max_width - this.options.node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_node_stroke_width + (thickness-1) * (this.options.selected_node_stroke_max_width - this.options.selected_node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n buildShape: function(){\n if( 'shape' in this.model.changed ) {\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.circle.sendToBack();\n this.last_circle_radius = 1;\n },\n redraw: function(options) {\n if( 'shape' in this.model.changed && 'change' in options && options.change ) {\n //if( 'shape' in this.model.changed ) {\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 var _strokeWidth = this._getStrokeWidth();\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 + 0.5*_strokeWidth,\n opacity: opacity\n });\n var _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null;\n this.circle.strokeWidth = _strokeWidth;\n this.circle.strokeColor = _color;\n this.circle.dashArray = _dash;\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 if(this.circle) {\n this.circle.sendToBack();\n }\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 (typeof options === 'undefined' || !('dontRedrawEdges' in options) || !options.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.node_image.insertAbove(this.circle);\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._getSelectedStrokeWidth();\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._getStrokeWidth();\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 }).value();\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_scale = 1;\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.pivot = new paper.Point([ this.options.edge_arrow_length / 2, this.options.edge_arrow_width / 2 ]);\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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.edge_stroke_width + (thickness-1) * (this.options.edge_stroke_max_width - this.options.edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_edge_stroke_width + (thickness-1) * (this.options.selected_edge_stroke_max_width - this.options.selected_edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getArrowScale: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return 1 + (thickness-1) * ((this.options.edge_arrow_max_width / this.options.edge_arrow_width) - 1) / (this.options.edge_stroke_witdh_scale-1);\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 _strokeWidth = this._getStrokeWidth(),\n _arrow_scale = this._getArrowScale(),\n _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 + 0.5 * _arrow_scale * this.options.edge_arrow_width),\n _handle = _v.divide(3),\n _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null,\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 var array_opacity =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) || !this.model.has(\"style\") || (typeof this.model.get(\"style\").arrow === 'undefined') ? opacity : 0;\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\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.strokeWidth = _strokeWidth;\n this.line.strokeColor = _color;\n this.line.dashArray = _dash;\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.scale(_arrow_scale / this.arrow_scale);\n this.arrow_scale = _arrow_scale;\n this.arrow.fillColor = _color;\n this.arrow.opacity = array_opacity;\n this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);\n this.arrow.position = this.paper_coords;\n\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._getSelectedStrokeWidth();\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._getStrokeWidth();\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 = _.reject(this.bundle.edges, function(_edge) {\n return _this === _edge;\n });\n }\n }).value();\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 }).value();\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 = _.map(_.range(8), 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 }).value();\n\n /* _BaseEditor End */\n\n return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder'], function ($, _, requtils, BaseEditor, ShapeBuilder) {\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/nodeeditor.html'];\n this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\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 shapes : _(ShapeBuilder.builders).omit('svg').keys().value(),\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.editor_$.off(\"keyup\");\n _this.editor_$.find(\"input, textarea, select\").off(\"change keyup paste\");\n _this.editor_$.find(\".Rk-Edit-Image-File\").off('change');\n _this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").off('hover');\n _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\n _this.editor_$.find(\".Rk-Edit-Image-Del\").off('click');\n _this.editor_$.find(\".Rk-Edit-ColorPicker\").find(\"li\").off('hover click');\n _this.editor_$.find(\".Rk-CloseX\").off('click');\n _this.editor_$.find(\".Rk-Edit-Goto\").off('click');\n\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 = _.throttle(function() {\n _.defer(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.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\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 }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {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 var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\n });\n\n this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n _this.editor_$.find(\".Rk-Edit-Image\").val('');\n onFieldChange();\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 }).value();\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/edgeeditor.html'];\n this.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\n arrow: (_model.has(\"style\") && _model.get(\"style\").arrow) || !_model.has(\"style\") || (typeof _model.get(\"style\").arrow === 'undefined') ? \"checked\" : \"\",\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n from_title: _from_model.get(\"title\"),\n to_title: _to_model.get(\"title\"),\n from_color: (_from_model.has(\"style\") && _from_model.get(\"style\").color) || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n to_color: (_to_model.has(\"style\") && _to_model.get(\"style\").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 _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\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 = _.throttle(function() {\n _.defer(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 if (_this.options.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\n var arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {arrow: arrow});\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 });\n },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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {color: $(this).attr(\"data-color\")}));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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).value();\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 _.each(_event.originalEvent.dataTransfer.types, 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 _.extend(res,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:saveStatus\", function(){\n switch (_this.renkan.project.get(\"saveStatus\")) {\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:loadingStatus\", function(){\n if (_this.renkan.project.get(\"loadingStatus\")){\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(\"loadingStatus\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"add:edges\", function(_edge) {\n _this.addRepresentation(\"Edge\", _edge);\n if (!_this.renkan.project.get(\"loadingStatus\")){\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 = _.reject(this.representations,\n function(_repr) {\n return _repr === _representation;\n }\n );\n },\n getRepresentationByModel: function(_model) {\n if (!_model) {\n return undefined;\n }\n return _.find(this.representations, function(_repr) {\n return _repr.model === _model;\n });\n },\n removeRepresentationsOfType: function(_type) {\n var _representations = _.filter(this.representations,function(_repr) {\n return _repr.type === _type;\n }),\n _this = this;\n _.each(_representations, 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 _.each(this.representations, function(_repr) {\n _repr.unhighlight();\n });\n },\n unselectAll: function(_model) {\n _.each(this.representations, function(_repr) {\n _repr.unselect();\n });\n },\n redraw: function() {\n if(! this.redrawActive ) {\n return;\n }\n _.each(this.representations, function(_representation) {\n _representation.redraw({ dontRedrawEdges: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 _.extend(_data,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 }).value();\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/lodash/lodash',\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":["templates.js","../../js/main.js","../../js/dataloader.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":["this","obj","__t","__p","_","escape","__e","Array","prototype","join","renkan","translate","edge","title","options","show_edge_editor_uri","uri","properties","length","each","ontology","label","property","show_edge_editor_style","show_edge_editor_style_color","show_edge_editor_style_dash","dash","show_edge_editor_style_thickness","thickness","show_edge_editor_style_arrow","arrow","show_edge_editor_direction","show_edge_editor_nodes","from_color","shortenText","from_title","to_title","show_edge_editor_creator","has_creator","created_by_title","show_edge_tooltip_color","color","show_edge_tooltip_uri","short_uri","description","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","static_url","url","show_bins","show_editor","node","show_node_editor_uri","show_node_editor_description","show_node_editor_size","size","show_node_editor_style","show_node_editor_style_color","show_node_editor_style_dash","show_node_editor_style_thickness","show_node_editor_image","image_placeholder","clip_path","allow_image_upload","show_node_editor_creator","change_shapes","shapes","shape","charAt","toUpperCase","substring","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","print","__j","call","arguments","show_top_bar","editor_mode","project","get","show_user_list","show_user_color","user_color_editable","colorPicker","home_button_url","home_button_title","show_fullscreen_button","show_addnode_button","show_addedge_button","show_export_button","show_save_button","show_open_button","show_bookmarklet","show_search_field","resize","show_zoom","save_view","root","$","jQuery","pickerColors","__renkans","_BaseBin","_renkan","_opts","find","hide","addClass","appendTo","title_icon_$","_this","attr","href","html","click","destroy","slideDown","resizeBins","refresh","count_$","title_$","main_$","auto_refresh","window","setInterval","detach","Renkan","push","defaults","templates","renkanJST","template","property_files","f","getJSON","data","concat","read_only","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","_id","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","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","where","_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","lastsearch","lastval","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","test","img","Image","src","res","inherit","_baseClass","_callbefore","_class","apply","slice","_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","default_user_color","_BOOKMARKLET_CODE","_maxlength","drawEditBox","_options","_coords","_path","_xmargin","_selector","tooltip_width","tooltip_padding","_height","_isLeft","x","paper","view","center","_left","tooltip_arrow_length","_right","_top","y","tooltip_margin","max","tooltip_arrow_width","min","_bottom","segments","point","add","closed","fillColor","GradientColor","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","converters","from1to2","len","nodes","console","log","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","Backbone","guid","RenkanModel","RelationalModel","idAttribute","constructor","id","prepare","addReference","_propName","_list","_default","_element","User","toJSON","Node","relations","HasOne","relatedModel","created_by","position","Edge","from","to","View","isArray","zoom_level","hidden_nodes","RosterUser","blacklist","HasMany","reverseRelation","includeInJSON","_props","_user","findOrCreate","addNode","_node","addEdge","_edge","addView","_view","removeNode","remove","removeEdge","_project","users","views","_item","t","version","initialize","filter","json","clone","attributes","Model","Collection","omit","site_id","model","navigator","userLanguage","popup_editor","editor_panel","manual_save","size_bug_fix","force_resize","allow_double_click","zoom_on_scroll","element_delete_delay","autoscale_padding","default_view","user_name_editable","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","default_dash_array","show_node_circles","clip_node_images","node_images_fill_mode","node_size_base","node_stroke_width","node_stroke_max_width","selected_node_stroke_width","selected_node_stroke_max_width","node_stroke_witdh_scale","node_fill_color","highlighted_node_fill_color","node_label_distance","node_label_max_length","label_untitled_nodes","edge_stroke_width","edge_stroke_max_width","selected_edge_stroke_width","selected_edge_stroke_max_width","edge_stroke_witdh_scale","edge_label_distance","edge_label_max_length","edge_arrow_length","edge_arrow_width","edge_arrow_max_width","edge_gap_in_bundles","label_untitled_edges","tooltip_border_color","tooltip_border_width","uploaded_image_max_kb","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:","Dash:","Thickness:","Arrow:","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","Cloud","Triangle","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","loadingStatus","_data","saveStatus","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","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","_e","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","change","_removeBinding","removeRepresentation","defer","_selectBinding","select","_unselectBinding","unselect","_super","_func","moveTo","trigger","unhighlight","mousedown","mouseup","value","getUtils","getRenderer","requtils","BaseRepresentation","_BaseButton","_pos","sector","_newTarget","source_representation","cloud_path","builders","circle","getShape","Path","getImageShape","radius","rectangle","Rectangle","ellipse","polygon","RegularPolygon","diamond","d","SQRT2","rotate","star","cloud","path","scale","triangle","svg","ShapeBuilder","NodeRepr","node_layer","activate","buildShape","hidden","ghost","strokeWidth","h_ratio","labels_$","normal_buttons","NodeEditButton","NodeRemoveButton","NodeHideButton","NodeShowButton","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","pending_delete_buttons","NodeRevertButton","all_buttons","active_buttons","last_circle_radius","minimap","minimap_circle","__representation","miniframe","node_group","addChild","_getStrokeWidth","has","_getSelectedStrokeWidth","changed","shapeBuilder","sendToBack","_model_coords","Point","_baseRadius","exp","is_dragging","paper_coords","toPaperCoords","circle_radius","forEach","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","_strokeWidth","_color","_dash","strokeColor","_pc","lastImage","showImage","minipos","toMinimapCoords","miniradius","minisize","Size","fitBounds","dontRedrawEdges","ed","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","insertAbove","paperShift","_delta","openEditor","removeRepresentationsOfType","_editor","addRepresentation","draw","_uri","showNeighbors","hideButtons","buttons_timeout","undefined","hideNeighbors","indexNode","hiddenNodes","indexOf","splice","textToReplace","hlvalue","throttledPaperDraw","saveCoords","toModelCoords","_event","_isTouch","unselectAll","index","click_target","edge_layer","bundle","addToBundles","line","arrow_scale","pivot","arrow_angle","EdgeEditButton","EdgeRemoveButton","EdgeRevertButton","minimap_line","_getArrowScale","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","array_opacity","handleIn","handleOut","bounds","_textpos","transform","-moz-transform","-webkit-transform","text_angle","visible","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","keys","closeEditor","onFieldChange","assign","keyCode","files","FileReader","alert","onload","target","result","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","clearTimeout","NodeButton","delid","delete_list","time","valueOf","confirm","addHiddenNode","unset","_off","_point","addTempEdge","MiniFrame","filesaver","representations","notif_$","setup","initialScale","totalScroll","mouse_down","selected_target","Layer","background_layer","topleft","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","getData","parse","bindClick","selector","fname","evt","last","hideNodes","showNodes","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","_restPos","_grp","_imgdelta","_currentPos","_edgeRepr","_bundle","_er","_dir","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","hideNode","last_point","_scrolldelta","SQRT1_2","open","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","require","config","paths","jquery","underscore","startRenkan"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,KAAgB,UAAIA,KAAgB,cAEpCA,KAAgB,UAAE,8BAAgC,SAASC,KAC3DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,EAAUC,GAAEC,OAC3B,KAAMJ,IACNE,KAAO,oBACS,OAAdD,IAAM,GAAe,GAAKA,KAC5B,yBACgB,OAAdA,IAAM,GAAe,GAAKA,KAC5B,SAGA,OAAOC,MAGPH,KAAgB,UAAE,6BAA+B,SAASC,KAC1DA,MAAQA,OACR,EAAA,GAAIC,KAAKC,IAAM,GAAIG,IAAMF,EAAEC,MAAcE,OAAMC,UAAUC,KAEzD,KAAMR,IACNE,KAAO,mDACPG,IAAII,OAAOC,UAAU,cACrB,mCACAL,IAAII,OAAOC,UAAU,WACrB,iEACAL,IAAIM,KAAKC,OACT,eACKC,QAAQC,uBACbZ,KAAO,6BACPG,IAAII,OAAOC,UAAU,SACrB,mEACAL,IAAIM,KAAKI,KACT,+CACAV,IAAIM,KAAKI,KACT,yCACKF,QAAQG,WAAWC,SACxBf,KAAO,qCACPG,IAAII,OAAOC,UAAU,4BACrB,8EACCP,EAAEe,KAAKL,QAAQG,WAAY,SAASG,GACrCjB,KAAO,qGACPG,IAAKI,OAAOC,UAAUS,EAASC,QAC/B,wDACCjB,EAAEe,KAAKC,EAASH,WAAY,SAASK,GAAY,GAAIN,GAAMI,EAAS,YAAcE,EA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uB,EAC/BhjB,EAASijB,YAAcwP,EACvBzyB,EAASuO,KAAOsW,EAChB7kB,EAAS6O,KAAOA,EAChB7O,EAASwvB,SAAWA,EACpBxvB,EAASowB,YAAcM,EACvB1wB,EAAS2wB,WAAaA,EACtB3wB,EAASsyB,WAAaA,EACtBtyB,EAAS0yB,YAAcQ,EACvBlzB,EAASulB,eAAiBA,EAC1BvlB,EAASwlB,iBAAmBA,EAC5BxlB,EAASylB,eAAiBA,EAC1BzlB,EAAS0lB,eAAiBA,EAC1B1lB,EAAS+lB,iBAAmBA,EAC5B/lB,EAAS2lB,eAAiBA,EAC1B3lB,EAAS4lB,kBAAoBA,EAC7B5lB,EAAS6lB,iBAAmBA,EAC5B7lB,EAASytB,eAAiBA,EAC1BztB,EAAS0tB,iBAAmBA,EAC5B1tB,EAAS2tB,iBAAmBA,EAC5B3tB,EAAS6zB,UAAYA,EACrB7zB,EAASC,MAAQA,EAEjBohC,gBAGJ7f,OAAO,gBAAiB","sourcesContent":["this[\"renkanJST\"] = this[\"renkanJST\"] || {};\n\nthis[\"renkanJST\"][\"templates/colorpicker.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li data-color=\"' +\n((__t = (c)) == null ? '' : __t) +\n'\" style=\"background: ' +\n((__t = (c)) == null ? '' : __t) +\n'\"></li>';\n\n}\nreturn __p\n};\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 <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Edge\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(edge.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n ';\n if (options.properties.length) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose from vocabulary:\")) +\n'</label>\\n <select class=\"Rk-Edit-Vocabulary\">\\n ';\n _.each(options.properties, function(ontology) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Class\" value=\"\">\\n ' +\n__e( renkan.translate(ontology.label) ) +\n'\\n </option>\\n ';\n _.each(ontology.properties, function(property) { var uri = ontology[\"base-uri\"] + property.uri; ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( uri ) +\n'\"\\n ';\n if (uri === edge.uri) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(property.label) ) +\n'\\n </option>\\n ';\n }) ;\n__p += '\\n ';\n }) ;\n__p += '\\n </select>\\n </p>\\n';\n } } ;\n__p += '\\n';\n if (options.show_edge_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_edge_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Edge color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: <%-edge.color%>;\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( edge.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e( edge.thickness ) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_edge_editor_style_arrow) { ;\n__p += '\\n <div id=\"Rk-Editor-p-arrow\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Arrow:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Arrow\" class=\"Rk-Edit-Arrow\" ' +\n__e( edge.arrow ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_direction) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Edit-Direction\">' +\n__e( renkan.translate(\"Change edge direction\") ) +\n'</span>\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(edge.from_color) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: >%-edge.to_color%>;\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_editor_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: <%-edge.created_by_color%>;\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_edge_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.color ) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (edge.uri) { ;\n__p += '\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(edge.title) +\n'\\n ';\n if (edge.uri) { ;\n__p += ' </a> ';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (options.show_edge_tooltip_uri && edge.uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(edge.uri) +\n'\" target=\"_blank\">' +\n__e( edge.short_uri ) +\n'</a>\\n </p>\\n';\n } ;\n__p += '\\n<p>' +\n__e(edge.description) +\n'</p>\\n';\n if (options.show_edge_tooltip_nodes) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"From:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.from_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.from_title, 25) ) +\n'\\n </p>\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"To:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.to_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.to_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += '\\n';\n if (options.show_edge_tooltip_creator && edge.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e( edge.created_by_color ) +\n';\"></span>\\n ' +\n__e( shortenText(edge.created_by_title, 25) ) +\n'\\n </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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n data-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 data-title=\"' +\n__e(title) +\n'\" data-description=\"' +\n__e(description) +\n'\">\\n\\n <img class=\"Rk-Ldt-Annotation-Icon\" src=\"' +\n((__t = (image)) == null ? '' : __t) +\n'\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <p>' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n <p>Start: ' +\n((__t = (start)) == null ? '' : __t) +\n', End: ' +\n((__t = (end)) == null ? '' : __t) +\n', Duration: ' +\n((__t = (duration)) == null ? '' : __t) +\n'</p>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\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 data-image=\"' +\n__e( Rkns.Utils.getFullURL(static_url+'img/ldt-tag.png') ) +\n'\"\\n data-uri=\"' +\n((__t = (ldt_platform)) == null ? '' : __t) +\n'ldtplatform/ldt/front/search/?search=' +\n((__t = (encodedtitle)) == null ? '' : __t) +\n'&field=all\"\\n data-title=\"' +\n__e(title) +\n'\" data-description=\"Tag \\'' +\n__e(title) +\n'\\'\">\\n\\n <img class=\"Rk-Ldt-Tag-Icon\" src=\"' +\n__e(static_url) +\n'img/ldt-tag.png\" />\\n <h4>' +\n((__t = (htitle)) == null ? '' : __t) +\n'</h4>\\n <div class=\"Rk-Clear\"></div>\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/list-bin.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape, __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\nwith (obj) {\n__p += '<li class=\"Rk-Bin-Item Rk-ResourceList-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n ';\n if (image) { ;\n__p += '\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL(image) ) +\n'\"\\n ';\n } else { ;\n__p += '\\n data-image=\"\"\\n ';\n } ;\n__p += '\\n>';\n if (image) { ;\n__p += '\\n <img class=\"Rk-ResourceList-Image\" src=\"' +\n__e(image) +\n'\" />\\n';\n } ;\n__p += '\\n<h4 class=\"Rk-ResourceList-Title\">\\n ';\n if (url) { ;\n__p += '\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n((__t = (htitle)) == null ? '' : __t) +\n'\\n ';\n if (url) { ;\n__p += '</a>';\n } ;\n__p += '\\n </h4>\\n ';\n if (description) { ;\n__p += '\\n <p class=\"Rk-ResourceList-Description\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n ';\n } ;\n__p += '\\n ';\n if (image) { ;\n__p += '\\n <div style=\"clear: both;\"></div>\\n ';\n } ;\n__p += '\\n</li>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/main.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_bins) { ;\n__p += '\\n <div class=\"Rk-Bins\">\\n <div class=\"Rk-Bins-Head\">\\n <h2 class=\"Rk-Bins-Title\">' +\n__e( translate(\"Select contents:\")) +\n'</h2>\\n <form class=\"Rk-Web-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Web-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n <div class=\"Rk-Search-Select\">\\n <div class=\"Rk-Search-Current\"></div>\\n <ul class=\"Rk-Search-List\"></ul>\\n </div>\\n <input type=\"submit\" value=\"\"\\n class=\"Rk-Web-Search-Submit Rk-Search-Submit\" title=\"' +\n__e( translate('Search the Web') ) +\n'\" />\\n </form>\\n <form class=\"Rk-Bins-Search-Form Rk-Search-Form\">\\n <input class=\"Rk-Bins-Search-Input Rk-Search-Input\" type=\"search\"\\n placeholder=\"' +\n__e( translate('Search in Bins') ) +\n'\" /> <input\\n type=\"submit\" value=\"\"\\n class=\"Rk-Bins-Search-Submit Rk-Search-Submit\"\\n title=\"' +\n__e( translate('Search in Bins') ) +\n'\" />\\n </form>\\n </div>\\n <ul class=\"Rk-Bin-List\"></ul>\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_editor) { ;\n__p += '\\n <div class=\"Rk-Render Rk-Render-';\n if (options.show_bins) { ;\n__p += 'Panel';\n } else { ;\n__p += 'Full';\n } ;\n__p += '\"></div>\\n';\n } ;\n__p += '\\n';\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\n //TODO: change class to id ;\n__p += '\\n<h2>\\n <span class=\"Rk-CloseX\">×</span>' +\n__e(renkan.translate(\"Edit Node\")) +\n'</span>\\n</h2>\\n<p>\\n <label>' +\n__e(renkan.translate(\"Title:\")) +\n'</label>\\n <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 <p>\\n <label>' +\n__e(renkan.translate(\"URI:\")) +\n'</label>\\n <input class=\"Rk-Edit-URI\" type=\"text\" value=\"' +\n__e(node.uri) +\n'\" />\\n <a class=\"Rk-Edit-Goto\" href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\"></a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_description) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Description:\")) +\n'</label>\\n <textarea class=\"Rk-Edit-Description\">' +\n__e(node.description) +\n'</textarea>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_size) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Size:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Size-Value\">' +\n__e(node.size) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Size-Up\">+</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_style) { ;\n__p += '\\n <div class=\"Rk-Editor-p\">\\n ';\n if (options.show_node_editor_style_color) { ;\n__p += '\\n <div id=\"Rk-Editor-p-color\">\\n <span class=\"Rk-Editor-Label\">\\n ' +\n__e(renkan.translate(\"Node color:\")) +\n'</span>\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-Edit-Color\" style=\"background: ' +\n__e(node.color) +\n';\">\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n </span>\\n ' +\n((__t = ( renkan.colorPicker )) == null ? '' : __t) +\n'\\n <span class=\"Rk-Edit-ColorPicker-Text\">' +\n__e( renkan.translate(\"Choose color\") ) +\n'</span>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_dash) { ;\n__p += '\\n <div id=\"Rk-Editor-p-dash\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Dash:\")) +\n'</span>\\n <input type=\"checkbox\" name=\"Rk-Edit-Dash\" class=\"Rk-Edit-Dash\" ' +\n__e( node.dash ) +\n' />\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_node_editor_style_thickness) { ;\n__p += '\\n <div id=\"Rk-Editor-p-thickness\">\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Thickness:\")) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Down\">-</a>\\n <span class=\"Rk-Edit-Size-Disp\" id=\"Rk-Edit-Thickness-Value\">' +\n__e(node.thickness) +\n'</span>\\n <a href=\"#\" class=\"Rk-Edit-Size-Btn\" id=\"Rk-Edit-Thickness-Up\">+</a>\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n';\n } ;\n__p += ' ';\n if (options.show_node_editor_image) { ;\n__p += '\\n <div class=\"Rk-Edit-ImgWrap\">\\n <div class=\"Rk-Edit-ImgPreview\">\\n <img src=\"' +\n__e(node.image || node.image_placeholder) +\n'\" />\\n ';\n if (node.clip_path) { ;\n__p += '\\n <svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewbox=\"0 0 1 1\" preserveAspectRatio=\"none\">\\n <path style=\"stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;\" d=\"' +\n__e( node.clip_path ) +\n'\" />\\n </svg>\\n ';\n };\n__p += '\\n </div>\\n </div>\\n <p>\\n <label>' +\n__e(renkan.translate(\"Image URL:\")) +\n'</label>\\n <div>\\n <a class=\"Rk-Edit-Image-Del\" href=\"#\"></a>\\n <input class=\"Rk-Edit-Image\" type=\"text\" value=\\'' +\n__e(node.image) +\n'\\' />\\n </div>\\n </p>\\n';\n if (options.allow_image_upload) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Choose Image File:\")) +\n'</label>\\n <input class=\"Rk-Edit-Image-File\" type=\"file\" accept=\"image/*\" />\\n </p>\\n';\n };\n\n } ;\n__p += ' ';\n if (options.show_node_editor_creator && node.has_creator) { ;\n__p += '\\n <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.change_shapes) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Shapes available\")) +\n':</label>\\n <select class=\"Rk-Edit-Shape\">\\n ';\n _.each(shapes, function(shape) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( shape ) +\n'\"';\n if (node.shape === shape) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(shape.charAt(0).toUpperCase() + shape.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\n </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 <span class=\"Rk-CloseX\">×</span>\\n ';\n if (options.show_node_tooltip_color) { ;\n__p += '\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.color) +\n';\"></span>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-Display-Title\">\\n ';\n if (node.uri) { ;\n__p += '\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">\\n ';\n } ;\n__p += '\\n ' +\n__e(node.title) +\n'\\n ';\n if (node.uri) { ;\n__p += '</a>';\n } ;\n__p += '\\n </span>\\n</h2>\\n';\n if (node.uri && options.show_node_tooltip_uri) { ;\n__p += '\\n <p class=\"Rk-Display-URI\">\\n <a href=\"' +\n__e(node.uri) +\n'\" target=\"_blank\">' +\n__e(node.short_uri) +\n'</a>\\n </p>\\n';\n } ;\n__p += ' ';\n if (options.show_node_tooltip_description) { ;\n__p += '\\n <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 <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 <p>\\n <span class=\"Rk-Editor-Label\">' +\n__e(renkan.translate(\"Created by:\")) +\n'</span>\\n <span class=\"Rk-UserColor\" style=\"background: ' +\n__e(node.created_by_color) +\n';\"></span>\\n ' +\n__e( shortenText(node.created_by_title, 25) ) +\n'\\n </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 <div class=\"Rk-TopBar\">\\n <div class=\"loader\"></div>\\n ';\n if (!options.editor_mode) { ;\n__p += '\\n <h2 class=\"Rk-PadTitle\">\\n ' +\n__e( project.get(\"title\") || translate(\"Untitled project\")) +\n'\\n </h2>\\n ';\n } else { ;\n__p += '\\n <input type=\"text\" class=\"Rk-PadTitle\" value=\"' +\n__e( project.get('title') || '' ) +\n'\" placeholder=\"' +\n__e(translate('Untitled project')) +\n'\" />\\n ';\n } ;\n__p += '\\n ';\n if (options.show_user_list) { ;\n__p += '\\n <div class=\"Rk-Users\">\\n <div class=\"Rk-CurrentUser\">\\n ';\n if (options.show_user_color) { ;\n__p += '\\n <div class=\"Rk-Edit-ColorPicker-Wrapper\">\\n <span class=\"Rk-CurrentUser-Color\">\\n ';\n if (options.user_color_editable) { ;\n__p += '\\n <span class=\"Rk-Edit-ColorTip\"></span>\\n ';\n } ;\n__p += '\\n </span>\\n ';\n if (options.user_color_editable) { print(colorPicker) } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n <span class=\"Rk-CurrentUser-Name\"><unknown user></span>\\n </div>\\n <ul class=\"Rk-UserList\"></ul>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.home_button_url) {;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Home-Button\" href=\"' +\n__e( options.home_button_url ) +\n'\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e( translate(options.home_button_title) ) +\n'\\n </div>\\n </div>\\n </a>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_fullscreen_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-FullScreen-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Full Screen\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.editor_mode) { ;\n__p += '\\n ';\n if (options.show_addnode_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddNode-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Node\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_addedge_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-AddEdge-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Add Edge\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_save_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Save-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\"></div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_open_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Open-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Open Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_bookmarklet) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <a class=\"Rk-TopBar-Button Rk-Bookmarklet-Button\" href=\"#\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Renkan \\'Drag-to-Add\\' bookmarklet\")) +\n'\\n </div>\\n </div>\\n </a>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n } else { ;\n__p += '\\n ';\n if (options.show_export_button) { ;\n__p += '\\n <div class=\"Rk-TopBar-Separator\"></div>\\n <div class=\"Rk-TopBar-Button Rk-Export-Button\">\\n <div class=\"Rk-TopBar-Tooltip\">\\n <div class=\"Rk-TopBar-Tooltip-Contents\">\\n ' +\n__e(translate(\"Download Project\")) +\n'\\n </div>\\n </div>\\n </div>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n ';\n }; ;\n__p += '\\n ';\n if (options.show_search_field) { ;\n__p += '\\n <form action=\"#\" class=\"Rk-GraphSearch-Form\">\\n <input type=\"search\" class=\"Rk-GraphSearch-Field\" placeholder=\"' +\n__e( translate('Search in graph') ) +\n'\" />\\n </form>\\n <div class=\"Rk-TopBar-Separator\"></div>\\n ';\n } ;\n__p += '\\n </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 <div class=\"Rk-Labels\"></div>\\n <canvas class=\"Rk-Canvas\" ';\n if (options.resize) { ;\n__p += ' resize=\"\" ';\n } ;\n__p += '></canvas>\\n <div class=\"Rk-Notifications\"></div>\\n <div class=\"Rk-Editor\">\\n ';\n if (options.show_bins) { ;\n__p += '\\n <div class=\"Rk-Fold-Bins\">«</div>\\n ';\n } ;\n__p += '\\n ';\n if (options.show_zoom) { ;\n__p += '\\n <div class=\"Rk-ZoomButtons\">\\n <div class=\"Rk-ZoomIn\" title=\"' +\n__e(translate('Zoom In')) +\n'\"></div>\\n <div class=\"Rk-ZoomFit\" title=\"' +\n__e(translate('Zoom Fit')) +\n'\"></div>\\n <div class=\"Rk-ZoomOut\" title=\"' +\n__e(translate('Zoom Out')) +\n'\"></div>\\n ';\n if (options.editor_mode && options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSave\" title=\"' +\n__e(translate('Zoom Save')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n ';\n if (options.save_view) { ;\n__p += '\\n <div class=\"Rk-ZoomSetSaved\" title=\"' +\n__e(translate('View saved zoom')) +\n'\"></div>\\n \\t<div class=\"Rk-ShowHiddenNodes\" title=\"' +\n__e(translate('Show hidden nodes')) +\n'\"></div>\\n ';\n } ;\n__p += '\\n </div>\\n ';\n } ;\n__p += '\\n </div>\\n</div>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/search.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"' +\n((__t = ( className )) == null ? '' : __t) +\n'\" data-key=\"' +\n((__t = ( key )) == null ? '' : __t) +\n'\">' +\n((__t = ( title )) == null ? '' : __t) +\n'</li>';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/wikipedia-bin/resulttemplate.html\"] = function(obj) {\nobj || (obj = {});\nvar __t, __p = '', __e = _.escape;\nwith (obj) {\n__p += '<li class=\"Rk-Wikipedia-Result Rk-Bin-Item\" draggable=\"true\"\\n data-uri=\"' +\n__e(url) +\n'\" data-title=\"Wikipedia: ' +\n__e(title) +\n'\"\\n data-description=\"' +\n__e(description) +\n'\"\\n data-image=\"' +\n__e( Rkns.Utils.getFullURL( static_url + 'img/wikipedia.png' ) ) +\n'\">\\n\\n <img class=\"Rk-Wikipedia-Icon\" src=\"' +\n__e(static_url) +\n'img/wikipedia.png\">\\n <h4 class=\"Rk-Wikipedia-Title\">\\n <a href=\"' +\n__e(url) +\n'\" target=\"_blank\">' +\n((__t = (htitle)) == null ? '' : __t) +\n'</a>\\n </h4>\\n <p class=\"Rk-Wikipedia-Snippet\">' +\n((__t = (hdescription)) == null ? '' : __t) +\n'</p>\\n</li>\\n';\n\n}\nreturn __p\n};","/* Declaring the Renkan Namespace Rkns and Default values */\n\n(function(root) {\n\n \"use strict\";\n\n if (typeof root.Rkns !== \"object\") {\n root.Rkns = {};\n }\n\n var Rkns = root.Rkns;\n var $ = Rkns.$ = root.jQuery;\n var _ = Rkns._ = root._;\n\n Rkns.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 ];\n\n Rkns.__renkans = [];\n\n var _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\n var Renkan = Rkns.Renkan = function(_opts) {\n var _this = this;\n\n Rkns.__renkans.push(this);\n\n this.options = _.defaults(_opts, Rkns.defaults, {\n templates: renkanJST\n });\n this.template = renkanJST['templates/main.html'];\n\n _.each(this.options.property_files, function(f) {\n Rkns.$.getJSON(f, function(data) {\n _this.options.properties = _this.options.properties.concat(data);\n });\n });\n\n this.read_only = this.options.read_only || !this.options.editor_mode;\n\n this.project = new Rkns.Models.Project();\n this.dataloader = new Rkns.DataLoader.Loader(this.project, this.options);\n\n this.setCurrentUser = function(user_id, user_name) {\n this.project.addUser({\n _id: user_id,\n title: user_name\n });\n this.current_user = user_id;\n this.renderer.redrawUsers();\n };\n\n if (typeof this.options.user_id !== \"undefined\") {\n this.current_user = this.options.user_id;\n }\n this.$ = Rkns.$(\"#\" + this.options.container);\n this.$\n .addClass(\"Rk-Main\")\n .html(this.template(this));\n\n this.tabs = [];\n this.search_engines = [];\n\n this.current_user_list = new Rkns.Models.UsersList();\n\n this.current_user_list.on(\"add remove\", function() {\n if (this.renderer) {\n this.renderer.redrawUsers();\n }\n });\n\n this.colorPicker = (function() {\n var _tmpl = renkanJST['templates/colorpicker.html'];\n return '<ul class=\"Rk-Edit-ColorPicker\">' + Rkns.pickerColors.map(function(c) {\n return _tmpl({\n c: c\n });\n }).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 = renkanJST['templates/search.html'],\n _select = this.$.find(\".Rk-Search-List\"),\n _input = this.$.find(\".Rk-Web-Search-Input\"),\n _form = this.$.find(\".Rk-Web-Search-Form\");\n _.each(this.options.search, function(_search, _key) {\n if (Rkns[_search.type] && Rkns[_search.type].Search) {\n _this.search_engines.push(new Rkns[_search.type].Search(_this, _search));\n }\n });\n _select.html(\n _(this.search_engines).map(function(_search, _key) {\n return _tmpl({\n key: _key,\n title: _search.getSearchTitle(),\n className: _search.getBgClass()\n });\n }).join(\"\")\n );\n _select.find(\"li\").click(function() {\n var _el = Rkns.$(this);\n _this.setSearchEngine(_el.attr(\"data-key\"));\n _form.submit();\n });\n _form.submit(function() {\n if (_input.val()) {\n var _search = _this.search_engine;\n _search.search(_input.val());\n }\n return false;\n });\n this.$.find(\".Rk-Search-Current\").mouseenter(\n function() {\n _select.slideDown();\n }\n );\n this.$.find(\".Rk-Search-Select\").mouseleave(\n function() {\n _select.hide();\n }\n );\n this.setSearchEngine(0);\n }\n _.each(this.options.bins, function(_bin) {\n if (Rkns[_bin.type] && Rkns[_bin.type].Bin) {\n _this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));\n }\n });\n\n var elementDropped = false;\n\n this.$.find(\".Rk-Bins\")\n .on(\"click\", \".Rk-Bin-Title,.Rk-Bin-Title-Icon\", function() {\n var _mainDiv = Rkns.$(this).siblings(\".Rk-Bin-Main\");\n if (_mainDiv.is(\":hidden\")) {\n _this.$.find(\".Rk-Bin-Main\").slideUp();\n _mainDiv.slideDown();\n }\n });\n\n if (this.options.show_editor) {\n\n this.$.find(\".Rk-Bins\").on(\"mouseover\", \".Rk-Bin-Item\", function(_e) {\n var _t = Rkns.$(this);\n if (_t && $(_t).attr(\"data-uri\")) {\n var _models = _this.project.get(\"nodes\").where({\n uri: $(_t).attr(\"data-uri\")\n });\n _.each(_models, function(_model) {\n _this.renderer.highlightModel(_model);\n });\n }\n }).mouseout(function() {\n _this.renderer.unhighlightAll();\n }).on(\"mousemove\", \".Rk-Bin-Item\", function(e) {\n try {\n this.dragDrop();\n } catch (err) {}\n }).on(\"touchstart\", \".Rk-Bin-Item\", function(e) {\n elementDropped = false;\n }).on(\"touchmove\", \".Rk-Bin-Item\", function(e) {\n e.preventDefault();\n var touch = e.originalEvent.changedTouches[0],\n off = _this.renderer.canvas_$.offset(),\n w = _this.renderer.canvas_$.width(),\n h = _this.renderer.canvas_$.height();\n if (touch.pageX >= off.left && touch.pageX < (off.left + w) && touch.pageY >= off.top && touch.pageY < (off.top + h)) {\n if (elementDropped) {\n _this.renderer.onMouseMove(touch, true);\n } else {\n elementDropped = true;\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n _this.renderer.dropData({\n \"text/html\": div.innerHTML\n }, touch);\n _this.renderer.onMouseDown(touch, true);\n }\n }\n }).on(\"touchend\", \".Rk-Bin-Item\", function(e) {\n if (elementDropped) {\n _this.renderer.onMouseUp(e.originalEvent.changedTouches[0], true);\n }\n elementDropped = false;\n }).on(\"dragstart\", \".Rk-Bin-Item\", function(e) {\n var div = document.createElement('div');\n div.appendChild(this.cloneNode(true));\n try {\n e.originalEvent.dataTransfer.setData(\"text/html\", div.innerHTML);\n } catch (err) {\n e.originalEvent.dataTransfer.setData(\"text\", div.innerHTML);\n }\n });\n\n }\n\n Rkns.$(window).resize(function() {\n _this.resizeBins();\n });\n\n var lastsearch = false,\n lastval = '';\n\n this.$.find(\".Rk-Bins-Search-Input\").on(\"change keyup paste input\", function() {\n var val = Rkns.$(this).val();\n if (val === lastval) {\n return;\n }\n var search = Rkns.Utils.regexpFromTextOrArray(val.length > 1 ? val : null);\n if (search.source === lastsearch) {\n return;\n }\n lastsearch = search.source;\n _.each(_this.tabs, function(tab) {\n tab.render(search);\n });\n\n });\n this.$.find(\".Rk-Bins-Search-Form\").submit(function() {\n return false;\n });\n\n };\n\n Renkan.prototype.translate = function(_text) {\n if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) {\n return Rkns.i18n[this.options.language][_text];\n }\n if (this.options.language.length > 2 && Rkns.i18n[this.options.language.substr(0, 2)] && Rkns.i18n[this.options.language.substr(0, 2)][_text]) {\n return Rkns.i18n[this.options.language.substr(0, 2)][_text];\n }\n return _text;\n };\n\n Renkan.prototype.onStatusChange = function() {\n this.renderer.onStatusChange();\n };\n\n Renkan.prototype.setSearchEngine = function(_key) {\n this.search_engine = this.search_engines[_key];\n this.$.find(\".Rk-Search-Current\").attr(\"class\", \"Rk-Search-Current \" + this.search_engine.getBgClass());\n var listClasses = this.search_engine.getBgClass().split(\" \");\n var classes = \"\";\n for (var i = 0; i < listClasses.length; i++) {\n classes += \".\" + listClasses[i];\n }\n this.$.find(\".Rk-Web-Search-Input.Rk-Search-Input\").attr(\"placeholder\", this.translate(\"Search in \") + this.$.find(\".Rk-Search-List \" + classes).html());\n };\n\n Renkan.prototype.resizeBins = function() {\n var _d = +this.$.find(\".Rk-Bins-Head\").outerHeight();\n this.$.find(\".Rk-Bin-Title:visible\").each(function() {\n _d += Rkns.$(this).outerHeight();\n });\n this.$.find(\".Rk-Bin-Main\").css({\n height: this.$.find(\".Rk-Bins\").height() - _d\n });\n };\n\n /* Utility functions */\n var getUUID4 = function() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n };\n\n Rkns.Utils = {\n getUUID4: getUUID4,\n getUID: (function() {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n var _d = new Date(),\n ID_AUTO_INCREMENT = 0,\n ID_BASE = _d.getUTCFullYear() + '-' +\n pad(_d.getUTCMonth() + 1) + '-' +\n pad(_d.getUTCDate()) + '-' +\n getUUID4();\n return function(_base) {\n var _n = (++ID_AUTO_INCREMENT).toString(16),\n _uidbase = (typeof _base === \"undefined\" ? \"\" : _base + \"-\");\n while (_n.length < 4) {\n _n = '0' + _n;\n }\n return _uidbase + ID_BASE + '-' + _n;\n };\n })(),\n getFullURL: function(url) {\n\n if (typeof(url) === 'undefined' || url == null) {\n return \"\";\n }\n if (/https?:\\/\\//.test(url)) {\n return url;\n }\n var img = new Image();\n img.src = url;\n var res = img.src;\n img.src = null;\n return res;\n\n },\n inherit: function(_baseClass, _callbefore) {\n\n var _class = function(_arg) {\n if (typeof _callbefore === \"function\") {\n _callbefore.apply(this, Array.prototype.slice.call(arguments, 0));\n }\n _baseClass.apply(this, Array.prototype.slice.call(arguments, 0));\n if (typeof this._init === \"function\" && !this._initialized) {\n this._init.apply(this, Array.prototype.slice.call(arguments, 0));\n this._initialized = true;\n }\n };\n _.extend(_class.prototype, _baseClass.prototype);\n\n return _class;\n\n },\n regexpFromTextOrArray: (function() {\n var charsub = [\n '[aáàâä]',\n '[cç]',\n '[eéèêë]',\n '[iíìîï]',\n '[oóòôö]',\n '[uùûü]'\n ],\n removeChars = [\n String.fromCharCode(768), String.fromCharCode(769), String.fromCharCode(770), String.fromCharCode(771), String.fromCharCode(807),\n \"{\", \"}\", \"(\", \")\", \"[\", \"]\", \"【\", \"】\", \"、\", \"・\", \"‥\", \"。\", \"「\", \"」\", \"『\", \"』\", \"〜\", \":\", \"!\", \"?\", \" \",\n \",\", \" \", \";\", \"(\", \")\", \".\", \"*\", \"+\", \"\\\\\", \"?\", \"|\", \"{\", \"}\", \"[\", \"]\", \"^\", \"#\", \"/\"\n ],\n remsrc = \"[\\\\\" + removeChars.join(\"\\\\\") + \"]\",\n remrx = new RegExp(remsrc, \"gm\"),\n charsrx = _.map(charsub, function(c) {\n return new RegExp(c);\n });\n\n function replaceText(_text) {\n var txt = _text.toLowerCase().replace(remrx, \"\"),\n src = \"\";\n\n function makeReplaceFunc(l) {\n return function(k, v) {\n l = l.replace(charsrx[k], v);\n };\n }\n for (var j = 0; j < txt.length; j++) {\n if (j) {\n src += remsrc + \"*\";\n }\n var l = txt[j];\n _.each(charsub, makeReplaceFunc(l));\n src += l;\n }\n return src;\n }\n\n function getSource(inp) {\n switch (typeof inp) {\n case \"string\":\n return replaceText(inp);\n case \"object\":\n var src = '';\n _.each(inp, function(v) {\n var res = getSource(v);\n if (res) {\n if (src) {\n src += '|';\n }\n src += res;\n }\n });\n return src;\n }\n return '';\n }\n\n return function(_textOrArray) {\n var source = getSource(_textOrArray);\n if (source) {\n var testrx = new RegExp(source, \"im\"),\n replacerx = new RegExp('(' + source + ')', \"igm\");\n return {\n isempty: false,\n source: source,\n test: function(_t) {\n return testrx.test(_t);\n },\n replace: function(_text, _replace) {\n return _text.replace(replacerx, _replace);\n }\n };\n } else {\n return {\n isempty: true,\n source: '',\n test: function() {\n return true;\n },\n replace: function(_text) {\n return text;\n }\n };\n }\n };\n })(),\n /* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */\n _MIN_DRAG_DISTANCE: 2,\n /* Distance between the inner and outer radius of buttons that appear when hovering on a node */\n _NODE_BUTTON_WIDTH: 40,\n\n _EDGE_BUTTON_INNER: 2,\n _EDGE_BUTTON_OUTER: 40,\n /* Constants used to know if a specific action is to be performed when clicking on the canvas */\n _CLICKMODE_ADDNODE: 1,\n _CLICKMODE_STARTEDGE: 2,\n _CLICKMODE_ENDEDGE: 3,\n /* Node size step: Used to calculate the size change when clicking the +/- buttons */\n _NODE_SIZE_STEP: Math.LN2 / 4,\n _MIN_SCALE: 1 / 20,\n _MAX_SCALE: 20,\n _MOUSEMOVE_RATE: 80,\n _DOUBLETAP_DELAY: 800,\n /* Maximum distance in pixels (squared, to reduce calculations)\n * between two taps when double-tapping on a touch terminal */\n _DOUBLETAP_DISTANCE: 20 * 20,\n /* A placeholder so a default colour is displayed when a node has a null value for its user property */\n _USER_PLACEHOLDER: function(_renkan) {\n return {\n color: _renkan.options.default_user_color,\n title: _renkan.translate(\"(unknown user)\"),\n get: function(attr) {\n return this[attr] || false;\n }\n };\n },\n /* The code for the \"Drag and Add Bookmarklet\", slightly minified and with whitespaces removed, though\n * it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)\n */\n _BOOKMARKLET_CODE: function(_renkan) {\n return \"(function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r){a=document;b=a.body;c=a.location.href;j='draggable';m='text/x-iri-';d=a.createElement('div');d.innerHTML='<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 = _path.segments[7].point = _coords.add([_isLeft * _xmargin, 0]);\n _path.segments[1].point.x = _path.segments[2].point.x = _path.segments[5].point.x = _path.segments[6].point.x = _left;\n _path.segments[3].point.x = _path.segments[4].point.x = _right;\n _path.segments[2].point.y = _path.segments[3].point.y = _top;\n _path.segments[4].point.y = _path.segments[5].point.y = _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 // from http://stackoverflow.com/a/6444043\n increaseBrightness: function (hex, percent){\n // strip the leading # if it's there\n hex = hex.replace(/^\\s*#|\\s*$/g, '');\n\n // convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`\n if(hex.length === 3){\n hex = hex.replace(/(.)/g, '$1$1');\n }\n\n var r = parseInt(hex.substr(0, 2), 16),\n g = parseInt(hex.substr(2, 2), 16),\n b = parseInt(hex.substr(4, 2), 16);\n\n return '#' +\n ((0|(1<<8) + r + (256 - r) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + g + (256 - g) * percent / 100).toString(16)).substr(1) +\n ((0|(1<<8) + b + (256 - b) * percent / 100).toString(16)).substr(1);\n }\n };\n})(window);\n\n/* END main.js */\n","(function(root) {\n\n \"use strict\";\n\n var DataLoader = root.Rkns.DataLoader = {\n converters: {\n from1to2: function(data) {\n\n var i, len;\n if(typeof data.nodes !== 'undefined') {\n for(i=0, len=data.nodes.length; i<len; i++) {\n var node = data.nodes[i];\n if(node.color) {\n console.log(\"node color : \", node.color);\n node.style = {\n color: node.color,\n };\n }\n else {\n node.style = {};\n }\n }\n }\n if(typeof data.edges !== 'undefined') {\n for(i=0, len=data.edges.length; i<len; i++) {\n var edge = data.edges[i];\n if(edge.color) {\n edge.style = {\n color: edge.color,\n };\n }\n else {\n edge.style = {};\n }\n }\n }\n\n data.schema_version = \"2\";\n\n return data;\n },\n }\n };\n\n\n DataLoader.Loader = function(project, options) {\n this.project = project;\n this.dataConverters = _.defaults(options.converters || {}, DataLoader.converters);\n };\n\n\n DataLoader.Loader.prototype.convert = function(data) {\n var schemaVersionFrom = this.project.getSchemaVersion(data);\n var schemaVersionTo = this.project.getSchemaVersion();\n\n if (schemaVersionFrom !== schemaVersionTo) {\n var converterName = \"from\" + schemaVersionFrom + \"to\" + schemaVersionTo;\n if (typeof this.dataConverters[converterName] === 'function') {\n console.log(\"Apply conversion function :\", converterName);\n data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n console.log(data);\n this.project.set(this.convert(data), {\n validate: true\n });\n };\n\n})(window);\n","(function(root) {\n \"use strict\";\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 style : this.get(\"style\"),\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 type : this.get(\"type\")\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 style : this.get(\"style\"),\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 hidden_nodes: this.get(\"hidden_nodes\")\n // Don't need project id\n };\n }\n });\n\n // PROJECT\n var Project = Models.Project = RenkanModel.extend({\n schema_version : \"2\",\n type : \"project\",\n blacklist : [ 'saveStatus', 'loadingStatus'],\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 _.each(\n [].concat(options.users, options.nodes, options.edges,options.views),\n function(_item) {\n if (_item) {\n _item.project = _project;\n }\n }\n );\n },\n getSchemaVersion : function(data) {\n var t = data;\n if(typeof(t) === \"undefined\") {\n t = this;\n }\n var version = t.schema_version;\n if(!version) {\n return 1;\n }\n else {\n return version;\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})(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 popup_editor: true,\n /* show the node editor as a popup inside the renkan view */\n editor_panel: 'editor-panel',\n /* GUI continer DOM element ID of the editor panel */\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 default_dash_array : [4, 5],\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 node_stroke_max_width: 12,\n selected_node_stroke_width: 4,\n selected_node_stroke_max_width: 24,\n node_stroke_witdh_scale: 5,\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 edge_stroke_max_width: 12,\n selected_edge_stroke_width: 4,\n selected_edge_stroke_max_width: 24,\n edge_stroke_witdh_scale: 5,\n\n edge_label_distance: 0,\n edge_label_max_length: 20,\n edge_arrow_length: 18,\n edge_arrow_width: 12,\n edge_arrow_max_width: 32,\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_style: true,\n show_node_editor_style_color: true,\n show_node_editor_style_dash: true,\n show_node_editor_style_thickness: 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_style: true,\n show_edge_editor_style_color: true,\n show_edge_editor_style_dash: true,\n show_edge_editor_style_thickness: true,\n show_edge_editor_style_arrow: 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 \"Dash:\": \"Point. :\",\n \"Thickness:\": \"Epaisseur :\",\n \"Arrow:\": \"Flèche :\",\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 \"Cloud\": \"Nuage\",\n \"Triangle\": \"Triangle\",\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 loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\n _renkan.renderer.redrawActive = true;\n _renkan.renderer.fixSize();\n });\n };\n var _save = function() {\n _proj.set({\n saveStatus : 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 saveStatus : 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('saveStatus'))) {\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({loadingStatus:true});\n },\n success: function(_data) {\n _renkan.dataloader.load(_data);\n _proj.set({loadingStatus:false});\n _proj.set({saveStatus:0});\n _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({saveStatus:2});\n },\n success: function(data, textStatus, jqXHR) {\n $(window).off(\"beforeunload\", _onLeave);\n _saveWarn = false;\n _proj.set({saveStatus: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({saveStatus:1});\n\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('saveStatus'))) {\n\t \t\t_checkLeave();\n\t \t}\n\t });\n\t\tif(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('saveStatus'))) {\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 _.map(_this.data.tags,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 _.map(_this.data.annotations,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 _.each(this.data.objects,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 = renkanJST['templates/list-bin.html'];\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._.each(this.data,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 = renkanJST['templates/wikipedia-bin/resulttemplate.html'];\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._.each(this.data.query.search, 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({change: true});\n };\n this._removeBinding = function() {\n _renderer.removeRepresentation(_this);\n _.defer(function() {\n _renderer.redraw();\n });\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 }).value();\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 }).value();\n\n return _BaseButton;\n\n});\n\n\ndefine('renderer/shapebuilder',[], function () {\n \n\n var cloud_path = \"M0,0c-0.1218516546,-0.0336420601 -0.2451649928,0.0048580836 -0.3302944641,0.0884969975c-0.0444763883,-0.0550844815 -0.1047003238,-0.0975985034 -0.1769360893,-0.1175406746c-0.1859066673,-0.0513257002 -0.3774236254,0.0626045858 -0.4272374613,0.2541588105c-0.0036603877,0.0140753132 -0.0046241235,0.028229722 -0.0065872453,0.042307536c-0.1674179627,-0.0179317735 -0.3276106855,0.0900599386 -0.3725537463,0.2628868425c-0.0445325077,0.1712456429 0.0395025693,0.3463497959 0.1905420475,0.4183458793c-0.0082101538,0.0183442886 -0.0158652506,0.0372432828 -0.0211098452,0.0574080693c-0.0498130336,0.1915540431 0.0608692569,0.3884647499 0.2467762814,0.4397904033c0.0910577256,0.0251434257 0.1830791813,0.0103792696 0.2594677475,-0.0334472349c0.042100113,0.0928009202 0.1205930075,0.1674914182 0.2240666796,0.1960572479c0.1476344161,0.0407610407 0.297446165,-0.0238077445 0.3783262342,-0.1475652419c0.0327623278,0.0238981846 0.0691792333,0.0436665447 0.1102008706,0.0549940004c0.1859065794,0.0513256592 0.3770116432,-0.0627203154 0.4268255671,-0.2542745401c0.0250490557,-0.0963230532 0.0095494076,-0.1938010889 -0.0356681889,-0.2736906101c0.0447507424,-0.0439678867 0.0797796014,-0.0996624318 0.0969425462,-0.1656617192c0.0498137481,-0.1915564561 -0.0608688118,-0.3884669813 -0.2467755669,-0.4397928163c-0.0195699622,-0.0054005426 -0.0391731675,-0.0084429542 -0.0586916488,-0.0102888295c0.0115683912,-0.1682147574 -0.0933564223,-0.3269222408 -0.2572937178,-0.3721841203z\";\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(center, 6, radius);\n }\n },\n \"diamond\":{\n getShape: function() {\n var d = new paper.Path.Rectangle([-Math.SQRT2, -Math.SQRT2], [Math.SQRT2, Math.SQRT2]);\n d.rotate(45);\n return d;\n },\n getImageShape: function(center, radius) {\n var d = new paper.Path.Rectangle([-radius*Math.SQRT2/2, -radius*Math.SQRT2/2], [radius*Math.SQRT2, radius*Math.SQRT2]);\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(center, 8, radius*1, radius*0.7);\n }\n },\n \"cloud\": {\n getShape: function() {\n var path = new paper.Path(cloud_path);\n return path;\n\n },\n getImageShape: function(center, radius) {\n var path = new paper.Path(cloud_path);\n path.scale(radius);\n path.translate(center);\n return path;\n }\n },\n \"triangle\": {\n getShape: function() {\n return new paper.Path.RegularPolygon([0,0], 3, 1);\n },\n getImageShape: function(center, radius) {\n return new paper.Path.RegularPolygon(center, 3, radius);\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(shape === null || 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 ShapeBuilder.builders = builders;\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 this.hidden = false;\n this.ghost= false;\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.NodeHideButton(this.renderer, null),\n new Renderer.NodeShowButton(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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.node_stroke_width + (thickness-1) * (this.options.node_stroke_max_width - this.options.node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_node_stroke_width + (thickness-1) * (this.options.selected_node_stroke_max_width - this.options.selected_node_stroke_width) / (this.options.node_stroke_witdh_scale-1);\n },\n buildShape: function(){\n if( 'shape' in this.model.changed ) {\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.circle.sendToBack();\n this.last_circle_radius = 1;\n },\n redraw: function(options) {\n if( 'shape' in this.model.changed && 'change' in options && options.change ) {\n //if( 'shape' in this.model.changed ) {\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 if (this.selected && this.renderer.isEditable() && !this.ghost) {\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 var _strokeWidth = this._getStrokeWidth();\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 + 0.5*_strokeWidth,\n opacity: opacity\n });\n var _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null;\n this.circle.strokeWidth = _strokeWidth;\n this.circle.strokeColor = _color;\n this.circle.dashArray = _dash;\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 if(this.circle) {\n this.circle.sendToBack();\n }\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 (typeof options === 'undefined' || !('dontRedrawEdges' in options) || !options.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 if (this.ghost){\n this.show(true);\n } else {\n if (this.hidden) { this.hide(); }\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.node_image.insertAbove(this.circle);\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._getSelectedStrokeWidth();\n if (this.renderer.isEditable() && !this.hidden) {\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 //if the node is hidden and the mouse hover it, it appears as a ghost\n if (this.hidden) {\n this.show(true);\n }\n else {\n this.showNeighbors(true);\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._getStrokeWidth();\n $('.Rk-Bin-Item').removeClass(\"selected\");\n if (this.renderer.minimap) {\n this.minimap_circle.strokeColor = undefined;\n }\n //when the mouse don't hover the node anymore, we hide it\n if (this.hidden) {\n this.hide();\n }\n else {\n this.hideNeighbors();\n }\n this._super(\"unselect\");\n }\n },\n hide: function(){\n var _this = this;\n this.ghost = false;\n this.hidden = true;\n if (typeof this.node_image !== 'undefined'){\n this.node_image.opacity = 0; \n }\n this.hideButtons();\n this.circle.opacity = 0;\n this.title.css('opacity', 0);\n this.minimap_circle.opacity = 0;\n \n \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.hide();\n }\n }\n );\n this.hideNeighbors();\n },\n show: function(ghost){\n var _this = this;\n this.ghost = ghost;\n if (this.ghost){\n if (typeof this.node_image !== 'undefined'){\n this.node_image.opacity = 0.3;\n }\n this.circle.opacity = 0.3;\n this.title.css('opacity', 0.3);\n this.minimap_circle.opacity = 0.3;\n } else {\n this.hidden = false;\n this.redraw();\n }\n \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.show(_this.ghost);\n }\n }\n ); \n },\n hideNeighbors: function(){\n var _this = this;\n _.each(\n this.project.get(\"edges\").filter(\n function (ed) {\n return (ed.get(\"from\") === _this.model);\n }\n ),\n function(edge, index, list) {\n var repr = _this.renderer.getRepresentationByModel(edge.get(\"to\"));\n if (repr && repr.ghost) {\n repr.hide();\n }\n }\n );\n },\n showNeighbors: function(ghost){\n var _this = this;\n _.each(\n this.project.get(\"edges\").filter(\n function (ed) {\n return (ed.get(\"from\") === _this.model);\n }\n ),\n function(edge, index, list) {\n var repr = _this.renderer.getRepresentationByModel(edge.get(\"to\"));\n if (repr && repr.hidden) {\n repr.show(ghost);\n if (!ghost){\n var indexNode = _this.renderer.hiddenNodes.indexOf(repr.model.id);\n if (indexNode !== -1){\n _this.renderer.hiddenNodes.splice(indexNode, 1);\n }\n }\n }\n }\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 (this.hidden) {\n var index = this.renderer.hiddenNodes.indexOf(this.model.id);\n if (index !== -1){\n this.renderer.hiddenNodes.splice(index, 1);\n }\n this.show(false);\n this.select();\n } else {\n if (!_isTouch && !this.model.get(\"delete_scheduled\")) {\n this.openEditor();\n }\n this.model.trigger(\"clicked\");\n }\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 }).value();\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.hidden = false;\n this.ghost = false;\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_scale = 1;\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.pivot = new paper.Point([ this.options.edge_arrow_length / 2, this.options.edge_arrow_width / 2 ]);\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 _getStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.edge_stroke_width + (thickness-1) * (this.options.edge_stroke_max_width - this.options.edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getSelectedStrokeWidth: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return this.options.selected_edge_stroke_width + (thickness-1) * (this.options.selected_edge_stroke_max_width - this.options.selected_edge_stroke_width) / (this.options.edge_stroke_witdh_scale-1);\n },\n _getArrowScale: function() {\n var thickness = (this.model.has('style') && this.model.get('style').thickness) || 1;\n return 1 + (thickness-1) * ((this.options.edge_arrow_max_width / this.options.edge_arrow_width) - 1) / (this.options.edge_stroke_witdh_scale-1);\n },\n redraw: function() {\n var from = this.model.get(\"from\"),\n to = this.model.get(\"to\");\n if (!from || !to || (this.hidden && !this.ghost)) {\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 (this.from_representation.hidden && !this.from_representation.ghost) ||\n (this.to_representation.hidden && !this.to_representation.ghost)) {\n this.hide();\n return;\n }\n var _strokeWidth = this._getStrokeWidth(),\n _arrow_scale = this._getArrowScale(),\n _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 + 0.5 * _arrow_scale * this.options.edge_arrow_width),\n _handle = _v.divide(3),\n _color = (this.model.has(\"style\") && this.model.get(\"style\").color) || (this.model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n _dash = (this.model.has(\"style\") && this.model.get(\"style\").dash) ? this.options.default_dash_array : null,\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 var array_opacity =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) || !this.model.has(\"style\") || (typeof this.model.get(\"style\").arrow === 'undefined') ? opacity : 0;\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\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.strokeWidth = _strokeWidth;\n this.line.strokeColor = _color;\n this.line.dashArray = _dash;\n this.line.opacity = this.ghost ? 0.3 : 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.scale(_arrow_scale / this.arrow_scale);\n this.arrow_scale = _arrow_scale;\n this.arrow.fillColor = _color;\n this.arrow.opacity = this.ghost ? 0.3 : array_opacity; //TODO: magic constant + var name\n this.arrow.rotate(_a - this.arrow_angle, this.arrow.bounds.center);\n this.arrow.position = this.paper_coords;\n\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: this.ghost ? 0.3 : 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 hide: function(){\n this.hidden = true;\n this.ghost = false;\n \n this.text.hide();\n this.line.visible = false;\n this.arrow.visible = false;\n this.minimap_line.visible = false;\n },\n show: function(ghost){\n this.ghost = ghost;\n if (this.ghost) {\n this.text.css('opacity', 0.3);\n this.line.opacity = 0.3;\n this.arrow.opacity = 0.3;\n this.minimap_line.opacity = 0.3;\n } else {\n this.hidden = false;\n \n this.text.css('opacity', 1);\n this.line.opacity = 1;\n this.arrow.opacity = 1;\n this.minimap_line.opacity = 1;\n }\n this.text.show();\n this.line.visible = true;\n this.arrow.visible = true;\n this.minimap_line.visible = true;\n this.redraw();\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._getSelectedStrokeWidth();\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._getStrokeWidth();\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 = _.reject(this.bundle.edges, function(_edge) {\n return _this === _edge;\n });\n }\n }).value();\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 }).value();\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 = _.map(_.range(8), 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 }).value();\n\n /* _BaseEditor End */\n\n return _BaseEditor;\n\n});\n\n\ndefine('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder'], function ($, _, requtils, BaseEditor, ShapeBuilder) {\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/nodeeditor.html'];\n //this.templates['default']= this.options.templates['templates/nodeeditor.html'];\n //fusionner avec this.options.node_editor_templates\n this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\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 shapes : _(ShapeBuilder.builders).omit('svg').keys().value(),\n }));\n this.redraw();\n var _this = this,\n closeEditor = function() {\n _this.editor_$.off(\"keyup\");\n _this.editor_$.find(\"input, textarea, select\").off(\"change keyup paste\");\n _this.editor_$.find(\".Rk-Edit-Image-File\").off('change');\n _this.editor_$.find(\".Rk-Edit-ColorPicker-Wrapper\").off('hover');\n _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\n _this.editor_$.find(\".Rk-Edit-Image-Del\").off('click');\n _this.editor_$.find(\".Rk-Edit-ColorPicker\").find(\"li\").off('hover click');\n _this.editor_$.find(\".Rk-CloseX\").off('click');\n _this.editor_$.find(\".Rk-Edit-Goto\").off('click');\n\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 = _.throttle(function() {\n _.defer(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.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\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 }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {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 var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\n });\n\n this.editor_$.find(\".Rk-Edit-Image-Del\").click(function() {\n _this.editor_$.find(\".Rk-Edit-Image\").val('');\n onFieldChange();\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 if (this.options.popup_editor){\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 }\n this.editor_$.show();\n paper.view.draw();\n }\n }).value();\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 _init: function() {\n BaseEditor.prototype._init.apply(this);\n this.template = this.options.templates['templates/edgeeditor.html'];\n this.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html'];\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.has(\"style\") && _model.get(\"style\").color) || _created_by.get(\"color\"),\n dash: _model.has(\"style\") && _model.get(\"style\").dash ? \"checked\" : \"\",\n arrow: (_model.has(\"style\") && _model.get(\"style\").arrow) || !_model.has(\"style\") || (typeof _model.get(\"style\").arrow === 'undefined') ? \"checked\" : \"\",\n thickness: (_model.has(\"style\") && _model.get(\"style\").thickness) || 1,\n from_title: _from_model.get(\"title\"),\n to_title: _to_model.get(\"title\"),\n from_color: (_from_model.has(\"style\") && _from_model.get(\"style\").color) || (_from_model.get(\"created_by\") || Utils._USER_PLACEHOLDER(this.renkan)).get(\"color\"),\n to_color: (_to_model.has(\"style\") && _to_model.get(\"style\").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 _this.editor_$.find(\".Rk-Edit-Size-Btn\").off('click');\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 = _.throttle(function() {\n _.defer(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 if (_this.options.show_node_editor_style) {\n var dash = _this.editor_$.find(\".Rk-Edit-Dash\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash});\n var arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {arrow: arrow});\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 });\n },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.has(\"style\") && _model.get(\"style\").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(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {color: $(this).attr(\"data-color\")}));\n _picker.hide();\n paper.view.draw();\n } else {\n closeEditor();\n }\n });\n var shiftThickness = function(n) {\n if (_this.renderer.isEditable()) {\n var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1),\n _newThickness = n + _oldThickness;\n if(_newThickness < 1 ) {\n _newThickness = 1;\n }\n else if (_newThickness > _this.options.node_stroke_witdh_scale) {\n _newThickness = _this.options.node_stroke_witdh_scale;\n }\n if (_newThickness !== _oldThickness) {\n _this.editor_$.find(\"#Rk-Edit-Thickness-Value\").text(_newThickness);\n _model.set(\"style\", _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {thickness: _newThickness}));\n paper.view.draw();\n }\n }\n else {\n closeEditor();\n }\n };\n\n this.editor_$.find(\"#Rk-Edit-Thickness-Down\").click(function() {\n shiftThickness(-1);\n return false;\n });\n this.editor_$.find(\"#Rk-Edit-Thickness-Up\").click(function() {\n shiftThickness(1);\n return false;\n });\n }\n },\n redraw: function() {\n if (this.options.popup_editor){\n var _coords = this.source_representation.paper_coords;\n Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);\n }\n this.editor_$.show();\n paper.view.draw();\n }\n }).value();\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 }).value();\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 = -125;\n this.endAngle = -55;\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 }).value();\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 = -10;\n this.endAngle = 45;\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 }).value();\n\n /* NodeRemoveButton End */\n\n return NodeRemoveButton;\n\n});\n\n\ndefine('renderer/nodehidebutton',['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 NodeHideButton = Utils.inherit(NodeButton);\n\n _(NodeHideButton.prototype).extend({\n _init: function() {\n this.type = \"Node-hide-button\";\n this.lastSectorInner = 0;\n this.startAngle = 45;\n this.endAngle = 90;\n this.imageName = \"hide\";\n this.text = \"Hide\";\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 this.renderer.addHiddenNode(this.source_representation.model);\n }\n }\n }).value();\n\n /* NodeRemoveButton End */\n\n return NodeHideButton;\n\n});\n\n\ndefine('renderer/nodeshowbutton',['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 NodeShowButton = Utils.inherit(NodeButton);\n\n _(NodeShowButton.prototype).extend({\n _init: function() {\n this.type = \"Node-show-button\";\n this.lastSectorInner = 0;\n this.startAngle = 90;\n this.endAngle = 135;\n this.imageName = \"show\";\n this.text = \"Show\";\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 this.source_representation.showNeighbors(false);\n }\n }\n }).value();\n\n /* NodeShowButton End */\n\n return NodeShowButton;\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 }).value();\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 = 135;\n this.endAngle = 190;\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 }).value();\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 = -55;\n this.endAngle = -10;\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 }).value();\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 = -170;\n this.endAngle = -125;\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 }).value();\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 if (!_renkan.options.popup_editor){\n this.editor_$ = $(\"#\" + _renkan.options.editor_panel);\n }else{\n this.editor_$ = this.$.find(\".Rk-Editor\");\n }\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.hiddenNodes = [];\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).value();\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', 'hide', 'show', '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 _.each(_event.originalEvent.dataTransfer.types, 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 _.extend(res,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, hidden_nodes: _this.hiddenNodes } );\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 _this.hiddenNodes = view.get(\"hidden_nodes\") || [];\n _this.hideNodes();\n }\n });\n this.$.find(\".Rk-ShowHiddenNodes\").mouseenter( function() {\n _this.showNodes(true);\n _this.$.find(\".Rk-ShowHiddenNodes\").mouseleave( function() {\n _this.hideNodes(false);\n });\n });\n this.$.find(\".Rk-ShowHiddenNodes\").click( function() {\n _this.showNodes(false);\n _this.$.find(\".Rk-ShowHiddenNodes\").off( \"mouseleave\" ); \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:saveStatus\", function(){\n switch (_this.renkan.project.get(\"saveStatus\")) {\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:loadingStatus\", function(){\n if (_this.renkan.project.get(\"loadingStatus\")){\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(\"loadingStatus\")){\n _thRedraw();\n }\n });\n this.renkan.project.on(\"add:edges\", function(_edge) {\n _this.addRepresentation(\"Edge\", _edge);\n if (!_this.renkan.project.get(\"loadingStatus\")){\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 = _.reject(this.representations,\n function(_repr) {\n return _repr === _representation;\n }\n );\n },\n getRepresentationByModel: function(_model) {\n if (!_model) {\n return undefined;\n }\n return _.find(this.representations, function(_repr) {\n return _repr.model === _model;\n });\n },\n removeRepresentationsOfType: function(_type) {\n var _representations = _.filter(this.representations,function(_repr) {\n return _repr.type === _type;\n }),\n _this = this;\n _.each(_representations, 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 _.each(this.representations, function(_repr) {\n _repr.unhighlight();\n });\n },\n unselectAll: function(_model) {\n _.each(this.representations, function(_repr) {\n _repr.unselect();\n });\n },\n redraw: function() {\n var _this = this;\n if(! this.redrawActive ) {\n return;\n }\n _.each(this.representations, function(_representation) {\n _representation.redraw({ dontRedrawEdges: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 addHiddenNode: function(_model){\n this.hideNode(_model);\n this.hiddenNodes.push(_model.id);\n },\n hideNode: function(_model){\n var _this = this;\n if (typeof _this.getRepresentationByModel(_model) !== 'undefined'){\n _this.getRepresentationByModel(_model).hide();\n }\n },\n hideNodes: function(){\n var _this = this;\n this.hiddenNodes.forEach(function(_id, index){\n var node = _this.renkan.project.get(\"nodes\").get(_id);\n if (typeof node !== 'undefined'){\n return _this.hideNode(_this.renkan.project.get(\"nodes\").get(_id));\n }else{\n _this.hiddenNodes.splice(index, 1);\n }\n });\n paper.view.draw();\n },\n showNodes: function(ghost){\n var _this = this;\n this.hiddenNodes.forEach(function(_id){\n _this.getRepresentationByModel(_this.renkan.project.get(\"nodes\").get(_id)).show(ghost);\n });\n if (!ghost){\n this.hiddenNodes = [];\n }\n paper.view.draw();\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 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 \n if (!this.isEditable()) {\n if (_hitResult && typeof _hitResult.item.__representation !== \"undefined\") {\n if (_hitResult.item.__representation.model.get('uri')){\n window.open(_hitResult.item.__representation.model.get('uri'), '_blank');\n }\n }\n return;\n }\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 _.extend(_data,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 }).value();\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/lodash/lodash',\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/nodehidebutton',\n 'renderer/nodeshowbutton',\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, NodeHideButton, NodeShowButton, 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.NodeHideButton = NodeHideButton;\n Renderer.NodeShowButton = NodeShowButton;\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