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

De Wiki Francophone de Maxthon
Aller à la navigation Aller à la recherche
 
Ligne 159 : Ligne 159 :
</ul>
</ul>


<center>[[Tutorial Plugin : 1 - Introduction|Retour au début]]</center>
<center> '''<''' [[Tutorial Plugin : 5 - Exemples|Partie 5 : Exemples]] | [[Tutorial Plugin|Sommaire Plugin]]</center>

Version du 12 septembre 2005 à 10:23

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. Security_id: For Toolbar Plugins: %max_security_id For Sidebar Plugins: Inside max.src, called max_security_id

These are the Maxthon DHTML commands:

  1. readFile( security_id, plugin_name, file_name) Read a text file.
    var text = external.readFile(%max_security_id,
    "Test plugin","export.txt")
  2. writeFile( security_id, plugin_name, file_name, content ) Write a text file.
    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
    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
    external.m2_writeIni(%max_security_id,
    "testplugin","settings.ini","general","save","true")
  5. tab_count Total number of tabs.
    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
    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.
    var cur_tab = external.cur_sel
  10. m2_plugin_folder( security_id , plugin_name ) The local path of the 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.
    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.
    external.m2_callerName(%max_security_id,"ViewSource!")
  13. max_showConfig( security_id, plugin_name) Show the plugin's config dialog.
    external.max_showConfig(%max_security_id,"ViewSource!")
  14. max_activex(security_id, prog_id) Create an ActiveX object.
    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.
    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.
    var language=external.max_language_id
  17. max_actSideBarItem( plugin_name ) This function will activate the sidebar plugin named as 'plugin_name'.
    external.max_actSideBarItem("Calculator++&quot)
  18. addFavorite( url , title ) , addFavorite( url ) Add the 'url' into favorites.
    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.
    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.
    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.
    var text = external.m2_search_text(%max_security_id)

In a sidebar plugin you can implement a script function called 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

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

Useful Maxthon Links:

< Partie 5 : Exemples | Sommaire Plugin