`;
h += `
Associated website${ fsentry.subdomains.length > 1 ? 's':''}
`;
fsentry.subdomains.forEach(subdomain => {
h += `
${subdomain.address.replace('https://', '')}
`;
});
h += `
`;
// close other website popovers
$('.website-badge-popover-content').closest('.popover').remove();
// show a UIPopover with the website
UIPopover({
target: e.target,
content:h,
snapToElement: e.target,
parent_element: e.target,
top: top - 30,
left: left + 20,
})
}
}
})
})
$(document).on('click', '.website-badge-popover-link', function(e){
// remove the parent popover
$(e.target).closest('.popover').remove();
})
// removes item(s)
$.fn.removeItems = async function(options) {
options = options || {};
$(this).each(async function() {
const parent_container = $(this).closest('.item-container');
$(this).remove();
show_or_hide_empty_folder_message(parent_container);
});
return this;
}
window.activate_item_name_editor= function(el_item){
// files in trash cannot be renamed, the user should be notified with an Alert.
if($(el_item).attr('data-immutable') !== '0'){
return;
}
// files in trash cannot be renamed, user should be notified with an Alert.
else if(path.dirname($(el_item).attr('data-path')) === window.trash_path){
UIAlert(i18n('items_in_trash_cannot_be_renamed'));
return;
}
const el_item_name = $(el_item).find('.item-name');
const el_item_name_editor = $(el_item).find('.item-name-editor').get(0);
$(el_item_name).hide();
$(el_item_name_editor).show();
$(el_item_name_editor).focus();
$(el_item_name_editor).addClass('item-name-editor-active');
// select all text before extension
const item_name = $(el_item).attr('data-name');
const is_dir = parseInt($(el_item).attr('data-is_dir'));
const extname = path.extname('/'+item_name);
if(extname !== '' && !is_dir)
el_item_name_editor.setSelectionRange(0, item_name.length - extname.length)
else
$(el_item_name_editor).select();
}
export default UIItem;