More changes from jq.data to pure props.
This commit is contained in:
parent
a3c9bc9db0
commit
131d153cf5
8 changed files with 15 additions and 19 deletions
|
@ -20,7 +20,8 @@ let $crumbbar;
|
|||
|
||||
|
||||
function createHtml(item) {
|
||||
const $html = jq(crumbTemplate).data('item', item);
|
||||
const $html = jq(crumbTemplate);
|
||||
$html[0]._item = item;
|
||||
item.elCrumb = $html[0];
|
||||
location.setLink($html, item);
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ function initItem(item) {
|
|||
item.$view.find('a').on('click', ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), matchedItem => {
|
||||
matchedItem = jq(matchedItem).data('item');
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), el => {
|
||||
const matchedItem = el._item;
|
||||
return lo.includes(settings.types, matchedItem.type) ? matchedItem : null;
|
||||
}));
|
||||
|
||||
|
|
|
@ -116,8 +116,8 @@ function initItem(item) {
|
|||
item.$view.find('a').on('click', ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), matchedItem => {
|
||||
matchedItem = jq(matchedItem).data('item');
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), el => {
|
||||
const matchedItem = el._item;
|
||||
return lo.includes(settings.types, matchedItem.type) ? matchedItem : null;
|
||||
}));
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ function initItem(item) {
|
|||
item.$view.find('a').on('click', ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), matchedItem => {
|
||||
matchedItem = jq(matchedItem).data('item');
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), el => {
|
||||
const matchedItem = el._item;
|
||||
return lo.includes(lo.keys(settings.types), matchedItem.type) ? matchedItem : null;
|
||||
}));
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ function initItem(item) {
|
|||
item.$view.find('a').on('click', ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), matchedItem => {
|
||||
matchedItem = jq(matchedItem).data('item');
|
||||
const matchedItems = lo.compact(lo.map(jq('#items .item'), el => {
|
||||
const matchedItem = el._item;
|
||||
return lo.includes(settings.types, matchedItem.type) ? matchedItem : null;
|
||||
}));
|
||||
|
||||
|
|
|
@ -26,9 +26,7 @@ const $selectionRect = jq('<div id="selection-rect"/>');
|
|||
|
||||
|
||||
function publish() {
|
||||
const items = lo.map(jq('#items .item.selected'), itemElement => {
|
||||
return jq(itemElement).data('item');
|
||||
});
|
||||
const items = lo.map(jq('#items .item.selected'), el => el._item);
|
||||
event.pub('selection', items);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,9 +53,8 @@ function update(item) {
|
|||
const $img = $html.find('.icon img');
|
||||
const $label = $html.find('.label');
|
||||
|
||||
$html
|
||||
.addClass(item.isFolder() ? 'folder' : 'file')
|
||||
.data('item', item);
|
||||
$html.addClass(item.isFolder() ? 'folder' : 'file');
|
||||
$html[0]._item = item;
|
||||
|
||||
location.setLink($a, item);
|
||||
$img.attr('src', resource.icon('folder'));
|
||||
|
@ -126,7 +125,7 @@ function createOnIndicatorClick() {
|
|||
return ev => {
|
||||
let $indicator = jq(ev.currentTarget);
|
||||
let $item = $indicator.closest('.item');
|
||||
const item = $item.data('item');
|
||||
const item = $item[0]._item;
|
||||
let $content = $item.find('> ul.content');
|
||||
|
||||
if ($indicator.hasClass('unknown')) {
|
||||
|
|
|
@ -127,9 +127,7 @@ const createHtml = item => {
|
|||
const $date = $html.find('.date');
|
||||
const $size = $html.find('.size');
|
||||
|
||||
$html
|
||||
.addClass(item.isFolder() ? 'folder' : 'file')
|
||||
.data('item', item);
|
||||
$html.addClass(item.isFolder() ? 'folder' : 'file');
|
||||
$html[0]._item = item;
|
||||
|
||||
location.setLink($a, item);
|
||||
|
|
Loading…
Add table
Reference in a new issue