-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit: jshint + codestyle cleanup
- Loading branch information
Showing
13 changed files
with
331 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
bower_components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
{ | ||
"requireCurlyBraces": [ | ||
"if", | ||
"else", | ||
"for", | ||
"while", | ||
"do", | ||
"try", | ||
"catch" | ||
], | ||
"requireSpaceAfterKeywords": [ | ||
"if", | ||
"else", | ||
"for", | ||
"while", | ||
"do", | ||
"switch", | ||
"return", | ||
"try", | ||
"catch" | ||
], | ||
"requireParenthesesAroundIIFE": true, | ||
"requireSpacesInFunctionExpression": { | ||
"beforeOpeningCurlyBrace": true | ||
}, | ||
"disallowSpacesInFunctionExpression": { | ||
"beforeOpeningRoundBrace": true | ||
}, | ||
"requireMultipleVarDecl": true, | ||
"requireBlocksOnNewline": true, | ||
"disallowEmptyBlocks": true, | ||
"disallowSpaceAfterObjectKeys": true, | ||
"requireCommaBeforeLineBreak": true, | ||
"requireOperatorBeforeLineBreak": [ | ||
"?", | ||
"+", | ||
"-", | ||
"/", | ||
"*", | ||
"=", | ||
"==", | ||
"===", | ||
"!=", | ||
"!==", | ||
">", | ||
">=", | ||
"<", | ||
"<=" | ||
], | ||
"disallowLeftStickedOperators": [ | ||
"?", | ||
"+", | ||
"-", | ||
"/", | ||
"*", | ||
"=", | ||
"==", | ||
"===", | ||
"!=", | ||
"!==", | ||
">", | ||
">=", | ||
"<", | ||
"<=" | ||
], | ||
"requireRightStickedOperators": ["!"], | ||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], | ||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], | ||
"requireSpaceBeforeBinaryOperators": [ | ||
"+", | ||
"-", | ||
"/", | ||
"*", | ||
"=", | ||
"==", | ||
"===", | ||
"!=", | ||
"!==" | ||
], | ||
"requireSpaceAfterBinaryOperators": [ | ||
"+", | ||
"-", | ||
"/", | ||
"*", | ||
"=", | ||
"==", | ||
"===", | ||
"!=", | ||
"!==" | ||
], | ||
"disallowMultipleLineStrings": true, | ||
"disallowMultipleLineBreaks": true, | ||
"validateQuoteMarks": { "mark": "'", "escape": true }, | ||
"validateIndentation": "\t", | ||
"disallowMixedSpacesAndTabs": true, | ||
"disallowTrailingWhitespace": true, | ||
"disallowKeywordsOnNewLine": ["else"], | ||
"requireLineFeedAtFileEnd": true, | ||
"requireDotNotation": true, | ||
"validateJSDoc": { | ||
"checkParamNames": true, | ||
"checkRedundantParams": true, | ||
"requireParamTypes": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"curly": true, | ||
|
||
"eqeqeq": true, | ||
|
||
"nonbsp": true, | ||
|
||
"quotmark": "single", | ||
|
||
"undef": true, | ||
|
||
"unused": true, | ||
|
||
"browser": true, | ||
|
||
"jquery": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = function(grunt) { | ||
|
||
// Project configuration. | ||
grunt.initConfig({ | ||
|
||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
// tasks | ||
jscs: grunt.file.readJSON('./grunt/tasks/jscs.json'), | ||
uglify: grunt.file.readJSON('./grunt/tasks/uglify.json'), | ||
jshint: grunt.file.readJSON('./grunt/tasks/jshint.json') | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-jscs-checker'); | ||
|
||
grunt.registerTask( | ||
'default', | ||
[ | ||
'jscs', | ||
'jshint', | ||
'uglify' | ||
] | ||
); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "jflickrfeed", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/gwa/jflickrfeed", | ||
"authors": [ | ||
"Joel Sutherland", | ||
"Timothy Groves <[email protected]>" | ||
], | ||
"description": "jQuery Flickr feed plugin", | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests", | ||
"package.json", | ||
"grunt", | ||
"Gruntfile.js" | ||
], | ||
"dependencies": { | ||
"jquery": "~1.11.*" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"src": "src/*.js", | ||
"options": { | ||
"config": ".jscsrc" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"options": { | ||
"jshintrc": true | ||
}, | ||
"src": [ | ||
"src/*.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"options": { | ||
"report": "min", | ||
"preserveComments": "some", | ||
"sourceMap": true | ||
}, | ||
"dist": { | ||
"files" : { | ||
"dist/jquery.jflickrfeed.min.js": [ | ||
"src/jquery.jflickrfeed.js" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "jflickrfeed", | ||
"version": "1.0.0", | ||
"description": "jQuery Flickr feed plugin", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gwa/jflickrfeed.git" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/gwa/jflickrfeed/issues" | ||
}, | ||
"homepage": "https://github.com/gwa/jflickrfeed", | ||
"devDependencies": { | ||
"grunt": "^0.4.4", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-jscs-checker": "^0.4.1", | ||
"grunt-contrib-uglify": "^0.4.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/*! | ||
* Original copyright: | ||
* | ||
* Copyright (C) 2009 Joel Sutherland | ||
* Licenced under the MIT license | ||
* http://www.newmediacampaigns.com/page/jquery-flickr-plugin | ||
* | ||
* Available tags for templates: | ||
* title, link, date_taken, description, published, author, author_id, tags, image* | ||
*/ | ||
(function($) { | ||
$.fn.jflickrfeed = function(settings, callback) { | ||
settings = $.extend(true, { | ||
flickrbase: 'http://api.flickr.com/services/feeds/', | ||
feedapi: 'photos_public.gne', | ||
limit: 20, | ||
qstrings: { | ||
lang: 'en-us', | ||
format: 'json', | ||
jsoncallback: '?' | ||
}, | ||
cleanDescription: true, | ||
useTemplate: true, | ||
itemTemplate: '', | ||
itemCallback: function() {} | ||
}, settings); | ||
|
||
var url = settings.flickrbase + settings.feedapi + '?', | ||
first = true, | ||
key; | ||
|
||
for (key in settings.qstrings) { | ||
if (!first) { | ||
url += '&'; | ||
} | ||
url += key + '=' + settings.qstrings[key]; | ||
first = false; | ||
} | ||
|
||
return $(this).each(function() { | ||
var $container = $(this), | ||
container = this; | ||
$.getJSON(url, function(data) { | ||
$.each(data.items, function(i, item) { | ||
var regex, | ||
input, | ||
key, | ||
template; | ||
if (i < settings.limit) { | ||
|
||
// Clean out the Flickr Description | ||
if (settings.cleanDescription) { | ||
regex = /<p>(.*?)<\/p>/g; | ||
input = item.description; | ||
if (regex.test(input)) { | ||
item.description = input.match(regex)[2]; | ||
if (item.description !== undefined) { | ||
item.description = item.description.replace('<p>', '').replace('</p>', ''); | ||
} | ||
} | ||
} | ||
|
||
// Add Image Sizes | ||
// http://www.flickr.com/services/api/misc.urls.html | ||
item.image_s = item.media.m.replace('_m', '_s'); | ||
item.image_t = item.media.m.replace('_m', '_t'); | ||
item.image_m = item.media.m.replace('_m', '_m'); | ||
item.image = item.media.m.replace('_m', ''); | ||
item.image_b = item.media.m.replace('_m', '_b'); | ||
item.image_q = item.media.m.replace('_m', '_q'); | ||
delete item.media; | ||
|
||
// Use Template | ||
if (settings.useTemplate) { | ||
template = settings.itemTemplate; | ||
for (key in item) { | ||
regex = new RegExp('{{' + key + '}}', 'g'); | ||
template = template.replace(regex, item[key]); | ||
} | ||
$container.append(template); | ||
} | ||
|
||
//itemCallback | ||
settings.itemCallback.call(container, item); | ||
} | ||
}); | ||
if ($.isFunction(callback)) { | ||
callback.call(container, data); | ||
} | ||
}); | ||
}); | ||
}; | ||
})(jQuery); |