infieldLabel
Advanced tools
Comparing version 1.0.2 to 1.1.0
113
Gulpfile.js
@@ -1,2 +0,3 @@ | ||
var banner = ['/**', | ||
const banner = [ | ||
'/**', | ||
' * <%= pkg.name %> - <%= pkg.description %>', | ||
@@ -7,17 +8,20 @@ ' * @version v<%= pkg.version %>', | ||
' */', | ||
''].join('\n'); | ||
var browserSync = require('browser-sync').create(); | ||
var del = require('del'); | ||
var gulp = require('gulp'); | ||
var header = require('gulp-header'); | ||
var jshint = require('gulp-jshint'); | ||
var notify = require('gulp-notify'); | ||
var pkg = require('./package.json'); | ||
var plumber = require('gulp-plumber'); | ||
var rename = require('gulp-rename'); | ||
var runSequence = require('run-sequence'); | ||
var stylish = require('jshint-stylish'); | ||
var uglify = require('gulp-uglify'); | ||
'' | ||
].join('\n') | ||
const autoprefixer = require('autoprefixer') | ||
const browserSync = require('browser-sync').create() | ||
const del = require('del') | ||
const gulp = require('gulp') | ||
const header = require('gulp-header') | ||
const notify = require('gulp-notify') | ||
const pkg = require('./package.json') | ||
const plumber = require('gulp-plumber') | ||
const postcss = require('gulp-postcss') | ||
const rename = require('gulp-rename') | ||
const runSequence = require('run-sequence') | ||
const sass = require('gulp-sass') | ||
const sassGlob = require('gulp-sass-glob') | ||
const sourcemaps = require('gulp-sourcemaps') | ||
const uglify = require('gulp-uglify') | ||
/* | ||
@@ -29,7 +33,6 @@ -------------------- | ||
gulp.task('clean', function () { | ||
return del(['**/.DS_Store']); | ||
}); | ||
gulp.task('clean', () => { | ||
return del(['**/.DS_Store', './assets/*']) | ||
}) | ||
/* | ||
@@ -41,7 +44,5 @@ -------------------- | ||
gulp.task('scripts', function() { | ||
gulp.task('scripts', () => { | ||
return gulp.src(['./jquery.infieldLabel.js']) | ||
.pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")})) | ||
.pipe(jshint()) | ||
.pipe(jshint.reporter(stylish)) | ||
.pipe(uglify()) | ||
@@ -51,6 +52,56 @@ .pipe(rename('jquery.infieldLabel.min.js')) | ||
.pipe(gulp.dest('./')) | ||
.pipe(notify('Scripts uglify task complete')); | ||
}); | ||
.pipe(notify('Scripts uglify task complete')) | ||
}) | ||
/* | ||
-------------------- | ||
Styles tasks | ||
-------------------- | ||
*/ | ||
let processors = [ | ||
autoprefixer({ | ||
browsers: ['last 3 versions', '> 1%', 'ie >= 10'] | ||
}) | ||
] | ||
gulp.task('styles:infieldLabel', () => { | ||
return gulp.src([ | ||
'./src/styles/jquery.infieldLabel.scss' | ||
]) | ||
.pipe(plumber({ | ||
errorHandler: notify.onError("Error: <%= error.message %>") | ||
})) | ||
.pipe(sourcemaps.init()) | ||
.pipe(sassGlob()) | ||
.pipe(sass()) | ||
.pipe(postcss(processors)) | ||
.pipe(sourcemaps.write('maps')) | ||
.pipe(gulp.dest('./')) | ||
.pipe(browserSync.stream()) | ||
}) | ||
gulp.task('styles:other', () => { | ||
return gulp.src([ | ||
'./src/styles/index.scss' | ||
]) | ||
.pipe(plumber({ | ||
errorHandler: notify.onError("Error: <%= error.message %>") | ||
})) | ||
.pipe(sourcemaps.init()) | ||
.pipe(sassGlob()) | ||
.pipe(sass()) | ||
.pipe(postcss(processors)) | ||
.pipe(sourcemaps.write('maps')) | ||
.pipe(gulp.dest('./assets/styles')) | ||
.pipe(browserSync.stream()) | ||
}) | ||
gulp.task('styles', () => { | ||
runSequence( | ||
'styles:infieldLabel', | ||
'styles:other' | ||
) | ||
}) | ||
/* | ||
@@ -62,4 +113,4 @@ -------------------- | ||
gulp.task('default', function() { | ||
runSequence('clean', ['scripts'], function() { | ||
gulp.task('default', () => { | ||
runSequence('clean', ['scripts', 'styles'], () => { | ||
browserSync.init({ | ||
@@ -69,8 +120,10 @@ server: { | ||
} | ||
}); | ||
}) | ||
gulp.watch(['./src/styles/{,*/}{,*/}*.scss'], ['styles']) | ||
gulp.watch([ | ||
'./jquery.infieldLabel.js' | ||
], ['scripts']).on('change', browserSync.reload); | ||
}); | ||
}); | ||
], ['scripts']).on('change', browserSync.reload) | ||
}) | ||
}) |
@@ -20,14 +20,13 @@ (function($) { | ||
/* | ||
-------------------- | ||
Set up | ||
-------------------- | ||
*/ | ||
* set up | ||
*/ | ||
// first time input setup | ||
base.setup = function() { | ||
base.$input = base.$el.find('input'); | ||
base.$input = base.$el.find('input, textarea'); | ||
base.$label = base.$el.find('label'); | ||
base.$el.addClass('init'); | ||
// hide label if there's already a value | ||
@@ -74,6 +73,5 @@ base.blur(); | ||
/* | ||
-------------------- | ||
Initialize | ||
-------------------- | ||
*/ | ||
* initialize | ||
*/ | ||
base.init(); | ||
@@ -84,6 +82,4 @@ }; | ||
/* | ||
-------------------- | ||
Options | ||
-------------------- | ||
*/ | ||
* options | ||
*/ | ||
@@ -90,0 +86,0 @@ $.infieldLabel.defaultOptions = { |
/** | ||
* infieldLabel - A jQuery plugin that creates a compact, text-over-input, form layout while using semabtic HTML and preserving usability and accessibility. | ||
* @version v1.0.2 | ||
* @version v1.1.0 | ||
* @link https://github.com/ten1seven/infieldLabel | ||
* @license MIT | ||
*/ | ||
!function(i){i.infieldLabel=function(n,l){var s=this;s.$el=i(n),s.$input=null,s.init=function(){s.options=i.extend({},i.infieldLabel.defaultOptions,l),s.setup()},s.setup=function(){s.$input=s.$el.find("input"),s.$label=s.$el.find("label"),s.blur(),s.bind()},s.bind=function(){s.$input.on("focus.infield",function(){s.$el.removeClass(s.options.hideClass).addClass(s.options.focusClass)}).on("blur.infield change.infield",function(){s.blur()}),s.$label.on("click.infield",function(){s.$el.removeClass(s.options.hideClass).addClass(s.options.focusClass),s.$input.focus()})},s.blur=function(){""!==s.$input.val()?s.$el.removeClass(s.options.focusClass).addClass(s.options.hideClass):s.$el.removeClass(s.options.focusClass+" "+s.options.hideClass)},s.init()},i.infieldLabel.defaultOptions={focusClass:"placeholder-focus",hideClass:"placeholder-hide"},i.fn.infieldLabel=function(n){this.each(function(){new i.infieldLabel(this,n)})}}(jQuery); | ||
!function(i){i.infieldLabel=function(n,l){var s=this;s.$el=i(n),s.$input=null,s.init=function(){s.options=i.extend({},i.infieldLabel.defaultOptions,l),s.setup()},s.setup=function(){s.$input=s.$el.find("input, textarea"),s.$label=s.$el.find("label"),s.$el.addClass("init"),s.blur(),s.bind()},s.bind=function(){s.$input.on("focus.infield",function(){s.$el.removeClass(s.options.hideClass).addClass(s.options.focusClass)}).on("blur.infield change.infield",function(){s.blur()}),s.$label.on("click.infield",function(){s.$el.removeClass(s.options.hideClass).addClass(s.options.focusClass),s.$input.focus()})},s.blur=function(){""!==s.$input.val()?s.$el.removeClass(s.options.focusClass).addClass(s.options.hideClass):s.$el.removeClass(s.options.focusClass+" "+s.options.hideClass)},s.init()},i.infieldLabel.defaultOptions={focusClass:"placeholder-focus",hideClass:"placeholder-hide"},i.fn.infieldLabel=function(n){this.each(function(){new i.infieldLabel(this,n)})}}(jQuery); |
{ | ||
"name": "infieldLabel", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "A jQuery plugin that creates a compact, text-over-input, form layout while using semabtic HTML and preserving usability and accessibility.", | ||
@@ -17,3 +17,3 @@ "main": "jquery.infieldLabel.js", | ||
], | ||
"author": "Jeremy Fields <jeremy.fields@viget.com>", | ||
"author": "Jeremy Fields <jeremy@ten1seven.com>", | ||
"license": "MIT", | ||
@@ -23,4 +23,8 @@ "bugs": { | ||
}, | ||
"scripts": { | ||
"start": "gulp" | ||
}, | ||
"homepage": "https://github.com/ten1seven/infieldLabel", | ||
"devDependencies": { | ||
"autoprefixer": "6.3.6", | ||
"browser-sync": "2.12.1", | ||
@@ -30,11 +34,12 @@ "del": "2.2.0", | ||
"gulp-header": "1.7.1", | ||
"gulp-jshint": "2.0.0", | ||
"gulp-notify": "2.2.0", | ||
"gulp-plumber": "1.1.0", | ||
"gulp-postcss": "6.1.0", | ||
"gulp-rename": "1.2.2", | ||
"gulp-sass": "^3.1.0", | ||
"gulp-sass-glob": "^1.0.8", | ||
"gulp-sourcemaps": "^2.6.0", | ||
"gulp-uglify": "1.5.3", | ||
"jshint": "2.9.1", | ||
"jshint-stylish": "2.1.0", | ||
"run-sequence": "1.1.5" | ||
} | ||
} |
@@ -19,2 +19,4 @@ # infieldLabel | ||
or install via Bower... | ||
```shell | ||
@@ -21,0 +23,0 @@ bower install infieldLabel |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
162632
17
63
14
289
1