--- a/client/js/paper-renderer.js Tue Apr 23 22:30:09 2013 +0200
+++ b/client/js/paper-renderer.js Tue Apr 23 22:53:01 2013 +0200
@@ -22,12 +22,12 @@
get: function(attr) {
return this[attr] || false;
}
- }
+ };
},
_BOOKMARKLET_CODE: function(_renkan) {
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;\">"
+ _renkan.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);})();"
+ + "</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(_text, _maxlength) {
return (_text.length > _maxlength ? (_text.substr(0,_maxlength) + '…') : _text);
@@ -35,7 +35,7 @@
drawEditBox : function(_options, _coords, _path, _xmargin, _selector) {
_selector.css({
width: ( _options.tooltip_width - 2* _options.tooltip_padding ),
- })
+ });
var _height = _selector.outerHeight() + 2* _options.tooltip_padding,
_isLeft = (_coords.x < paper.view.center.x ? 1 : -1),
_left = _coords.x + _isLeft * ( _xmargin + _options.tooltip_arrow_length ),
@@ -75,7 +75,7 @@
});
return _path;
}
-}
+};
Rkns.Renderer._BaseRepresentation = function(_renderer, _model) {
if (typeof _renderer !== "undefined") {
@@ -88,62 +88,62 @@
var _this = this;
this._changeBinding = function() {
_this.redraw();
- }
+ };
this._removeBinding = function() {
_renderer.removeRepresentation(_this);
_(function() {
- _renderer.redraw()
+ _renderer.redraw();
}).defer();
- }
+ };
this._selectBinding = function() {
_this.select();
- }
+ };
this._unselectBinding = function() {
_this.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 );
}
}
-}
+};
Rkns.Renderer._BaseRepresentation.prototype.super = function(_func) {
Rkns.Renderer._BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1));
-}
+};
-Rkns.Renderer._BaseRepresentation.prototype.redraw = function() {}
+Rkns.Renderer._BaseRepresentation.prototype.redraw = function() {};
-Rkns.Renderer._BaseRepresentation.prototype.moveTo = function() {}
+Rkns.Renderer._BaseRepresentation.prototype.moveTo = function() {};
-Rkns.Renderer._BaseRepresentation.prototype.show = function() {}
+Rkns.Renderer._BaseRepresentation.prototype.show = function() {};
-Rkns.Renderer._BaseRepresentation.prototype.hide = function() {}
+Rkns.Renderer._BaseRepresentation.prototype.hide = function() {};
Rkns.Renderer._BaseRepresentation.prototype.select = function() {
if (this.model) {
this.model.trigger("selected");
}
-}
+};
Rkns.Renderer._BaseRepresentation.prototype.unselect = function() {
if (this.model) {
this.model.trigger("unselected");
}
-}
+};
-Rkns.Renderer._BaseRepresentation.prototype.highlight = function() {}
+Rkns.Renderer._BaseRepresentation.prototype.highlight = function() {};
-Rkns.Renderer._BaseRepresentation.prototype.unhighlight = function() {}
+Rkns.Renderer._BaseRepresentation.prototype.unhighlight = function() {};
-Rkns.Renderer._BaseRepresentation.prototype.mousedown = function() {}
+Rkns.Renderer._BaseRepresentation.prototype.mousedown = function() {};
Rkns.Renderer._BaseRepresentation.prototype.mouseup = function() {
if (this.model) {
this.model.trigger("clicked");
}
-}
+};
Rkns.Renderer._BaseRepresentation.prototype.destroy = function() {
if (this.model) {
@@ -152,7 +152,7 @@
this.model.off("select", this._selectBinding );
this.model.off("unselect", this._unselectBinding );
}
-}
+};
/* */
@@ -160,30 +160,30 @@
Rkns.Renderer._BaseButton.prototype.moveTo = function(_pos) {
this.sector.moveTo(_pos);
-}
+};
Rkns.Renderer._BaseButton.prototype.show = function() {
this.sector.show();
-}
+};
Rkns.Renderer._BaseButton.prototype.hide = function() {
this.sector.hide();
-}
+};
Rkns.Renderer._BaseButton.prototype.select = function() {
this.sector.select();
-}
+};
Rkns.Renderer._BaseButton.prototype.unselect = function(_newTarget) {
this.sector.unselect();
if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) {
this.source_representation.unselect();
}
-}
+};
Rkns.Renderer._BaseButton.prototype.destroy = function() {
this.sector.destroy();
-}
+};
/* */
@@ -212,7 +212,7 @@
this.pending_delete_buttons = [
new Rkns.Renderer.NodeRevertButton(this.renderer, null)
];
- this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons)
+ this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);
for (var i = 0; i < this.all_buttons.length; i++) {
this.all_buttons[i].source_representation = this;
}
@@ -228,7 +228,7 @@
this.minimap_circle.__representation = this.renderer.minimap.miniframe.__representation;
this.renderer.minimap.node_group.addChild(this.minimap_circle);
}
-}
+};
Rkns.Renderer.Node.prototype.redraw = function(_dontRedrawEdges) {
var _model_coords = new paper.Point(this.model.get("position")),
@@ -294,7 +294,7 @@
left: this.paper_coords.x,
top: this.paper_coords.y + this.circle_radius * this.h_ratio + this.options.node_label_distance,
opacity: opacity
- })
+ });
var _color = this.model.get("color") || (this.model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(this.renkan)).get("color");
this.circle.strokeColor = _color;
var _pc = this.paper_coords;
@@ -335,7 +335,7 @@
_this.node_image.fitBounds(bounds);
_this.redraw();
paper.view.draw();
- }
+ };
_image.src = _img;
}
this.img = _img;
@@ -361,7 +361,7 @@
}, this);
}
-}
+};
Rkns.Renderer.Node.prototype.paperShift = function(_delta) {
if (this.options.editor_mode) {
@@ -373,14 +373,14 @@
} else {
this.renderer.paperShift(_delta);
}
-}
+};
Rkns.Renderer.Node.prototype.openEditor = function() {
this.renderer.removeRepresentationsOfType("editor");
var _editor = this.renderer.addRepresentation("NodeEditor",null);
_editor.source_representation = this;
_editor.draw();
-}
+};
Rkns.Renderer.Node.prototype.select = function() {
this.selected = true;
@@ -408,7 +408,7 @@
this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
}
this.super("select");
-}
+};
Rkns.Renderer.Node.prototype.unselect = function(_newTarget) {
if (!_newTarget || _newTarget.source_representation !== this) {
@@ -423,7 +423,7 @@
}
this.super("unselect");
}
-}
+};
Rkns.Renderer.Node.prototype.highlight = function() {
if (this.highlighted) {
@@ -432,7 +432,7 @@
this.highlighted = true;
this.redraw();
this.renderer.throttledPaperDraw();
-}
+};
Rkns.Renderer.Node.prototype.unhighlight = function() {
if (!this.highlighted) {
@@ -441,7 +441,7 @@
this.highlighted = false;
this.redraw();
this.renderer.throttledPaperDraw();
-}
+};
Rkns.Renderer.Node.prototype.saveCoords = function() {
var _coords = this.renderer.toModelCoords(this.paper_coords),
@@ -454,14 +454,14 @@
if (this.renderer.isEditable()) {
this.model.set(_data);
}
-}
+};
Rkns.Renderer.Node.prototype.mousedown = function(_event, _isTouch) {
if (_isTouch) {
this.renderer.unselectAll();
this.select();
}
-}
+};
Rkns.Renderer.Node.prototype.mouseup = function(_event, _isTouch) {
if (this.renderer.is_dragging && this.renderer.isEditable()) {
@@ -475,7 +475,7 @@
this.renderer.click_target = null;
this.renderer.is_dragging = false;
this.is_dragging = false;
-}
+};
Rkns.Renderer.Node.prototype.destroy = function(_event) {
this.super("destroy");
@@ -490,7 +490,7 @@
if (this.node_image) {
this.node_image.remove();
}
-}
+};
/* */
@@ -523,7 +523,7 @@
this.pending_delete_buttons = [
new Rkns.Renderer.EdgeRevertButton(this.renderer, null)
];
- this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons)
+ this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);
for (var i = 0; i < this.all_buttons.length; i++) {
this.all_buttons[i].source_representation = this;
}
@@ -539,7 +539,7 @@
this.minimap_line.__representation = this.renderer.minimap.miniframe.__representation;
this.minimap_line.strokeWidth = 1;
}
-}
+};
Rkns.Renderer.Edge.prototype.redraw = function() {
this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from"));
@@ -628,14 +628,14 @@
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")));
}
-}
+};
Rkns.Renderer.Edge.prototype.openEditor = function() {
this.renderer.removeRepresentationsOfType("editor");
var _editor = this.renderer.addRepresentation("EdgeEditor",null);
_editor.source_representation = this;
_editor.draw();
-}
+};
Rkns.Renderer.Edge.prototype.select = function() {
this.selected = true;
@@ -649,7 +649,7 @@
this.openEditor();
}
this.super("select");
-}
+};
Rkns.Renderer.Edge.prototype.unselect = function(_newTarget) {
if (!_newTarget || _newTarget.source_representation !== this) {
@@ -662,14 +662,14 @@
this.line.strokeWidth = this.options.edge_stroke_width;
this.super("unselect");
}
-}
+};
Rkns.Renderer.Edge.prototype.mousedown = function(_event, _isTouch) {
if (_isTouch) {
this.renderer.unselectAll();
this.select();
}
-}
+};
Rkns.Renderer.Edge.prototype.mouseup = function(_event, _isTouch) {
if (!this.renkan.read_only && this.renderer.is_dragging) {
@@ -685,7 +685,7 @@
}
this.renderer.click_target = null;
this.renderer.is_dragging = false;
-}
+};
Rkns.Renderer.Edge.prototype.paperShift = function(_delta) {
if (this.options.editor_mode) {
@@ -696,7 +696,7 @@
} else {
this.renderer.paperShift(_delta);
}
-}
+};
Rkns.Renderer.Edge.prototype.destroy = function() {
this.super("destroy");
@@ -713,7 +713,7 @@
this.bundle.edges = Rkns._(this.bundle.edges).reject(function(_edge) {
return _edge === _this;
});
-}
+};
/* */
@@ -739,7 +739,7 @@
);
this.arrow.__representation = this;
this.arrow_angle = 0;
-}
+};
Rkns.Renderer.TempEdge.prototype.redraw = function() {
var _p0 = this.from_representation.paper_coords,
@@ -751,7 +751,7 @@
this.arrow.rotate(_a - this.arrow_angle);
this.arrow.position = _c;
this.arrow_angle = _a;
-}
+};
Rkns.Renderer.TempEdge.prototype.paperShift = function(_delta) {
if (!this.renderer.isEditable()) {
@@ -763,7 +763,7 @@
var _hitResult = paper.project.hitTest(this.end_pos);
this.renderer.findTarget(_hitResult);
this.redraw();
-}
+};
Rkns.Renderer.TempEdge.prototype.mouseup = function(_event, _isTouch) {
var _hitResult = paper.project.hitTest(_event.point),
@@ -797,12 +797,12 @@
this.renderer.removeRepresentation(this);
paper.view.draw();
}
-}
+};
Rkns.Renderer.TempEdge.prototype.destroy = function() {
this.arrow.remove();
this.line.remove();
-}
+};
/* */
@@ -812,7 +812,7 @@
this.renderer.buttons_layer.activate();
this.type = "editor";
this.editor_block = new paper.Path();
- var _pts = Rkns._(Rkns._.range(8)).map(function() {return [0,0]});
+ var _pts = Rkns._(Rkns._.range(8)).map(function() {return [0,0];});
this.editor_block.add.apply(this.editor_block, _pts);
this.editor_block.strokeWidth = this.options.tooltip_border_width;
this.editor_block.strokeColor = this.options.tooltip_border_color;
@@ -824,12 +824,12 @@
opacity: .8
})
.hide();
-}
+};
Rkns.Renderer._BaseEditor.prototype.destroy = function() {
this.editor_block.remove();
this.editor_$.remove();
-}
+};
/* */
@@ -886,7 +886,7 @@
closeEditor = function() {
_this.renderer.removeRepresentation(_this);
paper.view.draw();
- }
+ };
this.editor_$.find(".Rk-CloseX").click(closeEditor);
@@ -904,7 +904,7 @@
description: _this.editor_$.find(".Rk-Edit-Description").val(),
uri: _uri,
image: _image
- }
+ };
_model.set(_data);
_this.redraw();
} else {
@@ -937,7 +937,7 @@
fr.onload = function(e) {
_this.editor_$.find(".Rk-Edit-Image").val(e.target.result);
onFieldChange();
- }
+ };
fr.readAsDataURL(f);
}
});
@@ -963,7 +963,7 @@
},
function(_e) {
_e.preventDefault();
- _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || (_model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(_this.renkan)).get("color"))
+ _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || (_model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(_this.renkan)).get("color"));
}
).click(function(_e) {
_e.preventDefault();
@@ -999,14 +999,14 @@
this.editor_$.find("img").load(function() {
_this.redraw();
});
-}
+};
Rkns.Renderer.NodeEditor.prototype.redraw = function() {
var _coords = this.source_representation.paper_coords;
Rkns.Renderer.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * .75, this.editor_$);
this.editor_$.show();
paper.view.draw();
-}
+};
/* */
@@ -1069,7 +1069,7 @@
closeEditor = function() {
_this.renderer.removeRepresentation(_this);
paper.view.draw();
- }
+ };
this.editor_$.find(".Rk-CloseX").click(closeEditor);
if (this.renderer.isEditable()) {
@@ -1081,7 +1081,7 @@
var _data = {
title: _this.editor_$.find(".Rk-Edit-Title").val(),
uri: _this.editor_$.find(".Rk-Edit-URI").val()
- }
+ };
_model.set(_data);
paper.view.draw();
} else {
@@ -1139,7 +1139,7 @@
},
function(_e) {
_e.preventDefault();
- _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || (_model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(_this.renkan)).get("color"))
+ _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || (_model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(_this.renkan)).get("color"));
}
).click(function(_e) {
_e.preventDefault();
@@ -1152,14 +1152,14 @@
}
});
}
-}
+};
Rkns.Renderer.EdgeEditor.prototype.redraw = function() {
var _coords = this.source_representation.paper_coords;
Rkns.Renderer.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
this.editor_$.show();
paper.view.draw();
-}
+};
/* */
@@ -1182,7 +1182,7 @@
);
this.lastSectorInner = sectorInner;
}
-}
+};
/* */
@@ -1195,13 +1195,13 @@
this.endAngle = -45;
this.imageName = "edit";
this.text = "Edit";
-}
+};
Rkns.Renderer.NodeEditButton.prototype.mouseup = function() {
if (!this.renderer.is_dragging) {
this.source_representation.openEditor();
}
-}
+};
/* */
@@ -1214,7 +1214,7 @@
this.endAngle = 90;
this.imageName = "remove";
this.text = "Remove";
-}
+};
Rkns.Renderer.NodeRemoveButton.prototype.mouseup = function() {
this.renderer.click_target = null;
@@ -1228,7 +1228,7 @@
});
this.source_representation.model.set("delete_scheduled", delid);
}
-}
+};
/* */
@@ -1241,7 +1241,7 @@
this.endAngle = 135;
this.imageName = "revert";
this.text = "Cancel deletion";
-}
+};
Rkns.Renderer.NodeRevertButton.prototype.mouseup = function() {
this.renderer.click_target = null;
@@ -1249,7 +1249,7 @@
if (this.renderer.isEditable()) {
this.source_representation.model.unset("delete_scheduled");
}
-}
+};
/* */
@@ -1262,7 +1262,7 @@
this.endAngle = 180;
this.imageName = "link";
this.text = "Link to another node";
-}
+};
Rkns.Renderer.NodeLinkButton.prototype.mousedown = function(_event, _isTouch) {
if (this.renderer.isEditable()) {
@@ -1275,7 +1275,7 @@
this.renderer.removeRepresentationsOfType("editor");
this.renderer.addTempEdge(this.source_representation, _point);
}
-}
+};
/* */
@@ -1288,7 +1288,7 @@
this.endAngle = 0;
this.imageName = "enlarge";
this.text = "Enlarge";
-}
+};
Rkns.Renderer.NodeEnlargeButton.prototype.mouseup = function() {
var _newsize = 1 + (this.source_representation.model.get("size") || 0);
@@ -1296,7 +1296,7 @@
this.source_representation.select();
this.select();
paper.view.draw();
-}
+};
/* */
@@ -1309,7 +1309,7 @@
this.endAngle = -135;
this.imageName = "shrink";
this.text = "Shrink";
-}
+};
Rkns.Renderer.NodeShrinkButton.prototype.mouseup = function() {
var _newsize = -1 + (this.source_representation.model.get("size") || 0);
@@ -1317,7 +1317,7 @@
this.source_representation.select();
this.select();
paper.view.draw();
-}
+};
/* */
@@ -1326,13 +1326,13 @@
Rkns.Renderer.EdgeEditButton.prototype._init = function() {
this.type = "Edge-edit-button";
this.sector = this.renderer.drawSector(this, Rkns.Renderer._EDGE_BUTTON_INNER, Rkns.Renderer._EDGE_BUTTON_OUTER, -270, -90, 1, "edit", this.renkan.translate("Edit"));
-}
+};
Rkns.Renderer.EdgeEditButton.prototype.mouseup = function() {
if (!this.renderer.is_dragging) {
this.source_representation.openEditor();
}
-}
+};
/* */
@@ -1341,7 +1341,7 @@
Rkns.Renderer.EdgeRemoveButton.prototype._init = function() {
this.type = "Edge-remove-button";
this.sector = this.renderer.drawSector(this, Rkns.Renderer._EDGE_BUTTON_INNER, Rkns.Renderer._EDGE_BUTTON_OUTER, -90, 90, 1, "remove", this.renkan.translate("Remove"));
-}
+};
Rkns.Renderer.EdgeRemoveButton.prototype.mouseup = function() {
this.renderer.click_target = null;
@@ -1355,7 +1355,7 @@
});
this.source_representation.model.set("delete_scheduled", delid);
}
-}
+};
/* */
@@ -1364,7 +1364,7 @@
Rkns.Renderer.EdgeRevertButton.prototype._init = function() {
this.type = "Edge-revert-button";
this.sector = this.renderer.drawSector(this, Rkns.Renderer._EDGE_BUTTON_INNER, Rkns.Renderer._EDGE_BUTTON_OUTER, -135, 135, 1, "revert", this.renkan.translate("Cancel deletion"));
-}
+};
Rkns.Renderer.EdgeRevertButton.prototype.mouseup = function() {
this.renderer.click_target = null;
@@ -1372,7 +1372,7 @@
if (this.renderer.isEditable()) {
this.source_representation.model.unset("delete_scheduled");
}
-}
+};
/* */
@@ -1381,12 +1381,12 @@
Rkns.Renderer.MiniFrame.prototype.paperShift = function(_delta) {
this.renderer.offset = this.renderer.offset.subtract(_delta.divide(this.renderer.minimap.scale).multiply(this.renderer.scale));
this.renderer.redraw();
-}
+};
Rkns.Renderer.MiniFrame.prototype.mouseup = function(_delta) {
this.renderer.click_target = null;
this.renderer.is_dragging = false;
-}
+};
/* */
@@ -1419,7 +1419,7 @@
node_layer: new paper.Layer(),
node_group: new paper.Group(),
size: new paper.Size( _renkan.options.minimap_width, _renkan.options.minimap_height )
- }
+ };
this.minimap.background_layer.activate();
this.minimap.topleft = paper.view.bounds.bottomRight.subtract(this.minimap.size);
@@ -1618,7 +1618,7 @@
_this.setScale( _newScale, _offset );
});
this.$.find(".Rk-CurrentUser").mouseenter(
- function() { _this.$.find(".Rk-UserList").slideDown() }
+ function() { _this.$.find(".Rk-UserList").slideDown(); }
);
this.$.find(".Rk-Users").mouseleave(
function() { _this.$.find(".Rk-UserList").slideUp(); }
@@ -1699,12 +1699,12 @@
paper.view.onResize = function(_event) {
_this.offset = _this.offset.add(_event.delta.divide(2));
if (_this.minimap) {
- _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size)
+ _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);
}
_this.redraw();
- }
+ };
var _thRedraw = Rkns._.throttle(function() {
_this.redraw();
@@ -1718,7 +1718,7 @@
this.$.find(".Rk-PadTitle").on("keyup input paste", function() {
_renkan.project.set({"title": $(this).val()});
- })
+ });
this.renkan.project.get("users").each(function(_user) {
_this.addUser(_user);
@@ -1783,17 +1783,17 @@
}
});
_this.delete_list = _this.delete_list.filter(function(d) {
- return _renkan.project.get("nodes").findWhere({"delete_scheduled":d.id}) || _renkan.project.get("edges").findWhere({"delete_scheduled":d.id})
+ return _renkan.project.get("nodes").findWhere({"delete_scheduled":d.id}) || _renkan.project.get("edges").findWhere({"delete_scheduled":d.id});
});
}, 500);
if (this.minimap) {
window.setInterval(function() {
- _this.rescaleMinimap()
+ _this.rescaleMinimap();
}, 2000);
}
-}
+};
Rkns.Renderer.Scene.prototype.template = Rkns._.template(
'<% if (options.show_top_bar) { %><div class="Rk-TopBar"><% if (!options.editor_mode) { %><h2 class="Rk-PadTitle"><%- project.get("title") || translate("Untitled project")%></h2>'
@@ -1831,7 +1831,7 @@
if (_autoscale) {
this.autoScale();
}
-}
+};
Rkns.Renderer.Scene.prototype.drawSector = function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) {
var _options = this.renkan.options,
@@ -1922,7 +1922,7 @@
destroy: function() {
_grp.remove();
}
- }
+ };
function showImage() {
var _raster = new paper.Raster(_img);
_raster.position = _imgdelta.add(_grp.position).subtract(_delta);
@@ -1934,8 +1934,8 @@
Rkns.$(_img).on("load",showImage);
}
- return _res
-}
+ return _res;
+};
Rkns.Renderer.Scene.prototype.addToBundles = function(_edgeRepr) {
var _bundle = Rkns._(this.bundles).find(function(_bundle) {
@@ -1945,7 +1945,7 @@
);
});
if (typeof _bundle !== "undefined") {
- _bundle.edges.push(_edgeRepr)
+ _bundle.edges.push(_edgeRepr);
} else {
_bundle = {
from: _edgeRepr.from_representation,
@@ -1955,15 +1955,15 @@
var _dir = (_er.from_representation === this.from) ? 1 : -1;
return _dir * ( Rkns._(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 );
}
- }
+ };
this.bundles.push(_bundle);
}
return _bundle;
-}
+};
Rkns.Renderer.Scene.prototype.isEditable = function() {
- return (this.renkan.options.editor_mode && !this.renkan.read_only)
-}
+ return (this.renkan.options.editor_mode && !this.renkan.read_only);
+};
Rkns.Renderer.Scene.prototype.onStatusChange = function() {
var savebtn = this.$.find(".Rk-Save-Button"),
@@ -1980,23 +1980,23 @@
tip.text(this.renkan.translate("Auto-save enabled"));
}
}
-}
+};
Rkns.Renderer.Scene.prototype.setScale = function(_newScale, _offset) {
if (_newScale > Rkns.Renderer._MIN_SCALE && _newScale < Rkns.Renderer._MAX_SCALE) {
this.scale = _newScale;
if (_offset) {
- this.offset = _offset
+ this.offset = _offset;
}
this.redraw();
}
-}
+};
Rkns.Renderer.Scene.prototype.autoScale = function() {
- var nodes = this.renkan.project.get("nodes")
+ var nodes = this.renkan.project.get("nodes");
if (nodes.length > 1) {
- var _xx = nodes.map(function(_node) { return _node.get("position").x }),
- _yy = nodes.map(function(_node) { return _node.get("position").y }),
+ var _xx = nodes.map(function(_node) { return _node.get("position").x; }),
+ _yy = nodes.map(function(_node) { return _node.get("position").y; }),
_minx = Math.min.apply(Math, _xx),
_miny = Math.min.apply(Math, _yy),
_maxx = Math.max.apply(Math, _xx),
@@ -2007,19 +2007,19 @@
if (nodes.length === 1) {
this.setScale(1, paper.view.center.subtract(new paper.Point([nodes.at(0).get("position").x, nodes.at(0).get("position").y])));
}
-}
+};
Rkns.Renderer.Scene.prototype.redrawMiniframe = function() {
var topleft = this.toMinimapCoords(this.toModelCoords(new paper.Point([0,0]))),
bottomright = this.toMinimapCoords(this.toModelCoords(paper.view.bounds.bottomRight));
this.minimap.miniframe.fitBounds(topleft, bottomright);
-}
+};
Rkns.Renderer.Scene.prototype.rescaleMinimap = function() {
- var nodes = this.renkan.project.get("nodes")
+ var nodes = this.renkan.project.get("nodes");
if (nodes.length > 1) {
- var _xx = nodes.map(function(_node) { return _node.get("position").x }),
- _yy = nodes.map(function(_node) { return _node.get("position").y }),
+ var _xx = nodes.map(function(_node) { return _node.get("position").x; }),
+ _yy = nodes.map(function(_node) { return _node.get("position").y; }),
_minx = Math.min.apply(Math, _xx),
_miny = Math.min.apply(Math, _yy),
_maxx = Math.max.apply(Math, _xx),
@@ -2038,32 +2038,32 @@
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));
}
this.redraw();
-}
+};
Rkns.Renderer.Scene.prototype.toPaperCoords = function(_point) {
return _point.multiply(this.scale).add(this.offset);
-}
+};
Rkns.Renderer.Scene.prototype.toMinimapCoords = function(_point) {
return _point.multiply(this.minimap.scale).add(this.minimap.offset).add(this.minimap.topleft);
-}
+};
Rkns.Renderer.Scene.prototype.toModelCoords = function(_point) {
return _point.subtract(this.offset).divide(this.scale);
-}
+};
Rkns.Renderer.Scene.prototype.addRepresentation = function(_type, _model) {
var _repr = new Rkns.Renderer[_type](this, _model);
this.representations.push(_repr);
return _repr;
-}
+};
Rkns.Renderer.Scene.prototype.addRepresentations = function(_type, _collection) {
var _this = this;
_collection.forEach(function(_model) {
_this.addRepresentation(_type, _model);
});
-}
+};
Rkns.Renderer.Scene.prototype.userTemplate = Rkns._.template(
'<li class="Rk-User"><span class="Rk-UserColor" style="background:<%=background%>;"></span><%=name%></li>'
@@ -2083,22 +2083,22 @@
)
);
}
-}
+};
Rkns.Renderer.Scene.prototype.removeRepresentation = function(_representation) {
_representation.destroy();
this.representations = Rkns._(this.representations).reject(
function(_repr) {
- return _repr == _representation
+ return _repr == _representation;
}
);
-}
+};
Rkns.Renderer.Scene.prototype.getRepresentationByModel = function(_model) {
return Rkns._(this.representations).find(function(_repr) {
return _repr.model === _model;
});
-}
+};
Rkns.Renderer.Scene.prototype.removeRepresentationsOfType = function(_type) {
var _representations = Rkns._(this.representations).filter(function(_repr) {
@@ -2108,26 +2108,26 @@
Rkns._(_representations).each(function(_repr) {
_this.removeRepresentation(_repr);
});
-}
+};
Rkns.Renderer.Scene.prototype.highlightModel = function(_model) {
var _repr = this.getRepresentationByModel(_model);
if (_repr) {
_repr.highlight();
}
-}
+};
Rkns.Renderer.Scene.prototype.unhighlightAll = function(_model) {
Rkns._(this.representations).each(function(_repr) {
_repr.unhighlight();
});
-}
+};
Rkns.Renderer.Scene.prototype.unselectAll = function(_model) {
Rkns._(this.representations).each(function(_repr) {
_repr.unselect();
});
-}
+};
Rkns.Renderer.Scene.prototype.redraw = function() {
Rkns._(this.representations).each(function(_representation) {
@@ -2137,7 +2137,7 @@
this.redrawMiniframe();
}
paper.view.draw();
-}
+};
Rkns.Renderer.Scene.prototype.addTempEdge = function(_from, _point) {
var _tmpEdge = this.addRepresentation("TempEdge",null);
@@ -2145,7 +2145,7 @@
_tmpEdge.from_representation = _from;
_tmpEdge.redraw();
this.click_target = _tmpEdge;
-}
+};
Rkns.Renderer.Scene.prototype.findTarget = function(_hitResult) {
if (_hitResult && typeof _hitResult.item.__representation !== "undefined") {
@@ -2163,12 +2163,12 @@
}
this.selected_target = null;
}
-}
+};
Rkns.Renderer.Scene.prototype.paperShift = function(_delta) {
this.offset = this.offset.add(_delta);
this.redraw();
-}
+};
Rkns.Renderer.Scene.prototype.onMouseMove = function(_event) {
var _off = this.canvas_$.offset(),
@@ -2192,7 +2192,7 @@
this.findTarget(_hitResult);
}
paper.view.draw();
-}
+};
Rkns.Renderer.Scene.prototype.onMouseDown = function(_event, _isTouch) {
var _off = this.canvas_$.offset(),
@@ -2240,7 +2240,7 @@
}
}
paper.view.draw();
-}
+};
Rkns.Renderer.Scene.prototype.onMouseUp = function(_event, _isTouch) {
this.mouse_down = false;
@@ -2263,7 +2263,7 @@
}
}
paper.view.draw();
-}
+};
Rkns.Renderer.Scene.prototype.onScroll = function(_event, _scrolldelta) {
this.totalScroll += _scrolldelta;
@@ -2280,7 +2280,7 @@
}
this.totalScroll = 0;
}
-}
+};
Rkns.Renderer.Scene.prototype.onDoubleClick = function(_event) {
if (!this.isEditable()) {
@@ -2306,7 +2306,7 @@
this.getRepresentationByModel(_node).openEditor();
}
paper.view.draw();
-}
+};
Rkns.Renderer.Scene.prototype.dropData = function(_data, _event) {
if (!this.isEditable()) {
@@ -2323,7 +2323,7 @@
switch(_data["text/x-iri-specific-site"]) {
case "twitter":
var snippet = Rkns.$('<div>').html(_data["text/x-iri-selected-html"]),
- tweetdiv = snippet.find(".tweet")
+ tweetdiv = snippet.find(".tweet");
newNode.title = _renkan.translate("Tweet by ") + tweetdiv.attr("data-name");
newNode.uri = "http://twitter.com/" + tweetdiv.attr("data-screen-name") + "/status/" + tweetdiv.attr("data-tweet-id");
newNode.image = tweetdiv.find(".avatar").attr("src");
@@ -2412,4 +2412,4 @@
if (_event.type === "drop") {
_repr.openEditor();
}
-}
+};