Wenn du jetzt noch den header so ändern könntest, dass es absolut klar ist dass das keine meiner Versionen vom Code ist.
Jawoll, wird gemacht.
-----------------------------------------------------
Erledigt. Recht so?
Wenn du jetzt noch den header so ändern könntest, dass es absolut klar ist dass das keine meiner Versionen vom Code ist.
Jawoll, wird gemacht.
-----------------------------------------------------
Erledigt. Recht so?
Du hast den header kopiert?
Verflixt, sieht wohl so aus.
Neuer Versuch.
// Additional toolbars
// Buttons to turn toolbar On/Off, right-click/context menu item to switch toolbar position
// Use filename starting with 00 for custom button functions !! =>
// 00_extra_toolbars_V(was_auch_immer).uc.js
// Based on: https://www.camp-firefox.de/forum/thema/137714-seitennavigation-fly-out-menue
// Aris: https://github.com/Aris-t2/CustomJSforFx/blob/master/scripts/addonbar_vertical.uc.js// Latest versions and icons =>
// Forum topic: https://www.camp-firefox.de/forum/thema/139927-eigene-zusatzleisten-ab-ff-143/
// Kudos to Aris and Mitleser
// ATTENTION: Some system buttons can still be moved to additional/custom toolbars, but they will have no function.
// There is a patch by @BrokenHeart: https://www.camp-firefox.de/forum/thema/138875-fix-toolbar-buttons-reagieren-nicht-mehr-ab-ff-134/
// Different patch re. the issue by Aris included in this script, experimental
// Basierend auf Version V14 von @Horstmann
(function() {
if (location.href !== 'chrome://browser/content/browser.xhtml')
return;
// User settings
// After script changes, restart with Clear StartUp Cache => about:support
// Custom Icons, expected in profile-name/chrome/icons folder ("icons" folder needs to be created)
// get path to profile folder
let ProfilePath = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
// path to icon folder named "icons" inside profile folder
let IconPath = '/chrome/icons/';
// On/Off Button
// Custom icon file
let Icon_tb = 'sidebars-right.svg';
// Firefox icon
let Icon_tb_Fx = 'chrome://browser/skin/sidebars-right.svg';
// false = use Firefox Icon, true = Custom Icon
let new_tb_icon = true;
// Complete path to icon
let ImagePath = ProfilePath + IconPath + Icon_tb;
// Position switch button
// Custom icon file
let Icon_sw = 'default-browser-red.svg';
// Firefox icon
let Icon_sw_Fx = 'chrome://global/skin/icons/arrow-right.svg';
// false: use Firefox Icon, true: Custom Icon
let new_tb_icon_sw = false;
// Complete path to icon
let ImagePathSW = ProfilePath + IconPath + Icon_sw;
// Custom background color: false = Off ; true = On (overwrites themes)
let new_tb_color = true;
// background color if true
//let new_tb_bg_color = 'hsla(200, 45%, 87%, 1)';
let new_tb_bg_color = '#4D4D4D';
// Border width, 0px = off
let new_tb_border_width = '1px';
// Border color
//let new_tb_border_color = 'red';
//let new_tb_border_color = 'var(--sidebar-border-color)';
let new_tb_border_color = 'color-mix(in srgb, currentColor 30%, transparent)';
// Size of toolbar and buttons changes, must be px values, all 3 settings are related ==>
// Change button sizes via padding, 8px default
let new_tb_btn_size = '6px';
// Distance between buttons, 2px default
let new_tb_distance = '4px';
// Width vertical toolbar / height horizontal toolbar, increased by this value on both sides
// Increase distance of buttons to edges, 0px => toolbar size = button size
let new_tb_size = '1px';
let new_toolbars_size = '16px';
// Expert mode ===>>>
// Saving changes, initial states ==>
// true = save states toolbar On/Off / position on quitting Firefox, false = don't save (prefs deleted)
// 2x restart required once after change, to make the the option stick
let new_tb_save = false; // true
// Initial state toolbar visibility: 0 = On, 1 = Off, only if new_tb_save = false (not saved)
let new_tb_off = 1; // 0
// Position initial state: 0 = right, 1 = left, 2 = bottom, 3 = top (NEU), only if new_tb_save = false (not saved)
let new_tb_loc = 0;
// Extra: false = Button switches toolbar On/Off / changes Position for all open windows ; true = only active window
let new_tb_uno = false; // On/Off Button
let new_tb_uno_sw = false; // Position button
// Possible problem solutions, if required, experimental ==>
// Fix #1 for themes with low/ tiling background images, true / false, best to only use one of both
let theme_fix = true;
// Fix #2, overwrites Fix #1
let theme_fix_2 = false;
// Adjustments for Restore 'Space & Separator' items script for Firefox 102+ by Aris, true / false
let separator_fix = true;
// Auto-Close Einstellungen
let autoCloseTime = 3000; // 0 = kein Auto-Close / >0 Zeit in Millisekunden /5000 => 5sec
let intervalID = 0;
// End of user settings
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
const pref_newtoolbar_state = "userchrome.newtoolbar.enabled";
let ntb_box = document.createXULElement('toolbox');
ntb_box.id = 'toolbox_new';
ntb_box.setAttribute('orient','horizontal');
let ntb = document.createXULElement('toolbar');
ntb.id = 'newtoolbar';
ntb.setAttribute('customizable', true);
ntb.setAttribute("class","toolbar-primary chromeclass-toolbar browser-toolbar customization-target");
ntb.setAttribute('mode', 'icons');
ntb.setAttribute('context', 'toolbar-context-menu');
// ntb.setAttribute('toolbarname', 'New_Toolbar_T');
// ntb.setAttribute('toolboxid', 'navigator-toolbox');
ntb.setAttribute('label', 'New Toolbar');
ntb.setAttribute('orient', 'vertical');
ntb.setAttribute("accesskey","");
ntb_box.appendChild(ntb);
document.getElementById('browser').parentNode.appendChild(ntb_box);
CustomizableUI.registerArea('newtoolbar', {legacy: true});
CustomizableUI.registerToolbarNode(ntb);
let observer_custom = new MutationObserver(function(mutations) {
for (let mutation of mutations) {
try {
const customContainer = document.getElementById('customization-container');
if (!customContainer) return;
const rect = customContainer.getBoundingClientRect();
document.getElementById('toolbox_new').style.setProperty('--height_newbar_c', rect.top + 'px');
} catch (e) { }
}
});
observer_custom.observe(document.querySelector('#main-window'), {
attributes: true,
attributeFilter: ['customizing'],
});
let navbar_size = document.getElementById("browser");
let observer = new ResizeObserver(() => {
let rect = navbar_size.getBoundingClientRect();
document.getElementById('toolbox_new').style.setProperty('--height_newbar', rect.height + 'px');
document.getElementById('toolbox_new').style.setProperty('--height_newbar_top', rect.top + 'px');
});
observer.observe(navbar_size);
//On/Off button
try {
CustomizableUI.createWidget({
id: 'NewToolbar_button',
defaultArea: CustomizableUI.AREA_NAVBAR,
tooltiptext: 'Toolbar On',
label: 'Toggle New Toolbar',
removable: false,
});
} catch(e) { }
// Button function
NewToolbar_button.addEventListener('click', event => {
if (event.button === 0) {
if (!new_tb_uno) {
tb_toggle();
} else {
tb_toggle_uno();
}
if (NewToolbar_button.classList.contains("off-mode_btn")) {
NewToolbar_button.setAttribute("tooltiptext", "Toolbar Off");
} else {
NewToolbar_button.setAttribute("tooltiptext", "Toolbar On");
}
// Auto-Close für alle Fenster
if (autoCloseTime > 0) {
// Sicherstellen, dass der aktuelle Zustand sichtbar ist
let anyVisible = false;
for (let win of Services.wm.getEnumerator("navigator:browser")) {
const toolbar = win.document.getElementById("newtoolbar");
if (!toolbar.classList.contains("off-mode")) {
anyVisible = true;
break;
}
}
// Falls sichtbar: Timer setzen, der wieder ausblendet
if (anyVisible) {
if (intervalID) {
clearInterval(intervalID);
intervalID = 0;
}
intervalID = event.target.ownerGlobal.setInterval(autoClose, autoCloseTime);
} else {
// Wenn nach dem Klick alles zu ist, Timer beenden
if (intervalID) {
clearInterval(intervalID);
intervalID = 0;
}
}
}
}
});
function tb_toggle() {
for (let win of Services.wm.getEnumerator("navigator:browser")) {
const toolbar = win.document.getElementById("newtoolbar");
const browserArea = win.document.getElementById("browser");
const button = win.document.getElementById("NewToolbar_button");
toolbar.classList.toggle("off-mode");
browserArea.classList.toggle("off-mode_b");
button.classList.toggle("off-mode_btn");
const ntb_visible = !toolbar.classList.contains("off-mode");
Services.prefs.setBoolPref(pref_newtoolbar_state, ntb_visible);
}
};
function tb_toggle_uno() {
newtoolbar.classList.toggle("off-mode");
browser.classList.toggle("off-mode_b");
NewToolbar_button.classList.toggle("off-mode_btn");
const ntb_visible = !newtoolbar.classList.contains("off-mode");
Services.prefs.setBoolPref(pref_newtoolbar_state, ntb_visible);
};
function autoClose() {
if (!intervalID) {
return;
}
let anyVisible = false;
for (let win of Services.wm.getEnumerator("navigator:browser")) {
const toolbar = win.document.getElementById("newtoolbar");
const browserArea = win.document.getElementById("browser");
const button = win.document.getElementById("NewToolbar_button");
if (!toolbar.classList.contains("off-mode")) {
// Leiste schließen
toolbar.classList.add("off-mode");
browserArea.classList.add("off-mode_b");
button.classList.add("off-mode_btn");
button.setAttribute("tooltiptext", "Toolbar Off");
}
if (!toolbar.classList.contains("off-mode")) {
anyVisible = true;
}
}
if (!anyVisible) {
clearInterval(intervalID);
intervalID = 0;
}
}
// Position initial state (um „top“ erweitert)
if (new_tb_loc === 0) {
toolbox_new.classList.add("right_mode");
browser.classList.add("right_mode_b");
NewToolbar_button.classList.add("right_mode_btn");
}
else if (new_tb_loc === 1) {
toolbox_new.classList.add("left_mode");
browser.classList.add("left_mode_b");
NewToolbar_button.classList.add("left_mode_btn");
}
else if (new_tb_loc === 2) {
toolbox_new.classList.add("bottom_mode");
browser.classList.add("bottom_mode_b");
NewToolbar_button.classList.add("bottom_mode_btn");
}
else if (new_tb_loc === 3) { // NEU für oben
toolbox_new.classList.add("top_mode");
browser.classList.add("top_mode_b");
NewToolbar_button.classList.add("top_mode_btn");
}
let toolbarEnabled = true;
try {
toolbarEnabled = Services.prefs.getBoolPref(pref_newtoolbar_state);
} catch(e) {
Services.prefs.setBoolPref(pref_newtoolbar_state, new_tb_off === 0);
toolbarEnabled = new_tb_off === 0;
}
if (!toolbarEnabled) {
newtoolbar.classList.add("off-mode");
browser.classList.add("off-mode_b");
NewToolbar_button.classList.add("off-mode_btn");
NewToolbar_button.setAttribute("tooltiptext", "Toolbar Off");
}
// Icon
if (new_tb_icon) {
NewToolbar_button.classList.add("icon_mode");
}
// Background color
if (new_tb_color) {
newtoolbar.classList.add("ntb_bg_color");
}
const customHandlers = {
"unified-extensions-button": (el, e) => gUnifiedExtensions.togglePanel(e),
"fxa-toolbar-menu-button": (el, e) => gSync.toggleAccountPanel(el, e),
"firefox-view-button": (el, e) => FirefoxViewHandler.openToolbarMouseEvent(e),
"downloads-button": (el, e) => DownloadsIndicatorView.onCommand(e),
"pageActionButton": (el, e) => BrowserPageActions.mainButtonClicked(e),
"alltabs-button": (el, e) => gTabsPanel.showAllTabsPanel(e, "alltabs-button"),
"library-button": (el, e) => PanelUI.showSubView("appMenu-libraryView", el, e),
"import-button": (el, e) => MigrationUtils.showMigrationWizard(window, {
entrypoint: MigrationUtils.MIGRATION_ENTRYPOINTS.BOOKMARKS_TOOLBAR,
}),
};
document.getElementById("newtoolbar").addEventListener("mousedown", (e) => {
const button = e.target.closest("toolbarbutton");
if (button?.id && customHandlers[button.id]) customHandlers[button.id](button, e);
});
// Position switch menu item
const pref_position = "userchrome.newtoolbar.position";
function getPositionPref() {
try {
return Services.prefs.getCharPref(pref_position);
} catch (e) {
return "right";
}
}
function setPositionPref(value) {
Services.prefs.setCharPref(pref_position, value);
}
// Context menu menuitem alt
let refItemSW = document.createXULElement("menuitem");
refItemSW.setAttribute('id', 'NewToolbar_position_Con');
refItemSW.setAttribute('closemenu', 'none');
refItemSW.setAttribute('label', 'Toolbar Position');
refItemSW.classList.add('menuitem-iconic');
let refItemSW_A = document.getElementById('toolbar-context-menu');
let refItemSW_S = document.querySelector('.viewCustomizeToolbar');
refItemSW_A.insertBefore(refItemSW, refItemSW_S);
let menuseparator_sw = document.createXULElement("menuseparator");
menuseparator_sw.setAttribute('id', 'sw_sep');
refItemSW_A.insertBefore(menuseparator_sw, refItemSW.nextSibling);
function applyPosition(pos) {
toolbox_new.classList.remove("left_mode", "bottom_mode", "right_mode", "top_mode"); // NEU top_mode
browser.classList.remove("left_mode_b", "bottom_mode_b", "right_mode_b", "top_mode_b");
NewToolbar_button.classList.remove("left_mode_btn", "bottom_mode_btn", "right_mode_btn", "top_mode_btn");
NewToolbar_position_Con.classList.remove("left_mode_sw", "bottom_mode_sw", "right_mode_sw", "top_mode_sw");
if (pos === "left") {
toolbox_new.classList.add("left_mode");
browser.classList.add("left_mode_b");
NewToolbar_button.classList.add("left_mode_btn");
NewToolbar_position_Con.classList.add("left_mode_sw");
} else if (pos === "bottom") {
toolbox_new.classList.add("bottom_mode");
browser.classList.add("bottom_mode_b");
NewToolbar_button.classList.add("bottom_mode_btn");
NewToolbar_position_Con.classList.add("bottom_mode_sw");
} else if (pos === "top") { // NEU
toolbox_new.classList.add("top_mode");
browser.classList.add("top_mode_b");
NewToolbar_button.classList.add("top_mode_btn");
NewToolbar_position_Con.classList.add("top_mode_sw");
} else if (pos === "right") {
toolbox_new.classList.add("right_mode");
browser.classList.add("right_mode_b");
NewToolbar_button.classList.add("right_mode_btn");
NewToolbar_position_Con.classList.add("right_mode_sw");
}
}
let savedPos = getPositionPref();
applyPosition(savedPos);
document.getElementById("NewToolbar_position_Con").addEventListener('click', event => {
if (event.button === 0 || event.button === 2) {
if (!new_tb_uno_sw) {
poser();
}
else {
poser_uno();
};
}
});
// Zyklus right -> left -> bottom -> top -> right
function poser() {
for (let win of Services.wm.getEnumerator("navigator:browser")) {
const toolbox = win.document.getElementById("toolbox_new");
const browserArea = win.document.getElementById("browser");
const button = win.document.getElementById("NewToolbar_button");
const button_con = win.document.getElementById("NewToolbar_position_Con");
if (toolbox.classList.contains("right_mode")) {
toolbox.classList.replace("right_mode", "left_mode");
browserArea.classList.replace("right_mode_b", "left_mode_b");
button.classList.replace("right_mode_btn", "left_mode_btn");
button_con.classList.replace("right_mode_sw", "left_mode_sw");
setPositionPref("left");
}
else if (toolbox.classList.contains("left_mode")) {
toolbox.classList.replace("left_mode", "bottom_mode");
browserArea.classList.replace("left_mode_b", "bottom_mode_b");
button.classList.replace("left_mode_btn", "bottom_mode_btn");
button_con.classList.replace("left_mode_sw", "bottom_mode_sw");
setPositionPref("bottom");
}
else if (toolbox.classList.contains("bottom_mode")) {
toolbox.classList.replace("bottom_mode", "top_mode");
browserArea.classList.replace("bottom_mode_b", "top_mode_b");
button.classList.replace("bottom_mode_btn", "top_mode_btn");
button_con.classList.replace("bottom_mode_sw", "top_mode_sw");
setPositionPref("top");
}
else if (toolbox.classList.contains("top_mode")) {
toolbox.classList.replace("top_mode", "right_mode");
browserArea.classList.replace("top_mode_b", "right_mode_b");
button.classList.replace("top_mode_btn", "right_mode_btn");
button_con.classList.replace("top_mode_sw", "right_mode_sw");
setPositionPref("right");
}
}
};
function poser_uno() {
if (toolbox_new.classList.contains("right_mode")) {
toolbox_new.classList.replace("right_mode", "left_mode");
browser.classList.replace("right_mode_b", "left_mode_b");
NewToolbar_button.classList.replace("right_mode_btn", "left_mode_btn");
NewToolbar_position_Con.classList.replace("right_mode_sw", "left_mode_sw");
setPositionPref("left");
}
else if (toolbox_new.classList.contains("left_mode")) {
toolbox_new.classList.replace("left_mode", "bottom_mode");
browser.classList.replace("left_mode_b", "bottom_mode_b");
NewToolbar_button.classList.replace("left_mode_btn", "bottom_mode_btn");
NewToolbar_position_Con.classList.replace("left_mode_sw", "bottom_mode_sw");
setPositionPref("bottom");
}
else if (toolbox_new.classList.contains("bottom_mode")) {
toolbox_new.classList.replace("bottom_mode", "top_mode");
browser.classList.replace("bottom_mode_b", "top_mode_b");
NewToolbar_button.classList.replace("bottom_mode_btn", "top_mode_btn");
NewToolbar_position_Con.classList.replace("bottom_mode_sw", "top_mode_sw");
setPositionPref("top");
}
else if (toolbox_new.classList.contains("top_mode")) {
toolbox_new.classList.replace("top_mode", "right_mode");
browser.classList.replace("top_mode_b", "right_mode_b");
NewToolbar_button.classList.replace("top_mode_btn", "right_mode_btn");
NewToolbar_position_Con.classList.replace("top_mode_sw", "right_mode_sw");
setPositionPref("right");
}
};
// Icon Position menuitem
if (new_tb_icon_sw) {
NewToolbar_position_Con.classList.add("icon_mode_sw");
}
// On quitting Firefox: delete Prefs, if new_tb_save = false
if (!new_tb_save) {
Services.obs.addObserver(function observer(subject, topic, data) {
if (topic === "quit-application-granted") {
try {
Services.prefs.clearUserPref(pref_newtoolbar_state);
Services.prefs.clearUserPref(pref_position);
} catch (e) { }
Services.obs.removeObserver(observer, "quit-application-granted");
}
}, "quit-application-granted");
};
let css =`
#main-window {
--ug-newbar_basewidth: calc(2 * ${new_tb_btn_size} + ${new_toolbars_size}); /* Minimalgroesse = Groesse Buttons */
--ug-newbar_width: calc(var(--ug-newbar_basewidth) + ${new_tb_border_width} + 2 * ${new_tb_size});
}
/*- Buttons -*/
/* Buttons sizes */
#newtoolbar {
--toolbarbutton-inner-padding: ${new_tb_btn_size} !important;
--toolbarbutton-outer-padding: 0px !important;
}
/* On/Off Button */
#NewToolbar_button .toolbarbutton-icon {
list-style-image: url("${Icon_tb_Fx}");
}
#NewToolbar_button.icon_mode .toolbarbutton-icon {
list-style-image: url("${ImagePath}");
}
#NewToolbar_button.off-mode_btn:not(:hover, :active) .toolbarbutton-icon {
opacity: 0.4;
}
/* Button adjustments to Toolbar Position */
#NewToolbar_button.left_mode_btn .toolbarbutton-icon,
#NewToolbar_position_Con.left_mode_sw :is(image, img) {
transform: rotate(180deg);
}
#NewToolbar_button.bottom_mode_btn .toolbarbutton-icon,
#NewToolbar_position_Con.bottom_mode_sw :is(image, img) {
transform: rotate(90deg);
}
#NewToolbar_button.top_mode_btn .toolbarbutton-icon,
#NewToolbar_position_Con.top_mode_sw :is(image, img) {
transform: rotate(-90deg);
}
#NewToolbar_position_Con {
-moz-context-properties: fill, fill-opacity !important;
fill: currentColor !important;
}
#NewToolbar_position_Con :is(image, img) {
list-style-image: url("${Icon_sw_Fx}");
content: url("${Icon_sw_Fx}") !important;
}
#NewToolbar_position_Con.icon_mode_sw :is(image, img) {
list-style-image: url("${ImagePathSW}");
content: url("${ImagePathSW}") !important;
}
#unified-extensions-button[hidden] {
visibility: visible !important;
display: flex !important;
}
/*-- Browser adjustments --*/
#browser.right_mode_b {
transition: padding-right 0.25s ease !important;
}
#browser.left_mode_b {
transition: padding-left 0.25s ease !important;
}
#browser.bottom_mode_b {
transition: padding-bottom 0.25s ease !important;
}
#browser.top_mode_b {
transition: padding-top 0.25s ease !important;
}
#browser:not(.off-mode_b).right_mode_b {
padding-right: var(--ug-newbar_width) !important;
}
#browser:not(.off-mode_b).left_mode_b {
padding-left: var(--ug-newbar_width) !important;
}
#browser:not(.off-mode_b).bottom_mode_b {
padding-bottom: var(--ug-newbar_width) !important;
}
#browser:not(.off-mode_b).top_mode_b {
padding-top: var(--ug-newbar_width) !important;
}
/*-- Basics / Right --*/
#toolbox_new {
position: fixed;
z-index: 2 !important;
display: flex;
/* width: fit-content; */
top: var(--height_newbar_top);
right: 0px;
}
#newtoolbar {
display: flex;
min-width: var(--ug-newbar_width) !important;
width: var(--ug-newbar_width) !important;
min-height: var(--ug-newbar_basewidth) !important;
height: var(--height_newbar) !important;
align-items: center !important;
overflow: hidden !important;
padding-block: 8px;
border-width: 0px;
border-style: solid !important;
border-color: ${new_tb_border_color} !important;
border-left-width: ${new_tb_border_width};
border-right-width: 0px;
margin-inline: 0px;
}
#toolbox_new:not(.bottom_mode) #newtoolbar:not([customizing]) {
max-width: var(--ug-newbar_width) !important;
transition: width 0.25s ease, max-width 0.25s ease, min-width 0.25s ease, border-left-width 0.125s ease;
}
#toolbox_new #newtoolbar:not([customizing]).off-mode {
min-width: 0px !important;
width: 0px !important;
max-width: 0px !important;
min-height: unset !important;
max-height: unset !important;
border-width: 0px !important;
box-shadow: none !important;
}
#newtoolbar:not([customizing]).off-mode > :is(.toolbarbutton-1, toolbaritem) {
opacity: 0 !important;
}
#newtoolbar > :is(.toolbarbutton-1, toolbaritem),
#newtoolbar toolbarpaletteitem > :is(.toolbarbutton-1, toolbaritem) {
margin-block: ${new_tb_distance} !important;
margin-inline: var(--toolbarbutton-outer-padding) !important;
transition: opacity 0.125s ease;
}
/*-- Left --*/
#toolbox_new.left_mode {
right: unset;
left: 0px;
}
#toolbox_new.left_mode #newtoolbar:not([customizing]) {
border-left-width: 0px;
border-right-width: ${new_tb_border_width};
transition: width 0.25s ease, max-width 0.25s ease, min-width 0.25s ease, border-right-width 0.125s ease;
}
/*-- Bottom --*/
#toolbox_new.bottom_mode {
top: unset;
bottom: 0px;
}
#toolbox_new.bottom_mode #newtoolbar:not([customizing]) {
flex-direction: row !important;
min-height: 0px !important;
height: var(--ug-newbar_width) !important;
max-height: var(--ug-newbar_width) !important;
min-width: 0px !important;
width: 100vw !important;
padding-block: 0px;
padding-inline: 8px;
border-inline-width: 0px;
border-top-width: ${new_tb_border_width};
/*justify-content: center !important;*/ /* Inhalt mittig, optional */
transition: height 0.25s ease, max-height 0.25s ease, min-height 0.25s ease, border-top-width 0.125s ease !important;
}
#toolbox_new.bottom_mode #newtoolbar:not([customizing]).off-mode {
min-height: 0px !important;
height: 0px !important;
max-height: 0px !important;
max-width: unset !important;
}
#toolbox_new.bottom_mode #newtoolbar:not([customizing]) > :is(.toolbarbutton-1, toolbaritem),
#toolbox_new.bottom_mode #newtoolbar:not([customizing]) toolbarpaletteitem > :is(.toolbarbutton-1, toolbaritem) {
margin-block: var(--toolbarbutton-outer-padding) !important;
margin-inline: ${new_tb_distance} !important;
}
/-- Top (NEU) --/
#toolbox_new.top_mode {
top: 0px;
bottom: unset;
}
#toolbox_new.top_mode #newtoolbar:not([customizing]) {
flex-direction: row !important;
min-height: 0px !important;
height: var(--ug-newbar_width) !important;
max-height: var(--ug-newbar_width) !important;
min-width: 0px !important;
width: 100vw !important;
padding-block: 0px;
padding-inline: 8px;
border-inline-width: 0px;
border-top-width: ${new_tb_border_width};
/*justify-content: center !important;*/ /* Inhalt mittig, optional */
transition: height 0.25s ease, max-height 0.25s ease, min-height 0.25s ease, border-top-width 0.125s ease !important;
padding-right: 100vw !important;
}
#toolbox_new.top_mode #newtoolbar:not([customizing]).off-mode {
min-height: 0px !important;
height: 0px !important;
max-height: 0px !important;
max-width: unset !important;
}
#toolbox_new.top_mode #newtoolbar:not([customizing]) > :is(.toolbarbutton-1, toolbaritem),
#toolbox_new.top_mode #newtoolbar:not([customizing]) toolbarpaletteitem > :is(.toolbarbutton-1, toolbaritem) {
margin-block: var(--toolbarbutton-outer-padding) !important;
margin-inline: ${new_tb_distance} !important;
}
/*-- Fullscreen --*/
/* Mac / nur Video Fullscreen */
#main-window[inDOMFullscreen]:not([customizing]) #toolbox_new {
visibility: collapse !important;
}
#main-window[inDOMFullscreen]:not([customizing]) #browser {
padding: 0 !important;
}
/* Windows Fullscreen Video + Normal */
@media (-moz-platform: windows) {
#main-window[inFullscreen]:not([customizing]) #toolbox_new {
visibility: collapse !important;
}
#main-window[inFullscreen]:not([customizing]) #browser {
padding: 0 !important;
}
/*-- customizing --*/
#main-window[customizing] #toolbox_new {
top: unset !important;
bottom: 0 !important;
right: 0 !important;
left: unset !important;
}
#newtoolbar[customizing] {
height: calc(100vh - var(--height_newbar_c)) !important;
width: initial !important;
box-shadow: inset 0px 1px ${new_tb_border_color};
transition: none !important;
}
#main-window:not([customizing]) #newtoolbar[customizing].off-mode {
min-width: 0px !important;
width: 0px !important;
min-height: 0px !important;
height: 0px !important;
border-width: 0px !important;
}
#customization-container {
margin-right: var(--ug-newbar_width) !important;
}
/*- Background colors themes -*/
/* Custom toolbar background color if enabled */
#newtoolbar.ntb_bg_color {
background-color: ${new_tb_bg_color} !important;
}
/*- Background themes, if background images are tiled, try theme_fix options above -*/
:root[lwtheme] #newtoolbar:not(.ntb_bg_color) {
background-color: var(--lwt-accent-color, var(--toolbar-bgcolor)) !important;
}
:root[lwtheme][lwtheme-image] #newtoolbar:not(.ntb_bg_color) {
background-image: var(--lwt-header-image) !important;
background-position: left 0px top 0px !important;
}
`;
if (theme_fix) {
css += `
/*- Fix #1 for themes with tiled background images -*/
:root[lwtheme][lwtheme-image] #newtoolbar:not(.ntb_bg_color) {
background: var(--lwt-header-image) !important;
background-repeat: no-repeat !important;
background-size: cover !important;
background-position: right 0px top 0px !important;
}
:root[lwtheme][lwtheme-image] #toolbox_new.bottom_mode #newtoolbar:not(.ntb_bg_color) {
background-size: auto !important;
}
`;
}
if (theme_fix_2) {
css += `
/*- Fix #2 for themes with tiled background images -*/
:root[lwtheme][lwtheme-image] #toolbox_new #newtoolbar:not(.ntb_bg_color) {
background: transparent !important;
}
:root[lwtheme][lwtheme-image] #newtoolbar:not(.ntb_bg_color)::before {
content: "" ;
position: absolute;
top: 0;
right: 0;
width: var(--height_newbar) !important;
height: var(--ug-newbar_width) !important;
pointer-events: none;
z-index: -1 !important;
background: var(--lwt-header-image) !important;
background-repeat: no-repeat !important;
transform: rotate(-90deg) translateX(var(--ug-newbar_width)) !important;
transform-origin: 100% 100% !important;
transition: margin 0.25s ease;
}
:root[lwtheme][lwtheme-image] #toolbox_new.bottom_mode #newtoolbar:not(.ntb_bg_color, [customizing])::before {
transform: scaleX(-1) !important;
transform-origin: 50% 50% !important;
width: 100% !important;
}
:root[lwtheme][lwtheme-image] #newtoolbar:not(.ntb_bg_color)[customizing]::before {
width: calc(100vh - var(--height_newbar_c)) !important;
}
#newtoolbar:not([customizing]).off-mode::before {
min-width: 0px !important;
margin-inline: 0px calc(0px - var(--ug-newbar_width));
}
#toolbox_new.left_mode #newtoolbar:not([customizing]).off-mode::before {
margin-inline: calc(0px - var(--ug-newbar_width)) 0;
}
#toolbox_new.bottom_mode #newtoolbar:not([customizing]).off-mode::before {
min-height: 0px !important;
margin-inline: 0px;
margin-block: 0px calc(0px - var(--ug-newbar_width)) !important;
}
`;
}
if (separator_fix) {
css += `
/* Adjustments for Separator Scripts */
#newtoolbar toolbarseparator {
width: calc(var(--ug-newbar_width) - ${new_tb_border_width} - 6px) !important;
margin: 5px 0px !important;
border-block-color: hsl(0, 0%, 0%, 0.45) hsl(0, 0%, 100%, 0.55) !important;
transition: width 0.125s ease !important;
}
#newtoolbar :is(toolbarspacer, toolbarspring, toolbarseparator) {
min-width: 0px !important;
}
#newtoolbar:not([customizing]).off-mode toolbarseparator {
width: 0px !important;
}
#toolbox_new.bottom_mode #newtoolbar:not([customizing]) toolbarseparator {
transform: rotate(-90deg) !important;
margin: 0px !important;
}
#newtoolbar[customizing] toolbarseparator {
margin-block: 16px !important;
}
`;
}
const sss = Cc['@mozilla.org/content/style-sheet-service;1'].getService(Ci.nsIStyleSheetService);
const uri = Services.io.newURI('data:text/css,' + encodeURIComponent(css));
sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
})();
Alles anzeigen
Besser?
Besser!
Danke Horstmann.
Ich wollte mir aber alle Optionen offenhalten.
War aber eine schwere Geburt.
// Additional toolbars
// Buttons to turn toolbar On/Off, right-click/context menu item to switch toolbar position
// Use filename starting with 00 for custom button functions !! =>
// 00_extra_toolbars_V14.uc.js
// Based on: https://www.camp-firefox.de/forum/thema/137714-seitennavigation-fly-out-menue
// Aris: https://github.com/Aris-t2/CustomJSforFx/blob/master/scripts/addonbar_vertical.uc.js// Latest versions and icons =>
// Forum topic: https://www.camp-firefox.de/forum/thema/139927-eigene-zusatzleisten-ab-ff-143/
// Kudos to Aris and Mitleser
// ATTENTION: Some system buttons can still be moved to additional/custom toolbars, but they will have no function.
// There is a patch by @BrokenHeart: https://www.camp-firefox.de/forum/thema/138875-fix-toolbar-buttons-reagieren-nicht-mehr-ab-ff-134/
// Different patch re. the issue by Aris included in this script, experimental
// Version V14
(function() {
Alles anzeigen
Höhe (horizontale Leiste) und Breite (vertikale Leiste) sind in Zeilen 64 - 74 einstellbar (Version 14 in #161), im speziellen Zeile 74.
Viel einfacher!!
In den Settings eingefügt und
"--ug-newbar_basewidth: calc(2 * ${new_tb_btn_size} + ${new_toolbars_size}); /* Minimalgroesse = Groesse Buttons */ "
geändert.
An "die Leiste oben" mache ich mich noch dran.
Denn da wäre sie mir lieber.
Aber dazu brauche ich Zeit, und die habe ich z.Z. nicht so wirklich.
Ich habe Deine Version 14 genutzt.
Egal ob links, rechts oder unten, es funktioniert.
Und für mich habe ich die Hintergrundfarbe der Leise noch geändert.
Was ich noch suche, wie ich die Höhe, bzw, die Breite verändern kann.
Und was mich dann auch noch interessiert, ob man diese Leiste auch oben in das Fenster integrieren könnte.
Aber DAS, das ist dann schon wieder eine größere Geschichte.
Hi Horstmann
Ich glaube, ich habe Verwendung für Dein Skript,
aber nicht so, wie Du es ausgearbeitet und zur Verfügung gestellt hast!
Daher habe ich noch mal daran Hand angelegt UND
eine Funktion hinzugefügt, die die Zusatzleiste automatisch wieder ausblendet!
Hier die Codefragmente:
// Auto-Close Einstellungen
let autoCloseTime = 5000; // Zeit in Millisekunden, 0 = kein Auto-Close
let intervalID = 0;
In die Settings einfügen.
Die Buttonfunktion mit diesem Code ersetzen:
// Button function
NewToolbar_button.addEventListener('click', event => {
if (event.button === 0) {
if (!new_tb_uno) {
tb_toggle();
} else {
tb_toggle_uno();
}
if (NewToolbar_button.classList.contains("off-mode_btn")) {
NewToolbar_button.setAttribute("tooltiptext", "Toolbar Off");
} else {
NewToolbar_button.setAttribute("tooltiptext", "Toolbar On");
}
// Auto-Close für alle Fenster
if (autoCloseTime > 0) {
// Sicherstellen, dass der aktuelle Zustand sichtbar ist
let anyVisible = false;
for (let win of Services.wm.getEnumerator("navigator:browser")) {
const toolbar = win.document.getElementById("newtoolbar");
if (!toolbar.classList.contains("off-mode")) {
anyVisible = true;
break;
}
}
// Falls sichtbar: Timer setzen, der wieder ausblendet
if (anyVisible) {
if (intervalID) {
clearInterval(intervalID);
intervalID = 0;
}
intervalID = event.target.ownerGlobal.setInterval(autoClose, autoCloseTime);
} else {
// Wenn nach dem Klick alles zu ist, Timer beenden
if (intervalID) {
clearInterval(intervalID);
intervalID = 0;
}
}
}
}
});
Alles anzeigen
Und die Zeitschleifenfunktion einfügen.
Direkt unter "function tb_toggle_uno()"
function autoClose() {
if (!intervalID) {
return;
}
let anyVisible = false;
for (let win of Services.wm.getEnumerator("navigator:browser")) {
const toolbar = win.document.getElementById("newtoolbar");
const browserArea = win.document.getElementById("browser");
const button = win.document.getElementById("NewToolbar_button");
if (!toolbar.classList.contains("off-mode")) {
// Leiste schließen
toolbar.classList.add("off-mode");
browserArea.classList.add("off-mode_b");
button.classList.add("off-mode_btn");
button.setAttribute("tooltiptext", "Toolbar Off");
}
// Prüfen, ob noch irgendwo sichtbar (sollte nach obigem eigentlich nicht vorkommen)
if (!toolbar.classList.contains("off-mode")) {
anyVisible = true;
}
}
if (!anyVisible) {
clearInterval(intervalID);
intervalID = 0;
}
}
Alles anzeigen
Wenn ich das komplette Skript einfügen soll, so gib Bescheid.
Die Skripte sind überarbeitet.
Sie sollte jetzt den "Elchtest" überstehen
und auch sofort nach dem Verschieben aus dem Anpassfenster (TAB) funktionieren.
Die Symbole sind nun auch hochgeladen.
Ja!
Ist das jetzt der Endstand?
Warum so ungeduldig?
Ich habe da noch was anderes in der Pipeline, aber das dauert noch.
Muss selber erst mal schauen.
FuchsFan & 2002Andreas
War mein Fehler!
So funktioniert es und damit hat sich das mit dem auskommentierten Code auch erledigt.
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'link-button-cf', // Id des Buttons
link = 'https://www.camp-firefox.de/forum/', // Linkziel des Buttons
label = 'Quicklink: camp-firefox.de/...', // Bezeichnung des Buttons
tooltiptext = 'Quicklink:\nForum - camp-firefox.de',
// Icon-------------------------------------------------------
icon = 'camp-firefox.ico', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
// Erlaubt korrekte .svg Icons Darstellung in allen UI Bereichen
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
// Optik
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
}
});
} catch(e) {};
//click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', event => {
if (event.button === 0) {
openTrustedLinkIn(link, "tab");
}
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
Horstmann Oh, nein ich ließ den Code aus #19 mit dem meinigen vergleichen.
Das geht schon, ist mE nur sehr verwirrend.
Der eine Vorteil der Variablen ist, dass User Einstellung oben zusammengefasst dargestellt und veränderbar sind; für einen neuen Button kann man dann nur diese Zeilen anpassen, und fertig.
Die Button Funktion könnte man auch noch nach oben ziehen.Ob man das jetzt braucht für relativ kurze und einfache Buttonscripts ist eine andere Frage.
Richtig!
Natürlich kann man den "Konfigurationsbereich" auch weglassen und die "Parameter" direkt
im Code einfügen, nur so ist es aber auch für so manchen Nutzer einfacher,
wenn nicht im Code direkt etwas geändert werden muss.
Kurze Bewertung von perplexy (KI)
Anmerkung!
Variante 1 => Dein Code aus #20
Variante 2 => hänge ich mal unten an.
ZitatBeide Varianten tun funktional fast dasselbe, sind aber unterschiedlich strukturiert und haben jeweils Vor‑ und Nachteile.
Robustheit / Fehlerfälle
- Beide Varianten kapseln CustomizableUI.createWidget in try { ... } catch(e) {}, behandeln aber den Fehler nur durch Ignorieren.
- Variante 1 geht davon aus, dass document.getElementById(button_id) nach createWidget sofort existiert; wenn das fehlschlägt, gibt es keinen Klick‑Listener.
- Variante 2 prüft explizit, ob der Button existiert, und versucht es bei Fehlschlag weiter (Polling), wodurch der Listener sehr zuverlässig angehängt wird.
Bewertung: Variante 2 ist in der Praxis fehlertoleranter, weil der Klick‑Handler fast sicher gesetzt wird.
Ob DAS so stimmt? Ich kann das nicht so wirklich beurteilen.
Da müsste mal kurz ein Profi drüberschauen.
Horstmann In der langen Version der "Beurteilung" standen nur Dinge,
die meiner Meinung jetzt nicht so ausschlaggebend waren.
Ich glaube, das kannst Du Dir ja anschauen, wenn Du ganz unten den Editierbutton anklickst.
Wenn das nicht gehen sollte, ich schicke Dir die lange Version auch gerne per PN zu.
Und hier meine Variante, wobei da noch zwei Zeilen Code sind,
die ich auskommentiert habe, weil ich mich noch nicht entschieden habe!
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'link-button-cf', // Id des Buttons
link = 'https://www.camp-firefox.de/forum/', // Linkziel des Buttons
label = 'Quicklink: camp-firefox.de/...', // Bezeichnung des Buttons
tooltiptext = 'Quicklink:\nForum - camp-firefox.de',
// Icon-------------------------------------------------------
icon = 'camp-firefox.ico', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
// Erlaubt korrekte .svg Icons Darstellung in allen UI Bereichen
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
// Optik
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
}
});
} catch(e) {};
//click
(function add_button() {
// const button = document.getElementById(id);
if (button) {
// button.addEventListener('click', event => {
document.getElementById(id).addEventListener('click', event => {
if (event.button === 0) {
openTrustedLinkIn(link, "tab");
}
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
Wofür ist der ganze Bitch-Code?
Habe jetzt mal nur den Code aus #10
nach : "catch(e) {};" angepasst und übernommen, (danke dafür)
und damit besteht es den Elchtest und auch den Funktionstest.
(Sofortige Funktion nach verschieben aus dem Anpassfenster)
Also, entweder besteht das Skript den Elchtest,
oder der Button ist ohne Neustart sofort funktionstüchtig.
Beides bekomme ich nicht hin![]()
Was ist nun "wichtiger"?
Ich meine der Elchtest, denn dieses Szenario, so kann ich mir vorstellen,
kommt öfters vor.
Für das andere Problem kann man (ich) ja einen Hinweis ins Skript schreiben.
"Nach dem Verschieben aus dem Anpassfenster ist ein Neustart erforderlich!"
So, oder so ähnlich.
Meinungen?
9 Quellen
Auch wieder KI-erzeugt? Denn niemals ist die Dokumentation von WebExtension-Schnittstellen die Quelle für diesen Code, weil die im Script verwendete API damit überhaupt nichts zu tun hat … 🤦♂️
Wie hätten's denn gern?
Das waren, sind die Quellen die scheinbar perplexity genutzt hatte.
Zumindest waren diese als Quellen angegeben.
Einfach nur den Hinweis, dass KI verwendet wurde?
Oder wie soll ich denn kenntlich machen, dass ich KI genutzt habe?
Oder möchtest Du, dass ich keine Skripte mehr ....
Dann lass ich's halt, wenn nicht gewünscht.
Balstle nur noch für mich und schaue hier quasi nur noch zu.
Nicht falsch verstehen! Bin nicht eingeschnappt oder zickig (bockig).
Versuche es nur richtigzumachen und bin gerade total verunsichert.
Wenn noch weiter Bestätigungen kommen, so denke ich, werde ich mich kommende Woche dranmachen
die Skripte zu aktualisieren.
Bitte testen.
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'link-button-cf', // Id des Buttons
link = 'https://www.camp-firefox.de/forum/', // Linkziel des Buttons
label = 'Quicklink: camp-firefox.de/...', // Bezeichnung des Buttons
tooltiptext = 'Quicklink:\nForum - camp-firefox.de',
// Icon-------------------------------------------------------
icon = 'camp-firefox.ico', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
// Optik
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
//click
button.addEventListener('click', () => {
if (event.button === 0) {
event.target.ownerGlobal.openTrustedLinkIn(link, "tab");
}
});
}
});
} catch (e) {};
})();
Alles anzeigen
9 Quellen
Horstmann Danke für den "Elchtest".
Nun muss ich alle "Buttons" noch einmal überarbeiten.
Aber hatte Mitleser nicht geschrieben, dass ....?
Wenn man nicht alles selber überprüft, tststs.
Dennoch, so denke ich, ist die Idee hinter Mitlesers Vorlage die richtige.
Also, bevor ich hier aufräume und auch die passenden Symbole hochlade,
werde ich die Skripte nach Horstmanns Vorlage "reparieren"!
Wird halt nun aber leider etwas dauern.
Wenn "dringender" Bedarf besteht, passe ich das betreffende Skript dann auch vorrangig an!
Hier mal ein Beispiel, wie ich das dachte!
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'browser-toolbox-button', // Id des Buttons
label = 'Browser-Werkzeuge', // Bezeichnung des Buttons
tooltiptext = 'Browser-Werkzeuge',
// Icon-------------------------------------------------------
icon = 'werkzeuge.png',
iconPath = 'file:///C:/FoxIcons2/',
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
Alles anzeigen
und an statt:
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
einfach
button.style.listStyleImage = 'url("' + iconPath + icon + '")';
Wenn Du die Zeile "curProfDir = ...." auch weg haben möchtest,
muss am Ende der Zeile, also hinter "file:///C:/FoxIcons2/' ", das Komma durch das Semikolon ersetzt werden!
FuchsFan Natürlich funktioniert das,
aber wozu habe ich einen Konfigurationsbereich eingeführt?
für den About-Dialog
// About-Dialog.uc.js
// Das Script erstellt einen Button, der den About-Dialog öffnet.
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'aboutname', // Id des Buttons
label = 'aboutname', // Bezeichnung des Buttons
tooltiptext = 'Über Firefox',
// Icon-------------------------------------------------------
icon = 'firefox_logo_16.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir)); // Pfad zum Profil
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
}
});
} catch(e) {};
//click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', event => {
if (event.button !== 0) return;
openAboutDialog();
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
für Addons-UpDate-Check
// Addons-UpDate-Check.uc.js
// Das Script erstellt einen Button, der einen UpDate-Check ausführt und dies in einem neuen Tab anzeigt.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'addons-update-button', // Id des Buttons
label = 'Add-ons Update', // Bezeichnung des Buttons
tooltiptext = 'Add-ons aktualisieren',
// Icon-------------------------------------------------------
icon = 'sync.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#ffe10f'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) {};
// click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', (event) => {
if (event.button !== 0) {
return;
}
event.target.ownerGlobal.openTrustedLinkIn('about:addons', 'tab');
window.addEventListener('pageshow', function onPageshow(e) {
const doc = e.target;
if (doc.URL !== 'about:addons') {
return;
}
window.removeEventListener('pageshow', onPageshow);
doc.querySelector('addon-page-options panel-item[action="view-recent-updates"]').click();
doc.querySelector('addon-page-options panel-item[action="check-for-updates"]').click();
content.setTimeout(function () {
const categories = doc.getElementById('categories');
categories
.querySelector('button[viewid="addons://updates/recent"]')
.click();
categories
.querySelector('button[viewid="addons://updates/available"]')
.click();
}, 1500);
});
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
für das Downloadfenster
// Downloadbutton.uc.js
// Das Script erstellt einen Button, der das Downloadfenster öffnet.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'Download-button', // Id des Buttons
label = 'Download Fenster öffnen', // Bezeichnung des Buttons
tooltiptext = 'Download Fenster öffnen',
// Icon-------------------------------------------------------
icon = 'Download.png', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
}
});
} catch(e) {};
(function add_button(() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', (event) => {
if (event.button === 0) {
event.target.ownerGlobal.window.open(
'chrome://browser/content/downloads/contentAreaDownloadsView.xhtml',
'Downloads',
'chrome,resizable=yes,width=800,height=600,left=120,top=100'
);
}
});
} else {
// Button existiert noch nicht → später erneut versuchen
setTimeout(add_downloads_button_listener, 100);
}
})();
})();
Alles anzeigen
für den Neustart
// Restart_Firefox.uc.js
// Das Script erstellt einen Button, der einen Neustart des Browsers auslöst .
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
// Linksklick if (event.button == 0)
// Mittelklick if (event.button == 1)
// Rechtsklick if (event.button == 2)
(function() {
if (location.href !== 'chrome://browser/content/browser.xhtml')
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'restart-button2a', // Id des Buttons
label = 'Neustart', // Bezeichnung des Buttons
tooltiptext = 'Neustart (inkl. SkriptCache Löschen)',
// Icon-------------------------------------------------------
icon = 'restart_1.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#ff0000'; // Farbe für das SVG-Icon setzen
button.style.paddingLeft = '5px';
button.style.paddingTop = '3px';
}
});
} catch(e) { };
(function add_restart_button_listener() {
const button = document.getElementById('restart-button2a');
if (button) {
button.addEventListener('click', (event) => {
// rechte Maus – Neustart
if (event.button === 2) {
Services.startup.quit(
Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit
);
}
// linke Maus – Neustart mit Löschung des Start-Caches
if (event.button === 0) {
event.preventDefault();
Services.appinfo.invalidateCachesOnRestart();
Services.startup.quit(
Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit
);
}
// Mittelklick
if (event.button === 1) {
openTrustedLinkIn("about:config", "tab");
}
});
} else {
// Button existiert noch nicht → später erneut versuchen
setTimeout(add_restart_button_listener, 100);
}
})();
})();
Alles anzeigen
Button für den Profilmanager
// QuickProfilesChangesButton.uc.js
// Das Script erstellt einen Button, der den Profilmanager zur Auswahl einer weiteren Instans öffnet.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (location.href !== 'chrome://browser/content/browser.xhtml')
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'profileschange-button', // Id des Buttons
label = 'Profil zusätzlich starten', // Bezeichnung des Buttons
tooltiptext = 'Profile Changer',
// Icon-------------------------------------------------------
icon = 'profile.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#E0E0E0'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) {};
// click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', (event) => {
if (event.button != 0) {
return;
}
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
// let args = ["-no-remote", "-P", "Neu", "-foreground"]; // Profil wird ausgewählt
let args = ["-no-remote", "-P", "-foreground"]; // Profilmanager aufrufen
file.initWithPath("C:\\Program Files\\Mozilla Firefox\\firefox.exe"); // 64‑bit
// file.initWithPath("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); // 32‑bit
// file.initWithPath("/Applications/Firefox.app/Contents/MacOS/firefox"); // macOS
let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
process.init(file);
process.run(false, args, args.length);
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
Button "Erweiterungen" verschiebbar
// Erweiterungen-button verschiebbar.uc.js
// Vorlage: 2002Andreas in https://www.camp-firefox.de/forum/thema/135846/?postID=1217540#post1217540
// Änderung: Speravir in https://www.camp-firefox.de/forum/thema/135846/?postID=1218255#post1218255
// Neu! https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
origID = "unified-extensions-button", // ID des originalen Buttons
label = "Erweiterungen",
tooltiptext = label, // auch eigener Text möglich, dieser in Anführungszeichen
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
menuButton = document.getElementById(origID),
buttonID = 'ucjs_' + origID;
if (!CustomizableUI.getPlacementOfWidget( buttonID )) {
try {
CustomizableUI.createWidget({
id: buttonID,
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
let toolbaritem = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbaritem');
toolbaritem.id = buttonID;
toolbaritem.className = 'chromeclass-toolbar-additional';
toolbaritem.setAttribute('label', label);
toolbaritem.style.color = '#FF00FF'; // Farbe für das SVG-Icon setzen
return toolbaritem;
}
});
if (!CustomizableUI.getPlacementOfWidget( buttonID )) {
menuButton.style.display = 'none';
return;
};
} catch(e) {
menuButton.style.display = 'none';
return;
};
};
setTimeout(function() {
document.getElementById(buttonID).appendChild(menuButton);
menuButton.setAttribute('consumeanchor', buttonID);
menuButton.setAttribute('label', label);
menuButton.setAttribute('tooltiptext', tooltiptext);
}, 0);
}());
Alles anzeigen
PersonalToolbar (Lesezeichenleiste) ein- und ausblenden
// Button_PersonalToolbar.uc.js
// Das Script erstellt einen Button, der die Lesezeichentoolbar ein- oder ausblendet.
// Source file https://www.camp-firefox.de/forum/thema/134920/?postID=1232103#post1232103
// PersonalToolbar_ausblenden
// basierend auf den Ideen von BrokenHeart und visoer, Verbesserungen von Horstmann,
// Korrekturen von Sören und Anpassungen von Mira
// Neu! https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function ptbut() {
if (location.href !== 'chrome://browser/content/browser.xhtml')
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
startHeight = '0px' ,// '24px' oder '0px' Der Startzustand wird definiert: '24px' startet mit sichtbarer Leiste
collapse = '0px' ,// Leiste nicht sichtbar
visible = '24px' ,// Leiste sichtbar
autoCloseTime = 5000 ,// 0 = kein Auto-Close / >0 Zeit in Millisekunden /5000 => 5sec
intervalID = 0 ,
persToolbar = document.getElementById('PersonalToolbar'),
id = 'PersonalToolbar-button', // Id des Buttons
label = 'Toggle', // Bezeichnung des Buttons
tooltiptext = 'Lesezeichenleiste ein-/ausblenden',
// Icon-------------------------------------------------------
icon = 'bookmark.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#ffaa00'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) { };
//----------BEGINN----------------------
// Funktion zum Abfragen der Tastatur ("belauscht" Eingaben)
// Hinweis: Tasten, die anderweitig bereits "abgefangen" werden, ergeben keinen Event
document.addEventListener('keydown', (event) => {
let keyName = event.key;
if (event.altKey && keyName == 'q') { // Funktion wird ausgeführt, wenn "Alt & q gedrückt werden
onClick(event,true);
}
}, false
);
//----------ENDE------------------------
// Anmerkungen und Beispiele am Ende des Scriptes
document.getElementById('PersonalToolbar').style.minHeight = '0';
document.getElementById('PersonalToolbar').style.transition = 'all 0.3s steps(6, end)';
if( startHeight === visible || startHeight === collapse ) {
document.getElementById('PersonalToolbar').style.height = startHeight;
}
else {
document.getElementById('PersonalToolbar').style.height = visible;
}
document.getElementById('PersonalToolbar-button').addEventListener( "click", onClick );
function onClick(aEvent, keyEvent=false) {
if(!keyEvent && aEvent.button != 0) {
return;
}
if (persToolbar.style.height == '') {
persToolbar.style.height = collapse;
}
else if (persToolbar.style.height == visible) {
persToolbar.style.height = collapse;
}
else if(persToolbar.style.height == collapse) {
persToolbar.style.height = visible;
if(!intervalID && autoCloseTime) {
intervalID = aEvent.target.ownerGlobal.setInterval( autoClose, autoCloseTime );
}
}
}
function autoClose() {
if (persToolbar.style.height == visible) {
persToolbar.style.height = collapse;
}
if (intervalID) {
clearInterval(intervalID);
intervalID = 0;
}
}
/*
function autoClose() {
if( intervalID ) {
if( persToolbar.style.height == visible) {
persToolbar.style.height = collapse;
clearInterval(intervalID);
intervalID=0;
}
}
}
*/
})();
// Anmerkungen und Beispiele
// Funktion wird ausgeführt, wenn STRG + Alt + l gedrückt wird
// if (event.ctrlKey && event.altKey && keyName == 'l') {
// Funktion wird ausgeführt, wenn STRG + w gedrückt werden
//if (event.ctrlKey && keyName == 'w') {
Alles anzeigen
Für den Profilordner
// Button_for_Profilfolder.us.js
// Das Script erstellt einen Button, der direkt den "Profilordner" öffnet.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'profilefolder-ToolBarButton', // Id des Buttons
label = 'Profil-Ordner öffnen', // Bezeichnung des Buttons
tooltiptext = 'Profil-Ordner öffnen',
// Icon-------------------------------------------------------
icon = 'user.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#ff5a79'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) {};
(function add_button() {
const button = document.getElementById(id);
if (button) {
// click
button.addEventListener('click', (event) => {
if (event.button === 0) {
event.target.ownerGlobal.Services.dirsvc.get("ProfD", Ci.nsIFile).launch();
}
});
} else {
// Wenn der Button noch nicht existiert, später nochmal probieren
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
für den "Chromeordner"
// Button_for_Chromefolder.us.js
// Das Script erstellt einen Button, der direkt den "chrome"-Ordner im "Profil" öffnet.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'Open-Chrome-Folder-ToolBarButton', // Id des Buttons
label = 'Chrome-Ordner öffnen', // Bezeichnung des Buttons
tooltiptext = 'Chrome-Ordner öffnen',
// Icon-------------------------------------------------------
icon = 'folder.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#619dbf'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) {};
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', event => {
// if (event.button === 0) {
event.target.ownerGlobal.Services.dirsvc.get("UChrm", Ci.nsIFile).launch();
// }
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
Für die Browserwerkzeuge
// Browser-Werkzeuge.uc.js
// Das Script erstellt einen Button, der die Browser-Wekzeuge öffnet.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'browser-toolbox-button', // Id des Buttons
label = 'Browser-Werkzeuge', // Bezeichnung des Buttons
tooltiptext = 'Browser-Werkzeuge',
// Icon-------------------------------------------------------
icon = 'window-dev-tools.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
// button.style.listStyleImage = 'url("' + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#83ee1a'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) {};
// click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', (event) => {
if (event.button === 0) {
// Versuche das Menü-Element zu finden
let document = event.target.ownerDocument;
let menuItem = document.getElementById('menu_browserToolbox');
if (!menuItem) {
let { require } = ChromeUtils.importESModule(
"resource://devtools/shared/loader/Loader.sys.mjs",
{}
);
let { BrowserToolboxLauncher } = require(
'resource://devtools/client/framework/browser-toolbox/Launcher.sys.mjs'
);
BrowserToolboxLauncher.init();
// Beobachter für das Menü-Element, bis es auftaucht
let observer = new MutationObserver(() => {
menuItem = document.getElementById('menu_browserToolbox');
if (menuItem) {
menuItem.click();
observer.disconnect();
}
});
observer.observe(document, { childList: true, subtree: true });
} else {
menuItem.click();
}
}
});
} else {
// Wenn Button noch nicht existiert, erneut versuchen
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
für Werkzeugen für Webentwickler
// Werkzeuge-fuer-Webentwickler.us.js
// Das Script erstellt einen Button, der die Werkzeuge-fuer-Webentwickler öffnet.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'dev-toolbox-button', // Id des Buttons
label = 'Werkzeuge für Web-Entwickler', // Bezeichnung des Buttons
tooltiptext = 'Werkzeuge für Web-Entwickler',
// Icon-------------------------------------------------------
icon = 'developer.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.color = '#ffe10f'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) {};
// click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', (event) => {
if (event.button === 0) {
// Versuche das Menü-Element zu finden
let document = event.target.ownerDocument;
let menuItem = document.getElementById('menu_devToolbox');
if (!menuItem) {
let { require } = ChromeUtils.importESModule(
"resource://devtools/shared/loader/Loader.sys.mjs",
{}
);
require('devtools/client/framework/devtools-browser');
// Beobachter für das Menü-Element, bis es auftaucht
let observer = new MutationObserver(() => {
menuItem = document.getElementById('menu_devToolbox');
if (menuItem) {
menuItem.click();
observer.disconnect();
}
});
observer.observe(document, { childList: true, subtree: true });
} else {
menuItem.click();
}
}
});
} else {
// Wenn Button noch nicht existiert, erneut versuchen
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
Skripte sind nun überarbeitet und sollte sowohl den "Elchtest" sowie das "ohne Neustart sofort funktionstüchtig" bestehen.
Mitleser hat hier ein Musterskript vorgestellt, das ich mal etwas unter die Lupe genommen habe.
Nach Überprüfung und vergleichen mit "meinem" Quicklink-Button für das Forum,
kam ich zu dem Ergebnis, dass dieses Skript wohl einen besseren Code beinhaltet.
Darauf habe ich alle meine "Quicklinks" überarbeitet.
Dieser Teil ist von "https://www.perplexity.ai/" erstellt!
ZitatAlles anzeigenHauptunterschiede
- Konfiguration und Anpassbarkeit: Die neue Variante verwendet eine zentrale "UserConfiguration"-Sektion,
in der z.B. die ID, das Linkziel, das Label und der Icon-Pfad klar anpassbar ausgegliedert sind.
Das macht das Skript deutlich flexibler im täglichen Einsatz und Änderungen können ohne Änderung
an der Logik vorgenommen werden, was Wartung und Anpassung vereinfacht.- Icon-Handling: Im neuen Skript werden Icon-Pfad und -Dateiname dynamisch generiert. Zusätzlich
werden moderne CSS-Eigenschaften wie MozContextProperties gesetzt, was wichtig sein kann,
wenn SVG-Icons oder Farbthemen im Browser verwendet werden. Auch wird die Handhabung
der Firefox-Einstellung zur Unterstützung von SVG-Kontext-Eigenschaften berücksichtigt.- Event-Handling: Das neue Skript nutzt einen gezielten Event Listener für Klicks und prüft explizit,
dass der linke Mausklick benutzt wurde (event.button === 0). Das erhöht die Fehlertoleranz und Flexibilität
bei der Benutzung durch Nutzer im Gegensatz zur festen onclick-Logik der alten Variante,
in der alle Klicks (auch Rechtsklick oder Mittelklick) behandelt werden.- Tab-Logik und Ziel: Die alte Variante öffnet immer vier feste URLs, während die neue Variante flexibel für eine
einzelne frei konfigurierbare Zieladresse programmiert ist. Falls mehrere Ziele benötigt werden,
müsste das im neuen Skript ergänzt werden, aber für typische Szenarien ist das neue Verhalten deutlich übersichtlicher.- Kompatibilität und Zukunftssicherheit: Die neue Variante nutzt moderne Browser-APIs und bezieht Features
wie PathUtils und moderne Preferences explizit mit ein – sie ist daher besser für neue Firefox-Versionen
geeignet und zukunftssicherer.Fazit
Die neue Variante ist die bessere Wahl, weil sie einfacher anpassbar, technisch moderner und robuster gegenüber zukünftigen Änderungen ist.
Sie ist übersichtlicher strukturiert und unterstützt eine nachhaltige Wartung und Erweiterung durch Nutzer mit unterschiedlichen Bedürfnissen.
Bis hierhin ist der Text von "https://www.perplexity.ai/" erstellt.
Wichtig![]()
Alle hier von mir zur Verfügung gestellte Skripte sind unter zu Hilfenahme von KI erstellt!
Nun denn, hier meine ersten Quicklink-Skripte.
Als Erstes der Quicklink-Button für das Forum.
// QuickLinkButton-cf.uc.js
// Das Script erstellt einen Button, der einen Tab öffnet mit einer Website (https://www.camp-firefox.de/forum/).
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'link-button-cf', // Id des Buttons
link = 'https://www.camp-firefox.de/forum/', // Linkziel des Buttons
label = 'Quicklink: camp-firefox.de/...', // Bezeichnung des Buttons
tooltiptext = 'Quicklink:\nForum - camp-firefox.de',
// Icon-------------------------------------------------------
icon = 'camp-firefox.ico', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir)); // Pfad zum Profil
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
// Erlaubt korrekte .svg Icons Darstellung in allen UI Bereichen
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
// Optik
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
}
});
} catch(e) {};
//click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', event => {
if (event.button === 0) {
openTrustedLinkIn(link, "tab");
}
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
Nun ein Button der gleich mehrere Tabs (Internetseiten) öffnet
// QuickLinkButton.uc.js
// Das Script erstellt einen Button, der mehrere Tabs öffnet mit verschiedenen Webseiten.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'link-button', // Id des Buttons
// link = 'fedia.io/m/FirefoxCSS', // Linkziel des Buttons
quickLinks =
[
'https://www.tagesschau.de/',
'https://www.zdfheute.de/',
'https://www.welt.de/?wtrid=crossdevice.n24.desktop.directhome',
'https://www.n-tv.de/',
];
label = 'Quicklink: M:C', // Bezeichnung des Buttons
tooltiptext = 'Quicklink: Morning Coffee',
// Icon-------------------------------------------------------
icon = 'cup-16as.png', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
}
});
} catch(e) {};
//click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', function(event) {
quickLinks.forEach(link => {
if (event.button === 0) {
openWebLinkIn(link, "tab");
}
});
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen
Und nun noch ein Quicklink-Button für "about:about"
// QuickLinkButton-about:about.uc.js = Button_for_QuickLinks-about.uc.js
// Das Script erstellt einen Button, der einen Tab öffnet mit den Links zu verschiedenen "about:"-Seiten.
// Source file https://www.camp-firefox.de/forum/thema/140072/?postID=1282691#post1282691
/* ----------------------------------------------------------------------------------- */
/* Zu beachten ist, dass die Grafiken sich im richtigen Ordner befinden müssen */
/* %appdata%\Mozilla\Firefox\Profiles\"Profilname"\chrome\icons */
/* ----------------------------------------------------------------------------------- */
(function() {
if (!window.gBrowser)
return;
const
// ■■ START UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
id = 'link-button-about', // Id des Buttons
link = 'about:about', // Linkziel des Buttons
label = 'Quicklink: about:about', // Bezeichnung des Buttons
tooltiptext = 'Quicklink:\nabout:about',
// Icon-------------------------------------------------------
icon = 'firefox.svg', // [Name.Dateiendung] des Symbols
iconPath = '/chrome/icons/', // Pfad zum Ordner der das Icon beinhaltet
// ■■ END UserConfiguration ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
curProfDir = PathUtils.toFileURI(PathUtils.join(PathUtils.profileDir));
if (Services.prefs.getBoolPref('svg.context-properties.content.enabled') == false) {
Services.prefs.setBoolPref('svg.context-properties.content.enabled', true );
}
//BUTTON
try {
CustomizableUI.createWidget({
id: id,
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
onCreated: (button) => {
button.style.MozContextProperties = 'fill, stroke, fill-opacity';
button.style.listStyleImage = 'url("' + curProfDir + iconPath + icon + '")';
button.style.minWidth = 'fit-content';
button.style.fill = '#f1b508'; // Farbe für das SVG-Icon setzen
}
});
} catch(e) {};
// click
(function add_button() {
const button = document.getElementById(id);
if (button) {
button.addEventListener('click', (event) => {
if (event.button === 0) {
event.target.ownerGlobal.openTrustedLinkIn(link, "tab");
}
});
} else {
setTimeout(add_button, 100);
}
})();
})();
Alles anzeigen