Différences entre les versions de « Tutorial Plugin : 6 - Liste des commandes »

De Wiki Francophone de Maxthon
Aller à la navigation Aller à la recherche
Ligne 1 : Ligne 1 :
___TOC____
This is a short summary of all important Maxthon commands and links.
This is a short summary of all important Maxthon commands and links.
You can [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark] this page so you can quickly lookup this information.
You can [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark] this page so you can quickly lookup this information.
Ligne 5 : Ligne 7 :
Vous pouvez mettre ajouter cette page à vos favoris [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark].<br> Ainsi vous accéderez plus rapidement à ces informations.
Vous pouvez mettre ajouter cette page à vos favoris [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark].<br> Ainsi vous accéderez plus rapidement à ces informations.


 
= Commandes de Maxthon =
<b>Security_id:</b>
<b>Security_id:</b>
For Toolbar Plugins: %max_security_id
For Toolbar Plugins: %max_security_id
For Sidebar Plugins: Inside max.src, called max_security_id
For Sidebar Plugins: Inside max.src, called max_security_id


<b>Security_id:</b><br>
<b>Security_id :</b><br>
*Pour les plugins de barre d'outils : %max_security_id
*Pour les plugins de barre d'outils : %max_security_id
*Pour les plugins de barre latérale : Inside max.src, called max_security_id
*Pour les plugins de barre latérale : Inside max.src, called max_security_id
Ligne 22 : Ligne 24 :


<ol>
<ol>
<li><B>readFile( security_id, plugin_name, file_name)</B>
<li>
<B>readFile( security_id, plugin_name, file_name)</B>


Read a text file.
Read a text file.<br> Lire un fichier texte.
<pre>var text = external.readFile(%max_security_id,
<pre>var text = external.readFile(%max_security_id,
&quot;Test plugin&quot;,&quot;export.txt&quot;)</pre>
&quot;Test plugin&quot;,&quot;export.txt&quot;)</pre>
   </li>
   </li>
   <li><B>writeFile( security_id, plugin_name, file_name, content )</B>
   <li>
<B>writeFile( security_id, plugin_name, file_name, content )</B>


Write a text file.
Write a text file.<br> Ecrire un fihcier texte.
<pre>external.writeFile(%max_security_id,
<pre>external.writeFile(%max_security_id,
&quot;Test plugin&quot;,&quot;export.txt&quot;, &quot;Some Data.&quot;)</pre>
&quot;Test plugin&quot;,&quot;export.txt&quot;, &quot;Some Data.&quot;)</pre>
   </li>
   </li>
<li><B>m2_readIni( security_id, plugin_name , file_name , section_name , key , default_value)</B>
<li>
<B>m2_readIni( security_id, plugin_name , file_name , section_name , key , default_value)</B>


Read an ini-file
Read an ini-file. <br>Lire un fichier 'ini'.
<pre>path = external.m2_readIni(%max_security_id,
<pre>path = external.m2_readIni(%max_security_id,
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;0&quot;)</pre>
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;0&quot;)</pre>
   </li>
   </li>
   <li><B>m2_writeIni( security_id , plugin_name , file_name , section_name , key , value )</B>
   <li>
<B>m2_writeIni( security_id , plugin_name , file_name , section_name , key , value )</B>


Write an ini-file
Write an ini-file. <br>Erire dans un fixhier 'ini'.
<pre>external.m2_writeIni(%max_security_id,
<pre>external.m2_writeIni(%max_security_id,
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;true&quot;)</pre>
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;true&quot;)</pre>
   </li>
   </li>
   <li><B>tab_count</B>
   <li>
<B>tab_count</B>


Total number of tabs.
Total number of tabs.<br>Nombre total d'onglets.
<pre>var total_tab = external.tab_count</pre>
<pre>var total_tab = external.tab_count</pre>
   </li>
   </li>
   <li><B>activate_tab( security_id , index )</B>
   <li>
<B>activate_tab( security_id , index )</B>


Activate tab number (starting from zero).
Activate tab number (starting from zero).
Ligne 58 : Ligne 66 :
   <li><B>close_tab( security_id , index )</B>
   <li><B>close_tab( security_id , index )</B>


Close a tab
Close a tab. <br>Fermer un onglet.
<pre>external.close_tab(%max_security_id,2)</pre>
<pre>external.close_tab(%max_security_id,2)</pre>
   </li>
   </li>
   <li><B>get_tab( security_id , index )</B>
   <li>
