Remove lodash

This commit is contained in:
gplane 2017-04-26 15:58:53 +08:00
parent 911724881c
commit 800cebcc8f
5 changed files with 32 additions and 12 deletions

View File

@ -25,8 +25,7 @@
"bootstrap-fileinput": "^4.3.3",
"bootstrap": "^3.3.6",
"sweetalert2": "^4.1.6",
"jqPaginator": "^1.2.0",
"lodash": "^4.17.4"
"jqPaginator": "^1.2.0"
},
"resolutions": {
"jquery": "1.9.1 - 3"

View File

@ -1,8 +1,8 @@
/*
* @Author: printempw
* @Date: 2016-07-21 13:38:26
* @Last Modified by: printempw
* @Last Modified time: 2017-01-22 20:45:06
* @Last Modified by: g-plane
* @Last Modified time: 2017-04-26 15:39:46
*/
'use strict';
@ -25,7 +25,6 @@ var srcPath = 'resources/assets/src/';
var distPath = 'resources/assets/dist/';
var vendorScripts = [
'lodash/dist/lodash.min.js',
'jquery/dist/jquery.min.js',
'bootstrap/dist/js/bootstrap.min.js',
'AdminLTE/dist/js/app.min.js',

View File

@ -2,7 +2,7 @@
* @Author: printempw
* @Date: 2016-07-22 14:02:44
* @Last Modified by: g-plane
* @Last Modified time: 2017-04-26 15:31:34
* @Last Modified time: 2017-04-26 15:37:52
*/
'use strict';
@ -321,7 +321,7 @@ function changeOwner(pid) {
});
});
$('.swal2-input').on('input', _.debounce(() => {
$('.swal2-input').on('input', debounce(() => {
const uid = $('.swal2-input').val();
if (uid > 0) {
Promise.resolve($.ajax({

View File

@ -1,8 +1,8 @@
/*
* @Author: printempw
* @Date: 2016-09-15 10:39:41
* @Last Modified by: printempw
* @Last Modified time: 2017-01-22 18:51:51
* @Last Modified by: g-plane
* @Last Modified time: 2017-04-26 15:57:50
*/
'use strict';
@ -157,6 +157,28 @@ function getQueryString(key) {
}
}
/**
* Return a debounced function
*
* @param {Function} func
* @param {number} delay
* @param {Array} args
* @param {Object} context
*/
function debounce(func, delay, args = [], context = undefined) {
if (isNaN(delay) || typeof func !== 'function') {
throw new Error('Arguments type of function "debounce" is incorrent!');
}
let timer = null;
return function () {
clearTimeout(timer);
timer = setTimeout(() => {
func.apply(context, args);
}, delay);
}
}
// polyfill of String.prototype.endsWith
if (!String.prototype.endsWith) {
String.prototype.endsWith = function (searchString, position) {

View File

@ -1,8 +1,8 @@
/*
* @Author: printempw
* @Date: 2016-07-16 10:02:24
* @Last Modified by: printempw
* @Last Modified time: 2017-01-20 21:19:07
* @Last Modified by: g-plane
* @Last Modified time: 2017-04-26 15:53:54
*/
'use strict';
@ -278,7 +278,7 @@ $(document).ready(function() {
});
}).catch(error => showAjaxError);
$('input[name=q]').on('input', _.debounce(() => {
$('input[name=q]').on('input', debounce(() => {
const category = $('#skin-category').hasClass('active') ? 'skin' : 'cape';
reloadCloset(
category,