-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
519 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,10 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"jquery": true | ||
}, | ||
"extends": "jquery", | ||
"rules": { | ||
"no-console": "off" | ||
} | ||
} |
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,19 @@ | ||
{ | ||
"boss": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"expr": true, | ||
"immed": true, | ||
"noarg": true, | ||
"quotmark": "double", | ||
"smarttabs": true, | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true, | ||
|
||
"browser": true, | ||
"devel": true, | ||
"jquery": true, | ||
"esversion": 6 | ||
} |
File renamed without changes.
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,44 @@ | ||
/*! | ||
* jQuery Search Among Plugin | ||
* https://github.com/glebkema/jquery-search-among | ||
* | ||
* Version: 0.2.1 | ||
* | ||
* Copyright Gleb Kemarsky | ||
* Released under the MIT license. | ||
*/ | ||
|
||
(function ($) { | ||
|
||
$.fn.searchAmong = function($items) { | ||
let oldSearch = ""; | ||
|
||
$(this).on("input", function() { | ||
let newSearch = this.value.trim().toLowerCase(); | ||
if (newSearch !== oldSearch) { | ||
oldSearch = newSearch; | ||
if (newSearch) { | ||
let words = newSearch.split(/\s+/); | ||
let count = words.length; | ||
for (let item of $items) { | ||
let text = $(item).text().toLowerCase(); | ||
let is_visible = true; | ||
for (let i = 0; i < count; i++) { | ||
if (-1 === text.indexOf(words[i])) { | ||
is_visible = false; | ||
break; | ||
} | ||
} | ||
$(item).toggle(is_visible); | ||
} | ||
} | ||
else { | ||
$items.show(); | ||
} | ||
} | ||
}); | ||
|
||
return this; | ||
}; | ||
|
||
}(jQuery)); |
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,10 @@ | ||
/*! | ||
* jQuery Search Among Plugin | ||
* https://github.com/glebkema/jquery-search-among | ||
* | ||
* Version: 0.2.1 | ||
* | ||
* Copyright Gleb Kemarsky | ||
* Released under the MIT license. | ||
*/ | ||
!function(r){r.fn.searchAmong=function(e){let o="";return r(this).on("input",function(){let t=this.value.trim().toLowerCase();if(t!==o)if(o=t,t){var i,n=t.split(/\s+/),f=n.length;for(i of e){let e=r(i).text().toLowerCase(),o=!0;for(let t=0;t<f;t++)if(-1===e.indexOf(n[t])){o=!1;break}r(i).toggle(o)}}else e.show()}),this}}(jQuery); |
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,84 @@ | ||
'use strict'; | ||
|
||
const gulp = require('gulp'), | ||
isDevelopment = false, // (! process.env.NODE_ENV) || ('development' === process.env.NODE_ENV), | ||
DIR_DEST = 'dist', | ||
DIR_TESTS = 'tests', | ||
SRC_CSS = 'app/scss/**/*.scss', | ||
SRC_JS = 'app/js/**/*.js', | ||
TASK_BUILD = 'build', | ||
TASK_CSS = 'css', | ||
TASK_JS = 'js', | ||
TASK_LIVE = 'live', | ||
TASK_SERVE = 'serve', | ||
TASK_WATCH = 'watch'; | ||
|
||
function lazyRequireTask(taskName, options) { | ||
const path = './tasks/' + taskName.replace(/:/g, '-'); | ||
options = options || {}; | ||
options.taskName = taskName; | ||
options.isDevelopment = isDevelopment; | ||
gulp.task(taskName, function(callback) { | ||
let task = require(path).call(this, options); | ||
return task(callback); | ||
}); | ||
} | ||
|
||
lazyRequireTask(TASK_CSS, { | ||
src: SRC_CSS, | ||
dest: DIR_DEST, | ||
}); | ||
|
||
lazyRequireTask(TASK_CSS + ':min', { | ||
src: SRC_CSS, | ||
dest: DIR_DEST, | ||
}); | ||
|
||
lazyRequireTask(TASK_JS, { | ||
src: SRC_JS, | ||
dest: DIR_DEST, | ||
}); | ||
|
||
lazyRequireTask(TASK_JS + ':build', { | ||
src: SRC_JS, | ||
dest: DIR_DEST, | ||
}); | ||
|
||
lazyRequireTask(TASK_JS + ':hint', { | ||
src: SRC_JS, | ||
}); | ||
|
||
lazyRequireTask(TASK_JS + ':lint', { | ||
src: SRC_JS, | ||
dest: DIR_DEST, | ||
cacheFilePath: process.cwd() + '/tmp/lintCache.json', | ||
}); | ||
|
||
lazyRequireTask(TASK_JS + ':min', { | ||
src: SRC_JS, | ||
dest: DIR_DEST, | ||
}); | ||
|
||
// gulp.task(TASK_BUILD, gulp.parallel(TASK_CSS, TASK_CSS + ':min', gulp.series(TASK_JS + ':lint', TASK_JS, TASK_JS + ':min'))); | ||
// gulp.task(TASK_BUILD, gulp.parallel(TASK_CSS, TASK_CSS + ':min', TASK_JS + ':build')); | ||
gulp.task(TASK_BUILD, gulp.series(TASK_JS, TASK_JS + ':min')); | ||
|
||
lazyRequireTask(TASK_SERVE, { | ||
server: { | ||
// baseDir: '.', | ||
index: DIR_TESTS + '/index.html', | ||
}, | ||
}); | ||
|
||
gulp.task(TASK_WATCH, function() { | ||
gulp.watch(SRC_CSS, gulp.parallel(TASK_CSS, TASK_CSS + ':min')); | ||
// gulp.watch(SRC_JS, gulp.series(TASK_JS + ':lint', TASK_JS, TASK_JS + ':min')); | ||
gulp.watch(SRC_JS, gulp.parallel(TASK_JS + ':build')); | ||
}); | ||
|
||
gulp.task(TASK_LIVE, gulp.parallel(TASK_WATCH, TASK_SERVE)); | ||
|
||
gulp.task('dev', gulp.series(TASK_BUILD, TASK_LIVE)); | ||
|
||
gulp.task('default', function() { | ||
}); |
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,60 @@ | ||
{ | ||
"name": "jquery-search-among", | ||
"version": "0.2.1", | ||
"description": "Use input field to provide a quick search among list items, text paragraphs or another blocks of the web-page content. Specify multiple search terms, separated by spaces. As you enter characters, inappropriate items disappear.", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/glebkema/jquery-search-among/" | ||
}, | ||
"browserslist": [ | ||
"> 1%", | ||
"last 2 versions", | ||
"IE >= 9" | ||
], | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [ | ||
"jquery plugin", | ||
"search" | ||
], | ||
"author": "glebkema <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"autoprefixer": "^9.6.4", | ||
"browser-sync": "^2.26.7", | ||
"del": "^5.1.0", | ||
"eslint-config-standard": "^14.1.0", | ||
"eslint-config-wordpress": "^2.0.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-node": "^10.0.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"fs": "0.0.2", | ||
"gulp": "^4.0.2", | ||
"gulp-cssnano": "^2.1.3", | ||
"gulp-debug": "^4.0.0", | ||
"gulp-eslint": "^6.0.0", | ||
"gulp-if": "^3.0.0", | ||
"gulp-jshint": "^2.1.0", | ||
"gulp-load-plugins": "^2.0.1", | ||
"gulp-newer": "^1.4.0", | ||
"gulp-notify": "^3.2.0", | ||
"gulp-postcss": "^8.0.0", | ||
"gulp-rename": "^1.4.0", | ||
"gulp-replace": "^1.1.3", | ||
"gulp-sass": "^5.0.0", | ||
"gulp-sourcemaps": "^2.6.5", | ||
"gulp-uglify": "^3.0.2", | ||
"jshint": "^2.10.2", | ||
"jshint-stylish": "^2.2.1", | ||
"multipipe": "^3.0.1", | ||
"pump": "^3.0.0", | ||
"through2": "^3.0.1" | ||
}, | ||
"dependencies": { | ||
"npm": "^6.11.3" | ||
}, | ||
"optionalDependencies": {} | ||
} |
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,29 @@ | ||
'use strict'; | ||
|
||
const $ = require('gulp-load-plugins')(); | ||
const gulp = require('gulp'); | ||
const pump = require('pump'); // https://github.com/gulpjs/gulp/tree/master/docs/why-use-pump | ||
const package_json = require('../package.json'); // https://stackoverflow.com/a/22646149/6263942 | ||
|
||
module.exports = function(options) { | ||
|
||
return function(callback) { | ||
pump([ | ||
gulp.src(options.src), | ||
$.if(options.isDevelopment, $.sourcemaps.init()), | ||
$.sass(), | ||
//gulp.dest('app/css'), | ||
$.cssnano({ | ||
// autoprefixer: {browsers: ['> 1%', 'last 2 versions', 'ie >= 9'], add: true}, | ||
autoprefixer: {browsers: package_json.browserslist, add: true}, | ||
}), | ||
$.debug({title: options.taskName}), | ||
$.if(options.isDevelopment, $.sourcemaps.write('.')), | ||
$.rename({suffix: '.min'}), | ||
gulp.dest(options.dest), | ||
], | ||
callback | ||
); | ||
}; | ||
|
||
}; |
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,22 @@ | ||
'use strict'; | ||
|
||
const $ = require('gulp-load-plugins')(); | ||
const gulp = require('gulp'); | ||
const autoprefixer = require('autoprefixer'); | ||
const multipipe = require('multipipe'); | ||
|
||
module.exports = function(options) { | ||
|
||
return function() { | ||
return multipipe( | ||
gulp.src(options.src), | ||
$.if(options.isDevelopment, $.sourcemaps.init()), | ||
$.sass(), | ||
$.postcss([ autoprefixer() ]), | ||
$.debug({title: options.taskName}), | ||
$.if(options.isDevelopment, $.sourcemaps.write('.')), | ||
gulp.dest(options.dest) | ||
).on('error', $.notify.onError()); | ||
}; | ||
|
||
}; |
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,28 @@ | ||
'use strict'; | ||
|
||
const $ = require('gulp-load-plugins')(); | ||
const gulp = require('gulp'); | ||
const pump = require('pump'); // https://github.com/gulpjs/gulp/tree/master/docs/why-use-pump | ||
const replace = require('gulp-replace'); // ??? why does not work "$.replace" | ||
|
||
module.exports = function(options) { | ||
|
||
return function(callback) { | ||
pump([ | ||
gulp.src(options.src, {since: gulp.lastRun(options.taskName)}), | ||
replace('\'', '"'), // https://www.npmjs.com/package/gulp-replace | ||
$.debug({title: options.taskName}), // ????? | ||
gulp.dest(options.dest), | ||
$.jshint(), | ||
$.jshint.reporter('jshint-stylish'), | ||
$.jshint.reporter('fail'), // https://www.npmjs.com/package/gulp-jshint | ||
$.uglify({output: {comments: /^!/}}), | ||
$.debug({title: options.taskName}), // ????? | ||
$.rename({suffix: '.min'}), | ||
gulp.dest(options.dest), | ||
], | ||
callback | ||
); | ||
}; | ||
|
||
}; |
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 @@ | ||
'use strict'; | ||
|
||
const $ = require('gulp-load-plugins')(); | ||
const gulp = require('gulp'); | ||
const multipipe = require('multipipe'); | ||
|
||
module.exports = function(options) { | ||
|
||
return function() { | ||
return multipipe( | ||
gulp.src(options.src, {since: gulp.lastRun(options.taskName)}), | ||
$.jshint(), | ||
// $.jshint.reporter('jshint-stylish'), | ||
$.jshint.reporter('jshint-stylish', {beep: true}), // https://www.npmjs.com/package/jshint-stylish | ||
// $.jshint.reporter('fail'), // https://www.npmjs.com/package/gulp-jshint | ||
$.debug({title: options.taskName}) | ||
).on('error', $.notify.onError()); | ||
}; | ||
|
||
}; |
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,58 @@ | ||
'use strict'; | ||
|
||
const gulp = require('gulp'); | ||
const $ = require('gulp-load-plugins')(); | ||
const through2 = require('through2').obj; | ||
const fs = require('fs'); | ||
const multipipe = require('multipipe'); | ||
|
||
// function isFixed(file) { | ||
// return file.eslint != null && file.eslint.fixed; // has ESLint fixed the file contents? | ||
// } | ||
|
||
module.exports = function(options) { | ||
|
||
return function() { | ||
|
||
let eslintResults = {}; | ||
let cacheFilePath = options.cacheFilePath; | ||
|
||
try { | ||
eslintResults = JSON.parse(fs.readFileSync(cacheFilePath)); | ||
} catch (e) { | ||
} | ||
|
||
return gulp.src(options.src, {read: false}) | ||
.pipe($.if( | ||
function(file) { | ||
return eslintResults[file.path] && eslintResults[file.path].mtime == file.stat.mtime.toJSON(); | ||
}, | ||
through2(function(file, enc, callback) { | ||
file.eslint = eslintResults[file.path].eslint; | ||
callback(null, file); | ||
}), | ||
multipipe( | ||
through2(function(file, enc, callback) { | ||
file.contents = fs.readFileSync(file.path); | ||
callback(null, file); | ||
}), | ||
$.eslint({ fix: true }), // https://stackoverflow.com/a/37108027/6263942 | ||
// how to use? $.eslint.format(), | ||
// how to use? $.if(isFixed, gulp.dest(options.dest)), | ||
$.eslint.failAfterError(), | ||
through2(function(file, enc, callback) { | ||
eslintResults[file.path] = { | ||
eslint: file.eslint, | ||
mtime: file.stat.mtime, | ||
}; | ||
callback(null, file); | ||
}) | ||
) | ||
)) | ||
.on('end', function() { | ||
fs.writeFileSync(cacheFilePath, JSON.stringify((eslintResults))); | ||
}) | ||
.pipe($.eslint.format()); | ||
}; | ||
|
||
}; |
Oops, something went wrong.