mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 04:24:45 -04:00
Remove all lodash deps.
This commit is contained in:
parent
131d153cf5
commit
aebfdeb1cd
24 changed files with 123 additions and 145 deletions
|
@ -1,10 +1,11 @@
|
|||
const {win, jq, lo} = require('../globals');
|
||||
const {each, map, includes, compact} = require('../lo');
|
||||
const {win, jq} = require('../globals');
|
||||
const server = require('../server');
|
||||
const event = require('../core/event');
|
||||
const allsettings = require('../core/settings');
|
||||
const preview = require('./preview');
|
||||
|
||||
const settings = lo.extend({
|
||||
const settings = Object.assign({
|
||||
enabled: false,
|
||||
size: null,
|
||||
types: []
|
||||
|
@ -112,22 +113,22 @@ function onEnter(items, idx) {
|
|||
}
|
||||
|
||||
function initItem(item) {
|
||||
if (item.$view && lo.includes(settings.types, item.type)) {
|
||||
if (item.$view && includes(settings.types, item.type)) {
|
||||
item.$view.find('a').on('click', ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), el => {
|
||||
const matchedItems = compact(map(jq('#items .item'), el => {
|
||||
const matchedItem = el._item;
|
||||
return lo.includes(settings.types, matchedItem.type) ? matchedItem : null;
|
||||
return includes(settings.types, matchedItem.type) ? matchedItem : null;
|
||||
}));
|
||||
|
||||
onEnter(matchedItems, lo.indexOf(matchedItems, item));
|
||||
onEnter(matchedItems, matchedItems.indexOf(item));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onViewChanged(added) {
|
||||
lo.each(added, initItem);
|
||||
each(added, initItem);
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue