Beiträge von aborix
-
-
Alles Gute!
-
Testet bitte:
JavaScript
Alles anzeigen(function() { if (window.__SSi != 'window0') return; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { BrowserGlue: "resource:///modules/BrowserGlue.sys.mjs" }); lazy.BrowserGlue.prototype._onQuitRequest = function BG__onQuitRequest(aCancelQuit, aQuitType) { // If user has already dismissed quit request, then do nothing if (aCancelQuit instanceof Ci.nsISupportsPRBool && aCancelQuit.data) { return; } // There are several cases where we won't show a dialog here: // 1. There is only 1 tab open in 1 window // 2. browser.warnOnQuit == false // 3. The browser is currently in Private Browsing mode // 4. The browser will be restarted. // 5. The user has automatic session restore enabled and // browser.sessionstore.warnOnQuit is not set to true. // 6. The user doesn't have automatic session restore enabled // and browser.tabs.warnOnClose is not set to true. // // Otherwise, we will show the "closing multiple tabs" dialog. // // aQuitType == "lastwindow" is overloaded. "lastwindow" is used to indicate // "the last window is closing but we're not quitting (a non-browser window is open)" // and also "we're quitting by closing the last window". if (aQuitType == "restart" || aQuitType == "os-restart") { return; } // browser.warnOnQuit is a hidden global boolean to override all quit prompts. if (!Services.prefs.getBoolPref("browser.warnOnQuit")) { return; } var windowcount = 0; var pagecount = 0; let pinnedcount = 0; for (let win of BrowserWindowTracker.orderedWindows) { if (win.closed) { continue; } windowcount++; let tabbrowser = win.gBrowser; if (tabbrowser) { pinnedcount += tabbrowser._numPinnedTabs; pagecount += tabbrowser.visibleTabs.length - tabbrowser._numPinnedTabs; } } // No windows open so no need for a warning. if (!windowcount) { return; } // browser.warnOnQuitShortcut is checked when quitting using the shortcut key. // The warning will appear even when only one window/tab is open. For other // methods of quitting, the warning only appears when there is more than one // window or tab open. let shouldWarnForShortcut = this._quitSource == "shortcut" && Services.prefs.getBoolPref("browser.warnOnQuitShortcut"); let shouldWarnForTabs = //pagecount >= 2 && Services.prefs.getBoolPref("browser.tabs.warnOnClose"); if (!shouldWarnForTabs && !shouldWarnForShortcut) { return; } if (!aQuitType) { aQuitType = "quit"; } let win = BrowserWindowTracker.getTopWindow(); // Our prompt for quitting is most important, so replace others. win.gDialogBox.replaceDialogIfOpen(); let titleId, buttonLabelId; if (windowcount > 1) { // More than 1 window. Compose our own message. titleId = { id: "tabbrowser-confirm-close-windows-title", args: { windowCount: windowcount }, }; buttonLabelId = "tabbrowser-confirm-close-windows-button"; } else if (shouldWarnForShortcut) { titleId = "tabbrowser-confirm-close-tabs-with-key-title"; buttonLabelId = "tabbrowser-confirm-close-tabs-with-key-button"; } else { titleId = { id: "tabbrowser-confirm-close-tabs-title", args: { tabCount: pagecount }, }; buttonLabelId = "tabbrowser-confirm-close-tabs-button"; } // The checkbox label is different depending on whether the shortcut // was used to quit or not. let checkboxLabelId; if (shouldWarnForShortcut) { const quitKeyElement = win.document.getElementById("key_quitApplication"); const quitKey = ShortcutUtils.prettifyShortcut(quitKeyElement); checkboxLabelId = { id: "tabbrowser-confirm-close-tabs-with-key-checkbox", args: { quitKey }, }; } else { checkboxLabelId = "tabbrowser-confirm-close-tabs-checkbox"; } let [ title, buttonLabel, checkboxLabel, ] = win.gBrowser.tabLocalization.formatMessagesSync([ titleId, buttonLabelId, checkboxLabelId, ]); let warnOnClose = { value: true }; let flags = Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 + Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1; // 1 Fenster mit höchstens 1 nicht angehefteter Tab if (windowcount == 1 && pagecount < 2 && this._quitSource != "shortcut") { title.value = "Fenster schließen?"; buttonLabel.value = "Schließen"; checkboxLabel.value = null; } // buttonPressed will be 0 for closing, 1 for cancel (don't close/quit) let buttonPressed = Services.prompt.confirmEx( win, title.value, null, flags, buttonLabel.value, null, null, checkboxLabel.value, warnOnClose ); Services.telemetry.setEventRecordingEnabled("close_tab_warning", true); let warnCheckbox = warnOnClose.value ? "checked" : "unchecked"; let sessionWillBeRestored = Services.prefs.getIntPref("browser.startup.page") == 3 || Services.prefs.getBoolPref("browser.sessionstore.resume_session_once"); Services.telemetry.recordEvent( "close_tab_warning", "shown", "application", null, { source: this._quitSource, button: buttonPressed == 0 ? "close" : "cancel", warn_checkbox: warnCheckbox, closing_wins: "" + windowcount, closing_tabs: "" + (pagecount + pinnedcount), will_restore: sessionWillBeRestored ? "yes" : "no", } ); // If the user has unticked the box, and has confirmed closing, stop showing // the warning. if (buttonPressed == 0 && !warnOnClose.value) { if (shouldWarnForShortcut) { Services.prefs.setBoolPref("browser.warnOnQuitShortcut", false); } else { Services.prefs.setBoolPref("browser.tabs.warnOnClose", false); } } this._quitSource = "unknown"; aCancelQuit.data = buttonPressed != 0; } })();
-
Firefox merkt sich die Zoom-Faktoren für jede Domain, nicht für jede Seite. Sieht man auch in der content-prefs.sqlite. Es heisst ja auch browser.zoom.siteSpecific und nicht browser.zoom.pageSpecific.
-
Frohe Weihnachten und Alles Gute für das neue Jahr!
-
Teste:
JavaScript
Alles anzeigenconst strings = [ '- camp-firefox.de', ' - Firefox Allgemein', '- Individuelle Anpassungen', 'Camp Firefox -', '- Seite', '| ComputerBase Forum', '- CHIP', '· GitHub', ]; function replaceStrings() { let titlestring = document.title; for (let string of strings) { titlestring = titlestring.replace(string, ''); } document.title = titlestring; } if (document.title) { replaceStrings(); } else { let intID = setInterval(function() { if (document.title) { replaceStrings(); clearInterval(intID); } }, 0); }
-
Es geht nicht nur um Seiten von camp-firefox.de, sondern auch von anderen Domains?
-
Teste:
JavaScript
Alles anzeigen// ==UserScript== // @name Camp Firefox ausblenden // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @grant none // @icon https://www.camp-firefox.de/images/style-2/favicon.ico // @match https://www.camp-firefox.de* // @match https://www.camp-firefox.de/forum/ // @match https://www.camp-firefox.de/forum/thema/ // @match https://www.camp-firefox.de/forum/forum/15-firefox-allgemein/ // @run-at document-start // ==/UserScript== const string = ' - camp-firefox.de'; if (document.title) { document.title = document.title.replace(string, ''); } else { let intID = setInterval(function() { if (document.title) { document.title = document.title.replace(string, ''); clearInterval(intID); } }, 0); }
-
Ich meine es so:
JavaScript
Alles anzeigen// ==UserScript== // @name Camp Firefox ausblenden // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @grant none // @icon https://www.camp-firefox.de/images/style-2/favicon.ico // @match https://www.camp-firefox.de* // @match https://www.camp-firefox.de/forum/ // @match https://www.camp-firefox.de/forum/thema/ // @match https://www.camp-firefox.de/forum/forum/15-firefox-allgemein/ // @run-at document-start // ==/UserScript== const strings = [ '- camp-firefox.de', ]; let intID = setInterval(function() { if (document.title) { let titlestring = document.title; for (let str of strings) { titlestring = titlestring.replace(str, '', 'g'); } document.title = titlestring; clearInterval(intID); } }, 10);
-
Hallo,
füge im Metadaten-Block diese Zeile hinzu:
// @run-at document-start
und der JS-Code ist
JavaScript
Alles anzeigenconst strings = [ '- camp-firefox.de', ]; let intID = setInterval(function() { if (document.title) { let titlestring = document.title; for (let str of strings) { titlestring = titlestring.replace(str, '', 'g'); } document.title = titlestring; clearInterval(intID); } }, 10);
-
Wie funktioniert das:
JavaScript
Alles anzeigen(function() { if (!window.gBrowser) return; try { CustomizableUI.createWidget({ id: 'Download-button', type: 'custom', defaultArea: CustomizableUI.AREA_NAVBAR, onBuild: function(aDocument) { let toolbaritem = aDocument.createXULElement('toolbarbutton'); let props = { id: 'Download-button', class: 'toolbarbutton-1 chromeclass-toolbar-additional', removable: true, label: 'Download Fenster öffnen', accesskey: 'D', tooltiptext: 'Download Fenster öffnen', style: 'list-style-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAFo9M/3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAC7klEQVR42mJgAIL3K2X+AwQQy9VMzf+cIooMAAHE8H6i2n+QKEAAsbCrSjJ8vST4HyCAQByG13Mc/n+/D5EBCCAWsMByBQa2bz/BkgABxAAz5f1aYbAKgAACo6+XJP///OQFFgAIIJbvd23//z/NyPD/NQPDg8uS/wECiIlT+TDjr5/sDK9ZrjMo6D5nBAgguLYPC13/f7nN+v/bQ7H/P77awM0DCCAWGOPLp58MfE80GFiE+RiYOCXhGgECiAlE3PZI/i8iL8bAchMocV2C4d/+fwyPj2qBTQEIIBR02S7+/4N1AigSAAHECPcLyB9/OBkY/rMxMLxkYRDMvwWWAwggJpgCDidZBlazzwzsVg8ZGAXU4SYABBDckYy/2BmYvgsyMLLxMPz+g7AFIIAQCr6zA+0B+oCLn+HHV0Q4AgQQ48MTUv8FvwszsLwUhHhLlIeBkQ+oT+IXw8Pa3wwAAcQkb/GM8f2fbwwMr4CO+8ABDBABBua3wgzP8qQY1BbsZQQIILAj5V3vMj6Tv8Dw8/VbBqZ/nxjuT2BiUFw/D+wLgABCQXeX8v+/5pyAEg4AAYSh6v0il/+cMeIM/9+/YGBgZmNgZOSGKOSTYvi25A6DYOw2FD0AAcSCbsCfX38Y/n+4x/D37R0GZiY2hn/sQN//+8LAzGgClGPCcBVAAGEa8O8/A9MnVoZ/77gZ/gH5zHwCDP//czAwcnID5T5jGAAQQCx3o0L/s/znBXP+/fvD8E/sGgPjJ14GxrdCDAxszMBwBQYrAz8DAx8TA7P8d4anaXH/mf8yMfz/y87w6/9zBoAAYoSlJrbiAwzi7wwY/r38CNSIcCqTFB+E/wvonu//GVj4+Rie855k+NtjzaCwfjYjQAChBMhNt5T/7IV7GaTf6jD8fAZx7h9xXgZ2RmYGVjFBsMYfzZYMqjvmwvUBBBBWBIqqW2t5/n+eo/X/6zKj//d38v4HuRKbWoAAwouOher8Pxmtg1cjQIABAFbt8Z32Ai5RAAAAAElFTkSuQmCC)', oncommand: "window.open('chrome://browser/content/downloads/contentAreaDownloadsView.xhtml', 'Downloads', 'chrome,resizable=yes,width=600,height=600,left=120,top=100');" }; for (var p in props) toolbaritem.setAttribute(p, props[p]); return toolbaritem; } }); } catch(e) { }; Downloads.getList(Downloads.ALL) .then(list => list.addView({ onDownloadAdded: () => Services.wm.getMostRecentBrowserWindow().document.getElementById('Download-button').click() })); })();
-
Evtl. lässt sich ja dieses Skript umschreiben auf das kleine Popup
Gute Idee. Teste bitte:
-
Schon etwas besser:
JavaScript
Alles anzeigen(function() { if (window.__SSi != 'window0') return; function createButton(str) { CustomizableUI.createWidget({ id: str + '-button-2', type: 'custom', defaultArea: CustomizableUI.AREA_NAVBAR, onBuild: function() { let button = document.getElementById(str + '-button').cloneNode(true); button.id = str + '-button-2'; button.style.listStyleImage = 'url(chrome://browser/skin/' + str + '.svg)'; button.setAttribute('onclick', 'checkForMiddleClick(this, event); if (event.button == 0) event.target.ownerDocument.getElementById("' + str + '-button").click();'); button.setAttribute('onmousedown', 'if (event.button == 0) event.preventDefault();'); return button; } }); } createButton('back'); createButton('forward'); })();
-
Ja, so in etwa:
JavaScript
Alles anzeigen(function() { if (window.__SSi != 'window0') return; CustomizableUI.createWidget({ id: 'back-button-2', type: 'custom', defaultArea: CustomizableUI.AREA_NAVBAR, onBuild: function() { let button = document.getElementById('back-button').cloneNode(true); button.id = 'back-button-2'; button.style.listStyleImage = 'url(chrome://browser/skin/back.svg)'; return button; } }); CustomizableUI.createWidget({ id: 'forward-button-2', type: 'custom', defaultArea: CustomizableUI.AREA_NAVBAR, onBuild: function() { let button = document.getElementById('forward-button').cloneNode(true); button.id = 'forward-button-2'; button.style.listStyleImage = 'url(chrome://browser/skin/forward.svg)'; return button; } }); })();
Funktioniert aber noch nicht so ganz.
-
Dieses hier:
Da wird das neue Fenster nicht mit
OpenBrowserWindow()
sondern mit
openDialog(AppConstants.BROWSER_CHROME_URL)
geöffnet.
Wie ist es, wenn du diese Anweisung in die Browserkonsole eingibst?
Ich hatte mich oben im Beitrag vertan, und meinte diesen neuen Eintrag:
event.preventDefault()
Den meinte ich ohnehin auch.
-
Mich hat nur interessiert, warum es mit dem anderen Skript nicht so ist.
Welches Skript nochmal genau?
Ist das so richtig eingetragen?
Das funktioniert zwar auch, aber ich meinte nach diesen Zeilen:
-
-
Noch ein Test: Wie ist es, wenn du in die Browserkonsole eingibst:
OpenBrowserWindow()
-
-
In einer Bugzilla-Diskussion (Link muss ich erst suchen) wurde z.B. das Aufrufen eines Lesezeichens als typische Anwendung für OpenTrustedLinkIn beschrieben.
Das interessiert mich. Falls du den Link noch findest, teile ihn bitte mit.
Jetzt müsste man noch herausfinden, wie man das kurzzeitige Aufpoppen des Kontextmenüs beim Rechtsklick verhindern kann.
Mit event.preventDefault().
Fällt dir evtl. dazu etwas ein?
BeitragRE: Quicklink-Button[…]
Hallo @aborix.
Im Prinzip funtioniert es gut.
Nur das neue Fenster ist immer kleiner
camp-firefox.de/attachment/39572/
Ich kann es vergrößern, aber bei einem erneuten Rechtsklick ist es wieder kleiner.
Oder mache ich etwas falsch?Öffne mal mit Strg+N ein neues Fenster. Ist es gleich groß?