<B>get_tab( security_id , index )</B>


Get the webpage object from tab 'index'
Get the webpage object from tab 'index'
<pre>var doc = external.get_tab(%max_security_id,2).document</pre>
<pre>var doc = external.get_tab(%max_security_id,2).document</pre>
   </li>
   </li>
   <li><B> cur_sel</B>
   <li>
<B> cur_sel</B>


The number of the active tab.
The number of the active tab.<br>Le numéro de l'onglet actif.
<pre>var cur_tab = external.cur_sel</pre>
<pre>var cur_tab = external.cur_sel</pre>
   </li>
   </li>
   <li><B>m2_plugin_folder( security_id , plugin_name )</B>
   <li><B>m2_plugin_folder( security_id , plugin_name )</B>


The local path of the plugin.
The local path of the plugin.<br>Le chemin local du plugin.
<pre>var folder = external.m2_plugin_folder(%max_security_id,
<pre>var folder = external.m2_plugin_folder(%max_security_id,
&quot;ViewSource!&quot;)</pre>
&quot;ViewSource!&quot;)</pre>
   </li>
   </li>
   <li><B>m2_run_cmd( security_id , id )</B>
   <li>
<B>m2_run_cmd( security_id , id )</B>


Call a Maxthon command with the specified ID.
Call a Maxthon command with the specified ID.<br>Appeler une commande de Maxthon avec une ID specifiée.
<pre>external.m2_run_cmd(%max_security_id,32772)</pre>This will open a blank page.
<pre>external.m2_run_cmd(%max_security_id,32772)</pre>This will open a blank page.
   </li>
   </li>
   <li><B>m2_callerName( security_id, plugin_name)</B>
   <li>
<B>m2_callerName( security_id, plugin_name)</B>


This function tells Maxthon the call is made from a Plugin.
This function tells Maxthon the call is made from a Plugin.<br>Cette fonction indique à Maxthon l'appel effectué d'un plugin.
<pre>external.m2_callerName(%max_security_id,&quot;ViewSource!&quot;)</pre>
<pre>external.m2_callerName(%max_security_id,&quot;ViewSource!&quot;)</pre>
   </li>
   </li>
   <li><B>max_showConfig( security_id, plugin_name)</B>
   <li>
<B>max_showConfig( security_id, plugin_name)</B>


Show the plugin's config dialog.
Show the plugin's config dialog.<br>Montre la boite de dialogue de configuration du plugin.
<pre>external.max_showConfig(%max_security_id,&quot;ViewSource!&quot;)</pre>
<pre>external.max_showConfig(%max_security_id,&quot;ViewSource!&quot;)</pre>
</li>
</li>
<li><b>max_activex(security_id, prog_id)</b>
<li><b>max_activex(security_id, prog_id)</b>


Create an ActiveX object.
Create an ActiveX object.<br> Crée un objet ActiveX.
<pre>
<pre>
var tempwin = window.open()
var tempwin = window.open()
Ligne 101 : Ligne 114 :
tempwin.close()</pre>
tempwin.close()</pre>
   </li>
   </li>
   <li><B>max_modelessDialog( security_id , url , option , attr , window )</B>
   <li>
<B>max_modelessDialog( security_id , url , option , attr , window )</B>


