smilefly

[SDK] Maxthon Extension Development Guide & Package Tool | 2015/05/21

28 posts in this topic

Posted (edited)

Here we offer Maxthon Extension Development Guide and Package Tool (for Maxthon3 and Maxthon Cloud Browser).

The English SDK is here

Update date:May 21th, 2015
SDK runtime version:1.0.6
SDK document version:1.2.7


Mx-Extension-SDK.zip

Update:

1.2.7:

update stopOnClose
1.2.6:
add contextmenu api
add resize api
add toolbar support
1.2.3:
Update the description of def.json
1.2.2:
Describe the objects that runtime.post support to post
1.2.1:
The included JS File's format must be UTF8 with BOM



Maxthon Extension/Skin Package Tool


Update date:Mar 13th, 2013
version:1.0.7




Instructions:
Pack: Drag the extension/skin directory onto the MxPacker icon(no need to run it) to make a package.
Unpack: Drag a package onto the MxPacker/skin icon(no need to run it) to unpack it.

or

Double click the MxPacker icon to run it, and pack or unpack a package with its GUI interface.

Note: Please rename the packed file's extenstion to .mxskin, if it is a skin file.



examples:

These are from Maxthon Chinese BBS. So you may just take a look at it if your like.
Douban Radio:
Baidu Ting:


Douban Radio and Baidu Ting are two popular apps in China which may offer you songs randomly. They can remember your taste and recommend the styles you like. Hope you enjoy.

Edited by smilefly
Links added
2 people like this

Share this post


Link to post
Share on other sites

Also the mxpacker is at 1.0.0.5, not 1.0.0.4.

Share this post


Link to post
Share on other sites

mx packer is at 1.0.0.7 over at the chinese board

Packer.zip

Share this post


Link to post
Share on other sites

hrm ok thanks. didn't see that. THANKS.

Haven't really read the Chinese site since the remake sadly...not sure why.

Share this post


Link to post
Share on other sites

its not an easy place at best - dont know that thats the latest - just its later than anything i had - dont know where they get them from and why we cannot have access or at least somebody post them here

Share this post


Link to post
Share on other sites

Maxthon Cloud Browser (Maxthon4) does not support toolbar entrypoint.

How unfortunate. Would still like to know the reasoning behind this. Seems like the MX team think the Sidebar is a better option, but I just don't see the benefit.

Share this post


Link to post
Share on other sites

7twenty replied at 2013-5-10 03:20 back.gif

How unfortunate. Would still like to know the reasoning behind this. Seems like the MX team think ...

what do you want to do - i have noads and skynotes running as separate entries - it was initially necessary to add them to the toolbar extension file - either something has changed or i did it wrong the first time - they are now just as downloaded

have not posted my method but can if you are interested

Share this post


Link to post
Share on other sites

7twenty replied at 2013-5-10 03:20 back.gif

How unfortunate. Would still like to know the reasoning behind this. Seems like the MX team think ...

Agreed, menus from the toolbar on Mx3 versions, particularly, don't work as a result.

And not to be redundant, but *still* wondering why there are TWO threads for the extension SDK, one by myself and this one by Smilefly. 1702

http://bbs.maxthon.com/forum.php?mod=redirect&goto=findpost&ptid=801&pid=3445&fromuid=11018970

post-11018970-14315106916107_thumb.png

Share this post


Link to post
Share on other sites

tony. replied at 2013-5-10 03:38 back.gif

what do you want to do - i have noads and skynotes running as separate entries - it was initially ...

Now that i've finally decided to move to MX4, I have started modding the skin to my liking to a degree. Still working on getting the avatar back on the left.

But the problem is getting Favs on toolbar back on the quicktools bar. I managed to get it back a while ago after screwing around with the toolbar extension file IIRC.

Although the bigger problem is that this particular extension gets broken by something so won't display properly - even in the sidebar, even though it calls the same Favourites panel as the sidebar addon. I've tried playing around with all the options in the addon file to no avail.

Will keep on poking around.

