mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-09 22:57:47 +02:00
Added plugin context view
- Added plugin context view - Moved plugin type definition to separate file - Added wip request forwarder
This commit is contained in:
@@ -78,9 +78,6 @@
|
||||
<i class="simplistic user circle icon"></i> SSO / Oauth
|
||||
</a>
|
||||
<div class="ui divider menudivider">Others</div>
|
||||
<a class="item" tag="plugins">
|
||||
<i class="simplistic puzzle piece icon"></i> Plugins
|
||||
</a>
|
||||
<a class="item" tag="webserv">
|
||||
<i class="simplistic globe icon"></i> Static Web Server
|
||||
</a>
|
||||
@@ -96,6 +93,15 @@
|
||||
<a class="item" tag="utils">
|
||||
<i class="simplistic paperclip icon"></i> Utilities
|
||||
</a>
|
||||
<a class="item" tag="plugins">
|
||||
<i class="simplistic puzzle piece icon"></i> Plugins Manager
|
||||
</a>
|
||||
<div class="ui divider menudivider">Plugins</div>
|
||||
<cx id="pluginMenu"></container>
|
||||
<a class="item" style="pointer-events: none; user-select: none; opacity: 0.6;">
|
||||
<i class="green circle check icon"></i> No Installed Plugins
|
||||
</a>
|
||||
</cx>
|
||||
<!-- Add more components here -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -155,6 +161,12 @@
|
||||
|
||||
<!-- Utilities -->
|
||||
<div id="utils" class="functiontab" target="utils.html"></div>
|
||||
|
||||
<!-- Plugin Context Menu -->
|
||||
<div id="pluginContextWindow" class="functiontab" target="plugincontext.html"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -246,7 +258,26 @@
|
||||
|
||||
if (window.location.hash.length > 1){
|
||||
let tabID = window.location.hash.substr(1);
|
||||
openTabById(tabID);
|
||||
if (tabID.startsWith("{")) {
|
||||
tabID = decodeURIComponent(tabID);
|
||||
//Zoraxy v3.2.x plugin context window
|
||||
try {
|
||||
let parsedData = JSON.parse(tabID);
|
||||
tabID = parsedData.tabID;
|
||||
|
||||
//Open the plugin context window
|
||||
if (tabID == "pluginContextWindow"){
|
||||
let pluginID = parsedData.pluginID;
|
||||
let button = $("#pluginMenu").find(`[pluginid="${pluginID}"]`);
|
||||
openTabById(tabID, button);
|
||||
loadPluginUIContextIfAvailable();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Invalid JSON data:", e);
|
||||
}
|
||||
}else{
|
||||
openTabById(tabID);
|
||||
}
|
||||
}else{
|
||||
openTabById("status");
|
||||
}
|
||||
@@ -257,7 +288,7 @@
|
||||
$("#mainmenu").find(".item").each(function(){
|
||||
$(this).on("click", function(event){
|
||||
let tabid = $(this).attr("tag");
|
||||
openTabById(tabid);
|
||||
openTabById(tabid, $(this));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -282,13 +313,19 @@
|
||||
if ($(".sideWrapper").is(":visible")){
|
||||
$(".sideWrapper iframe")[0].contentWindow.setDarkTheme(false);
|
||||
}
|
||||
|
||||
if ($("#pluginContextLoader").is(":visible")){
|
||||
$("#pluginContextLoader")[0].contentWindow.setDarkTheme(false);
|
||||
}
|
||||
}else{
|
||||
setDarkTheme(true);
|
||||
//Check if the snippet iframe is opened. If yes, set the dark theme to the iframe
|
||||
if ($(".sideWrapper").is(":visible")){
|
||||
$(".sideWrapper iframe")[0].contentWindow.setDarkTheme(true);
|
||||
}
|
||||
|
||||
if ($("#pluginContextLoader").is(":visible")){
|
||||
$("#pluginContextLoader")[0].contentWindow.setDarkTheme(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,8 +344,12 @@
|
||||
|
||||
//Select and open a tab by its tag id
|
||||
let tabSwitchEventBind = {}; //Bind event to tab switch by tabid
|
||||
function openTabById(tabID){
|
||||
let targetBtn = getTabButtonById(tabID);
|
||||
function openTabById(tabID, object=undefined){
|
||||
let targetBtn = object;
|
||||
if (object == undefined){
|
||||
//Search tab by its tap id
|
||||
targetBtn = getTabButtonById(tabID);
|
||||
}
|
||||
if (targetBtn == undefined){
|
||||
alert("Invalid tabid given");
|
||||
return;
|
||||
@@ -329,7 +370,19 @@
|
||||
},100)
|
||||
});
|
||||
$('html,body').animate({scrollTop: 0}, 'fast');
|
||||
window.location.hash = tabID;
|
||||
|
||||
if (tabID == "pluginContextWindow"){
|
||||
let statePayload = {
|
||||
tabID: tabID,
|
||||
pluginID: $(targetBtn).attr("pluginid")
|
||||
}
|
||||
|
||||
window.location.hash = JSON.stringify(statePayload);
|
||||
loadPluginUIContextIfAvailable();
|
||||
}else{
|
||||
window.location.hash = tabID;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$(window).on("resize", function(){
|
||||
|
Reference in New Issue
Block a user