--- a/client/gruntfile.js Fri May 16 12:37:51 2014 +0200
+++ b/client/gruntfile.js Fri May 16 14:09:57 2014 +0200
@@ -97,6 +97,15 @@
}
},
jshint: {
+ options: {
+ curly: true,
+ eqeqeq: true,
+ eqnull: true,
+ browser: true,
+ globals: {
+ jQuery: true
+ },
+ },
all: ['Gruntfile.js', 'js/**/*.js']
},
connect: {
@@ -123,7 +132,7 @@
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task(s).
- grunt.registerTask('default', ['requirejs', 'concat', 'uglify', 'cssmin', 'copy', 'clean:renderer']);
+ grunt.registerTask('default', ['jshint', 'requirejs', 'concat', 'uglify', 'cssmin', 'copy', 'clean:renderer']);
};
--- a/client/js/build-renderer.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/build-renderer.js Fri May 16 14:09:57 2014 +0200
@@ -1,5 +1,4 @@
/* main-require.js */
-"use strict";
//Load modules and use them
if( typeof require.config === "function" ) {
require.config({
@@ -33,6 +32,8 @@
'renderer/scene'
], function(BaseRepresentation, BaseButton, NodeRepr, Edge, TempEdge, BaseEditor, NodeEditor, EdgeEditor, NodeButton, NodeEditButton, NodeRemoveButton, NodeRevertButton, NodeLinkButton, NodeEnlargeButton, NodeShrinkButton, EdgeEditButton, EdgeRemoveButton, EdgeRevertButton, MiniFrame, Scene){
+ 'use strict';
+
var Rkns = window.Rkns;
if(typeof Rkns.Renderer === "undefined"){
@@ -43,7 +44,7 @@
Renderer._BaseRepresentation = BaseRepresentation;
Renderer._BaseButton = BaseButton;
Renderer.Node = NodeRepr;
- Renderer.Edge = Edge
+ Renderer.Edge = Edge;
Renderer.TempEdge = TempEdge;
Renderer._BaseEditor = BaseEditor;
Renderer.NodeEditor = NodeEditor;
--- a/client/js/full-json.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/full-json.js Fri May 16 14:09:57 2014 +0200
@@ -2,7 +2,7 @@
Rkns.jsonIO = function(_renkan, _opts) {
var _proj = _renkan.project;
- if (typeof _opts.http_method == "undefined") {
+ if (typeof _opts.http_method === "undefined") {
_opts.http_method = 'PUT';
}
var _load = function() {
@@ -23,7 +23,7 @@
}
});
}
-
+
};
var _thrSave = Rkns._.throttle(
function() {
@@ -38,6 +38,6 @@
_proj.on("change", function() {
_thrSave();
});
-
+
_load();
};
--- a/client/js/ldtjson-bin.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/ldtjson-bin.js Fri May 16 14:09:57 2014 +0200
@@ -7,9 +7,9 @@
var Bin = Ldt.Bin = function(_renkan, _opts) {
if (_opts.ldt_type) {
- var resclass = Ldt[_opts.ldt_type+"Bin"];
- if (resclass) {
- return new resclass(_renkan, _opts);
+ var Resclass = Ldt[_opts.ldt_type+"Bin"];
+ if (Resclass) {
+ return new Resclass(_renkan, _opts);
}
}
console.error("No such LDT Bin Type");
@@ -18,13 +18,13 @@
var ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin);
ProjectBin.prototype.tagTemplate = _.template(
- '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(static_url+\'img/ldt-tag.png\') %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/search/?search=<%=encodedtitle%>&field=all" data-title="<%-title%>" data-description="Tag \'<%-title%>\'">'
- + '<img class="Rk-Ldt-Tag-Icon" src="<%-static_url%>img/ldt-tag.png" /><h4><%=htitle%></h4><div class="Rk-Clear"></div></li>'
+ '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(static_url+\'img/ldt-tag.png\') %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/search/?search=<%=encodedtitle%>&field=all" data-title="<%-title%>" data-description="Tag \'<%-title%>\'">' +
+ '<img class="Rk-Ldt-Tag-Icon" src="<%-static_url%>img/ldt-tag.png" /><h4><%=htitle%></h4><div class="Rk-Clear"></div></li>'
);
ProjectBin.prototype.annotationTemplate = _.template(
- '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">'
- + '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>'
+ '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' +
+ '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>'
);
ProjectBin.prototype._init = function(_renkan, _opts) {
@@ -61,7 +61,7 @@
_res += pad(_minutes) + ':' + pad(_seconds);
return _res;
}
-
+
var _html = '<li><h3>Tags</h3></li>',
_projtitle = this.data.meta["dc:title"],
_this = this,
@@ -91,9 +91,9 @@
count++;
var _duration = _annotation.end - _annotation.begin,
_img = (
- (_annotation.content && _annotation.content.img && _annotation.content.img.src)
- ? _annotation.content.img.src
- : ( _duration ? _this.renkan.options.static_url+"img/ldt-segment.png" : _this.renkan.options.static_url+"img/ldt-point.png" )
+ (_annotation.content && _annotation.content.img && _annotation.content.img.src) ?
+ _annotation.content.img.src :
+ ( _duration ? _this.renkan.options.static_url+"img/ldt-segment.png" : _this.renkan.options.static_url+"img/ldt-point.png" )
);
_html += _this.annotationTemplate({
ldt_platform: _this.ldt_platform,
@@ -110,7 +110,7 @@
static_url: _this.renkan.options.static_url
});
});
-
+
this.main_$.html(_html);
if (!search.isempty && count) {
this.count_$.text(count).show();
@@ -161,8 +161,8 @@
var ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin);
ResultsBin.prototype.segmentTemplate = _.template(
- '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">'
- + '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>'
+ '<li class="Rk-Bin-Item" draggable="true" data-image="<%- Rkns.Utils.getFullURL(image) %>" data-uri="<%=ldt_platform%>ldtplatform/ldt/front/player/<%=mediaid%>/#id=<%=annotationid%>" data-title="<%-title%>" data-description="<%-description%>">' +
+ '<img class="Rk-Ldt-Annotation-Icon" src="<%=image%>"/><h4><%=htitle%></h4><p><%=hdescription%></p><p>Start: <%=start%>, End: <%=end%>, Duration: <%=duration%></p><div class="Rk-Clear"></div></li>'
);
ResultsBin.prototype._init = function(_renkan, _opts) {
@@ -203,12 +203,12 @@
_res += pad(_minutes) + ':' + pad(_seconds);
return _res;
}
-
+
var _html = '',
_this = this,
count = 0;
_(this.data.objects).each(function(_segment) {
- var _description = _segment['abstract'],
+ var _description = _segment.abstract,
_title = _segment.title;
if (!search.isempty && !search.test(_title) && !search.test(_description)) {
return;
@@ -218,9 +218,9 @@
_begin = _segment.start_ts,
_end = + _segment.duration + _begin,
_img = (
- _duration
- ? _this.renkan.options.static_url + "img/ldt-segment.png"
- : _this.renkan.options.static_url + "img/ldt-point.png"
+ _duration ?
+ _this.renkan.options.static_url + "img/ldt-segment.png" :
+ _this.renkan.options.static_url + "img/ldt-point.png"
);
_html += _this.segmentTemplate({
ldt_platform: _this.ldt_platform,
@@ -238,7 +238,7 @@
image: _img
});
});
-
+
this.main_$.html(_html);
if (!search.isempty && count) {
this.count_$.text(count).show();
--- a/client/js/list-bin.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/list-bin.js Fri May 16 14:09:57 2014 +0200
@@ -3,12 +3,12 @@
Rkns.ResourceList.Bin = Rkns.Utils.inherit(Rkns._BaseBin);
Rkns.ResourceList.Bin.prototype.resultTemplate = Rkns._.template(
- '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true" data-uri="<%-url%>" '
- + 'data-title="<%-title%>" data-description="<%-description%>" '
- + '<% if (image) { %>data-image="<%- Rkns.Utils.getFullURL(image) %>"<% } else { %>data-image=""<% } %> >'
- + '<% if (image) { %><img class="Rk-ResourceList-Image" src="<%-image%>"/><% } %><h4 class="Rk-ResourceList-Title">'
- + '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>'
- + '<% if (description) { %><p class="Rk-ResourceList-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
+ '<li class="Rk-Bin-Item Rk-ResourceList-Item" draggable="true" data-uri="<%-url%>" ' +
+ 'data-title="<%-title%>" data-description="<%-description%>" ' +
+ '<% if (image) { %>data-image="<%- Rkns.Utils.getFullURL(image) %>"<% } else { %>data-image=""<% } %> >' +
+ '<% if (image) { %><img class="Rk-ResourceList-Image" src="<%-image%>"/><% } %><h4 class="Rk-ResourceList-Title">' +
+ '<% if (url) { %><a href="<%-url%>" target="_blank"><% } %><%=htitle%><% if (url) { %></a><% } %></h4>' +
+ '<% if (description) { %><p class="Rk-ResourceList-Description"><%=hdescription%></p><% } %><% if (image) { %><div style="clear: both;"></div><% } %></li>'
);
Rkns.ResourceList.Bin.prototype._init = function(_renkan, _opts) {
@@ -30,12 +30,13 @@
_this = this,
count = 0;
Rkns._(this.data).each(function(_item) {
+ var _element;
if (typeof _item === "string") {
if (/^(https?:\/\/|www)/.test(_item)) {
- var _element = { url: _item };
+ _element = { url: _item };
} else {
- var _element = { title: _item.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,'').trim() },
- _match = _item.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);
+ _element = { title: _item.replace(/[:,]?\s?(https?:\/\/|www)[\d\w\/.&?=#%-_]+\s?/,'').trim() };
+ var _match = _item.match(/(https?:\/\/|www)[\d\w\/.&?=#%-_]+/);
if (_match) {
_element.url = _match[0];
}
@@ -45,7 +46,7 @@
}
}
} else {
- var _element = _item;
+ _element = _item;
}
var title = _element.title || (_element.url || "").replace(/^https?:\/\/(www\.)?/,'').replace(/^(.{40}).+$/,'$1…'),
url = _element.url || "",
@@ -81,9 +82,9 @@
}
this.renkan.resizeBins();
};
-
+
Rkns.ResourceList.Bin.prototype.refresh = function() {
if (this.data) {
this.render();
}
-};
\ No newline at end of file
+};
--- a/client/js/main.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/main.js Fri May 16 14:09:57 2014 +0200
@@ -34,9 +34,9 @@
this.title_icon_$ = Rkns.$('<span>')
.addClass("Rk-Bin-Title-Icon")
.appendTo(this.$);
-
+
var _this = this;
-
+
Rkns.$('<a>')
.attr({
href: "#",
@@ -76,7 +76,7 @@
.html('<h4 class="Rk-Bin-Loading">' + _renkan.translate("Loading, please wait") + '</h4>');
this.title_$.html(_opts.title || '(new bin)');
this.renkan.resizeBins();
-
+
if (_opts.auto_refresh) {
window.setInterval(function() {
_this.refresh();
@@ -94,21 +94,21 @@
var Renkan = Rkns.Renkan = function(_opts) {
var _this = this;
-
+
Rkns.__renkans.push(this);
-
+
this.options = _.defaults(_opts, Rkns.defaults);
-
+
_(this.options.property_files).each(function(f) {
Rkns.$.getJSON(f, function(data) {
_this.options.properties = _this.options.properties.concat(data);
});
});
-
+
this.read_only = this.options.read_only || !this.options.editor_mode;
this.project = new Rkns.Models.Project();
-
+
if (typeof this.options.user_id !== "undefined") {
this.current_user = this.options.user_id;
}
@@ -116,27 +116,27 @@
this.$
.addClass("Rk-Main")
.html(this.template(this));
-
+
this.tabs = [];
this.search_engines = [];
this.current_user_list = new Rkns.Models.UsersList();
-
+
this.current_user_list.on("add remove", function() {
if (this.renderer) {
this.renderer.redrawUsers();
}
});
-
+
this.colorPicker = (function() {
var _tmpl = _.template('<li data-color="<%=c%>" style="background: <%=c%>"></li>');
- return '<ul class="Rk-Edit-ColorPicker">' + Rkns.pickerColors.map(function(c) { return _tmpl({c:c})}).join("") + '</ul>'
+ return '<ul class="Rk-Edit-ColorPicker">' + Rkns.pickerColors.map(function(c) { return _tmpl({c:c});}).join("") + '</ul>';
})();
-
+
if (this.options.show_editor) {
this.renderer = new Rkns.Renderer.Scene(this);
}
-
+
if (!this.options.search.length) {
this.$.find(".Rk-Web-Search-Form").detach();
} else {
@@ -183,9 +183,9 @@
_this.tabs.push(new Rkns[_bin.type].Bin(_this, _bin));
}
});
-
+
var elementDropped = false;
-
+
this.$.find(".Rk-Bins")
.on("click",".Rk-Bin-Title,.Rk-Bin-Title-Icon", function() {
var _mainDiv = Rkns.$(this).siblings(".Rk-Bin-Main");
@@ -194,9 +194,9 @@
_mainDiv.slideDown();
}
});
-
+
if (this.options.show_editor) {
-
+
this.$.find(".Rk-Bins").on("mouseover", ".Rk-Bin-Item", function(_e) {
var _t = Rkns.$(this);
if (_t && $(_t).attr("data-uri")) {
@@ -248,15 +248,15 @@
e.originalEvent.dataTransfer.setData("text",div.innerHTML);
}
});
-
+
}
-
+
Rkns.$(window).resize(function() {
_this.resizeBins();
});
-
+
var lastsearch = false, lastval = '';
-
+
this.$.find(".Rk-Bins-Search-Input").on("change keyup paste input", function() {
var val = Rkns.$(this).val();
if (val === lastval) {
@@ -270,23 +270,23 @@
_(_this.tabs).each(function(tab) {
tab.render(search);
});
-
+
});
this.$.find(".Rk-Bins-Search-Form").submit(function() {
return false;
});
-
+
};
Renkan.prototype.template = _.template(
- '<% if (options.show_bins) { %><div class="Rk-Bins"><div class="Rk-Bins-Head"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>'
- + '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search the Web") %>" />'
- + '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>'
- + '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" title="<%- translate("Search the Web") %>" /></form>'
- + '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search in Bins") %>" />'
- + '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" title="<%- translate("Search in Bins") %>" /></form></div>'
- + '<ul class="Rk-Bin-List"></ul></div><% } %>'
- + '<% if (options.show_editor) { %><div class="Rk-Render Rk-Render-<% if (options.show_bins) { %>Panel<% } else { %>Full<% } %>"></div><% } %>'
+ '<% if (options.show_bins) { %><div class="Rk-Bins"><div class="Rk-Bins-Head"><h2 class="Rk-Bins-Title"><%- translate("Select contents:")%></h2>' +
+ '<form class="Rk-Web-Search-Form Rk-Search-Form"><input class="Rk-Web-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search the Web") %>" />' +
+ '<div class="Rk-Search-Select"><div class="Rk-Search-Current"></div><ul class="Rk-Search-List"></ul></div>' +
+ '<input type="submit" value="" class="Rk-Web-Search-Submit Rk-Search-Submit" title="<%- translate("Search the Web") %>" /></form>' +
+ '<form class="Rk-Bins-Search-Form Rk-Search-Form"><input class="Rk-Bins-Search-Input Rk-Search-Input" type="search" placeholder="<%- translate("Search in Bins") %>" />' +
+ '<input type="submit" value="" class="Rk-Bins-Search-Submit Rk-Search-Submit" title="<%- translate("Search in Bins") %>" /></form></div>' +
+ '<ul class="Rk-Bin-List"></ul></div><% } %>' +
+ '<% if (options.show_editor) { %><div class="Rk-Render Rk-Render-<% if (options.show_bins) { %>Panel<% } else { %>Full<% } %>"></div><% } %>'
);
Renkan.prototype.translate = function(_text) {
@@ -327,26 +327,26 @@
}
function fillrand() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+ var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
var _d = new Date(),
ID_AUTO_INCREMENT = 0,
- ID_BASE = _d.getUTCFullYear() + '-'
- + pad(_d.getUTCMonth()+1) + '-'
- + pad(_d.getUTCDate()) + '-'
- + fillrand();
+ ID_BASE = _d.getUTCFullYear() + '-' +
+ pad(_d.getUTCMonth()+1) + '-' +
+ pad(_d.getUTCDate()) + '-' +
+ fillrand();
return function(_base) {
var _n = (++ID_AUTO_INCREMENT).toString(16),
- _base = (typeof _base === "undefined" ? "" : _base + "-" );
+ _uidbase = (typeof _base === "undefined" ? "" : _base + "-" );
while (_n.length < 4) { _n = '0' + _n; }
- return _base + ID_BASE + '-' + _n;
- }
+ return _uidbase + ID_BASE + '-' + _n;
+ };
})(),
getFullURL : function(url) {
-
- if(typeof(url) == 'undefined' || url == null ) {
+
+ if(typeof(url) === 'undefined' || url == null ) {
return "";
}
if(/https?:\/\//.test(url)) {
@@ -357,24 +357,24 @@
var res = img.src;
img.src = null;
return res;
-
+
},
inherit : function(_baseClass, _callbefore) {
-
+
var _class = function(_arg) {
if (typeof _callbefore === "function") {
_callbefore.apply(this, Array.prototype.slice.call(arguments, 0));
}
_baseClass.apply(this, Array.prototype.slice.call(arguments, 0));
- if (typeof this._init == "function" && !this._initialized) {
+ if (typeof this._init === "function" && !this._initialized) {
this._init.apply(this, Array.prototype.slice.call(arguments, 0));
this._initialized = true;
}
};
_(_class.prototype).extend(_baseClass.prototype);
-
+
return _class;
-
+
},
regexpFromTextOrArray: (function() {
var charsub = [
@@ -395,22 +395,25 @@
charsrx = _(charsub).map(function(c) {
return new RegExp(c);
});
-
+
function replaceText(_text) {
var txt = _text.toLowerCase().replace(remrx,""), src = "";
+ function makeReplaceFunc(l) {
+ return function(k,v) {
+ l = l.replace(charsrx[k], v);
+ };
+ }
for (var j = 0; j < txt.length; j++) {
if (j) {
src += remsrc + "*";
}
var l = txt[j];
- _(charsub).each(function(v, k) {
- l = l.replace(charsrx[k], v);
- });
+ _(charsub).each(makeReplaceFunc(l));
src += l;
}
return src;
}
-
+
function getSource(inp) {
switch (typeof inp) {
case "string":
@@ -430,27 +433,27 @@
}
return '';
}
-
+
return function(_textOrArray) {
var source = getSource(_textOrArray);
if (source) {
var testrx = new RegExp( source, "im"),
- replacerx = new RegExp( '(' + source + ')', "igm")
+ replacerx = new RegExp( '(' + source + ')', "igm");
return {
isempty: false,
source: source,
- test: function(_t) { return testrx.test(_t) },
+ test: function(_t) { return testrx.test(_t); },
replace: function(_text, _replace) { return _text.replace(replacerx, _replace); }
- }
+ };
} else {
return {
isempty: true,
source: '',
- test: function() { return true },
- replace: function(_text) { return text }
- }
+ test: function() { return true; },
+ replace: function(_text) { return text; }
+ };
}
- }
+ };
})(),
/* The minimum distance (in pixels) the mouse has to move to consider an element was dragged */
_MIN_DRAG_DISTANCE: 2,
@@ -486,9 +489,9 @@
* it doesn't seem that it's still a requirement in newer browsers (i.e. the ones compatibles with canvas drawing)
*/
_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);})();";
+ 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);})();";
},
/* Shortens text to the required length then adds ellipsis */
shortenText: function(_text, _maxlength) {
@@ -512,23 +515,24 @@
_top = Math.min( _options.tooltip_margin, _coords.y - _options.tooltip_arrow_width / 2 );
}
var _bottom = _top + _height;
+ /* jshint laxbreak:true */
_path.segments[0].point
- = _path.segments[7].point
- = _coords.add([_isLeft * _xmargin, 0]);
+ = _path.segments[7].point
+ = _coords.add([_isLeft * _xmargin, 0]);
_path.segments[1].point.x
- = _path.segments[2].point.x
- = _path.segments[5].point.x
- = _path.segments[6].point.x
- = _left;
+ = _path.segments[2].point.x
+ = _path.segments[5].point.x
+ = _path.segments[6].point.x
+ = _left;
_path.segments[3].point.x
- = _path.segments[4].point.x
- = _right;
+ = _path.segments[4].point.x
+ = _right;
_path.segments[2].point.y
- = _path.segments[3].point.y
- = _top;
+ = _path.segments[3].point.y
+ = _top;
_path.segments[4].point.y
- = _path.segments[5].point.y
- = _bottom;
+ = _path.segments[5].point.y
+ = _bottom;
_path.segments[1].point.y = _coords.y - _options.tooltip_arrow_width / 2;
_path.segments[6].point.y = _coords.y + _options.tooltip_arrow_width / 2;
_path.closed = true;
--- a/client/js/models.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/models.js Fri May 16 14:09:57 2014 +0200
@@ -1,31 +1,31 @@
(function() {
"use strict";
var root = this;
-
+
var Backbone = root.Backbone;
-
+
var Models = root.Rkns.Models = {};
-
-
+
+
Models.getUID = function(obj) {
var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+ var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
- return obj.type + "-" + guid;
+ return obj.type + "-" + guid;
};
-
-
+
+
var RenkanModel = Backbone.RelationalModel.extend({
idAttribute : "_id",
constructor: function(options) {
-
+
if (typeof options !== "undefined") {
options._id = options._id || options.id || Models.getUID(this);
options.title = options.title || "";
options.description = options.description || "";
options.uri = options.uri || "";
-
+
if(typeof this.prepare === "function") {
options = this.prepare(options);
}
@@ -47,7 +47,7 @@
}
}
});
-
+
// USER
var User = Models.User = RenkanModel.extend({
type: "user",
@@ -65,7 +65,7 @@
};
}
});
-
+
// NODE
var Node = Models.Node = RenkanModel.extend({
type: "node",
@@ -95,7 +95,7 @@
};
}
});
-
+
// EDGE
var Edge = Models.Edge = RenkanModel.extend({
type: "edge",
@@ -136,7 +136,7 @@
};
}
});
-
+
// View
var View = Models.View = RenkanModel.extend({
type: "view",
@@ -160,7 +160,7 @@
};
}
});
-
+
// PROJECT
var Project = Models.Project = RenkanModel.extend({
type: "project",
@@ -209,7 +209,7 @@
return _user;
},
addNode: function(_props, _options) {
- _props.project = this;
+ _props.project = this;
var _node = Node.findOrCreate(_props);
this.get("nodes").push(_node, _options);
return _node;
@@ -258,19 +258,19 @@
this.on("remove:nodes", function(_node) {
_this.get("edges").remove(
_this.get("edges").filter(function(_edge) {
- return _edge.get("from") == _node || _edge.get("to") == _node;
+ return _edge.get("from") === _node || _edge.get("to") === _node;
})
);
});
}
});
-
+
var RosterUser = Models.RosterUser = Backbone.Model.extend({
type: "roster_user",
idAttribute : "_id",
-
+
constructor: function(options) {
-
+
if (typeof options !== "undefined") {
options._id = options._id || options.id || Models.getUID(this);
options.title = options.title || "(untitled " + this.type + ")";
@@ -278,25 +278,25 @@
options.uri = options.uri || "";
options.project = options.project || null;
options.site_id = options.site_id || 0;
-
+
if(typeof this.prepare === "function") {
options = this.prepare(options);
}
}
Backbone.Model.prototype.constructor.call(this, options);
},
-
+
validate: function() {
if(!this.type) {
return "object has no type";
}
},
-
+
prepare: function(options) {
options.color = options.color || "#666666";
return options;
},
-
+
toJSON: function() {
return {
_id: this.get("_id"),
@@ -309,11 +309,10 @@
};
}
});
-
+
var UsersList = Models.UsersList = Backbone.Collection.extend({
model: RosterUser
});
-
+
}).call(window);
-
--- a/client/js/random-data.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/random-data.js Fri May 16 14:09:57 2014 +0200
@@ -5,14 +5,15 @@
_opts.edge_count = _opts.edge_count || 2 * _opts.node_count;
_opts.user_colors = _opts.user_colors || ["#ff0000", "#008000", "#0000ff", "#808000", "#808080", "#c000c0", "#00c0c0"];
var _proj = _renkan.project;
- for (var i = 0; i < _opts.user_count; i++) {
+ var i;
+ for (i = 0; i < _opts.user_count; i++) {
_proj.addUser({
id: "user-"+i,
title: "User #"+(1+i),
color: _opts.user_colors[i]
});
}
- for (var i = 0; i < _opts.node_count; i++) {
+ for (i = 0; i < _opts.node_count; i++) {
_proj.addNode({
id: "node-"+i,
title: "Node #"+(1+i),
@@ -23,7 +24,7 @@
}
});
}
- for (var i = 0; i < _opts.node_count; i++) {
+ for (i = 0; i < _opts.node_count; i++) {
var _from, _to;
_from = _to = Math.floor(_opts.node_count*Math.random());
while(_from === _to) {
--- a/client/js/renderer/basebutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/basebutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,13 +1,13 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
-
+
/* Rkns.Renderer._BaseButton Class */
-
+
/* BaseButton is extended by contextual buttons that appear when hovering on nodes and edges */
-
+
var _BaseButton = Utils.inherit(BaseRepresentation);
_(_BaseButton.prototype).extend({
@@ -37,4 +37,3 @@
return _BaseButton;
});
-
--- a/client/js/renderer/baseeditor.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/baseeditor.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* _BaseEditor Begin */
@@ -17,12 +17,12 @@
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;
- this.editor_block.opacity = .8;
+ this.editor_block.opacity = 0.8;
this.editor_$ = $('<div>')
.appendTo(this.renderer.editor_$)
.css({
position: "absolute",
- opacity: .8
+ opacity: 0.8
})
.hide();
},
@@ -31,7 +31,7 @@
this.editor_$.remove();
}
});
-
+
/* _BaseEditor End */
return _BaseEditor;
--- a/client/js/renderer/baserepresentation.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/baserepresentation.js Fri May 16 14:09:57 2014 +0200
@@ -1,6 +1,6 @@
-/* paper-renderer.js */
-"use strict";
+
define(['jquery', 'underscore'], function ($, _) {
+ 'use strict';
/* Rkns.Renderer._BaseRepresentation Class */
@@ -79,8 +79,7 @@
});
/* End of Rkns.Renderer._BaseRepresentation Class */
-
+
return _BaseRepresentation;
});
-
--- a/client/js/renderer/edge.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/edge.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* Edge Class Begin */
@@ -83,7 +83,7 @@
opacity = 1;
if (this.model.get("delete_scheduled") || this.from_representation.model.get("delete_scheduled") || this.to_representation.model.get("delete_scheduled")) {
- opacity = .5;
+ opacity = 0.5;
this.line.dashArray = [2, 2];
} else {
opacity = 1;
@@ -232,4 +232,3 @@
return Edge;
});
-
--- a/client/js/renderer/edgeeditbutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/edgeeditbutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* EdgeEditButton Begin */
@@ -22,7 +22,7 @@
});
/* EdgeEditButton End */
-
+
return EdgeEditButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/edgeeditor.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/edgeeditor.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* EdgeEditor Begin */
@@ -11,29 +11,29 @@
_(EdgeEditor.prototype).extend({
template: _.template(
- '<h2><span class="Rk-CloseX">×</span><%-renkan.translate("Edit Edge")%></span></h2>'
- + '<p><label><%-renkan.translate("Title:")%></label><input class="Rk-Edit-Title" type="text" value="<%-edge.title%>"/></p>'
- + '<% if (options.show_edge_editor_uri) { %><p><label><%-renkan.translate("URI:")%></label><input class="Rk-Edit-URI" type="text" value="<%-edge.uri%>"/><a class="Rk-Edit-Goto" href="<%-edge.uri%>" target="_blank"></a></p>'
- + '<% if (options.properties.length) { %><p><label><%-renkan.translate("Choose from vocabulary:")%></label><select class="Rk-Edit-Vocabulary">'
- + '<% _(options.properties).each(function(ontology) { %><option class="Rk-Edit-Vocabulary-Class" value=""><%- renkan.translate(ontology.label) %></option>'
- + '<% _(ontology.properties).each(function(property) { var uri = ontology["base-uri"] + property.uri; %><option class="Rk-Edit-Vocabulary-Property" value="<%- uri %>'
- + '"<% if (uri === edge.uri) { %> selected<% } %>><%- renkan.translate(property.label) %></option>'
- + '<% }) %><% }) %></select></p><% } } %>'
- + '<% if (options.show_edge_editor_color) { %><div class="Rk-Editor-p"><span class="Rk-Editor-Label"><%-renkan.translate("Edge color:")%></span><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-Edit-Color" style="background:<%-edge.color%>;"><span class="Rk-Edit-ColorTip"></span></span>'
- + '<%= renkan.colorPicker %><span class="Rk-Edit-ColorPicker-Text"><%- renkan.translate("Choose color") %></span></div></div><% } %>'
- + '<% if (options.show_edge_editor_direction) { %><p><span class="Rk-Edit-Direction"><%- renkan.translate("Change edge direction") %></span></p><% } %>'
- + '<% if (options.show_edge_editor_nodes) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("From:")%></span><span class="Rk-UserColor" style="background:<%-edge.from_color%>;"></span><%- shortenText(edge.from_title, 25) %></p>'
- + '<p><span class="Rk-Editor-Label"><%-renkan.translate("To:")%></span><span class="Rk-UserColor" style="background:<%-edge.to_color%>;"></span><%- shortenText(edge.to_title, 25) %></p><% } %>'
- + '<% if (options.show_edge_editor_creator && edge.has_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span><span class="Rk-UserColor" style="background:<%-edge.created_by_color%>;"></span><%- shortenText(edge.created_by_title, 25) %></p><% } %>'
+ '<h2><span class="Rk-CloseX">×</span><%-renkan.translate("Edit Edge")%></span></h2>' +
+ '<p><label><%-renkan.translate("Title:")%></label><input class="Rk-Edit-Title" type="text" value="<%-edge.title%>"/></p>' +
+ '<% if (options.show_edge_editor_uri) { %><p><label><%-renkan.translate("URI:")%></label><input class="Rk-Edit-URI" type="text" value="<%-edge.uri%>"/><a class="Rk-Edit-Goto" href="<%-edge.uri%>" target="_blank"></a></p>' +
+ '<% if (options.properties.length) { %><p><label><%-renkan.translate("Choose from vocabulary:")%></label><select class="Rk-Edit-Vocabulary">' +
+ '<% _(options.properties).each(function(ontology) { %><option class="Rk-Edit-Vocabulary-Class" value=""><%- renkan.translate(ontology.label) %></option>' +
+ '<% _(ontology.properties).each(function(property) { var uri = ontology["base-uri"] + property.uri; %><option class="Rk-Edit-Vocabulary-Property" value="<%- uri %>' +
+ '"<% if (uri === edge.uri) { %> selected<% } %>><%- renkan.translate(property.label) %></option>' +
+ '<% }) %><% }) %></select></p><% } } %>' +
+ '<% if (options.show_edge_editor_color) { %><div class="Rk-Editor-p"><span class="Rk-Editor-Label"><%-renkan.translate("Edge color:")%></span><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-Edit-Color" style="background:<%-edge.color%>;"><span class="Rk-Edit-ColorTip"></span></span>' +
+ '<%= renkan.colorPicker %><span class="Rk-Edit-ColorPicker-Text"><%- renkan.translate("Choose color") %></span></div></div><% } %>' +
+ '<% if (options.show_edge_editor_direction) { %><p><span class="Rk-Edit-Direction"><%- renkan.translate("Change edge direction") %></span></p><% } %>' +
+ '<% if (options.show_edge_editor_nodes) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("From:")%></span><span class="Rk-UserColor" style="background:<%-edge.from_color%>;"></span><%- shortenText(edge.from_title, 25) %></p>' +
+ '<p><span class="Rk-Editor-Label"><%-renkan.translate("To:")%></span><span class="Rk-UserColor" style="background:<%-edge.to_color%>;"></span><%- shortenText(edge.to_title, 25) %></p><% } %>' +
+ '<% if (options.show_edge_editor_creator && edge.has_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span><span class="Rk-UserColor" style="background:<%-edge.created_by_color%>;"></span><%- shortenText(edge.created_by_title, 25) %></p><% } %>'
),
readOnlyTemplate: _.template(
- '<h2><span class="Rk-CloseX">×</span><% if (options.show_edge_tooltip_color) { %><span class="Rk-UserColor" style="background:<%-edge.color%>;"></span><% } %>'
- + '<span class="Rk-Display-Title"><% if (edge.uri) { %><a href="<%-edge.uri%>" target="_blank"><% } %><%-edge.title%><% if (edge.uri) { %></a><% } %></span></h2>'
- + '<% if (options.show_edge_tooltip_uri && edge.uri) { %><p class="Rk-Display-URI"><a href="<%-edge.uri%>" target="_blank"><%-edge.short_uri%></a></p><% } %>'
- + '<p><%-edge.description%></p>'
- + '<% if (options.show_edge_tooltip_nodes) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("From:")%></span><span class="Rk-UserColor" style="background:<%-edge.from_color%>;"></span><%- shortenText(edge.from_title, 25) %></p>'
- + '<p><span class="Rk-Editor-Label"><%-renkan.translate("To:")%></span><span class="Rk-UserColor" style="background:<%-edge.to_color%>;"></span><%- shortenText(edge.to_title, 25) %></p><% } %>'
- + '<% if (options.show_edge_tooltip_creator && edge.has_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span><span class="Rk-UserColor" style="background:<%-edge.created_by_color%>;"></span><%- shortenText(edge.created_by_title, 25) %></p><% } %>'
+ '<h2><span class="Rk-CloseX">×</span><% if (options.show_edge_tooltip_color) { %><span class="Rk-UserColor" style="background:<%-edge.color%>;"></span><% } %>' +
+ '<span class="Rk-Display-Title"><% if (edge.uri) { %><a href="<%-edge.uri%>" target="_blank"><% } %><%-edge.title%><% if (edge.uri) { %></a><% } %></span></h2>' +
+ '<% if (options.show_edge_tooltip_uri && edge.uri) { %><p class="Rk-Display-URI"><a href="<%-edge.uri%>" target="_blank"><%-edge.short_uri%></a></p><% } %>' +
+ '<p><%-edge.description%></p>' +
+ '<% if (options.show_edge_tooltip_nodes) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("From:")%></span><span class="Rk-UserColor" style="background:<%-edge.from_color%>;"></span><%- shortenText(edge.from_title, 25) %></p>' +
+ '<p><span class="Rk-Editor-Label"><%-renkan.translate("To:")%></span><span class="Rk-UserColor" style="background:<%-edge.to_color%>;"></span><%- shortenText(edge.to_title, 25) %></p><% } %>' +
+ '<% if (options.show_edge_tooltip_creator && edge.has_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span><span class="Rk-UserColor" style="background:<%-edge.created_by_color%>;"></span><%- shortenText(edge.created_by_title, 25) %></p><% } %>'
),
draw: function() {
var _model = this.source_representation.model,
@@ -166,7 +166,7 @@
});
/* EdgeEditor End */
-
+
return EdgeEditor;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/edgeremovebutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/edgeremovebutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* EdgeRemoveButton Begin */
@@ -36,7 +36,7 @@
});
/* EdgeRemoveButton End */
-
+
return EdgeRemoveButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/edgerevertbutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/edgerevertbutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* EdgeRevertButton Begin */
@@ -24,7 +24,7 @@
});
/* EdgeRevertButton End */
-
+
return EdgeRevertButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/miniframe.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/miniframe.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* MiniFrame Begin */
@@ -21,7 +21,7 @@
});
/* MiniFrame End */
-
+
return MiniFrame;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/nodebutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/nodebutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,6 +1,6 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/basebutton'], function ($, _, requtils, BaseButton) {
+ 'use strict';
var Utils = requtils.getUtils();
@@ -31,7 +31,7 @@
});
/* _NodeButton End */
-
+
return _NodeButton;
});
--- a/client/js/renderer/nodeeditbutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/nodeeditbutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* NodeEditButton Begin */
@@ -26,7 +26,7 @@
});
/* NodeEditButton End */
-
+
return NodeEditButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/nodeeditor.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/nodeeditor.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/baseeditor'], function ($, _, requtils, BaseEditor) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* NodeEditor Begin */
@@ -10,26 +10,26 @@
_(NodeEditor.prototype).extend({
template: _.template(
- '<h2><span class="Rk-CloseX">×</span><%-renkan.translate("Edit Node")%></span></h2>'
- + '<p><label><%-renkan.translate("Title:")%></label><input class="Rk-Edit-Title" type="text" value="<%-node.title%>"/></p>'
- + '<% if (options.show_node_editor_uri) { %><p><label><%-renkan.translate("URI:")%></label><input class="Rk-Edit-URI" type="text" value="<%-node.uri%>"/><a class="Rk-Edit-Goto" href="<%-node.uri%>" target="_blank"></a></p><% } %>'
- + '<% if (options.show_node_editor_description) { %><p><label><%-renkan.translate("Description:")%></label><textarea class="Rk-Edit-Description"><%-node.description%></textarea></p><% } %>'
- + '<% if (options.show_node_editor_size) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Size:")%></span><a href="#" class="Rk-Edit-Size-Down">-</a><span class="Rk-Edit-Size-Value"><%-node.size%></span><a href="#" class="Rk-Edit-Size-Up">+</a></p><% } %>'
- + '<% if (options.show_node_editor_color) { %><div class="Rk-Editor-p"><span class="Rk-Editor-Label"><%-renkan.translate("Node color:")%></span><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-Edit-Color" style="background:<%-node.color%>;"><span class="Rk-Edit-ColorTip"></span></span>'
- + '<%= renkan.colorPicker %><span class="Rk-Edit-ColorPicker-Text"><%- renkan.translate("Choose color") %></span></div></div><% } %>'
- + '<% if (options.show_node_editor_image) { %><div class="Rk-Edit-ImgWrap"><div class="Rk-Edit-ImgPreview"><img src="<%-node.image || node.image_placeholder%>" />'
- + '<% if (node.clip_path) { %><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none"><path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="<%- node.clip_path %>"/></svg><% }%>'
- + '</div></div><p><label><%-renkan.translate("Image URL:")%></label><input class="Rk-Edit-Image" type="text" value="<%-node.image%>"/></p>'
- + '<p><label><%-renkan.translate("Choose Image File:")%></label><input class="Rk-Edit-Image-File" type="file" accept="image/*"/></p><% } %>'
- + '<% if (options.show_node_editor_creator && node.has_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span> <span class="Rk-UserColor" style="background:<%-node.created_by_color%>;"></span><%- shortenText(node.created_by_title, 25) %></p><% } %>'
+ '<h2><span class="Rk-CloseX">×</span><%-renkan.translate("Edit Node")%></span></h2>' +
+ '<p><label><%-renkan.translate("Title:")%></label><input class="Rk-Edit-Title" type="text" value="<%-node.title%>"/></p>' +
+ '<% if (options.show_node_editor_uri) { %><p><label><%-renkan.translate("URI:")%></label><input class="Rk-Edit-URI" type="text" value="<%-node.uri%>"/><a class="Rk-Edit-Goto" href="<%-node.uri%>" target="_blank"></a></p><% } %>' +
+ '<% if (options.show_node_editor_description) { %><p><label><%-renkan.translate("Description:")%></label><textarea class="Rk-Edit-Description"><%-node.description%></textarea></p><% } %>' +
+ '<% if (options.show_node_editor_size) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Size:")%></span><a href="#" class="Rk-Edit-Size-Down">-</a><span class="Rk-Edit-Size-Value"><%-node.size%></span><a href="#" class="Rk-Edit-Size-Up">+</a></p><% } %>' +
+ '<% if (options.show_node_editor_color) { %><div class="Rk-Editor-p"><span class="Rk-Editor-Label"><%-renkan.translate("Node color:")%></span><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-Edit-Color" style="background:<%-node.color%>;"><span class="Rk-Edit-ColorTip"></span></span>' +
+ '<%= renkan.colorPicker %><span class="Rk-Edit-ColorPicker-Text"><%- renkan.translate("Choose color") %></span></div></div><% } %>' +
+ '<% if (options.show_node_editor_image) { %><div class="Rk-Edit-ImgWrap"><div class="Rk-Edit-ImgPreview"><img src="<%-node.image || node.image_placeholder%>" />' +
+ '<% if (node.clip_path) { %><svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewbox="0 0 1 1" preserveAspectRatio="none"><path style="stroke-width: .02; stroke:red; fill-opacity:.3; fill:red;" d="<%- node.clip_path %>"/></svg><% }%>' +
+ '</div></div><p><label><%-renkan.translate("Image URL:")%></label><input class="Rk-Edit-Image" type="text" value="<%-node.image%>"/></p>' +
+ '<p><label><%-renkan.translate("Choose Image File:")%></label><input class="Rk-Edit-Image-File" type="file" accept="image/*"/></p><% } %>' +
+ '<% if (options.show_node_editor_creator && node.has_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span> <span class="Rk-UserColor" style="background:<%-node.created_by_color%>;"></span><%- shortenText(node.created_by_title, 25) %></p><% } %>'
),
readOnlyTemplate: _.template(
- '<h2><span class="Rk-CloseX">×</span><% if (options.show_node_tooltip_color) { %><span class="Rk-UserColor" style="background:<%-node.color%>;"></span><% } %>'
- + '<span class="Rk-Display-Title"><% if (node.uri) { %><a href="<%-node.uri%>" target="_blank"><% } %><%-node.title%><% if (node.uri) { %></a><% } %></span></h2>'
- + '<% if (node.uri && options.show_node_tooltip_uri) { %><p class="Rk-Display-URI"><a href="<%-node.uri%>" target="_blank"><%-node.short_uri%></a></p><% } %>'
- + '<% if (options.show_node_tooltip_description) { %><p class="Rk-Display-Description"><%-node.description%></p><% } %>'
- + '<% if (node.image && options.show_node_tooltip_image) { %><img class="Rk-Display-ImgPreview" src="<%-node.image%>" /><% } %>'
- + '<% if (node.has_creator && options.show_node_tooltip_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span><span class="Rk-UserColor" style="background:<%-node.created_by_color%>;"></span><%- shortenText(node.created_by_title, 25) %></p><% } %>'
+ '<h2><span class="Rk-CloseX">×</span><% if (options.show_node_tooltip_color) { %><span class="Rk-UserColor" style="background:<%-node.color%>;"></span><% } %>' +
+ '<span class="Rk-Display-Title"><% if (node.uri) { %><a href="<%-node.uri%>" target="_blank"><% } %><%-node.title%><% if (node.uri) { %></a><% } %></span></h2>' +
+ '<% if (node.uri && options.show_node_tooltip_uri) { %><p class="Rk-Display-URI"><a href="<%-node.uri%>" target="_blank"><%-node.short_uri%></a></p><% } %>' +
+ '<% if (options.show_node_tooltip_description) { %><p class="Rk-Display-Description"><%-node.description%></p><% } %>' +
+ '<% if (node.image && options.show_node_tooltip_image) { %><img class="Rk-Display-ImgPreview" src="<%-node.image%>" /><% } %>' +
+ '<% if (node.has_creator && options.show_node_tooltip_creator) { %><p><span class="Rk-Editor-Label"><%-renkan.translate("Created by:")%></span><span class="Rk-UserColor" style="background:<%-node.created_by_color%>;"></span><%- shortenText(node.created_by_title, 25) %></p><% } %>'
),
draw: function() {
var _model = this.source_representation.model,
@@ -196,14 +196,14 @@
},
redraw: function() {
var _coords = this.source_representation.paper_coords;
- Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * .75, this.editor_$);
+ Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$);
this.editor_$.show();
paper.view.draw();
}
});
/* NodeEditor End */
-
+
return NodeEditor;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/nodeenlargebutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/nodeenlargebutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,6 +1,7 @@
-"use strict";
+
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+ 'use strict';
var Utils = requtils.getUtils();
@@ -28,7 +29,7 @@
});
/* NodeEnlargeButton End */
-
+
return NodeEnlargeButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/nodelinkbutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/nodelinkbutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* NodeLinkButton Begin */
@@ -33,7 +33,7 @@
});
/* NodeLinkButton End */
-
+
return NodeLinkButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/noderemovebutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/noderemovebutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,6 +1,6 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
+ 'use strict';
var Utils = requtils.getUtils();
@@ -40,7 +40,7 @@
});
/* NodeRemoveButton End */
-
+
return NodeRemoveButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/noderepr.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/noderepr.js Fri May 16 14:09:57 2014 +0200
@@ -1,8 +1,8 @@
-/* paper-renderer.js */
-"use strict";
+
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* Rkns.Renderer.Node Class */
@@ -82,7 +82,7 @@
var opacity = 1;
if (this.model.get("delete_scheduled")) {
- opacity = .5;
+ opacity = 0.5;
this.active_buttons = this.pending_delete_buttons;
this.circle.dashArray = [2,2];
} else {
@@ -103,12 +103,12 @@
}
if (this.node_image) {
- this.node_image.opacity = this.highlighted ? opacity * .5 : (opacity - .01);
+ this.node_image.opacity = this.highlighted ? opacity * 0.5 : (opacity - 0.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 ? opacity : .01;
+ this.circle.opacity = this.options.show_node_circles ? opacity : 0.01;
var _text = this.model.get("title") || this.renkan.translate(this.options.label_untitled_nodes) || "";
_text = Utils.shortenText(_text, this.options.node_label_max_length);
@@ -202,9 +202,9 @@
var res = parseFloat(v),
isY = k % 2;
if (isY) {
- res = ( res - .5 ) * height;
+ res = ( res - 0.5 ) * height;
} else {
- res = ( res - .5 ) * width;
+ res = ( res - 0.5 ) * width;
}
if (relative) {
res += lastCoords[isY];
@@ -268,7 +268,7 @@
_raster.locked = true; // Disable mouse events on icon
if (hasClipPath) {
_raster = new paper.Group(_clip, _raster);
- _raster.opacity = .99;
+ _raster.opacity = 0.99;
/* This is a workaround to allow clipping at group level
* If opacity was set to 1, paper.js would merge all clipping groups in one (known bug).
*/
@@ -278,7 +278,7 @@
if (this.options.clip_node_images) {
var _circleClip = new paper.Path.Circle(centerPoint, baseRadius);
_raster = new paper.Group(_circleClip, _raster);
- _raster.opacity = .99;
+ _raster.opacity = 0.99;
_raster.clipped = true;
_circleClip.__representation = this;
}
@@ -325,7 +325,7 @@
if (_uri) {
$('.Rk-Bin-Item').each(function() {
var _el = $(this);
- if (_el.attr("data-uri") == _uri) {
+ if (_el.attr("data-uri") === _uri) {
_el.addClass("selected");
}
});
@@ -417,8 +417,7 @@
}
}
});
-
+
return NodeRepr;
-
+
});
-
--- a/client/js/renderer/noderevertbutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/noderevertbutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* NodeRevertButton Begin */
@@ -28,7 +28,7 @@
});
/* NodeRevertButton End */
-
+
return NodeRevertButton;
});
--- a/client/js/renderer/nodeshrinkbutton.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/nodeshrinkbutton.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,7 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/nodebutton'], function ($, _, requtils, NodeButton) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* NodeShrinkButton Begin */
@@ -28,7 +28,7 @@
});
/* NodeShrinkButton End */
-
+
return NodeShrinkButton;
-});
\ No newline at end of file
+});
--- a/client/js/renderer/scene.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/scene.js Fri May 16 14:09:57 2014 +0200
@@ -1,9 +1,9 @@
-"use strict";
define(['jquery', 'underscore', 'requtils', 'renderer/miniframe'], function ($, _, requtils, MiniFrame) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
-
+
/* Scene Begin */
var Scene = function(_renkan) {
@@ -28,7 +28,7 @@
this.node_layer = new paper.Layer();
this.buttons_layer = new paper.Layer();
this.delete_list = [];
-
+
if (_renkan.options.show_minimap) {
this.minimap = {
background_layer: new paper.Layer(),
@@ -45,7 +45,7 @@
this.minimap.rectangle.strokeColor = _renkan.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.scale = 0.1;
this.minimap.node_layer.activate();
this.minimap.cliprectangle = new paper.Path.Rectangle(this.minimap.topleft, this.minimap.size);
@@ -54,7 +54,7 @@
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.opacity = 0.3;
this.minimap.miniframe.strokeColor = '#000080';
this.minimap.miniframe.strokeWidth = 3;
this.minimap.miniframe.__representation = new MiniFrame(this, null);
@@ -82,7 +82,7 @@
img.src = _renkan.options.static_url + 'img/' + imgname + '.png';
_this.icon_cache[imgname] = img;
});
-
+
var throttledMouseMove = _.throttle(function(_event, _isTouch) {
_this.onMouseMove(_event, _isTouch);
}, Utils._MOUSEMOVE_RATE);
@@ -112,9 +112,9 @@
_event.preventDefault();
var _touches = _event.originalEvent.touches[0];
if (
- _renkan.options.allow_double_click
- && new Date() - _lastTap < Utils._DOUBLETAP_DELAY
- && ( Math.pow(_lastTapX - _touches.pageX, 2) + Math.pow(_lastTapY - _touches.pageY, 2) < Utils._DOUBLETAP_DISTANCE )
+ _renkan.options.allow_double_click &&
+ new Date() - _lastTap < Utils._DOUBLETAP_DELAY &&
+ ( Math.pow(_lastTapX - _touches.pageX, 2) + Math.pow(_lastTapY - _touches.pageY, 2) < Utils._DOUBLETAP_DISTANCE )
) {
_lastTap = 0;
_this.onDoubleClick(_touches);
@@ -130,7 +130,7 @@
touchmove: function(_event) {
_event.preventDefault();
_lastTap = 0;
- if (_event.originalEvent.touches.length == 1) {
+ if (_event.originalEvent.touches.length === 1) {
_this.onMouseMove(_event.originalEvent.touches[0], true);
} else {
if (!_zooming) {
@@ -147,7 +147,7 @@
_newOffset = new paper.Point([
_this.canvas_$.width(),
_this.canvas_$.height()
- ]).multiply( .5 * ( 1 - _scaleRatio ) ).add(_this.offset.multiply( _scaleRatio ));
+ ]).multiply( 0.5 * ( 1 - _scaleRatio ) ).add(_this.offset.multiply( _scaleRatio ));
_this.setScale(_newScale, _newOffset);
}
},
@@ -256,15 +256,16 @@
bindClick(".Rk-Save-Button", "save");
bindClick(".Rk-Open-Button", "open");
this.$.find(".Rk-Bookmarklet-Button")
- .attr("href","javascript:" + Utils._BOOKMARKLET_CODE(_renkan))
- .click(function(){
- _this.notif_$
- .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."))
- .fadeIn()
- .delay(5000)
- .fadeOut();
- return false;
- });
+ /*jshint scripturl:true */
+ .attr("href","javascript:" + Utils._BOOKMARKLET_CODE(_renkan))
+ .click(function(){
+ _this.notif_$
+ .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."))
+ .fadeIn()
+ .delay(5000)
+ .fadeOut();
+ return false;
+ });
this.$.find(".Rk-TopBar-Button").mouseover(function() {
$(this).find(".Rk-TopBar-Tooltip").show();
}).mouseout(function() {
@@ -338,8 +339,8 @@
if (_renkan.options.size_bug_fix) {
var _delay = (
- typeof _renkan.options.size_bug_fix === "number"
- ? _renkan.options.size_bug_fix
+ typeof _renkan.options.size_bug_fix === "number" ?
+ _renkan.options.size_bug_fix
: 500
);
window.setTimeout(
@@ -404,7 +405,7 @@
if (rxs.test(n.get("title")) || rxs.test(n.get("description"))) {
_this.getRepresentationByModel(n).highlight(rxs);
} else {
- _this.getRepresentationByModel(n).unhighlight();
+ _this.getRepresentationByModel(n).unhighlight();
}
});
}
@@ -442,31 +443,31 @@
_(Scene.prototype).extend({
template: _.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>'
- + '<% } else { %><input type="text" class="Rk-PadTitle" value="<%- project.get("title") || "" %>" placeholder="<%-translate("Untitled project")%>" /><% } %>'
- + '<% if (options.show_user_list) { %><div class="Rk-Users"><div class="Rk-CurrentUser"><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-CurrentUser-Color"><% if (options.user_color_editable) { %><span class="Rk-Edit-ColorTip"></span><% } %></span>'
- + '<% if (options.user_color_editable) { print(colorPicker) } %></div><span class="Rk-CurrentUser-Name"><unknown user></span></div><ul class="Rk-UserList"></ul></div><% } %>'
- + '<% if (options.home_button_url) {%><div class="Rk-TopBar-Separator"></div><a class="Rk-TopBar-Button Rk-Home-Button" href="<%- options.home_button_url %>"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents">'
- + '<%- translate(options.home_button_title) %></div></div></a><% } %>'
- + '<% if (options.show_fullscreen_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-FullScreen-Button"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents"><%-translate("Full Screen")%></div></div></div><% } %>'
- + '<% if (options.editor_mode) { %>'
- + '<% if (options.show_addnode_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-AddNode-Button"><div class="Rk-TopBar-Tooltip">'
- + '<div class="Rk-TopBar-Tooltip-Contents"><%-translate("Add Node")%></div></div></div><% } %>'
- + '<% if (options.show_addedge_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-AddEdge-Button"><div class="Rk-TopBar-Tooltip">'
- + '<div class="Rk-TopBar-Tooltip-Contents"><%-translate("Add Edge")%></div></div></div><% } %>'
- + '<% if (options.show_save_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-Save-Button"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents"> </div></div></div><% } %>'
- + '<% if (options.show_open_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-Open-Button"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents"><%-translate("Open Project")%></div></div></div><% } %>'
- + '<% if (options.show_bookmarklet) { %><div class="Rk-TopBar-Separator"></div><a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents">'
- + '<%-translate("Renkan \'Drag-to-Add\' bookmarklet")%></div></div></a><% } %>'
- + '<div class="Rk-TopBar-Separator"></div><% }; if (options.show_search_field) { %>'
- + '<form action="#" class="Rk-GraphSearch-Form"><input type="search" class="Rk-GraphSearch-Field" placeholder="<%- translate("Search in graph") %>" /></form><div class="Rk-TopBar-Separator"></div><% } %></div><% } %>'
- + '<div class="Rk-Editing-Space<% if (!options.show_top_bar) { %> Rk-Editing-Space-Full<% } %>">'
- + '<div class="Rk-Labels"></div><canvas class="Rk-Canvas" resize></canvas><div class="Rk-Notifications"></div><div class="Rk-Editor">'
- + '<% if (options.show_bins) { %><div class="Rk-Fold-Bins">«</div><% } %>'
- + '<div class="Rk-ZoomButtons"><div class="Rk-ZoomIn" title="<%-translate("Zoom In")%>"></div><div class="Rk-ZoomFit" title="<%-translate("Zoom Fit")%>"></div><div class="Rk-ZoomOut" title="<%-translate("Zoom Out")%>"></div>'
- + '<% if (options.editor_mode) { %><div class="Rk-ZoomSave" title="<%-translate("Zoom Save")%>"></div><% } %>'
- + '<% if (options.editor_mode || !isNaN(parseInt(options.default_view))) { %><div class="Rk-ZoomSetSaved" title="<%-translate("View saved zoom")%>"></div><% } %></div>'
- + '</div></div>'
+ '<% if (options.show_top_bar) { %><div class="Rk-TopBar"><% if (!options.editor_mode) { %><h2 class="Rk-PadTitle"><%- project.get("title") || translate("Untitled project")%></h2>' +
+ '<% } else { %><input type="text" class="Rk-PadTitle" value="<%- project.get("title") || "" %>" placeholder="<%-translate("Untitled project")%>" /><% } %>' +
+ '<% if (options.show_user_list) { %><div class="Rk-Users"><div class="Rk-CurrentUser"><div class="Rk-Edit-ColorPicker-Wrapper"><span class="Rk-CurrentUser-Color"><% if (options.user_color_editable) { %><span class="Rk-Edit-ColorTip"></span><% } %></span>' +
+ '<% if (options.user_color_editable) { print(colorPicker) } %></div><span class="Rk-CurrentUser-Name"><unknown user></span></div><ul class="Rk-UserList"></ul></div><% } %>' +
+ '<% if (options.home_button_url) {%><div class="Rk-TopBar-Separator"></div><a class="Rk-TopBar-Button Rk-Home-Button" href="<%- options.home_button_url %>"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents">' +
+ '<%- translate(options.home_button_title) %></div></div></a><% } %>' +
+ '<% if (options.show_fullscreen_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-FullScreen-Button"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents"><%-translate("Full Screen")%></div></div></div><% } %>' +
+ '<% if (options.editor_mode) { %>' +
+ '<% if (options.show_addnode_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-AddNode-Button"><div class="Rk-TopBar-Tooltip">' +
+ '<div class="Rk-TopBar-Tooltip-Contents"><%-translate("Add Node")%></div></div></div><% } %>' +
+ '<% if (options.show_addedge_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-AddEdge-Button"><div class="Rk-TopBar-Tooltip">' +
+ '<div class="Rk-TopBar-Tooltip-Contents"><%-translate("Add Edge")%></div></div></div><% } %>' +
+ '<% if (options.show_save_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-Save-Button"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents"> </div></div></div><% } %>' +
+ '<% if (options.show_open_button) { %><div class="Rk-TopBar-Separator"></div><div class="Rk-TopBar-Button Rk-Open-Button"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents"><%-translate("Open Project")%></div></div></div><% } %>' +
+ '<% if (options.show_bookmarklet) { %><div class="Rk-TopBar-Separator"></div><a class="Rk-TopBar-Button Rk-Bookmarklet-Button" href="#"><div class="Rk-TopBar-Tooltip"><div class="Rk-TopBar-Tooltip-Contents">' +
+ '<%-translate("Renkan \'Drag-to-Add\' bookmarklet")%></div></div></a><% } %>' +
+ '<div class="Rk-TopBar-Separator"></div><% }; if (options.show_search_field) { %>' +
+ '<form action="#" class="Rk-GraphSearch-Form"><input type="search" class="Rk-GraphSearch-Field" placeholder="<%- translate("Search in graph") %>" /></form><div class="Rk-TopBar-Separator"></div><% } %></div><% } %>' +
+ '<div class="Rk-Editing-Space<% if (!options.show_top_bar) { %> Rk-Editing-Space-Full<% } %>">' +
+ '<div class="Rk-Labels"></div><canvas class="Rk-Canvas" resize></canvas><div class="Rk-Notifications"></div><div class="Rk-Editor">' +
+ '<% if (options.show_bins) { %><div class="Rk-Fold-Bins">«</div><% } %>' +
+ '<div class="Rk-ZoomButtons"><div class="Rk-ZoomIn" title="<%-translate("Zoom In")%>"></div><div class="Rk-ZoomFit" title="<%-translate("Zoom Fit")%>"></div><div class="Rk-ZoomOut" title="<%-translate("Zoom Out")%>"></div>' +
+ '<% if (options.editor_mode) { %><div class="Rk-ZoomSave" title="<%-translate("Zoom Save")%>"></div><% } %>' +
+ '<% if (options.editor_mode || !isNaN(parseInt(options.default_view))) { %><div class="Rk-ZoomSetSaved" title="<%-translate("View saved zoom")%>"></div><% } %></div>' +
+ '</div></div>'
),
fixSize: function(_autoscale) {
var w = this.$.width(),
@@ -508,7 +509,7 @@
_endYIn = Math.sin(_endRads) * _inR - _padding * _enddy,
_endXOut = Math.cos(_endRads) * _outR - _padding * _enddx,
_endYOut = Math.sin(_endRads) * _outR - _padding * _enddy,
- _centerR = (_inR + _outR)/2,
+ _centerR = (_inR + _outR) / 2,
_centerRads = (_startRads + _endRads) / 2,
_centerX = Math.cos(_centerRads) * _centerR,
_centerY = Math.sin(_centerRads) * _centerR,
@@ -525,7 +526,7 @@
_path.lineTo([_endXOut, _endYOut]);
_path.arcTo([_centerXOut, _centerYOut], [_startXOut, _startYOut]);
_path.fillColor = _options.buttons_background;
- _path.opacity = .5;
+ _path.opacity = 0.5;
_path.closed = true;
_path.__representation = _repr;
var _text = new paper.PointText(_textX,_textY);
@@ -568,11 +569,11 @@
_grp.position = _restPos;
},
select: function() {
- _path.opacity = .8;
+ _path.opacity = 0.8;
_text.visible = true;
},
unselect: function() {
- _path.opacity = .5;
+ _path.opacity = 0.5;
_text.visible = false;
},
destroy: function() {
@@ -595,9 +596,9 @@
},
addToBundles: function(_edgeRepr) {
var _bundle = _(this.bundles).find(function(_bundle) {
- return (
- ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation )
- || ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation )
+ return (
+ ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation ) ||
+ ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation )
);
});
if (typeof _bundle !== "undefined") {
@@ -683,8 +684,8 @@
_maxx = Math.max.apply(Math, _xx),
_maxy = Math.max.apply(Math, _yy);
var _scale = Math.min(
- this.scale * .8 * this.renkan.options.minimap_width / paper.view.bounds.width,
- this.scale * .8 * this.renkan.options.minimap_height / paper.view.bounds.height,
+ this.scale * 0.8 * this.renkan.options.minimap_width / paper.view.bounds.width,
+ this.scale * 0.8 * this.renkan.options.minimap_height / paper.view.bounds.height,
( this.renkan.options.minimap_width - 2 * this.renkan.options.minimap_padding ) / (_maxx - _minx),
( this.renkan.options.minimap_height - 2 * this.renkan.options.minimap_padding ) / (_maxy - _miny)
);
@@ -692,7 +693,7 @@
this.minimap.scale = _scale;
}
if (nodes.length === 1) {
- this.minimap.scale = .1;
+ this.minimap.scale = 0.1;
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();
@@ -707,8 +708,8 @@
return _point.subtract(this.offset).divide(this.scale);
},
addRepresentation: function(_type, _model) {
- var r = requtils.getRenderer()[_type];
- var _repr = new r(this, _model);
+ var RendererType = requtils.getRenderer()[_type];
+ var _repr = new RendererType(this, _model);
this.representations.push(_repr);
return _repr;
},
@@ -781,7 +782,7 @@
_representation.destroy();
this.representations = _(this.representations).reject(
function(_repr) {
- return _repr == _representation;
+ return _repr === _representation;
}
);
},
@@ -795,7 +796,7 @@
},
removeRepresentationsOfType: function(_type) {
var _representations = _(this.representations).filter(function(_repr) {
- return _repr.type == _type;
+ return _repr.type === _type;
}),
_this = this;
_(_representations).each(function(_repr) {
@@ -990,22 +991,22 @@
},
defaultDropHandler: function(_data) {
var newNode = {};
+ var snippet = "";
switch(_data["text/x-iri-specific-site"]) {
case "twitter":
- var snippet = $('<div>').html(_data["text/x-iri-selected-html"]),
- tweetdiv = snippet.find(".tweet");
+ snippet = $('<div>').html(_data["text/x-iri-selected-html"]);
+ var tweetdiv = snippet.find(".tweet");
newNode.title = this.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");
newNode.description = tweetdiv.find(".js-tweet-text:first").text();
break;
case "google":
- var snippet = $('<div>').html(_data["text/x-iri-selected-html"]);
+ snippet = $('<div>').html(_data["text/x-iri-selected-html"]);
newNode.title = snippet.find("h3:first").text().trim();
newNode.uri = snippet.find("h3 a").attr("href");
newNode.description = snippet.find(".st:first").text().trim();
break;
- case undefined:
default:
if (_data["text/x-iri-source-uri"]) {
newNode.uri = _data["text/x-iri-source-uri"];
@@ -1015,7 +1016,7 @@
newNode.description = (_data["text/plain"] || _data["text/x-iri-selected-text"]).replace(/[\s\n]+/gm,' ').trim();
}
if (_data["text/html"] || _data["text/x-iri-selected-html"]) {
- var snippet = $('<div>').html(_data["text/html"] || _data["text/x-iri-selected-html"]);
+ snippet = $('<div>').html(_data["text/html"] || _data["text/x-iri-selected-html"]);
var _svgimgs = snippet.find("image");
if (_svgimgs.length) {
newNode.image = _svgimgs.attr("xlink:href");
@@ -1048,7 +1049,7 @@
newNode.title = _data["text/x-iri-source-title"];
}
if (_data["text/html"] || _data["text/x-iri-selected-html"]) {
- var snippet = $('<div>').html(_data["text/html"] || _data["text/x-iri-selected-html"]);
+ snippet = $('<div>').html(_data["text/html"] || _data["text/x-iri-selected-html"]);
newNode.image = snippet.find("[data-image]").attr("data-image") || newNode.image;
newNode.uri = snippet.find("[data-uri]").attr("data-uri") || newNode.uri;
newNode.title = snippet.find("[data-title]").attr("data-title") || newNode.title;
@@ -1069,11 +1070,11 @@
newNode[f] = undefined;
}
}
-
+
if(typeof this.renkan.options.drop_enhancer === "function"){
newNode = this.renkan.options.drop_enhancer(newNode, _data);
}
-
+
return newNode;
},
@@ -1088,9 +1089,9 @@
}
catch(e) {}
}
-
+
var newNode = (typeof this.renkan.options.drop_handler === "undefined")?this.defaultDropHandler(_data):this.renkan.options.drop_handler(_data);
-
+
var _off = this.canvas_$.offset(),
_point = new paper.Point([
_event.pageX - _off.left,
@@ -1119,18 +1120,19 @@
},
fullScreen: function() {
var _isFull = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen,
- _el = this.renkan.$[0],
- _requestMethods = ["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],
- _cancelMethods = ["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"];
+ _el = this.renkan.$[0],
+ _requestMethods = ["requestFullScreen","mozRequestFullScreen","webkitRequestFullScreen"],
+ _cancelMethods = ["cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen"],
+ i;
if (_isFull) {
- for (var i = 0; i < _cancelMethods.length; i++) {
+ for (i = 0; i < _cancelMethods.length; i++) {
if (typeof document[_cancelMethods[i]] === "function") {
document[_cancelMethods[i]]();
break;
}
}
} else {
- for (var i = 0; i < _requestMethods.length; i++) {
+ for (i = 0; i < _requestMethods.length; i++) {
if (typeof _el[_requestMethods[i]] === "function") {
_el[_requestMethods[i]]();
break;
@@ -1143,7 +1145,7 @@
_offset = new paper.Point([
this.canvas_$.width(),
this.canvas_$.height()
- ]).multiply( .5 * ( 1 - Math.SQRT1_2 ) ).add(this.offset.multiply( Math.SQRT1_2 ));
+ ]).multiply( 0.5 * ( 1 - Math.SQRT1_2 ) ).add(this.offset.multiply( Math.SQRT1_2 ));
this.setScale( _newScale, _offset );
},
zoomIn: function() {
@@ -1151,7 +1153,7 @@
_offset = new paper.Point([
this.canvas_$.width(),
this.canvas_$.height()
- ]).multiply( .5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));
+ ]).multiply( 0.5 * ( 1 - Math.SQRT2 ) ).add(this.offset.multiply( Math.SQRT2 ));
this.setScale( _newScale, _offset );
},
addNodeBtn: function() {
@@ -1177,9 +1179,9 @@
foldBins: function() {
var foldBinsButton = this.$.find(".Rk-Fold-Bins"),
bins = this.renkan.$.find(".Rk-Bins");
+ var _this = this;
if (bins.offset().left < 0) {
bins.animate({left: 0},250);
- var _this = this;
this.$.animate({left: 300},250,function() {
var w = _this.$.width();
paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);
@@ -1187,7 +1189,6 @@
foldBinsButton.html("«");
} else {
bins.animate({left: -300},250);
- var _this = this;
this.$.animate({left: 0},250,function() {
var w = _this.$.width();
paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);
@@ -1198,9 +1199,9 @@
save: function() { },
open: function() { }
});
-
+
/* Scene End */
-
+
return Scene;
-
+
});
--- a/client/js/renderer/tempedge.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/renderer/tempedge.js Fri May 16 14:09:57 2014 +0200
@@ -1,7 +1,8 @@
-"use strict";
+
define(['jquery', 'underscore', 'requtils', 'renderer/baserepresentation'], function ($, _, requtils, BaseRepresentation) {
-
+ 'use strict';
+
var Utils = requtils.getUtils();
/* TempEdge Class Begin */
@@ -93,7 +94,7 @@
});
/* TempEdge Class End */
-
+
return TempEdge;
-})
+});
--- a/client/js/require-utils.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/require-utils.js Fri May 16 14:09:57 2014 +0200
@@ -1,5 +1,5 @@
-"use strict";
define([], function ($, _) {
+ 'use strict';
return {
getUtils: function(){
return window.Rkns.Utils;
@@ -8,5 +8,5 @@
return window.Rkns.Renderer;
}
};
-
-});
\ No newline at end of file
+
+});
--- a/client/js/retrieve-kc.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/retrieve-kc.js Fri May 16 14:09:57 2014 +0200
@@ -2,7 +2,7 @@
Rkns.retrieveKC = function(_renkan, _opts) {
if (typeof _opts === "undefined") {
- var _opts = {};
+ _opts = {};
}
var _proj = _renkan.project,
_username = _opts.user_name || "Yves-Marie",
--- a/client/js/save-once.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/save-once.js Fri May 16 14:09:57 2014 +0200
@@ -6,7 +6,7 @@
_onLeave = function() {
return "Project not saved";
};
- if (typeof _opts.http_method == "undefined") {
+ if (typeof _opts.http_method === "undefined") {
_opts.http_method = 'POST';
}
var _load = function() {
@@ -71,5 +71,5 @@
} else {
_save();
}
- }
+ };
};
--- a/client/js/space-editor.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/space-editor.js Fri May 16 14:09:57 2014 +0200
@@ -1,10 +1,10 @@
$(function() {
-
+
var originalData = {
show_editor: false,
container: "preview"
};
-
+
var userData = {
bins: [
{
@@ -27,27 +27,27 @@
}
]
};
-
+
function getNormalizedHtml(jqsel) {
return jqsel.html().replace(/[\r\n]/gm,' ').replace(/\s{2,}/g,' ').replace(/(^\s+|\s+$)/g,'');
}
-
+
var searchEngineTemplate = getNormalizedHtml($(".search-engine-list"));
-
+
$(".search-engine-list").empty().sortable();
-
+
var resourceTemplate = getNormalizedHtml($(".resource-list"));
-
+
$(".resource-list").empty();
-
+
var binTemplate = getNormalizedHtml($(".bin-list"));
-
+
$(".bin-list").empty().sortable();
-
+
function addSearchEngine(data, editMode) {
-
+
$(".item").removeClass("item-editing");
-
+
var element = $(searchEngineTemplate),
allfields = element.find(".edit-value"),
typefield = element.find(".search-engine-type .edit-value"),
@@ -56,16 +56,16 @@
langfield = element.find(".search-engine-language .edit-value"),
langdisplay = element.find(".search-engine-language .display-value");
element.data("userdata",data);
-
+
if (editMode) {
element.addClass("item-editing");
}
-
+
var onChange = function() {
-
+
data.type = typefield.val();
typedisplay.text(typefield.find("[value=" + data.type + "]").text());
-
+
if (data.type === "Wikipedia") {
data.lang = langfield.val() || "en";
langdisplay.text(langfield.find("[value=" + data.lang + "]").text());
@@ -74,18 +74,18 @@
delete data.lang;
langsection.hide();
}
- }
-
+ };
+
typefield.val(data.type);
-
+
if (data.type === "Wikipedia") {
langfield.val(data.lang || "en");
}
-
+
allfields.on("keyup paste change", onChange);
-
+
onChange();
-
+
element.click(function() {
$(".item").removeClass("item-editing");
element.addClass("item-editing");
@@ -95,14 +95,14 @@
element.remove();
return false;
});
-
+
$(".search-engine-list").append(element);
}
-
+
function addBin(data, editMode) {
-
+
$(".item").removeClass("item-editing");
-
+
var element = $(binTemplate),
allfields = element.find(".edit-value"),
typefield = element.find(".bin-type .edit-value"),
@@ -125,22 +125,22 @@
titlefield = element.find(".bin-title .edit-value"),
titledisplay = element.find(".bin-title .display-value"),
reslist = element.find(".resource-list");
-
+
reslist.sortable({
stop: updateListData
});
-
+
element.data("userdata",data);
-
+
if (editMode) {
element.addClass("item-editing");
}
-
+
var onChange = function() {
-
+
data.type = typefield.val();
typedisplay.text(typefield.find("[value=" + data.type + "]").text());
-
+
if (data.type === "Wikipedia") {
data.lang = langfield.val() || "en";
langdisplay.text(langfield.find("[value=" + data.lang + "]").text());
@@ -149,15 +149,15 @@
delete data.lang;
langsection.hide();
}
-
+
if (data.type === "Ldt") {
ldtsection.show();
data.ldt_type = ldttypefield.val() || "Results";
ldttypedisplay.text(ldttypefield.find("[value=" + data.ldt_type + "]").text());
-
+
data.ldt_platform = ldtpffield.val() || ldtpffield.val("http://ldt.iri.centrepompidou.fr/").val();
ldtpfdisplay.text(data.ldt_platform);
-
+
if (data.ldt_type === "Project") {
data.project_id = ldtprojfield.val();
ldtprojdisplay.text(data.ldt_project);
@@ -166,14 +166,14 @@
delete data.ldt_project;
ldtprojsection.hide();
}
-
+
} else {
delete data.ldt_type;
delete data.project_id;
delete data.ldt_platform;
ldtsection.hide();
}
-
+
if (data.type === "Wikipedia" || (data.type === "Ldt" && data.ldt_type === "Results")) {
data.search = kwfield.val();
kwdisplay.text(data.search);
@@ -182,7 +182,7 @@
delete data.search;
kwsection.hide();
}
-
+
if (data.type === "ResourceList") {
data.title = titlefield.val() || titlefield.val("Untitled Resource List").val();
titledisplay.text(data.title);
@@ -190,11 +190,11 @@
} else {
ressection.hide();
}
-
+
updateListData();
-
- }
-
+
+ };
+
var updateListData = function() {
if (data.type === "ResourceList") {
data.list = Array.prototype.slice.call(
@@ -203,10 +203,10 @@
} else {
delete data.list;
}
- }
-
+ };
+
var addResource = function(resdata, editmode) {
-
+
var resel = $(resourceTemplate),
all_fields = resel.find(".edit-value"),
title_field = resel.find(".resource-title .edit-value"),
@@ -217,87 +217,87 @@
description_text = resel.find(".resource-description .display-value"),
image_field = resel.find(".resource-image .edit-value"),
image_text = resel.find(".resource-image .display-value");
-
+
resel.data("userdata",resdata);
-
+
if (editmode) {
resel.addClass("resource-editing");
}
-
+
var onResourceChange = function() {
-
+
resdata.title = title_field.val();
title_text.text(resdata.title);
-
+
resdata.description = description_field.val();
description_text.text(resdata.description);
-
+
resdata.url = url_field.val();
url_text.text(resdata.url);
-
+
resdata.image = image_field.val();
image_text.text(resdata.image);
-
+
updateListData();
-
- }
-
+
+ };
+
title_field.val( resdata.title || "" );
url_field.val( resdata.url || "" );
description_field.val( resdata.description || "" );
image_field.val( resdata.image || "" );
-
+
all_fields.on("keyup paste change", onResourceChange);
-
+
onResourceChange();
-
+
resel.find(".remove-item").click(function() {
resel.remove();
updateListData();
return false;
});
-
+
resel.click(function() {
$(".resource").removeClass("resource-editing");
resel.addClass("resource-editing");
return false;
});
-
+
reslist.append(resel);
- }
-
+ };
+
if (data.list) {
data.list.forEach(addResource);
}
-
+
typefield.val(data.type);
-
+
if (data.type === "Wikipedia") {
langfield.val(data.lang || "en");
}
-
+
if (data.type === "Ldt") {
ldttypefield.val(data.ldt_type || "Results");
ldtpffield.val(data.ldt_platform || "http://ldt.iri.centrepompidou.fr/");
-
+
if (data.ldt_type === "Project") {
ldtprojfield.val(data.ldt_project);
}
-
+
}
-
+
if (data.type === "Wikipedia" || (data.type === "Ldt" && data.ldt_type === "Results")) {
kwfield.val(data.search || "");
}
-
+
if (data.type === "ResourceList") {
titlefield.val(data.title || "Untitled Resource List");
}
-
+
allfields.on("keyup paste change", onChange);
-
+
onChange();
-
+
element.click(function() {
$(".item").removeClass("item-editing");
element.addClass("item-editing");
@@ -311,19 +311,19 @@
addResource({"title": "New Resource"},true);
return false;
});
-
+
$(".bin-list").append(element);
-
+
}
-
-
+
+
userData.search.forEach(function(data) {
addSearchEngine(data,false);
});
userData.bins.forEach(function(data) {
addBin(data,false);
});
-
+
$(".add-search-engine").click(function() {
addSearchEngine({
type: "Wikipedia",
@@ -331,7 +331,7 @@
}, true);
return false;
});
-
+
$(".add-bin").click(function() {
addBin({
type: "Wikipedia",
@@ -340,7 +340,7 @@
}, true);
return false;
});
-
+
$(".update-preview").click(function() {
userData.search = Array.prototype.slice.call(
$(".search-engine").map(function(){return $(this).data("userdata");})
@@ -349,9 +349,9 @@
$(".bin").map(function(){return $(this).data("userdata");})
);
new Rkns.Renkan(_.extend({}, originalData, userData));
-
+
});
-
+
new Rkns.Renkan(_.extend({}, originalData, userData));
-
+
});
--- a/client/js/wikipedia-bin.js Fri May 16 12:37:51 2014 +0200
+++ b/client/js/wikipedia-bin.js Fri May 16 14:09:57 2014 +0200
@@ -35,10 +35,10 @@
Rkns.Wikipedia.Bin = Rkns.Utils.inherit(Rkns._BaseBin);
Rkns.Wikipedia.Bin.prototype.resultTemplate = Rkns._.template(
- '<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true" data-uri="<%-url%>" '
- + 'data-title="Wikipedia: <%-title%>" data-description="<%-description%>" data-image="<%- Rkns.Utils.getFullURL( static_url + \'img/wikipedia.png\' ) %>">'
- + '<img class="Rk-Wikipedia-Icon" src="<%-static_url%>img/wikipedia.png"></div><h4 class="Rk-Wikipedia-Title"><a href="<%-url%>" target="_blank"><%=htitle%></a></h4>'
- + '<p class="Rk-Wikipedia-Snippet"><%=hdescription%></p></li>'
+ '<li class="Rk-Wikipedia-Result Rk-Bin-Item" draggable="true" data-uri="<%-url%>" ' +
+ 'data-title="Wikipedia: <%-title%>" data-description="<%-description%>" data-image="<%- Rkns.Utils.getFullURL( static_url + \'img/wikipedia.png\' ) %>">' +
+ '<img class="Rk-Wikipedia-Icon" src="<%-static_url%>img/wikipedia.png"></div><h4 class="Rk-Wikipedia-Title"><a href="<%-url%>" target="_blank"><%=htitle%></a></h4>' +
+ '<p class="Rk-Wikipedia-Snippet"><%=hdescription%></p></li>'
);
Rkns.Wikipedia.Bin.prototype._init = function(_renkan, _opts) {
@@ -89,7 +89,7 @@
}
this.renkan.resizeBins();
};
-
+
Rkns.Wikipedia.Bin.prototype.refresh = function() {
var _this = this;
Rkns.$.ajax({
@@ -100,4 +100,4 @@
_this.render();
}
});
-};
\ No newline at end of file
+};