Différences entre les versions de « Tutorial Plugin : 2 - Fichiers Plugin »

De Wiki Francophone de Maxthon
Aller à la navigation Aller à la recherche
Ligne 1 : Ligne 1 :
__TOC__
Plugins are stored in the Maxthon/Plugin/PLUGINNAME folder.
 
Every plugin has it's own folder.
Plugins are stored in the Maxthon/Plugin/PLUGINNAME folder. Every plugin has it's own folder.
 
There are at least 3 files for every plugin necessary, all stored in the PLUGINNAME folder:
There are at least 3 files for every plugin necessary, all stored in the PLUGINNAME folder:
 
<ul>
* plugin.ini  
<li>plugin.ini
* ICONNAME.ico  
<li>ICONNAME.ico
* FILE.html  
<li>FILE.html
 
</ul>
ICONNAME and FILE need to be defined in the plugin.ini file.
ICONNAME and FILE need to be defined in the plugin.ini file.


=Toolbar Plugins=
= Toolbar Plugins =
 
The plugin.ini file looks like this for a toolbar plugin:
The plugin.ini file looks like this for a toolbar plugin:  
 
'''[General]'''
 
'''Name=Tester''' the pluginname
 
'''Author=neo101''' the author of the plugin
 
'''Version=2.1b''' version number
 
'''ModuleType=SCRIPT''' plugintype. Could be COM,EXE or SCRIPT
 
'''FileName=test.html''' filename of the script that will be run if you press the button
 
'''Comments=Test Plugin''' These comments are visible in Maxthon Options->Plugin->Maxthon Plugin
 
'''Type=M2Plugin_BUTTON''' script type, could be M2Plugin_BUTTON or M2Plugin_SIDEBAR (not case sensitive)
 
'''HotIcon=testhot.ico''' Icon that is visible if the user moves the mouse over the plugin button
 
'''Icon=test.ico''' Icon that is always visible on the plugin toolbar (can be the same as HotIcon)
 
