diff --git a/.jscsrc b/.jscsrc index 58d73089b585d1f774128ca82d9b829912774237..01a598ef72aaf1c26b34dec1cb12a68e220bc3e3 100644 --- a/.jscsrc +++ b/.jscsrc @@ -35,6 +35,7 @@ "examples/js_of_ocaml/js/*.js", "examples/polymer/elements/elements.build.js", "examples/thorax/js/lib/backbone-localstorage.js", + "examples/thorax_lumbar/public/*.js", "examples/typescript-*/js/**/*.js", "examples/vanilladart/**/*.js" ], diff --git a/examples/thorax_lumbar/public/base.js b/examples/thorax_lumbar/public/base.js index 16ec208b3eaafb7cec8a04d5f2b8ffa6cb70ac7b..6be8950c3dadbbe58dc28a8ff3f221917f28eeba 100644 --- a/examples/thorax_lumbar/public/base.js +++ b/examples/thorax_lumbar/public/base.js @@ -17276,12 +17276,15 @@ if (module.exports.loader && module.exports.loader.map && window.Backbone) { } ;; +/*global Thorax, Backbone, $ */ + //all templates are assumed to be in the templates directory Thorax.templatePathPrefix = 'src/templates/'; var app = window.app = module.exports; $(function () { + 'use strict'; app.initBackboneLoader(); Backbone.history.start(); }); diff --git a/examples/thorax_lumbar/public/todomvc.js b/examples/thorax_lumbar/public/todomvc.js index 4d375b7aba080e42f8ed89542f783213e5e41925..dc511bad00056f09ceb59762623dc3a106142d0f 100644 --- a/examples/thorax_lumbar/public/todomvc.js +++ b/examples/thorax_lumbar/public/todomvc.js @@ -7,6 +7,7 @@ Application['todomvc'] = (function() { /* router : todomvc */ module.name = "todomvc"; module.routes = {"":"setFilter",":filter":"setFilter"}; +/*global Thorax */ (function () { 'use strict'; @@ -46,6 +47,7 @@ module.routes = {"":"setFilter",":filter":"setFilter"}; }()); ;; +/*global Thorax, Store */ (function () { 'use strict'; @@ -91,7 +93,8 @@ module.routes = {"":"setFilter",":filter":"setFilter"}; }()); ;; -/*global Thorax, ENTER_KEY, ESCAPE_KEY*/ +/*global Thorax, $, ENTER_KEY, ESCAPE_KEY */ + $(function () { 'use strict'; @@ -173,7 +176,9 @@ $(function () { }); ;; -Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-count\"><strong>{{remaining}}</strong> {{itemText}} left</span>\n<ul id=\"filters\">\n <li>\n {{#link \"/\" class=\"selected\"}}All{{/link}}\n </li>\n <li>\n {{#link \"/active\"}}Active{{/link}}\n </li>\n <li>\n {{#link \"/completed\"}}Completed{{/link}}\n </li>\n</ul>\n{{#if completed}}\n <button id=\"clear-completed\">Clear completed</button>\n{{/if}}\n');Thorax.View.extend({ +Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-count\"><strong>{{remaining}}</strong> {{itemText}} left</span>\n<ul id=\"filters\">\n <li>\n {{#link \"/\" class=\"selected\"}}All{{/link}}\n </li>\n <li>\n {{#link \"/active\"}}Active{{/link}}\n </li>\n <li>\n {{#link \"/completed\"}}Completed{{/link}}\n </li>\n</ul>\n{{#if completed}}\n <button id=\"clear-completed\">Clear completed</button>\n{{/if}}\n');/*global Thorax, _ */ + +Thorax.View.extend({ name: 'stats', events: { @@ -185,6 +190,7 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co }, initialize: function () { + 'use strict'; // Whenever the Todos collection changes re-render the stats // render() needs to be called with no arguments, otherwise calling // it with arguments will insert the arguments as content @@ -195,6 +201,7 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co // Clear all completed todo items, destroying their models. clearCompleted: function () { + 'use strict'; _.each(window.app.Todos.completed(), function (todo) { todo.destroy(); }); @@ -206,6 +213,7 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co // be called to generate the context / scope that the template // will be called with. "context" defaults to "return this" context: function () { + 'use strict'; var remaining = window.app.Todos.remaining().length; return { itemText: remaining === 1 ? 'item' : 'items', @@ -216,15 +224,18 @@ Thorax.templates['src/templates/stats'] = Handlebars.compile('<span id=\"todo-co // Highlight which filter will appear to be active highlightFilter: function () { + 'use strict'; this.$('#filters li a') - .removeClass('selected') - .filter('[href="#/' + (window.app.TodoFilter || '') + '"]') - .addClass('selected'); + .removeClass('selected') + .filter('[href="#/' + (window.app.TodoFilter || '') + '"]') + .addClass('selected'); } }); ;; -Thorax.templates['src/templates/app'] = Handlebars.compile('<section id=\"todoapp\">\n <header id=\"header\">\n <h1>todos</h1>\n <input id=\"new-todo\" placeholder=\"What needs to be done?\" autofocus>\n </header>\n {{^empty collection}}\n <section id=\"main\">\n <input id=\"toggle-all\" type=\"checkbox\">\n <label for=\"toggle-all\">Mark all as complete</label>\n {{#collection item-view=\"todo-item\" tag=\"ul\" id=\"todo-list\"}}\n <div class=\"view\">\n <input class=\"toggle\" type=\"checkbox\" {{#if completed}}checked=\"checked\"{{/if}}>\n <label>{{title}}</label>\n <button class=\"destroy\"></button>\n </div>\n <input class=\"edit\" value=\"{{title}}\">\n {{/collection}}\n </section>\n {{view \"stats\" tag=\"footer\" id=\"footer\"}}\n {{/empty}}\n</section>\n<div id=\"info\">\n <p>Double-click to edit a todo</p>\n <p>Written by <a href=\"https://github.com/addyosmani\">Addy Osmani</a> & <a href=\"https://github.com/eastridge\">Ryan Eastridge</a></p>\n <p>Part of <a href=\"http://todomvc.com\">TodoMVC</a></p>\n</div>\n');$(function ($) { +Thorax.templates['src/templates/app'] = Handlebars.compile('<section id=\"todoapp\">\n <header id=\"header\">\n <h1>todos</h1>\n <input id=\"new-todo\" placeholder=\"What needs to be done?\" autofocus>\n </header>\n {{^empty collection}}\n <section id=\"main\">\n <input id=\"toggle-all\" type=\"checkbox\">\n <label for=\"toggle-all\">Mark all as complete</label>\n {{#collection item-view=\"todo-item\" tag=\"ul\" id=\"todo-list\"}}\n <div class=\"view\">\n <input class=\"toggle\" type=\"checkbox\" {{#if completed}}checked=\"checked\"{{/if}}>\n <label>{{title}}</label>\n <button class=\"destroy\"></button>\n </div>\n <input class=\"edit\" value=\"{{title}}\">\n {{/collection}}\n </section>\n {{view \"stats\" tag=\"footer\" id=\"footer\"}}\n {{/empty}}\n</section>\n<div id=\"info\">\n <p>Double-click to edit a todo</p>\n <p>Written by <a href=\"https://github.com/addyosmani\">Addy Osmani</a> & <a href=\"https://github.com/eastridge\">Ryan Eastridge</a></p>\n <p>Part of <a href=\"http://todomvc.com\">TodoMVC</a></p>\n</div>\n');/*global Thorax, $, ENTER_KEY */ + +$(function () { 'use strict'; // The Application @@ -294,6 +305,8 @@ Thorax.templates['src/templates/app'] = Handlebars.compile('<section id=\"todoap }); ;; +/*global Thorax */ + (function () { 'use strict'; @@ -313,17 +326,18 @@ Thorax.templates['src/templates/app'] = Handlebars.compile('<section id=\"todoap // force the collection to re-filter window.app.Todos.trigger('filter'); } - })); + }))(); }()); ;; -/*global Thorax, Backbone*/ +/*global Thorax, $ */ /*jshint unused:false*/ var ENTER_KEY = 13; var ESCAPE_KEY = 27; $(function () { + 'use strict'; // Kick things off by creating the **App**. var view = new Thorax.Views.app({ collection: window.app.Todos diff --git a/examples/thorax_lumbar/src/js/app.js b/examples/thorax_lumbar/src/js/app.js index d0764175bc567582563543472442787c2881b4ef..2d422f634241a0c751ffca78a58cb4893ef7ca10 100644 --- a/examples/thorax_lumbar/src/js/app.js +++ b/examples/thorax_lumbar/src/js/app.js @@ -1,9 +1,10 @@ -/*global Thorax, Backbone*/ +/*global Thorax, $ */ /*jshint unused:false*/ var ENTER_KEY = 13; var ESCAPE_KEY = 27; $(function () { + 'use strict'; // Kick things off by creating the **App**. var view = new Thorax.Views.app({ collection: window.app.Todos diff --git a/examples/thorax_lumbar/src/js/collections/todos.js b/examples/thorax_lumbar/src/js/collections/todos.js index 62289a2738f23d961fbce2bcc01e361ac769156d..c77896b8be31521c591270ac0085c63d5b4da626 100644 --- a/examples/thorax_lumbar/src/js/collections/todos.js +++ b/examples/thorax_lumbar/src/js/collections/todos.js @@ -1,3 +1,4 @@ +/*global Thorax, Store */ (function () { 'use strict'; diff --git a/examples/thorax_lumbar/src/js/init.js b/examples/thorax_lumbar/src/js/init.js index ae6812453566aa09d4a7ca14c4ba34945e14e7c5..a5ccc405d9da3772cd831689b39f35c3409ed704 100644 --- a/examples/thorax_lumbar/src/js/init.js +++ b/examples/thorax_lumbar/src/js/init.js @@ -1,9 +1,12 @@ +/*global Thorax, Backbone, $ */ + //all templates are assumed to be in the templates directory Thorax.templatePathPrefix = 'src/templates/'; var app = window.app = module.exports; $(function () { + 'use strict'; app.initBackboneLoader(); Backbone.history.start(); }); diff --git a/examples/thorax_lumbar/src/js/models/todo.js b/examples/thorax_lumbar/src/js/models/todo.js index cfbf88ffc1fc84bad4b9ba6f88c98e9e95e64a25..3e27785632227e7c9e074f1d0a727815c9772801 100644 --- a/examples/thorax_lumbar/src/js/models/todo.js +++ b/examples/thorax_lumbar/src/js/models/todo.js @@ -1,3 +1,4 @@ +/*global Thorax */ (function () { 'use strict'; diff --git a/examples/thorax_lumbar/src/js/routers/todomvc.js b/examples/thorax_lumbar/src/js/routers/todomvc.js index 37bca2067945357f16a5408452b3bca848e9a910..6547affbf18a420ddbcdcb20d1ed3610eadf9852 100644 --- a/examples/thorax_lumbar/src/js/routers/todomvc.js +++ b/examples/thorax_lumbar/src/js/routers/todomvc.js @@ -1,3 +1,5 @@ +/*global Thorax */ + (function () { 'use strict'; @@ -17,6 +19,6 @@ // force the collection to re-filter window.app.Todos.trigger('filter'); } - })); + }))(); }()); diff --git a/examples/thorax_lumbar/src/js/views/app.js b/examples/thorax_lumbar/src/js/views/app.js index 93950d67587ba97e3472b8efbb7640dce0936cdc..904191682f5dc542d0e373510ce2c848bdf370e7 100644 --- a/examples/thorax_lumbar/src/js/views/app.js +++ b/examples/thorax_lumbar/src/js/views/app.js @@ -1,4 +1,6 @@ -$(function ($) { +/*global Thorax, $, ENTER_KEY */ + +$(function () { 'use strict'; // The Application diff --git a/examples/thorax_lumbar/src/js/views/stats.js b/examples/thorax_lumbar/src/js/views/stats.js index 4d2d16035f8fa6abff7c10ee1e14bba25e2c0acb..f5068327f72960e1e1e02fdc878d0a2d3a288f9c 100644 --- a/examples/thorax_lumbar/src/js/views/stats.js +++ b/examples/thorax_lumbar/src/js/views/stats.js @@ -1,3 +1,5 @@ +/*global Thorax, _ */ + Thorax.View.extend({ name: 'stats', @@ -10,6 +12,7 @@ Thorax.View.extend({ }, initialize: function () { + 'use strict'; // Whenever the Todos collection changes re-render the stats // render() needs to be called with no arguments, otherwise calling // it with arguments will insert the arguments as content @@ -20,6 +23,7 @@ Thorax.View.extend({ // Clear all completed todo items, destroying their models. clearCompleted: function () { + 'use strict'; _.each(window.app.Todos.completed(), function (todo) { todo.destroy(); }); @@ -31,6 +35,7 @@ Thorax.View.extend({ // be called to generate the context / scope that the template // will be called with. "context" defaults to "return this" context: function () { + 'use strict'; var remaining = window.app.Todos.remaining().length; return { itemText: remaining === 1 ? 'item' : 'items', @@ -41,9 +46,10 @@ Thorax.View.extend({ // Highlight which filter will appear to be active highlightFilter: function () { + 'use strict'; this.$('#filters li a') - .removeClass('selected') - .filter('[href="#/' + (window.app.TodoFilter || '') + '"]') - .addClass('selected'); + .removeClass('selected') + .filter('[href="#/' + (window.app.TodoFilter || '') + '"]') + .addClass('selected'); } }); diff --git a/examples/thorax_lumbar/src/js/views/todo-item.js b/examples/thorax_lumbar/src/js/views/todo-item.js index e23ac010ce48e2b44408b56a453873882e92f5df..0eed3e265736e3f395422b84a429bbb3aba0fa84 100644 --- a/examples/thorax_lumbar/src/js/views/todo-item.js +++ b/examples/thorax_lumbar/src/js/views/todo-item.js @@ -1,4 +1,5 @@ -/*global Thorax, ENTER_KEY, ESCAPE_KEY*/ +/*global Thorax, $, ENTER_KEY, ESCAPE_KEY */ + $(function () { 'use strict';