X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/blobdiff_plain/fae5cd150c35b3f9669372e87da8d13415a4bf19..6ae326cb8d203015fa158b04e5b3b584f86c3654:/settings/add-plugin.php
diff --git a/settings/add-plugin.php b/settings/add-plugin.php
index 4ca6df2..1b38740 100644
--- a/settings/add-plugin.php
+++ b/settings/add-plugin.php
@@ -34,7 +34,6 @@ $p = new PluginRepo();
const ibtns = document.querySelectorAll(".btn-install-plugin");
ibtns.forEach((ib) => {
ib.addEventListener('click', (e) => {
- console.log("Button clicked! " +ib.innerHTML);
if (ib.innerHTML !== "Install" && ib.innerHTML !== "Uninstall") // some point between, don't do anything
{}
else if (ib.innerHTML == "Install") // install button pressed!
@@ -72,84 +71,12 @@ $p = new PluginRepo();
btn.innerHTML = "Uninstall";
});
- function requestInstall(name, uninstall = false)
- {
- let inst = (uninstall) ? "uninstall" : "install";
- var xhr = new XMLHttpRequest();
- xhr.onload = function() {
- if (xhr.status === 200) {
- var response = JSON.parse(xhr.responseText);
- console.log(response.success);
- let install_button = document.getElementById(name+'install');
- if (response.success !== undefined)
- {
- if (install_button)
- {
- install_button.innerHTML = (inst == "uninstall") ? "Install" : "Uninstall";
- install_button.classList.replace('btn-secondary', (inst == "uninstall") ? 'btn-primary' : 'btn-outline-danger');
- let icomplete = bsModal(((inst == "uninstall") ? "Uninstall" : "Install") + " Plugin", response.success,"
Close
", null, true, true, false);
- let closebtn = document.getElementById(name+"closebtn");
- closebtn.addEventListener('click', e => {
- location.reload();
- });
- }
- }
- else
- {
- if (install_button)
- {
- install_button.innerHTML = (inst == "uninstall") ? "Uninstall" : "Install";
- install_button.classList.replace('btn-secondary', (inst == "uninstall") ? 'btn-outline-danger' : 'btn-primary');
- let icomplete = bsModal(((inst == "uninstall") ? "Uninstall" : "Install") + " Plugin", response.error,"", null, false, true);
- let closebtn = document.getElementById(name+"closebtn");
- closebtn.addEventListener('click', e => {
- location.reload();
- });
- }
- }
- }
- };
-
- xhr.open('GET', BASE_URL + 'api/plugin.php?'+inst+'=' + name, true);
- xhr.send();
- return true;
- }
-
- function create_info_modal(modname)
- {
- fetch('https://api.dalek.services/plugins.list')
- .then(response => response.json()) // Parse the response as JSON
- .then(data => {
- for (let i = 0; data[i]; i++)
- {
- if (data[i].name == modname)
- {
- const modal = bsModal(
- "Information about " + data[i].title + "", // title
- "
",
- "Close
", null, true, true, false
- );
- let modalclose = document.getElementById(modal);
- modalclose.addEventListener('click', (e) => {
- $("#"+modal).modal('hide');
- });
- console.log(modal + '-body');
- boobs = document.getElementById(modal + '-body');
- boobs.innerHTML = data[i].description;
- }
- }
- })
- .catch(error => {
- // Handle any errors that occur during the request
- console.error('Error:', error);
- });
- }
const infoButtons = document.querySelectorAll('.more-info');
infoButtons.forEach((el) => {
el.addEventListener('click', (event) => {
- create_info_modal(el.id);
+ create_plugin_info_modal(el.id);
});
});