From a4f0074bbc385c41f32580eba96c125f11c13bbc Mon Sep 17 00:00:00 2001 From: qianjiahong Date: Fri, 26 May 2023 17:34:58 +0800 Subject: [PATCH 1/5] Change the button and menu style to avoid being too compact. --- Debug/addons/addressbar/config.xml | 6 +++--- Debug/addons/addressbar/script.js | 17 ++++++++++------- Debug/script/index.css | 9 +++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Debug/addons/addressbar/config.xml b/Debug/addons/addressbar/config.xml index d59e4aac..4e1442d8 100644 --- a/Debug/addons/addressbar/config.xml +++ b/Debug/addons/addressbar/config.xml @@ -1,8 +1,8 @@ - 1.70 - 2022.1.12 - Thu, 13 Jan 2022 00:00:00 GMT + 1.72 + 2023.5.26 + Fri, 26 May 2023 00:00:00 GMT Common:0,6,7,8,9:0 2 Gaku diff --git a/Debug/addons/addressbar/script.js b/Debug/addons/addressbar/script.js index 159a71dd..66d4a064 100644 --- a/Debug/addons/addressbar/script.js +++ b/Debug/addons/addressbar/script.js @@ -49,12 +49,12 @@ if (window.Addon == 1) { const oImg = document.getElementById("addr_img"); const oPopup = document.getElementById("addressbarselect"); const width = oAddr.offsetWidth - oImg.offsetWidth + oPopup.offsetWidth - 2; - const height = oAddr.offsetHeight - 6; + const height = oAddr.offsetHeight - 11; if (Addons.AddressBar.XP) { oAddr.style.color = ""; } else { const arHTML = []; - o.style.height = (oAddr.offsetHeight - 3) + "px"; + o.style.height = "auto"; const bRoot = api.ILIsEmpty(FolderItem); const Items = JSON.parse(await Sync.AddressBar.SplitPath(FolderItem)); o.style.width = "auto"; @@ -62,7 +62,7 @@ if (window.Addon == 1) { o.innerHTML = ""; for (n = 0; n < Items.length; ++n) { if (Items[n].next) { - arHTML.unshift('' + BUTTONS.next + ''); + arHTML.unshift('' + BUTTONS.next + ''); o.insertAdjacentHTML("afterbegin", arHTML[0]); } arHTML.unshift('' + EncodeSC(Items[n].name) + ''); @@ -85,9 +85,8 @@ if (window.Addon == 1) { } Addons.AddressBar.nLevel = n; } - oPopup.style.left = (oAddr.offsetWidth - oPopup.offsetWidth - 1) + "px"; - oPopup.style.lineHeight = Math.abs(oAddr.offsetHeight - 6) + "px"; - oImg.style.top = Math.abs(oAddr.offsetHeight - oImg.offsetHeight) / 2 + "px"; + oPopup.style.left = (oAddr.offsetWidth - oPopup.offsetWidth - 2) + "px"; + oPopup.style.lineHeight = Math.abs(height) + "px"; } }, @@ -171,6 +170,7 @@ if (window.Addon == 1) { break; case 5: Addons.AddressBar.Exec(); + Addons.AddressBar.Focus(); break; } } @@ -354,7 +354,10 @@ if (window.Addon == 1) { s = "100%"; } const z = screen.deviceYDPI / 96; - s = ['
']; + s = ['
', + '', + '', + '']; s.push(' Date: Mon, 29 May 2023 14:12:56 +0800 Subject: [PATCH 2/5] Add favorite without showing confirmation dialog. --- Debug/script/sync1.js | 49 +++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/Debug/script/sync1.js b/Debug/script/sync1.js index 2291b9a1..e4c8667e 100644 --- a/Debug/script/sync1.js +++ b/Debug/script/sync1.js @@ -1316,6 +1316,27 @@ AddEvent("Refresh", function (Ctrl, pt) { } }); +InsertFavoriteItem = function (xml, menus, item, FolderItem, s) { + if (s) { + item.setAttribute("Name", s.replace(/\\/g, "/")); + item.setAttribute("Filter", ""); + let path = api.GetDisplayNameOf(FolderItem, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING | SHGDN_FORPARSINGEX); + if ("string" === typeof path) { + path = FolderItem.Path; + } + if (!FolderItem.Enum && fso.FileExists(path)) { + path = PathQuoteSpaces(path); + item.setAttribute("Type", "Exec"); + } else { + item.setAttribute("Type", "Open"); + } + item.text = path; + menus[0].appendChild(item); + SaveXmlEx("menus.xml", xml); + FavoriteChanged(); + } +} + AddFavorite = function (FolderItem) { const xml = te.Data.xmlMenus; const menus = xml.getElementsByTagName("Favorites"); @@ -1330,26 +1351,14 @@ AddFavorite = function (FolderItem) { if (!FolderItem) { return; } - InputDialog("Add Favorite", GetFolderItemName(FolderItem), function (s) { - if (s) { - item.setAttribute("Name", s.replace(/\\/g, "/")); - item.setAttribute("Filter", ""); - let path = api.GetDisplayNameOf(FolderItem, SHGDN_FORADDRESSBAR | SHGDN_FORPARSING | SHGDN_FORPARSINGEX); - if ("string" === typeof path) { - path = FolderItem.Path; - } - if (!FolderItem.Enum && fso.FileExists(path)) { - path = PathQuoteSpaces(path); - item.setAttribute("Type", "Exec"); - } else { - item.setAttribute("Type", "Open"); - } - item.text = path; - menus[0].appendChild(item); - SaveXmlEx("menus.xml", xml); - FavoriteChanged(); - } - }); + + if (0) { + InputDialog("Add Favorite", GetFolderItemName(FolderItem), function (s) { + InsertFavoriteItem(xml, menus, item, FolderItem, s); + }); + } else { + InsertFavoriteItem(xml, menus, item, FolderItem, GetFolderItemName(FolderItem)); + } } } From f9d9b8ff35215280dec09c15f0af4bfc1fa923b2 Mon Sep 17 00:00:00 2001 From: qianjiahong Date: Mon, 29 May 2023 14:14:27 +0800 Subject: [PATCH 3/5] Extended options form field. --- Debug/script/options.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Debug/script/options.js b/Debug/script/options.js index 37befe30..ba0ebba0 100644 --- a/Debug/script/options.js +++ b/Debug/script/options.js @@ -7,6 +7,7 @@ TabIndex = -1; g_x = { Menu: null, Addons: null }; g_Chg = { Menus: false, Addons: false, Tab: false, Tree: false, View: false, Data: null }; g_arMenuTypes = ["Default", "Context", "Background", "Tabs", "Tree", "File", "Edit", "View", "Favorites", "Tools", "Help", "Systray", "System", "Alias"]; +g_arFields = ["Name", "Path", "Type", "Icon", "Height"]; g_MenuType = ""; g_Id = ""; g_dlgAddons = null; @@ -844,7 +845,7 @@ async function LoadMenus(nSelected) { } } -async function LoadX(mode, fn, form) { +async function LoadX(mode, fn, form, arExtFields) { if (!g_x[mode]) { if (!form) { form = document.F; @@ -902,7 +903,21 @@ async function LoadX(mode, fn, form) { g_x[mode].length = i; while (--i >= 0) { const item = items[i]; - SetData(g_x[mode][i], [item.getAttribute("Name"), item.text || item.textContent, item.getAttribute("Type"), item.getAttribute("Icon"), item.getAttribute("Height")]); + const values = []; + for (let index = 0; index < g_arFields.length; index++) { + if (index != 1) { + values.push(item.getAttribute(g_arFields[index])); + } else { + values.push(item.text || item.textContent); + } + } + if (arExtFields) { + for (let index = 0; index < arExtFields.length; index++) { + values.push(item.getAttribute(arExtFields[index])); + } + } + + SetData(g_x[mode][i], values); } } EnableSelectTag(g_x[mode]); From 395e755e467b345db055fa3e95f2c929b87fd45a Mon Sep 17 00:00:00 2001 From: qianjiahong Date: Mon, 27 May 2024 11:39:29 +0800 Subject: [PATCH 4/5] Add a "Close all tabs" button after the tab. --- Debug/addons/tabplus/options.html | 19 ++++++++- Debug/addons/tabplus/script.js | 62 ++++++++++++++++++++++++---- Debug/addons/undoclosetab/config.xml | 7 +++- 3 files changed, 78 insertions(+), 10 deletions(-) diff --git a/Debug/addons/tabplus/options.html b/Debug/addons/tabplus/options.html index d85475f5..5dc85183 100644 --- a/Debug/addons/tabplus/options.html +++ b/Debug/addons/tabplus/options.html @@ -1,9 +1,10 @@ -
+




+



@@ -78,6 +79,22 @@ + + + + + + + + + + + + + + + +
diff --git a/Debug/addons/tabplus/script.js b/Debug/addons/tabplus/script.js index d3182993..90d6dbd4 100644 --- a/Debug/addons/tabplus/script.js +++ b/Debug/addons/tabplus/script.js @@ -1,4 +1,4 @@ -const Addon_Id = "tabplus"; +const Addon_Id = "tabplus"; let item = GetAddonElement(Addon_Id); if (!item.getAttribute("Set")) { item.setAttribute("Icon", 1); @@ -23,6 +23,19 @@ if (window.Addon == 1) { tids: [], nSelected: [], + IsWin10OrLater: async function () { + let appVer, res, osVer; + appVer = await navigator.appVersion.split(';'); + if (appVer[2]) { + res = /^\s*Windows NT\s+(\d+\.\d+)/i.exec(appVer[2]); + if (res && res[1] && parseFloat(res[1]) >= 10) { + return 1; + } + } + + return 0; + }, + Arrange: async function (Id, bWait) { delete Addons.TabPlus.tids[Id]; const o = document.getElementById("tabplus_" + Id); @@ -36,6 +49,9 @@ if (window.Addon == 1) { if (o.lastChild && Addons.TabPlus.opt.New) { o.removeChild(o.lastChild); } + if (o.lastChild && Addons.TabPlus.opt.CloseAll) { + o.removeChild(o.lastChild); + } let nDisp = o.getElementsByTagName("li").length; while (nDisp > nCount) { o.removeChild(o.lastChild); @@ -60,7 +76,15 @@ if (window.Addon == 1) { if (Addons.TabPlus.opt.Align > 1 && Addons.TabPlus.opt.Width) { s.push(' style="text-align: center; width: 100%"'); } - s.push('>+'); + s.push('>', Addons.TabPlus.ImgNewTab, ''); + o.insertAdjacentHTML("beforeend", s.join("")); + } + if (Addons.TabPlus.opt.CloseAll) { + let s = ['
  • 1 && Addons.TabPlus.opt.Width) { + s.push(' style="text-align: center; width: 100%"'); + } + s.push('>', Addons.TabPlus.ImgCloseAll, '
  • '); o.insertAdjacentHTML("beforeend", s.join("")); } Addons.TabPlus.SetActiveColor(Id); @@ -109,6 +133,15 @@ if (window.Addon == 1) { } }, + CloseAll: async function (Id) { + const TC = await te.Ctrl(CTRL_TC, Id); + if (TC) { + for (var i = TC.Count; i--;) { + TC[i].Close(); + } + } + }, + Style: async function (TC, i, bRedraw, wait) { let r = await Promise.all([TC[i], TC.Id]); const FV = r[0]; @@ -511,6 +544,11 @@ if (window.Addon == 1) { $.importScript("addons\\" + Addon_Id + "\\sync.js"); + let newTabImage = "font:Segoe UI Emoji,0x271a"; + if (Addons.TabPlus.IsWin10OrLater()) { + newTabImage = "font:Segoe UI Symbol,0xe109"; + } + AddEvent("PanelCreated", async function (Ctrl, Id) { const s = ['
      - 1.16 + 1.17 2021.12.18 - Sun, 26 Dec 2021 00:00:00 GMT + 2024-05-27 00:00:00 GMT Common:0,5,6,7,8,9:0 2 Gaku @@ -24,4 +24,7 @@ 復原已關閉分頁 + + 恢复已关闭的选项卡 + From 27ad3f7d0ccbf8a95b771909cba416a4ebbf9105 Mon Sep 17 00:00:00 2001 From: qianjiahong Date: Tue, 28 May 2024 11:16:33 +0800 Subject: [PATCH 5/5] When the user closes the last tab, navigate to "This PC". --- Debug/script/sync1.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Debug/script/sync1.js b/Debug/script/sync1.js index 0f1250cd..5c4b0d04 100644 --- a/Debug/script/sync1.js +++ b/Debug/script/sync1.js @@ -1,4 +1,4 @@ -//Tablacus Explorer +//Tablacus Explorer te.ClearEvents(); te.About = AboutTE(2); @@ -1555,7 +1555,15 @@ AddEvent("Close", function (Ctrl) { break; case CTRL_SB: case CTRL_EB: - return CanClose(Ctrl) || api.ILIsEqual(Ctrl, "about:blank") && Ctrl.Parent.Count < 2 ? S_FALSE : CloseView(Ctrl); + // When the user closes the last tab, navigate to "This PC". + let retValue = CanClose(Ctrl); + if (retValue == S_OK && Ctrl.Parent.Count <= 1) { + retValue = (api.ILIsEqual(Ctrl, ssfDRIVES) || api.ILIsEqual(Ctrl, "about:blank")) ? S_FALSE : S_OK; + if (!api.ILIsEqual(Ctrl, ssfDRIVES)) { + Ctrl.Navigate(ssfDRIVES, SBSP_NEWBROWSER); + } + } + return retValue; case CTRL_TC: SetDisplay("Panel_" + Ctrl.Id, "none"); break;