GithubHelp home page GithubHelp logo

cleidigh / thunderkdb Goto Github PK

View Code? Open in Web Editor NEW
11.0 5.0 7.0 1.12 GB

Thunderbird Addon Code Knowledge Base

JavaScript 79.00% CSS 10.61% HTML 9.87% C++ 0.19% Java 0.11% Makefile 0.01% XSLT 0.09% Shell 0.01% Python 0.02% Batchfile 0.01% PowerShell 0.01% DIGITAL Command Language 0.01% C 0.01% Vim Script 0.01% Smarty 0.04% VBScript 0.01% SCSS 0.01% Less 0.02%

thunderkdb's Introduction

thunderkdb's People

Contributors

cleidigh avatar jobisoft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

thunderkdb's Issues

How do you get the Thunderbird version info in background.js?

For "MailExtensions", nothing is overlayed based on your extension. Instead, a "background script", listed in manifest.json, is run.

In that script, you don't have access to all sorts of facilities you're used to in Thunderbird proper.

Specifically, how do you get the Thunderbird version info in there?

Please provide a concrete snippet of code.

<listbox>, element issues and alternatives

<listbox> XUL element and its related subelements have been deprecated.

<richlistbox>, is the most basic alternative.
<tree> can also be used, it manages column width, better , but can require extra logic for views (a simple content fewest built-in)

A Gist here shows two simple lists XUL , one using richlistbox the other tree.
https://gist.github.com/cleidigh/4db62350b3b70fdbed799800bb17afc4

A good example extension using richlistbox is TbSync
https://addons.thunderbird.net/en-US/thunderbird/addon/tbsync/?src=search

xpiLib code pointer:

<richlistbox id="tbsync.newaccount.serviceproviderlist" flex="1" seltype="single" style="margin-top:1ex" onselect="tbSyncDavNewAccount.clearValues();" ondblclick="tbSyncDavNewAccount.advance()"/>

Full extension:
https://github.com/cleidigh/ThunderKdB/tree/master/xall/x68/773590-tbsync

My global extension object goes missing in TB 68 - why?

Background

