From 7953cb9d8e37042d888ab40a26e0c53c51035401 Mon Sep 17 00:00:00 2001 From: MrOtherGuy Date: Sun, 1 Jan 2023 18:40:37 +0200 Subject: [PATCH] Move "legacy" or otherwise deprecated styles into sub-folder --- .../bookmarksbar_on_new_tabs_only.css | 0 .../full_width_urlbar_popup.css | 0 .../google_style_urlbar_popup.css | 0 .../{ => deprecated}/multi-row_tabs_Fx66+.css | 0 .../multi-row_tabs_below_content_legacy.css | 0 .../multi-row_tabs_legacy.css | 0 .../theme_additional_windows.css | 0 .../theme_aware_modal_prompts.css | 0 .../theme_color_variables.css | 0 .../theme_popups_and_menus.css | 0 chrome/{ => deprecated}/theme_sidebar.css | 0 chrome/{ => deprecated}/theme_toolbars.css | 0 .../toggle_bookmarksbar_with_alt.css | 0 .../urlbar_and_popup_equal_width.css | 0 html_resources/main.css | 6 +- html_resources/selector.js | 58 +++++++++++-------- html_resources/tagmap.json | 28 ++++----- tags.csv | 28 ++++----- 18 files changed, 65 insertions(+), 55 deletions(-) rename chrome/{ => deprecated}/bookmarksbar_on_new_tabs_only.css (100%) rename chrome/{ => deprecated}/full_width_urlbar_popup.css (100%) rename chrome/{ => deprecated}/google_style_urlbar_popup.css (100%) rename chrome/{ => deprecated}/multi-row_tabs_Fx66+.css (100%) rename chrome/{ => deprecated}/multi-row_tabs_below_content_legacy.css (100%) rename chrome/{ => deprecated}/multi-row_tabs_legacy.css (100%) rename chrome/{ => deprecated}/theme_additional_windows.css (100%) rename chrome/{ => deprecated}/theme_aware_modal_prompts.css (100%) rename chrome/{ => deprecated}/theme_color_variables.css (100%) rename chrome/{ => deprecated}/theme_popups_and_menus.css (100%) rename chrome/{ => deprecated}/theme_sidebar.css (100%) rename chrome/{ => deprecated}/theme_toolbars.css (100%) rename chrome/{ => deprecated}/toggle_bookmarksbar_with_alt.css (100%) rename chrome/{ => deprecated}/urlbar_and_popup_equal_width.css (100%) diff --git a/chrome/bookmarksbar_on_new_tabs_only.css b/chrome/deprecated/bookmarksbar_on_new_tabs_only.css similarity index 100% rename from chrome/bookmarksbar_on_new_tabs_only.css rename to chrome/deprecated/bookmarksbar_on_new_tabs_only.css diff --git a/chrome/full_width_urlbar_popup.css b/chrome/deprecated/full_width_urlbar_popup.css similarity index 100% rename from chrome/full_width_urlbar_popup.css rename to chrome/deprecated/full_width_urlbar_popup.css diff --git a/chrome/google_style_urlbar_popup.css b/chrome/deprecated/google_style_urlbar_popup.css similarity index 100% rename from chrome/google_style_urlbar_popup.css rename to chrome/deprecated/google_style_urlbar_popup.css diff --git a/chrome/multi-row_tabs_Fx66+.css b/chrome/deprecated/multi-row_tabs_Fx66+.css similarity index 100% rename from chrome/multi-row_tabs_Fx66+.css rename to chrome/deprecated/multi-row_tabs_Fx66+.css diff --git a/chrome/multi-row_tabs_below_content_legacy.css b/chrome/deprecated/multi-row_tabs_below_content_legacy.css similarity index 100% rename from chrome/multi-row_tabs_below_content_legacy.css rename to chrome/deprecated/multi-row_tabs_below_content_legacy.css diff --git a/chrome/multi-row_tabs_legacy.css b/chrome/deprecated/multi-row_tabs_legacy.css similarity index 100% rename from chrome/multi-row_tabs_legacy.css rename to chrome/deprecated/multi-row_tabs_legacy.css diff --git a/chrome/theme_additional_windows.css b/chrome/deprecated/theme_additional_windows.css similarity index 100% rename from chrome/theme_additional_windows.css rename to chrome/deprecated/theme_additional_windows.css diff --git a/chrome/theme_aware_modal_prompts.css b/chrome/deprecated/theme_aware_modal_prompts.css similarity index 100% rename from chrome/theme_aware_modal_prompts.css rename to chrome/deprecated/theme_aware_modal_prompts.css diff --git a/chrome/theme_color_variables.css b/chrome/deprecated/theme_color_variables.css similarity index 100% rename from chrome/theme_color_variables.css rename to chrome/deprecated/theme_color_variables.css diff --git a/chrome/theme_popups_and_menus.css b/chrome/deprecated/theme_popups_and_menus.css similarity index 100% rename from chrome/theme_popups_and_menus.css rename to chrome/deprecated/theme_popups_and_menus.css diff --git a/chrome/theme_sidebar.css b/chrome/deprecated/theme_sidebar.css similarity index 100% rename from chrome/theme_sidebar.css rename to chrome/deprecated/theme_sidebar.css diff --git a/chrome/theme_toolbars.css b/chrome/deprecated/theme_toolbars.css similarity index 100% rename from chrome/theme_toolbars.css rename to chrome/deprecated/theme_toolbars.css diff --git a/chrome/toggle_bookmarksbar_with_alt.css b/chrome/deprecated/toggle_bookmarksbar_with_alt.css similarity index 100% rename from chrome/toggle_bookmarksbar_with_alt.css rename to chrome/deprecated/toggle_bookmarksbar_with_alt.css diff --git a/chrome/urlbar_and_popup_equal_width.css b/chrome/deprecated/urlbar_and_popup_equal_width.css similarity index 100% rename from chrome/urlbar_and_popup_equal_width.css rename to chrome/deprecated/urlbar_and_popup_equal_width.css diff --git a/html_resources/main.css b/html_resources/main.css index a222f9c..39bd37b 100644 --- a/html_resources/main.css +++ b/html_resources/main.css @@ -53,8 +53,6 @@ pre:empty{ display: none } max-width: 30%; cursor: pointer; white-space:nowrap; - overflow: hidden; - text-overflow: ellipsis; display: flex; } .target > a{ @@ -66,6 +64,10 @@ pre:empty{ display: none } background-size: contain; flex-shrink: 0; } +.target > span{ + overflow: hidden; + pointer-events: none; +} .target:hover{ background-color: rgb(80,80,90) } .target.selected{ background-color: rgb(80,80,120) } .target > a:hover{ filter: drop-shadow(0 0 3px fuchsia) } diff --git a/html_resources/selector.js b/html_resources/selector.js index 21bfcee..4f509af 100644 --- a/html_resources/selector.js +++ b/html_resources/selector.js @@ -1,23 +1,34 @@ 'use strict'; -let DB = null; - -function initDB(obj){ - DB = obj.content; - Object.defineProperty(DB,"query",{value:function (q,list){ +const DB = new (function(){ + this.content = null; + this.query = (q,list) => { let nlist = []; for(let key of list || this.keys){ - if(this[key].includes(q)){ + if(this.content[key].includes(q)){ nlist.push(key) } } return nlist + }; + this.init = (obj) => { + this.content = obj + } + this._keys = null; + Object.defineProperty(this,"keys",{ get:() => { + if(this.content && !this._keys){ + this._keys = Object.keys(this.content).sort(); + } + return this._keys }}); - Object.defineProperty(DB,"keys",{value:(Object.keys(DB).sort())}); - - Object.defineProperty(DB,"getTagsForFile",{value:function(name){return this[name]}}); - - return true + this.getTagsForFile = (name) => { + return this.content[name]; + } +})(); + +function initDB(obj){ + window.DB = DB; + DB.init(obj.content); } function fetchWithType(url){ @@ -106,7 +117,7 @@ function getSecondaryCategories(list){ function showMatchingTargets(fileNames,setSelected = false){ let bonus = 0; for(let c of Array.from(document.querySelectorAll(".target"))){ - if(fileNames.includes(getText(c))){ + if(fileNames.includes(c.dataset.filename)){ c.classList.remove("hidden"); setSelected && selectedTarget.add(c) }else{ @@ -129,7 +140,7 @@ function onCategoryClicked(categoryNode,isSecondary = false){ let fileNames = currentCategory.getFileNames(categoryNode,isSecondary); if(!isSecondary){ - if(fileNames.length > 9){ + if(fileNames.length > 9 && categoryNode.textContent != "legacy"){ let matchingSecondaries = getSecondaryCategories(fileNames); for(let child of Array.from(secondaryCategoriesNode.children)){ matchingSecondaries.includes(child.textContent) ? child.classList.remove("hidden") : child.classList.add("hidden") @@ -148,7 +159,7 @@ function onCategoryClicked(categoryNode,isSecondary = false){ async function onTargetClicked(target,append = false){ const text = typeof target === "string" ? target - : getText(target); + : target.dataset.filename; fetchWithType(`chrome/${text}`) .then(obj => { @@ -185,7 +196,7 @@ function onFilenameClicked(box,ctrlKey){ if(ctrlKey){ selectedTarget.deselect(box); let previewbox = document.getElementById("previewBox"); - let preview = previewbox.getNamedSection(`chrome/${box.getAttribute("title")}.css`); + let preview = previewbox.getNamedSection(`chrome/${box.dataset.filename}`); if(preview){ preview.remove(); } @@ -256,18 +267,19 @@ function createCategories(){ const TAR_PARENT = document.getElementById("targets"); TAR_PARENT.addEventListener("click",onSomeClicked,{passive:true}); - const createNode = function(name,type){ + const createNode = function(name,type,isDeprecated){ let node = document.createElement("div"); node.classList.add(type); if(type === "target"){ let link = node.appendChild(document.createElement("a")); node.classList.add("hidden"); - link.href = `https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/${name}`; + link.href = `https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/${isDeprecated?"deprecated/":""}${name}`; link.title = "See on Github"; link.target = "_blank"; const content = name.substring(0,name.lastIndexOf(".")); - node.append(content); + node.appendChild(document.createElement("span")).textContent = content; + node.dataset.filename = `${content}.css`; node.setAttribute("title",content); }else{ node.textContent = name.name; @@ -276,17 +288,13 @@ function createCategories(){ return node; } - - const createCategory = name => createNode(name,"category"); - - const createTarget = name => createNode(name,"target"); const CAT_NAMES = (function(){ let list = []; - for(let key of Object.keys(DB)){ - TAR_PARENT.appendChild(createNode(key,"target")); - let things = DB[key]; + for(let key of DB.keys){ + let things = DB.content[key]; + TAR_PARENT.appendChild(createNode(key,"target",things.includes("legacy"))); for(let t of things){ list.push(t) } diff --git a/html_resources/tagmap.json b/html_resources/tagmap.json index 547b792..62eba00 100644 --- a/html_resources/tagmap.json +++ b/html_resources/tagmap.json @@ -9,7 +9,7 @@ "autohide_tabstoolbar.css":["autohide","tabs","toolbars"], "autohide_toolbox.css":["autohide","toolbars","fullscreen"], "blank_page_background.css":["dark-mode"], -"bookmarksbar_on_new_tabs_only.css":["legacy"], +"deprecated/bookmarksbar_on_new_tabs_only.css":["legacy"], "bookmarks_toolbar_on_newtabs_only.css":["bookmarks","toolbars","autohide","hiding"], "button_effect_icon_glow.css":["buttons","effect"], "button_effect_scale_onclick.css":["buttons","effect"], @@ -42,8 +42,8 @@ "fake_statusbar_w_menubar.css":["hack","status","toolbars","menubar"], "fake_tab_tooltip.css":["tab","hack","popup"], "floating_findbar_on_top.css":["findbar"], -"full_width_urlbar_popup.css":["legacy"], -"google_style_urlbar_popup.css":["legacy"], +"deprecated/full_width_urlbar_popup.css":["legacy"], +"deprecated/google_style_urlbar_popup.css":["legacy"], "grid_overflow_menu.css":["popup","menu"], "hide_statuspanel_when_fullscreen.css":["status","fullscreen","hiding"], "hide_tabs_scrollbuttons.css":["tabs","hiding","buttons","minimal"], @@ -78,10 +78,10 @@ "multi-row_main_toolbar.css":["urlbar","toolbars","multi-row","hack"], "multi-row_oneliner_combo_patch.css":["multi-row","patch","one-line","minimal"], "multi-row_tabs.css":["tabs","multi-row","toolbars"], -"multi-row_tabs_Fx66+.css":["legacy"], +"deprecated/multi-row_tabs_Fx66+.css":["legacy"], "multi-row_tabs_below_content.css":["multi-row","tabs","toolbars"], -"multi-row_tabs_below_content_legacy.css":["legacy"], -"multi-row_tabs_legacy.css":["legacy"], +"deprecated/multi-row_tabs_below_content_legacy.css":["legacy"], +"deprecated/multi-row_tabs_legacy.css":["legacy"], "multi-row_tabs_separate_pinned_row_patch.css":["tabs","multi-row","patch"], "multi-row_tabs_window_control_patch.css":["patch","multi-row","window-control"], "navbar_below_content.css":["nav-bar","toolbars"], @@ -130,17 +130,17 @@ "tabs_on_bottom_menubar_on_top_patch.css":["tabs","menubar","toolbars","classic","patch"], "textual_context_navigation.css":["navigation","popup","menu"], "textual_searchbar_one-offs.css":["popup","menu"], -"theme_additional_windows.css":["legacy"], -"theme_aware_modal_prompts.css":["effect","dark-mode","colors","popup","legacy"], -"theme_color_variables.css":["legacy"], -"theme_popups_and_menus.css":["legacy"], -"theme_sidebar.css":["legacy"], -"theme_toolbars.css":["legacy"], -"toggle_bookmarksbar_with_alt.css":["legacy"], +"deprecated/theme_additional_windows.css":["legacy"], +"deprecated/theme_aware_modal_prompts.css":["legacy"], +"deprecated/theme_color_variables.css":["legacy"], +"deprecated/theme_popups_and_menus.css":["legacy"], +"deprecated/theme_sidebar.css":["legacy"], +"deprecated/theme_toolbars.css":["legacy"], +"deprecated/toggle_bookmarksbar_with_alt.css":["legacy"], "toggle_tabs_toolbar_with_alt.css":["hack","tabs","menubar"], "toolbarbuttons_icon+label.css":["buttons","icon"], "toolbars_below_content.css":["tabs","toolbars"], -"urlbar_and_popup_equal_width.css":["legacy"], +"deprecated/urlbar_and_popup_equal_width.css":["legacy"], "urlbar_centered_text.css":["urlbar"], "urlbar_connection_type_background_colors.css":["urlbar","colors","status"], "urlbar_connection_type_text_colors.css":["urlbar","colors","status"], diff --git a/tags.csv b/tags.csv index 82b40d0..d0f8806 100644 --- a/tags.csv +++ b/tags.csv @@ -8,7 +8,7 @@ autohide_sidebar.css,autohide,sidebar autohide_tabstoolbar.css,autohide,tabs,toolbars autohide_toolbox.css,autohide,toolbars,fullscreen blank_page_background.css,dark-mode -bookmarksbar_on_new_tabs_only.css,legacy +deprecated/bookmarksbar_on_new_tabs_only.css,legacy bookmarks_toolbar_on_newtabs_only.css,bookmarks,toolbars,autohide,hiding button_effect_icon_glow.css,buttons,effect button_effect_scale_onclick.css,buttons,effect @@ -41,8 +41,8 @@ fake_urlbar_dropmarker.css,urlbar,hack fake_statusbar_w_menubar.css,hack,status,toolbars,menubar fake_tab_tooltip.css,tab,hack,popup floating_findbar_on_top.css,findbar -full_width_urlbar_popup.css,legacy -google_style_urlbar_popup.css,legacy +deprecated/full_width_urlbar_popup.css,legacy +deprecated/google_style_urlbar_popup.css,legacy grid_overflow_menu.css,popup,menu hide_statuspanel_when_fullscreen.css,status,fullscreen,hiding hide_tabs_scrollbuttons.css,tabs,hiding,buttons,minimal @@ -77,10 +77,10 @@ multi-row_bookmarks.css,multi-row,bookmarks,toolbars multi-row_main_toolbar.css,urlbar,toolbars,multi-row,hack multi-row_oneliner_combo_patch.css,multi-row,patch,one-line,minimal multi-row_tabs.css,tabs,multi-row,toolbars -multi-row_tabs_Fx66+.css,legacy +deprecated/multi-row_tabs_Fx66+.css,legacy multi-row_tabs_below_content.css,multi-row,tabs,toolbars -multi-row_tabs_below_content_legacy.css,legacy -multi-row_tabs_legacy.css,legacy +deprecated/multi-row_tabs_below_content_legacy.css,legacy +deprecated/multi-row_tabs_legacy.css,legacy multi-row_tabs_separate_pinned_row_patch.css,tabs,multi-row,patch multi-row_tabs_window_control_patch.css,patch,multi-row,window-control navbar_below_content.css,nav-bar,toolbars @@ -129,17 +129,17 @@ tabs_on_bottom.css,tabs,toolbars,classic tabs_on_bottom_menubar_on_top_patch.css,tabs,menubar,toolbars,classic,patch textual_context_navigation.css,navigation,popup,menu textual_searchbar_one-offs.css,popup,menu -theme_additional_windows.css,legacy -theme_aware_modal_prompts.css,effect,dark-mode,colors,popup,legacy -theme_color_variables.css,legacy, -theme_popups_and_menus.css,legacy -theme_sidebar.css,legacy -theme_toolbars.css,legacy -toggle_bookmarksbar_with_alt.css,legacy +deprecated/theme_additional_windows.css,legacy +deprecated/theme_aware_modal_prompts.css,legacy +deprecated/theme_color_variables.css,legacy, +deprecated/theme_popups_and_menus.css,legacy +deprecated/theme_sidebar.css,legacy +deprecated/theme_toolbars.css,legacy +deprecated/toggle_bookmarksbar_with_alt.css,legacy toggle_tabs_toolbar_with_alt.css,hack,tabs,menubar toolbarbuttons_icon+label.css,buttons,icon toolbars_below_content.css,tabs,toolbars -urlbar_and_popup_equal_width.css,legacy +deprecated/urlbar_and_popup_equal_width.css,legacy urlbar_centered_text.css,urlbar urlbar_connection_type_background_colors.css,urlbar,colors,status urlbar_connection_type_text_colors.css,urlbar,colors,status