These two days, I am a little interested in Maxthon plug-ins. I started my research and found these materials on the Internet.
Let's take a closer look at some of the applications that can be done... you are welcome to talk with me (maybe I can't talk about it, because I am still very fond of it ).
Proud game plug-in development reference (http://bbs.maxthon.cn/forumdisplay.php? FID = 48)
I. Basic Introduction
I. Plug-in type
The maxcompute plug-in type is defined by both the file type and the interface element type.
(1) Plug-In File Types
Including script, HTML, COM, and exe (executable files)
1. Script
(1). It can be a button type. Execute the script when you click the button.
Scripts can be written in scripting languages supported by IE, such as JavaScript and VBScript.
In addition, Maxthon 2.0 provides additional mscript script execution methods to implement more powerful plug-in functions.
Example
Example
Wlgjx.com
The script file must be written in the following format:
Script file must be written in the following format:
Sample I-1-(1) _ 1 script file
Wlgjx
Reference
<Script language = "JavaScript">
Alert (document. lastmodified );
</SCRIPT>
Any valid language supported by IE can be used here.
The 'language 'could be any valid language that IE supports.
(2). It can also be a sidebar type. The HTML file specified by the plug-in is displayed in the sidebar. Wlgjx.com
HTML files can be written in HTML format supported by IE.
2. html
It is a new plug-in type added by Maxthon 2.0. It is of the same nature as the plug-in the script sidebar. The plug-in the script sidebar is displayed in the sidebar, while the HTML plug-in is displayed in the toolbar as a button.
3. com
You can use any language supported by mscom, such as C ++, C #, Visual Basic, and Delphi.
By default, Maxthon supports the button type, toolbar type, and sidebar type com plug-in.
In addition, you can add the plug-in display method to be used for the com plug-in, such as the menu or pop-up window.
The COM object must implement the imyieclient interface. For more information, see imyie. h In the SDK.
COM object must implement imyieclient interface. Please refer to imyie. h
4. exe
Any executable file can be displayed in Maxthon as a toolbar button. Maxthon can provide parameters when executing the EXE plug-in, such as the page address and the Maxthon window handle.
Network Toolbox
Any Win32 executable file can be used as a plug-in. Maxthon will pass various parameters according to different purposes, but there is no guarantee that the parameters will be passed in order.
Any Win32 EXE file cocould be used as plugin. Maxthon will send different parameters under different circumstance.
Common parameters include:
General parameter:
A. "-H = handle": handle is the hwnd handle of the Maxthon main window, which is a 10-digit number.
A. "-H = handle": handle is the WND handle of the Maxthon Main Window, decimalist.
(2) Interface Element Types
Including button, sidebar, toolbar, and other)
1. Button
The plug-in will add a button in the plug-in bar. When you click the button, the specified operations will be executed, including the specified script (script plug-in), Program (exe plug-in), and DLL (COM type plug-in. You can choose to add a drop-down menu on the plug-in button of the script and exe types.
2. Sidebar
Wlgjx.com
The plug-in will add a button in the sidebar, and add a command in the main course> View> sidebar. During execution, the sidebar and the HTML page specified by the plug-in will be displayed.
3. Toolbar
The plug-in adds a toolbar. You can choose whether to display the new toolbar on the main menu> View> toolbar.
4. Other
There is no fixed display interface for the plug-in. The plug-in can change the interface as needed, such as changing the menu and adding buttons.
(3) Support for the aoyou plug-in type
Relationship between plug-in file types and Interface Element Types
Table I-1-(3) _ 1
Code
Type ______ button ___ sidebar ___ toolbar ___ other
Script _________ supported _____ supported
HTML (only 2.x) ___ supported
EXE ___________ supported
COM (only 1.x) ____ supported _____ supported
2. Plug-in files
The maxcompute plug-in file contains the 、in.ini?runtime file, as shown in the figure "config.html ".
(1) plugin. ini
Required
Description
Define the attributes of the plug-in
Example
Example I-2-(1) _ 1 all
Reference
[General]
; Required. define the main attributes of the plug-in.
Name =
; Plug-in name
Author =
; Author name
Version =
; Version number
Moduletype =
; Can be script, HTML, com or EXE
Filename =
; Can be HTML files (scripts and HTML plug-ins), DLL files (COM plug-ins), or EXE files (exe plug-ins)
Comments =
Wlgjx
Type =
; It can be m2plugin_button, m2plugin_sidebar, m2plugin_toolbar, or m2plugin_other.
Idealsize =
; Specify the size of the plug-in displayed on the interface, such as "120 20" (width height, applicable to HTML plug-ins)
Idealsizevertical =
; Optional, specify the size of the plug-in interface displayed when the toolbar is placed vertically, such as "120 20" (width height, applicable to HTML plug-ins)
Icon =
; Icons displayed in buttons or sidebar plug-ins (applicable to buttons and sidebar plug-ins)
Hoticon =
The icon displayed when you move the cursor over the plug-in button (applicable to button plug-ins)
CLSID =
; CLSID of the COM plug-in (applicable to the com plug-in)
[Myie2buttons]
(Optional) drop-down menu for defining button-type plug-ins. It is applicable to scripts and exe-type plug-ins.
Count =
; Number of projects in the plug-in drop-down menu
Name1 =
; The name of the first drop-down menu item, and so on
Filename1 =
; Provide a file of the code to be executed in the first drop-down menu item, and so on
Example I-2-(1) _ 2.1 script type button
Reference
[General] wlgjx.com
Name = lastmodified
Author = bloodchen
Version = 1.0
Moduletype = script
Filenameappslastmodified.htm
Comments = see Last modified Date of current page
Type = m2plugin_button
Hoticon = hot. ICO
Toolkit wlgjx.com
Icon = cold. ICO
Example I-2-(1) _ 2.2 Script Type sidebar
Reference
[General]
Name = calculator ++ 1.2
Author = SiC
Version = 1.2
Moduletype = script
Wlgjx.com
Filename=calculator.htm
Comments = scientific programmable calculator.
Type = m2plugin_sidebar
Hoticon = CPP. ICO
Icon = CPP. ICO
Example: I-2-(1) _ 3 EXE type
Reference
[General] copying to wlgjx.com
Name = exebutton
Author = bloodchen
Version = 1.0
Moduletype = exe
Filename=abc.exe
Comments = EXE type button
Type = m2plugin_button
Icon = P. ICO
Wlgjx.com
Example I-2-(1) _ 4 com type
Reference
[General]
Name = combutton
Author = bloodchen
Version = 1.0
Moduletype = com
Filename = combutton. dll
Wlgjx.com
CLSID = {96e78121-9ff2-466d-b6cd-4038cac1bb79}
Comments = com type 'button'
Type = m2plugin_button
Hoticon = hot. ICO
Icon = cold. ICO
(2) run the file
Required
Description
Operations to be performed or displayed by the plug-in
Note that it must be a file type supported by the aoyou plug-in.
(3) icons
Applicable to buttons and sidebar plug-ins. You can use the built-in icons of COM or EXE plug-ins.
Note that the icon file must be in ICO format
(4)、config.html
Optional
Window for setting scripts and HTML plug-ins
Ii. Language Reference
I. Attributes
(1) Extend attributes
1. max_security_id
(1). Script Type
You can write "Var security_id = % max_security_id" in your script file, and then you can use security_id in your script file.
(2). HTML and script sidebar
Maxthon will create a "Max. SRC "file is in the folder of the corresponding plug-in, which contains" max_security_id = ID ". you can include it in your HTML file to get the ID. network Toolbox
2. max_language_id
You can obtain the language selected by the user.
Description
Remarks
This attribute returns the language code of the current UI.
This property will return current language ID of Maxthon UI.
(1). 1.x language code
Table II-1-(1) _ 1.1 1.x language code
Code
Code _ name
English 0000
0001 Simplified Chinese
0005 Chinese Traditional Chinese traditional
Network Toolbox
(2). 2.x language code
Table II-1-(1) _ 1.2 2.x language code
Reference
Code ____ name
0x0409 English
0x0804 Simplified Chinese
0x0404 Chinese Traditional Chinese traditional
The language code can be found here
Language ID can be found at here
Example
Example toolkit wlgjx.com
Example II-1-(1) _ 1 get the language code
Reference
Alert ('language id = '+ External. max_language_id );
3. cur_sel and current_tab
Returns the serial number (integer) of the current active tag ).
Return the number of current active tab as a integer.
If no tag is opened, null is returned.
Null will be returned if there is no tab opened.
Copy to wlgjx.com
Remarks
In aoyou 2.x, use current_tab to replace the cur_sel used in aoyou 1.x because the latter name is literally hard to understand.
Current_tab is introduced in Maxthon 2.0 as a replacement of cur_sel because the old property name is too obscure to understand.
Example
Example
Example II-1-(1) _ 2.1 1. x get the serial number of the activation tag
Reference
Alert ('current tab Index = '+ External. cur_sel );
Wlgjx.com
Example II-1-(1) _ 2.2 2. x get the serial number of the activation tag
Reference
Alert ('current tab Index = '+ External. current_tab );
(Kukuan: This is doubtful. External. cur_sel is still available in 2.x, while external. current_tab is undefined)
To kukuan: I don't know if I will change it if I copy it from the official API -__-
4. tab_count
The total number of opened tags (integers) is returned ).
This property will return total number of tabs as a integer.
Example
Wlgjx.com
Example
Sample II-1-(1) _ 3 get the total number of tags
Reference
Alert ('tabs COUNT = '+ External. tab_count );
Ii. Method
(1) General Method
1. AddFavorite
This method will ask you if you want to add a URL to your favorites. You can use the title to name the link.
AddFavorite (URL [, title])
Parameters
Parameters
URL
Required. String, page address
Required. String, the URL to add.
Title network toolbox
Optional. String, page title
Optional. String, the title of the URL.
Example
Example
Example II-2-(1) _ 1.1 add URL to favorites
Reference
External. AddFavorite ("http://www.maxthon.com ");
Example II-2-(1) _ 1.2 add web site and title to favorites common software tutorial wlgjx.com
Reference
External. AddFavorite ("http://www.maxthon.com", "Maxthon official site ");
2. addproxy
Add a proxy to the Proxy Server list of Maxthon
(1). 1.x
Addproxy (name, address, speed, type)
Parameters
Toolkit wlgjx.com
Parameters
Name
Required. Proxy name
Required. The display name of proxy.
Address
Required. Proxy address: <address >:< port>
Required. The IP address or domain name of proxy.
Speed
Required. Agent speed: 0 is invalid, 1 is slow, 2 is slow, 3 is normal, 4 is fast, 5 is fast
Required.
Type
Required. Proxy type: 1 HTTP and FTP Proxy, 0 other proxy types
Required.
Example
Example
Network Toolbox
Example II-2-(1) _ 2.1 Add proxy to Maxthon 1.x
Reference
External. addproxy ("my proxy", "192.168.1.0: 8080", 3, 0 );
(2). 2.x
Addproxy (name, address, type) network toolbox
Parameters
Parameters
Name
Required. Proxy name
Required. The display name of proxy.
Address
Required. Proxy address: <address >:< port>
Required. The IP address or domain name of proxy.
Type
Required. Proxy type: 0 = HTTP proxy, 1 = socks 4A proxy, 2 = Socks 5 proxy
Required. A number indicates the speed rating of proxy. 0 = HTTP proxy, 1 = socks 4A proxy, 2 = Socks 5 proxy
Example
Example
Network Toolbox
Example II-2-(1) _ 2.2 add proxy to Maxthon 2.x
Reference
External. addproxy ("my proxy", "192.168.1.0: 8080", 0 );
3. addfilter
Add filter rules to the filter list of Maxthon.
Addfilter (url_mask [, type]) helps wlgjx.com
Parameters
Parameters
Url_mask
Required. String or regular expression. Filter address matching rules
Required. String. Address Mask to match blocked addresses. supports regular expression.
Type
Optional. Integer. Filter Type
Optional. Integer. A number indicates which Filter list to add.
(A). 1.x
0 = webpage content filtering, 1 = pop-up window Filtering
0 = content filter, 1 = popup Filter
(B). 2.x
0 = pop-up window filtering, 1 = webpage content filtering
Wlgjx.com
0 = popup filter, 1 = Content Filter
Example
Example
Example II-2-(1) _ 3 Add filter to Maxthon
Reference
External. addfilter ("*/AD/*", 0 );
4. m2_run_cmd
Wlgjx.com
This function will call a Maxthon command.
This function will call a Maxthon's command with the ID.
M2_run_cmd (security_id, command_id)
Parameters
Parameters
Security_id
Required. Ao you Security ID
Required. Maxthon's Security ID.
Command_id
Required. Integer. Ao you command no.
Required. Integer. The internal command ID of Maxthon.
Description
Remarks
The command numbers can be found in the language file language. ini. wlgjx
The ID of every command cocould be found in the language file.
Example
Example
Sample II-2-(1) _ 4 Create a blank page
Open a blank page
Reference
External. m2_run_cmd (% max_security_id, 32772 );
5. m2_search_text
Returns the text in the Maxthon search bar.
Copied to wlgjx.com
This function will return the text in Maxthon's search box as a string.
M2_search_text (security_id)
Parameters
Parameters
Security_id
Required. Ao you Security ID
Required. Maxthon's Security ID.
Example
Example
Example: II-2-(1) _ 5 get search keywords
Reference
Alert ('search text = '+ External. m2_search_text (% max_security_id ));
Wlgjx.com
6. m2_plugin_folder
This function returns the local path of the plug-in folder.
This function will return the local path of the plugin.
M2_plugin_folder (security_id, plugin_name)
Parameters
Parameters
Security_id
Required. Ao you Security ID
Required. Maxthon's Security ID.
Plugin_name
Required. Plug-in name, that is, the name value of the general part in plugin. ini.
Required. The name of the plugin as defined in plugin. ini.
Requirements
Requirements copied to wlgjx.com
Maxthon version 1.2 +
Example
Example
Example II-2-(1) _ 6 get the folder path of viewpage
Reference
Alert ("plugin Path =" + External. m2_plugin_folder (% max_security_id, "viewpage "));