From ba5d1d00b486899a0f799eb261ee983bd8c09261 Mon Sep 17 00:00:00 2001 From: Joe Catera Date: Thu, 18 Oct 2012 00:13:46 -0700 Subject: [PATCH] Fixed JSLint errors. --- .../part1/hello/application.json | 1 - .../mojits/HelloMojit/controller.server.js | 5 ++- .../part2/basic_yql/application.json | 3 -- .../part2/basic_yql/index.js | 8 ++-- .../mojits/Flickr/controller.server.js | 9 ++-- .../mojits/Flickr/models/model.server.js | 29 ++++++------- .../part2/basic_yql/routes.json | 10 ++--- .../part3/intl-templates/application.json | 2 - .../part3/intl-templates/index.js | 6 +-- .../mojits/Flickr/controller.server.js | 23 +++++----- .../mojits/Flickr/lang/Flickr.js | 4 +- .../mojits/Flickr/lang/Flickr_de.js | 3 +- .../mojits/Flickr/models/model.server.js | 24 +++++------ .../part3/intl-templates/routes.json | 3 +- .../part3/intl-templates/server.js | 4 +- .../part4/paged-yql/application.json | 1 - .../part4/paged-yql/index.js | 6 +-- .../mojits/PagedFlickr/binders/index.js | 42 ++++++++----------- .../mojits/PagedFlickr/controller.common.js | 32 +++++++------- .../mojits/PagedFlickr/lang/PagedFlickr_de.js | 5 +-- .../PagedFlickr/lang/PagedFlickr_en-US.js | 5 +-- .../mojits/PagedFlickr/models/model.common.js | 32 +++++++------- .../part4/paged-yql/routes.json | 3 -- .../part4/paged-yql/server.js | 3 +- .../part5/flickr-list/application.json | 2 - .../part5/flickr-list/models/flickr.common.js | 40 +++++++++--------- .../mojits/FlickrBrowser/assets/logmutator.js | 3 +- .../mojits/FlickrBrowser/binders/index.js | 10 ++--- .../mojits/FlickrBrowser/controller.common.js | 6 ++- .../mojits/FlickrDetail/binders/index.js | 20 ++++----- .../mojits/FlickrDetail/binders/message.js | 4 +- .../mojits/FlickrDetail/controller.common.js | 12 +++--- .../FlickrDetail/lang/FlickrDetail_de.js | 3 +- .../FlickrDetail/lang/FlickrDetail_en-US.js | 4 +- .../mojits/PagedFlickr/binders/index.js | 20 ++++----- .../mojits/PagedFlickr/controller.common.js | 38 +++++++++-------- .../mojits/PagedFlickr/lang/PagedFlickr_de.js | 4 +- .../PagedFlickr/lang/PagedFlickr_en-US.js | 4 +- .../part5/flickr-list/routes.json | 3 -- 39 files changed, 209 insertions(+), 227 deletions(-) diff --git a/examples/getting-started-guide/part1/hello/application.json b/examples/getting-started-guide/part1/hello/application.json index d927c148f..7917a43d8 100644 --- a/examples/getting-started-guide/part1/hello/application.json +++ b/examples/getting-started-guide/part1/hello/application.json @@ -1,7 +1,6 @@ [ { "settings": [ "master" ], - "specs": { "hello": { "type": "HelloMojit" diff --git a/examples/getting-started-guide/part1/hello/mojits/HelloMojit/controller.server.js b/examples/getting-started-guide/part1/hello/mojits/HelloMojit/controller.server.js index 70987547d..c5ffa2076 100644 --- a/examples/getting-started-guide/part1/hello/mojits/HelloMojit/controller.server.js +++ b/examples/getting-started-guide/part1/hello/mojits/HelloMojit/controller.server.js @@ -4,8 +4,9 @@ * See the accompanying LICENSE file for terms. */ -YUI.add('HelloMojit', function(Y, NAME) { +YUI.add('HelloMojit', function (Y, NAME) { + "use strict"; /** * The HelloMojit module. * @@ -26,7 +27,7 @@ YUI.add('HelloMojit', function(Y, NAME) { * @param ac {Object} The action context that provides access * to the Mojito API. */ - index: function(ac) { + index: function (ac) { ac.done('Mojito is working.'); } diff --git a/examples/getting-started-guide/part2/basic_yql/application.json b/examples/getting-started-guide/part2/basic_yql/application.json index ef6620822..35320ebf1 100644 --- a/examples/getting-started-guide/part2/basic_yql/application.json +++ b/examples/getting-started-guide/part2/basic_yql/application.json @@ -1,13 +1,10 @@ [ { - "settings" : ["master"], - "specs": { "flickr": { "type": "Flickr" } } - } ] diff --git a/examples/getting-started-guide/part2/basic_yql/index.js b/examples/getting-started-guide/part2/basic_yql/index.js index e13db6ce2..a80baf402 100644 --- a/examples/getting-started-guide/part2/basic_yql/index.js +++ b/examples/getting-started-guide/part2/basic_yql/index.js @@ -16,13 +16,13 @@ process.chdir(__dirname); * @param {object} token Token used to identify the application. */ module.exports = function(config, token) { - var server = require('./server.js'); - var YUI = require('mojito').YUI; + var server = require('./server.js'), + YUI = require('mojito').YUI; - YUI().use('mojito-server', function(Y) { + YUI().use('mojito-server', function (Y) { var app = server(Y); // Signal the app is ready, providing the token and app references. process.emit("application-ready", token, app); - }); + }); }; diff --git a/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/controller.server.js b/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/controller.server.js index 95a09c34f..bdd719970 100644 --- a/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/controller.server.js +++ b/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/controller.server.js @@ -4,8 +4,9 @@ * See the accompanying LICENSE file for terms. */ -YUI.add('Flickr', function(Y, NAME) { +YUI.add('Flickr', function (Y, NAME) { + "use strict"; /** * The Flickr module. * @@ -21,8 +22,8 @@ YUI.add('Flickr', function(Y, NAME) { * to the Mojito API. * @return {} */ - index: function(ac) { - ac.models.flickr.getFlickrImages('mojito', function(images) { + index: function (ac) { + ac.models.FlickrModel.getFlickrImages('mojito', function (images) { ac.flush({images: images}); @@ -32,4 +33,4 @@ YUI.add('Flickr', function(Y, NAME) { }; -}, '0.0.1', {requires: []}); +}, '0.0.1', {requires: ['FlickrModel']}); diff --git a/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/models/model.server.js b/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/models/model.server.js index 629feebbe..f1482b1e9 100644 --- a/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/models/model.server.js +++ b/examples/getting-started-guide/part2/basic_yql/mojits/Flickr/models/model.server.js @@ -4,7 +4,10 @@ * See the accompanying LICENSE file for terms. */ -YUI.add('FlickrModel', function(Y) { +/*jslint plusplus:true */ +YUI.add('FlickrModel', function (Y, NAME) { + "use strict"; + var API_KEY = '84921e87fb8f2fc338c3ff9bf51a412e'; /** @@ -12,8 +15,12 @@ YUI.add('FlickrModel', function(Y) { * * @module FlickrModel */ - - Y.mojito.models.flickr = { + function buildFlickrUrlFromRecord(record) { + return 'http://farm' + record.farm + + '.static.flickr.com/' + record.server + + '/' + record.id + '_' + record.secret + '.jpg'; + } + Y.namespace('mojito.models')[NAME] = { /** * Method that will be invoked by the mojit controller to obtain data. @@ -22,17 +29,17 @@ YUI.add('FlickrModel', function(Y) { * data has been retrieved. * @return {Object} photots */ - getFlickrImages: function(queryString, callback) { + getFlickrImages: function (queryString, callback) { var q = 'select * from flickr.photos.search where text="' + queryString + '" and api_key="' + API_KEY + '"'; - Y.YQL(q, function(rawYqlData) { + Y.YQL(q, function (rawYqlData) { Y.log(rawYqlData); var rawPhotos = rawYqlData.query.results.photo, - rawPhoto = null + rawPhoto = null, photos = [], photo = null, i = 0; - for (; i 1) { - data.prev.url = selfUrl(ac, 'flickr', { page: page-1 }); + data.prev.url = selfUrl(ac, 'flickr', { page: page - 1 }); data.has_prev = true; } ac.done(data); @@ -82,12 +93,5 @@ YUI.add('PagedFlickr', function(Y, NAME) { } }; - function selfUrl(ac, mojitType, mods) { - var params = Y.mojito.util.copy(ac.params.merged()); - for (var k in mods) { - params[k] = mods[k]; - } - return ac.url.make(mojitType, 'index', Y.QueryString.stringify(params)); - } }, '0.0.1', {requires: ['mojito-intl-addon', 'mojito-util', 'querystring-stringify', 'ModelFlickr'], lang: ['de', 'en-US']}); diff --git a/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_de.js b/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_de.js index 5d8715d01..1347db7e5 100644 --- a/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_de.js +++ b/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_de.js @@ -4,8 +4,8 @@ * See the accompanying LICENSE file for terms. */ -YUI.add("lang/PagedFlickr_de", function(Y) { - +YUI.add("lang/PagedFlickr_de", function (Y) { + "use strict"; Y.Intl.add( "PagedFlickr", // associated module diff --git a/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_en-US.js b/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_en-US.js index 2db027bd4..2cecc23b0 100644 --- a/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_en-US.js +++ b/examples/getting-started-guide/part5/flickr-list/mojits/PagedFlickr/lang/PagedFlickr_en-US.js @@ -4,8 +4,8 @@ * See the accompanying LICENSE file for terms. */ -YUI.add("lang/PagedFlickr_en-US", function(Y) { - +YUI.add("lang/PagedFlickr_en-US", function (Y) { + "use strict"; Y.Intl.add( "PagedFlickr", // associated module diff --git a/examples/getting-started-guide/part5/flickr-list/routes.json b/examples/getting-started-guide/part5/flickr-list/routes.json index 54c7733e3..97099c2ea 100644 --- a/examples/getting-started-guide/part5/flickr-list/routes.json +++ b/examples/getting-started-guide/part5/flickr-list/routes.json @@ -1,19 +1,16 @@ [ { "settings": [ "master" ], - "flickr_by_page": { "verbs": ["get"], "path": "/flickr/page/:page/image/:image", "call": "flickr.index" }, - "flickr_base": { "verbs": ["get"], "path": "/flickr", "params": "page=1&image=0", "call": "flickr.index" } - } ]