Skip to content

Commit

Permalink
House cleaning.
Browse files Browse the repository at this point in the history
Closes #19, and closes #18.
  • Loading branch information
Micky Hulse committed Mar 12, 2013
1 parent b6f77f9 commit cefa394
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## v2.1.0

#### March 12, 2013

* Added `clean` task to build.
* Moved all vars to tops of functions for jshint and readability's sake.
* Minor house cleaning.

#### March 11, 2013

* Updated this file.
Expand Down
38 changes: 35 additions & 3 deletions build/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ module.exports = function(grunt) {
/*----------------------------------( 01 )----------------------------------*/

/**
* Validate files with JSHint.
*
* @see http://www.jshint.com/docs/
* @see https://github.com/jshint/jshint/blob/r12/jshint.js#L256
* @see https://github.com/gruntjs/grunt-contrib-jshint
*/

jshint: {
Expand All @@ -61,6 +63,32 @@ module.exports = function(grunt) {
/*----------------------------------( 02 )----------------------------------*/

/**
* Clean files and folders.
*
* @see https://github.com/gruntjs/grunt-contrib-clean
*/

clean : {

options : {

force : true // Sketchy!

},

dist : [

'../<%= pkg.name %>/**/*'

]

},

/*----------------------------------( 03 )----------------------------------*/

/**
* Minify files with UglifyJS.
*
* @see https://github.com/gruntjs/grunt-contrib-uglify
*/

Expand All @@ -84,9 +112,11 @@ module.exports = function(grunt) {

},

/*----------------------------------( 03 )----------------------------------*/
/*----------------------------------( 04 )----------------------------------*/

/**
* Concatenate files.
*
* @see https://github.com/gruntjs/grunt-contrib-concat
*/

Expand All @@ -113,12 +143,14 @@ module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-jshint');

grunt.loadNpmTasks('grunt-contrib-clean');

grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.loadNpmTasks('grunt-contrib-concat');

//----------------------------------

grunt.registerTask('default', ['jshint', 'uglify', 'concat']);
grunt.registerTask('default', ['jshint', 'clean', 'uglify', 'concat']);

};
3 changes: 2 additions & 1 deletion build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
"dependencies": {},
"devDependencies": {
"grunt": "0.4.0",
"grunt-contrib-jshint": "0.2.0",
"grunt-contrib-nodeunit": "0.1.2",
"grunt-contrib-jshint": "0.2.0",
"grunt-contrib-clean": "0.4.0",
"grunt-contrib-uglify": "0.1.2",
"grunt-contrib-concat": "0.1.3"
}
Expand Down
19 changes: 12 additions & 7 deletions build/src/onmediaquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@

omq.init = function(query_array) {

// Declare one `var` statement per function:
var i, l;

// rgne.ws/UJ8hYh
this._callbacks = []; // Container for all callbacks registered with the plugin.
this._context = ''; // Current active query to be read inside callbacks, as `this._last_context` won't be set when they're called!
this._last_context = ''; // Current active query.

if (typeof query_array !== 'undefined') {

for (var i = 0, l = query_array.length; i < l; i++) {
for (i = 0, l = query_array.length; i < l; i++) {

this.addQuery(query_array[i]);

Expand Down Expand Up @@ -91,9 +94,11 @@

omq.removeQuery = function(query_object) {

var match;

if (query_object) { // rgne.ws/VpFmUI

var match = -1;
match = -1;

while ((match = this._callbacks.indexOf(query_object)) > -1) {

Expand Down Expand Up @@ -187,10 +192,8 @@
_triggerCallbacks = function(size, key) {

if (size && key) {

var callback_function,
i,
l;

var callback_function, i, l;

for (i = 0, l = this._callbacks.length; i < l; i++) {

Expand Down Expand Up @@ -285,7 +288,9 @@

_inArray = function(needle, haystack) {

for (var i = 0, l = haystack.length; i < l; i++) {
var i, l;

for (i = 0, l = haystack.length; i < l; i++) {

if (haystack[i] == needle) {

Expand Down
21 changes: 13 additions & 8 deletions onmediaquery/onmediaquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @copyright Copyright (c) 2013 Josh Barr.
* @license Released under the Released under the MIT license..
* @version 2.1.0
* @date 2013/03/11
* @date 2013/03/12
*/

(function(omq) { // rgne.ws/V4HOQy
Expand All @@ -30,14 +30,17 @@

omq.init = function(query_array) {

// Declare one `var` statement per function:
var i, l;

// rgne.ws/UJ8hYh
this._callbacks = []; // Container for all callbacks registered with the plugin.
this._context = ''; // Current active query to be read inside callbacks, as `this._last_context` won't be set when they're called!
this._last_context = ''; // Current active query.

if (typeof query_array !== 'undefined') {

for (var i = 0, l = query_array.length; i < l; i++) {
for (i = 0, l = query_array.length; i < l; i++) {

this.addQuery(query_array[i]);

Expand Down Expand Up @@ -104,9 +107,11 @@

omq.removeQuery = function(query_object) {

var match;

if (query_object) { // rgne.ws/VpFmUI

var match = -1;
match = -1;

while ((match = this._callbacks.indexOf(query_object)) > -1) {

Expand Down Expand Up @@ -200,10 +205,8 @@
_triggerCallbacks = function(size, key) {

if (size && key) {

var callback_function,
i,
l;

var callback_function, i, l;

for (i = 0, l = this._callbacks.length; i < l; i++) {

Expand Down Expand Up @@ -298,7 +301,9 @@

_inArray = function(needle, haystack) {

for (var i = 0, l = haystack.length; i < l; i++) {
var i, l;

for (i = 0, l = haystack.length; i < l; i++) {

if (haystack[i] == needle) {

Expand Down
2 changes: 1 addition & 1 deletion onmediaquery/onmediaquery.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cefa394

Please sign in to comment.