MozillaZine

CustomizableUI

Discussion about official Mozilla Thunderbird builds
morat
 
Posts: 3445
Joined: February 3rd, 2009, 6:29 pm

Post Posted July 24th, 2019, 5:50 am

Is the CustomizableUI module being implemented in Thunderbird 68? Any info?

Implement CustomizableUI for SeaMonkey and Thunderbird
http://bugzilla.mozilla.org/show_bug.cgi?id=1011857
http://bugzilla.mozilla.org/show_bug.cgi?id=1119948

CustomizableUI
http://developer.mozilla.org/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm
http://developer.mozilla.org/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm/API-provided_widgets

I noticed the CustomizableUI property is available in the 3pane window and message window in Thunderbird 68.

I tried adding a button using the createWidget method in Thunderbird 68 like I do in Firefox 68, but the createWidget method fails silently.

Firefox Quantum compatible userChrome.js
http://github.com/Sporif/firefox-quantum-userchromejs

Restart Button for Firefox
http://gist.github.com/Sporif/ad6e917d87787491538bac80d3c8918c

Thunderbird example:

* chrome\userChrome.css

Code: Select all
/* Thunderbird userChrome.css */

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

toolbarbutton#alltabs-button {
  -moz-binding: url("userChrome.xml#js") !important; /* fails without !important */
}

* chrome\userChrome.xml

http://github.com/Sporif/firefox-quantu ... Chrome.xml

* chrome\TestThunderbirdButton_Movable.uc.js

Code: Select all
(function () {
  if (location != "chrome://messenger/content/messenger.xul") return;

  /* CustomizableUI
     http://developer.mozilla.org/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm
     http://developer.mozilla.org/docs/Mozilla/JavaScript_code_modules/CustomizableUI.jsm/API-provided_widgets
  */

  console.log("CustomizableUI test"); // logs correctly

  try {
    CustomizableUI.createWidget({
      id: "__unique_identifier_test_button", // should match id below
      type: "button",
      defaultArea: "mail-toolbar-menubar2", // Menu Bar     toolbar id
   // defaultArea: "mail-bar3",             // Mail Toolbar toolbar id
      label: "Test",
      tooltiptext: "Test" + "\n" + "\n" + "L: alert test" + "\n" + "R: open button context popup",
      onCommand: function (aEvent) {
        var win = aEvent.target.ownerDocument.defaultView;
        win.alert("test");
      },
    });
  } catch (e) {
    Components.utils.reportError(e);
  };

  var ios = Components.classes["@mozilla.org/network/io-service;1"].
    getService(Components.interfaces.nsIIOService);
  var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].
    getService(Components.interfaces.nsIStyleSheetService);
  var dataUrl = "data:image/png;base64," +
    "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAhpJRE" +
    "FUOMvN0UtI1FEUx/HvnfufV874n0lHfJQjlWTS6EKIxCFqE0S0yxaBLoooCIxoUbaIQCxy" +
    "kT1oE0Utgh6Q0M4kCiE3qYuIFmG+KPMx5gzTjP7Hmfu/LSIz0B606awu9xw+91x+8I8lVm" +
    "sMXmfzghF+hMMXZO7tkWgrT/9KfnPb35uc6tbz0090363qT6NX8a0051jpcuQujYHqQztQ" +
    "M+SscTZs31cykqL1j4DhHjwJwh0F4RrG+zsZHrhBQTCBWR45+eoCFb8FrBFOldYdrshOP6" +
    "D2wBi7jhrEPj5jY7TKm9SOS78EPjyk1C6sO+MJrMUpv5DvC1BU4CftVLi8s4S2rG980U50" +
    "VeBznIvFkf2+XGYSb5FJTZXENN1URhRKzVC50yFiyMt6WXry++HdTbYZ6/Zcyy8OC61iCK" +
    "lJZd4TDBWyu8Eia8cx3HG8edmy7pAe7XrJ6+UbiFQu70rJ1r0OlY2DSLOYs2hqLub4MReZ" +
    "xQTSGUfINJX1NqZJe9dZ8paA520cDESa67VKg7AQIoMhU/Q/HmKodwCnN4l0LeJ0f3utoY" +
    "myqQlOLwHaX36uaFMUpdJAFhxZvMzRcS/I+Tt1yDUC6f7x4WAZhGs5AWAAGJ6QaRgC2+UC" +
    "IUEIMp58enomUa4JwEIaP8e3kGR+CZgcGmzpu9/WKQ3h1/Y8WufQ2gIy2HpWaTRag7axlU" +
    "anZoklpmjhv6ivwhPCjfsi85IAAAAASUVORK5CYII=";
  var css = "#__unique_identifier_test_button {";
  css += 'list-style-image: url("' + dataUrl + '") !important;';
  css += "-moz-image-region: auto !important;";
  css += "}";
  css += '#mail-toolbar-menubar2 .menubar-text {'; // styles correctly
  css += "color: orange !important;";
  css += "}";
  var uri = ios.newURI("data:text/css," + encodeURIComponent(css), null, null);
  if (!sss.sheetRegistered(uri, sss.USER_SHEET)) {
    sss.loadAndRegisterSheet(uri, sss.USER_SHEET);
  }
})();

Reference - Thunderbird 60
http://dxr.mozilla.org/comm-esr60/search?q=CustomizableUI
http://dxr.mozilla.org/comm-esr60/source/mail/config/version.txt

Reference - Thunderbird 68
http://dxr.mozilla.org/comm-release/search?q=CustomizableUI
http://dxr.mozilla.org/comm-release/source/mail/config/version.txt

Paenglab

User avatar
 
Posts: 206
Joined: December 30th, 2006, 2:20 am
Location: Switzerland

Post Posted July 25th, 2019, 3:08 am

No, only the part that was needed for the port of the Appmenu.
Nuvola theme for Firefox and Thunderbird

morat
 
Posts: 3445
Joined: February 3rd, 2009, 6:29 pm

Post Posted July 25th, 2019, 8:20 am

Thanks for reply.

Return to Thunderbird Builds


Who is online

Users browsing this forum: No registered users and 3 guests