Tutorial Plugin : 6 - Liste des commandes

De Wiki Francophone de Maxthon
Révision datée du 2 septembre 2005 à 06:51 par Ldfa (discussion | contributions)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Sauter à la navigation Sauter à la recherche

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.
    "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,
  4. m2_writeIni( security_id , plugin_name , file_name , section_name , key , value ) Write an ini-file
  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).
  7. close_tab( security_id , index ) Close a tab
  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,
  11. m2_run_cmd( security_id , id ) Call a Maxthon command with the specified ID.
    This will open a blank page.
  12. m2_callerName( security_id, plugin_name) This function tells Maxthon the call is made from a Plugin.
  13. max_showConfig( security_id, plugin_name) Show the plugin's config dialog.
  14. max_activex(security_id, prog_id) Create an ActiveX object.
    var tempwin = window.open()
    var XML=tempwin.external.max_activex(%max_security_id,
  15. max_modelessDialog( security_id , url , option , attr , window ) Open a modelessDialog.
  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'.
  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",
  20. addFilter( address ) , addFilter( address, is_pop_filter ) Call Maxthon's add filter dialog.
    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:

Retour au début