Commit 381dafb4 authored by Romain Courteaud's avatar Romain Courteaud

JSLint examples.

parent 90a54b2f
...@@ -3,6 +3,8 @@ RENDERJS = renderjs.js ...@@ -3,6 +3,8 @@ RENDERJS = renderjs.js
RENDERJS_MIN = renderjs.min.js RENDERJS_MIN = renderjs.min.js
BUILDDIR = tmp BUILDDIR = tmp
LINT_OPTS = --maxlen 79 --indent 2 --maxerr 3
include config.mk include config.mk
all: external lint test build doc all: external lint test build doc
...@@ -67,10 +69,11 @@ lib/jio/complex_queries.js: ...@@ -67,10 +69,11 @@ lib/jio/complex_queries.js:
$(RENDERJS_MIN): $(RENDERJS) $(RENDERJS_MIN): $(RENDERJS)
$(UGLIFY_CMD) "$<" > "$@" $(UGLIFY_CMD) "$<" > "$@"
${BUILDDIR}/$(RENDERJS).lint: $(RENDERJS) test/renderjs_test.js ${BUILDDIR}/$(RENDERJS).lint: $(RENDERJS) test/renderjs_test.js examples/officejs/*.js
@mkdir -p $(@D) @mkdir -p $(@D)
$(LINT_CMD) "$(RENDERJS)" $(LINT_CMD) $(LINT_OPTS) "$(RENDERJS)"
$(LINT_CMD) "test/renderjs_test.js" $(LINT_CMD) $(LINT_OPTS) "test/renderjs_test.js"
$(LINT_CMD) $(LINT_OPTS) examples/officejs/*.js
touch $@ touch $@
${BUILDDIR}/index.html.ok: test/index.html ${BUILDDIR}/index.html.ok: test/index.html
......
...@@ -22,4 +22,4 @@ ...@@ -22,4 +22,4 @@
// editor.getSession().setMode("ace/mode/javascript"); // editor.getSession().setMode("ace/mode/javascript");
}); });
}(window, jQuery, rJS, ace)) }(window, jQuery, rJS, ace));
...@@ -52,4 +52,4 @@ ...@@ -52,4 +52,4 @@
return deferred.promise(); return deferred.promise();
}); });
}(window, $, rJS)) }(window, jQuery, rJS));
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
return text.replace(/&/g, "&amp;") return text.replace(/&/g, "&amp;")
.replace(/</g, "&lt;") .replace(/</g, "&lt;")
.replace(/>/g, "&gt;"); .replace(/>/g, "&gt;");
}; }
var gk = rJS(window); var gk = rJS(window);
...@@ -18,4 +18,4 @@ ...@@ -18,4 +18,4 @@
return rJS(this).context.find('textarea').val(); return rJS(this).context.find('textarea').val();
}); });
}(window, $, rJS)) }(window, jQuery, rJS));
...@@ -73,4 +73,4 @@ ...@@ -73,4 +73,4 @@
}); });
}); });
}(window, $, jIO, rJS)) }(window, jQuery, jIO, rJS));
...@@ -16,4 +16,4 @@ ...@@ -16,4 +16,4 @@
var g = rJS(this); var g = rJS(this);
g.context.find("#textarea-b").jqte(); g.context.find("#textarea-b").jqte();
}); });
}(window, $, rJS)) }(window, jQuery, rJS));
...@@ -21,43 +21,49 @@ ...@@ -21,43 +21,49 @@
io_a_context = g.context.find(".editor_a_safe").last(); io_a_context = g.context.find(".editor_a_safe").last();
// editor_b_context = g.context.find(".editor_b").last(), // editor_b_context = g.context.find(".editor_b").last(),
// io_b_context = g.context.find(".editor_b_safe").last(); // io_b_context = g.context.find(".editor_b_safe").last();
;
// First, load the catalog gadget // First, load the catalog gadget
g.declareGadget('./catalog.html', catalog_context).done(function (catalog) { g.declareGadget('./catalog.html', catalog_context).done(
function (catalog) {
// Fetch the list of editor and io gadgets // Fetch the list of editor and io gadgets
// This is done in 2 different queries to the catalog // This is done in 2 different queries to the catalog
$.when( $.when(
catalog.allDocs( catalog.allDocs(
{query: 'interface: "http://www.renderjs.org/interface/editor"'}), {query: 'interface: "http://www.renderjs.org/interface/editor"'}
),
catalog.allDocs( catalog.allDocs(
{query: 'interface: "http://www.renderjs.org/interface/io"'})) {query: 'interface: "http://www.renderjs.org/interface/io"'}
.done(function (editor_list, io_list) { )
).done(function (editor_list, io_list) {
var panel_context = g.context.find(".bare_panel"); var panel_context = g.context.find(".bare_panel");
// Load 1 editor and 1 IO and plug them // Load 1 editor and 1 IO and plug them
$.when( $.when(
g.declareIframedGadget(editor_list[0].path, editor_a_context), g.declareIframedGadget(editor_list[0].path, editor_a_context),
g.declareGadget(io_list[0].path, io_a_context), g.declareGadget(io_list[0].path, io_a_context),
"officejs").done(attachIOToEditor); "officejs"
).done(attachIOToEditor);
// Fill the panel // Fill the panel
$.each(editor_list, function(i, editor_definition) { $.each(editor_list, function (i, editor_definition) {
panel_context.append( panel_context.append(
'<a href="#" data-role="button" data-icon="edit" ' + '<a href="#" data-role="button" data-icon="edit" ' +
'data-iconpos="left">' + editor_definition.title + '</a>'); 'data-iconpos="left">' + editor_definition.title + '</a>'
);
panel_context.find('a').last().click(function () { panel_context.find('a').last().click(function () {
$.when( $.when(
g.declareIframedGadget(editor_definition.path, editor_a_context), g.declareIframedGadget(editor_definition.path,
editor_a_context),
g.declareGadget(io_list[0].path, io_a_context), g.declareGadget(io_list[0].path, io_a_context),
"officejs").done(attachIOToEditor); "officejs"
).done(attachIOToEditor);
}); });
}); });
panel_context.trigger('create'); panel_context.trigger('create');
}); });
}
}); );
// $.when( // $.when(
// g.declareGadget('./jqteditor.html', editor_a_context), // g.declareGadget('./jqteditor.html', editor_a_context),
...@@ -70,4 +76,4 @@ ...@@ -70,4 +76,4 @@
// "officejs_b").done(attachIOToEditor); // "officejs_b").done(attachIOToEditor);
}); });
}(window, $, rJS)) }(window, jQuery, rJS));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment