Even more linting of JS files.

This commit is contained in:
jgen 2014-04-24 00:55:14 -04:00
parent a105090039
commit 4b90faf89d
6 changed files with 25 additions and 19 deletions

View File

@ -1,3 +1,5 @@
/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
function activate_mass_tagger ( image_link ) { function activate_mass_tagger ( image_link ) {
$(".shm-thumb").each( $(".shm-thumb").each(
function ( index, block ) { function ( index, block ) {

View File

@ -1,3 +1,5 @@
/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
$(function() { $(function() {
if(window.notes) { if(window.notes) {
$('#main_image').imgNotes({notes: window.notes}); $('#main_image').imgNotes({notes: window.notes});
@ -36,9 +38,9 @@ $(function() {
}); });
function showaddnote (img, area) { function showaddnote (img, area) {
imgOffset = $(img).offset(); var imgOffset = $(img).offset();
form_left = parseInt(imgOffset.left) + parseInt(area.x1); var form_left = parseInt(imgOffset.left) + parseInt(area.x1);
form_top = parseInt(imgOffset.top) + parseInt(area.y1) + parseInt(area.height)+5; var form_top = parseInt(imgOffset.top) + parseInt(area.y1) + parseInt(area.height)+5;
$('#noteform').css({ left: form_left + 'px', top: form_top + 'px'}); $('#noteform').css({ left: form_left + 'px', top: form_top + 'px'});
$('#noteform').show(); $('#noteform').show();
@ -50,9 +52,9 @@ function showaddnote (img, area) {
} }
function showeditnote (img, area) { function showeditnote (img, area) {
imgOffset = $(img).offset(); var imgOffset = $(img).offset();
form_left = parseInt(imgOffset.left) + area.x1; var form_left = parseInt(imgOffset.left) + area.x1;
form_top = parseInt(imgOffset.top) + area.y2; var form_top = parseInt(imgOffset.top) + area.y2;
$('#noteEditForm').css({ left: form_left + 'px', top: form_top + 'px'}); $('#noteEditForm').css({ left: form_left + 'px', top: form_top + 'px'});
$('#noteEditForm').show(); $('#noteEditForm').show();

View File

@ -1,3 +1,5 @@
/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
$(function() { $(function() {
var order_pool = $.cookie("shm_ui-order-pool") || "created"; var order_pool = $.cookie("shm_ui-order-pool") || "created";
$("#order_pool option[value="+order_pool+"]").attr("selected", true); $("#order_pool option[value="+order_pool+"]").attr("selected", true);

View File

@ -44,7 +44,7 @@ var Tagger = {
var id = "tagger_alert-"+type var id = "tagger_alert-"+type
var t_alert = byId(id); var t_alert = byId(id);
if (t_alert) { if (t_alert) {
if(text == false) { if(text === false) {
// remove // remove
t_alert.parentNode.removeChild(t_alert); t_alert.parentNode.removeChild(t_alert);
} else { } else {

View File

@ -29,7 +29,7 @@
twitter_search_url: "search.twitter.com", // [string] custom twitter search url, if any (apigee, etc.) twitter_search_url: "search.twitter.com", // [string] custom twitter search url, if any (apigee, etc.)
template: "{avatar}{time}{join}{text}", // [string or function] template used to construct each tweet <li> - see code for available vars template: "{avatar}{time}{join}{text}", // [string or function] template used to construct each tweet <li> - see code for available vars
comparator: function(tweet1, tweet2) { // [function] comparator used to sort tweets (see Array.sort) comparator: function(tweet1, tweet2) { // [function] comparator used to sort tweets (see Array.sort)
return tweet2["tweet_time"] - tweet1["tweet_time"]; return tweet2.tweet_time - tweet1.tweet_time;
}, },
filter: function(tweet) { // [function] whether or not to include a particular tweet (be sure to also set 'fetch') filter: function(tweet) { // [function] whether or not to include a particular tweet (be sure to also set 'fetch')
return true; return true;
@ -48,7 +48,7 @@
result = result.replace(new RegExp('{'+key+'}','g'), val === null ? '' : val); result = result.replace(new RegExp('{'+key+'}','g'), val === null ? '' : val);
} }
return result; return result;
} else return template(info); } else { return template(info); }
} }
// Export the t function for use when passing a function as the 'template' option // Export the t function for use when passing a function as the 'template' option
$.extend({tweet: {t: t}}); $.extend({tweet: {t: t}});
@ -71,7 +71,7 @@
linkUser: replacer(/(^|[\W])@(\w+)/gi, "$1@<a href=\"http://"+s.twitter_url+"/$2\">$2</a>"), linkUser: replacer(/(^|[\W])@(\w+)/gi, "$1@<a href=\"http://"+s.twitter_url+"/$2\">$2</a>"),
// Support various latin1 (\u00**) and arabic (\u06**) alphanumeric chars // Support various latin1 (\u00**) and arabic (\u06**) alphanumeric chars
linkHash: replacer(/(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi, linkHash: replacer(/(?:^| )[\#]+([\w\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0600-\u06ff]+)/gi,
' <a href="http://'+s.twitter_search_url+'/search?q=&tag=$1&lang=all'+((s.username && s.username.length == 1 && !s.list) ? '&from='+s.username.join("%2BOR%2B") : '')+'">#$1</a>'), ' <a href="http://'+s.twitter_search_url+'/search?q=&tag=$1&lang=all'+((s.username && s.username.length === 1 && !s.list) ? '&from='+s.username.join("%2BOR%2B") : '')+'">#$1</a>'),
capAwesome: replacer(/\b(awesome)\b/gi, '<span class="awesome">$1</span>'), capAwesome: replacer(/\b(awesome)\b/gi, '<span class="awesome">$1</span>'),
capEpic: replacer(/\b(epic)\b/gi, '<span class="epic">$1</span>'), capEpic: replacer(/\b(epic)\b/gi, '<span class="epic">$1</span>'),
makeHeart: replacer(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>") makeHeart: replacer(/(&lt;)+[3]/gi, "<tt class='heart'>&#x2665;</tt>")
@ -83,7 +83,7 @@
var text = match; var text = match;
for(var i = 0; i < entities.length; ++i) { for(var i = 0; i < entities.length; ++i) {
var entity = entities[i]; var entity = entities[i];
if (entity.url == url && entity.expanded_url) { if (entity.url === url && entity.expanded_url) {
url = entity.expanded_url; url = entity.expanded_url;
text = entity.display_url; text = entity.display_url;
break; break;
@ -139,14 +139,14 @@
} }
function build_api_url() { function build_api_url() {
var proto = ('https:' == document.location.protocol ? 'https:' : 'http:'); var proto = ('https:' === document.location.protocol ? 'https:' : 'http:');
var count = (s.fetch === null) ? s.count : s.fetch; var count = (s.fetch === null) ? s.count : s.fetch;
var common_params = '&include_entities=1&callback=?'; var common_params = '&include_entities=1&callback=?';
if (s.list) { if (s.list) {
return proto+"//"+s.twitter_api_url+"/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?page="+s.page+"&per_page="+count+common_params; return proto+"//"+s.twitter_api_url+"/1/"+s.username[0]+"/lists/"+s.list+"/statuses.json?page="+s.page+"&per_page="+count+common_params;
} else if (s.favorites) { } else if (s.favorites) {
return proto+"//"+s.twitter_api_url+"/favorites/"+s.username[0]+".json?page="+s.page+"&count="+count+common_params; return proto+"//"+s.twitter_api_url+"/favorites/"+s.username[0]+".json?page="+s.page+"&count="+count+common_params;
} else if (s.query === null && s.username.length == 1) { } else if (s.query === null && s.username.length === 1) {
return proto+'//'+s.twitter_api_url+'/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+count+(s.retweets ? '&include_rts=1' : '')+'&page='+s.page+common_params; return proto+'//'+s.twitter_api_url+'/1/statuses/user_timeline.json?screen_name='+s.username[0]+'&count='+count+(s.retweets ? '&include_rts=1' : '')+'&page='+s.page+common_params;
} else { } else {
var query = (s.query || 'from:'+s.username.join(' OR from:')); var query = (s.query || 'from:'+s.username.join(' OR from:'));
@ -174,9 +174,9 @@
o.screen_name = item.from_user || item.user.screen_name; o.screen_name = item.from_user || item.user.screen_name;
o.avatar_size = s.avatar_size; o.avatar_size = s.avatar_size;
o.avatar_url = extract_avatar_url(item, (document.location.protocol === 'https:')); o.avatar_url = extract_avatar_url(item, (document.location.protocol === 'https:'));
o.retweet = typeof(item.retweeted_status) != 'undefined'; o.retweet = typeof(item.retweeted_status) !== 'undefined';
o.tweet_time = parse_date(item.created_at); o.tweet_time = parse_date(item.created_at);
o.join_text = s.join_text == "auto" ? build_auto_join_text(item.text) : s.join_text; o.join_text = s.join_text === "auto" ? build_auto_join_text(item.text) : s.join_text;
o.tweet_id = item.id_str; o.tweet_id = item.id_str;
o.twitter_base = "http://"+s.twitter_url+"/"; o.twitter_base = "http://"+s.twitter_url+"/";
o.user_url = o.twitter_base+o.screen_name; o.user_url = o.twitter_base+o.screen_name;
@ -215,10 +215,10 @@
} }
$(widget).bind("tweet:load", function(){ $(widget).bind("tweet:load", function(){
if (s.loading_text) $(widget).empty().append(loading); if (s.loading_text) { $(widget).empty().append(loading); }
$.getJSON(build_api_url(), function(data){ $.getJSON(build_api_url(), function(data){
$(widget).empty().append(list); $(widget).empty().append(list);
if (s.intro_text) list.before(intro); if (s.intro_text) { list.before(intro); }
list.empty(); list.empty();
var tweets = $.map(data.results || data, extract_template_data); var tweets = $.map(data.results || data, extract_template_data);
@ -228,7 +228,7 @@
children('li:odd').addClass('tweet_even').end(). children('li:odd').addClass('tweet_even').end().
children('li:even').addClass('tweet_odd'); children('li:even').addClass('tweet_odd');
if (s.outro_text) list.after(outro); if (s.outro_text) { list.after(outro); }
$(widget).trigger("loaded").trigger((tweets.length === 0 ? "empty" : "full")); $(widget).trigger("loaded").trigger((tweets.length === 0 ? "empty" : "full"));
if (s.refresh_interval) { if (s.refresh_interval) {
window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * s.refresh_interval); window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * s.refresh_interval);

View File

@ -141,7 +141,7 @@ function getHTTPObject() {
function getCookie( name ) { function getCookie( name ) {
var start = document.cookie.indexOf( name + "=" ); var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1; var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) { if ( ( !start ) && ( name !== document.cookie.substring( 0, name.length ) ) ) {
return null; return null;
} }
if ( start === -1 ) { return null; } if ( start === -1 ) { return null; }