Open a modelessDialog.
Open a modelessDialog.<br>Ouvre Une boite de dialogue modèle.  
<pre>external.max_modelessDialog(%max_security_id,
<pre>external.max_modelessDialog(%max_security_id,
'example.htm',window,  
'example.htm',window,  
Ligne 110 : Ligne 124 :
   <li><b>max_language_id</b>  
   <li><b>max_language_id</b>  


The user's current selected language.
The user's current selected language.<br>Le langage en cours sélectionné par l'utiisateur.
<pre>var language=external.max_language_id</pre>
<pre>var language=external.max_language_id</pre>
</li>
</li>
<li><B>max_actSideBarItem( plugin_name )</B>
<li>
<B>max_actSideBarItem( plugin_name )</B>


This function will activate the sidebar plugin named as 'plugin_name'.
This function will activate the sidebar plugin named as 'plugin_name'.<br>Cette fonction activera le plugin de barre latérale dont le nom est "pluginname".
<pre>external.max_actSideBarItem(&quot;Calculator++&quot)</pre>
<pre>external.max_actSideBarItem(&quot;Calculator++&quot)</pre>
   </li>
   </li>
<li><b>addFavorite( url , title ) , addFavorite( url )</b>
<li>
<b>addFavorite( url , title ) , addFavorite( url )</b>


Add the 'url' into favorites.
Add the 'url' into favorites.<br>Ajoute l'adresse URL aux favoris.
<pre>
<pre>
external.addFavorite( &quot;http://www.google.com&quot; )
external.addFavorite( &quot;http://www.google.com&quot; )
Ligne 126 : Ligne 142 :
&quot;This is google&quot;)</pre>
&quot;This is google&quot;)</pre>
   </li>
   </li>
   <li><B>addProxy (name, address, speed, is_web_proxy)</B>
   <li>
<B>addProxy (name, address, speed, is_web_proxy)</B>


Call Maxthon's add proxy dialog.
Call Maxthon's add proxy dialog.<br>Appelle la boite de dialogue "Ajouter un proxy".
<pre>external.addProxy(&quot;My proxy&quot;,
<pre>external.addProxy(&quot;My proxy&quot;,
&quot;192.168.1.0:8080&quot;,1,0)</pre>
&quot;192.168.1.0:8080&quot;,1,0)</pre>
   </li>
   </li>
   <li><B>addFilter( address ) , addFilter( address, is_pop_filter )</B>
   <li>
<B>addFilter( address ) , addFilter( address, is_pop_filter )</B>


Call Maxthon's add filter dialog.
Call Maxthon's add filter dialog.<br>Appelle la boite de dialogue "Ajouter un filtre".
<pre>
<pre>
external.addFilter(&quot;http://www.yahoo.com/ad*&quot;)
external.addFilter(&quot;http://www.yahoo.com/ad*&quot;)
external.addFilter(&quot;http://www.yahoo.com/img/*&quot;, 0)</pre>
external.addFilter(&quot;http://www.yahoo.com/img/*&quot;, 0)</pre>
   </li>
   </li>
   <li><B>m2_search_text( security_id )</B>
   <li>
<B>m2_search_text( security_id )</B>


This property will return the text in Maxthon's search bar.
This property will return the text in Maxthon's search bar.<br>Cette propriété renverra le texte dans la barre de recherche de Maxthon.
<pre>var text = external.m2_search_text(%max_security_id)</pre>
<pre>var text = external.m2_search_text(%max_security_id)</pre>
   </li>
   </li>
</ol>
</ol>


<p>In a sidebar plugin you can implement a script function called max_callback(status).
<p>In a sidebar plugin you can implement a script function called max_callback(status).<br>Dans un plugin de barre latérale vous pouvez ajouter une fonction script appelée : max_callback(status).<br>
<ol><li>
<ol><li>
   Created: URL = FILENAME?maxcmd=init</li><li>
   Created: URL = FILENAME?maxcmd=init</li><li>
Ligne 156 : Ligne 175 :


= Useful Links =
= Useful Links =
= Liens utiles =
These links are useful for reference and if you start learning HTML and Javascript.
These links are useful for reference and if you start learning HTML and Javascript.
<ul><li>[http://www.w3schools.com/js/default.asp W3School Javascript Tutorial] (Recommended for beginners)
<ul><li>[http://www.w3schools.com/js/default.asp W3School Javascript Tutorial] (Recommended for beginners)

Version du 9 octobre 2005 à 15:29

_

__

This is a short summary of all important Maxthon commands and links. You can [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark] this page so you can quickly lookup this information.
Voici un court sommaire des commandes et des liens utiles de Maxthon.
Vous pouvez mettre ajouter cette page à vos favoris [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark].
Ainsi vous accéderez plus rapidement à ces informations.

Commandes de Maxthon

Security_id: For Toolbar Plugins: %max_security_id For Sidebar Plugins: Inside max.src, called max_security_id

Security_id :

  • Pour les plugins de barre d'outils : %max_security_id
  • Pour les plugins de barre latérale : Inside max.src, called max_security_id


These are the Maxthon DHTML commands:

Voici les commandes DHTML de Maxthon :


  1. readFile( security_id, plugin_name, file_name) Read a text file.
    Lire un fichier texte.
    var text = external.readFile(%max_security_id,
    "Test plugin","export.txt")
  2. writeFile( security_id, plugin_name, file_name, content ) Write a text file.
    Ecrire un fihcier texte.
    external.writeFile(%max_security_id,
    "Test plugin","export.txt", "Some Data.")
  3. m2_readIni( security_id, plugin_name , file_name , section_name , key , default_value) Read an ini-file.
    Lire un fichier 'ini'.
    path = external.m2_readIni(%max_security_id,
    "testplugin","settings.ini","general","save","0")
  4. m2_writeIni( security_id , plugin_name , file_name , section_name , key , value ) Write an ini-file.
    Erire dans un fixhier 'ini'.
    external.m2_writeIni(%max_security_id,
    "testplugin","settings.ini","general","save","true")
  5. tab_count Total number of tabs.
    Nombre total d'onglets.
    var total_tab = external.tab_count
  6. activate_tab( security_id , index ) Activate tab number (starting from zero).
    external.activate_tab(%max_security_id,2)
  7. close_tab( security_id , index ) Close a tab.
    Fermer un onglet.
    external.close_tab(%max_security_id,2)
  8. get_tab( security_id , index ) Get the webpage object from tab 'index'
    var doc = external.get_tab(%max_security_id,2).document
  9. cur_sel The number of the active tab.
    Le numéro de l'onglet actif.
    var cur_tab = external.cur_sel
  10. m2_plugin_folder( security_id , plugin_name ) The local path of the plugin.
    Le chemin local du plugin.
    var folder = external.m2_plugin_folder(%max_security_id,
    "ViewSource!")
  11. m2_run_cmd( security_id , id ) Call a Maxthon command with the specified ID.
    Appeler une commande de Maxthon avec une ID specifiée.
    external.m2_run_cmd(%max_security_id,32772)
    This will open a blank page.
  12. m2_callerName( security_id, plugin_name) This function tells Maxthon the call is made from a Plugin.
    Cette fonction indique à Maxthon l'appel effectué d'un plugin.
    external.m2_callerName(%max_security_id,"ViewSource!")
  13. max_showConfig( security_id, plugin_name) Show the plugin's config dialog.
    Montre la boite de dialogue de configuration du plugin.
    external.max_showConfig(%max_security_id,"ViewSource!")
  14. max_activex(security_id, prog_id) Create an ActiveX object.
    Crée un objet ActiveX.
    var tempwin = window.open()
    var XML=tempwin.external.max_activex(%max_security_id,
    "Microsoft.XMLDOM")
    tempwin.close()
  15. max_modelessDialog( security_id , url , option , attr , window ) Open a modelessDialog.
    Ouvre Une boite de dialogue modèle.
    external.max_modelessDialog(%max_security_id,
    'example.htm',window, 
    'status:no;help:no;resizable:yes;scroll:yes;',window)
  16. max_language_id The user's current selected language.
    Le langage en cours sélectionné par l'utiisateur.
    var language=external.max_language_id
  17. max_actSideBarItem( plugin_name ) This function will activate the sidebar plugin named as 'plugin_name'.
    Cette fonction activera le plugin de barre latérale dont le nom est "pluginname".
    external.max_actSideBarItem("Calculator++&quot)
  18. addFavorite( url , title ) , addFavorite( url ) Add the 'url' into favorites.
    Ajoute l'adresse URL aux favoris.
    external.addFavorite( "http://www.google.com" )
    external.addFavorite( "http://www.google.com",
    "This is google")
  19. addProxy (name, address, speed, is_web_proxy) Call Maxthon's add proxy dialog.
    Appelle la boite de dialogue "Ajouter un proxy".
    external.addProxy("My proxy",
    "192.168.1.0:8080",1,0)
  20. addFilter( address ) , addFilter( address, is_pop_filter ) Call Maxthon's add filter dialog.
    Appelle la boite de dialogue "Ajouter un filtre".
    external.addFilter("http://www.yahoo.com/ad*")
    external.addFilter("http://www.yahoo.com/img/*", 0)
  21. m2_search_text( security_id ) This property will return the text in Maxthon's search bar.
    Cette propriété renverra le texte dans la barre de recherche de Maxthon.
    var text = external.m2_search_text(%max_security_id)

In a sidebar plugin you can implement a script function called max_callback(status).
Dans un plugin de barre latérale vous pouvez ajouter une fonction script appelée : max_callback(status).

  1. Created: URL = FILENAME?maxcmd=init
  2. Activated = max_callback('sidebar_activate')
  3. Deactivated = max_callback('sidebar_deactivate')
  4. Tab Change=max_callback('sidebar_tab_change')
  5. Unload=max_callback('sidebar_unload')

Useful Links

Liens utiles

These links are useful for reference and if you start learning HTML and Javascript.

Useful Maxthon Links:

< Partie 5 : Exemples | Sommaire Plugin