Sets up the initial state of the page when it loads. Calls the 'changeCategory' function to set the category to 'piadas' on page load.
Parameters:
None
window.onload = function() {
// run change category to be set to piadas when page loads
changeCategory('piadas');
};
Keeps track of the identifier of the selected item.
var selected_item_id = -1
Keeps track of the selected mode (0 for delete, 1 for edit).
var selected_mode = -1
Changes the displayed items based on the selected category. Hides all items that do not belong to the selected category and shows those that do.
Parameters:
category
(string): The category to be displayed.
function changeCategory(category) {
// ... Function code ...
}
Deletes the selected item after confirming with the user. Makes an AJAX request to delete the item and reloads the page on success. Logs an error message on failure.
Parameters:
itemID
(string): The identifier of the item to be deleted.
function deleteItem(itemID) {
// ... Function code ...
}
Selects an item by highlighting it and updating the selected_item_id. Resets the style of the previously selected item.
Parameters:
itemID
(string): The identifier of the selected item.
function select_item(itemID) {
// ... Function code ...
}
Sets the selected_mode to 'delete' and deletes the selected item.
function select_delete() {
// ... Function code ...
}
Sets the selected_mode to 'edit' and redirects to the edit page for the selected item.
function select_edit() {
// ... Function code ...
}
Redirects to the edit page for the selected item.
Parameters:
itemID
(string): The identifier of the item to be edited.
function editItem(itemID) {
// ... Function code ...
}