gulp ->> npm scripts😄
parent
d33844119b
commit
8284e95a26
@ -1 +1,3 @@
|
||||
/*! hotkeys-js v1.0.8 | (c) 2016 | https://github.com/jaywcjlove/hotkeys.git */!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?module.exports=n():e.hotkeys=n()}(this,function(){function e(e){m=e||"all"}function n(){return m||"all"}function t(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function o(e){return"string"==typeof e&&(e=b(e)),k.indexOf(e)!==-1}function r(e){return k.slice(0)}function i(e){var t,o=e.keyCode,r=C["*"];if(k.indexOf(o)===-1&&k.push(o),93!==o&&224!==o||(o=91),o in E){E[o]=!0;for(var i in w)w[i]===o&&(h[i]=!0);if(!r)return}for(var a in E)E[a]=e[x[a]];if(h.filter.call(this,e)){if(t=n(),r)for(c=0;c<r.length;c++)r[c].scope===t&&f(e,r[c],t);if(o in C)for(var c=0;c<C[o].length;c++)f(e,C[o][c],t)}}function f(e,n,t){var o;if(n.scope===t||"all"===n.scope){o=n.mods.length>0;for(var r in E)(!E[r]&&n.mods.indexOf(+r)>-1||E[r]&&n.mods.indexOf(+r)===-1)&&(o=!1);(0!==n.mods.length||E[16]||E[18]||E[17]||E[91])&&!o&&"*"!==n.shortcut||n.method(e,n)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function a(e,t){for(var o,r,i=d(e),f=[],a=0;a<i.length;a++){if(o=i[a].split("+"),o.length>1&&(f=s(o)),e=o[o.length-1],e=b(e),void 0===t&&(t=n()),!C[e])return;for(var c=0;c<C[e].length;c++)r=C[e][c],r.scope===t&&l(r.mods,f)&&(C[e][c]={})}}function c(e){var n,t,o;for(n in C)for(t=C[n],o=0;o<t.length;)t[o].scope===e?t.splice(o,1):o++}function l(e,n){if(e.length!==n.length)return!1;for(var t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function u(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)}function s(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=w[n[t]];return n}function d(e){var n;return e=e.replace(/\s/g,""),n=e.split(","),""===n[n.length-1]&&(n[n.length-2]+=","),n}function p(e){var n=e.keyCode,t=k.indexOf(n);if(t>=0&&k.splice(t,1),93!==n&&224!==n||(n=91),n in E){E[n]=!1;for(var o in w)w[o]===n&&(h[o]=!1)}}function h(e,n,t){var o=d(e),r=[],i=0;for(void 0===t&&(t=n,n="all");i<o.length;i++)e=o[i].split("+"),r=[],e.length>1&&(r=s(e),e=[e[e.length-1]]),e=e[0],e="*"===e?"*":b(e),e in C||(C[e]=[]),C[e].push({shortcut:o[i],scope:n,method:t,key:o[i],mods:r})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var n=0;n<this.length;n++)if(this[n]===e)return n;return-1});for(var g,v=navigator.userAgent.toLowerCase().indexOf("firefox")>0,y={backspace:8,tab:9,clear:12,enter:13,"return":13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,"delete":46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":v?173:189,"=":v?61:187,";":v?59:186,"'":222,"[":219,"]":221,"\\":220},m="all",w={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":v?224:91,command:v?224:91},k=[],x={16:"shiftKey",18:"altKey",17:"ctrlKey"},E={16:!1,18:!1,17:!1},b=function(e){return y[e]||e.toUpperCase().charCodeAt(0)},C={},O=1;O<20;O++)y["f"+O]=111+O;x[v?224:91]="metaKey",E[v?224:91]=!1,t(document,"keydown",function(e){i(e)}),t(document,"keyup",function(e){p(e)}),g={setScope:e,getScope:n,deleteScope:c,getPressedKeyCodes:r,isPressed:o,filter:u,unbind:a};for(var A in g)h[A]=g[A];var K=window.hotkeys;return h.noConflict=function(e){return e&&window.hotkeys===h&&(window.hotkeys=K),h},window.hotkeys=h,h});
|
||||
/*! hotkeys-js v1.0.9 | (c) 2016 | https://github.com/jaywcjlove/hotkeys.git */
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.hotkeys=e()}}(function(){function e(e){m=e||"all"}function n(){return m||"all"}function t(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent&&e.attachEvent("on"+n,function(){t(window.event)})}function o(e){return"string"==typeof e&&(e=E(e)),k.indexOf(e)!==-1}function r(e){return k.slice(0)}function i(e){var t,o=e.keyCode,r=C["*"];if(k.indexOf(o)===-1&&k.push(o),93!==o&&224!==o||(o=91),o in b){b[o]=!0;for(var i in w)w[i]===o&&(h[i]=!0);if(!r)return}for(var l in b)b[l]=e[x[l]];if(h.filter.call(this,e)){if(t=n(),r)for(a=0;a<r.length;a++)r[a].scope===t&&f(e,r[a],t);if(o in C)for(var a=0;a<C[o].length;a++)f(e,C[o][a],t)}}function f(e,n,t){var o;if(n.scope===t||"all"===n.scope){o=n.mods.length>0;for(var r in b)(!b[r]&&n.mods.indexOf(+r)>-1||b[r]&&n.mods.indexOf(+r)===-1)&&(o=!1);(0!==n.mods.length||b[16]||b[18]||b[17]||b[91])&&!o&&"*"!==n.shortcut||n.method(e,n)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function l(e,t){for(var o,r,i=d(e),f=[],l=0;l<i.length;l++){if(o=i[l].split("+"),o.length>1&&(f=s(o)),e=o[o.length-1],e=E(e),void 0===t&&(t=n()),!C[e])return;for(var a=0;a<C[e].length;a++)r=C[e][a],r.scope===t&&u(r.mods,f)&&(C[e][a]={})}}function a(e){var n,t,o;for(n in C)for(t=C[n],o=0;o<t.length;)t[o].scope===e?t.splice(o,1):o++}function u(e,n){if(e.length!==n.length)return!1;for(var t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function c(e){var n=(e.target||e.srcElement).tagName;return!("INPUT"===n||"SELECT"===n||"TEXTAREA"===n)}function s(e){for(var n=e.slice(0,e.length-1),t=0;t<n.length;t++)n[t]=w[n[t]];return n}function d(e){var n;return e=e.replace(/\s/g,""),n=e.split(","),""===n[n.length-1]&&(n[n.length-2]+=","),n}function p(e){var n=e.keyCode,t=k.indexOf(n);if(t>=0&&k.splice(t,1),93!==n&&224!==n||(n=91),n in b){b[n]=!1;for(var o in w)w[o]===n&&(h[o]=!1)}}function h(e,n,t){var o=d(e),r=[],i=0;for(void 0===t&&(t=n,n="all");i<o.length;i++)e=o[i].split("+"),r=[],e.length>1&&(r=s(e),e=[e[e.length-1]]),e=e[0],e="*"===e?"*":E(e),e in C||(C[e]=[]),C[e].push({shortcut:o[i],scope:n,method:t,key:o[i],mods:r})}Array.prototype.indexOf||(Array.prototype.indexOf=function(e){for(var n=0;n<this.length;n++)if(this[n]===e)return n;return-1});for(var g,v=navigator.userAgent.toLowerCase().indexOf("firefox")>0,y={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":v?173:189,"=":v?61:187,";":v?59:186,"'":222,"[":219,"]":221,"\\":220},m="all",w={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":v?224:91,command:v?224:91},k=[],x={16:"shiftKey",18:"altKey",17:"ctrlKey"},b={16:!1,18:!1,17:!1},E=function(e){return y[e]||e.toUpperCase().charCodeAt(0)},C={},O=1;O<20;O++)y["f"+O]=111+O;x[v?224:91]="metaKey",b[v?224:91]=!1,t(document,"keydown",function(e){i(e)}),t(document,"keyup",function(e){p(e)}),g={setScope:e,getScope:n,deleteScope:a,getPressedKeyCodes:r,isPressed:o,filter:c,unbind:l};for(var A in g)h[A]=g[A];var K=window.hotkeys;return h.noConflict=function(e){return e&&window.hotkeys===h&&(window.hotkeys=K),h},window.hotkeys=h,h});
|
||||
|
||||
|
@ -1,64 +0,0 @@
|
||||
var gulp = require('gulp');
|
||||
var watch = require('gulp-watch');
|
||||
var rename = require("gulp-rename");
|
||||
var uglify = require('gulp-uglify');
|
||||
var umd = require('gulp-umd')
|
||||
var gutil = require('gulp-util');
|
||||
var banner = require('gulp-banner');
|
||||
var bannerjs = require('bannerjs');
|
||||
var sourcemap = require('gulp-sourcemap');
|
||||
|
||||
|
||||
|
||||
gulp.task('default',["build","min"])
|
||||
|
||||
|
||||
gulp.task('watch',function(){
|
||||
gulp.watch('./src/**/*',['default'])
|
||||
})
|
||||
|
||||
gulp.task('build', function (cb) {
|
||||
|
||||
gulp.src('src/hotkeys.js')
|
||||
.pipe(umd({
|
||||
exports: function(file) {
|
||||
return 'hotkeys';
|
||||
},
|
||||
namespace: function(file) {
|
||||
return 'hotkeys';
|
||||
}
|
||||
}))
|
||||
.pipe(banner(bannerjs.multibanner()))
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
|
||||
})
|
||||
|
||||
|
||||
gulp.task('min', function (cb) {
|
||||
|
||||
gulp.src('dist/hotkeys.js')
|
||||
.pipe(uglify({
|
||||
mangle: true,
|
||||
output:{
|
||||
// comments:true
|
||||
}
|
||||
}))
|
||||
.pipe(rename({
|
||||
suffix:".min"
|
||||
}))
|
||||
.pipe(banner(bannerjs.onebanner()))
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
|
||||
})
|
||||
|
||||
gulp.task('map', function (cb) {
|
||||
|
||||
gulp.src('dist/hotkeys.js')
|
||||
.pipe(sourcemap({
|
||||
outSourceMap:'hotkeys.min.map',
|
||||
sourceRoot:"http://jslite.io",
|
||||
write:'./dist/'
|
||||
}))
|
||||
.pipe(gulp.dest('./dist/'));
|
||||
|
||||
})
|
Loading…
Reference in New Issue