Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JavaScript Document
- //Button_PersonalToolbar.uc.js
- (function ptbut() {
- if (location != 'chrome://browser/content/browser.xul' && location != 'chrome://browser/content/browser.xhtml')
- return;
- try {
- CustomizableUI.createWidget({
- id: 'PersonalToolbar-button',
- type: 'custom',
- defaultArea: CustomizableUI.AREA_NAVBAR,
- onBuild: function(aDocument) {
- var toolbaritem = aDocument.createXULElement('toolbarbutton');
- var currentProfileDirectory = Services.dirsvc.get("ProfD", Ci.nsIFile).path.replace(/\\/g, "/");
- var buttonicon = "toolbar.png"
- var props = {
- id: 'PersonalToolbar-button',
- class: 'toolbarbutton-1 chromeclass-toolbar-additional',
- removable: true,
- label: 'Toggle',
- tooltiptext: 'Toggle Bookmarktoolbar',
- style: 'list-style-image: url("' + ("file:" + currentProfileDirectory + "/chrome/icons/" + buttonicon) +'");',
- };
- for(var p in props)
- toolbaritem.setAttribute(p, props[p]);
- return toolbaritem;
- }
- });
- CustomizableUI.registerToolbarNode(tb);
- } catch(e) { };
- document.getElementById('PersonalToolbar-button').addEventListener( "click", onClick );
- document.addEventListener('keydown', (event) => {
- var keyName = event.key;
- // Mac : Funktion wird ausgeführt, wenn Cmd + < gedrückt wird
- if (event.metaKey && keyName == '<') {
- onClick(event);
- }
- }, false
- );
- function onClick(aEvent) {
- var d2 = document.getElementById('PersonalToolbar');
- if (d2.style.width == "") {
- d2.style.width = "40px";
- } else if (d2.style.width == "130px") {
- d2.style.width = "40px";
- } else if (d2.style.width == "40px") {
- d2.style.width = "130px";
- }
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment