mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 16:02:01 +00:00
Change title when inside plugin view
This commit is contained in:
@@ -1,3 +1,21 @@
|
|||||||
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
|
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 () {
|
(function () {
|
||||||
const PLUGIN_ICON = `
|
const PLUGIN_ICON = `
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plugin" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plugin" viewBox="0 0 16 16">
|
||||||
@@ -31,19 +49,18 @@
|
|||||||
if (document.hasFocus()) {
|
if (document.hasFocus()) {
|
||||||
inject();
|
inject();
|
||||||
document.getElementById("plugin_title").onclick = function() {
|
document.getElementById("plugin_title").onclick = function() {
|
||||||
document.getElementById("plugin_iframe").contentWindow.location.href = "http://127.0.0.1:1337/plugins/iframe";
|
reloadIframe();
|
||||||
|
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}
|
||||||
|
`;
|
||||||
}
|
}
|
||||||
clearInterval(injector);
|
clearInterval(injector);
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
function reloadIframe() {
|
|
||||||
console.log("reloading iframe");
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,11 @@
|
|||||||
iframe.contentWindow.postMessage(evt.data, "http://127.0.0.1:1337");
|
iframe.contentWindow.postMessage(evt.data, "http://127.0.0.1:1337");
|
||||||
});
|
});
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
function loadPlugin(name) {
|
||||||
|
this.parent.postMessage(name, "https://steamloopback.host");
|
||||||
|
location.href = `/plugins/load_main/${name}`;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% if not plugins|length %}
|
{% if not plugins|length %}
|
||||||
@@ -23,7 +28,7 @@
|
|||||||
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
||||||
{% for plugin in plugins %}
|
{% for plugin in plugins %}
|
||||||
{% if plugin.tile_view_html|length %}
|
{% if plugin.tile_view_html|length %}
|
||||||
<div onclick="location.href = '/plugins/load/{{ plugin.name }}'"
|
<div onclick="loadPlugin('{{ plugin.name }}')"
|
||||||
class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable"
|
class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable"
|
||||||
style="--indent-level:0;">
|
style="--indent-level:0;">
|
||||||
<iframe id="tile_view_iframe_{{ plugin.name }}" style="display:block; padding: 0; border: none;" scrolling="no"
|
<iframe id="tile_view_iframe_{{ plugin.name }}" style="display:block; padding: 0; border: none;" scrolling="no"
|
||||||
@@ -43,7 +48,7 @@
|
|||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
iframe.contentWindow.document.body.onclick = function () {
|
iframe.contentWindow.document.body.onclick = function () {
|
||||||
location.href = '/plugins/load_main/{{ plugin.name }}';
|
loadPlugin('{{ plugin.name }}');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@@ -51,7 +56,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
<div class="quickaccesscontrols_PanelSectionRow_26R5w">
|
||||||
<div onclick="location.href = '/plugins/load_main/{{ plugin.name }}'"
|
<div onclick="loadPlugin('{{ plugin.name }}')"
|
||||||
class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable"
|
class="basicdialog_Field_ugL9c basicdialog_WithChildrenBelow_1RjOd basicdialog_InlineWrapShiftsChildrenBelow_3a6QZ basicdialog_ExtraPaddingOnChildrenBelow_2-owv basicdialog_StandardPadding_1HrfN basicdialog_HighlightOnFocus_1xh2W Panel Focusable"
|
||||||
style="--indent-level:0;">
|
style="--indent-level:0;">
|
||||||
<div class="basicdialog_FieldChildren_279n8">
|
<div class="basicdialog_FieldChildren_279n8">
|
||||||
|
|||||||
Reference in New Issue
Block a user