--- a/client/bower.json Wed Oct 14 14:56:41 2015 +0200
+++ b/client/bower.json Mon Oct 19 14:18:51 2015 +0200
@@ -1,6 +1,6 @@
{
"name": "renkan",
- "version": "0.12.13",
+ "version": "0.12.14",
"authors": [
"IRI <dev@iri-research.org>"
],
--- a/client/package.json Wed Oct 14 14:56:41 2015 +0200
+++ b/client/package.json Mon Oct 19 14:18:51 2015 +0200
@@ -1,6 +1,6 @@
{
"name": "renkan",
- "version": "0.12.13",
+ "version": "0.12.14",
"description": "Renkan client application",
"repository": {
"type": "hg",
--- a/server/java/build.gradle Wed Oct 14 14:56:41 2015 +0200
+++ b/server/java/build.gradle Mon Oct 19 14:18:51 2015 +0200
@@ -2,7 +2,7 @@
apply plugin: 'maven'
group = 'org.iri_research.renkan'
- version = '0.12.13'
+ version = '0.12.14'
gradle.projectsEvaluated {
--- a/server/java/pom.xml Wed Oct 14 14:56:41 2015 +0200
+++ b/server/java/pom.xml Mon Oct 19 14:18:51 2015 +0200
@@ -5,7 +5,7 @@
<groupId>org.iri_research.renkan</groupId>
<artifactId>renkan</artifactId>
<packaging>pom</packaging>
- <version>0.12.13</version>
+ <version>0.12.14</version>
<name>Renkan project</name>
<modules>
--- a/server/java/renkan-core/pom.xml Wed Oct 14 14:56:41 2015 +0200
+++ b/server/java/renkan-core/pom.xml Mon Oct 19 14:18:51 2015 +0200
@@ -6,7 +6,7 @@
<parent>
<groupId>org.iri_research.renkan</groupId>
<artifactId>renkan</artifactId>
- <version>0.12.13</version>
+ <version>0.12.14</version>
</parent>
<artifactId>renkan-core</artifactId>
<name>renkan-core</name>
--- a/server/java/renkan-management/pom.xml Wed Oct 14 14:56:41 2015 +0200
+++ b/server/java/renkan-management/pom.xml Mon Oct 19 14:18:51 2015 +0200
@@ -5,7 +5,7 @@
<parent>
<groupId>org.iri_research.renkan</groupId>
<artifactId>renkan</artifactId>
- <version>0.12.13</version>
+ <version>0.12.14</version>
</parent>
<artifactId>renkan-management</artifactId>
--- a/server/java/renkan-web/pom.xml Wed Oct 14 14:56:41 2015 +0200
+++ b/server/java/renkan-web/pom.xml Mon Oct 19 14:18:51 2015 +0200
@@ -5,7 +5,7 @@
<parent>
<groupId>org.iri_research.renkan</groupId>
<artifactId>renkan</artifactId>
- <version>0.12.13</version>
+ <version>0.12.14</version>
</parent>
<artifactId>renkan-web</artifactId>
<packaging>war</packaging>
--- a/server/php/basic/public_html/static/lib/renkan/css/renkan.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/css/renkan.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
/*!
* _____ _
--- a/server/php/basic/public_html/static/lib/renkan/css/renkan.min.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/css/renkan.min.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
/*!
--- a/server/php/basic/public_html/static/lib/renkan/css/space-editor.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/css/space-editor.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
html {
overflow: visible !important;
--- a/server/php/basic/public_html/static/lib/renkan/css/space-editor.min.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/css/space-editor.min.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
html{overflow:visible!important}body{font-family:Arial,Helvetica,sans-serif;background:#F6F6F6;color:#333}.clearer{display:block;clear:both;height:1px}h1{margin-bottom:5px;padding:0 15px;background:#333;color:#fff;font-weight:700;font-size:30px;line-height:60px}.right{width:301px;position:absolute;top:10px;right:10px}.main{margin:10px 330px 10px 20px}.blue-button{display:inline-block;padding:4px 6px;color:#fff;text-decoration:none;border-radius:4px;background:-moz-linear-gradient(top,#6080c0,#2040a0);background:-webkit-linear-gradient(top,#6080c0,#2040a0);box-shadow:1px 1px 2px gray}.blue-button:hover{background:-moz-linear-gradient(top,#2040a0,#6080c0);background:-webkit-linear-gradient(top,#2040a0,#6080c0)}.update-preview{text-align:center;display:block;margin-bottom:10px;font-size:24px;font-weight:700;line-height:34px}#preview{position:relative;border-left:1px solid #000;border-bottom:1px solid #000;width:300px;height:800px;border-radius:4px;overflow:hidden;margin-bottom:10px}.section-title{font-size:20px;font-weight:700;margin:20px 0 5px}.first-level-list{margin:5px 0}.add-item{margin:5px 0;font-size:22px;font-weight:700;line-height:18px}.add-item:hover:after{float:right;font-size:14px;font-weight:400;line-height:18px;margin-left:4px}.add-search-engine:hover:after{content:"Add Search Engine"}.add-resource:hover:after{content:"Add Resource"}.add-bin:hover:after{content:"Add Bin"}.item{padding:5px;margin:5px 0;border-radius:4px;font-size:12px;background:-moz-linear-gradient(top,#ffcc8f,#fff0d0);background:-webkit-linear-gradient(top,#ffcc8f,#fff0d0);box-shadow:1px 1px 2px gray}.remove-item{float:right;font-size:22px;line-height:18px;height:18px;margin:0 0 2px -10px;font-weight:700}.setting{float:left;width:260px;margin:2px 15px 2px 2px;line-height:24px;min-height:24px}.setting label{float:left;display:block;width:100px;font-weight:700}.display-value{float:left;display:block;width:160px}.edit-value{width:160px;display:none;border:1px solid #ccc;border-radius:3px}input.edit-value,textarea.edit-value{width:154px;padding:2px}textarea.edit-value{resize:vertical;height:72px}.item-editing .display-value{display:none}.item-editing .edit-value{display:inline-block}.resource-list-title{clear:both;width:100%;font-size:16px;font-weight:700;margin:5px 0 0}.resource{display:block;clear:both;padding:5px;margin:5px;border-radius:4px;background:-moz-linear-gradient(top,#ff8f00,#ffcc8f);background:-webkit-linear-gradient(top,#ff8f00,#ffcc8f);box-shadow:1px 1px 2px gray}.resource .display-value{display:inline-block}.resource .edit-value,.resource.resource-editing .display-value{display:none}.resource.resource-editing .edit-value{display:inline-block}
\ No newline at end of file
--- a/server/php/basic/public_html/static/lib/renkan/js/renkan.js Wed Oct 14 14:56:41 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/js/renkan.js Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
this["renkanJST"] = this["renkanJST"] || {};
@@ -2843,7 +2843,7 @@
define('renderer/baserepresentation',['jquery', 'underscore'], function ($, _) {
-
+ 'use strict';
/* Rkns.Renderer._BaseRepresentation Class */
@@ -2928,7 +2928,7 @@
});
define('requtils',[], function ($, _) {
-
+ 'use strict';
return {
getUtils: function(){
return window.Rkns.Utils;
@@ -2942,7 +2942,7 @@
define('renderer/basebutton',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -2984,7 +2984,7 @@
define('renderer/shapebuilder',[], function () {
-
+ 'use strict';
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";
/* ShapeBuilder Begin */
@@ -3099,7 +3099,7 @@
});
define('renderer/noderepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation', 'renderer/shapebuilder'], function ($, _, requtils, BaseRepresentation, ShapeBuilder) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -3706,7 +3706,7 @@
define('renderer/edge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4007,7 +4007,7 @@
define('renderer/tempedge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4107,7 +4107,7 @@
define('renderer/baseeditor',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4147,7 +4147,7 @@
define('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder', 'ckeditor-jquery'], function ($, _, requtils, BaseEditor, ShapeBuilder) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4481,7 +4481,7 @@
define('renderer/edgeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4674,7 +4674,7 @@
define('renderer/nodebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4726,7 +4726,7 @@
define('renderer/nodeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4759,7 +4759,7 @@
define('renderer/noderemovebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4806,7 +4806,7 @@
define('renderer/nodehidebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4842,7 +4842,7 @@
define('renderer/nodeshowbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4878,7 +4878,7 @@
define('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4913,7 +4913,7 @@
define('renderer/nodelinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4954,7 +4954,7 @@
define('renderer/nodeenlargebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4989,7 +4989,7 @@
define('renderer/nodeshrinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5024,7 +5024,7 @@
define('renderer/edgeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5053,7 +5053,7 @@
define('renderer/edgeremovebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5096,7 +5096,7 @@
define('renderer/edgerevertbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5127,7 +5127,7 @@
define('renderer/miniframe',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5156,7 +5156,7 @@
define('renderer/scene',['jquery', 'underscore', 'filesaver', 'requtils', 'renderer/miniframe', 'screenfull'], function ($, _, filesaver, requtils, MiniFrame, Screenfull) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -6476,7 +6476,7 @@
});
define('renderer/viewrepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -6756,7 +6756,7 @@
'renderer/viewrepr'
], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene, ViewRepr){
-
+ 'use strict';
var Rkns = window.Rkns;
--- a/server/php/basic/public_html/static/lib/renkan/js/renkan.min.js Wed Oct 14 14:56:41 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/js/renkan.min.js Mon Oct 19 14:18:51 2015 +0200
@@ -24,12 +24,12 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - 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 __t,__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>"+(null==(__t=edge.description)?"":__t)+"</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 ",__p+=options.show_node_editor_title_richtext?'\n <div class="Rk-Edit-Title" contenteditable="true">'+(null==(__t=node.title)?"":__t)+"</div>\n ":'\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n ',__p+=" \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.change_types&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Types available"))+':</label>\n <select class="Rk-Edit-Type">\n ',_.each(types,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.type===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+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+"</label>\n ",__p+=options.show_node_editor_description_richtext?'\n <div class="Rk-Edit-Description" contenteditable="true">'+(null==(__t=node.description)?"":__t)+"</div>\n ":'\n <textarea class="Rk-Edit-Description">'+(null==(__t=node.description)?"":__t)+"</textarea>\n ",__p+="\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 __t,__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 "+(null==(__t=node.title)?"":__t)+"\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">'+(null==(__t=node.description)?"":__t)+"</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 <a href="#?idNode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\n";return __p},this.renkanJST["templates/nodeeditor_video.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 <video width="320" height="240" controls>\n <source src="'+__e(node.uri)+'" type="video/mp4">\n </video> \n'),__p+='\n <a href="#?idnode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\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("Save view"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved view"))+'"></div>\n ',options.hide_nodes&&(__p+='\n <div class="Rk-ShowHiddenNodes" title="'+__e(translate("Show hidden nodes"))+'"></div>\n '),__p+=" \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;b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:d.defaults(a.templates,renkanJST)||renkanJST,node_editor_templates:d.defaults(a.node_editor_templates,b.defaults.node_editor_templates)}),this.template=renkanJST["templates/main.html"];var f={};if(d.each(this.options.node_editor_templates,function(a,b){f[b]=e.options.templates[a],delete e.options.templates[a]}),this.options.node_editor_templates=f,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.router=new b.Router,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 g=renkanJST["templates/search.html"],h=this.$.find(".Rk-Search-List"),i=this.$.find(".Rk-Web-Search-Input"),j=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))}),h.html(d(this.search_engines).map(function(a,b){return g({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),h.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),j.submit()}),j.submit(function(){if(i.val()){var a=e.search_engine;a.search(i.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){h.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){h.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 k=!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(){k=!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(k)e.renderer.onMouseMove(b,!0);else{k=!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){k&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),k=!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 l=!1,m="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==m){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==l&&(l=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.fillColor=new paper.Color(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.Backbone;a.Rkns.Router=b.Router.extend({routes:{"":"index"},index:function(a){var b={};null!==a&&a.split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),this.trigger("router",b)}})}}(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.style=d.color?{color:d.color}:{}}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]&&(a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){this.project.set(this.convert(a),{validate:!0}),this.project.trigger("loaded",!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:!1,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,view_force_autoscale:!0,view_show_hiddennodes:!0,default_index_view:-1,url_parameters:!0,update_url:!0,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,ghost_opacity:.3,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)",hide_nodes:!0,change_shapes:!0,change_types:!0,node_editor_templates:{"default":"templates/nodeeditor_readonly.html",video:"templates/nodeeditor_video.html"},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,tooltip_opacity:.8,richtext_editor_config:{toolbarGroups:[{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"clipboard",groups:["clipboard","undo"]},"/",{name:"styles"}],removePlugins:"colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates"},show_node_editor_uri:!0,show_node_editor_title:!0,show_node_editor_title_richtext:!0,show_node_editor_description:!0,show_node_editor_description_richtext:!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",Polygon:"Polygone","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Save view":"Sauver la vue","View saved view":"Restaurer la Vue","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 ","Show hidden nodes":"Montrer les noeuds cachés","Show neighbors":"Montrer les voisins",Hide:"Cacher","Fullscreen not supported by your browser":"Le plein écran n'est pas supporté par votre navigateur"}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0})})},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})}})},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&&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){var c=new paper.Path.RegularPolygon([0,0],3,1);return c.scale(b),c.translate(a),c}},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.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.options.hide_nodes&&this.normal_buttons.push(new b.NodeHideButton(this.renderer,null),new b.NodeShowButton(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.view.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"),i=document.createElement("div");i.innerHTML=h;var j=i.textContent||i.innerText||"",k=j||this.renkan.translate(this.options.label_untitled_nodes)||"";k=f.shortenText(k,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(k).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(k);var l=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*l,opacity:g});var m=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),n=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=l,this.circle.strokeColor=m,this.circle.dashArray=n;var o=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(o)});var p=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==p&&(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=m;var q=this.renderer.toMinimapCoords(c),r=this.renderer.minimap.scale*d,s=new paper.Size([r,r]);this.minimap_circle.fitBounds(q.subtract(s),s.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var t=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===t.model||a.get("from")===t.model}),function(a){var b=t.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.view.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){clearTimeout(this.hide_timeout),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.renderer.removeRepresentationsOfType("editor"),this.hide()):this.hideNeighbors(!0),this._super("unselect")}},hide_delay:function(){var a=this;this.hide_timeout=setTimeout(function(){a.hide()},1e3)},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(!1)},show:function(a){var c=this;this.ghost=a,this.ghost?("undefined"!=typeof this.node_image&&(this.node_image.opacity=this.options.ghost_opacity),this.circle.opacity=this.options.ghost_opacity,this.title.css("opacity",this.options.ghost_opacity),this.minimap_circle.opacity=this.options.ghost_opacity):(this.minimap_circle.opacity=1,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(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"));d&&d.ghost&&(a?d.hide_delay():d.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.view.hiddenNodes.indexOf(d.model.id);-1!==e&&c.renderer.view.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.view.hiddenNodes.indexOf(this.model.id);-1!==c&&this.renderer.view.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,d=this._getStrokeWidth(),f=this._getArrowScale(),g=this.from_representation.paper_coords,h=this.to_representation.paper_coords,i=h.subtract(g),j=i.length,k=i.divide(j),l=new paper.Point([-k.y,k.x]),m=this.bundle.getPosition(this),n=l.multiply(this.options.edge_gap_in_bundles*m),o=g.add(n),p=h.add(n),q=i.angle,r=l.multiply(this.options.edge_label_distance+.5*f*this.options.edge_arrow_width),s=i.divide(3),t=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),u=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(c=.5,this.line.dashArray=[2,2]):(c=this.ghost?this.options.ghost_opacity:1,this.line.dashArray=null);var v=this.active_buttons;this.arrow.visible=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow,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=o.add(p).divide(2),this.line.strokeWidth=d,this.line.strokeColor=t,this.line.dashArray=u,this.line.opacity=c,this.line.segments[0].point=g,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=s.multiply(-1),this.line.segments[1].handleOut=s,this.line.segments[2].point=h,this.arrow.scale(f/this.arrow_scale),this.arrow_scale=f,this.arrow.fillColor=t,this.arrow.opacity=c,this.arrow.rotate(q-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=q,q>90&&(q-=180,r=r.multiply(-1)),-90>q&&(q+=180,r=r.multiply(-1));var w=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";w=e.shortenText(w,this.options.node_label_max_length),this.text.text(w);var x=this.paper_coords.add(r);this.text.css({left:x.x,top:x.y,transform:"rotate("+q+"deg)","-moz-transform":"rotate("+q+"deg)","-webkit-transform":"rotate("+q+"deg)",opacity:c}),this.text_angle=q;var y=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(y)}),this.renderer.minimap&&(this.minimap_line.strokeColor=t,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.hidden&&this.renderer.removeRepresentationsOfType("editor"),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=this.options.tooltip_opacity,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:this.options.tooltip_opacity}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder","ckeditor-jquery"],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.node_editor_templates},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[c.get("type")]||this.readOnlyTemplate["default"],h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{_id:c.get("_id"),has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),type:c.get("type")||"default",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(),types:b(this.options.node_editor_templates).keys().value()})),this.redraw();var j=this,k=j.options.show_node_editor_description_richtext?a(".Rk-Edit-Description").ckeditor(j.options.richtext_editor_config):!1,l=j.options.show_node_editor_title_richtext?a(".Rk-Edit-Title").ckeditor(j.options.richtext_editor_config):!1,m=function(){j.renderer.removeRepresentation(j),paper.view.draw()};if(j.cleanEditor=function(){if(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.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor){var a=k.editor;delete k.editor,a.focusManager.blur(!0),a.destroy()}if(j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor){var b=l.editor;delete l.editor,b.focusManager.blur(!0),b.destroy()}},this.editor_$.find(".Rk-CloseX").click(function(a){a.preventDefault(),m()}),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var n=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={};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&&(j.options.show_node_editor_description_richtext?"undefined"!=typeof k.editor&&k.editor.checkDirty()&&(a.description=k.editor.getData(),k.editor.resetDirty()):a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_title&&(j.options.show_node_editor_title_richtext?"undefined"!=typeof l.editor&&l.editor.checkDirty()&&(a.title=l.editor.getData(),l.editor.resetDirty()):a.title=j.editor_$.find(".Rk-Edit-Title").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()),j.options.change_types&&c.get("type")!==j.editor_$.find(".Rk-Edit-Type").val()&&(a.type=j.editor_$.find(".Rk-Edit-Type").val()),c.set(a),j.redraw()}else m()})},1e3);this.editor_$.on("keyup",function(a){27===a.keyCode&&m()}),this.editor_$.find("input, textarea, select").on("change keyup paste",n),j.options.show_node_editor_description&&j.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor&&(k.editor.on("change",n),k.editor.on("blur",n)),j.options.show_node_editor_title&&j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor&&(l.editor.on("change",n),l.editor.on("blur",n)),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),n()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var o=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),o.show()},function(a){a.preventDefault(),o.hide()}),o.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")})),o.hide(),paper.view.draw()):m()});var p=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 m()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return p(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return p(1),!1});var q=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 m()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return q(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return q(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),n(),!1})}else if("object"==typeof this.source_representation.highlighted){var r=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(r),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()},destroy:function(){"undefined"!=typeof this.cleanEditor&&this.cleanEditor(),this.editor_block.remove(),this.editor_$.remove()}}).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"),e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d,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=this.options.hide_nodes?-125:-135,this.endAngle=this.options.hide_nodes?-55:-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=this.options.hide_nodes?-10:0,this.endAngle=this.options.hide_nodes?45: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/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.view.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 neighbors"},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=this.options.hide_nodes?135:90,this.endAngle=this.options.hide_nodes?190: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=this.options.hide_nodes?-55:-45,this.endAngle=this.options.hide_nodes?-10: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=this.options.hide_nodes?-170:-180,this.endAngle=this.options.hide_nodes?-125:-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","screenfull"],function(a,b,c,d,e,f){var g=d.getUtils(),h=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.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=!1,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,h=!0,i=1,j=!1,k=0,l=0,m=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 n=b.throttle(function(a,b){d.onMouseMove(a,b)},g._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),n(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),h&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-m<g._DOUBLETAP_DELAY&&Math.pow(k-b.pageX,2)+Math.pow(l-b.pageY,2)<g._DOUBLETAP_DISTANCE?(m=0,d.onDoubleClick(b)):(m=new Date,k=b.pageX,l=b.pageY,i=d.view.scale,j=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),m=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(j||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,j=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*i,c=b/d.view.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.view.offset.multiply(c));d.view.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.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),h=!1},dragleave:function(a){a.preventDefault(),h=!0},drop:function(a){a.preventDefault(),h=!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(g){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 o=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};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()}),f.enabled?(o(".Rk-FullScreen-Button","fullScreen"),document.addEventListener(f.raw.fullscreenchange,function(){setTimeout(function(){var a=d.$.width(),b=d.$.height();d.renkan.options.show_top_bar&&(b-=d.$.find(".Rk-TopBar").height()),d.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(a-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([a,b]),d.resize(d.currentWidth,a,d.currentHeight,b),d.currentWidth=a,d.currentHeight=b,f.isFullscreen||(paper.view.onResize=function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)})},600)})):(this.$.find(".Rk-FullScreen-Button").addClass("disabled"),this.$.find(".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents").html(this.renkan.translate("Fullscreen not supported by your browser"))),o(".Rk-AddNode-Button","addNodeBtn"),o(".Rk-AddEdge-Button","addEdgeBtn"),o(".Rk-Save-Button","save"),o(".Rk-Open-Button","open"),o(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+g._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()}),o(".Rk-Fold-Bins","foldBins"),paper.view.on("resize",function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)});var p=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 q=b.throttle(function(){d.redrawUsers()},100);if(q(),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("loaded",function(){d.renkan.options.url_parameters?Backbone.history.start():d.fixSize(),d.redrawActive=!0,p()}),this.renkan.router.on("router",function(a){d.setViewparameters(a)}),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",q),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>1?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")||p()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||p()}),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 r="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},r)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var s=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),t=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");s.hover(function(a){d.isEditable()&&(a.preventDefault(),t.show())},function(a){a.preventDefault(),t.hide()}),t.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 u="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==u)if(u=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var f=g.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){f.test(a.get("title"))||f.test(a.get("description"))?d.getRepresentationByModel(a).highlight(f):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(h.prototype).extend({fixSize:function(){"undefined"==typeof this.view&&(this.view=this.addRepresentation("View",this.renkan.project.get("views").last())),this.view.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()},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.view.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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&&"undefined"!=typeof this.view&&this.redrawMiniframe(),paper.view.draw())},resize:function(a,b,c,d){var e;this.minimap&&(this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle.fitBounds(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.cliprectangle.fitBounds(this.minimap.topleft,this.minimap.size));var f=d/c,g=b/a;e=b>d?f:g,this.view.resizeZoom(b-a,d-c,e),this.redraw()},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},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>g._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.view.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 f=paper.project.hitTest(e);if(f&&"undefined"!=typeof f.item.__representation)this.click_target=f.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===g._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}},j=this.renkan.project.addNode(i);this.getRepresentationByModel(j).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===g._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=g._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(),this.view.updateUrl();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.view.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.view.setScale(this.view.scale*Math.SQRT2,this.view.offset.subtract(d)):this.view.setScale(this.view.scale*Math.SQRT1_2,this.view.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),f={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(f);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 f="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:g.getUID("node"),created_by:this.renkan.current_user,uri:f.uri||"",title:f.title||"",description:f.description||"",image:f.image||"",color:f.color||void 0,clip_path:f.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(){this.currentWidth=this.$.width(),this.currentHeight=this.$.height();var a=this.renkan.$[0];paper.view.off("resize"),f.toggle(a)},addNodeBtn:function(){return this.click_mode===g._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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===g._CLICKMODE_STARTEDGE||this.click_mode===g._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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 f,h,i={};b.each(a.nodes,function(a){f=a.id||a._id,delete a._id,delete a.id,i[f]=a["@id"]=g.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=i[a.to],a.from=i[a.from]}),b.each(a.views,function(a){delete a._id,delete a.id,a.hidden_nodes&&(h=a.hidden_nodes,a.hidden_nodes=[],b.each(h,function(b){a.hidden_nodes.push(i[b])}))}),a.users=[];var j=JSON.stringify(a,null,2),k=new Blob([j],{type:"application/json;charset=utf-8"});c(k,e)},setViewparameters:function(b){if(this.removeRepresentationsOfType("View"),a.isEmptyObject(b))return void(this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))));if(this.view="undefined"!=typeof b.viewIndex?this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(b.viewIndex))):this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))),"undefined"!=typeof b.view&&b.view.split(",").length>=3){var c=b.view.split(","),d={project:this.renkan.project,offset:{x:parseFloat(c[0]),y:parseFloat(c[1])},zoom_level:parseFloat(c[2])};this.view.setScale(d.zoom_level,new paper.Point(d.offset))}"undefined"!=typeof b.view&&"autoscale"===b.view&&this.view.autoScale(),"undefined"!=typeof b.viewsNodes&&("true"===b.viewsNodes?(this.view.hiddenNodes=(this.view.params.hidden_nodes||[]).concat(),this.view.hideNodes()):this.view.showNodes(!1)),this.unhighlightAll(),"undefined"!=typeof b.idNode&&this.highlightModel(this.renkan.project.get("nodes").get(b.idNode))},validViewIndex:function(a){var b=parseInt(a),c=0;return c=0>b?this.renkan.project.get("views").length+b:b,"undefined"==typeof this.renkan.project.get("views").at(b)&&(c=0),c},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=0,e=this,f=e.canvas_$.width();c.position().left<0?(d=new paper.Point([-c.width()/2,0]),c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f-c.width()<c.height()?f:f-c.width(),b.html("«")):(d=new paper.Point([c.width()/2,0]),c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f+300,b.html("»")),this.view.paperShift(d)},save:function(){},open:function(){}}).value(),h}),define("renderer/viewrepr",["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(){var b=this;this.$=a(".Rk-Render"),this.type="View",this.hiddenNodes=[],this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.params={},this.model&&(this.params={zoom_level:b.model.get("zoom_level"),offset:b.model.get("offset"),hidden_nodes:b.model.get("hidden_nodes")}),this.initWithParams();var c=function(a,c){b.$.find(a).click(function(a){return b[c](a),!1})};c(".Rk-ZoomOut","zoomOut"),c(".Rk-ZoomIn","zoomIn"),c(".Rk-ZoomFit","autoScale"),c(".Rk-ZoomSave","saveView"),this.$.find(".Rk-ZoomSetSaved").click(function(){b.setScale(b.params.zoom_level,new paper.Point(b.params.offset)),b.showNodes(!1),b.options.hide_nodes&&(b.hiddenNodes=(b.params.hidden_nodes||[]).concat(),b.hideNodes()),b.updateUrl()}),this.$.find(".Rk-ShowHiddenNodes").mouseenter(function(){b.showNodes(!0),b.$.find(".Rk-ShowHiddenNodes").mouseleave(function(){b.hideNodes()})}),this.$.find(".Rk-ShowHiddenNodes").click(function(){b.showNodes(!1),b.$.find(".Rk-ShowHiddenNodes").off("mouseleave")}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show()},redraw:function(){},initWithParams:function(){var a=this;a.options.view_force_autoscale?this.autoScale():a.setScale(a.params.zoom_level,new paper.Point(a.params.offset)),a.options.hide_nodes&&!a.options.view_show_hiddennodes?(a.hiddenNodes=(a.params.hidden_nodes||[]).concat(),a.hideNodes()):a.showNodes(!1)},saveView:function(){var a=this,b={x:a.offset.x,y:a.offset.y};a.model=a.renkan.project.addView({zoom_level:a.scale,offset:b,hidden_nodes:a.hiddenNodes.concat()}),a.params={zoom_level:a.model.get("zoom_level"),offset:a.model.get("offset"),hidden_nodes:a.model.get("hidden_nodes")},this.$.find(".Rk-ZoomSetSaved").show(),a.updateUrl()},addHiddenNode:function(a){this.hideNode(a),this.hiddenNodes.push(a.id),this.updateUrl()},hideNode:function(a){"undefined"!=typeof this.renderer.getRepresentationByModel(a)&&this.renderer.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.renderer.getRepresentationByModel(b.renkan.project.get("nodes").get(c)).show(a)}),a||(this.hiddenNodes=[]),paper.view.draw()},setScale:function(a,b){a/this.initialScale>e._MIN_SCALE&&a/this.initialScale<e._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.renderer.redraw(),this.updateUrl())},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.renderer.canvas_$.width(),this.renderer.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.renderer.canvas_$.width(),this.renderer.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([.5*this.renderer.canvas_$.width()*(1-c)+(this.offset.x*c+a*c*.5),.5*this.renderer.canvas_$.height()*(1-c)+(this.offset.y*c+b*c*.5)]);this.setScale(d,e)},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])))},paperShift:function(a){this.offset=this.offset.add(a),this.renderer.redraw()},updateUrl:function(){if(this.options.url_parameters&&this.options.update_url){var b={},c=Backbone.history.getFragment().split("?");c.length>1&&c[1].split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),b.view=Math.round(1e3*this.offset.x)/1e3+","+Math.round(1e3*this.offset.y)/1e3+","+Math.round(1e3*this.scale)/1e3,this.renkan.project.get("views").indexOf(this.model)>-1?(b.viewIndex=this.renkan.project.get("views").indexOf(this.model),b.viewIndex===this.renkan.project.get("views").length-1&&(b.viewIndex=-1)):b.viewIndex&&delete b.viewIndex,this.renkan.router.navigate("?"+decodeURIComponent(a.param(b)),{trigger:!1,replace:!0})}},destroy:function(){this._super("destroy"),this.showNodes(!1)}}).value(),f}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils","ckeditor-core":"../lib/ckeditor/ckeditor","ckeditor-jquery":"../lib/ckeditor/adapters/jquery",screenfull:"../lib/screenfull/screenfull-umd"},shim:{"ckeditor-jquery":{deps:["jquery","ckeditor-core"]}}}),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","renderer/viewrepr"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w){var x=window.Rkns;"undefined"==typeof x.Renderer&&(x.Renderer={});var y=x.Renderer;y._BaseRepresentation=a,y._BaseButton=b,y.Node=c,y.Edge=d,y.View=w,y.TempEdge=e,y._BaseEditor=f,y.NodeEditor=g,y.EdgeEditor=h,y._NodeButton=i,y.NodeEditButton=j,y.NodeRemoveButton=k,y.NodeHideButton=l,y.NodeShowButton=m,y.NodeRevertButton=n,y.NodeLinkButton=o,y.NodeEnlargeButton=p,y.NodeShrinkButton=q,y.EdgeEditButton=r,y.EdgeRemoveButton=s,y.EdgeRevertButton=t,y.MiniFrame=u,y.Scene=v,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 __t,__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>"+(null==(__t=edge.description)?"":__t)+"</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 ",__p+=options.show_node_editor_title_richtext?'\n <div class="Rk-Edit-Title" contenteditable="true">'+(null==(__t=node.title)?"":__t)+"</div>\n ":'\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n ',__p+=" \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.change_types&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Types available"))+':</label>\n <select class="Rk-Edit-Type">\n ',_.each(types,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.type===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+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+"</label>\n ",__p+=options.show_node_editor_description_richtext?'\n <div class="Rk-Edit-Description" contenteditable="true">'+(null==(__t=node.description)?"":__t)+"</div>\n ":'\n <textarea class="Rk-Edit-Description">'+(null==(__t=node.description)?"":__t)+"</textarea>\n ",__p+="\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 __t,__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 "+(null==(__t=node.title)?"":__t)+"\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">'+(null==(__t=node.description)?"":__t)+"</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 <a href="#?idNode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\n";return __p},this.renkanJST["templates/nodeeditor_video.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 <video width="320" height="240" controls>\n <source src="'+__e(node.uri)+'" type="video/mp4">\n </video> \n'),__p+='\n <a href="#?idnode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\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("Save view"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved view"))+'"></div>\n ',options.hide_nodes&&(__p+='\n <div class="Rk-ShowHiddenNodes" title="'+__e(translate("Show hidden nodes"))+'"></div>\n '),__p+=" \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;b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:d.defaults(a.templates,renkanJST)||renkanJST,node_editor_templates:d.defaults(a.node_editor_templates,b.defaults.node_editor_templates)}),this.template=renkanJST["templates/main.html"];var f={};if(d.each(this.options.node_editor_templates,function(a,b){f[b]=e.options.templates[a],delete e.options.templates[a]}),this.options.node_editor_templates=f,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.router=new b.Router,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 g=renkanJST["templates/search.html"],h=this.$.find(".Rk-Search-List"),i=this.$.find(".Rk-Web-Search-Input"),j=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a,c){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),h.html(d(this.search_engines).map(function(a,b){return g({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),h.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),j.submit()}),j.submit(function(){if(i.val()){var a=e.search_engine;a.search(i.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){h.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){h.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 k=!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(a){
+var f=b.$(this);if(f&&c(f).attr("data-uri")){var g=e.project.get("nodes").where({uri:c(f).attr("data-uri")});d.each(g,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(a){try{this.dragDrop()}catch(b){}}).on("touchstart",".Rk-Bin-Item",function(a){k=!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(k)e.renderer.onMouseMove(b,!0);else{k=!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){k&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),k=!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 l=!1,m="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==m){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==l&&(l=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(c){"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(a){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.fillColor=new paper.Color(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.Backbone;a.Rkns.Router=b.Router.extend({routes:{"":"index"},index:function(a){var b={};null!==a&&a.split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),this.trigger("router",b)}})}(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?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.color?e.style={color:e.color}:e.style={}}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]&&(a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){this.project.set(this.convert(a),{validate:!0}),this.project.trigger("loaded",!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);"undefined"==typeof f&&"undefined"!=typeof e?a[b]=e:a[b]=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:!1,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,view_force_autoscale:!0,view_show_hiddennodes:!0,default_index_view:-1,url_parameters:!0,update_url:!0,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,ghost_opacity:.3,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)",hide_nodes:!0,change_shapes:!0,change_types:!0,node_editor_templates:{"default":"templates/nodeeditor_readonly.html",video:"templates/nodeeditor_video.html"},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,tooltip_opacity:.8,richtext_editor_config:{toolbarGroups:[{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"clipboard",groups:["clipboard","undo"]},"/",{name:"styles"}],removePlugins:"colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates"},show_node_editor_uri:!0,show_node_editor_title:!0,show_node_editor_title_richtext:!0,show_node_editor_description:!0,show_node_editor_description_richtext:!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",Polygon:"Polygone","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Save view":"Sauver la vue","View saved view":"Restaurer la Vue","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 ","Show hidden nodes":"Montrer les noeuds cachés","Show neighbors":"Montrer les voisins",Hide:"Cacher","Fullscreen not supported by your browser":"Le plein écran n'est pas supporté par votre navigateur"}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0})})},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(a,b,d){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(a){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})}})},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(a,b,f){$(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){"use strict";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(a,b){"use strict";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){"use strict";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&&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(){"use strict";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){var c=new paper.Path.RegularPolygon([0,0],3,1);return c.scale(b),c.translate(a),c}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(a,b){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){"use strict";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.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.options.hide_nodes&&this.normal_buttons.push(new b.NodeHideButton(this.renderer,null),new b.NodeShowButton(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.view.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"),i=document.createElement("div");i.innerHTML=h;var j=i.textContent||i.innerText||"",k=j||this.renkan.translate(this.options.label_untitled_nodes)||"";k=f.shortenText(k,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(k).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(k);var l=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*l,opacity:g});var m=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),n=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=l,this.circle.strokeColor=m,this.circle.dashArray=n;var o=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(o)});var p=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==p&&(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=m;var q=this.renderer.toMinimapCoords(c),r=this.renderer.minimap.scale*d,s=new paper.Size([r,r]);this.minimap_circle.fitBounds(q.subtract(s),s.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var t=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===t.model||a.get("from")===t.model}),function(a,b,c){var d=t.renderer.getRepresentationByModel(a);d&&"undefined"!=typeof d.from_representation&&"undefined"!=typeof d.from_representation.paper_coords&&"undefined"!=typeof d.to_representation&&"undefined"!=typeof d.to_representation.paper_coords&&d.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.view.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){clearTimeout(this.hide_timeout),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.renderer.removeRepresentationsOfType("editor"),this.hide()):this.hideNeighbors(!0),this._super("unselect")}},hide_delay:function(){var a=this;this.hide_timeout=setTimeout(function(){a.hide()},1e3)},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,c,d){var e=a.renderer.getRepresentationByModel(b);e&&"undefined"!=typeof e.from_representation&&"undefined"!=typeof e.from_representation.paper_coords&&"undefined"!=typeof e.to_representation&&"undefined"!=typeof e.to_representation.paper_coords&&e.hide()}),this.hideNeighbors(!1)},show:function(a){var c=this;this.ghost=a,this.ghost?("undefined"!=typeof this.node_image&&(this.node_image.opacity=this.options.ghost_opacity),this.circle.opacity=this.options.ghost_opacity,this.title.css("opacity",this.options.ghost_opacity),this.minimap_circle.opacity=this.options.ghost_opacity):(this.minimap_circle.opacity=1,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,b,d){var e=c.renderer.getRepresentationByModel(a);e&&"undefined"!=typeof e.from_representation&&"undefined"!=typeof e.from_representation.paper_coords&&"undefined"!=typeof e.to_representation&&"undefined"!=typeof e.to_representation.paper_coords&&e.show(c.ghost)})},hideNeighbors:function(a){var c=this;b.each(this.project.get("edges").filter(function(a){return a.get("from")===c.model}),function(b,d,e){var f=c.renderer.getRepresentationByModel(b.get("to"));f&&f.ghost&&(a?f.hide_delay():f.hide())})},showNeighbors:function(a){var c=this;b.each(this.project.get("edges").filter(function(a){return a.get("from")===c.model}),function(b,d,e){var f=c.renderer.getRepresentationByModel(b.get("to"));if(f&&f.hidden&&(f.show(a),!a)){var g=c.renderer.view.hiddenNodes.indexOf(f.model.id);-1!==g&&c.renderer.view.hiddenNodes.splice(g,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.view.hiddenNodes.indexOf(this.model.id);-1!==c&&this.renderer.view.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(a){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){"use strict";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,d=this._getStrokeWidth(),f=this._getArrowScale(),g=this.from_representation.paper_coords,h=this.to_representation.paper_coords,i=h.subtract(g),j=i.length,k=i.divide(j),l=new paper.Point([-k.y,k.x]),m=this.bundle.getPosition(this),n=l.multiply(this.options.edge_gap_in_bundles*m),o=g.add(n),p=h.add(n),q=i.angle,r=l.multiply(this.options.edge_label_distance+.5*f*this.options.edge_arrow_width),s=i.divide(3),t=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),u=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(c=.5,this.line.dashArray=[2,2]):(c=this.ghost?this.options.ghost_opacity:1,this.line.dashArray=null);var v=this.active_buttons;this.arrow.visible=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow,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=o.add(p).divide(2),this.line.strokeWidth=d,this.line.strokeColor=t,this.line.dashArray=u,this.line.opacity=c,this.line.segments[0].point=g,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=s.multiply(-1),this.line.segments[1].handleOut=s,this.line.segments[2].point=h,this.arrow.scale(f/this.arrow_scale),this.arrow_scale=f,this.arrow.fillColor=t,this.arrow.opacity=c,this.arrow.rotate(q-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=q,q>90&&(q-=180,r=r.multiply(-1)),-90>q&&(q+=180,r=r.multiply(-1));var w=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";w=e.shortenText(w,this.options.node_label_max_length),this.text.text(w);var x=this.paper_coords.add(r);this.text.css({left:x.x,top:x.y,transform:"rotate("+q+"deg)","-moz-transform":"rotate("+q+"deg)","-webkit-transform":"rotate("+q+"deg)",opacity:c}),this.text_angle=q;var y=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(y)}),this.renderer.minimap&&(this.minimap_line.strokeColor=t,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.hidden&&this.renderer.removeRepresentationsOfType("editor"),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){"use strict";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,b){var c=paper.project.hitTest(a.point),d=this.from_representation.model,f=!0;if(c&&"undefined"!=typeof c.item.__representation){var g=c.item.__representation;if("Node"===g.type.substr(0,4)){var h=g.model||g.source_representation.model;if(d!==h){var i={id:e.getUID("edge"),created_by:this.renkan.current_user,from:d,to:h};this.renderer.isEditable()&&this.project.addEdge(i)}}(d===g.model||g.source_representation&&g.source_representation.model===d)&&(f=!1,this.renderer.is_dragging=!0)}f&&(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){"use strict";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=this.options.tooltip_opacity,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:this.options.tooltip_opacity}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder","ckeditor-jquery"],function(a,b,c,d,e){"use strict";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.node_editor_templates},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[c.get("type")]||this.readOnlyTemplate["default"],h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{_id:c.get("_id"),has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),type:c.get("type")||"default",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(),types:b(this.options.node_editor_templates).keys().value()})),this.redraw();var j=this,k=j.options.show_node_editor_description_richtext?a(".Rk-Edit-Description").ckeditor(j.options.richtext_editor_config):!1,l=j.options.show_node_editor_title_richtext?a(".Rk-Edit-Title").ckeditor(j.options.richtext_editor_config):!1,m=function(){j.renderer.removeRepresentation(j),paper.view.draw()};if(j.cleanEditor=function(){if(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.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor){var a=k.editor;delete k.editor,a.focusManager.blur(!0),a.destroy()}if(j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor){var b=l.editor;delete l.editor,b.focusManager.blur(!0),b.destroy()}},this.editor_$.find(".Rk-CloseX").click(function(a){a.preventDefault(),m()}),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var n=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={};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&&(j.options.show_node_editor_description_richtext?"undefined"!=typeof k.editor&&k.editor.checkDirty()&&(a.description=k.editor.getData(),k.editor.resetDirty()):a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_title&&(j.options.show_node_editor_title_richtext?"undefined"!=typeof l.editor&&l.editor.checkDirty()&&(a.title=l.editor.getData(),l.editor.resetDirty()):a.title=j.editor_$.find(".Rk-Edit-Title").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()),j.options.change_types&&c.get("type")!==j.editor_$.find(".Rk-Edit-Type").val()&&(a.type=j.editor_$.find(".Rk-Edit-Type").val()),c.set(a),j.redraw()}else m()})},1e3);this.editor_$.on("keyup",function(a){
+27===a.keyCode&&m()}),this.editor_$.find("input, textarea, select").on("change keyup paste",n),j.options.show_node_editor_description&&j.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor&&(k.editor.on("change",n),k.editor.on("blur",n)),j.options.show_node_editor_title&&j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor&&(l.editor.on("change",n),l.editor.on("blur",n)),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),n()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var o=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),o.show()},function(a){a.preventDefault(),o.hide()}),o.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")})),o.hide(),paper.view.draw()):m()});var p=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 m()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return p(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return p(1),!1});var q=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 m()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return q(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return q(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),n(),!1})}else if("object"==typeof this.source_representation.highlighted){var r=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(r),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()},destroy:function(){"undefined"!=typeof this.cleanEditor&&this.cleanEditor(),this.editor_block.remove(),this.editor_$.remove()}}).value(),g}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){"use strict";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"),e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d,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){"use strict";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){"use strict";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=this.options.hide_nodes?-125:-135,this.endAngle=this.options.hide_nodes?-55:-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){"use strict";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=this.options.hide_nodes?-10:0,this.endAngle=this.options.hide_nodes?45: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/nodehidebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){"use strict";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.view.addHiddenNode(this.source_representation.model)}}).value(),f}),define("renderer/nodeshowbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){"use strict";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 neighbors"},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){"use strict";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){"use strict";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=this.options.hide_nodes?135:90,this.endAngle=this.options.hide_nodes?190:180,this.imageName="link",this.text="Link to another node"},mousedown:function(a,b){if(this.renderer.isEditable()){var c=this.renderer.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,d)}}}).value(),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){"use strict";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=this.options.hide_nodes?-55:-45,this.endAngle=this.options.hide_nodes?-10: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){"use strict";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=this.options.hide_nodes?-170:-180,this.endAngle=this.options.hide_nodes?-125:-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){"use strict";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){"use strict";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){"use strict";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){"use strict";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(a){this.renderer.click_target=null,this.renderer.is_dragging=!1}}).value(),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe","screenfull"],function(a,b,c,d,e,f){"use strict";var g=d.getUtils(),h=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"),c.options.popup_editor?this.editor_$=this.$.find(".Rk-Editor"):this.editor_$=a("#"+c.options.editor_panel),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),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=!1,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,h=!0,i=1,j=!1,k=0,l=0,m=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 n=b.throttle(function(a,b){d.onMouseMove(a,b)},g._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),n(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),h&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-m<g._DOUBLETAP_DELAY&&Math.pow(k-b.pageX,2)+Math.pow(l-b.pageY,2)<g._DOUBLETAP_DISTANCE?(m=0,d.onDoubleClick(b)):(m=new Date,k=b.pageX,l=b.pageY,i=d.view.scale,j=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),m=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(j||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,j=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*i,c=b/d.view.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.view.offset.multiply(c));d.view.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.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),h=!1},dragleave:function(a){a.preventDefault(),h=!0},drop:function(a){a.preventDefault(),h=!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(g){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 o=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};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()}),f.enabled?(o(".Rk-FullScreen-Button","fullScreen"),document.addEventListener(f.raw.fullscreenchange,function(){setTimeout(function(){var a=d.$.width(),b=d.$.height();d.renkan.options.show_top_bar&&(b-=d.$.find(".Rk-TopBar").height()),d.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(a-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([a,b]),d.resize(d.currentWidth,a,d.currentHeight,b),d.currentWidth=a,d.currentHeight=b,f.isFullscreen||(paper.view.onResize=function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)})},600)})):(this.$.find(".Rk-FullScreen-Button").addClass("disabled"),this.$.find(".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents").html(this.renkan.translate("Fullscreen not supported by your browser"))),o(".Rk-AddNode-Button","addNodeBtn"),o(".Rk-AddEdge-Button","addEdgeBtn"),o(".Rk-Save-Button","save"),o(".Rk-Open-Button","open"),o(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+g._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()}),o(".Rk-Fold-Bins","foldBins"),paper.view.on("resize",function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)});var p=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 q=b.throttle(function(){d.redrawUsers()},100);if(q(),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("loaded",function(){d.renkan.options.url_parameters?Backbone.history.start():d.fixSize(),d.redrawActive=!0,p()}),this.renkan.router.on("router",function(a){d.setViewparameters(a)}),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",q),this.renkan.project.on("add:views remove:views",function(a){d.renkan.project.get("views").length>1?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")||p()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||p()}),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 r="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},r)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var s=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),t=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");s.hover(function(a){d.isEditable()&&(a.preventDefault(),t.show())},function(a){a.preventDefault(),t.hide()}),t.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 u="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==u)if(u=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var f=g.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){f.test(a.get("title"))||f.test(a.get("description"))?d.getRepresentationByModel(a).highlight(f):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(h.prototype).extend({fixSize:function(){"undefined"==typeof this.view&&(this.view=this.addRepresentation("View",this.renkan.project.get("views").last())),this.view.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},H>2?K.paragraphStyle.justification="left":-2>H?K.paragraphStyle.justification="right":K.paragraphStyle.justification="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()},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.view.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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(a){b.each(this.representations,function(a){a.unhighlight()})},unselectAll:function(a){b.each(this.representations,function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b.each(this.representations,function(a){a.redraw({dontRedrawEdges:!0})}),this.minimap&&"undefined"!=typeof this.view&&this.redrawMiniframe(),paper.view.draw())},resize:function(a,b,c,d){var e;this.minimap&&(this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle.fitBounds(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.cliprectangle.fitBounds(this.minimap.topleft,this.minimap.size));var f=d/c,g=b/a;e=b>d?f:g,this.view.resizeZoom(b-a,d-c,e),this.redraw()},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},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>g._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.view.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 f=paper.project.hitTest(e);if(f&&"undefined"!=typeof f.item.__representation)this.click_target=f.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===g._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}},j=this.renkan.project.addNode(i);this.getRepresentationByModel(j).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===g._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=g._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(),this.view.updateUrl();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.view.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.view.setScale(this.view.scale*Math.SQRT2,this.view.offset.subtract(d)):this.view.setScale(this.view.scale*Math.SQRT1_2,this.view.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),f={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(f);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 f="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:g.getUID("node"),created_by:this.renkan.current_user,uri:f.uri||"",title:f.title||"",description:f.description||"",image:f.image||"",color:f.color||void 0,clip_path:f.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(){this.currentWidth=this.$.width(),this.currentHeight=this.$.height();var a=this.renkan.$[0];paper.view.off("resize"),f.toggle(a)},addNodeBtn:function(){return this.click_mode===g._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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===g._CLICKMODE_STARTEDGE||this.click_mode===g._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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 f,h,i={};b.each(a.nodes,function(a,b,c){f=a.id||a._id,delete a._id,delete a.id,i[f]=a["@id"]=g.getUUID4()}),b.each(a.edges,function(a,b,c){delete a._id,delete a.id,a.to=i[a.to],a.from=i[a.from]}),b.each(a.views,function(a,c,d){delete a._id,delete a.id,a.hidden_nodes&&(h=a.hidden_nodes,a.hidden_nodes=[],b.each(h,function(b,c){a.hidden_nodes.push(i[b])}))}),a.users=[];var j=JSON.stringify(a,null,2),k=new Blob([j],{type:"application/json;charset=utf-8"});c(k,e)},setViewparameters:function(b){if(this.removeRepresentationsOfType("View"),a.isEmptyObject(b))return void(this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))));if("undefined"!=typeof b.viewIndex?this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(b.viewIndex))):this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))),"undefined"!=typeof b.view&&b.view.split(",").length>=3){var c=b.view.split(","),d={project:this.renkan.project,offset:{x:parseFloat(c[0]),y:parseFloat(c[1])},zoom_level:parseFloat(c[2])};this.view.setScale(d.zoom_level,new paper.Point(d.offset))}"undefined"!=typeof b.view&&"autoscale"===b.view&&this.view.autoScale(),"undefined"!=typeof b.viewsNodes&&("true"===b.viewsNodes?(this.view.hiddenNodes=(this.view.params.hidden_nodes||[]).concat(),this.view.hideNodes()):this.view.showNodes(!1)),this.unhighlightAll(),"undefined"!=typeof b.idNode&&this.highlightModel(this.renkan.project.get("nodes").get(b.idNode))},validViewIndex:function(a){var b=parseInt(a),c=0;return c=0>b?this.renkan.project.get("views").length+b:b,"undefined"==typeof this.renkan.project.get("views").at(b)&&(c=0),c},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=0,e=this,f=e.canvas_$.width();c.position().left<0?(d=new paper.Point([-c.width()/2,0]),c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f-c.width()<c.height()?f:f-c.width(),b.html("«")):(d=new paper.Point([c.width()/2,0]),c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f+300,b.html("»")),this.view.paperShift(d)},save:function(){},open:function(){}}).value(),h}),define("renderer/viewrepr",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){"use strict";var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){var b=this;this.$=a(".Rk-Render"),this.type="View",this.hiddenNodes=[],this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.params={},this.model&&(this.params={zoom_level:b.model.get("zoom_level"),offset:b.model.get("offset"),hidden_nodes:b.model.get("hidden_nodes")}),this.initWithParams();var c=function(a,c){b.$.find(a).click(function(a){return b[c](a),!1})};c(".Rk-ZoomOut","zoomOut"),c(".Rk-ZoomIn","zoomIn"),c(".Rk-ZoomFit","autoScale"),c(".Rk-ZoomSave","saveView"),this.$.find(".Rk-ZoomSetSaved").click(function(){b.setScale(b.params.zoom_level,new paper.Point(b.params.offset)),b.showNodes(!1),b.options.hide_nodes&&(b.hiddenNodes=(b.params.hidden_nodes||[]).concat(),b.hideNodes()),b.updateUrl()}),this.$.find(".Rk-ShowHiddenNodes").mouseenter(function(){b.showNodes(!0),b.$.find(".Rk-ShowHiddenNodes").mouseleave(function(){b.hideNodes()})}),this.$.find(".Rk-ShowHiddenNodes").click(function(){b.showNodes(!1),b.$.find(".Rk-ShowHiddenNodes").off("mouseleave")}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show()},redraw:function(a){},initWithParams:function(){var a=this;a.options.view_force_autoscale?this.autoScale():a.setScale(a.params.zoom_level,new paper.Point(a.params.offset)),a.options.hide_nodes&&!a.options.view_show_hiddennodes?(a.hiddenNodes=(a.params.hidden_nodes||[]).concat(),a.hideNodes()):a.showNodes(!1)},saveView:function(){var a=this,b={x:a.offset.x,y:a.offset.y};a.model=a.renkan.project.addView({zoom_level:a.scale,offset:b,hidden_nodes:a.hiddenNodes.concat()}),a.params={zoom_level:a.model.get("zoom_level"),offset:a.model.get("offset"),hidden_nodes:a.model.get("hidden_nodes")},this.$.find(".Rk-ZoomSetSaved").show(),a.updateUrl()},addHiddenNode:function(a){this.hideNode(a),this.hiddenNodes.push(a.id),this.updateUrl()},hideNode:function(a){"undefined"!=typeof this.renderer.getRepresentationByModel(a)&&this.renderer.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.renderer.getRepresentationByModel(b.renkan.project.get("nodes").get(c)).show(a)}),a||(this.hiddenNodes=[]),paper.view.draw()},setScale:function(a,b){a/this.initialScale>e._MIN_SCALE&&a/this.initialScale<e._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.renderer.redraw(),this.updateUrl())},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.renderer.canvas_$.width(),this.renderer.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.renderer.canvas_$.width(),this.renderer.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([.5*this.renderer.canvas_$.width()*(1-c)+(this.offset.x*c+a*c*.5),.5*this.renderer.canvas_$.height()*(1-c)+(this.offset.y*c+b*c*.5)]);this.setScale(d,e)},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])))},paperShift:function(a){this.offset=this.offset.add(a),this.renderer.redraw()},updateUrl:function(){if(this.options.url_parameters&&this.options.update_url){var b={},c=Backbone.history.getFragment().split("?");c.length>1&&c[1].split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),b.view=Math.round(1e3*this.offset.x)/1e3+","+Math.round(1e3*this.offset.y)/1e3+","+Math.round(1e3*this.scale)/1e3,this.renkan.project.get("views").indexOf(this.model)>-1?(b.viewIndex=this.renkan.project.get("views").indexOf(this.model),b.viewIndex===this.renkan.project.get("views").length-1&&(b.viewIndex=-1)):b.viewIndex&&delete b.viewIndex,this.renkan.router.navigate("?"+decodeURIComponent(a.param(b)),{trigger:!1,replace:!0})}},destroy:function(a){this._super("destroy"),this.showNodes(!1)}}).value(),f}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils","ckeditor-core":"../lib/ckeditor/ckeditor","ckeditor-jquery":"../lib/ckeditor/adapters/jquery",screenfull:"../lib/screenfull/screenfull-umd"},shim:{"ckeditor-jquery":{deps:["jquery","ckeditor-core"]}}}),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","renderer/viewrepr"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w){"use strict";var x=window.Rkns;"undefined"==typeof x.Renderer&&(x.Renderer={});var y=x.Renderer;y._BaseRepresentation=a,y._BaseButton=b,y.Node=c,y.Edge=d,y.View=w,y.TempEdge=e,y._BaseEditor=f,y.NodeEditor=g,y.EdgeEditor=h,y._NodeButton=i,y.NodeEditButton=j,y.NodeRemoveButton=k,y.NodeHideButton=l,y.NodeShowButton=m,y.NodeRevertButton=n,y.NodeLinkButton=o,y.NodeEnlargeButton=p,y.NodeShrinkButton=q,y.EdgeEditButton=r,y.EdgeRemoveButton=s,y.EdgeRevertButton=t,y.MiniFrame=u,y.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 Oct 14 14:56:41 2015 +0200
+++ b/server/php/basic/public_html/static/lib/renkan/js/renkan.min.map Mon Oct 19 14:18:51 2015 +0200
@@ -1,1 +1,1 @@
-{"version":3,"file":"renkan.min.js","sources":["templates.js","../../js/main.js","../../js/router.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","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","description","static_url","url","show_bins","show_editor","show_node_editor_title_richtext","node","show_node_editor_uri","change_types","types","type","charAt","toUpperCase","substring","show_node_editor_description","show_node_editor_description_richtext","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","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","_id","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","hide_nodes","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","node_editor_templates","template","types_templates","value","key","property_files","f","getJSON","data","concat","read_only","router","Router","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","Renderer","Scene","search","_select","_input","_form","_search","Search","_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","fillColor","Color","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","Backbone","routes","index","parameters","result","forEach","part","item","decodeURIComponent","trigger","converters","from1to2","len","nodes","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","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","view_force_autoscale","view_show_hiddennodes","default_index_view","url_parameters","update_url","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","ghost_opacity","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","default","video","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","tooltip_opacity","richtext_editor_config","toolbarGroups","name","groups","removePlugins","show_node_editor_title","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","Polygon","Zoom Fit","Download Project","Save view","View saved view","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","Show hidden nodes","Show neighbors","Hide","Fullscreen not supported by your browser","jsonIO","_proj","http_method","_load","loadingStatus","_data","saveStatus","_save","ajax","contentType","JSON","stringify","success","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","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","unhighlight","mousedown","mouseup","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","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","NodeHideButton","NodeShowButton","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","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","clean_title","textContent","innerText","_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","clearTimeout","hide_timeout","_uri","showNeighbors","hideButtons","buttons_timeout","undefined","hideNeighbors","hide_delay","delay","indexNode","hiddenNodes","indexOf","splice","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","_opacity","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","visible","handleIn","handleOut","bounds","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","keys","editorInstance","ckeditor","editorInstanceTitle","closeEditor","cleanEditor","editor","focusManager","blur","_editor_title","onFieldChange","checkDirty","getData","resetDirty","assign","keyCode","files","FileReader","alert","onload","target","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","NodeButton","delid","delete_list","time","valueOf","confirm","addHiddenNode","unset","_off","_point","addTempEdge","MiniFrame","filesaver","Screenfull","representations","notif_$","setup","totalScroll","mouse_down","selected_target","Layer","redrawActive","background_layer","topleft","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","_lastTap","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","parse","bindClick","selector","fname","evt","enabled","addEventListener","raw","fullscreenchange","widthAft","heightAft","viewSize","currentWidth","currentHeight","isFullscreen","onResize","newWidth","_width","newHeight","prevHeight","delta","prevWidth","fadeIn","fadeOut","mouseover","_thRedraw","addRepresentations","_thRedrawUsers","history","fixSize","_params","setViewparameters","el","_delay","autoScale","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","last","_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","closed","PointText","characterStyle","fontSize","paragraphStyle","justification","_visible","_restPos","_grp","_imgdelta","_currentPos","_edgeRepr","_bundle","_er","_dir","savebtn","tip","redrawMiniframe","bottomright","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","empty","parent","background","_representation","_representations","_ratio","ratioH","ratioW","resizeZoom","_from","_tmpEdge","last_point","updateUrl","_scrolldelta","SQRT1_2","open","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","toggle","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","isEmptyObject","validViewIndex","viewIndex","viewParams","params","viewsNodes","hideNodes","showNodes","idNode","_index","validIndex","foldBins","sizeAft","foldBinsButton","sizeBef","animate","ViewRepr","initialScale","initWithParams","saveView","hideNode","_offset","zoomOut","zoomIn","deltaW","deltaH","force_view","getFragment","round","navigate","param","require","config","paths","jquery","underscore","ckeditor-core","ckeditor-jquery","screenfull","shim","deps","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,K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B,EAASC,MAAQA,EAEjBmlC,gBAGJviB,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((__t = (edge.description)) == null ? '' : __t) +\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 ';\n if (options.show_node_editor_title_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Title\" contenteditable=\"true\">' +\n((__t = (node.title)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(node.title) +\n'\" />\\n ';\n } ;\n__p += ' \\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.change_types) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Types available\")) +\n':</label>\\n <select class=\"Rk-Edit-Type\">\\n ';\n _.each(types, function(type) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( type ) +\n'\"';\n if (node.type === type) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(type.charAt(0).toUpperCase() + type.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\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 ';\n if (options.show_node_editor_description_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Description\" contenteditable=\"true\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <textarea class=\"Rk-Edit-Description\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</textarea>\\n ';\n } ;\n__p += '\\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((__t = (node.title)) == null ? '' : __t) +\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((__t = (node.description)) == null ? '' : __t) +\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 <a href=\"#?idNode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor_video.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 <video width=\"320\" height=\"240\" controls>\\n <source src=\"' +\n__e(node.uri) +\n'\" type=\"video/mp4\">\\n </video> \\n';\n } ;\n__p += '\\n <a href=\"#?idnode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\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('Save view')) +\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 view')) +\n'\"></div>\\n ';\n if (options.hide_nodes) { ;\n__p += '\\n \\t <div class=\"Rk-ShowHiddenNodes\" title=\"' +\n__e(translate('Show hidden nodes')) +\n'\"></div>\\n ';\n } ;\n__p += ' \\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: _.defaults(_opts.templates, renkanJST) || renkanJST,\n node_editor_templates: _.defaults(_opts.node_editor_templates, Rkns.defaults.node_editor_templates)\n });\n this.template = renkanJST['templates/main.html'];\n\n var types_templates = {};\n _.each(this.options.node_editor_templates, function(value, key) {\n types_templates[key] = _this.options.templates[value];\n delete _this.options.templates[value];\n });\n this.options.node_editor_templates = types_templates;\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.router = new Rkns.Router();\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 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.fillColor = new paper.Color(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 \"use strict\";\n \n var Backbone = root.Backbone;\n \n var Router = root.Rkns.Router = Backbone.Router.extend({\n routes: {\n '': 'index'\n },\n \n index: function (parameters) {\n \n var result = {};\n if (parameters !== null){\n parameters.split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n this.trigger('router', result); \n } \n });\n\n})(window);","(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 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 data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n this.project.set(this.convert(data), {\n validate: true\n });\n this.project.trigger('loaded', true);\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: false,\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 view_force_autoscale: true,\n /* Force autoscale when the Renkan is loaded */\n view_show_hiddennodes: true,\n /* Show all the node when the Renkan is loaded */\n default_index_view: -1,\n \n /* URL parsing */\n url_parameters: true,\n /* accept or not hash parameters in the url */\n update_url: true,\n /* update the url each time the paper shift or on zoom in/out, with the serialized view (offset and scale) */\n /* Considered as false if url_parameters is false */\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 ghost_opacity : 0.3,\n /* opacity when the hidden element is revealed */\n default_dash_array : [4, 5],\n /* dash line genometry */\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 hide_nodes: true,\n /* allow hide/show nodes */\n change_shapes: true,\n /* Change shapes enabled */\n change_types: true,\n /* Change type enabled */\n\n /* NODE EDITOR TEMPLATE*/\n\n node_editor_templates: {\n \"default\": \"templates/nodeeditor_readonly.html\",\n \"video\": \"templates/nodeeditor_video.html\"\n },\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 tooltip_opacity: 0.8,\n\n richtext_editor_config: {\n toolbarGroups: [\n { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },\n { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },\n '/',\n\t { name: 'styles'},\n ],\n removePlugins : 'colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates',\n },\n\n /* NODE EDITOR OPTIONS */\n\n show_node_editor_uri: true,\n show_node_editor_title: true,\n show_node_editor_title_richtext: true,\n show_node_editor_description: true,\n show_node_editor_description_richtext: 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\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","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 \"Polygon\": \"Polygone\",\n \"Zoom Fit\": \"Ajuster le Zoom\",\n \"Download Project\": \"Télécharger le projet\",\n \"Save view\": \"Sauver la vue\",\n \"View saved view\": \"Restaurer la Vue\",\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 \"Show hidden nodes\": \"Montrer les noeuds cachés\",\n \"Show neighbors\": \"Montrer les voisins\",\n \"Hide\": \"Cacher\",\n \"Fullscreen not supported by your browser\": \"Le plein écran n'est pas supporté par votre navigateur\"\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 _proj.set({\n loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n \n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\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 \n //TODO: Rearrange to avoid the 2 firts PUT due to a change in the project model\n // Take car of setting up the listener correctly to listen the save action on the view\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 }\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 if (this.sector){\n this.sector.hide(); \n }\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 var shape = new paper.Path.RegularPolygon([0,0], 3, 1);\n shape.scale(radius);\n shape.translate(center);\n return shape;\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.NodeLinkButton(this.renderer, null),\n new Renderer.NodeEnlargeButton(this.renderer, null),\n new Renderer.NodeShrinkButton(this.renderer, null)\n ];\n if (this.options.hide_nodes){\n this.normal_buttons.push(\n new Renderer.NodeHideButton(this.renderer, null),\n new Renderer.NodeShowButton(this.renderer, null)\n );\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.view.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 \n //strip html from title\n var html = this.model.get(\"title\");\n var div = document.createElement(\"div\");\n div.innerHTML = html;\n var clean_title = div.textContent || div.innerText || \"\";\n \n var _text = clean_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.view.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 clearTimeout(this.hide_timeout);\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.renderer.removeRepresentationsOfType(\"editor\");\n this.hide();\n }\n else {\n this.hideNeighbors(true);\n }\n this._super(\"unselect\");\n }\n },\n hide_delay: function(){\n var _this = this;\n this.hide_timeout = setTimeout(function(){\n _this.hide();\n }, 1000);\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(false);\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 = this.options.ghost_opacity;\n }\n this.circle.opacity = this.options.ghost_opacity;\n this.title.css('opacity', this.options.ghost_opacity);\n this.minimap_circle.opacity = this.options.ghost_opacity;\n } else {\n this.minimap_circle.opacity = 1; \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(delay){\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 if (delay){ repr.hide_delay(); } else {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.view.hiddenNodes.indexOf(repr.model.id);\n if (indexNode !== -1){\n _this.renderer.view.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.view.hiddenNodes.indexOf(this.model.id);\n if (index !== -1){\n this.renderer.view.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;\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 = this.ghost ? this.options.ghost_opacity : 1;\n this.line.dashArray = null;\n }\n\n var old_act_btn = this.active_buttons;\n\n this.arrow.visible =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) ||\n !this.model.has(\"style\") ||\n typeof this.model.get(\"style\").arrow === 'undefined';\n\n this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.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 = _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 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 if (this.hidden){\n this.renderer.removeRepresentationsOfType(\"editor\");\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 = this.options.tooltip_opacity;\n this.editor_$ = $('<div>')\n .appendTo(this.renderer.editor_$)\n .css({\n position: \"absolute\",\n opacity: this.options.tooltip_opacity\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', 'ckeditor-jquery'], 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.node_editor_templates;\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[_model.get(\"type\")] || this.readOnlyTemplate[\"default\"]),\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 _id: _model.get(\"_id\"),\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n type: _model.get(\"type\") || \"default\",\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 types : _(this.options.node_editor_templates).keys().value(),\n }));\n this.redraw();\n var _this = this,\n editorInstance = _this.options.show_node_editor_description_richtext ?\n $(\".Rk-Edit-Description\").ckeditor(_this.options.richtext_editor_config) :\n false,\n editorInstanceTitle = _this.options.show_node_editor_title_richtext ?\n $(\".Rk-Edit-Title\").ckeditor(_this.options.richtext_editor_config) :\n false,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n\n _this.cleanEditor = 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined') {\n var _editor = editorInstance.editor;\n delete editorInstance.editor;\n _editor.focusManager.blur(true);\n _editor.destroy();\n }\n }\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined') {\n var _editor_title = editorInstanceTitle.editor;\n delete editorInstanceTitle.editor;\n _editor_title.focusManager.blur(true);\n _editor_title.destroy();\n }\n }\n };\n\n this.editor_$.find(\".Rk-CloseX\").click(function (e) {\n e.preventDefault();\n closeEditor();\n });\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 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined' &&\n editorInstance.editor.checkDirty()) {\n _data.description = editorInstance.editor.getData();\n editorInstance.editor.resetDirty();\n }\n }\n else {\n _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n }\n }\n if (_this.options.show_node_editor_title) {\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined' &&\n editorInstanceTitle.editor.checkDirty()) {\n _data.title = editorInstanceTitle.editor.getData();\n editorInstanceTitle.editor.resetDirty();\n }\n }\n else {\n _data.title = _this.editor_$.find(\".Rk-Edit-Title\").val();\n }\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 if (_this.options.change_types) {\n if(_model.get(\"type\")!==_this.editor_$.find(\".Rk-Edit-Type\").val()){\n _data.type = _this.editor_$.find(\".Rk-Edit-Type\").val();\n }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 1000);\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 if( _this.options.show_node_editor_description &&\n _this.options.show_node_editor_description_richtext &&\n typeof editorInstance.editor !== 'undefined')\n {\n editorInstance.editor.on(\"change\", onFieldChange);\n editorInstance.editor.on(\"blur\", onFieldChange);\n }\n \n if( _this.options.show_node_editor_title &&\n _this.options.show_node_editor_title_richtext &&\n typeof editorInstanceTitle.editor !== 'undefined')\n {\n editorInstanceTitle.editor.on(\"change\", onFieldChange);\n editorInstanceTitle.editor.on(\"blur\", onFieldChange);\n }\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 destroy: function() {\n if(typeof this.cleanEditor !== 'undefined') {\n this.cleanEditor();\n }\n this.editor_block.remove();\n this.editor_$.remove();\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 arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash, 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 = this.options.hide_nodes ? -125 : -135;\n this.endAngle = this.options.hide_nodes ? -55 : -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 = this.options.hide_nodes ? -10 : 0;\n this.endAngle = this.options.hide_nodes ? 45 : 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/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.view.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 neighbors\";\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 = this.options.hide_nodes ? 135 : 90;\n this.endAngle = this.options.hide_nodes ? 190 : 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 = this.options.hide_nodes ? -55 : -45;\n this.endAngle = this.options.hide_nodes ? -10 : 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 = this.options.hide_nodes ? -170 : -180;\n this.endAngle = this.options.hide_nodes ? -125 : -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', 'screenfull'], function ($, _, filesaver, requtils, MiniFrame, Screenfull) {\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.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 = false;\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 _lastTap = 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.view.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.view.scale,\n _newOffset = new paper.Point([\n _this.canvas_$.width(),\n _this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.view.offset.multiply( _scaleRatio ));\n _this.view.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 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 \n if (Screenfull.enabled){\n bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n \n document.addEventListener(Screenfull.raw.fullscreenchange, function () {\n //the listener occur too randomly and sometimes before the fullscreen is fully set up\n //so we add 500 delay\n setTimeout(function(){\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 _this.resize(_this.currentWidth, widthAft, _this.currentHeight, heightAft);\n \n _this.currentWidth = widthAft;\n _this.currentHeight = heightAft;\n \n if (!Screenfull.isFullscreen) {\n paper.view.onResize = function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\n };\n }\n }, 600);\n });\n } else {\n this.$.find(\".Rk-FullScreen-Button\").addClass(\"disabled\");\n this.$.find(\".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents\").html(this.renkan.translate(\"Fullscreen not supported by your browser\"));\n }\n \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.on(\"resize\", function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\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(\"loaded\", function(){\n if (_this.renkan.options.url_parameters){\n Backbone.history.start(); \n } else {\n _this.fixSize();\n }\n _this.redrawActive = true;\n _thRedraw();\n });\n \n //register router events\n this.renkan.router.on(\"router\", function(_params){\n _this.setViewparameters(_params);\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 > 1) {\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(typeof this.view === 'undefined') {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").last());\n }\n this.view.autoScale();\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 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.view.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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 && typeof this.view !== 'undefined') {\n this.redrawMiniframe();\n }\n paper.view.draw();\n },\n resize: function(prevWidth, newWidth, prevHeight, newHeight){\n var _ratio;\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/prevHeight,\n ratioW = newWidth/prevWidth;\n if (newHeight < newWidth) {\n _ratio = ratioH;\n } else {\n _ratio = ratioW;\n }\n this.view.resizeZoom(newWidth - prevWidth, newHeight - prevHeight, _ratio);\n \n this.redraw();\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 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.view.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 var _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 this.view.updateUrl();\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.view.offset).multiply( Math.SQRT2 - 1 );\n if (this.totalScroll > 0) {\n this.view.setScale( this.view.scale * Math.SQRT2, this.view.offset.subtract(_delta) );\n } else {\n this.view.setScale( this.view.scale * Math.SQRT1_2, this.view.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 this.currentWidth = this.$.width();\n this.currentHeight = this.$.height();\n \n var _el = this.renkan.$[0];\n paper.view.off(\"resize\");\n Screenfull.toggle(_el);\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 idsMap = {},\n hiddenNodes;\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 delete e._id;\n delete e.id;\n\n if(e.hidden_nodes) {\n hiddenNodes = e.hidden_nodes;\n e.hidden_nodes = [];\n _.each(hiddenNodes, function(h,j) {\n e.hidden_nodes.push(idsMap[h]);\n });\n }\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 setViewparameters: function(_params){\n this.removeRepresentationsOfType(\"View\");\n if ($.isEmptyObject(_params)){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n return;\n }\n if (typeof _params.viewIndex !== 'undefined'){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(_params.viewIndex)));\n } else {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n }\n if (typeof _params.view !== 'undefined' && _params.view.split(\",\").length >= 3){\n var viewParams = _params.view.split(\",\");\n var params = {\n \"project\": this.renkan.project,\n \"offset\": {\n \"x\": parseFloat(viewParams[0]),\n \"y\": parseFloat(viewParams[1])\n },\n \"zoom_level\": parseFloat(viewParams[2])\n };\n this.view.setScale(params.zoom_level, new paper.Point(params.offset));\n }\n //if view parameters = autoscale we apply a zoom fit on the view.\n if ((typeof _params.view !== 'undefined' && _params.view === \"autoscale\")){\n this.view.autoScale();\n }\n //if viewsNodes = false we show all the node by default.\n if (typeof _params.viewsNodes !== 'undefined'){\n if (_params.viewsNodes === \"true\"){\n this.view.hiddenNodes = (this.view.params.hidden_nodes || []).concat();\n this.view.hideNodes();\n } else {\n this.view.showNodes(false);\n }\n }\n //other parameters must go after because most of them depends on a view that must be initialize before\n this.unhighlightAll();\n if (typeof _params.idNode !== 'undefined'){\n this.highlightModel(this.renkan.project.get(\"nodes\").get(_params.idNode));\n }\n },\n validViewIndex: function(index){\n //check if the view index exist (negative index is from the end) and return the correct index or false if doesn't exist\n var _index = parseInt(index);\n var validIndex = 0;\n if (_index < 0){\n validIndex = this.renkan.project.get(\"views\").length + _index;\n } else {\n validIndex = _index;\n }\n if (typeof this.renkan.project.get(\"views\").at(_index) === 'undefined'){\n validIndex = 0;\n }\n return validIndex;\n },\n foldBins: function() {\n var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n bins = this.renkan.$.find(\".Rk-Bins\"),\n _delta = 0;\n var _this = this,\n sizeBef = _this.canvas_$.width(),\n sizeAft;\n if (bins.position().left < 0) {\n _delta= new paper.Point([-bins.width()/2, 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 _delta= new paper.Point([bins.width()/2, 0]);\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.view.paperShift(_delta);\n },\n save: function() { },\n open: function() { }\n }).value();\n\n /* Scene End */\n\n return Scene;\n\n});\n\ndefine('renderer/viewrepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer.View Class */\n\n /* The representation for the view. */\n\n var ViewRepr = Utils.inherit(BaseRepresentation);\n\n _(ViewRepr.prototype).extend({\n _init: function() {\n var _this = this;\n this.$ = $(\".Rk-Render\");\n this.type = \"View\";\n this.hiddenNodes = [];\n this.scale = 1;\n this.initialScale = 1;\n this.offset = paper.view.center;\n this.params = {};\n \n if (this.model){\n this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n }\n \n this.initWithParams();\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 bindClick(\".Rk-ZoomSave\", \"saveView\");\n \n this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset));\n _this.showNodes(false);\n if (_this.options.hide_nodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n }\n _this.updateUrl();\n });\n \n this.$.find(\".Rk-ShowHiddenNodes\").mouseenter( function() {\n _this.showNodes(true);\n _this.$.find(\".Rk-ShowHiddenNodes\").mouseleave( function() {\n _this.hideNodes();\n });\n });\n this.$.find(\".Rk-ShowHiddenNodes\").click( function() {\n _this.showNodes(false);\n _this.$.find(\".Rk-ShowHiddenNodes\").off( \"mouseleave\" ); \n });\n \n if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n },\n redraw: function(options) {\n //console.log(\"view : \", this.model.toJSON());\n },\n initWithParams: function(){\n var _this = this;\n \n if (_this.options.view_force_autoscale){\n this.autoScale();\n } else {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset)); \n }\n \n if (_this.options.hide_nodes && !_this.options.view_show_hiddennodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n } else {\n _this.showNodes(false);\n }\n },\n saveView: function(){\n var _this = this;\n \n var offset = {\n \"x\": _this.offset.x,\n \"y\": _this.offset.y\n };\n \n _this.model = _this.renkan.project.addView( { zoom_level:_this.scale, offset:offset, hidden_nodes: _this.hiddenNodes.concat() } );\n _this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n \n this.$.find(\".Rk-ZoomSetSaved\").show();\n \n _this.updateUrl();\n },\n addHiddenNode: function(_model){\n this.hideNode(_model);\n this.hiddenNodes.push(_model.id);\n this.updateUrl();\n },\n hideNode: function(_model){\n if (typeof this.renderer.getRepresentationByModel(_model) !== 'undefined'){\n this.renderer.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.renderer.getRepresentationByModel(_this.renkan.project.get(\"nodes\").get(_id)).show(ghost);\n });\n if (!ghost){\n this.hiddenNodes = [];\n }\n paper.view.draw();\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.renderer.redraw();\n this.updateUrl();\n }\n },\n zoomOut: function() {\n var _newScale = this.scale * Math.SQRT1_2,\n _offset = new paper.Point([\n this.renderer.canvas_$.width(),\n this.renderer.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.renderer.canvas_$.width(),\n this.renderer.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n this.setScale( _newScale, _offset );\n },\n resizeZoom: function(deltaW, deltaH, _ratio) {\n var _newScale = this.scale * _ratio;\n var _offset = new paper.Point([\n (this.renderer.canvas_$.width() * 0.5 * ( 1 - _ratio) ) + (this.offset.x * _ratio + deltaW * _ratio * 0.5 ),\n (this.renderer.canvas_$.height() * 0.5 * ( 1 - _ratio) ) + (this.offset.y * _ratio + deltaH * _ratio * 0.5 )\n ]);\n this.setScale( _newScale, _offset );\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 paperShift: function(_delta) {\n this.offset = this.offset.add(_delta);\n this.renderer.redraw();\n },\n updateUrl: function(){\n if(this.options.url_parameters && this.options.update_url){\n var result = {};\n var parameters = Backbone.history.getFragment().split('?');\n if (parameters.length > 1){\n parameters[1].split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n result.view = Math.round(this.offset.x*1000)/1000 + ',' + Math.round(this.offset.y*1000)/1000 + ',' + Math.round(this.scale*1000)/1000;\n\n if (this.renkan.project.get(\"views\").indexOf(this.model) > -1){\n result.viewIndex = this.renkan.project.get(\"views\").indexOf(this.model);\n if (result.viewIndex === this.renkan.project.get(\"views\").length - 1){\n result.viewIndex = -1;\n }\n } else {\n if (result.viewIndex){\n delete result.viewIndex;\n }\n }\n this.renkan.router.navigate(\"?\" + decodeURIComponent($.param(result)), {trigger: false, replace: true});\n }\n },\n destroy: function(_event) {\n this._super(\"destroy\");\n this.showNodes(false);\n }\n }).value();\n\n return ViewRepr;\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 'ckeditor-core':'../lib/ckeditor/ckeditor',\n 'ckeditor-jquery':'../lib/ckeditor/adapters/jquery',\n 'screenfull':'../lib/screenfull/screenfull-umd'\n },\n shim: {\n 'ckeditor-jquery':{\n deps:['jquery','ckeditor-core']\n }\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 'renderer/viewrepr'\n ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene, ViewRepr){\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.View = ViewRepr;\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
+{"version":3,"file":"renkan.min.js","sources":["templates.js","../../js/main.js","../../js/router.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","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","description","static_url","url","show_bins","show_editor","show_node_editor_title_richtext","node","show_node_editor_uri","change_types","types","type","charAt","toUpperCase","substring","show_node_editor_description","show_node_editor_description_richtext","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","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","_id","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","hide_nodes","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","node_editor_templates","template","types_templates","value","key","property_files","f","getJSON","data","concat","read_only","router","Router","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","Renderer","Scene","search","_select","_input","_form","_search","_key","Search","getSearchTitle","className","getBgClass","_el","setSearchEngine","submit","val","search_engine","mouseenter","mouseleave","bins","_bin","Bin","elementDropped","_mainDiv","siblings","is","slideUp","_e","_t","_models","where","_model","highlightModel","mouseout","unhighlightAll","e","dragDrop","err","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","_arg","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","fillColor","Color","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","Backbone","routes","index","parameters","result","forEach","part","item","decodeURIComponent","trigger","converters","from1to2","len","nodes","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","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","view_force_autoscale","view_show_hiddennodes","default_index_view","url_parameters","update_url","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","ghost_opacity","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","default","video","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","tooltip_opacity","richtext_editor_config","toolbarGroups","name","groups","removePlugins","show_node_editor_title","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","Polygon","Zoom Fit","Download Project","Save view","View saved view","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","Show hidden nodes","Show neighbors","Hide","Fullscreen not supported by your browser","jsonIO","_proj","http_method","_load","loadingStatus","_data","saveStatus","_save","ajax","contentType","JSON","stringify","success","textStatus","jqXHR","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","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","unhighlight","mousedown","mouseup","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","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","NodeHideButton","NodeShowButton","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","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","clean_title","textContent","innerText","_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","clearTimeout","hide_timeout","_uri","showNeighbors","hideButtons","buttons_timeout","undefined","hideNeighbors","hide_delay","delay","indexNode","hiddenNodes","indexOf","splice","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","_opacity","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","visible","handleIn","handleOut","bounds","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","keys","editorInstance","ckeditor","editorInstanceTitle","closeEditor","cleanEditor","editor","focusManager","blur","_editor_title","onFieldChange","checkDirty","getData","resetDirty","assign","keyCode","files","FileReader","alert","onload","target","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","NodeButton","delid","delete_list","time","valueOf","confirm","addHiddenNode","unset","_off","_point","addTempEdge","MiniFrame","filesaver","Screenfull","representations","notif_$","setup","totalScroll","mouse_down","selected_target","Layer","redrawActive","background_layer","topleft","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","_lastTap","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","parse","bindClick","selector","fname","evt","enabled","addEventListener","raw","fullscreenchange","widthAft","heightAft","viewSize","currentWidth","currentHeight","isFullscreen","onResize","newWidth","_width","newHeight","prevHeight","delta","prevWidth","fadeIn","fadeOut","mouseover","_thRedraw","addRepresentations","_thRedrawUsers","history","fixSize","_params","setViewparameters","el","_delay","autoScale","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","last","_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","closed","PointText","characterStyle","fontSize","paragraphStyle","justification","_visible","_restPos","_grp","_imgdelta","_currentPos","_edgeRepr","_bundle","_er","_dir","savebtn","tip","redrawMiniframe","bottomright","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","empty","parent","background","_representation","_representations","_ratio","ratioH","ratioW","resizeZoom","_from","_tmpEdge","last_point","updateUrl","_scrolldelta","SQRT1_2","open","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","toggle","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","isEmptyObject","validViewIndex","viewIndex","viewParams","params","viewsNodes","hideNodes","showNodes","idNode","_index","validIndex","foldBins","sizeAft","foldBinsButton","sizeBef","animate","ViewRepr","initialScale","initWithParams","saveView","hideNode","_offset","zoomOut","zoomIn","deltaW","deltaH","force_view","getFragment","round","navigate","param","require","config","paths","jquery","underscore","ckeditor-core","ckeditor-jquery","screenfull","shim","deps","startRenkan"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,KAAgB,UAAIA,KAAgB,cAEpCA,KAAgB,UAAE,8BAAgC,SAASC,KAC3DA,MAAQA,OACR,IAAIC,KAAKC,IAAM,EAAUC,GAAEC,MAC3B,MAAMJ,IACNE,KAAO,oBACS,OAAdD,IAAM,GAAe,GAAKA,KAC5B,yBACgB,OA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,iBACA,qBACG,SAASvgB,EAAoBuQ,EAAY1O,EAAUhX,EAAMgiB,EAAUiB,EAAYC,EAAYqC,EAAYW,EAAYxO,EAAgBC,EAAkBI,EAAgBC,EAAgBE,EAAkBN,EAAgBC,EAAmBC,EAAkBmI,EAAgBC,EAAkBC,EAAkB0G,EAAW/1B,EAAO6jC,GAE1U,YAEA,IAAIpsC,GAAO4F,OAAO5F,IAEU,oBAAlBA,GAAKsI,WACXtI,EAAKsI,YAET,IAAIA,GAAWtI,EAAKsI,QAEpBA,GAASijB,oBAAsBqB,EAC/BtkB,EAASukB,YAAcsQ,EACvB70B,EAAS6O,KAAOsX,EAChBnmB,EAASmP,KAAOA,EAChBnP,EAASsP,KAAOw0B,EAChB9jC,EAASmxB,SAAWA,EACpBnxB,EAAS8xB,YAAcM,EACvBpyB,EAASqyB,WAAaA,EACtBryB,EAAS00B,WAAaA,EACtB10B,EAAS80B,YAAcO,EACvBr1B,EAAS6mB,eAAiBA,EAC1B7mB,EAAS8mB,iBAAmBA,EAC5B9mB,EAASknB,eAAiBA,EAC1BlnB,EAASmnB,eAAiBA,EAC1BnnB,EAASqnB,iBAAmBA,EAC5BrnB,EAAS+mB,eAAiBA,EAC1B/mB,EAASgnB,kBAAoBA,EAC7BhnB,EAASinB,iBAAmBA,EAC5BjnB,EAASovB,eAAiBA,EAC1BpvB,EAASqvB,iBAAmBA,EAC5BrvB,EAASsvB,iBAAmBA,EAC5BtvB,EAASg2B,UAAYA,EACrBh2B,EAASC,MAAQA,EAEjBslC,gBAGJviB,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((__t = (edge.description)) == null ? '' : __t) +\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 ';\n if (options.show_node_editor_title_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Title\" contenteditable=\"true\">' +\n((__t = (node.title)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(node.title) +\n'\" />\\n ';\n } ;\n__p += ' \\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.change_types) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Types available\")) +\n':</label>\\n <select class=\"Rk-Edit-Type\">\\n ';\n _.each(types, function(type) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( type ) +\n'\"';\n if (node.type === type) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(type.charAt(0).toUpperCase() + type.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\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 ';\n if (options.show_node_editor_description_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Description\" contenteditable=\"true\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <textarea class=\"Rk-Edit-Description\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</textarea>\\n ';\n } ;\n__p += '\\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((__t = (node.title)) == null ? '' : __t) +\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((__t = (node.description)) == null ? '' : __t) +\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 <a href=\"#?idNode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor_video.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 <video width=\"320\" height=\"240\" controls>\\n <source src=\"' +\n__e(node.uri) +\n'\" type=\"video/mp4\">\\n </video> \\n';\n } ;\n__p += '\\n <a href=\"#?idnode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\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('Save view')) +\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 view')) +\n'\"></div>\\n ';\n if (options.hide_nodes) { ;\n__p += '\\n \\t <div class=\"Rk-ShowHiddenNodes\" title=\"' +\n__e(translate('Show hidden nodes')) +\n'\"></div>\\n ';\n } ;\n__p += ' \\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: _.defaults(_opts.templates, renkanJST) || renkanJST,\n node_editor_templates: _.defaults(_opts.node_editor_templates, Rkns.defaults.node_editor_templates)\n });\n this.template = renkanJST['templates/main.html'];\n\n var types_templates = {};\n _.each(this.options.node_editor_templates, function(value, key) {\n types_templates[key] = _this.options.templates[value];\n delete _this.options.templates[value];\n });\n this.options.node_editor_templates = types_templates;\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.router = new Rkns.Router();\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 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.fillColor = new paper.Color(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 \"use strict\";\n \n var Backbone = root.Backbone;\n \n var Router = root.Rkns.Router = Backbone.Router.extend({\n routes: {\n '': 'index'\n },\n \n index: function (parameters) {\n \n var result = {};\n if (parameters !== null){\n parameters.split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n this.trigger('router', result); \n } \n });\n\n})(window);","(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 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 data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n this.project.set(this.convert(data), {\n validate: true\n });\n this.project.trigger('loaded', true);\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: false,\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 view_force_autoscale: true,\n /* Force autoscale when the Renkan is loaded */\n view_show_hiddennodes: true,\n /* Show all the node when the Renkan is loaded */\n default_index_view: -1,\n \n /* URL parsing */\n url_parameters: true,\n /* accept or not hash parameters in the url */\n update_url: true,\n /* update the url each time the paper shift or on zoom in/out, with the serialized view (offset and scale) */\n /* Considered as false if url_parameters is false */\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 ghost_opacity : 0.3,\n /* opacity when the hidden element is revealed */\n default_dash_array : [4, 5],\n /* dash line genometry */\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 hide_nodes: true,\n /* allow hide/show nodes */\n change_shapes: true,\n /* Change shapes enabled */\n change_types: true,\n /* Change type enabled */\n\n /* NODE EDITOR TEMPLATE*/\n\n node_editor_templates: {\n \"default\": \"templates/nodeeditor_readonly.html\",\n \"video\": \"templates/nodeeditor_video.html\"\n },\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 tooltip_opacity: 0.8,\n\n richtext_editor_config: {\n toolbarGroups: [\n { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },\n { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },\n '/',\n\t { name: 'styles'},\n ],\n removePlugins : 'colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates',\n },\n\n /* NODE EDITOR OPTIONS */\n\n show_node_editor_uri: true,\n show_node_editor_title: true,\n show_node_editor_title_richtext: true,\n show_node_editor_description: true,\n show_node_editor_description_richtext: 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\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","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 \"Polygon\": \"Polygone\",\n \"Zoom Fit\": \"Ajuster le Zoom\",\n \"Download Project\": \"Télécharger le projet\",\n \"Save view\": \"Sauver la vue\",\n \"View saved view\": \"Restaurer la Vue\",\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 \"Show hidden nodes\": \"Montrer les noeuds cachés\",\n \"Show neighbors\": \"Montrer les voisins\",\n \"Hide\": \"Cacher\",\n \"Fullscreen not supported by your browser\": \"Le plein écran n'est pas supporté par votre navigateur\"\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 _proj.set({\n loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n \n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\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 \n //TODO: Rearrange to avoid the 2 firts PUT due to a change in the project model\n // Take car of setting up the listener correctly to listen the save action on the view\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 }\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 'use strict';\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 'use strict';\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 'use strict';\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 if (this.sector){\n this.sector.hide(); \n }\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 'use strict';\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 var shape = new paper.Path.RegularPolygon([0,0], 3, 1);\n shape.scale(radius);\n shape.translate(center);\n return shape;\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 'use strict';\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.NodeLinkButton(this.renderer, null),\n new Renderer.NodeEnlargeButton(this.renderer, null),\n new Renderer.NodeShrinkButton(this.renderer, null)\n ];\n if (this.options.hide_nodes){\n this.normal_buttons.push(\n new Renderer.NodeHideButton(this.renderer, null),\n new Renderer.NodeShowButton(this.renderer, null)\n );\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.view.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 \n //strip html from title\n var html = this.model.get(\"title\");\n var div = document.createElement(\"div\");\n div.innerHTML = html;\n var clean_title = div.textContent || div.innerText || \"\";\n \n var _text = clean_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.view.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 clearTimeout(this.hide_timeout);\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.renderer.removeRepresentationsOfType(\"editor\");\n this.hide();\n }\n else {\n this.hideNeighbors(true);\n }\n this._super(\"unselect\");\n }\n },\n hide_delay: function(){\n var _this = this;\n this.hide_timeout = setTimeout(function(){\n _this.hide();\n }, 1000);\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(false);\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 = this.options.ghost_opacity;\n }\n this.circle.opacity = this.options.ghost_opacity;\n this.title.css('opacity', this.options.ghost_opacity);\n this.minimap_circle.opacity = this.options.ghost_opacity;\n } else {\n this.minimap_circle.opacity = 1; \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(delay){\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 if (delay){ repr.hide_delay(); } else {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.view.hiddenNodes.indexOf(repr.model.id);\n if (indexNode !== -1){\n _this.renderer.view.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.view.hiddenNodes.indexOf(this.model.id);\n if (index !== -1){\n this.renderer.view.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 'use strict';\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;\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 = this.ghost ? this.options.ghost_opacity : 1;\n this.line.dashArray = null;\n }\n\n var old_act_btn = this.active_buttons;\n\n this.arrow.visible =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) ||\n !this.model.has(\"style\") ||\n typeof this.model.get(\"style\").arrow === 'undefined';\n\n this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.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 = _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 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 if (this.hidden){\n this.renderer.removeRepresentationsOfType(\"editor\");\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 'use strict';\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 'use strict';\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 = this.options.tooltip_opacity;\n this.editor_$ = $('<div>')\n .appendTo(this.renderer.editor_$)\n .css({\n position: \"absolute\",\n opacity: this.options.tooltip_opacity\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', 'ckeditor-jquery'], function ($, _, requtils, BaseEditor, ShapeBuilder) {\n 'use strict';\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.node_editor_templates;\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[_model.get(\"type\")] || this.readOnlyTemplate[\"default\"]),\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 _id: _model.get(\"_id\"),\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n type: _model.get(\"type\") || \"default\",\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 types : _(this.options.node_editor_templates).keys().value(),\n }));\n this.redraw();\n var _this = this,\n editorInstance = _this.options.show_node_editor_description_richtext ?\n $(\".Rk-Edit-Description\").ckeditor(_this.options.richtext_editor_config) :\n false,\n editorInstanceTitle = _this.options.show_node_editor_title_richtext ?\n $(\".Rk-Edit-Title\").ckeditor(_this.options.richtext_editor_config) :\n false,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n\n _this.cleanEditor = 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined') {\n var _editor = editorInstance.editor;\n delete editorInstance.editor;\n _editor.focusManager.blur(true);\n _editor.destroy();\n }\n }\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined') {\n var _editor_title = editorInstanceTitle.editor;\n delete editorInstanceTitle.editor;\n _editor_title.focusManager.blur(true);\n _editor_title.destroy();\n }\n }\n };\n\n this.editor_$.find(\".Rk-CloseX\").click(function (e) {\n e.preventDefault();\n closeEditor();\n });\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 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined' &&\n editorInstance.editor.checkDirty()) {\n _data.description = editorInstance.editor.getData();\n editorInstance.editor.resetDirty();\n }\n }\n else {\n _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n }\n }\n if (_this.options.show_node_editor_title) {\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined' &&\n editorInstanceTitle.editor.checkDirty()) {\n _data.title = editorInstanceTitle.editor.getData();\n editorInstanceTitle.editor.resetDirty();\n }\n }\n else {\n _data.title = _this.editor_$.find(\".Rk-Edit-Title\").val();\n }\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 if (_this.options.change_types) {\n if(_model.get(\"type\")!==_this.editor_$.find(\".Rk-Edit-Type\").val()){\n _data.type = _this.editor_$.find(\".Rk-Edit-Type\").val();\n }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 1000);\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 if( _this.options.show_node_editor_description &&\n _this.options.show_node_editor_description_richtext &&\n typeof editorInstance.editor !== 'undefined')\n {\n editorInstance.editor.on(\"change\", onFieldChange);\n editorInstance.editor.on(\"blur\", onFieldChange);\n }\n \n if( _this.options.show_node_editor_title &&\n _this.options.show_node_editor_title_richtext &&\n typeof editorInstanceTitle.editor !== 'undefined')\n {\n editorInstanceTitle.editor.on(\"change\", onFieldChange);\n editorInstanceTitle.editor.on(\"blur\", onFieldChange);\n }\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 destroy: function() {\n if(typeof this.cleanEditor !== 'undefined') {\n this.cleanEditor();\n }\n this.editor_block.remove();\n this.editor_$.remove();\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 'use strict';\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 arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash, 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 'use strict';\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 'use strict';\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 = this.options.hide_nodes ? -125 : -135;\n this.endAngle = this.options.hide_nodes ? -55 : -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 'use strict';\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 = this.options.hide_nodes ? -10 : 0;\n this.endAngle = this.options.hide_nodes ? 45 : 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/nodehidebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n 'use strict';\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.view.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 'use strict';\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 neighbors\";\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 'use strict';\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 'use strict';\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 = this.options.hide_nodes ? 135 : 90;\n this.endAngle = this.options.hide_nodes ? 190 : 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 'use strict';\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 = this.options.hide_nodes ? -55 : -45;\n this.endAngle = this.options.hide_nodes ? -10 : 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 'use strict';\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 = this.options.hide_nodes ? -170 : -180;\n this.endAngle = this.options.hide_nodes ? -125 : -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 'use strict';\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 'use strict';\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 'use strict';\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 'use strict';\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', 'screenfull'], function ($, _, filesaver, requtils, MiniFrame, Screenfull) {\n 'use strict';\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.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 = false;\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 _lastTap = 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.view.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.view.scale,\n _newOffset = new paper.Point([\n _this.canvas_$.width(),\n _this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.view.offset.multiply( _scaleRatio ));\n _this.view.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 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 \n if (Screenfull.enabled){\n bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n \n document.addEventListener(Screenfull.raw.fullscreenchange, function () {\n //the listener occur too randomly and sometimes before the fullscreen is fully set up\n //so we add 500 delay\n setTimeout(function(){\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 _this.resize(_this.currentWidth, widthAft, _this.currentHeight, heightAft);\n \n _this.currentWidth = widthAft;\n _this.currentHeight = heightAft;\n \n if (!Screenfull.isFullscreen) {\n paper.view.onResize = function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\n };\n }\n }, 600);\n });\n } else {\n this.$.find(\".Rk-FullScreen-Button\").addClass(\"disabled\");\n this.$.find(\".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents\").html(this.renkan.translate(\"Fullscreen not supported by your browser\"));\n }\n \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.on(\"resize\", function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\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(\"loaded\", function(){\n if (_this.renkan.options.url_parameters){\n Backbone.history.start(); \n } else {\n _this.fixSize();\n }\n _this.redrawActive = true;\n _thRedraw();\n });\n \n //register router events\n this.renkan.router.on(\"router\", function(_params){\n _this.setViewparameters(_params);\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 > 1) {\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(typeof this.view === 'undefined') {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").last());\n }\n this.view.autoScale();\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 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.view.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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 && typeof this.view !== 'undefined') {\n this.redrawMiniframe();\n }\n paper.view.draw();\n },\n resize: function(prevWidth, newWidth, prevHeight, newHeight){\n var _ratio;\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/prevHeight,\n ratioW = newWidth/prevWidth;\n if (newHeight < newWidth) {\n _ratio = ratioH;\n } else {\n _ratio = ratioW;\n }\n this.view.resizeZoom(newWidth - prevWidth, newHeight - prevHeight, _ratio);\n \n this.redraw();\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 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.view.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 var _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 this.view.updateUrl();\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.view.offset).multiply( Math.SQRT2 - 1 );\n if (this.totalScroll > 0) {\n this.view.setScale( this.view.scale * Math.SQRT2, this.view.offset.subtract(_delta) );\n } else {\n this.view.setScale( this.view.scale * Math.SQRT1_2, this.view.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 this.currentWidth = this.$.width();\n this.currentHeight = this.$.height();\n \n var _el = this.renkan.$[0];\n paper.view.off(\"resize\");\n Screenfull.toggle(_el);\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 idsMap = {},\n hiddenNodes;\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 delete e._id;\n delete e.id;\n\n if(e.hidden_nodes) {\n hiddenNodes = e.hidden_nodes;\n e.hidden_nodes = [];\n _.each(hiddenNodes, function(h,j) {\n e.hidden_nodes.push(idsMap[h]);\n });\n }\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 setViewparameters: function(_params){\n this.removeRepresentationsOfType(\"View\");\n if ($.isEmptyObject(_params)){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n return;\n }\n if (typeof _params.viewIndex !== 'undefined'){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(_params.viewIndex)));\n } else {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n }\n if (typeof _params.view !== 'undefined' && _params.view.split(\",\").length >= 3){\n var viewParams = _params.view.split(\",\");\n var params = {\n \"project\": this.renkan.project,\n \"offset\": {\n \"x\": parseFloat(viewParams[0]),\n \"y\": parseFloat(viewParams[1])\n },\n \"zoom_level\": parseFloat(viewParams[2])\n };\n this.view.setScale(params.zoom_level, new paper.Point(params.offset));\n }\n //if view parameters = autoscale we apply a zoom fit on the view.\n if ((typeof _params.view !== 'undefined' && _params.view === \"autoscale\")){\n this.view.autoScale();\n }\n //if viewsNodes = false we show all the node by default.\n if (typeof _params.viewsNodes !== 'undefined'){\n if (_params.viewsNodes === \"true\"){\n this.view.hiddenNodes = (this.view.params.hidden_nodes || []).concat();\n this.view.hideNodes();\n } else {\n this.view.showNodes(false);\n }\n }\n //other parameters must go after because most of them depends on a view that must be initialize before\n this.unhighlightAll();\n if (typeof _params.idNode !== 'undefined'){\n this.highlightModel(this.renkan.project.get(\"nodes\").get(_params.idNode));\n }\n },\n validViewIndex: function(index){\n //check if the view index exist (negative index is from the end) and return the correct index or false if doesn't exist\n var _index = parseInt(index);\n var validIndex = 0;\n if (_index < 0){\n validIndex = this.renkan.project.get(\"views\").length + _index;\n } else {\n validIndex = _index;\n }\n if (typeof this.renkan.project.get(\"views\").at(_index) === 'undefined'){\n validIndex = 0;\n }\n return validIndex;\n },\n foldBins: function() {\n var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n bins = this.renkan.$.find(\".Rk-Bins\"),\n _delta = 0;\n var _this = this,\n sizeBef = _this.canvas_$.width(),\n sizeAft;\n if (bins.position().left < 0) {\n _delta= new paper.Point([-bins.width()/2, 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 _delta= new paper.Point([bins.width()/2, 0]);\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.view.paperShift(_delta);\n },\n save: function() { },\n open: function() { }\n }).value();\n\n /* Scene End */\n\n return Scene;\n\n});\n\ndefine('renderer/viewrepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n 'use strict';\n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer.View Class */\n\n /* The representation for the view. */\n\n var ViewRepr = Utils.inherit(BaseRepresentation);\n\n _(ViewRepr.prototype).extend({\n _init: function() {\n var _this = this;\n this.$ = $(\".Rk-Render\");\n this.type = \"View\";\n this.hiddenNodes = [];\n this.scale = 1;\n this.initialScale = 1;\n this.offset = paper.view.center;\n this.params = {};\n \n if (this.model){\n this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n }\n \n this.initWithParams();\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 bindClick(\".Rk-ZoomSave\", \"saveView\");\n \n this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset));\n _this.showNodes(false);\n if (_this.options.hide_nodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n }\n _this.updateUrl();\n });\n \n this.$.find(\".Rk-ShowHiddenNodes\").mouseenter( function() {\n _this.showNodes(true);\n _this.$.find(\".Rk-ShowHiddenNodes\").mouseleave( function() {\n _this.hideNodes();\n });\n });\n this.$.find(\".Rk-ShowHiddenNodes\").click( function() {\n _this.showNodes(false);\n _this.$.find(\".Rk-ShowHiddenNodes\").off( \"mouseleave\" ); \n });\n \n if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n },\n redraw: function(options) {\n //console.log(\"view : \", this.model.toJSON());\n },\n initWithParams: function(){\n var _this = this;\n \n if (_this.options.view_force_autoscale){\n this.autoScale();\n } else {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset)); \n }\n \n if (_this.options.hide_nodes && !_this.options.view_show_hiddennodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n } else {\n _this.showNodes(false);\n }\n },\n saveView: function(){\n var _this = this;\n \n var offset = {\n \"x\": _this.offset.x,\n \"y\": _this.offset.y\n };\n \n _this.model = _this.renkan.project.addView( { zoom_level:_this.scale, offset:offset, hidden_nodes: _this.hiddenNodes.concat() } );\n _this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n \n this.$.find(\".Rk-ZoomSetSaved\").show();\n \n _this.updateUrl();\n },\n addHiddenNode: function(_model){\n this.hideNode(_model);\n this.hiddenNodes.push(_model.id);\n this.updateUrl();\n },\n hideNode: function(_model){\n if (typeof this.renderer.getRepresentationByModel(_model) !== 'undefined'){\n this.renderer.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.renderer.getRepresentationByModel(_this.renkan.project.get(\"nodes\").get(_id)).show(ghost);\n });\n if (!ghost){\n this.hiddenNodes = [];\n }\n paper.view.draw();\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.renderer.redraw();\n this.updateUrl();\n }\n },\n zoomOut: function() {\n var _newScale = this.scale * Math.SQRT1_2,\n _offset = new paper.Point([\n this.renderer.canvas_$.width(),\n this.renderer.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.renderer.canvas_$.width(),\n this.renderer.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n this.setScale( _newScale, _offset );\n },\n resizeZoom: function(deltaW, deltaH, _ratio) {\n var _newScale = this.scale * _ratio;\n var _offset = new paper.Point([\n (this.renderer.canvas_$.width() * 0.5 * ( 1 - _ratio) ) + (this.offset.x * _ratio + deltaW * _ratio * 0.5 ),\n (this.renderer.canvas_$.height() * 0.5 * ( 1 - _ratio) ) + (this.offset.y * _ratio + deltaH * _ratio * 0.5 )\n ]);\n this.setScale( _newScale, _offset );\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 paperShift: function(_delta) {\n this.offset = this.offset.add(_delta);\n this.renderer.redraw();\n },\n updateUrl: function(){\n if(this.options.url_parameters && this.options.update_url){\n var result = {};\n var parameters = Backbone.history.getFragment().split('?');\n if (parameters.length > 1){\n parameters[1].split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n result.view = Math.round(this.offset.x*1000)/1000 + ',' + Math.round(this.offset.y*1000)/1000 + ',' + Math.round(this.scale*1000)/1000;\n\n if (this.renkan.project.get(\"views\").indexOf(this.model) > -1){\n result.viewIndex = this.renkan.project.get(\"views\").indexOf(this.model);\n if (result.viewIndex === this.renkan.project.get(\"views\").length - 1){\n result.viewIndex = -1;\n }\n } else {\n if (result.viewIndex){\n delete result.viewIndex;\n }\n }\n this.renkan.router.navigate(\"?\" + decodeURIComponent($.param(result)), {trigger: false, replace: true});\n }\n },\n destroy: function(_event) {\n this._super(\"destroy\");\n this.showNodes(false);\n }\n }).value();\n\n return ViewRepr;\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 'ckeditor-core':'../lib/ckeditor/ckeditor',\n 'ckeditor-jquery':'../lib/ckeditor/adapters/jquery',\n 'screenfull':'../lib/screenfull/screenfull-umd'\n },\n shim: {\n 'ckeditor-jquery':{\n deps:['jquery','ckeditor-core']\n }\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 'renderer/viewrepr'\n ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene, ViewRepr){\n\n 'use strict';\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.View = ViewRepr;\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/__init__.py Wed Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/__init__.py Mon Oct 19 14:18:51 2015 +0200
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-VERSION = (0, 12, 13, "final", 0)
+VERSION = (0, 12, 14, "final", 0)
def get_version():
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
/*!
* _____ _
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.min.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/renkan.min.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
/*!
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/space-editor.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/space-editor.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
html {
overflow: visible !important;
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/space-editor.min.css Wed Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/css/space-editor.min.css Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
html{overflow:visible!important}body{font-family:Arial,Helvetica,sans-serif;background:#F6F6F6;color:#333}.clearer{display:block;clear:both;height:1px}h1{margin-bottom:5px;padding:0 15px;background:#333;color:#fff;font-weight:700;font-size:30px;line-height:60px}.right{width:301px;position:absolute;top:10px;right:10px}.main{margin:10px 330px 10px 20px}.blue-button{display:inline-block;padding:4px 6px;color:#fff;text-decoration:none;border-radius:4px;background:-moz-linear-gradient(top,#6080c0,#2040a0);background:-webkit-linear-gradient(top,#6080c0,#2040a0);box-shadow:1px 1px 2px gray}.blue-button:hover{background:-moz-linear-gradient(top,#2040a0,#6080c0);background:-webkit-linear-gradient(top,#2040a0,#6080c0)}.update-preview{text-align:center;display:block;margin-bottom:10px;font-size:24px;font-weight:700;line-height:34px}#preview{position:relative;border-left:1px solid #000;border-bottom:1px solid #000;width:300px;height:800px;border-radius:4px;overflow:hidden;margin-bottom:10px}.section-title{font-size:20px;font-weight:700;margin:20px 0 5px}.first-level-list{margin:5px 0}.add-item{margin:5px 0;font-size:22px;font-weight:700;line-height:18px}.add-item:hover:after{float:right;font-size:14px;font-weight:400;line-height:18px;margin-left:4px}.add-search-engine:hover:after{content:"Add Search Engine"}.add-resource:hover:after{content:"Add Resource"}.add-bin:hover:after{content:"Add Bin"}.item{padding:5px;margin:5px 0;border-radius:4px;font-size:12px;background:-moz-linear-gradient(top,#ffcc8f,#fff0d0);background:-webkit-linear-gradient(top,#ffcc8f,#fff0d0);box-shadow:1px 1px 2px gray}.remove-item{float:right;font-size:22px;line-height:18px;height:18px;margin:0 0 2px -10px;font-weight:700}.setting{float:left;width:260px;margin:2px 15px 2px 2px;line-height:24px;min-height:24px}.setting label{float:left;display:block;width:100px;font-weight:700}.display-value{float:left;display:block;width:160px}.edit-value{width:160px;display:none;border:1px solid #ccc;border-radius:3px}input.edit-value,textarea.edit-value{width:154px;padding:2px}textarea.edit-value{resize:vertical;height:72px}.item-editing .display-value{display:none}.item-editing .edit-value{display:inline-block}.resource-list-title{clear:both;width:100%;font-size:16px;font-weight:700;margin:5px 0 0}.resource{display:block;clear:both;padding:5px;margin:5px;border-radius:4px;background:-moz-linear-gradient(top,#ff8f00,#ffcc8f);background:-webkit-linear-gradient(top,#ff8f00,#ffcc8f);box-shadow:1px 1px 2px gray}.resource .display-value{display:inline-block}.resource .edit-value,.resource.resource-editing .display-value{display:none}.resource.resource-editing .edit-value{display:inline-block}
\ No newline at end of file
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.js Wed Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.js Mon Oct 19 14:18:51 2015 +0200
@@ -24,7 +24,7 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - Copyright © IRI 2015 */
this["renkanJST"] = this["renkanJST"] || {};
@@ -2843,7 +2843,7 @@
define('renderer/baserepresentation',['jquery', 'underscore'], function ($, _) {
-
+ 'use strict';
/* Rkns.Renderer._BaseRepresentation Class */
@@ -2928,7 +2928,7 @@
});
define('requtils',[], function ($, _) {
-
+ 'use strict';
return {
getUtils: function(){
return window.Rkns.Utils;
@@ -2942,7 +2942,7 @@
define('renderer/basebutton',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -2984,7 +2984,7 @@
define('renderer/shapebuilder',[], function () {
-
+ 'use strict';
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";
/* ShapeBuilder Begin */
@@ -3099,7 +3099,7 @@
});
define('renderer/noderepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation', 'renderer/shapebuilder'], function ($, _, requtils, BaseRepresentation, ShapeBuilder) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -3706,7 +3706,7 @@
define('renderer/edge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4007,7 +4007,7 @@
define('renderer/tempedge',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4107,7 +4107,7 @@
define('renderer/baseeditor',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4147,7 +4147,7 @@
define('renderer/nodeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder', 'ckeditor-jquery'], function ($, _, requtils, BaseEditor, ShapeBuilder) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4481,7 +4481,7 @@
define('renderer/edgeeditor',['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4674,7 +4674,7 @@
define('renderer/nodebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4726,7 +4726,7 @@
define('renderer/nodeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4759,7 +4759,7 @@
define('renderer/noderemovebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4806,7 +4806,7 @@
define('renderer/nodehidebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4842,7 +4842,7 @@
define('renderer/nodeshowbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4878,7 +4878,7 @@
define('renderer/noderevertbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4913,7 +4913,7 @@
define('renderer/nodelinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4954,7 +4954,7 @@
define('renderer/nodeenlargebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -4989,7 +4989,7 @@
define('renderer/nodeshrinkbutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5024,7 +5024,7 @@
define('renderer/edgeeditbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5053,7 +5053,7 @@
define('renderer/edgeremovebutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5096,7 +5096,7 @@
define('renderer/edgerevertbutton',['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5127,7 +5127,7 @@
define('renderer/miniframe',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -5156,7 +5156,7 @@
define('renderer/scene',['jquery', 'underscore', 'filesaver', 'requtils', 'renderer/miniframe', 'screenfull'], function ($, _, filesaver, requtils, MiniFrame, Screenfull) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -6476,7 +6476,7 @@
});
define('renderer/viewrepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
var Utils = requtils.getUtils();
@@ -6756,7 +6756,7 @@
'renderer/viewrepr'
], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene, ViewRepr){
-
+ 'use strict';
var Rkns = window.Rkns;
--- a/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.js Wed Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.js Mon Oct 19 14:18:51 2015 +0200
@@ -24,12 +24,12 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/
-/*! renkan - v0.12.13 - Copyright © IRI 2015 */
+/*! renkan - v0.12.14 - 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 __t,__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>"+(null==(__t=edge.description)?"":__t)+"</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 ",__p+=options.show_node_editor_title_richtext?'\n <div class="Rk-Edit-Title" contenteditable="true">'+(null==(__t=node.title)?"":__t)+"</div>\n ":'\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n ',__p+=" \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.change_types&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Types available"))+':</label>\n <select class="Rk-Edit-Type">\n ',_.each(types,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.type===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+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+"</label>\n ",__p+=options.show_node_editor_description_richtext?'\n <div class="Rk-Edit-Description" contenteditable="true">'+(null==(__t=node.description)?"":__t)+"</div>\n ":'\n <textarea class="Rk-Edit-Description">'+(null==(__t=node.description)?"":__t)+"</textarea>\n ",__p+="\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 __t,__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 "+(null==(__t=node.title)?"":__t)+"\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">'+(null==(__t=node.description)?"":__t)+"</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 <a href="#?idNode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\n";return __p},this.renkanJST["templates/nodeeditor_video.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 <video width="320" height="240" controls>\n <source src="'+__e(node.uri)+'" type="video/mp4">\n </video> \n'),__p+='\n <a href="#?idnode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\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("Save view"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved view"))+'"></div>\n ',options.hide_nodes&&(__p+='\n <div class="Rk-ShowHiddenNodes" title="'+__e(translate("Show hidden nodes"))+'"></div>\n '),__p+=" \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;b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:d.defaults(a.templates,renkanJST)||renkanJST,node_editor_templates:d.defaults(a.node_editor_templates,b.defaults.node_editor_templates)}),this.template=renkanJST["templates/main.html"];var f={};if(d.each(this.options.node_editor_templates,function(a,b){f[b]=e.options.templates[a],delete e.options.templates[a]}),this.options.node_editor_templates=f,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.router=new b.Router,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 g=renkanJST["templates/search.html"],h=this.$.find(".Rk-Search-List"),i=this.$.find(".Rk-Web-Search-Input"),j=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))}),h.html(d(this.search_engines).map(function(a,b){return g({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),h.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),j.submit()}),j.submit(function(){if(i.val()){var a=e.search_engine;a.search(i.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){h.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){h.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 k=!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(){k=!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(k)e.renderer.onMouseMove(b,!0);else{k=!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){k&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),k=!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 l=!1,m="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==m){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==l&&(l=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.fillColor=new paper.Color(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.Backbone;a.Rkns.Router=b.Router.extend({routes:{"":"index"},index:function(a){var b={};null!==a&&a.split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),this.trigger("router",b)}})}}(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.style=d.color?{color:d.color}:{}}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]&&(a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){this.project.set(this.convert(a),{validate:!0}),this.project.trigger("loaded",!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:!1,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,view_force_autoscale:!0,view_show_hiddennodes:!0,default_index_view:-1,url_parameters:!0,update_url:!0,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,ghost_opacity:.3,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)",hide_nodes:!0,change_shapes:!0,change_types:!0,node_editor_templates:{"default":"templates/nodeeditor_readonly.html",video:"templates/nodeeditor_video.html"},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,tooltip_opacity:.8,richtext_editor_config:{toolbarGroups:[{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"clipboard",groups:["clipboard","undo"]},"/",{name:"styles"}],removePlugins:"colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates"},show_node_editor_uri:!0,show_node_editor_title:!0,show_node_editor_title_richtext:!0,show_node_editor_description:!0,show_node_editor_description_richtext:!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",Polygon:"Polygone","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Save view":"Sauver la vue","View saved view":"Restaurer la Vue","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 ","Show hidden nodes":"Montrer les noeuds cachés","Show neighbors":"Montrer les voisins",Hide:"Cacher","Fullscreen not supported by your browser":"Le plein écran n'est pas supporté par votre navigateur"}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0})})},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})}})},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&&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){var c=new paper.Path.RegularPolygon([0,0],3,1);return c.scale(b),c.translate(a),c}},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.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.options.hide_nodes&&this.normal_buttons.push(new b.NodeHideButton(this.renderer,null),new b.NodeShowButton(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.view.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"),i=document.createElement("div");i.innerHTML=h;var j=i.textContent||i.innerText||"",k=j||this.renkan.translate(this.options.label_untitled_nodes)||"";k=f.shortenText(k,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(k).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(k);var l=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*l,opacity:g});var m=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),n=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=l,this.circle.strokeColor=m,this.circle.dashArray=n;var o=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(o)});var p=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==p&&(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=m;var q=this.renderer.toMinimapCoords(c),r=this.renderer.minimap.scale*d,s=new paper.Size([r,r]);this.minimap_circle.fitBounds(q.subtract(s),s.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var t=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===t.model||a.get("from")===t.model}),function(a){var b=t.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.view.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){clearTimeout(this.hide_timeout),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.renderer.removeRepresentationsOfType("editor"),this.hide()):this.hideNeighbors(!0),this._super("unselect")}},hide_delay:function(){var a=this;this.hide_timeout=setTimeout(function(){a.hide()},1e3)},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(!1)},show:function(a){var c=this;this.ghost=a,this.ghost?("undefined"!=typeof this.node_image&&(this.node_image.opacity=this.options.ghost_opacity),this.circle.opacity=this.options.ghost_opacity,this.title.css("opacity",this.options.ghost_opacity),this.minimap_circle.opacity=this.options.ghost_opacity):(this.minimap_circle.opacity=1,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(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"));d&&d.ghost&&(a?d.hide_delay():d.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.view.hiddenNodes.indexOf(d.model.id);-1!==e&&c.renderer.view.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.view.hiddenNodes.indexOf(this.model.id);-1!==c&&this.renderer.view.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,d=this._getStrokeWidth(),f=this._getArrowScale(),g=this.from_representation.paper_coords,h=this.to_representation.paper_coords,i=h.subtract(g),j=i.length,k=i.divide(j),l=new paper.Point([-k.y,k.x]),m=this.bundle.getPosition(this),n=l.multiply(this.options.edge_gap_in_bundles*m),o=g.add(n),p=h.add(n),q=i.angle,r=l.multiply(this.options.edge_label_distance+.5*f*this.options.edge_arrow_width),s=i.divide(3),t=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),u=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(c=.5,this.line.dashArray=[2,2]):(c=this.ghost?this.options.ghost_opacity:1,this.line.dashArray=null);var v=this.active_buttons;this.arrow.visible=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow,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=o.add(p).divide(2),this.line.strokeWidth=d,this.line.strokeColor=t,this.line.dashArray=u,this.line.opacity=c,this.line.segments[0].point=g,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=s.multiply(-1),this.line.segments[1].handleOut=s,this.line.segments[2].point=h,this.arrow.scale(f/this.arrow_scale),this.arrow_scale=f,this.arrow.fillColor=t,this.arrow.opacity=c,this.arrow.rotate(q-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=q,q>90&&(q-=180,r=r.multiply(-1)),-90>q&&(q+=180,r=r.multiply(-1));var w=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";w=e.shortenText(w,this.options.node_label_max_length),this.text.text(w);var x=this.paper_coords.add(r);this.text.css({left:x.x,top:x.y,transform:"rotate("+q+"deg)","-moz-transform":"rotate("+q+"deg)","-webkit-transform":"rotate("+q+"deg)",opacity:c}),this.text_angle=q;var y=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(y)}),this.renderer.minimap&&(this.minimap_line.strokeColor=t,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.hidden&&this.renderer.removeRepresentationsOfType("editor"),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=this.options.tooltip_opacity,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:this.options.tooltip_opacity}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder","ckeditor-jquery"],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.node_editor_templates},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[c.get("type")]||this.readOnlyTemplate["default"],h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{_id:c.get("_id"),has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),type:c.get("type")||"default",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(),types:b(this.options.node_editor_templates).keys().value()})),this.redraw();var j=this,k=j.options.show_node_editor_description_richtext?a(".Rk-Edit-Description").ckeditor(j.options.richtext_editor_config):!1,l=j.options.show_node_editor_title_richtext?a(".Rk-Edit-Title").ckeditor(j.options.richtext_editor_config):!1,m=function(){j.renderer.removeRepresentation(j),paper.view.draw()};if(j.cleanEditor=function(){if(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.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor){var a=k.editor;delete k.editor,a.focusManager.blur(!0),a.destroy()}if(j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor){var b=l.editor;delete l.editor,b.focusManager.blur(!0),b.destroy()}},this.editor_$.find(".Rk-CloseX").click(function(a){a.preventDefault(),m()}),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var n=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={};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&&(j.options.show_node_editor_description_richtext?"undefined"!=typeof k.editor&&k.editor.checkDirty()&&(a.description=k.editor.getData(),k.editor.resetDirty()):a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_title&&(j.options.show_node_editor_title_richtext?"undefined"!=typeof l.editor&&l.editor.checkDirty()&&(a.title=l.editor.getData(),l.editor.resetDirty()):a.title=j.editor_$.find(".Rk-Edit-Title").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()),j.options.change_types&&c.get("type")!==j.editor_$.find(".Rk-Edit-Type").val()&&(a.type=j.editor_$.find(".Rk-Edit-Type").val()),c.set(a),j.redraw()}else m()})},1e3);this.editor_$.on("keyup",function(a){27===a.keyCode&&m()}),this.editor_$.find("input, textarea, select").on("change keyup paste",n),j.options.show_node_editor_description&&j.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor&&(k.editor.on("change",n),k.editor.on("blur",n)),j.options.show_node_editor_title&&j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor&&(l.editor.on("change",n),l.editor.on("blur",n)),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),n()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var o=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),o.show()},function(a){a.preventDefault(),o.hide()}),o.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")})),o.hide(),paper.view.draw()):m()});var p=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 m()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return p(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return p(1),!1});var q=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 m()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return q(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return q(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),n(),!1})}else if("object"==typeof this.source_representation.highlighted){var r=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(r),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()},destroy:function(){"undefined"!=typeof this.cleanEditor&&this.cleanEditor(),this.editor_block.remove(),this.editor_$.remove()}}).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"),e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d,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=this.options.hide_nodes?-125:-135,this.endAngle=this.options.hide_nodes?-55:-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=this.options.hide_nodes?-10:0,this.endAngle=this.options.hide_nodes?45: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/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.view.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 neighbors"},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=this.options.hide_nodes?135:90,this.endAngle=this.options.hide_nodes?190: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=this.options.hide_nodes?-55:-45,this.endAngle=this.options.hide_nodes?-10: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=this.options.hide_nodes?-170:-180,this.endAngle=this.options.hide_nodes?-125:-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","screenfull"],function(a,b,c,d,e,f){var g=d.getUtils(),h=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.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=!1,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,h=!0,i=1,j=!1,k=0,l=0,m=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 n=b.throttle(function(a,b){d.onMouseMove(a,b)},g._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),n(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),h&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-m<g._DOUBLETAP_DELAY&&Math.pow(k-b.pageX,2)+Math.pow(l-b.pageY,2)<g._DOUBLETAP_DISTANCE?(m=0,d.onDoubleClick(b)):(m=new Date,k=b.pageX,l=b.pageY,i=d.view.scale,j=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),m=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(j||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,j=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*i,c=b/d.view.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.view.offset.multiply(c));d.view.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.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),h=!1},dragleave:function(a){a.preventDefault(),h=!0},drop:function(a){a.preventDefault(),h=!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(g){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 o=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};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()}),f.enabled?(o(".Rk-FullScreen-Button","fullScreen"),document.addEventListener(f.raw.fullscreenchange,function(){setTimeout(function(){var a=d.$.width(),b=d.$.height();d.renkan.options.show_top_bar&&(b-=d.$.find(".Rk-TopBar").height()),d.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(a-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([a,b]),d.resize(d.currentWidth,a,d.currentHeight,b),d.currentWidth=a,d.currentHeight=b,f.isFullscreen||(paper.view.onResize=function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)})},600)})):(this.$.find(".Rk-FullScreen-Button").addClass("disabled"),this.$.find(".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents").html(this.renkan.translate("Fullscreen not supported by your browser"))),o(".Rk-AddNode-Button","addNodeBtn"),o(".Rk-AddEdge-Button","addEdgeBtn"),o(".Rk-Save-Button","save"),o(".Rk-Open-Button","open"),o(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+g._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()}),o(".Rk-Fold-Bins","foldBins"),paper.view.on("resize",function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)});var p=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 q=b.throttle(function(){d.redrawUsers()},100);if(q(),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("loaded",function(){d.renkan.options.url_parameters?Backbone.history.start():d.fixSize(),d.redrawActive=!0,p()}),this.renkan.router.on("router",function(a){d.setViewparameters(a)}),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",q),this.renkan.project.on("add:views remove:views",function(){d.renkan.project.get("views").length>1?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")||p()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||p()}),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 r="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},r)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var s=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),t=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");s.hover(function(a){d.isEditable()&&(a.preventDefault(),t.show())},function(a){a.preventDefault(),t.hide()}),t.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 u="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==u)if(u=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var f=g.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){f.test(a.get("title"))||f.test(a.get("description"))?d.getRepresentationByModel(a).highlight(f):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(h.prototype).extend({fixSize:function(){"undefined"==typeof this.view&&(this.view=this.addRepresentation("View",this.renkan.project.get("views").last())),this.view.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()},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.view.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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&&"undefined"!=typeof this.view&&this.redrawMiniframe(),paper.view.draw())},resize:function(a,b,c,d){var e;this.minimap&&(this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle.fitBounds(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.cliprectangle.fitBounds(this.minimap.topleft,this.minimap.size));var f=d/c,g=b/a;e=b>d?f:g,this.view.resizeZoom(b-a,d-c,e),this.redraw()},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},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>g._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.view.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 f=paper.project.hitTest(e);if(f&&"undefined"!=typeof f.item.__representation)this.click_target=f.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===g._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}},j=this.renkan.project.addNode(i);this.getRepresentationByModel(j).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===g._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=g._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(),this.view.updateUrl();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.view.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.view.setScale(this.view.scale*Math.SQRT2,this.view.offset.subtract(d)):this.view.setScale(this.view.scale*Math.SQRT1_2,this.view.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),f={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(f);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 f="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:g.getUID("node"),created_by:this.renkan.current_user,uri:f.uri||"",title:f.title||"",description:f.description||"",image:f.image||"",color:f.color||void 0,clip_path:f.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(){this.currentWidth=this.$.width(),this.currentHeight=this.$.height();var a=this.renkan.$[0];paper.view.off("resize"),f.toggle(a)},addNodeBtn:function(){return this.click_mode===g._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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===g._CLICKMODE_STARTEDGE||this.click_mode===g._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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 f,h,i={};b.each(a.nodes,function(a){f=a.id||a._id,delete a._id,delete a.id,i[f]=a["@id"]=g.getUUID4()}),b.each(a.edges,function(a){delete a._id,delete a.id,a.to=i[a.to],a.from=i[a.from]}),b.each(a.views,function(a){delete a._id,delete a.id,a.hidden_nodes&&(h=a.hidden_nodes,a.hidden_nodes=[],b.each(h,function(b){a.hidden_nodes.push(i[b])}))}),a.users=[];var j=JSON.stringify(a,null,2),k=new Blob([j],{type:"application/json;charset=utf-8"});c(k,e)},setViewparameters:function(b){if(this.removeRepresentationsOfType("View"),a.isEmptyObject(b))return void(this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))));if(this.view="undefined"!=typeof b.viewIndex?this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(b.viewIndex))):this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))),"undefined"!=typeof b.view&&b.view.split(",").length>=3){var c=b.view.split(","),d={project:this.renkan.project,offset:{x:parseFloat(c[0]),y:parseFloat(c[1])},zoom_level:parseFloat(c[2])};this.view.setScale(d.zoom_level,new paper.Point(d.offset))}"undefined"!=typeof b.view&&"autoscale"===b.view&&this.view.autoScale(),"undefined"!=typeof b.viewsNodes&&("true"===b.viewsNodes?(this.view.hiddenNodes=(this.view.params.hidden_nodes||[]).concat(),this.view.hideNodes()):this.view.showNodes(!1)),this.unhighlightAll(),"undefined"!=typeof b.idNode&&this.highlightModel(this.renkan.project.get("nodes").get(b.idNode))},validViewIndex:function(a){var b=parseInt(a),c=0;return c=0>b?this.renkan.project.get("views").length+b:b,"undefined"==typeof this.renkan.project.get("views").at(b)&&(c=0),c},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=0,e=this,f=e.canvas_$.width();c.position().left<0?(d=new paper.Point([-c.width()/2,0]),c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f-c.width()<c.height()?f:f-c.width(),b.html("«")):(d=new paper.Point([c.width()/2,0]),c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f+300,b.html("»")),this.view.paperShift(d)},save:function(){},open:function(){}}).value(),h}),define("renderer/viewrepr",["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(){var b=this;this.$=a(".Rk-Render"),this.type="View",this.hiddenNodes=[],this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.params={},this.model&&(this.params={zoom_level:b.model.get("zoom_level"),offset:b.model.get("offset"),hidden_nodes:b.model.get("hidden_nodes")}),this.initWithParams();var c=function(a,c){b.$.find(a).click(function(a){return b[c](a),!1})};c(".Rk-ZoomOut","zoomOut"),c(".Rk-ZoomIn","zoomIn"),c(".Rk-ZoomFit","autoScale"),c(".Rk-ZoomSave","saveView"),this.$.find(".Rk-ZoomSetSaved").click(function(){b.setScale(b.params.zoom_level,new paper.Point(b.params.offset)),b.showNodes(!1),b.options.hide_nodes&&(b.hiddenNodes=(b.params.hidden_nodes||[]).concat(),b.hideNodes()),b.updateUrl()}),this.$.find(".Rk-ShowHiddenNodes").mouseenter(function(){b.showNodes(!0),b.$.find(".Rk-ShowHiddenNodes").mouseleave(function(){b.hideNodes()})}),this.$.find(".Rk-ShowHiddenNodes").click(function(){b.showNodes(!1),b.$.find(".Rk-ShowHiddenNodes").off("mouseleave")}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show()},redraw:function(){},initWithParams:function(){var a=this;a.options.view_force_autoscale?this.autoScale():a.setScale(a.params.zoom_level,new paper.Point(a.params.offset)),a.options.hide_nodes&&!a.options.view_show_hiddennodes?(a.hiddenNodes=(a.params.hidden_nodes||[]).concat(),a.hideNodes()):a.showNodes(!1)},saveView:function(){var a=this,b={x:a.offset.x,y:a.offset.y};a.model=a.renkan.project.addView({zoom_level:a.scale,offset:b,hidden_nodes:a.hiddenNodes.concat()}),a.params={zoom_level:a.model.get("zoom_level"),offset:a.model.get("offset"),hidden_nodes:a.model.get("hidden_nodes")},this.$.find(".Rk-ZoomSetSaved").show(),a.updateUrl()},addHiddenNode:function(a){this.hideNode(a),this.hiddenNodes.push(a.id),this.updateUrl()},hideNode:function(a){"undefined"!=typeof this.renderer.getRepresentationByModel(a)&&this.renderer.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.renderer.getRepresentationByModel(b.renkan.project.get("nodes").get(c)).show(a)}),a||(this.hiddenNodes=[]),paper.view.draw()},setScale:function(a,b){a/this.initialScale>e._MIN_SCALE&&a/this.initialScale<e._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.renderer.redraw(),this.updateUrl())},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.renderer.canvas_$.width(),this.renderer.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.renderer.canvas_$.width(),this.renderer.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([.5*this.renderer.canvas_$.width()*(1-c)+(this.offset.x*c+a*c*.5),.5*this.renderer.canvas_$.height()*(1-c)+(this.offset.y*c+b*c*.5)]);this.setScale(d,e)},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])))},paperShift:function(a){this.offset=this.offset.add(a),this.renderer.redraw()},updateUrl:function(){if(this.options.url_parameters&&this.options.update_url){var b={},c=Backbone.history.getFragment().split("?");c.length>1&&c[1].split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),b.view=Math.round(1e3*this.offset.x)/1e3+","+Math.round(1e3*this.offset.y)/1e3+","+Math.round(1e3*this.scale)/1e3,this.renkan.project.get("views").indexOf(this.model)>-1?(b.viewIndex=this.renkan.project.get("views").indexOf(this.model),b.viewIndex===this.renkan.project.get("views").length-1&&(b.viewIndex=-1)):b.viewIndex&&delete b.viewIndex,this.renkan.router.navigate("?"+decodeURIComponent(a.param(b)),{trigger:!1,replace:!0})}},destroy:function(){this._super("destroy"),this.showNodes(!1)}}).value(),f}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils","ckeditor-core":"../lib/ckeditor/ckeditor","ckeditor-jquery":"../lib/ckeditor/adapters/jquery",screenfull:"../lib/screenfull/screenfull-umd"},shim:{"ckeditor-jquery":{deps:["jquery","ckeditor-core"]}}}),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","renderer/viewrepr"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w){var x=window.Rkns;"undefined"==typeof x.Renderer&&(x.Renderer={});var y=x.Renderer;y._BaseRepresentation=a,y._BaseButton=b,y.Node=c,y.Edge=d,y.View=w,y.TempEdge=e,y._BaseEditor=f,y.NodeEditor=g,y.EdgeEditor=h,y._NodeButton=i,y.NodeEditButton=j,y.NodeRemoveButton=k,y.NodeHideButton=l,y.NodeShowButton=m,y.NodeRevertButton=n,y.NodeLinkButton=o,y.NodeEnlargeButton=p,y.NodeShrinkButton=q,y.EdgeEditButton=r,y.EdgeRemoveButton=s,y.EdgeRevertButton=t,y.MiniFrame=u,y.Scene=v,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 __t,__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>"+(null==(__t=edge.description)?"":__t)+"</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 ",__p+=options.show_node_editor_title_richtext?'\n <div class="Rk-Edit-Title" contenteditable="true">'+(null==(__t=node.title)?"":__t)+"</div>\n ":'\n <input class="Rk-Edit-Title" type="text" value="'+__e(node.title)+'" />\n ',__p+=" \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.change_types&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Types available"))+':</label>\n <select class="Rk-Edit-Type">\n ',_.each(types,function(a){__p+='\n <option class="Rk-Edit-Vocabulary-Property" value="'+__e(a)+'"',node.type===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+=" ",options.show_node_editor_description&&(__p+="\n <p>\n <label>"+__e(renkan.translate("Description:"))+"</label>\n ",__p+=options.show_node_editor_description_richtext?'\n <div class="Rk-Edit-Description" contenteditable="true">'+(null==(__t=node.description)?"":__t)+"</div>\n ":'\n <textarea class="Rk-Edit-Description">'+(null==(__t=node.description)?"":__t)+"</textarea>\n ",__p+="\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 __t,__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 "+(null==(__t=node.title)?"":__t)+"\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">'+(null==(__t=node.description)?"":__t)+"</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 <a href="#?idNode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\n";return __p},this.renkanJST["templates/nodeeditor_video.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 <video width="320" height="240" controls>\n <source src="'+__e(node.uri)+'" type="video/mp4">\n </video> \n'),__p+='\n <a href="#?idnode='+__e(node._id)+'">'+__e(renkan.translate("Link to the node"))+"</a>\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("Save view"))+'"></div>\n '),__p+="\n ",options.save_view&&(__p+='\n <div class="Rk-ZoomSetSaved" title="'+__e(translate("View saved view"))+'"></div>\n ',options.hide_nodes&&(__p+='\n <div class="Rk-ShowHiddenNodes" title="'+__e(translate("Show hidden nodes"))+'"></div>\n '),__p+=" \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;b.__renkans.push(this),this.options=d.defaults(a,b.defaults,{templates:d.defaults(a.templates,renkanJST)||renkanJST,node_editor_templates:d.defaults(a.node_editor_templates,b.defaults.node_editor_templates)}),this.template=renkanJST["templates/main.html"];var f={};if(d.each(this.options.node_editor_templates,function(a,b){f[b]=e.options.templates[a],delete e.options.templates[a]}),this.options.node_editor_templates=f,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.router=new b.Router,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 g=renkanJST["templates/search.html"],h=this.$.find(".Rk-Search-List"),i=this.$.find(".Rk-Web-Search-Input"),j=this.$.find(".Rk-Web-Search-Form");d.each(this.options.search,function(a,c){b[a.type]&&b[a.type].Search&&e.search_engines.push(new b[a.type].Search(e,a))}),h.html(d(this.search_engines).map(function(a,b){return g({key:b,title:a.getSearchTitle(),className:a.getBgClass()})}).join("")),h.find("li").click(function(){var a=b.$(this);e.setSearchEngine(a.attr("data-key")),j.submit()}),j.submit(function(){if(i.val()){var a=e.search_engine;a.search(i.val())}return!1}),this.$.find(".Rk-Search-Current").mouseenter(function(){h.slideDown()}),this.$.find(".Rk-Search-Select").mouseleave(function(){h.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 k=!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(a){
+var f=b.$(this);if(f&&c(f).attr("data-uri")){var g=e.project.get("nodes").where({uri:c(f).attr("data-uri")});d.each(g,function(a){e.renderer.highlightModel(a)})}}).mouseout(function(){e.renderer.unhighlightAll()}).on("mousemove",".Rk-Bin-Item",function(a){try{this.dragDrop()}catch(b){}}).on("touchstart",".Rk-Bin-Item",function(a){k=!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(k)e.renderer.onMouseMove(b,!0);else{k=!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){k&&e.renderer.onMouseUp(a.originalEvent.changedTouches[0],!0),k=!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 l=!1,m="";this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input",function(){var a=b.$(this).val();if(a!==m){var c=b.Utils.regexpFromTextOrArray(a.length>1?a:null);c.source!==l&&(l=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(c){"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(a){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.fillColor=new paper.Color(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.Backbone;a.Rkns.Router=b.Router.extend({routes:{"":"index"},index:function(a){var b={};null!==a&&a.split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),this.trigger("router",b)}})}(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?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.color?e.style={color:e.color}:e.style={}}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]&&(a=this.dataConverters[d](a))}return a},b.Loader.prototype.load=function(a){this.project.set(this.convert(a),{validate:!0}),this.project.trigger("loaded",!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);"undefined"==typeof f&&"undefined"!=typeof e?a[b]=e:a[b]=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:!1,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,view_force_autoscale:!0,view_show_hiddennodes:!0,default_index_view:-1,url_parameters:!0,update_url:!0,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,ghost_opacity:.3,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)",hide_nodes:!0,change_shapes:!0,change_types:!0,node_editor_templates:{"default":"templates/nodeeditor_readonly.html",video:"templates/nodeeditor_video.html"},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,tooltip_opacity:.8,richtext_editor_config:{toolbarGroups:[{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"clipboard",groups:["clipboard","undo"]},"/",{name:"styles"}],removePlugins:"colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates"},show_node_editor_uri:!0,show_node_editor_title:!0,show_node_editor_title_richtext:!0,show_node_editor_description:!0,show_node_editor_description_richtext:!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",Polygon:"Polygone","Zoom Fit":"Ajuster le Zoom","Download Project":"Télécharger le projet","Save view":"Sauver la vue","View saved view":"Restaurer la Vue","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 ","Show hidden nodes":"Montrer les noeuds cachés","Show neighbors":"Montrer les voisins",Hide:"Cacher","Fullscreen not supported by your browser":"Le plein écran n'est pas supporté par votre navigateur"}},Rkns.jsonIO=function(a,b){var c=a.project;"undefined"==typeof b.http_method&&(b.http_method="PUT");var d=function(){c.set({loadingStatus:!0}),Rkns.$.getJSON(b.url,function(b){a.dataloader.load(b),c.set({loadingStatus:!1}),c.set({saveStatus:0})})},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(a,b,d){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(a){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})}})},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(a,b,f){$(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){"use strict";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(a,b){"use strict";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){"use strict";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&&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(){"use strict";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){var c=new paper.Path.RegularPolygon([0,0],3,1);return c.scale(b),c.translate(a),c}},svg:function(a){return{getShape:function(){return new paper.Path(a)},getImageShape:function(a,b){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){"use strict";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.NodeLinkButton(this.renderer,null),new b.NodeEnlargeButton(this.renderer,null),new b.NodeShrinkButton(this.renderer,null)],this.options.hide_nodes&&this.normal_buttons.push(new b.NodeHideButton(this.renderer,null),new b.NodeShowButton(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.view.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"),i=document.createElement("div");i.innerHTML=h;var j=i.textContent||i.innerText||"",k=j||this.renkan.translate(this.options.label_untitled_nodes)||"";k=f.shortenText(k,this.options.node_label_max_length),"object"==typeof this.highlighted?this.title.html(this.highlighted.replace(b(k).escape(),'<span class="Rk-Highlighted">$1</span>')):this.title.text(k);var l=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*l,opacity:g});var m=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||f._USER_PLACEHOLDER(this.renkan)).get("color"),n=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.circle.strokeWidth=l,this.circle.strokeColor=m,this.circle.dashArray=n;var o=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(o)});var p=this.img;if(this.img=this.model.get("image"),this.img&&this.img!==p&&(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=m;var q=this.renderer.toMinimapCoords(c),r=this.renderer.minimap.scale*d,s=new paper.Size([r,r]);this.minimap_circle.fitBounds(q.subtract(s),s.multiply(2))}if(!("undefined"!=typeof a&&"dontRedrawEdges"in a&&a.dontRedrawEdges)){var t=this;b.each(this.project.get("edges").filter(function(a){return a.get("to")===t.model||a.get("from")===t.model}),function(a,b,c){var d=t.renderer.getRepresentationByModel(a);d&&"undefined"!=typeof d.from_representation&&"undefined"!=typeof d.from_representation.paper_coords&&"undefined"!=typeof d.to_representation&&"undefined"!=typeof d.to_representation.paper_coords&&d.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.view.paperShift(a)},openEditor:function(){this.renderer.removeRepresentationsOfType("editor");var a=this.renderer.addRepresentation("NodeEditor",null);a.source_representation=this,a.draw()},select:function(){clearTimeout(this.hide_timeout),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.renderer.removeRepresentationsOfType("editor"),this.hide()):this.hideNeighbors(!0),this._super("unselect")}},hide_delay:function(){var a=this;this.hide_timeout=setTimeout(function(){a.hide()},1e3)},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,c,d){var e=a.renderer.getRepresentationByModel(b);e&&"undefined"!=typeof e.from_representation&&"undefined"!=typeof e.from_representation.paper_coords&&"undefined"!=typeof e.to_representation&&"undefined"!=typeof e.to_representation.paper_coords&&e.hide()}),this.hideNeighbors(!1)},show:function(a){var c=this;this.ghost=a,this.ghost?("undefined"!=typeof this.node_image&&(this.node_image.opacity=this.options.ghost_opacity),this.circle.opacity=this.options.ghost_opacity,this.title.css("opacity",this.options.ghost_opacity),this.minimap_circle.opacity=this.options.ghost_opacity):(this.minimap_circle.opacity=1,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,b,d){var e=c.renderer.getRepresentationByModel(a);e&&"undefined"!=typeof e.from_representation&&"undefined"!=typeof e.from_representation.paper_coords&&"undefined"!=typeof e.to_representation&&"undefined"!=typeof e.to_representation.paper_coords&&e.show(c.ghost)})},hideNeighbors:function(a){var c=this;b.each(this.project.get("edges").filter(function(a){return a.get("from")===c.model}),function(b,d,e){var f=c.renderer.getRepresentationByModel(b.get("to"));f&&f.ghost&&(a?f.hide_delay():f.hide())})},showNeighbors:function(a){var c=this;b.each(this.project.get("edges").filter(function(a){return a.get("from")===c.model}),function(b,d,e){var f=c.renderer.getRepresentationByModel(b.get("to"));if(f&&f.hidden&&(f.show(a),!a)){var g=c.renderer.view.hiddenNodes.indexOf(f.model.id);-1!==g&&c.renderer.view.hiddenNodes.splice(g,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.view.hiddenNodes.indexOf(this.model.id);-1!==c&&this.renderer.view.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(a){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){"use strict";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,d=this._getStrokeWidth(),f=this._getArrowScale(),g=this.from_representation.paper_coords,h=this.to_representation.paper_coords,i=h.subtract(g),j=i.length,k=i.divide(j),l=new paper.Point([-k.y,k.x]),m=this.bundle.getPosition(this),n=l.multiply(this.options.edge_gap_in_bundles*m),o=g.add(n),p=h.add(n),q=i.angle,r=l.multiply(this.options.edge_label_distance+.5*f*this.options.edge_arrow_width),s=i.divide(3),t=this.model.has("style")&&this.model.get("style").color||(this.model.get("created_by")||e._USER_PLACEHOLDER(this.renkan)).get("color"),u=this.model.has("style")&&this.model.get("style").dash?this.options.default_dash_array:null;this.model.get("delete_scheduled")||this.from_representation.model.get("delete_scheduled")||this.to_representation.model.get("delete_scheduled")?(c=.5,this.line.dashArray=[2,2]):(c=this.ghost?this.options.ghost_opacity:1,this.line.dashArray=null);var v=this.active_buttons;this.arrow.visible=this.model.has("style")&&this.model.get("style").arrow||!this.model.has("style")||"undefined"==typeof this.model.get("style").arrow,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=o.add(p).divide(2),this.line.strokeWidth=d,this.line.strokeColor=t,this.line.dashArray=u,this.line.opacity=c,this.line.segments[0].point=g,this.line.segments[1].point=this.paper_coords,this.line.segments[1].handleIn=s.multiply(-1),this.line.segments[1].handleOut=s,this.line.segments[2].point=h,this.arrow.scale(f/this.arrow_scale),this.arrow_scale=f,this.arrow.fillColor=t,this.arrow.opacity=c,this.arrow.rotate(q-this.arrow_angle,this.arrow.bounds.center),this.arrow.position=this.paper_coords,this.arrow_angle=q,q>90&&(q-=180,r=r.multiply(-1)),-90>q&&(q+=180,r=r.multiply(-1));var w=this.model.get("title")||this.renkan.translate(this.options.label_untitled_edges)||"";w=e.shortenText(w,this.options.node_label_max_length),this.text.text(w);var x=this.paper_coords.add(r);this.text.css({left:x.x,top:x.y,transform:"rotate("+q+"deg)","-moz-transform":"rotate("+q+"deg)","-webkit-transform":"rotate("+q+"deg)",opacity:c}),this.text_angle=q;var y=this.paper_coords;this.all_buttons.forEach(function(a){a.moveTo(y)}),this.renderer.minimap&&(this.minimap_line.strokeColor=t,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.hidden&&this.renderer.removeRepresentationsOfType("editor"),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){"use strict";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,b){var c=paper.project.hitTest(a.point),d=this.from_representation.model,f=!0;if(c&&"undefined"!=typeof c.item.__representation){var g=c.item.__representation;if("Node"===g.type.substr(0,4)){var h=g.model||g.source_representation.model;if(d!==h){var i={id:e.getUID("edge"),created_by:this.renkan.current_user,from:d,to:h};this.renderer.isEditable()&&this.project.addEdge(i)}}(d===g.model||g.source_representation&&g.source_representation.model===d)&&(f=!1,this.renderer.is_dragging=!0)}f&&(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){"use strict";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=this.options.tooltip_opacity,this.editor_$=a("<div>").appendTo(this.renderer.editor_$).css({position:"absolute",opacity:this.options.tooltip_opacity}).hide()},destroy:function(){this.editor_block.remove(),this.editor_$.remove()}}).value(),f}),define("renderer/nodeeditor",["jquery","underscore","requtils","renderer/baseeditor","renderer/shapebuilder","ckeditor-jquery"],function(a,b,c,d,e){"use strict";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.node_editor_templates},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[c.get("type")]||this.readOnlyTemplate["default"],h=this.options.static_url+"img/image-placeholder.png",i=c.get("size")||0;this.editor_$.html(g({node:{_id:c.get("_id"),has_creator:!!c.get("created_by"),title:c.get("title"),uri:c.get("uri"),type:c.get("type")||"default",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(),types:b(this.options.node_editor_templates).keys().value()})),this.redraw();var j=this,k=j.options.show_node_editor_description_richtext?a(".Rk-Edit-Description").ckeditor(j.options.richtext_editor_config):!1,l=j.options.show_node_editor_title_richtext?a(".Rk-Edit-Title").ckeditor(j.options.richtext_editor_config):!1,m=function(){j.renderer.removeRepresentation(j),paper.view.draw()};if(j.cleanEditor=function(){if(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.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor){var a=k.editor;delete k.editor,a.focusManager.blur(!0),a.destroy()}if(j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor){var b=l.editor;delete l.editor,b.focusManager.blur(!0),b.destroy()}},this.editor_$.find(".Rk-CloseX").click(function(a){a.preventDefault(),m()}),this.editor_$.find(".Rk-Edit-Goto").click(function(){return c.get("uri")?void 0:!1}),this.renderer.isEditable()){var n=b.throttle(function(){b.defer(function(){if(j.renderer.isEditable()){var a={};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&&(j.options.show_node_editor_description_richtext?"undefined"!=typeof k.editor&&k.editor.checkDirty()&&(a.description=k.editor.getData(),k.editor.resetDirty()):a.description=j.editor_$.find(".Rk-Edit-Description").val()),j.options.show_node_editor_title&&(j.options.show_node_editor_title_richtext?"undefined"!=typeof l.editor&&l.editor.checkDirty()&&(a.title=l.editor.getData(),l.editor.resetDirty()):a.title=j.editor_$.find(".Rk-Edit-Title").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()),j.options.change_types&&c.get("type")!==j.editor_$.find(".Rk-Edit-Type").val()&&(a.type=j.editor_$.find(".Rk-Edit-Type").val()),c.set(a),j.redraw()}else m()})},1e3);this.editor_$.on("keyup",function(a){
+27===a.keyCode&&m()}),this.editor_$.find("input, textarea, select").on("change keyup paste",n),j.options.show_node_editor_description&&j.options.show_node_editor_description_richtext&&"undefined"!=typeof k.editor&&(k.editor.on("change",n),k.editor.on("blur",n)),j.options.show_node_editor_title&&j.options.show_node_editor_title_richtext&&"undefined"!=typeof l.editor&&(l.editor.on("change",n),l.editor.on("blur",n)),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),n()},b.readAsDataURL(a)}}),this.editor_$.find(".Rk-Edit-Title")[0].focus();var o=j.editor_$.find(".Rk-Edit-ColorPicker");this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(function(a){a.preventDefault(),o.show()},function(a){a.preventDefault(),o.hide()}),o.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")})),o.hide(),paper.view.draw()):m()});var p=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 m()};this.editor_$.find("#Rk-Edit-Size-Down").click(function(){return p(-1),!1}),this.editor_$.find("#Rk-Edit-Size-Up").click(function(){return p(1),!1});var q=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 m()};this.editor_$.find("#Rk-Edit-Thickness-Down").click(function(){return q(-1),!1}),this.editor_$.find("#Rk-Edit-Thickness-Up").click(function(){return q(1),!1}),this.editor_$.find(".Rk-Edit-Image-Del").click(function(){return j.editor_$.find(".Rk-Edit-Image").val(""),n(),!1})}else if("object"==typeof this.source_representation.highlighted){var r=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(r),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()},destroy:function(){"undefined"!=typeof this.cleanEditor&&this.cleanEditor(),this.editor_block.remove(),this.editor_$.remove()}}).value(),g}),define("renderer/edgeeditor",["jquery","underscore","requtils","renderer/baseeditor"],function(a,b,c,d){"use strict";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"),e=i.editor_$.find(".Rk-Edit-Arrow").is(":checked");a.style=b.assign(c.has("style")&&b.clone(c.get("style"))||{},{dash:d,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){"use strict";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){"use strict";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=this.options.hide_nodes?-125:-135,this.endAngle=this.options.hide_nodes?-55:-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){"use strict";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=this.options.hide_nodes?-10:0,this.endAngle=this.options.hide_nodes?45: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/nodehidebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){"use strict";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.view.addHiddenNode(this.source_representation.model)}}).value(),f}),define("renderer/nodeshowbutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){"use strict";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 neighbors"},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){"use strict";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){"use strict";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=this.options.hide_nodes?135:90,this.endAngle=this.options.hide_nodes?190:180,this.imageName="link",this.text="Link to another node"},mousedown:function(a,b){if(this.renderer.isEditable()){var c=this.renderer.canvas_$.offset(),d=new paper.Point([a.pageX-c.left,a.pageY-c.top]);this.renderer.click_target=null,this.renderer.removeRepresentationsOfType("editor"),this.renderer.addTempEdge(this.source_representation,d)}}}).value(),f}),define("renderer/nodeenlargebutton",["jquery","underscore","requtils","renderer/nodebutton"],function(a,b,c,d){"use strict";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=this.options.hide_nodes?-55:-45,this.endAngle=this.options.hide_nodes?-10: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){"use strict";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=this.options.hide_nodes?-170:-180,this.endAngle=this.options.hide_nodes?-125:-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){"use strict";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){"use strict";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){"use strict";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){"use strict";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(a){this.renderer.click_target=null,this.renderer.is_dragging=!1}}).value(),f}),define("renderer/scene",["jquery","underscore","filesaver","requtils","renderer/miniframe","screenfull"],function(a,b,c,d,e,f){"use strict";var g=d.getUtils(),h=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"),c.options.popup_editor?this.editor_$=this.$.find(".Rk-Editor"):this.editor_$=a("#"+c.options.editor_panel),this.notif_$=this.$.find(".Rk-Notifications"),paper.setup(this.canvas_$[0]),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=!1,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,h=!0,i=1,j=!1,k=0,l=0,m=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 n=b.throttle(function(a,b){d.onMouseMove(a,b)},g._MOUSEMOVE_RATE);this.canvas_$.on({mousedown:function(a){a.preventDefault(),d.onMouseDown(a,!1)},mousemove:function(a){a.preventDefault(),n(a,!1)},mouseup:function(a){a.preventDefault(),d.onMouseUp(a,!1)},mousewheel:function(a,b){c.options.zoom_on_scroll&&(a.preventDefault(),h&&d.onScroll(a,b))},touchstart:function(a){a.preventDefault();var b=a.originalEvent.touches[0];c.options.allow_double_click&&new Date-m<g._DOUBLETAP_DELAY&&Math.pow(k-b.pageX,2)+Math.pow(l-b.pageY,2)<g._DOUBLETAP_DISTANCE?(m=0,d.onDoubleClick(b)):(m=new Date,k=b.pageX,l=b.pageY,i=d.view.scale,j=!1,d.onMouseDown(b,!0))},touchmove:function(a){if(a.preventDefault(),m=0,1===a.originalEvent.touches.length)d.onMouseMove(a.originalEvent.touches[0],!0);else{if(j||(d.onMouseUp(a.originalEvent.touches[0],!0),d.click_target=null,d.is_dragging=!1,j=!0),"undefined"===a.originalEvent.scale)return;var b=a.originalEvent.scale*i,c=b/d.view.scale,e=new paper.Point([d.canvas_$.width(),d.canvas_$.height()]).multiply(.5*(1-c)).add(d.view.offset.multiply(c));d.view.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.click_target=null,d.is_dragging=!1},dragover:function(a){a.preventDefault()},dragenter:function(a){a.preventDefault(),h=!1},dragleave:function(a){a.preventDefault(),h=!0},drop:function(a){a.preventDefault(),h=!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(g){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 o=function(a,b){d.$.find(a).click(function(a){return d[b](a),!1})};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()}),f.enabled?(o(".Rk-FullScreen-Button","fullScreen"),document.addEventListener(f.raw.fullscreenchange,function(){setTimeout(function(){var a=d.$.width(),b=d.$.height();d.renkan.options.show_top_bar&&(b-=d.$.find(".Rk-TopBar").height()),d.renkan.options.show_bins&&this.renkan.$.find(".Rk-Bins").position().left>0&&(a-=this.renkan.$.find(".Rk-Bins").width()),paper.view.viewSize=new paper.Size([a,b]),d.resize(d.currentWidth,a,d.currentHeight,b),d.currentWidth=a,d.currentHeight=b,f.isFullscreen||(paper.view.onResize=function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)})},600)})):(this.$.find(".Rk-FullScreen-Button").addClass("disabled"),this.$.find(".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents").html(this.renkan.translate("Fullscreen not supported by your browser"))),o(".Rk-AddNode-Button","addNodeBtn"),o(".Rk-AddEdge-Button","addEdgeBtn"),o(".Rk-Save-Button","save"),o(".Rk-Open-Button","open"),o(".Rk-Export-Button","exportProject"),this.$.find(".Rk-Bookmarklet-Button").attr("href","javascript:"+g._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()}),o(".Rk-Fold-Bins","foldBins"),paper.view.on("resize",function(a){var b=a.size._width,c=a.size._height,e=c-a.delta.height,f=b-a.delta.width;d.resize(f,b,e,c)});var p=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 q=b.throttle(function(){d.redrawUsers()},100);if(q(),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("loaded",function(){d.renkan.options.url_parameters?Backbone.history.start():d.fixSize(),d.redrawActive=!0,p()}),this.renkan.router.on("router",function(a){d.setViewparameters(a)}),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",q),this.renkan.project.on("add:views remove:views",function(a){d.renkan.project.get("views").length>1?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")||p()}),this.renkan.project.on("add:edges",function(a){d.addRepresentation("Edge",a),d.renkan.project.get("loadingStatus")||p()}),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 r="number"==typeof c.options.size_bug_fix?c.options.size_bug_fix:500;window.setTimeout(function(){d.fixSize()},r)}if(c.options.force_resize&&a(window).resize(function(){d.autoScale()}),c.options.show_user_list&&c.options.user_color_editable){var s=this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),t=this.$.find(".Rk-Users .Rk-Edit-ColorPicker");s.hover(function(a){d.isEditable()&&(a.preventDefault(),t.show())},function(a){a.preventDefault(),t.hide()}),t.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 u="";this.$.find(".Rk-GraphSearch-Field").on("keyup change paste input",function(){var b=a(this),e=b.val();if(e!==u)if(u=e,e.length<2)c.project.get("nodes").each(function(a){d.getRepresentationByModel(a).unhighlight()});else{var f=g.regexpFromTextOrArray(e);c.project.get("nodes").each(function(a){f.test(a.get("title"))||f.test(a.get("description"))?d.getRepresentationByModel(a).highlight(f):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(h.prototype).extend({fixSize:function(){"undefined"==typeof this.view&&(this.view=this.addRepresentation("View",this.renkan.project.get("views").last())),this.view.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},H>2?K.paragraphStyle.justification="left":-2>H?K.paragraphStyle.justification="right":K.paragraphStyle.justification="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()},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.view.scale*this.renkan.options.minimap_width/paper.view.bounds.width,.8*this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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(a){b.each(this.representations,function(a){a.unhighlight()})},unselectAll:function(a){b.each(this.representations,function(a){a.unselect()})},redraw:function(){this.redrawActive&&(b.each(this.representations,function(a){a.redraw({dontRedrawEdges:!0})}),this.minimap&&"undefined"!=typeof this.view&&this.redrawMiniframe(),paper.view.draw())},resize:function(a,b,c,d){var e;this.minimap&&(this.minimap.topleft=paper.view.bounds.bottomRight.subtract(this.minimap.size),this.minimap.rectangle.fitBounds(this.minimap.topleft.subtract([2,2]),this.minimap.size.add([4,4])),this.minimap.cliprectangle.fitBounds(this.minimap.topleft,this.minimap.size));var f=d/c,g=b/a;e=b>d?f:g,this.view.resizeZoom(b-a,d-c,e),this.redraw()},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},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>g._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.view.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 f=paper.project.hitTest(e);if(f&&"undefined"!=typeof f.item.__representation)this.click_target=f.item.__representation,this.click_target.mousedown(b,c);else if(this.click_target=null,this.isEditable()&&this.click_mode===g._CLICKMODE_ADDNODE){var h=this.toModelCoords(e),i={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:h.x,y:h.y}},j=this.renkan.project.addNode(i);this.getRepresentationByModel(j).openEditor()}}this.click_mode&&(this.isEditable()&&this.click_mode===g._CLICKMODE_STARTEDGE&&this.click_target&&"Node"===this.click_target.type?(this.removeRepresentationsOfType("editor"),this.addTempEdge(this.click_target,e),this.click_mode=g._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(),this.view.updateUrl();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.view.offset).multiply(Math.SQRT2-1);this.totalScroll>0?this.view.setScale(this.view.scale*Math.SQRT2,this.view.offset.subtract(d)):this.view.setScale(this.view.scale*Math.SQRT1_2,this.view.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),f={id:g.getUID("node"),created_by:this.renkan.current_user,position:{x:e.x,y:e.y}},h=this.renkan.project.addNode(f);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 f="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:g.getUID("node"),created_by:this.renkan.current_user,uri:f.uri||"",title:f.title||"",description:f.description||"",image:f.image||"",color:f.color||void 0,clip_path:f.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(){this.currentWidth=this.$.width(),this.currentHeight=this.$.height();var a=this.renkan.$[0];paper.view.off("resize"),f.toggle(a)},addNodeBtn:function(){return this.click_mode===g._CLICKMODE_ADDNODE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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===g._CLICKMODE_STARTEDGE||this.click_mode===g._CLICKMODE_ENDEDGE?(this.click_mode=!1,this.notif_$.hide()):(this.click_mode=g._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 f,h,i={};b.each(a.nodes,function(a,b,c){f=a.id||a._id,delete a._id,delete a.id,i[f]=a["@id"]=g.getUUID4()}),b.each(a.edges,function(a,b,c){delete a._id,delete a.id,a.to=i[a.to],a.from=i[a.from]}),b.each(a.views,function(a,c,d){delete a._id,delete a.id,a.hidden_nodes&&(h=a.hidden_nodes,a.hidden_nodes=[],b.each(h,function(b,c){a.hidden_nodes.push(i[b])}))}),a.users=[];var j=JSON.stringify(a,null,2),k=new Blob([j],{type:"application/json;charset=utf-8"});c(k,e)},setViewparameters:function(b){if(this.removeRepresentationsOfType("View"),a.isEmptyObject(b))return void(this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))));if("undefined"!=typeof b.viewIndex?this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(b.viewIndex))):this.view=this.addRepresentation("View",this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view))),"undefined"!=typeof b.view&&b.view.split(",").length>=3){var c=b.view.split(","),d={project:this.renkan.project,offset:{x:parseFloat(c[0]),y:parseFloat(c[1])},zoom_level:parseFloat(c[2])};this.view.setScale(d.zoom_level,new paper.Point(d.offset))}"undefined"!=typeof b.view&&"autoscale"===b.view&&this.view.autoScale(),"undefined"!=typeof b.viewsNodes&&("true"===b.viewsNodes?(this.view.hiddenNodes=(this.view.params.hidden_nodes||[]).concat(),this.view.hideNodes()):this.view.showNodes(!1)),this.unhighlightAll(),"undefined"!=typeof b.idNode&&this.highlightModel(this.renkan.project.get("nodes").get(b.idNode))},validViewIndex:function(a){var b=parseInt(a),c=0;return c=0>b?this.renkan.project.get("views").length+b:b,"undefined"==typeof this.renkan.project.get("views").at(b)&&(c=0),c},foldBins:function(){var a,b=this.$.find(".Rk-Fold-Bins"),c=this.renkan.$.find(".Rk-Bins"),d=0,e=this,f=e.canvas_$.width();c.position().left<0?(d=new paper.Point([-c.width()/2,0]),c.animate({left:0},250),this.$.animate({left:300},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f-c.width()<c.height()?f:f-c.width(),b.html("«")):(d=new paper.Point([c.width()/2,0]),c.animate({left:-300},250),this.$.animate({left:0},250,function(){var a=e.$.width();paper.view.viewSize=new paper.Size([a,e.canvas_$.height()])}),a=f+300,b.html("»")),this.view.paperShift(d)},save:function(){},open:function(){}}).value(),h}),define("renderer/viewrepr",["jquery","underscore","requtils","renderer/baserepresentation"],function(a,b,c,d){"use strict";var e=c.getUtils(),f=e.inherit(d);return b(f.prototype).extend({_init:function(){var b=this;this.$=a(".Rk-Render"),this.type="View",this.hiddenNodes=[],this.scale=1,this.initialScale=1,this.offset=paper.view.center,this.params={},this.model&&(this.params={zoom_level:b.model.get("zoom_level"),offset:b.model.get("offset"),hidden_nodes:b.model.get("hidden_nodes")}),this.initWithParams();var c=function(a,c){b.$.find(a).click(function(a){return b[c](a),!1})};c(".Rk-ZoomOut","zoomOut"),c(".Rk-ZoomIn","zoomIn"),c(".Rk-ZoomFit","autoScale"),c(".Rk-ZoomSave","saveView"),this.$.find(".Rk-ZoomSetSaved").click(function(){b.setScale(b.params.zoom_level,new paper.Point(b.params.offset)),b.showNodes(!1),b.options.hide_nodes&&(b.hiddenNodes=(b.params.hidden_nodes||[]).concat(),b.hideNodes()),b.updateUrl()}),this.$.find(".Rk-ShowHiddenNodes").mouseenter(function(){b.showNodes(!0),b.$.find(".Rk-ShowHiddenNodes").mouseleave(function(){b.hideNodes()})}),this.$.find(".Rk-ShowHiddenNodes").click(function(){b.showNodes(!1),b.$.find(".Rk-ShowHiddenNodes").off("mouseleave")}),this.renkan.project.get("views").length>0&&this.renkan.options.save_view&&this.$.find(".Rk-ZoomSetSaved").show()},redraw:function(a){},initWithParams:function(){var a=this;a.options.view_force_autoscale?this.autoScale():a.setScale(a.params.zoom_level,new paper.Point(a.params.offset)),a.options.hide_nodes&&!a.options.view_show_hiddennodes?(a.hiddenNodes=(a.params.hidden_nodes||[]).concat(),a.hideNodes()):a.showNodes(!1)},saveView:function(){var a=this,b={x:a.offset.x,y:a.offset.y};a.model=a.renkan.project.addView({zoom_level:a.scale,offset:b,hidden_nodes:a.hiddenNodes.concat()}),a.params={zoom_level:a.model.get("zoom_level"),offset:a.model.get("offset"),hidden_nodes:a.model.get("hidden_nodes")},this.$.find(".Rk-ZoomSetSaved").show(),a.updateUrl()},addHiddenNode:function(a){this.hideNode(a),this.hiddenNodes.push(a.id),this.updateUrl()},hideNode:function(a){"undefined"!=typeof this.renderer.getRepresentationByModel(a)&&this.renderer.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.renderer.getRepresentationByModel(b.renkan.project.get("nodes").get(c)).show(a)}),a||(this.hiddenNodes=[]),paper.view.draw()},setScale:function(a,b){a/this.initialScale>e._MIN_SCALE&&a/this.initialScale<e._MAX_SCALE&&(this.scale=a,b&&(this.offset=b),this.renderer.redraw(),this.updateUrl())},zoomOut:function(){var a=this.scale*Math.SQRT1_2,b=new paper.Point([this.renderer.canvas_$.width(),this.renderer.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.renderer.canvas_$.width(),this.renderer.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([.5*this.renderer.canvas_$.width()*(1-c)+(this.offset.x*c+a*c*.5),.5*this.renderer.canvas_$.height()*(1-c)+(this.offset.y*c+b*c*.5)]);this.setScale(d,e)},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])))},paperShift:function(a){this.offset=this.offset.add(a),this.renderer.redraw()},updateUrl:function(){if(this.options.url_parameters&&this.options.update_url){var b={},c=Backbone.history.getFragment().split("?");c.length>1&&c[1].split("&").forEach(function(a){var c=a.split("=");b[c[0]]=decodeURIComponent(c[1])}),b.view=Math.round(1e3*this.offset.x)/1e3+","+Math.round(1e3*this.offset.y)/1e3+","+Math.round(1e3*this.scale)/1e3,this.renkan.project.get("views").indexOf(this.model)>-1?(b.viewIndex=this.renkan.project.get("views").indexOf(this.model),b.viewIndex===this.renkan.project.get("views").length-1&&(b.viewIndex=-1)):b.viewIndex&&delete b.viewIndex,this.renkan.router.navigate("?"+decodeURIComponent(a.param(b)),{trigger:!1,replace:!0})}},destroy:function(a){this._super("destroy"),this.showNodes(!1)}}).value(),f}),"function"==typeof require.config&&require.config({paths:{jquery:"../lib/jquery/jquery",underscore:"../lib/lodash/lodash",filesaver:"../lib/FileSaver/FileSaver",requtils:"require-utils","ckeditor-core":"../lib/ckeditor/ckeditor","ckeditor-jquery":"../lib/ckeditor/adapters/jquery",screenfull:"../lib/screenfull/screenfull-umd"},shim:{"ckeditor-jquery":{deps:["jquery","ckeditor-core"]}}}),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","renderer/viewrepr"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w){"use strict";var x=window.Rkns;"undefined"==typeof x.Renderer&&(x.Renderer={});var y=x.Renderer;y._BaseRepresentation=a,y._BaseButton=b,y.Node=c,y.Edge=d,y.View=w,y.TempEdge=e,y._BaseEditor=f,y.NodeEditor=g,y.EdgeEditor=h,y._NodeButton=i,y.NodeEditButton=j,y.NodeRemoveButton=k,y.NodeHideButton=l,y.NodeShowButton=m,y.NodeRevertButton=n,y.NodeLinkButton=o,y.NodeEnlargeButton=p,y.NodeShrinkButton=q,y.EdgeEditButton=r,y.EdgeRemoveButton=s,y.EdgeRevertButton=t,y.MiniFrame=u,y.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 Oct 14 14:56:41 2015 +0200
+++ b/server/python/django/renkanmanager/static/renkanmanager/lib/renkan/js/renkan.min.map Mon Oct 19 14:18:51 2015 +0200
@@ -1,1 +1,1 @@
-{"version":3,"file":"renkan.min.js","sources":["templates.js","../../js/main.js","../../js/router.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","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","description","static_url","url","show_bins","show_editor","show_node_editor_title_richtext","node","show_node_editor_uri","change_types","types","type","charAt","toUpperCase","substring","show_node_editor_description","show_node_editor_description_richtext","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","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","_id","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","hide_nodes","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","node_editor_templates","template","types_templates","value","key","property_files","f","getJSON","data","concat","read_only","router","Router","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","Renderer","Scene","search","_select","_input","_form","_search","Search","_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","fillColor","Color","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","Backbone","routes","index","parameters","result","forEach","part","item","decodeURIComponent","trigger","converters","from1to2","len","nodes","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","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","view_force_autoscale","view_show_hiddennodes","default_index_view","url_parameters","update_url","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","ghost_opacity","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","default","video","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","tooltip_opacity","richtext_editor_config","toolbarGroups","name","groups","removePlugins","show_node_editor_title","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","Polygon","Zoom Fit","Download Project","Save view","View saved view","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","Show hidden nodes","Show neighbors","Hide","Fullscreen not supported by your browser","jsonIO","_proj","http_method","_load","loadingStatus","_data","saveStatus","_save","ajax","contentType","JSON","stringify","success","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","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","unhighlight","mousedown","mouseup","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","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","NodeHideButton","NodeShowButton","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","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","clean_title","textContent","innerText","_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","clearTimeout","hide_timeout","_uri","showNeighbors","hideButtons","buttons_timeout","undefined","hideNeighbors","hide_delay","delay","indexNode","hiddenNodes","indexOf","splice","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","_opacity","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","visible","handleIn","handleOut","bounds","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","keys","editorInstance","ckeditor","editorInstanceTitle","closeEditor","cleanEditor","editor","focusManager","blur","_editor_title","onFieldChange","checkDirty","getData","resetDirty","assign","keyCode","files","FileReader","alert","onload","target","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","NodeButton","delid","delete_list","time","valueOf","confirm","addHiddenNode","unset","_off","_point","addTempEdge","MiniFrame","filesaver","Screenfull","representations","notif_$","setup","totalScroll","mouse_down","selected_target","Layer","redrawActive","background_layer","topleft","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","_lastTap","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","parse","bindClick","selector","fname","evt","enabled","addEventListener","raw","fullscreenchange","widthAft","heightAft","viewSize","currentWidth","currentHeight","isFullscreen","onResize","newWidth","_width","newHeight","prevHeight","delta","prevWidth","fadeIn","fadeOut","mouseover","_thRedraw","addRepresentations","_thRedrawUsers","history","fixSize","_params","setViewparameters","el","_delay","autoScale","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","last","_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","closed","PointText","characterStyle","fontSize","paragraphStyle","justification","_visible","_restPos","_grp","_imgdelta","_currentPos","_edgeRepr","_bundle","_er","_dir","savebtn","tip","redrawMiniframe","bottomright","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","empty","parent","background","_representation","_representations","_ratio","ratioH","ratioW","resizeZoom","_from","_tmpEdge","last_point","updateUrl","_scrolldelta","SQRT1_2","open","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","toggle","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","isEmptyObject","validViewIndex","viewIndex","viewParams","params","viewsNodes","hideNodes","showNodes","idNode","_index","validIndex","foldBins","sizeAft","foldBinsButton","sizeBef","animate","ViewRepr","initialScale","initWithParams","saveView","hideNode","_offset","zoomOut","zoomIn","deltaW","deltaH","force_view","getFragment","round","navigate","param","require","config","paths","jquery","underscore","ckeditor-core","ckeditor-jquery","screenfull","shim","deps","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,WAC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kanJST\"] = 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((__t = (edge.description)) == null ? '' : __t) +\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 ';\n if (options.show_node_editor_title_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Title\" contenteditable=\"true\">' +\n((__t = (node.title)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(node.title) +\n'\" />\\n ';\n } ;\n__p += ' \\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.change_types) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Types available\")) +\n':</label>\\n <select class=\"Rk-Edit-Type\">\\n ';\n _.each(types, function(type) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( type ) +\n'\"';\n if (node.type === type) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(type.charAt(0).toUpperCase() + type.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\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 ';\n if (options.show_node_editor_description_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Description\" contenteditable=\"true\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <textarea class=\"Rk-Edit-Description\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</textarea>\\n ';\n } ;\n__p += '\\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((__t = (node.title)) == null ? '' : __t) +\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((__t = (node.description)) == null ? '' : __t) +\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 <a href=\"#?idNode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor_video.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 <video width=\"320\" height=\"240\" controls>\\n <source src=\"' +\n__e(node.uri) +\n'\" type=\"video/mp4\">\\n </video> \\n';\n } ;\n__p += '\\n <a href=\"#?idnode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\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('Save view')) +\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 view')) +\n'\"></div>\\n ';\n if (options.hide_nodes) { ;\n__p += '\\n \\t <div class=\"Rk-ShowHiddenNodes\" title=\"' +\n__e(translate('Show hidden nodes')) +\n'\"></div>\\n ';\n } ;\n__p += ' \\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: _.defaults(_opts.templates, renkanJST) || renkanJST,\n node_editor_templates: _.defaults(_opts.node_editor_templates, Rkns.defaults.node_editor_templates)\n });\n this.template = renkanJST['templates/main.html'];\n\n var types_templates = {};\n _.each(this.options.node_editor_templates, function(value, key) {\n types_templates[key] = _this.options.templates[value];\n delete _this.options.templates[value];\n });\n this.options.node_editor_templates = types_templates;\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.router = new Rkns.Router();\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 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.fillColor = new paper.Color(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 \"use strict\";\n \n var Backbone = root.Backbone;\n \n var Router = root.Rkns.Router = Backbone.Router.extend({\n routes: {\n '': 'index'\n },\n \n index: function (parameters) {\n \n var result = {};\n if (parameters !== null){\n parameters.split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n this.trigger('router', result); \n } \n });\n\n})(window);","(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 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 data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n this.project.set(this.convert(data), {\n validate: true\n });\n this.project.trigger('loaded', true);\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: false,\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 view_force_autoscale: true,\n /* Force autoscale when the Renkan is loaded */\n view_show_hiddennodes: true,\n /* Show all the node when the Renkan is loaded */\n default_index_view: -1,\n \n /* URL parsing */\n url_parameters: true,\n /* accept or not hash parameters in the url */\n update_url: true,\n /* update the url each time the paper shift or on zoom in/out, with the serialized view (offset and scale) */\n /* Considered as false if url_parameters is false */\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 ghost_opacity : 0.3,\n /* opacity when the hidden element is revealed */\n default_dash_array : [4, 5],\n /* dash line genometry */\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 hide_nodes: true,\n /* allow hide/show nodes */\n change_shapes: true,\n /* Change shapes enabled */\n change_types: true,\n /* Change type enabled */\n\n /* NODE EDITOR TEMPLATE*/\n\n node_editor_templates: {\n \"default\": \"templates/nodeeditor_readonly.html\",\n \"video\": \"templates/nodeeditor_video.html\"\n },\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 tooltip_opacity: 0.8,\n\n richtext_editor_config: {\n toolbarGroups: [\n { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },\n { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },\n '/',\n\t { name: 'styles'},\n ],\n removePlugins : 'colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates',\n },\n\n /* NODE EDITOR OPTIONS */\n\n show_node_editor_uri: true,\n show_node_editor_title: true,\n show_node_editor_title_richtext: true,\n show_node_editor_description: true,\n show_node_editor_description_richtext: 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\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","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 \"Polygon\": \"Polygone\",\n \"Zoom Fit\": \"Ajuster le Zoom\",\n \"Download Project\": \"Télécharger le projet\",\n \"Save view\": \"Sauver la vue\",\n \"View saved view\": \"Restaurer la Vue\",\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 \"Show hidden nodes\": \"Montrer les noeuds cachés\",\n \"Show neighbors\": \"Montrer les voisins\",\n \"Hide\": \"Cacher\",\n \"Fullscreen not supported by your browser\": \"Le plein écran n'est pas supporté par votre navigateur\"\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 _proj.set({\n loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n \n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\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 \n //TODO: Rearrange to avoid the 2 firts PUT due to a change in the project model\n // Take car of setting up the listener correctly to listen the save action on the view\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 }\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 if (this.sector){\n this.sector.hide(); \n }\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 var shape = new paper.Path.RegularPolygon([0,0], 3, 1);\n shape.scale(radius);\n shape.translate(center);\n return shape;\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.NodeLinkButton(this.renderer, null),\n new Renderer.NodeEnlargeButton(this.renderer, null),\n new Renderer.NodeShrinkButton(this.renderer, null)\n ];\n if (this.options.hide_nodes){\n this.normal_buttons.push(\n new Renderer.NodeHideButton(this.renderer, null),\n new Renderer.NodeShowButton(this.renderer, null)\n );\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.view.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 \n //strip html from title\n var html = this.model.get(\"title\");\n var div = document.createElement(\"div\");\n div.innerHTML = html;\n var clean_title = div.textContent || div.innerText || \"\";\n \n var _text = clean_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.view.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 clearTimeout(this.hide_timeout);\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.renderer.removeRepresentationsOfType(\"editor\");\n this.hide();\n }\n else {\n this.hideNeighbors(true);\n }\n this._super(\"unselect\");\n }\n },\n hide_delay: function(){\n var _this = this;\n this.hide_timeout = setTimeout(function(){\n _this.hide();\n }, 1000);\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(false);\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 = this.options.ghost_opacity;\n }\n this.circle.opacity = this.options.ghost_opacity;\n this.title.css('opacity', this.options.ghost_opacity);\n this.minimap_circle.opacity = this.options.ghost_opacity;\n } else {\n this.minimap_circle.opacity = 1; \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(delay){\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 if (delay){ repr.hide_delay(); } else {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.view.hiddenNodes.indexOf(repr.model.id);\n if (indexNode !== -1){\n _this.renderer.view.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.view.hiddenNodes.indexOf(this.model.id);\n if (index !== -1){\n this.renderer.view.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;\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 = this.ghost ? this.options.ghost_opacity : 1;\n this.line.dashArray = null;\n }\n\n var old_act_btn = this.active_buttons;\n\n this.arrow.visible =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) ||\n !this.model.has(\"style\") ||\n typeof this.model.get(\"style\").arrow === 'undefined';\n\n this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.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 = _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 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 if (this.hidden){\n this.renderer.removeRepresentationsOfType(\"editor\");\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 = this.options.tooltip_opacity;\n this.editor_$ = $('<div>')\n .appendTo(this.renderer.editor_$)\n .css({\n position: \"absolute\",\n opacity: this.options.tooltip_opacity\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', 'ckeditor-jquery'], 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.node_editor_templates;\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[_model.get(\"type\")] || this.readOnlyTemplate[\"default\"]),\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 _id: _model.get(\"_id\"),\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n type: _model.get(\"type\") || \"default\",\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 types : _(this.options.node_editor_templates).keys().value(),\n }));\n this.redraw();\n var _this = this,\n editorInstance = _this.options.show_node_editor_description_richtext ?\n $(\".Rk-Edit-Description\").ckeditor(_this.options.richtext_editor_config) :\n false,\n editorInstanceTitle = _this.options.show_node_editor_title_richtext ?\n $(\".Rk-Edit-Title\").ckeditor(_this.options.richtext_editor_config) :\n false,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n\n _this.cleanEditor = 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined') {\n var _editor = editorInstance.editor;\n delete editorInstance.editor;\n _editor.focusManager.blur(true);\n _editor.destroy();\n }\n }\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined') {\n var _editor_title = editorInstanceTitle.editor;\n delete editorInstanceTitle.editor;\n _editor_title.focusManager.blur(true);\n _editor_title.destroy();\n }\n }\n };\n\n this.editor_$.find(\".Rk-CloseX\").click(function (e) {\n e.preventDefault();\n closeEditor();\n });\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 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined' &&\n editorInstance.editor.checkDirty()) {\n _data.description = editorInstance.editor.getData();\n editorInstance.editor.resetDirty();\n }\n }\n else {\n _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n }\n }\n if (_this.options.show_node_editor_title) {\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined' &&\n editorInstanceTitle.editor.checkDirty()) {\n _data.title = editorInstanceTitle.editor.getData();\n editorInstanceTitle.editor.resetDirty();\n }\n }\n else {\n _data.title = _this.editor_$.find(\".Rk-Edit-Title\").val();\n }\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 if (_this.options.change_types) {\n if(_model.get(\"type\")!==_this.editor_$.find(\".Rk-Edit-Type\").val()){\n _data.type = _this.editor_$.find(\".Rk-Edit-Type\").val();\n }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 1000);\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 if( _this.options.show_node_editor_description &&\n _this.options.show_node_editor_description_richtext &&\n typeof editorInstance.editor !== 'undefined')\n {\n editorInstance.editor.on(\"change\", onFieldChange);\n editorInstance.editor.on(\"blur\", onFieldChange);\n }\n \n if( _this.options.show_node_editor_title &&\n _this.options.show_node_editor_title_richtext &&\n typeof editorInstanceTitle.editor !== 'undefined')\n {\n editorInstanceTitle.editor.on(\"change\", onFieldChange);\n editorInstanceTitle.editor.on(\"blur\", onFieldChange);\n }\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 destroy: function() {\n if(typeof this.cleanEditor !== 'undefined') {\n this.cleanEditor();\n }\n this.editor_block.remove();\n this.editor_$.remove();\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 arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash, 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 = this.options.hide_nodes ? -125 : -135;\n this.endAngle = this.options.hide_nodes ? -55 : -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 = this.options.hide_nodes ? -10 : 0;\n this.endAngle = this.options.hide_nodes ? 45 : 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/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.view.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 neighbors\";\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 = this.options.hide_nodes ? 135 : 90;\n this.endAngle = this.options.hide_nodes ? 190 : 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 = this.options.hide_nodes ? -55 : -45;\n this.endAngle = this.options.hide_nodes ? -10 : 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 = this.options.hide_nodes ? -170 : -180;\n this.endAngle = this.options.hide_nodes ? -125 : -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', 'screenfull'], function ($, _, filesaver, requtils, MiniFrame, Screenfull) {\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.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 = false;\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 _lastTap = 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.view.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.view.scale,\n _newOffset = new paper.Point([\n _this.canvas_$.width(),\n _this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.view.offset.multiply( _scaleRatio ));\n _this.view.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 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 \n if (Screenfull.enabled){\n bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n \n document.addEventListener(Screenfull.raw.fullscreenchange, function () {\n //the listener occur too randomly and sometimes before the fullscreen is fully set up\n //so we add 500 delay\n setTimeout(function(){\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 _this.resize(_this.currentWidth, widthAft, _this.currentHeight, heightAft);\n \n _this.currentWidth = widthAft;\n _this.currentHeight = heightAft;\n \n if (!Screenfull.isFullscreen) {\n paper.view.onResize = function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\n };\n }\n }, 600);\n });\n } else {\n this.$.find(\".Rk-FullScreen-Button\").addClass(\"disabled\");\n this.$.find(\".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents\").html(this.renkan.translate(\"Fullscreen not supported by your browser\"));\n }\n \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.on(\"resize\", function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\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(\"loaded\", function(){\n if (_this.renkan.options.url_parameters){\n Backbone.history.start(); \n } else {\n _this.fixSize();\n }\n _this.redrawActive = true;\n _thRedraw();\n });\n \n //register router events\n this.renkan.router.on(\"router\", function(_params){\n _this.setViewparameters(_params);\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 > 1) {\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(typeof this.view === 'undefined') {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").last());\n }\n this.view.autoScale();\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 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.view.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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 && typeof this.view !== 'undefined') {\n this.redrawMiniframe();\n }\n paper.view.draw();\n },\n resize: function(prevWidth, newWidth, prevHeight, newHeight){\n var _ratio;\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/prevHeight,\n ratioW = newWidth/prevWidth;\n if (newHeight < newWidth) {\n _ratio = ratioH;\n } else {\n _ratio = ratioW;\n }\n this.view.resizeZoom(newWidth - prevWidth, newHeight - prevHeight, _ratio);\n \n this.redraw();\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 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.view.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 var _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 this.view.updateUrl();\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.view.offset).multiply( Math.SQRT2 - 1 );\n if (this.totalScroll > 0) {\n this.view.setScale( this.view.scale * Math.SQRT2, this.view.offset.subtract(_delta) );\n } else {\n this.view.setScale( this.view.scale * Math.SQRT1_2, this.view.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 this.currentWidth = this.$.width();\n this.currentHeight = this.$.height();\n \n var _el = this.renkan.$[0];\n paper.view.off(\"resize\");\n Screenfull.toggle(_el);\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 idsMap = {},\n hiddenNodes;\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 delete e._id;\n delete e.id;\n\n if(e.hidden_nodes) {\n hiddenNodes = e.hidden_nodes;\n e.hidden_nodes = [];\n _.each(hiddenNodes, function(h,j) {\n e.hidden_nodes.push(idsMap[h]);\n });\n }\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 setViewparameters: function(_params){\n this.removeRepresentationsOfType(\"View\");\n if ($.isEmptyObject(_params)){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n return;\n }\n if (typeof _params.viewIndex !== 'undefined'){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(_params.viewIndex)));\n } else {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n }\n if (typeof _params.view !== 'undefined' && _params.view.split(\",\").length >= 3){\n var viewParams = _params.view.split(\",\");\n var params = {\n \"project\": this.renkan.project,\n \"offset\": {\n \"x\": parseFloat(viewParams[0]),\n \"y\": parseFloat(viewParams[1])\n },\n \"zoom_level\": parseFloat(viewParams[2])\n };\n this.view.setScale(params.zoom_level, new paper.Point(params.offset));\n }\n //if view parameters = autoscale we apply a zoom fit on the view.\n if ((typeof _params.view !== 'undefined' && _params.view === \"autoscale\")){\n this.view.autoScale();\n }\n //if viewsNodes = false we show all the node by default.\n if (typeof _params.viewsNodes !== 'undefined'){\n if (_params.viewsNodes === \"true\"){\n this.view.hiddenNodes = (this.view.params.hidden_nodes || []).concat();\n this.view.hideNodes();\n } else {\n this.view.showNodes(false);\n }\n }\n //other parameters must go after because most of them depends on a view that must be initialize before\n this.unhighlightAll();\n if (typeof _params.idNode !== 'undefined'){\n this.highlightModel(this.renkan.project.get(\"nodes\").get(_params.idNode));\n }\n },\n validViewIndex: function(index){\n //check if the view index exist (negative index is from the end) and return the correct index or false if doesn't exist\n var _index = parseInt(index);\n var validIndex = 0;\n if (_index < 0){\n validIndex = this.renkan.project.get(\"views\").length + _index;\n } else {\n validIndex = _index;\n }\n if (typeof this.renkan.project.get(\"views\").at(_index) === 'undefined'){\n validIndex = 0;\n }\n return validIndex;\n },\n foldBins: function() {\n var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n bins = this.renkan.$.find(\".Rk-Bins\"),\n _delta = 0;\n var _this = this,\n sizeBef = _this.canvas_$.width(),\n sizeAft;\n if (bins.position().left < 0) {\n _delta= new paper.Point([-bins.width()/2, 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 _delta= new paper.Point([bins.width()/2, 0]);\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.view.paperShift(_delta);\n },\n save: function() { },\n open: function() { }\n }).value();\n\n /* Scene End */\n\n return Scene;\n\n});\n\ndefine('renderer/viewrepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n \n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer.View Class */\n\n /* The representation for the view. */\n\n var ViewRepr = Utils.inherit(BaseRepresentation);\n\n _(ViewRepr.prototype).extend({\n _init: function() {\n var _this = this;\n this.$ = $(\".Rk-Render\");\n this.type = \"View\";\n this.hiddenNodes = [];\n this.scale = 1;\n this.initialScale = 1;\n this.offset = paper.view.center;\n this.params = {};\n \n if (this.model){\n this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n }\n \n this.initWithParams();\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 bindClick(\".Rk-ZoomSave\", \"saveView\");\n \n this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset));\n _this.showNodes(false);\n if (_this.options.hide_nodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n }\n _this.updateUrl();\n });\n \n this.$.find(\".Rk-ShowHiddenNodes\").mouseenter( function() {\n _this.showNodes(true);\n _this.$.find(\".Rk-ShowHiddenNodes\").mouseleave( function() {\n _this.hideNodes();\n });\n });\n this.$.find(\".Rk-ShowHiddenNodes\").click( function() {\n _this.showNodes(false);\n _this.$.find(\".Rk-ShowHiddenNodes\").off( \"mouseleave\" ); \n });\n \n if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n },\n redraw: function(options) {\n //console.log(\"view : \", this.model.toJSON());\n },\n initWithParams: function(){\n var _this = this;\n \n if (_this.options.view_force_autoscale){\n this.autoScale();\n } else {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset)); \n }\n \n if (_this.options.hide_nodes && !_this.options.view_show_hiddennodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n } else {\n _this.showNodes(false);\n }\n },\n saveView: function(){\n var _this = this;\n \n var offset = {\n \"x\": _this.offset.x,\n \"y\": _this.offset.y\n };\n \n _this.model = _this.renkan.project.addView( { zoom_level:_this.scale, offset:offset, hidden_nodes: _this.hiddenNodes.concat() } );\n _this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n \n this.$.find(\".Rk-ZoomSetSaved\").show();\n \n _this.updateUrl();\n },\n addHiddenNode: function(_model){\n this.hideNode(_model);\n this.hiddenNodes.push(_model.id);\n this.updateUrl();\n },\n hideNode: function(_model){\n if (typeof this.renderer.getRepresentationByModel(_model) !== 'undefined'){\n this.renderer.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.renderer.getRepresentationByModel(_this.renkan.project.get(\"nodes\").get(_id)).show(ghost);\n });\n if (!ghost){\n this.hiddenNodes = [];\n }\n paper.view.draw();\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.renderer.redraw();\n this.updateUrl();\n }\n },\n zoomOut: function() {\n var _newScale = this.scale * Math.SQRT1_2,\n _offset = new paper.Point([\n this.renderer.canvas_$.width(),\n this.renderer.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.renderer.canvas_$.width(),\n this.renderer.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n this.setScale( _newScale, _offset );\n },\n resizeZoom: function(deltaW, deltaH, _ratio) {\n var _newScale = this.scale * _ratio;\n var _offset = new paper.Point([\n (this.renderer.canvas_$.width() * 0.5 * ( 1 - _ratio) ) + (this.offset.x * _ratio + deltaW * _ratio * 0.5 ),\n (this.renderer.canvas_$.height() * 0.5 * ( 1 - _ratio) ) + (this.offset.y * _ratio + deltaH * _ratio * 0.5 )\n ]);\n this.setScale( _newScale, _offset );\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 paperShift: function(_delta) {\n this.offset = this.offset.add(_delta);\n this.renderer.redraw();\n },\n updateUrl: function(){\n if(this.options.url_parameters && this.options.update_url){\n var result = {};\n var parameters = Backbone.history.getFragment().split('?');\n if (parameters.length > 1){\n parameters[1].split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n result.view = Math.round(this.offset.x*1000)/1000 + ',' + Math.round(this.offset.y*1000)/1000 + ',' + Math.round(this.scale*1000)/1000;\n\n if (this.renkan.project.get(\"views\").indexOf(this.model) > -1){\n result.viewIndex = this.renkan.project.get(\"views\").indexOf(this.model);\n if (result.viewIndex === this.renkan.project.get(\"views\").length - 1){\n result.viewIndex = -1;\n }\n } else {\n if (result.viewIndex){\n delete result.viewIndex;\n }\n }\n this.renkan.router.navigate(\"?\" + decodeURIComponent($.param(result)), {trigger: false, replace: true});\n }\n },\n destroy: function(_event) {\n this._super(\"destroy\");\n this.showNodes(false);\n }\n }).value();\n\n return ViewRepr;\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 'ckeditor-core':'../lib/ckeditor/ckeditor',\n 'ckeditor-jquery':'../lib/ckeditor/adapters/jquery',\n 'screenfull':'../lib/screenfull/screenfull-umd'\n },\n shim: {\n 'ckeditor-jquery':{\n deps:['jquery','ckeditor-core']\n }\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 'renderer/viewrepr'\n ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene, ViewRepr){\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.View = ViewRepr;\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
+{"version":3,"file":"renkan.min.js","sources":["templates.js","../../js/main.js","../../js/router.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","show_edge_tooltip_nodes","to_color","show_edge_tooltip_creator","created_by_color","Rkns","Utils","getFullURL","image","description","static_url","url","show_bins","show_editor","show_node_editor_title_richtext","node","show_node_editor_uri","change_types","types","type","charAt","toUpperCase","substring","show_node_editor_description","show_node_editor_description_richtext","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","show_node_tooltip_color","show_node_tooltip_uri","show_node_tooltip_description","show_node_tooltip_image","show_node_tooltip_creator","_id","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","hide_nodes","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","node_editor_templates","template","types_templates","value","key","property_files","f","getJSON","data","concat","read_only","router","Router","Models","Project","dataloader","DataLoader","Loader","setCurrentUser","user_id","user_name","addUser","current_user","renderer","redrawUsers","container","tabs","search_engines","current_user_list","UsersList","on","_tmpl","map","c","Renderer","Scene","search","_select","_input","_form","_search","_key","Search","getSearchTitle","className","getBgClass","_el","setSearchEngine","submit","val","search_engine","mouseenter","mouseleave","bins","_bin","Bin","elementDropped","_mainDiv","siblings","is","slideUp","_e","_t","_models","where","_model","highlightModel","mouseout","unhighlightAll","e","dragDrop","err","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","_arg","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","fillColor","Color","Gradient","tooltip_top_color","tooltip_bottom_color","increaseBrightness","hex","percent","parseInt","g","b","Backbone","routes","index","parameters","result","forEach","part","item","decodeURIComponent","trigger","converters","from1to2","len","nodes","style","edges","schema_version","dataConverters","convert","schemaVersionFrom","getSchemaVersion","schemaVersionTo","converterName","load","set","validate","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","view_force_autoscale","view_show_hiddennodes","default_index_view","url_parameters","update_url","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","ghost_opacity","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","default","video","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","tooltip_opacity","richtext_editor_config","toolbarGroups","name","groups","removePlugins","show_node_editor_title","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","Polygon","Zoom Fit","Download Project","Save view","View saved view","Renkan 'Drag-to-Add' bookmarklet","(unknown user)","<unknown user>","Search in graph","Search in ","Show hidden nodes","Show neighbors","Hide","Fullscreen not supported by your browser","jsonIO","_proj","http_method","_load","loadingStatus","_data","saveStatus","_save","ajax","contentType","JSON","stringify","success","textStatus","jqXHR","_thrSave","throttle","setTimeout","changedAttributes","hasChanged","jsonIOSaveOnClick","_saveWarn","_onLeave","getdata","rx","matches","location","hash","match","beforeSend","_checkLeave","removeClass","save","hasClass","Ldt","ProjectBin","ldt_type","Resclass","console","error","tagTemplate","annotationTemplate","proj_id","project_id","ldt_platform","searchbase","highlight","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","unhighlight","mousedown","mouseup","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","NodeLinkButton","NodeEnlargeButton","NodeShrinkButton","NodeHideButton","NodeShowButton","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","setSectorSize","node_image","subtract","image_delta","multiply","old_act_btn","opacity","dashArray","selected","isEditable","highlighted","clean_title","textContent","innerText","_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","clearTimeout","hide_timeout","_uri","showNeighbors","hideButtons","buttons_timeout","undefined","hideNeighbors","hide_delay","delay","indexNode","hiddenNodes","indexOf","splice","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","_opacity","_arrow_scale","_p0a","_p1a","_v","_r","_u","_ortho","_group_pos","getPosition","_p0b","_p1b","_a","angle","_textdelta","_handle","visible","handleIn","handleOut","bounds","_textpos","transform","-moz-transform","-webkit-transform","text_angle","reject","TempEdge","_p0","_p1","end_pos","_c","_hitResult","hitTest","findTarget","_endDrag","_target","_destmodel","_BaseEditor","buttons_layer","editor_block","_pts","range","editor_$","BaseEditor","NodeEditor","readOnlyTemplate","_created_by","_template","_image_placeholder","_size","keys","editorInstance","ckeditor","editorInstanceTitle","closeEditor","cleanEditor","editor","focusManager","blur","_editor_title","onFieldChange","checkDirty","getData","resetDirty","assign","keyCode","files","FileReader","alert","onload","target","readAsDataURL","focus","_picker","hover","shiftSize","_newsize","shiftThickness","_oldThickness","_newThickness","titlehtml","EdgeEditor","_from_model","_to_model","BaseButton","_NodeButton","sectorInner","lastSectorInner","drawSector","startAngle","endAngle","imageName","NodeButton","delid","delete_list","time","valueOf","confirm","addHiddenNode","unset","_off","_point","addTempEdge","MiniFrame","filesaver","Screenfull","representations","notif_$","setup","totalScroll","mouse_down","selected_target","Layer","redrawActive","background_layer","topleft","bottomRight","cliprectangle","bundles","click_mode","_allowScroll","_originalScale","_zooming","_lastTapX","_lastTapY","_lastTap","icon_cache","imgname","throttledMouseMove","mousemove","mousewheel","onScroll","touchstart","_touches","touches","pow","onDoubleClick","touchmove","_newScale","_scaleRatio","_newOffset","setScale","touchend","dblclick","dragover","dragenter","dragleave","drop","parse","bindClick","selector","fname","evt","enabled","addEventListener","raw","fullscreenchange","widthAft","heightAft","viewSize","currentWidth","currentHeight","isFullscreen","onResize","newWidth","_width","newHeight","prevHeight","delta","prevWidth","fadeIn","fadeOut","mouseover","_thRedraw","addRepresentations","_thRedrawUsers","history","fixSize","_params","setViewparameters","el","_delay","autoScale","$cpwrapper","$cplist","$this","rxs","_now","findWhere","delete_scheduled","rescaleMinimap","last","_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","closed","PointText","characterStyle","fontSize","paragraphStyle","justification","_visible","_restPos","_grp","_imgdelta","_currentPos","_edgeRepr","_bundle","_er","_dir","savebtn","tip","redrawMiniframe","bottomright","_xx","_yy","_minx","_miny","_maxx","_maxy","_scale","at","_type","RendererType","_collection","userTemplate","allUsers","models","ulistHtml","$userpanel","$name","$cpitems","$colorsquare","$input","empty","parent","background","_representation","_representations","_ratio","ratioH","ratioW","resizeZoom","_from","_tmpEdge","last_point","updateUrl","_scrolldelta","SQRT1_2","open","defaultDropHandler","newNode","tweetdiv","_svgimgs","_svgpaths","_imgs","_as","fields","drop_enhancer","jsondata","drop_handler","_nodedata","fullScreen","toggle","addNodeBtn","addEdgeBtn","exportProject","projectJSON","projectId","fileNameToSaveAs","space_id","objId","idsMap","projectJSONStr","blob","Blob","isEmptyObject","validViewIndex","viewIndex","viewParams","params","viewsNodes","hideNodes","showNodes","idNode","_index","validIndex","foldBins","sizeAft","foldBinsButton","sizeBef","animate","ViewRepr","initialScale","initWithParams","saveView","hideNode","_offset","zoomOut","zoomIn","deltaW","deltaH","force_view","getFragment","round","navigate","param","require","config","paths","jquery","underscore","ckeditor-core","ckeditor-jquery","screenfull","shim","deps","startRenkan"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAAA,KAAgB,UAAIA,KAAgB,cAEpCA,KAAgB,UAAE,8BAAgC,SAASC,KAC3DA,MAAQA,OACR,IAAIC,KAAKC,IAAM,EAAUC,GAAEC,MAC3B,MAAMJ,IACNE,KAAO,oBACS,OAAdD,IAAM,GAAe,GAAKA,KAC5B,yBACgB,OAAdA,IAAM,GAAe,GAAKA,KAC5B,SAGA,OAAOC,MAGPH,KAAgB,UAAE,6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,EAAYC,EAAYqC,EAAYW,EAAYxO,EAAgBC,EAAkBI,EAAgBC,EAAgBE,EAAkBN,EAAgBC,EAAmBC,EAAkBmI,EAAgBC,EAAkBC,EAAkB0G,EAAW/1B,EAAO6jC,GAE1U,YAEA,IAAIpsC,GAAO4F,OAAO5F,IAEU,oBAAlBA,GAAKsI,WACXtI,EAAKsI,YAET,IAAIA,GAAWtI,EAAKsI,QAEpBA,GAASijB,oBAAsBqB,EAC/BtkB,EAASukB,YAAcsQ,EACvB70B,EAAS6O,KAAOsX,EAChBnmB,EAASmP,KAAOA,EAChBnP,EAASsP,KAAOw0B,EAChB9jC,EAASmxB,SAAWA,EACpBnxB,EAAS8xB,YAAcM,EACvBpyB,EAASqyB,WAAaA,EACtBryB,EAAS00B,WAAaA,EACtB10B,EAAS80B,YAAcO,EACvBr1B,EAAS6mB,eAAiBA,EAC1B7mB,EAAS8mB,iBAAmBA,EAC5B9mB,EAASknB,eAAiBA,EAC1BlnB,EAASmnB,eAAiBA,EAC1BnnB,EAASqnB,iBAAmBA,EAC5BrnB,EAAS+mB,eAAiBA,EAC1B/mB,EAASgnB,kBAAoBA,EAC7BhnB,EAASinB,iBAAmBA,EAC5BjnB,EAASovB,eAAiBA,EAC1BpvB,EAASqvB,iBAAmBA,EAC5BrvB,EAASsvB,iBAAmBA,EAC5BtvB,EAASg2B,UAAYA,EACrBh2B,EAASC,MAAQA,EAEjBslC,gBAGJviB,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((__t = (edge.description)) == null ? '' : __t) +\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 ';\n if (options.show_node_editor_title_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Title\" contenteditable=\"true\">' +\n((__t = (node.title)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <input class=\"Rk-Edit-Title\" type=\"text\" value=\"' +\n__e(node.title) +\n'\" />\\n ';\n } ;\n__p += ' \\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.change_types) { ;\n__p += '\\n <p>\\n <label>' +\n__e(renkan.translate(\"Types available\")) +\n':</label>\\n <select class=\"Rk-Edit-Type\">\\n ';\n _.each(types, function(type) { ;\n__p += '\\n <option class=\"Rk-Edit-Vocabulary-Property\" value=\"' +\n__e( type ) +\n'\"';\n if (node.type === type) { ;\n__p += ' selected';\n } ;\n__p += '>\\n ' +\n__e( renkan.translate(type.charAt(0).toUpperCase() + type.substring(1)) ) +\n'\\n </option>\\n ';\n }); ;\n__p += '\\n </select>\\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 ';\n if (options.show_node_editor_description_richtext) { ;\n__p += '\\n <div class=\"Rk-Edit-Description\" contenteditable=\"true\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</div>\\n ';\n } else { ;\n__p += '\\n <textarea class=\"Rk-Edit-Description\">' +\n((__t = (node.description)) == null ? '' : __t) +\n'</textarea>\\n ';\n } ;\n__p += '\\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((__t = (node.title)) == null ? '' : __t) +\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((__t = (node.description)) == null ? '' : __t) +\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 <a href=\"#?idNode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\n';\n\n}\nreturn __p\n};\n\nthis[\"renkanJST\"][\"templates/nodeeditor_video.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 <video width=\"320\" height=\"240\" controls>\\n <source src=\"' +\n__e(node.uri) +\n'\" type=\"video/mp4\">\\n </video> \\n';\n } ;\n__p += '\\n <a href=\"#?idnode=' +\n__e(node._id) +\n'\">' +\n__e(renkan.translate(\"Link to the node\")) +\n'</a>\\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('Save view')) +\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 view')) +\n'\"></div>\\n ';\n if (options.hide_nodes) { ;\n__p += '\\n \\t <div class=\"Rk-ShowHiddenNodes\" title=\"' +\n__e(translate('Show hidden nodes')) +\n'\"></div>\\n ';\n } ;\n__p += ' \\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: _.defaults(_opts.templates, renkanJST) || renkanJST,\n node_editor_templates: _.defaults(_opts.node_editor_templates, Rkns.defaults.node_editor_templates)\n });\n this.template = renkanJST['templates/main.html'];\n\n var types_templates = {};\n _.each(this.options.node_editor_templates, function(value, key) {\n types_templates[key] = _this.options.templates[value];\n delete _this.options.templates[value];\n });\n this.options.node_editor_templates = types_templates;\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.router = new Rkns.Router();\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 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.fillColor = new paper.Color(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 \"use strict\";\n \n var Backbone = root.Backbone;\n \n var Router = root.Rkns.Router = Backbone.Router.extend({\n routes: {\n '': 'index'\n },\n \n index: function (parameters) {\n \n var result = {};\n if (parameters !== null){\n parameters.split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n this.trigger('router', result); \n } \n });\n\n})(window);","(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 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 data = this.dataConverters[converterName](data);\n }\n }\n return data;\n };\n\n DataLoader.Loader.prototype.load = function(data) {\n this.project.set(this.convert(data), {\n validate: true\n });\n this.project.trigger('loaded', true);\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: false,\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 view_force_autoscale: true,\n /* Force autoscale when the Renkan is loaded */\n view_show_hiddennodes: true,\n /* Show all the node when the Renkan is loaded */\n default_index_view: -1,\n \n /* URL parsing */\n url_parameters: true,\n /* accept or not hash parameters in the url */\n update_url: true,\n /* update the url each time the paper shift or on zoom in/out, with the serialized view (offset and scale) */\n /* Considered as false if url_parameters is false */\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 ghost_opacity : 0.3,\n /* opacity when the hidden element is revealed */\n default_dash_array : [4, 5],\n /* dash line genometry */\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 hide_nodes: true,\n /* allow hide/show nodes */\n change_shapes: true,\n /* Change shapes enabled */\n change_types: true,\n /* Change type enabled */\n\n /* NODE EDITOR TEMPLATE*/\n\n node_editor_templates: {\n \"default\": \"templates/nodeeditor_readonly.html\",\n \"video\": \"templates/nodeeditor_video.html\"\n },\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 tooltip_opacity: 0.8,\n\n richtext_editor_config: {\n toolbarGroups: [\n { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },\n { name: 'clipboard', groups: [ 'clipboard', 'undo' ] },\n '/',\n\t { name: 'styles'},\n ],\n removePlugins : 'colorbutton,find,flash,font,forms,iframe,image,newpage,smiley,specialchar,stylescombo,templates',\n },\n\n /* NODE EDITOR OPTIONS */\n\n show_node_editor_uri: true,\n show_node_editor_title: true,\n show_node_editor_title_richtext: true,\n show_node_editor_description: true,\n show_node_editor_description_richtext: 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\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","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 \"Polygon\": \"Polygone\",\n \"Zoom Fit\": \"Ajuster le Zoom\",\n \"Download Project\": \"Télécharger le projet\",\n \"Save view\": \"Sauver la vue\",\n \"View saved view\": \"Restaurer la Vue\",\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 \"Show hidden nodes\": \"Montrer les noeuds cachés\",\n \"Show neighbors\": \"Montrer les voisins\",\n \"Hide\": \"Cacher\",\n \"Fullscreen not supported by your browser\": \"Le plein écran n'est pas supporté par votre navigateur\"\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 _proj.set({\n loadingStatus : true\n });\n Rkns.$.getJSON(_opts.url, function(_data) {\n _renkan.dataloader.load(_data);\n \n _proj.set({\n loadingStatus : false\n });\n _proj.set({\n saveStatus : 0\n });\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 \n //TODO: Rearrange to avoid the 2 firts PUT due to a change in the project model\n // Take car of setting up the listener correctly to listen the save action on the view\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 }\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 'use strict';\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 'use strict';\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 'use strict';\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 if (this.sector){\n this.sector.hide(); \n }\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 'use strict';\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 var shape = new paper.Path.RegularPolygon([0,0], 3, 1);\n shape.scale(radius);\n shape.translate(center);\n return shape;\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 'use strict';\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.NodeLinkButton(this.renderer, null),\n new Renderer.NodeEnlargeButton(this.renderer, null),\n new Renderer.NodeShrinkButton(this.renderer, null)\n ];\n if (this.options.hide_nodes){\n this.normal_buttons.push(\n new Renderer.NodeHideButton(this.renderer, null),\n new Renderer.NodeShowButton(this.renderer, null)\n );\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.view.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 \n //strip html from title\n var html = this.model.get(\"title\");\n var div = document.createElement(\"div\");\n div.innerHTML = html;\n var clean_title = div.textContent || div.innerText || \"\";\n \n var _text = clean_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.view.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 clearTimeout(this.hide_timeout);\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.renderer.removeRepresentationsOfType(\"editor\");\n this.hide();\n }\n else {\n this.hideNeighbors(true);\n }\n this._super(\"unselect\");\n }\n },\n hide_delay: function(){\n var _this = this;\n this.hide_timeout = setTimeout(function(){\n _this.hide();\n }, 1000);\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(false);\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 = this.options.ghost_opacity;\n }\n this.circle.opacity = this.options.ghost_opacity;\n this.title.css('opacity', this.options.ghost_opacity);\n this.minimap_circle.opacity = this.options.ghost_opacity;\n } else {\n this.minimap_circle.opacity = 1; \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(delay){\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 if (delay){ repr.hide_delay(); } else {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.view.hiddenNodes.indexOf(repr.model.id);\n if (indexNode !== -1){\n _this.renderer.view.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.view.hiddenNodes.indexOf(this.model.id);\n if (index !== -1){\n this.renderer.view.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 'use strict';\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;\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 = this.ghost ? this.options.ghost_opacity : 1;\n this.line.dashArray = null;\n }\n\n var old_act_btn = this.active_buttons;\n\n this.arrow.visible =\n (this.model.has(\"style\") && this.model.get(\"style\").arrow) ||\n !this.model.has(\"style\") ||\n typeof this.model.get(\"style\").arrow === 'undefined';\n\n this.active_buttons = this.model.get(\"delete_scheduled\") ? this.pending_delete_buttons : this.normal_buttons;\n\n if (this.selected && this.renderer.isEditable() && old_act_btn !== this.active_buttons) {\n old_act_btn.forEach(function(b) {\n b.hide();\n });\n this.active_buttons.forEach(function(b) {\n b.show();\n });\n }\n\n this.paper_coords = _p0b.add(_p1b).divide(2);\n this.line.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 = _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 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 if (this.hidden){\n this.renderer.removeRepresentationsOfType(\"editor\");\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 'use strict';\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 'use strict';\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 = this.options.tooltip_opacity;\n this.editor_$ = $('<div>')\n .appendTo(this.renderer.editor_$)\n .css({\n position: \"absolute\",\n opacity: this.options.tooltip_opacity\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', 'ckeditor-jquery'], function ($, _, requtils, BaseEditor, ShapeBuilder) {\n 'use strict';\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.node_editor_templates;\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[_model.get(\"type\")] || this.readOnlyTemplate[\"default\"]),\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 _id: _model.get(\"_id\"),\n has_creator: !!_model.get(\"created_by\"),\n title: _model.get(\"title\"),\n uri: _model.get(\"uri\"),\n type: _model.get(\"type\") || \"default\",\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 types : _(this.options.node_editor_templates).keys().value(),\n }));\n this.redraw();\n var _this = this,\n editorInstance = _this.options.show_node_editor_description_richtext ?\n $(\".Rk-Edit-Description\").ckeditor(_this.options.richtext_editor_config) :\n false,\n editorInstanceTitle = _this.options.show_node_editor_title_richtext ?\n $(\".Rk-Edit-Title\").ckeditor(_this.options.richtext_editor_config) :\n false,\n closeEditor = function() {\n _this.renderer.removeRepresentation(_this);\n paper.view.draw();\n };\n\n _this.cleanEditor = 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined') {\n var _editor = editorInstance.editor;\n delete editorInstance.editor;\n _editor.focusManager.blur(true);\n _editor.destroy();\n }\n }\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined') {\n var _editor_title = editorInstanceTitle.editor;\n delete editorInstanceTitle.editor;\n _editor_title.focusManager.blur(true);\n _editor_title.destroy();\n }\n }\n };\n\n this.editor_$.find(\".Rk-CloseX\").click(function (e) {\n e.preventDefault();\n closeEditor();\n });\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 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 if(_this.options.show_node_editor_description_richtext) {\n if(typeof editorInstance.editor !== 'undefined' &&\n editorInstance.editor.checkDirty()) {\n _data.description = editorInstance.editor.getData();\n editorInstance.editor.resetDirty();\n }\n }\n else {\n _data.description = _this.editor_$.find(\".Rk-Edit-Description\").val();\n }\n }\n if (_this.options.show_node_editor_title) {\n if(_this.options.show_node_editor_title_richtext) {\n if(typeof editorInstanceTitle.editor !== 'undefined' &&\n editorInstanceTitle.editor.checkDirty()) {\n _data.title = editorInstanceTitle.editor.getData();\n editorInstanceTitle.editor.resetDirty();\n }\n }\n else {\n _data.title = _this.editor_$.find(\".Rk-Edit-Title\").val();\n }\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 if (_this.options.change_types) {\n if(_model.get(\"type\")!==_this.editor_$.find(\".Rk-Edit-Type\").val()){\n _data.type = _this.editor_$.find(\".Rk-Edit-Type\").val();\n }\n }\n _model.set(_data);\n _this.redraw();\n } else {\n closeEditor();\n }\n });\n }, 1000);\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 if( _this.options.show_node_editor_description &&\n _this.options.show_node_editor_description_richtext &&\n typeof editorInstance.editor !== 'undefined')\n {\n editorInstance.editor.on(\"change\", onFieldChange);\n editorInstance.editor.on(\"blur\", onFieldChange);\n }\n \n if( _this.options.show_node_editor_title &&\n _this.options.show_node_editor_title_richtext &&\n typeof editorInstanceTitle.editor !== 'undefined')\n {\n editorInstanceTitle.editor.on(\"change\", onFieldChange);\n editorInstanceTitle.editor.on(\"blur\", onFieldChange);\n }\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 destroy: function() {\n if(typeof this.cleanEditor !== 'undefined') {\n this.cleanEditor();\n }\n this.editor_block.remove();\n this.editor_$.remove();\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 'use strict';\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 arrow = _this.editor_$.find(\".Rk-Edit-Arrow\").is(':checked');\n _data.style = _.assign( ((_model.has(\"style\") && _.clone(_model.get(\"style\"))) || {}), {dash: dash, 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 'use strict';\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 'use strict';\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 = this.options.hide_nodes ? -125 : -135;\n this.endAngle = this.options.hide_nodes ? -55 : -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 'use strict';\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 = this.options.hide_nodes ? -10 : 0;\n this.endAngle = this.options.hide_nodes ? 45 : 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/nodehidebutton',['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {\n 'use strict';\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.view.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 'use strict';\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 neighbors\";\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 'use strict';\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 'use strict';\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 = this.options.hide_nodes ? 135 : 90;\n this.endAngle = this.options.hide_nodes ? 190 : 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 'use strict';\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 = this.options.hide_nodes ? -55 : -45;\n this.endAngle = this.options.hide_nodes ? -10 : 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 'use strict';\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 = this.options.hide_nodes ? -170 : -180;\n this.endAngle = this.options.hide_nodes ? -125 : -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 'use strict';\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 'use strict';\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 'use strict';\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 'use strict';\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', 'screenfull'], function ($, _, filesaver, requtils, MiniFrame, Screenfull) {\n 'use strict';\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.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 = false;\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 _lastTap = 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.view.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.view.scale,\n _newOffset = new paper.Point([\n _this.canvas_$.width(),\n _this.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.view.offset.multiply( _scaleRatio ));\n _this.view.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 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 \n if (Screenfull.enabled){\n bindClick(\".Rk-FullScreen-Button\", \"fullScreen\");\n \n document.addEventListener(Screenfull.raw.fullscreenchange, function () {\n //the listener occur too randomly and sometimes before the fullscreen is fully set up\n //so we add 500 delay\n setTimeout(function(){\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 _this.resize(_this.currentWidth, widthAft, _this.currentHeight, heightAft);\n \n _this.currentWidth = widthAft;\n _this.currentHeight = heightAft;\n \n if (!Screenfull.isFullscreen) {\n paper.view.onResize = function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\n };\n }\n }, 600);\n });\n } else {\n this.$.find(\".Rk-FullScreen-Button\").addClass(\"disabled\");\n this.$.find(\".Rk-FullScreen-Button .Rk-TopBar-Tooltip-Contents\").html(this.renkan.translate(\"Fullscreen not supported by your browser\"));\n }\n \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.on(\"resize\", function(_event) {\n var newWidth = _event.size._width,\n newHeight = _event.size._height;\n var prevHeight = newHeight - _event.delta.height,\n prevWidth = newWidth - _event.delta.width;\n \n _this.resize(prevWidth, newWidth, prevHeight, newHeight);\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(\"loaded\", function(){\n if (_this.renkan.options.url_parameters){\n Backbone.history.start(); \n } else {\n _this.fixSize();\n }\n _this.redrawActive = true;\n _thRedraw();\n });\n \n //register router events\n this.renkan.router.on(\"router\", function(_params){\n _this.setViewparameters(_params);\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 > 1) {\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(typeof this.view === 'undefined') {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").last());\n }\n this.view.autoScale();\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 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.view.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,\n this.view.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.view.scale).add(this.view.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.view.offset).divide(this.view.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 && typeof this.view !== 'undefined') {\n this.redrawMiniframe();\n }\n paper.view.draw();\n },\n resize: function(prevWidth, newWidth, prevHeight, newHeight){\n var _ratio;\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/prevHeight,\n ratioW = newWidth/prevWidth;\n if (newHeight < newWidth) {\n _ratio = ratioH;\n } else {\n _ratio = ratioW;\n }\n this.view.resizeZoom(newWidth - prevWidth, newHeight - prevHeight, _ratio);\n \n this.redraw();\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 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.view.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 var _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 this.view.updateUrl();\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.view.offset).multiply( Math.SQRT2 - 1 );\n if (this.totalScroll > 0) {\n this.view.setScale( this.view.scale * Math.SQRT2, this.view.offset.subtract(_delta) );\n } else {\n this.view.setScale( this.view.scale * Math.SQRT1_2, this.view.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 this.currentWidth = this.$.width();\n this.currentHeight = this.$.height();\n \n var _el = this.renkan.$[0];\n paper.view.off(\"resize\");\n Screenfull.toggle(_el);\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 idsMap = {},\n hiddenNodes;\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 delete e._id;\n delete e.id;\n\n if(e.hidden_nodes) {\n hiddenNodes = e.hidden_nodes;\n e.hidden_nodes = [];\n _.each(hiddenNodes, function(h,j) {\n e.hidden_nodes.push(idsMap[h]);\n });\n }\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 setViewparameters: function(_params){\n this.removeRepresentationsOfType(\"View\");\n if ($.isEmptyObject(_params)){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n return;\n }\n if (typeof _params.viewIndex !== 'undefined'){\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(_params.viewIndex)));\n } else {\n this.view = this.addRepresentation(\"View\", this.renkan.project.get(\"views\").at(this.validViewIndex(this.renkan.options.default_index_view)));\n }\n if (typeof _params.view !== 'undefined' && _params.view.split(\",\").length >= 3){\n var viewParams = _params.view.split(\",\");\n var params = {\n \"project\": this.renkan.project,\n \"offset\": {\n \"x\": parseFloat(viewParams[0]),\n \"y\": parseFloat(viewParams[1])\n },\n \"zoom_level\": parseFloat(viewParams[2])\n };\n this.view.setScale(params.zoom_level, new paper.Point(params.offset));\n }\n //if view parameters = autoscale we apply a zoom fit on the view.\n if ((typeof _params.view !== 'undefined' && _params.view === \"autoscale\")){\n this.view.autoScale();\n }\n //if viewsNodes = false we show all the node by default.\n if (typeof _params.viewsNodes !== 'undefined'){\n if (_params.viewsNodes === \"true\"){\n this.view.hiddenNodes = (this.view.params.hidden_nodes || []).concat();\n this.view.hideNodes();\n } else {\n this.view.showNodes(false);\n }\n }\n //other parameters must go after because most of them depends on a view that must be initialize before\n this.unhighlightAll();\n if (typeof _params.idNode !== 'undefined'){\n this.highlightModel(this.renkan.project.get(\"nodes\").get(_params.idNode));\n }\n },\n validViewIndex: function(index){\n //check if the view index exist (negative index is from the end) and return the correct index or false if doesn't exist\n var _index = parseInt(index);\n var validIndex = 0;\n if (_index < 0){\n validIndex = this.renkan.project.get(\"views\").length + _index;\n } else {\n validIndex = _index;\n }\n if (typeof this.renkan.project.get(\"views\").at(_index) === 'undefined'){\n validIndex = 0;\n }\n return validIndex;\n },\n foldBins: function() {\n var foldBinsButton = this.$.find(\".Rk-Fold-Bins\"),\n bins = this.renkan.$.find(\".Rk-Bins\"),\n _delta = 0;\n var _this = this,\n sizeBef = _this.canvas_$.width(),\n sizeAft;\n if (bins.position().left < 0) {\n _delta= new paper.Point([-bins.width()/2, 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 _delta= new paper.Point([bins.width()/2, 0]);\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.view.paperShift(_delta);\n },\n save: function() { },\n open: function() { }\n }).value();\n\n /* Scene End */\n\n return Scene;\n\n});\n\ndefine('renderer/viewrepr',['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {\n 'use strict';\n\n var Utils = requtils.getUtils();\n\n /* Rkns.Renderer.View Class */\n\n /* The representation for the view. */\n\n var ViewRepr = Utils.inherit(BaseRepresentation);\n\n _(ViewRepr.prototype).extend({\n _init: function() {\n var _this = this;\n this.$ = $(\".Rk-Render\");\n this.type = \"View\";\n this.hiddenNodes = [];\n this.scale = 1;\n this.initialScale = 1;\n this.offset = paper.view.center;\n this.params = {};\n \n if (this.model){\n this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n }\n \n this.initWithParams();\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 bindClick(\".Rk-ZoomSave\", \"saveView\");\n \n this.$.find(\".Rk-ZoomSetSaved\").click( function() {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset));\n _this.showNodes(false);\n if (_this.options.hide_nodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n }\n _this.updateUrl();\n });\n \n this.$.find(\".Rk-ShowHiddenNodes\").mouseenter( function() {\n _this.showNodes(true);\n _this.$.find(\".Rk-ShowHiddenNodes\").mouseleave( function() {\n _this.hideNodes();\n });\n });\n this.$.find(\".Rk-ShowHiddenNodes\").click( function() {\n _this.showNodes(false);\n _this.$.find(\".Rk-ShowHiddenNodes\").off( \"mouseleave\" ); \n });\n \n if(this.renkan.project.get(\"views\").length > 0 && this.renkan.options.save_view){\n this.$.find(\".Rk-ZoomSetSaved\").show();\n }\n },\n redraw: function(options) {\n //console.log(\"view : \", this.model.toJSON());\n },\n initWithParams: function(){\n var _this = this;\n \n if (_this.options.view_force_autoscale){\n this.autoScale();\n } else {\n _this.setScale(_this.params.zoom_level, new paper.Point(_this.params.offset)); \n }\n \n if (_this.options.hide_nodes && !_this.options.view_show_hiddennodes){\n _this.hiddenNodes = (_this.params.hidden_nodes || []).concat();\n _this.hideNodes();\n } else {\n _this.showNodes(false);\n }\n },\n saveView: function(){\n var _this = this;\n \n var offset = {\n \"x\": _this.offset.x,\n \"y\": _this.offset.y\n };\n \n _this.model = _this.renkan.project.addView( { zoom_level:_this.scale, offset:offset, hidden_nodes: _this.hiddenNodes.concat() } );\n _this.params = {\n \"zoom_level\": _this.model.get(\"zoom_level\"),\n \"offset\": _this.model.get(\"offset\"),\n \"hidden_nodes\": _this.model.get(\"hidden_nodes\")\n };\n \n this.$.find(\".Rk-ZoomSetSaved\").show();\n \n _this.updateUrl();\n },\n addHiddenNode: function(_model){\n this.hideNode(_model);\n this.hiddenNodes.push(_model.id);\n this.updateUrl();\n },\n hideNode: function(_model){\n if (typeof this.renderer.getRepresentationByModel(_model) !== 'undefined'){\n this.renderer.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.renderer.getRepresentationByModel(_this.renkan.project.get(\"nodes\").get(_id)).show(ghost);\n });\n if (!ghost){\n this.hiddenNodes = [];\n }\n paper.view.draw();\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.renderer.redraw();\n this.updateUrl();\n }\n },\n zoomOut: function() {\n var _newScale = this.scale * Math.SQRT1_2,\n _offset = new paper.Point([\n this.renderer.canvas_$.width(),\n this.renderer.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.renderer.canvas_$.width(),\n this.renderer.canvas_$.height()\n ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));\n this.setScale( _newScale, _offset );\n },\n resizeZoom: function(deltaW, deltaH, _ratio) {\n var _newScale = this.scale * _ratio;\n var _offset = new paper.Point([\n (this.renderer.canvas_$.width() * 0.5 * ( 1 - _ratio) ) + (this.offset.x * _ratio + deltaW * _ratio * 0.5 ),\n (this.renderer.canvas_$.height() * 0.5 * ( 1 - _ratio) ) + (this.offset.y * _ratio + deltaH * _ratio * 0.5 )\n ]);\n this.setScale( _newScale, _offset );\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 paperShift: function(_delta) {\n this.offset = this.offset.add(_delta);\n this.renderer.redraw();\n },\n updateUrl: function(){\n if(this.options.url_parameters && this.options.update_url){\n var result = {};\n var parameters = Backbone.history.getFragment().split('?');\n if (parameters.length > 1){\n parameters[1].split(\"&\").forEach(function(part) {\n var item = part.split(\"=\");\n result[item[0]] = decodeURIComponent(item[1]);\n });\n }\n result.view = Math.round(this.offset.x*1000)/1000 + ',' + Math.round(this.offset.y*1000)/1000 + ',' + Math.round(this.scale*1000)/1000;\n\n if (this.renkan.project.get(\"views\").indexOf(this.model) > -1){\n result.viewIndex = this.renkan.project.get(\"views\").indexOf(this.model);\n if (result.viewIndex === this.renkan.project.get(\"views\").length - 1){\n result.viewIndex = -1;\n }\n } else {\n if (result.viewIndex){\n delete result.viewIndex;\n }\n }\n this.renkan.router.navigate(\"?\" + decodeURIComponent($.param(result)), {trigger: false, replace: true});\n }\n },\n destroy: function(_event) {\n this._super(\"destroy\");\n this.showNodes(false);\n }\n }).value();\n\n return ViewRepr;\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 'ckeditor-core':'../lib/ckeditor/ckeditor',\n 'ckeditor-jquery':'../lib/ckeditor/adapters/jquery',\n 'screenfull':'../lib/screenfull/screenfull-umd'\n },\n shim: {\n 'ckeditor-jquery':{\n deps:['jquery','ckeditor-core']\n }\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 'renderer/viewrepr'\n ], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeHideButton, NodeShowButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene, ViewRepr){\n\n 'use strict';\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.View = ViewRepr;\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