'''[MyIE2Buttons]''' The dropdown menu (not required if you don't need a dropdown menu)
 
'''Count=3''' Number of visible dropdown items
 
'''Name1=Test2''' Name of dropdown item 1
 
'''FileName1=test2.html''' Filename of item 1 (can be the same as FileName under General)
 
'''Name2=Test3''' 
 
'''FileName2=scripts/test3.html''' If the file is in a subdirectory called 'scripts'
 
'''Name3=Settings...''' 
 
'''FileName3=Config_caller.html''' 
 
'''[Settings]''' You can add your own items in the file (useful for settings) (not required)


'''NewWindow=true''' 
<table width="95%" border=0 style="text-align:left">
<tr><th>[General]</th><td>&nbsp;</td></tr>
<tr><th>Name=Tester</th><td>the pluginname</td></tr>
<tr><th>Author=neo101</th><td>the author of the plugin</td></tr>
<tr><th>Version=2.1b</th><td>version number</td></tr>
<tr><th>ModuleType=SCRIPT</th><td>plugintype. Could be COM,EXE or SCRIPT</td></tr>
<tr><th>FileName=test.html</th><td>filename of the script that will be run if you press the button</td></tr>
<tr><th>Comments=Test Plugin</th><td>These comments are visible in Maxthon Options->Plugin->Maxthon Plugin</td></tr>
<tr><th>Type=M2Plugin_BUTTON</th><td>script type, could be M2Plugin_BUTTON or M2Plugin_SIDEBAR (not case sensitive)</td></tr>
<tr><th>HotIcon=testhot.ico</th><td>Icon that is visible if the user moves the mouse over the plugin button</td></tr>
<tr><th>Icon=test.ico</th><td>Icon that is always visible on the plugin toolbar (can be the same as HotIcon)</td></tr>
<tr><th>[MyIE2Buttons]</th><td>The dropdown menu (not required if you don't need a dropdown menu)</td></tr><tr><th>Count=3</th><td>Number of visible dropdown items</td></tr>
<tr><th>Name1=Test2</th><td>Name of dropdown item 1</td></tr>
<tr><th>FileName1=test2.html</th><td> Filename of item 1 (can be the same as FileName under General)</td></tr>
<tr><th>Name2=Test3</th><td>&nbsp;</td></tr>
<tr><th>FileName2=scripts/test3.html</th><td>If the file is in a subdirectory called 'scripts'</td></tr>
<tr><th>Name3=Settings...</th><td> &nbsp;</td></tr>
<tr><th>FileName3=Config_caller.html</th><td>&nbsp;</td></tr>
<tr><th>[Settings]</th><td>You can add your own items in the file (useful for settings) (not required)</td></tr>
<tr><th> NewWindow=true</th><td>&nbsp;</td></tr>
<tr><th> Neo101IsNice=true</th><td>&nbsp;</td></tr>
</table>
Download a basic plugin.ini file for a Toolbar Plugin [http://maxthon.neo101.nl/tutorial/plugin.ini here]


'''Neo101IsNice=true''' 
= Sidebar Plugins =
The plugin.ini file looks like this for a sidebar plugin:


<table width="95%" border=0 style="text-align:left">
<tr><th>[General]</th><td>&nbsp;</td></tr>
<tr><th>Name=Tester</th><td>the pluginname</td></tr>
<tr><th>Author=neo101</th><td>the author of the plugin</td></tr>
<tr><th>Version=2.1b</th><td>version number</td></tr>
<tr><th>ModuleType=SCRIPT</th><td>plugintype. Could be COM,EXE or SCRIPT</td></tr>
<tr><th>FileName=test.html</th><td>filename of the script that will be run if you press the button</td></tr>
<tr><th>Comments=Test Plugin</th><td>These comments are visible in Maxthon Options->Plugin->Maxthon Plugin</td></tr>
<tr><th>Type=M2Plugin_SIDEBAR</th><td>script type, could be M2Plugin_BUTTON or M2Plugin_SIDEBAR (not case sensitive)</td></tr>
<tr><th>HotIcon=testhot.ico</th><td>Icon that is visible if the user moves the mouse over the plugin button</td></tr>
<tr><th>Icon=test.ico</th><td>Icon that is always visible on the plugin toolbar (can be the same as HotIcon)</td></tr>
<tr><th>[Settings]</th><td>You can add your own items in the file (useful for settings) (not required)</td></tr>
<tr><th> NewWindow=true</th><td>&nbsp;</td></tr>
<tr><th> Neo101IsNice=true</th><td>&nbsp;</td></tr>
</table>
Download a basic plugin.ini file for a Sidebar Plugin [http://maxthon.neo101.nl/tutorial/files/plugin.ini here]


Download a basic plugin.ini file for a Toolbar Plugin [http://maxthon.neo101.nl/tutorial/plugin.ini here].
= Config Window =
 
 
=Sidebar Plugins=
 
The plugin.ini file looks like this for a sidebar plugin:
 
[General] 
 
Name=Tester the pluginname
 
Author=neo101 the author of the plugin
 
Version=2.1b version number
 
ModuleType=SCRIPT plugintype. Could be COM,EXE or SCRIPT
 
FileName=test.html filename of the script that will be run if you press the button
 
Comments=Test Plugin These comments are visible in Maxthon Options->Plugin->Maxthon Plugin
 
Type=M2Plugin_SIDEBAR script type, could be M2Plugin_BUTTON or M2Plugin_SIDEBAR (not case sensitive)
 
HotIcon=testhot.ico Icon that is visible if the user moves the mouse over the plugin button
 
Icon=test.ico Icon that is always visible on the plugin toolbar (can be the same as HotIcon)
 
[Settings] You can add your own items in the file (useful for settings) (not required)
 
NewWindow=true 
 
Neo101IsNice=true 
 
 
Download a basic plugin.ini file for a Sidebar Plugin [http://maxthon.neo101.nl/tutorial/files/plugin.ini here].
 
=Config Window=
 
Since Maxthon v1.1.090 [2004-12-09] script plugins can use the configuration window.
Since Maxthon v1.1.090 [2004-12-09] script plugins can use the configuration window.
Example:
Example:


[[image:chat.png]]
[image:plugtut5.png]


For Toolbar Plugins: You can call the window if you add a dropdown item in the plugin.ini file that links to a file with this code:  
For Toolbar Plugins: You can call the window if you add a dropdown item in the plugin.ini file that links to a file with this code:  
   
 
  <script language="JavaScript">
  &lt;script language="JavaScript"&gt;<br> external.max_showConfig(%max_security_id,'PLUGINNAME')<br> &lt;/script&gt;
  external.max_showConfig(%max_security_id,'PLUGINNAME')
  </script>


PLUGINNAME is the name of your plugin.
PLUGINNAME is the name of your plugin.
For Sidebar Plugins: You can call the window if you add this code to your plugin:


For Sidebar Plugins: You can call the window if you add this code to your plugin:
 
   
  &lt;a title="Show the configuration window" <br>  href="javascript:external.max_showConfig(max_security_id,'PLUGINNAME')"&gt;<br>   Config&lt;/a&gt;
  <a title="Show the configuration window"  
    href="javascript:external.max_showConfig(max_security_id,'PLUGINNAME')">
    Config</a>


NOTE: You can also access the configuration window if you open Maxthon Options->Plugin->Maxthon Plugin and press the 'config' button.
NOTE: You can also access the configuration window if you open Maxthon Options->Plugin->Maxthon Plugin and press the 'config' button.
Maxthon will try to open config.html from your pluginfolder.
Maxthon will try to open config.html from your pluginfolder.
A 'max.src' will be created with the security_id (see part 3 for more info about the security_id).
A 'max.src' will be created with the security_id (see part 3 for more info about the security_id).
The config.html should be a normal HTML page. You can change the height/width of the window with this code:


The config.html should be a normal HTML page. You can change the height/width of the window with this code:
&lt;meta name=&quot;Dialog-Width&quot; content=&quot;110&quot;&gt;<br>  &lt;meta name=&quot;Dialog-Height&quot; content=&quot;120&quot;&gt;<br>
   
   
    <meta name="Dialog-Width" content="110">
This code should be inside the &lt;head&gt; element.
    <meta name="Dialog-Height" content="120">
This code should be inside the element.
 
Download a basic config.html file [http://maxthon.neo101.nl/tutorial/files/config.html here] (Right Click->Save Target As...)
Download a basic config.html file [http://maxthon.neo101.nl/tutorial/files/config.html here] (Right Click->Save Target As...)


=Install=
= Install =
 
If you put the plugin.ini file from your plugin in a directory in the maxthon/plugin folder and restart Maxthon, then Maxthon will automatically recognize your plugin.
If you put the plugin.ini file from your plugin in a directory in the maxthon/plugin folder and restart Maxthon, then Maxthon will automatically recognize your plugin.
The pluginname and versionnumber are written into the Maxthon/config/plugins.ini file if you close Maxthon.
The pluginname and versionnumber are written into the Maxthon/config/plugins.ini file if you close Maxthon.
Ligne 136 : Ligne 88 :
If the versionnumber, author, plugin type or pluginname changes than you will see the following dialog:
If the versionnumber, author, plugin type or pluginname changes than you will see the following dialog:


[[image:plugtut4.png]]
[image:plugtut4.png]
 
This does not happen if you modify any other file/item.
 
 
<b>NOTE:</b> changes to the name, versionnumber, icon, filenames and the dropdown menu (for toolbar plugins) are only effective after a restart of Maxthon.
Changes to the content of plugin files are effective immediately.Sidebar plugin need to be refreshed for the changes to take effect (right click->refresh).


This does not happen if you modify any other file/item.


NOTE: changes to the name, versionnumber, icon, filenames and the dropdown menu (for toolbar plugins) are only effective after a restart of Maxthon.
<center>[[Tutorial Plugin : 3 - Commandes de Maxthon|Partie 3: Commandes de Maxthon]]</center>
Changes to the content of plugin files are effective immediately.
Sidebar plugin need to be refreshed for the changes to take effect (right click->refresh).

Version du 2 septembre 2005 à 05:38

Plugins are stored in the Maxthon/Plugin/PLUGINNAME folder. Every plugin has it's own folder. There are at least 3 files for every plugin necessary, all stored in the PLUGINNAME folder:

  • plugin.ini
  • ICONNAME.ico
  • FILE.html

ICONNAME and FILE need to be defined in the plugin.ini file.

Toolbar Plugins

The plugin.ini file looks like this for a toolbar plugin:

[General] 
Name=Testerthe pluginname
Author=neo101the author of the plugin
Version=2.1bversion number
ModuleType=SCRIPTplugintype. Could be COM,EXE or SCRIPT
FileName=test.htmlfilename of the script that will be run if you press the button
Comments=Test PluginThese comments are visible in Maxthon Options->Plugin->Maxthon Plugin
Type=M2Plugin_BUTTONscript type, could be M2Plugin_BUTTON or M2Plugin_SIDEBAR (not case sensitive)
HotIcon=testhot.icoIcon that is visible if the user moves the mouse over the plugin button
Icon=test.icoIcon that is always visible on the plugin toolbar (can be the same as HotIcon)
[MyIE2Buttons]The dropdown menu (not required if you don't need a dropdown menu)
Count=3Number of visible dropdown items
Name1=Test2Name of dropdown item 1
FileName1=test2.html Filename of item 1 (can be the same as FileName under General)
Name2=Test3 
FileName2=scripts/test3.htmlIf the file is in a subdirectory called 'scripts'
Name3=Settings...  
FileName3=Config_caller.html 
[Settings]You can add your own items in the file (useful for settings) (not required)
NewWindow=true 
Neo101IsNice=true 

Download a basic plugin.ini file for a Toolbar Plugin here

Sidebar Plugins

The plugin.ini file looks like this for a sidebar plugin:

[General] 
Name=Testerthe pluginname
Author=neo101the author of the plugin
Version=2.1bversion number
ModuleType=SCRIPTplugintype. Could be COM,EXE or SCRIPT
FileName=test.htmlfilename of the script that will be run if you press the button
Comments=Test PluginThese comments are visible in Maxthon Options->Plugin->Maxthon Plugin
Type=M2Plugin_SIDEBARscript type, could be M2Plugin_BUTTON or M2Plugin_SIDEBAR (not case sensitive)
HotIcon=testhot.icoIcon that is visible if the user moves the mouse over the plugin button
Icon=test.icoIcon that is always visible on the plugin toolbar (can be the same as HotIcon)
[Settings]You can add your own items in the file (useful for settings) (not required)
NewWindow=true 
Neo101IsNice=true 

Download a basic plugin.ini file for a Sidebar Plugin here

Config Window

Since Maxthon v1.1.090 [2004-12-09] script plugins can use the configuration window. Example:

[image:plugtut5.png]

For Toolbar Plugins: You can call the window if you add a dropdown item in the plugin.ini file that links to a file with this code:

<script language="JavaScript">
external.max_showConfig(%max_security_id,'PLUGINNAME')
</script>

PLUGINNAME is the name of your plugin. For Sidebar Plugins: You can call the window if you add this code to your plugin:


<a title="Show the configuration window" 
href="javascript:external.max_showConfig(max_security_id,'PLUGINNAME')">
Config</a>

NOTE: You can also access the configuration window if you open Maxthon Options->Plugin->Maxthon Plugin and press the 'config' button. Maxthon will try to open config.html from your pluginfolder. A 'max.src' will be created with the security_id (see part 3 for more info about the security_id). The config.html should be a normal HTML page. You can change the height/width of the window with this code:

<meta name="Dialog-Width" content="110">
<meta name="Dialog-Height" content="120">

This code should be inside the <head> element. Download a basic config.html file here (Right Click->Save Target As...)

Install

If you put the plugin.ini file from your plugin in a directory in the maxthon/plugin folder and restart Maxthon, then Maxthon will automatically recognize your plugin. The pluginname and versionnumber are written into the Maxthon/config/plugins.ini file if you close Maxthon. Every time Maxthon starts it will check the Maxthon/config/plugins.ini file and check if the versionnumber has changed and if the plugin still exists. If the versionnumber, author, plugin type or pluginname changes than you will see the following dialog:

[image:plugtut4.png]

This does not happen if you modify any other file/item.


NOTE: changes to the name, versionnumber, icon, filenames and the dropdown menu (for toolbar plugins) are only effective after a restart of Maxthon. Changes to the content of plugin files are effective immediately.Sidebar plugin need to be refreshed for the changes to take effect (right click->refresh).


Partie 3: Commandes de Maxthon