Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Adds prettier, removes jshint
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jul 7, 2017
1 parent 45ce1f8 commit 0700def
Show file tree
Hide file tree
Showing 15 changed files with 796 additions and 824 deletions.
14 changes: 0 additions & 14 deletions .jshintrc

This file was deleted.

35 changes: 3 additions & 32 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,40 +129,11 @@ module.exports = function(grunt) {
qunit: {
files: ['test/**/*.html']
},
jshint: {
gruntfile: {
options: {
jshintrc: '.jshintrc'
},
src: 'Gruntfile.js'
},
src: {
options: {
jshintrc: 'src/.jshintrc',
ignores: []
},
src: ['dist/tablesaw-init.js', 'dist/tablesaw.jquery.js']
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/**/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
src: {
files: ['dist/<%= pkg.name %>.js', '<%= concat.jsall.src %>', '<%= concat.jsautoinit.src %>', '<%= concat.cssall.src %>' ],
tasks: ['src']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'qunit']
},
}
},
uglify: {
js: {
Expand Down Expand Up @@ -226,13 +197,13 @@ module.exports = function(grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

// Default task.
grunt.registerTask('travis', ['jshint', 'qunit']);
grunt.registerTask('travis', ['qunit']);
grunt.registerTask('concat-pre', ['concat:jsautoinit', 'concat:jsall', 'concat:jsjquery', 'concat:jsstack', 'concat:jsstackjquery', 'concat:cssall', 'concat:cssstack', 'concat:cssstackmixinpre']);
grunt.registerTask('concat-post', ['concat:cssstackmixinpost']);
grunt.registerTask('src', ['concat-pre', 'myth', 'concat-post', 'clean:dependencies', 'copy', 'clean:post']);
grunt.registerTask('filesize', ['uglify', 'cssmin', 'bytesize', 'clean:post']);

grunt.registerTask('default', ['src', 'jshint', 'qunit', 'filesize']);
grunt.registerTask('default', ['src', 'qunit', 'filesize']);

// Deploy
grunt.registerTask('deploy', ['default', 'gh-pages']);
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tablesaw",
"title": "Tablesaw",
"description": "A set of plugins for responsive tables.",
"version": "3.0.1",
"version": "3.0.2",
"homepage": "https://github.com/filamentgroup/tablesaw",
"author": {
"name": "Zach Leatherman",
Expand Down Expand Up @@ -42,7 +42,6 @@
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-cssmin": "^2.2.0",
"grunt-contrib-jshint": "~1.1.0",
"grunt-contrib-qunit": "~2.0.0",
"grunt-contrib-uglify": "^3.0.1",
"grunt-contrib-watch": "~1.0.0",
Expand Down
15 changes: 0 additions & 15 deletions src/.jshintrc

This file was deleted.

18 changes: 8 additions & 10 deletions src/tables-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@
* MIT License
*/

(function( win ) {
(function(win) {
"use strict";

var $;
if( 'shoestring' in win ) {
if ("shoestring" in win) {
$ = win.shoestring;
} else if( 'jQuery' in win ) {
} else if ("jQuery" in win) {
$ = win.jQuery;
} else {
throw new Error( "tablesaw: DOM library not found." );
throw new Error("tablesaw: DOM library not found.");
}

// DOM-ready auto-init of plugins.
// Many plugins bind to an "enhance" event to init themselves on dom ready, or when new markup is inserted into the DOM
// Use raw DOMContentLoaded instead of shoestring (may have issues in Android 2.3, exhibited by stack table)
if( "addEventListener" in document ) {
document.addEventListener( "DOMContentLoaded", function() {
$( document ).trigger( "enhance.tablesaw" );
if ("addEventListener" in document) {
document.addEventListener("DOMContentLoaded", function() {
$(document).trigger("enhance.tablesaw");
});
}

})( typeof window !== "undefined" ? window : this );
})(typeof window !== "undefined" ? window : this);
74 changes: 36 additions & 38 deletions src/tables.btnmarkup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,87 +8,85 @@
(function() {
var pluginName = "tablesawbtn",
methods = {
_create: function(){
return $( this ).each(function() {
$( this )
.trigger( "beforecreate." + pluginName )[ pluginName ]( "_init" )
.trigger( "create." + pluginName );
_create: function() {
return $(this).each(function() {
$(this)
.trigger("beforecreate." + pluginName)
[pluginName]("_init")
.trigger("create." + pluginName);
});
},
_init: function(){
var oEl = $( this ),
sel = this.getElementsByTagName( "select" )[ 0 ];
_init: function() {
var oEl = $(this),
sel = this.getElementsByTagName("select")[0];

if( sel ) {
if (sel) {
// TODO next major version: remove .btn-select
$( this )
.addClass( "btn-select tablesaw-btn-select" )[ pluginName ]( "_select", sel );
$(this).addClass("btn-select tablesaw-btn-select")[pluginName]("_select", sel);
}
return oEl;
},
_select: function( sel ) {
var update = function( oEl, sel ) {
var opts = $( sel ).find( "option" );
var label = document.createElement( "span" );
_select: function(sel) {
var update = function(oEl, sel) {
var opts = $(sel).find("option");
var label = document.createElement("span");
var el;
var children;
var found = false;

label.setAttribute( "aria-hidden", "true" );
label.setAttribute("aria-hidden", "true");
label.innerHTML = "&#160;";

opts.each(function() {
var opt = this;
if( opt.selected ) {
if (opt.selected) {
label.innerHTML = opt.text;
}
});

children = oEl.childNodes;
if( opts.length > 0 ){
for( var i = 0, l = children.length; i < l; i++ ) {
el = children[ i ];
if (opts.length > 0) {
for (var i = 0, l = children.length; i < l; i++) {
el = children[i];

if( el && el.nodeName.toUpperCase() === "SPAN" ) {
oEl.replaceChild( label, el );
if (el && el.nodeName.toUpperCase() === "SPAN") {
oEl.replaceChild(label, el);
found = true;
}
}

if( !found ) {
oEl.insertBefore( label, oEl.firstChild );
if (!found) {
oEl.insertBefore(label, oEl.firstChild);
}
}
};

update( this, sel );
$( this ).on( "change refresh", function() {
update( this, sel );
update(this, sel);
$(this).on("change refresh", function() {
update(this, sel);
});
}
};

// Collection method.
$.fn[ pluginName ] = function( arrg, a, b, c ) {
$.fn[pluginName] = function(arrg, a, b, c) {
return this.each(function() {

// if it's a method
if( arrg && typeof( arrg ) === "string" ){
return $.fn[ pluginName ].prototype[ arrg ].call( this, a, b, c );
if (arrg && typeof arrg === "string") {
return $.fn[pluginName].prototype[arrg].call(this, a, b, c);
}

// don't re-init
if( $( this ).data( pluginName + "active" ) ){
return $( this );
if ($(this).data(pluginName + "active")) {
return $(this);
}

$( this ).data( pluginName + "active", true );
$(this).data(pluginName + "active", true);

$.fn[ pluginName ].prototype._create.call( this );
$.fn[pluginName].prototype._create.call(this);
});
};

// add methods
$.extend( $.fn[ pluginName ].prototype, methods );

}());
$.extend($.fn[pluginName].prototype, methods);
})();
Loading

0 comments on commit 0700def

Please sign in to comment.