And please post your method.

Share this post


Link to post
Share on other sites

the extensions that are in the toolbar now are split into 2 sections - 2 of them are part of the main code - the others are in toolbar.mxaddon - thats in the public dir on c/users within the maxthon dir - for reasons i dont know the guid within an addon will not work so you need one out of the toolbar file

so unpack that and copy one of the guid numbers - then unpack the extension you want in the toobar and overwrite the guid number - make sure its set to show in the toolbar lower down in the code and repack it then put that file in maxthon/users/your email/addons

that should then show in the top toolbar - not all i have tried worked and it seems to upset the original toolbar file in that can leave blank icons or duplicate icons

for example - i used the guid number from clear cache for noads - when i repacked everything i had 2 noads icone - one opened noads the other clear cache - i cannot find a way round that so i just deleted the code for clear cache from within the toolbar file

hope that makes sense

Share this post


Link to post
Share on other sites

Thanks for that. Adds fine, and as far as I can tell seems to be working as intended.

Only thing left is getting rid of the Quicktools dropdown...

EDIT: got rid of that.. only thing left is the avatar menu. :-D

Also if one of the mod's thinks this is slightly off topic for the thread (even I think it might me) let me know and i'll start another related to my stuffing around.

Share this post


Link to post
Share on other sites

what are you trying to do with avatar menu

Share this post


Link to post
Share on other sites

we need >> anonymoX 2.4.6 << extension/ add-on, on maxthon, it works great on my other browsers.

Share this post


Link to post
Share on other sites

Thanks for letting us know. The Maxthon team have already been advised of this a few days ago. Obviously not fixed yet. Hopefully it won't be too much longer.

Share this post


Link to post
Share on other sites

How to use ContextMenu API? I can't even find any Maxthon extension with menu items in the context menus. I need an example

Share this post


Link to post
Share on other sites
2 hours ago, user12 said:

How to use ContextMenu API? I can't even find any Maxthon extension with menu items in the context menus. I need an example

I believe support for this was dropped in MX4.9

I have an extension that does have a context menu option in MX4.4, but the same extension doesn't show the context menu option in MX4.9

Unfortunately they have a knack of not updating their documents to show changes frequently enough. And there's next to zero support from dev's or the few in the know when it comes to extension development support.

Wish I could offer something more...

Share this post


Link to post
Share on other sites

Yeah, I was thinking that it just doesn't work anymore. So I guess it also will not be working in MX5?

Share this post


Link to post
Share on other sites
12 hours ago, user12 said:

How to use ContextMenu API? I can't even find any Maxthon extension with menu items in the context menus. I need an example

Do you talk about "entryPoints": ["contextMenu"] or some one else?

1 person likes this

Share this post


Link to post
Share on other sites

Posted (edited)

35 minutes ago, A.S. said:

Do you talk about "entryPoints": ["contextMenu"] or some one else?

Yeah, It works in 4.4

I've already tried:

    "actions": [
        {
            "type": "script",
            "entryPoints": ["contextMenu"],
            "js": ["cmenu.js"],
            "contexts": ["page", "link", "selection", "textbox", "image", "video", "audio"]
        }
    ]

In 4.9 it doesn't work.

But even if it works in 4.4, ContextMenu API is really bad in Maxhon - I can't create menu items dynamically (because we declare it in def.json), I can't set name for item menu (it just displays name of extension), and how to detect for e.g. link click event when item menu is clicked from the context menu, get url of this link and use it for something in cmenu.js? So what we can do with [link], [selection]?

In Chrome I can use something like this (in background.js):

chrome.contextMenus.create({
            title: "name of item"
            id: 'linkClick',
            contexts: ['link']
});

chrome.contextMenus.onClicked.addListener(function(info, tab) {
    if (info.menuItemId === "linkClick")
        // info.linkUrl - use url for something...
});

Also include/exclude attributes doesn't work for ContextMenu - item menu will be displayed in the context menu and script will be executed on every page

Edited by user12

Share this post


Link to post
Share on other sites