My 'traditional' extension (lets call it MyExt) uses a global object, named similarly to the extension (let's say MyExtStuff) - with all relevant constants, global variables, methods, "namespaced" methods (i.e. subjects with methods) existing within that global object.

(I had created this object so as not to pollute the global (or window) namespace with a large number of names, which might conflict with some other extensions which are more liberal with it.)

Now, I have a bunch of .js files, and a subset of these is loaded for different windows or dialogs. Each of them does something like this:

if ("undefined" == typeof(MyExtStuff)) {
  var MyExtStuff = {};
};

and then I would add members to that object, e.g.

MyExtStuff.Foo() = function() { return 42; }

so, each .js adds some stuff into MyExtStuff, then when the UI is used (e.g. you press some button, or during the load event handler), this object is fully decked out and everything we've added is usable.

The problem

So, now I'm trying to load my extension in Thunderbird 68. I've created a manifest.json, it's recognized, it's supposedly loading, but... as soon as something requiring MyExtStuff comes into play, I get an error message about it not being defined.

This is not due to a syntax error in the JS files! So... what causes this failure with Thunderbird 68 and how can I fix it?

ColumnsWizard Compatibility Update for Thunderbird 68

Christopher, Please PLEEEEZ update ColumnsWizard! Its absence has been haunting me every day for months now... columns are so effed up now in TB - need to be able to set my preferred columns default, see other particular columns (like CC in the Inbox) etc. And I'llbe glad to donate a few $$ to your efforts - just tell me how! Thank you.

XML Parsing Error: prefix not bound to a namespace <- but it is...

I'm using an HTML element replacing a XUL element, e.g. <html:input>, e.g. in my preferences dialog. But - when I try to use that dialog, in TB 68, I get an error saying:

XML Parsing Error: prefix not bound to a namespace
Location: chrome://bidimailpack/content/bidimailpack-prefs-68.xul
Line Number 59, Column 7:      <html:input id="space_between_paragraphs_value_text"
------^

This is strange, since I think I did ensure the prefix is bound to a namespace. My dialog element is the following:

<dialog
        id="bidimailui-dialog"
        xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        title="&bidimailpack-settings;"
        dlgbuttons="accept,cancel">

also, if I create a new Thunderbird profile, install the extension, and try opening the preferences dialog - it opens just fine with no complaints.

So, what's going on?

When should I use globalThis rather than window?

In browser JS code, a "global" variable is actually (always? usually?) a member of the window object. We also see the window object used in Thunderbird, but there is also an object named globalThis. For example, the Services object is a member of globalThis.

When, if at all, should we use globalThis? And which variables should be made members of globalThis rather than of window (assuming they're not local, which they should be of course if one can manage it).

Load a JS code module in all TB versions

(This question is about Javascript code modules, i.e. not the newer, JS-language modules)

In the old days, and for many years, you loaded your JSM modules using Components.utils.import(); but in recent TB versions, this doesn't work. On the other hand - ChromeUtils.import(), which works in TB 68, but doesn't even exist in older versions.

Now, you might think: Why can't I just use some version-independent library and have it import for me? Well, problem is, you would need to load that library first, which means loading a... JS code module :-( . This is (AFAICT) boilerplate code which you'll have to have at least once in every Javascript file.

So, how do you TB-version-portably load a module?

<datepicker>, datepicker element issues and alternatives

With the datepicker XUL element deprecated there are several options:

Replace with Lightning's custom element (requires extension or its files)
Good example extension: Send Later
https://github.com/cleidigh/ThunderKdB/tree/master/xall/x68/195275-send-later-3
Specifically here:

https://github.com/cleidigh/ThunderKdB/search?q=datepicker+path:xall/x68/195275-send-later-3/src

Alternative datepicker widgets are also possible options:
One decent alternative is flatpickr :
https://flatpickr.js.org

image

I use it in ThunderStats:

https://github.com/cleidigh/ThunderKdB/tree/master/xall/x68/596736-thunderstats

Specifically here:
https://github.com/cleidigh/ThunderKdB/search?q=flatpickr
Or:
https://github.com/cleidigh/ThunderKdB/blob/77ada97f65fc91b7e8ceaf174b83e5c17d90a8e7/xall/x68/596736-thunderstats/src/chrome/content/mzts-settings-nobusinessdayeditor.xhtml

JAR archives, make-jars, XUL preprocessing and updating for TB 78 compatibility

I have a TB-68 extension compatible extension, call it "myext" which I want to update for TB 78 compatibility.

Ever since I first created my extension, I've used a chrome/myext.jar, within the XPI, which is the result of compressing the chrome/content, chrome/locale and chome/skin directories. It's more than just compression: I use what was once a common pair of tools for extensions development:

  • Ian Hickson's XUL preprocessor (preprocessor.pl)
  • A "make-jars" script, unattributed

They work around a file named jar.mn - a JAR manifest - in which you list the intended content of your JAR file. Not all files necessarily go into the JAR; and those who do may undergo renaming, and possible application of the XUL preprocessor. It is also possible to specify additional command-line parameters to the preprocessor, e.g. adding certain preprocessor definitions. Finally, the jar.mn is itself preprocessed by the preprocessor, so your build script can create different JARs for different targets (e.g. Thunderbird vs Seamonkey).

Now, I understand - correct me if I'm wrong - that Thunderbird 78 does not accept JAR archives in XPIs, and that relevant files need to be placed in the XPI without further compression. So, my questions are:

  1. Is it true we should no longer use JARs?
  2. What would you suggest we replace the above build flow with?
  3. Should we place the uncompressed files in their subdirectories under chrome/, to be able to use the same URIs? Or should we use a different placement and reference scheme?

Note: It's true that many of these features may be unnecessary, if the XPI is not intended to maintain any backwards compatibility with pre-78 versions, and one ignores Seamonkey; so, possibly, one doesn't need to replace everything.

Should I import Services.jsm? Is it useful for extension authors?

Michael Kluge (@thundernest) asked:

If I want to do things that the WebExtension APIs do not support, it looks like I need to use ChromeUtils.import and import some magic that does stuff that is not documented anywhere:
...
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

The WebExtensions APIs are well documented, but soon after I tried Google for a documentation of ... what ... could be imported with ChromeUtil.import I had the feeling to enter a dark cave.

So:

  • What "services" are in Services.jsm?
  • Is it useful for extensions to import that module?

How do you get the account name for a given folder?

Suppose I have a folder (i.e. an nsIMsgFolder instance). How do I get its account? I suppose I could parse its URI to get some string ID, but is there a more civilized and idiomatic way to do this?

PS - Asking about regular Thunderbird extension/core code, not WebExtensions.

Should I import ExtensionsCommon.jsm? Is it useful for extension authors?

If I want to do things that the WebExtension APIs do not support, it looks like I need to use ChromeUtils.import and import some magic that does stuff that is not documented anywhere [such as]
var { ExtensionCommon } = ChromeUtils.import("resource://gre/modules/ExtensionCommon.jsm");

The WebExtensions APIs are well documented, but soon after I tried Google for a documentation of what ExtensionCommon.jsm can do for me ... I had the feeling to enter a dark cave.

So:

  • What's provided by ExtensionCommon.jsm?
  • Is it useful for extensions to import that module?

See also #19.

Highlight potential license issues / copying of code

Since this site links to different extensions, all with different licenses, I think there should be some sort of warning/reminder to add-on developers to respect licenses when looking at code.

Straight copying of code/ideas from one license to another could potentially cause issues in future.

How to search for web extension events references

I wanted to search for examples of webextension api events. They are declared as "events":

Unfortunately, I cannot use that as a search string: results are for returned 'events', not for '"events":'.

any workaround?

thanks,
Klaus

display more than 10 search results per page in xpiLib

usually, the pages load while I am doing other stuff.

Just had 10 result pages and find it inconvinient to click through all these. Can there be more serach results per page? That would reduce the waiting time for the web pages.

Add-ons with localised names

This is a enhancement suggestion - and a couple of questions.

I've been lurking in Geckozone, the French forum, for a while to see if anyone had observations about my addons. Someone did, so I created an account - and as a result updated one of them. Having an account I thought I'd post a link to the TB 78 compatible addons:
https://forums.mozfr.org/viewtopic.php?f=4&t=145286

I also noted in that post that my two addons have different names in French~. Which made me wonder:

  • are there other addons that have different names in other locales, so someone looking for the local name wouldn't find it in that list?
  • if so, could there be a localised list - a parameter, or even detect the browser language? Maybe there are so few it's not worth the effort.
  • with the possible exception of Grammalecte I see no addons that have foreign names. Are there none? I thought - but I don't remember why I thought - that there were some Japanese-only addons, or used to be. Does the list include non-EN addons?

~ For info, I gave Limit non-BCC recipients different names in other locales because 'BCC' is not used everywhere: the BCC field in the compose window has local variants: "Copie cachée à" in French, for example. It does cause me a lot more work, though!

xpiLib search broken

I searched for 'attachment column' and got results from all over the world, outside of the repo

test issue

This is a test issue. Please close it.

display more adjacent lines

example: trying to see how others use richlistbox.

I fiind the occurance of richlistbox with xpiLib, but would need to click into all extensions to see how it is used. This becaue it shows the occurrance of the search item, but not the next lines (or not enough of them)

If more neighborng lines were shown, I could judge which extensions to click into, because I could see the code 'inside' the richlistbox, as example.

have comment link on front page

for a moment, I was wondering how to send in comments. Then I remembered the code should have issues.

maybe put a link onto the front page for those who do not know

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.