diff options
| author | tza <marios8543@gmail.com> | 2022-04-07 23:22:23 +0300 |
|---|---|---|
| committer | tza <marios8543@gmail.com> | 2022-04-07 23:22:23 +0300 |
| commit | e35dd5a0281c511320c44291a400b7374a0659b0 (patch) | |
| tree | 9c3e2c73dd499fba6fad0fbbe8bc98316921f16f | |
| parent | c65427e693daf3ee96cfd707e74efcb8d9d985f2 (diff) | |
| download | decky-loader-e35dd5a0281c511320c44291a400b7374a0659b0.tar.gz decky-loader-e35dd5a0281c511320c44291a400b7374a0659b0.zip | |
plugin menu title change bug
Fixed a bug where steam would sometimes fire message events on its own, causing them to be displayed as plugin titles.
| -rw-r--r-- | plugin_loader/static/plugin_page.js | 24 | ||||
| -rw-r--r-- | plugin_loader/templates/plugin_view.html | 2 |
2 files changed, 10 insertions, 16 deletions
diff --git a/plugin_loader/static/plugin_page.js b/plugin_loader/static/plugin_page.js index 49d1aa89..b9a089a8 100644 --- a/plugin_loader/static/plugin_page.js +++ b/plugin_loader/static/plugin_page.js @@ -1,12 +1,3 @@ -function setPluginName(name) { - document.getElementById("plugin_title").innerHTML = ` - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-back" viewBox="0 0 16 16"> - <path d="M0 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v2h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2H2a2 2 0 0 1-2-2V2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H2z"/> - </svg> - ${name} - `; -} - function reloadIframe() { document.getElementById("plugin_iframe").contentWindow.location.href = "http://127.0.0.1:1337/plugins/iframe"; } @@ -83,12 +74,15 @@ function addPluginInstallPrompt(artifact, version, request_id) { document.getElementById("plugin_title").innerText = "Plugins"; } window.onmessage = function(ev) { - document.getElementById("plugin_title").innerHTML = ` - <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-square-fill" viewBox="0 0 16 16"> - <path d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12zm-4.5-6.5H5.707l2.147-2.146a.5.5 0 1 0-.708-.708l-3 3a.5.5 0 0 0 0 .708l3 3a.5.5 0 0 0 .708-.708L5.707 8.5H11.5a.5.5 0 0 0 0-1z"/> - </svg> - ${ev.data} - `; + let title = ev.data; + if (title.startsWith("PLUGIN_LOADER__")) { + document.getElementById("plugin_title").innerHTML = ` + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-square-fill" viewBox="0 0 16 16"> + <path d="M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12zm-4.5-6.5H5.707l2.147-2.146a.5.5 0 1 0-.708-.708l-3 3a.5.5 0 0 0 0 .708l3 3a.5.5 0 0 0 .708-.708L5.707 8.5H11.5a.5.5 0 0 0 0-1z"/> + </svg> + ${title} + `; + } } clearInterval(injector); } diff --git a/plugin_loader/templates/plugin_view.html b/plugin_loader/templates/plugin_view.html index c95f00fb..8b1e4793 100644 --- a/plugin_loader/templates/plugin_view.html +++ b/plugin_loader/templates/plugin_view.html @@ -10,7 +10,7 @@ }, false); function loadPlugin(name) { - this.parent.postMessage(name, "https://steamloopback.host"); + this.parent.postMessage("PLUGIN_LOADER__"+name, "https://steamloopback.host"); location.href = `/plugins/load_main/${name}`; } </script> |
