Permalink
Browse files

Update JS to make jslint happy, my apologies

  • Loading branch information...
1 parent b2fc79e commit 728733dcda4de32efb204ca6688336fc4c03255d @mitechie committed Sep 6, 2012
View
25 bookie/static/js/bookie/api.js
@@ -6,7 +6,6 @@
* @module api
*
*/
-
YUI.add('bookie-api', function (Y) {
ns = Y.namespace('bookie');
@@ -48,8 +47,6 @@ YUI.add('bookie-api', function (Y) {
if (args.callbacks.complete !== undefined) {
args.callbacks.complete(data, response, args);
- } else {
-
}
},
default_success = function (id, response, args) {
@@ -59,8 +56,6 @@ YUI.add('bookie-api', function (Y) {
// data we need to decode and pass to the callback
if (args.callbacks.success !== undefined) {
args.callbacks.success(data, response, args);
- } else {
-
}
},
default_failure = function (id, response, args) {
@@ -75,8 +70,6 @@ YUI.add('bookie-api', function (Y) {
response,
args
);
- } else {
-
}
};
@@ -459,20 +452,22 @@ YUI.add('bookie-api', function (Y) {
url_element: {
value: '/{resource}/bmarks',
getter: function () {
+ var ret;
// if there is no resource, use the username as the
// resource
if (!this.get('resource')) {
this.set('resource', this.get('username'));
}
if (this.get('tags')) {
- return [
+ ret = [
'/{resource}/bmarks',
this.get('tags').join('/')
].join('/');
} else {
- return '/{resource}/bmarks';
+ ret = '/{resource}/bmarks';
}
+ return ret;
}
},
@@ -966,14 +961,16 @@ YUI.add('bookie-api', function (Y) {
url_element: {
value: '/bmarks/search',
getter: function () {
+ var ret;
if (this.get('phrase').length) {
- return [
+ ret = [
'/bmarks/search',
this.get('phrase').join('/')
].join('/');
} else {
- return '/bmarks/search';
+ ret = '/bmarks/search';
}
+ return ret;
}
}
}
@@ -1032,14 +1029,16 @@ YUI.add('bookie-api', function (Y) {
url_element: {
value: '/{username}/bmarks/search',
getter: function () {
+ var ret;
if (this.get('phrase').length) {
- return [
+ ret = [
'/{username}/bmarks/search',
this.get('phrase').join('/')
].join('/');
} else {
- return '/{username}/bmarks/search';
+ ret = '/{username}/bmarks/search';
}
+ return ret;
}
}
}
View
2 bookie/static/js/bookie/history.js
@@ -88,7 +88,7 @@ YUI.add('bookie-history-module', function (Y) {
});
var updated_url = rtrim(this.get('route'), '/') + '/' + terms + '?' + qs;
- return '/' + ltrim(updated_url, '/')
+ return '/' + ltrim(updated_url, '/');
},
/**
View
30 bookie/static/js/bookie/model.js
@@ -252,9 +252,9 @@ YUI.add('bookie-model', function (Y) {
'domain': {
getter: function () {
var url = this.get('url');
- var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0]
- var spl = domain.split('.')
- return [spl[spl.length-2], spl[spl.length-1]].join('.')
+ var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0];
+ var spl = domain.split('.');
+ return [spl[spl.length-2], spl[spl.length-1]].join('.');
}
},
@@ -404,12 +404,14 @@ YUI.add('bookie-model', function (Y) {
'dateinfo': {
// we want to return a formatted version of stored
getter: function (val) {
- var stored = this.get('stored');
+ var ret,
+ stored = this.get('stored');
if (stored) {
- return (stored.getMonth() + 1) + "/" + stored.getDate();
+ ret = (stored.getMonth() + 1) + "/" + stored.getDate();
} else {
- return stored;
+ ret = stored;
}
+ return ret;
}
},
@@ -424,18 +426,20 @@ YUI.add('bookie-model', function (Y) {
'prettystored': {
// we want to return a formatted version of stored
getter: function (val) {
- var stored = this.get('stored');
+ var ret,
+ stored = this.get('stored');
if (stored) {
- return _("{month}/{date}/{year} {hours}:{minutes}", {
+ ret = _("{month}/{date}/{year} {hours}:{minutes}", {
'month': stored.getMonth() + 1,
'date': stored.getDate(),
'year': stored.getFullYear(),
'hours': stored.getHours(),
'minutes': stored.getMinutes()
});
} else {
- return stored;
+ ret = stored;
}
+ return ret;
}
}
}
@@ -610,12 +614,14 @@ YUI.add('bookie-model', function (Y) {
*
*/
_get_data: function (key, def) {
- var found = localStorage.getItem(key);
+ var ret,
+ found = localStorage.getItem(key);
if (found === null) {
- return def;
+ ret = def;
} else {
- return found;
+ ret = found;
}
+ return ret;
},
get_apicfg: function () {
View
11 extensions/chrome_ext/chrome.js
@@ -26,7 +26,7 @@ YUI().add('bookie-chrome', function (Y) {
*
*/
_bind_site_link: function () {
- var url = this.api_cfg.url
+ var url = this.api_cfg.url;
url = url.replace(/api\/v1\/?/, '');
url = url + this.api_cfg.username;
Y.one('#bookie_site').set('href', url);
@@ -75,7 +75,6 @@ YUI().add('bookie-chrome', function (Y) {
e.preventDefault();
this.indicator.show();
var model = this.get('model');
- debugger;
// we need to make sure the tag control is up to date so that we
// don't miss any tags. If the user starts typing a tag, and then
@@ -195,6 +194,7 @@ YUI().add('bookie-chrome', function (Y) {
_validate_settings: function () {
var errors = [],
+ ret,
settings = this.get('settings'),
required = [
'api_url',
@@ -210,11 +210,12 @@ YUI().add('bookie-chrome', function (Y) {
// display errors if we have them
if (errors.length) {
- return false;
+ ret = false;
} else {
- return true;
+ ret = true;
}
+ return ret;
},
events: {
@@ -539,7 +540,7 @@ YUI().add('bookie-chrome', function (Y) {
if (request.url) {
chrome.tabs.getSelected(null, function(tab_obj) {
var encoded_url = window.btoa(tab_obj.url),
- encoded_title = window.btoa(tab_obj.title)
+ encoded_title = window.btoa(tab_obj.title),
hash = [encoded_url, encoded_title].join('|');
chrome.tabs.create({url: "popup.html#" + hash});

0 comments on commit 728733d

Please sign in to comment.