diff --git a/Contents/Resources/web/js/item_loader.js b/Contents/Resources/web/js/item_loader.js index 87c65f2..1dc8962 100644 --- a/Contents/Resources/web/js/item_loader.js +++ b/Contents/Resources/web/js/item_loader.js @@ -176,6 +176,12 @@ let populate_results = function (plugins_list, container, update_counts = false) // for PluggerDB plugins if (plugins_list[plugin]['html_url']) { + // add archived plugin category if the plugin is archived + if (plugins_list[plugin]['archived'] === true && !plugins_list[plugin]['categories'].includes('Archived Plugin')) { + // add to beginning of array + plugins_list[plugin]['categories'].unshift('Archived Plugin') + } + // create a badge for each category for (let category in plugins_list[plugin]['categories']) { // if category is not in search_type drop down, add it @@ -205,7 +211,7 @@ let populate_results = function (plugins_list, container, update_counts = false) // increment the count if (update_counts) { let count = parseInt(search_options.children[i].children[2].textContent) - search_options.children[i].children[2].textContent = `${count + 1}` + search_options.children[i].children[2].textContent = (count + 1).toString() } break } @@ -234,7 +240,7 @@ let populate_results = function (plugins_list, container, update_counts = false) category_column.appendChild(category_badge) } // add a categories edit button using fontawesome icon - // todo - pass categories to the issue form + // todo - pass categories to the issue form... if it's possible let edit_link = `https://github.com/LizardByte/PluggerDB/issues/new?assignees=&labels=request-plugin&template=plugin.yml&title=${encodeURIComponent('[PLUGIN]: ')}${encodeURIComponent(plugins_list[plugin]['html_url'].replace('https://github.com/', ''))}&github_url=${encodeURIComponent(plugins_list[plugin]['html_url'])}` let category_column = document.createElement("div") category_column.className = "col-auto align-self-center" @@ -429,6 +435,18 @@ let populate_results = function (plugins_list, container, update_counts = false) issues_link.appendChild(issues_text) } + // add archived warning + if (plugins_list[plugin]['archived'] === true) { + let archived_column = document.createElement("div") + archived_column.className = "col-auto align-self-center me-1" + stats_row.appendChild(archived_column) + let archived_icon = document.createElement("i") + archived_icon.className = "fa-solid fa-triangle-exclamation align-middle" + archived_icon.style.color = "#ffb02e" + archived_icon.setAttribute('title', getTranslation('Archived')) + archived_column.appendChild(archived_icon) + } + } else if (plugins_list[plugin]['installed_data']['type'] === "system") { // add the system plugin category @@ -443,7 +461,7 @@ let populate_results = function (plugins_list, container, update_counts = false) // increment the count in the search_options drop down if (update_counts) { let system_plugin_count = document.getElementById("count_system_plugin") - system_plugin_count.textContent = `${parseInt(system_plugin_count.textContent) + 1}` + system_plugin_count.textContent = (parseInt(system_plugin_count.textContent) + 1).toString() } let category_column = document.createElement("div") @@ -521,7 +539,7 @@ let populate_results = function (plugins_list, container, update_counts = false) // increment the count in the search_options drop down if (update_counts) { let installed_plugin_count = document.getElementById("count_installed_plugin") - installed_plugin_count.textContent = `${parseInt(installed_plugin_count.textContent) + 1}` + installed_plugin_count.textContent = (parseInt(installed_plugin_count.textContent) + 1).toString() } } } diff --git a/Contents/Resources/web/templates/home.html b/Contents/Resources/web/templates/home.html index 0776333..84f8081 100644 --- a/Contents/Resources/web/templates/home.html +++ b/Contents/Resources/web/templates/home.html @@ -193,13 +193,42 @@

{{ _('Plugins') }}

success: function (result) { let plugin = result[github_id] + // archived alert + if (plugin['archived'] === true) { + let archived_alert = document.createElement('div') + archived_alert.className = 'alert alert-danger alert-dismissible fade show' + archived_alert.setAttribute('role', 'alert') + + let archived_alert_icon = document.createElement('i') + archived_alert_icon.className = 'fa-solid fa-exclamation-triangle fa-lg me-2' + archived_alert.appendChild(archived_alert_icon) + + let archived_alert_message = document.createElement('span') + archived_alert_message.innerHTML = `{{ _('This plugin is archived and is no longer being maintained. It is highly unlikely this plugin will function properly.') }}` + archived_alert.appendChild(archived_alert_message) + + let archived_alert_close = document.createElement('button') + archived_alert_close.className = 'btn-close' + archived_alert_close.setAttribute('type', 'button') + archived_alert_close.setAttribute('data-bs-dismiss', 'alert') + archived_alert_close.setAttribute('aria-label', "{{ _('Close') }}") + archived_alert.appendChild(archived_alert_close) + + install_section.appendChild(archived_alert) + } + // global alert let alert = document.createElement('div') alert.className = 'alert alert-warning alert-dismissible fade show' alert.setAttribute('role', 'alert') + // alert icon + let alert_icon = document.createElement('i') + // set class later + alert.appendChild(alert_icon) + // alert message - let alert_message = document.createElement('div') + let alert_message = document.createElement('span') // add the text later alert.appendChild(alert_message) @@ -279,7 +308,8 @@

{{ _('Plugins') }}

warning = `${warning} ${emoji.replace_colons(":warning: {{ _('This is not the default branch.') }}")}
` } if (download['default_branch'] === true && latest_release !== null) { - alert_message.textContent = emoji.replace_colons(":interrobang: {{ _('The default branch is older than the latest release. This plugin may not support installing from branches.') }}") + alert_icon.className = 'fa-solid fa-exclamation-triangle fa-lg me-2' + alert_message.textContent = "{{ _('The default branch () is older than the latest release. This plugin may not support installing from branches.') }}".replace('', download['name']) install_section.appendChild(alert) } } diff --git a/Contents/Resources/web/templates/translations.html b/Contents/Resources/web/templates/translations.html index eb81e3f..9faccb3 100644 --- a/Contents/Resources/web/templates/translations.html +++ b/Contents/Resources/web/templates/translations.html @@ -3,10 +3,12 @@ {# General strings #} {{ _('Clear Results') }} {{ _('Installed Version:') }} +{{ _('Archived Plugin') }} {{ _('Installed Plugin') }} {{ _('System Plugin') }} {# Tooltips #} +{{ _('Archived') }} {{ _('Edit Categories') }} {{ _('Force Update') }} {{ _('Forks') }}