How do I make my add-on PM compatible?

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

SmolBig

How do I make my add-on PM compatible?

Unread post by SmolBig » 2019-01-13, 17:11

Hello,

I wrote a simple Firefox plugin some time back that allows me to r-click a hyperlink and select a new entry in the context menu, the result of which is to send a POST containing the link to another device on my network, which extracts the link and does some work based on what it is.

I tried to add this add-on to PM thinking that it wouldn't be a problem since it's such a simple plugin, but I get the error message, "Pale Moon does not support webextensions."

I'm a coder, but I'm not really hip on web dev, and I don't even really remember what references I used to write this add-on. Basically I want to make this thing PM compatible. It's really just a very short script wrapped in a plugin:

Code: Select all

function SendLink(link) {
  var oReq = new XMLHttpRequest();
  oReq.open("POST", "http://192.168.1.123:4321");
  var blob = new Blob([link], {type: 'text/plain'});
  oReq.send(blob);
}

browser.menus.create({
  id: "sendToTrio",
  title: "Send to Trio",
  contexts: ["link"]
});

browser.menus.onClicked.addListener((info, tab) => {
  if(info.menuItemId == "sendToTrio") {
    SendLink(info.linkUrl);
  }
});
Could anyone give me a reference or a short explanation of what I need to do?

Thank you in advance for any help or advice.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35602
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: How do I make my add-on PM compatible?

Unread post by Moonchild » 2019-01-13, 19:42

Pale Moon doesn't support WebExtensions. For it to work on Pale Moon you'll have to make it into a XUL extension. That essentially means using different technology to interact with the browser.

Given a bit of time, I'm sure some of the community members here can help you make what you need.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

JustOff

Re: How do I make my add-on PM compatible?

Unread post by JustOff » 2019-01-14, 16:13

Here is the simplest XUL extension that performs the required task.
Attachments
sendToTrio-1.0.0.xpi
(1.59 KiB) Downloaded 33 times

SmolBig

Re: How do I make my add-on PM compatible?

Unread post by SmolBig » 2019-01-14, 18:51

Thank you! I'll take a look.

--Edit--

Yes, that works. I was able to wiggle the icon and other stuff into it with a little help from MDN.

Thanks again!

Locked