From 74438a31458af8bddd08d90eacc6d63677bab844 Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Fri, 13 May 2022 19:14:47 +0200 Subject: Work on react frontend loader --- plugin_loader/static/plugin_page.js | 98 ------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 plugin_loader/static/plugin_page.js (limited to 'plugin_loader/static/plugin_page.js') diff --git a/plugin_loader/static/plugin_page.js b/plugin_loader/static/plugin_page.js deleted file mode 100644 index 0531f04e..00000000 --- a/plugin_loader/static/plugin_page.js +++ /dev/null @@ -1,98 +0,0 @@ -function reloadIframe() { - document.getElementById("plugin_iframe").contentWindow.location.href = "http://127.0.0.1:1337/plugins/iframe"; -} - -function resolveMethodCall(call_id, result) { - let iframe = document.getElementById("plugin_iframe").contentWindow; - iframe.postMessage({'call_id': call_id, 'result': result}, "http://127.0.0.1:1337"); -} - -function installPlugin(request_id) { - let id = `${new Date().getTime()}`; - console.debug(JSON.stringify({ - "id": id, - "method": "confirm_plugin_install", - "args": {"request_id": request_id} - })); - document.getElementById('plugin_install_list').removeChild(document.getElementById(`plugin_install_prompt_${request_id}`)); -} - -function addPluginInstallPrompt(artifact, version, request_id) { - let text = ` - - -
-

Install Plugin?

-

- ${artifact} - Version: ${version} -

- -

- -
- `; - document.getElementById('plugin_install_list').innerHTML = text; - - execute_in_tab('SP', false, 'FocusNavController.DispatchVirtualButtonClick(28)') -} - -(function () { - const PLUGIN_ICON = ` - - - - `; - - function createTitle(text) { - return `
${text}
`; - } - - function createPluginList() { - let pages = document.getElementsByClassName("quickaccessmenu_AllTabContents_2yKG4 quickaccessmenu_Down_3rR0o")[0]; - let pluginPage = pages.children[pages.children.length - 1]; - pluginPage.innerHTML = createTitle("Plugins"); - - pluginPage.innerHTML += `
` - - pluginPage.innerHTML += ``; - } - - function inject() { - let tabs = document.getElementsByClassName("quickaccessmenu_TabContentColumn_2z5NL Panel Focusable")[0]; - tabs.children[tabs.children.length - 1].innerHTML = PLUGIN_ICON; - - createPluginList(); - } - - let injector = setInterval(function () { - if (document.hasFocus()) { - inject(); - document.getElementById("plugin_title").onclick = function() { - reloadIframe(); - document.getElementById("plugin_title").innerText = "Plugins"; - } - window.onmessage = function(ev) { - let title = ev.data; - if (title.startsWith("PLUGIN_LOADER__")) { - document.getElementById("plugin_title").innerHTML = ` - - - - ${title.replace("PLUGIN_LOADER__", "")} - `; - } - } - clearInterval(injector); - } - }, 100); -})(); \ No newline at end of file -- cgit v1.2.3