?? plugins-howto.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<p><a href="#handler">General questions about Plugins</a><br>
<a href="#config">How to implement "Config" function of a Plugin</a><br>
<a href="#handler">How to add new or override existing protocols</a><br>
<a href="#Button">How to make a "Button" type plugin</a><br>
<a href="#SideBar">How to make a "SideBar" type plugin</a> <br>
<a href="#DHTML">Extended DHTML support</a></p>
<p><a name="general"></a>General questions about Plugins<font size="+1">:</font>
</p>
<p>1. COM Object</p>
<p>COM object must implement IMyIEClient interface. Please refer to IMyIE.h</p>
<p>2. Exe File:</p>
<p>Any win32 exe file could be used as plugin. MyIE2 will send different parameters
under different circumstance. <br>
General parameter:<br>
a. "-h=handle" : handle is the Wnd handle of the MyIE2 main window,
decimalist.</p>
<p>3. Script File:</p>
<p>Script File must be written in the following format:</p>
<p>Example:<br>
<script language="Javascript"><br>
alert(document.lastModified);<br>
</script></p>
<p>The 'language' could be any valid language that IE supports.</p>
<p><br>
<font size="+1"><a name="config"></a>How to implement 'Config' function of a
Plugin?</font></p>
<p>There is a 'Config' button in the 'MyIE2 Plugin' option page. MyIE2 will call
the corresponding 'Config' function of a plugin, when user clicks the 'Config'
button.</p>
<p>1. COM Object:</p>
<p>The COM's IMyIEClient::Config will be call with the parameter of the config
dialog's hWnd handle.</p>
<p>2. Exe File:</p>
<p>The file will be called with a parameter of "-setup". For example,
if the filename is "abc.exe", then MyIE2 will call "abc.exe -setup
..." .</p>
<p>3. Script File:</p>
<p>Not support currently...</p>
<p><font size="+1"><a name="handler"></a>How to add new or override existing protocols?</font></p>
<p>With MyIE2, the plugin could estanblish a new protocol, such as book://, or
override an existing protocol, such as ftp:// .When the user inputs the protocol
in the address bar or clicks the protocol on webpage, MyIE2 will call the plugin.</p>
<p>1. COM Object:</p>
<p>Not support currently...</p>
<p>2. Exe File:</p>
<p>The file will be called with the parameter "-u=url", in which the
url is the address that the user wants to visit, such as book://www.mysite.com/abc.pdf,
or ftp://www.google.com .</p>
<p>3. Srcipt File:</p>
<p>Not support currently...<br>
</p>
<p><font size="+1"><a name="Button" id="Button"></a></font>How to make a "Button"
type plugin?</p>
<p>MyIE2 supports "Button" type plugins, which will be placed on "Ext
Button" toolbar. The plugin is called when user clicks on the corresponding
button. The 'Button' plugin could be implemented using the following methods.</p>
<p>1.COM Object: <br>
<br>
When user clicks on the button, MyIE2 will query the Com's IOleCommandTarget
interface and 和IObjectWithSite interface,passing the IWebBrowser2 pointer of
the current page to its IObjectWithSite::SetSite function,then call its IOleCommandTarget::Exec
function. It's similar to IE's implementation of button. Please refer to MSDN
for more information.</p>
<p>Sample Plugin.ini:<br>
<br>
[General]<br>
Name=ComButton<br>
Author=bloodchen<br>
Version=1.0<br>
ModuleType=COM<br>
FileName=ComButton.dll<br>
CLSID={96E78121-9FF2-466D-B6CD-4038CAC1BB79} <br>
Comments=Com type 'Button'<br>
Type=BUTTON<br>
HotIcon=hot.ico<br>
Icon=cold.ico</p>
<p><br>
2.Script:<br>
<br>
When the user clicks the button, MyIE2 will run the script on current web page.</p>
<p>Sample Plugin.ini:<br>
[General]<br>
Name=LastModified<br>
Author=bloodchen<br>
Version=1.0<br>
ModuleType=SCRIPT<br>
FileName=LastModified.htm<br>
Comments=See last modified date of current page<br>
Type=BUTTON<br>
HotIcon=hot.ico<br>
Icon=cold.ico</p>
<p>3.Exe File:<br>
<br>
When the user clicks the button, MyIE2 will call the file with the parameters
of current address and handle of the main MyIE2 window. For example, the file
is abc.exe,then MyIE2 will call abc.exe -h=23424 -u=http://www.yahoo.com, in
which 23424 is the handle of the main MyIE2 window and http://www.yahoo.com
is the URL of the current page.</p>
<p> Sample Plugin.ini:<br>
<br>
[General]<br>
Name=ExeButton<br>
Author=BloodChen<br>
Version=1.0<br>
ModuleType=EXE<br>
FileName=abc.exe<br>
Comments=Exe type Button<br>
Type=BUTTON<br>
Icon=p.ico<br>
</p>
<p><font size="+1"><a name="SideBar"></a>How to make a 'SideBar' type plugin </font></p>
<p>MyIE2 supports 'SideBar' plugin,This kind of plugin will appear on MYIE2's
sidebar, implemented using a html file.</p>
<p>1.HTML:<br>
<br>
When user clicks on the button,MyIE2 will load the html file into the side bar
, which is assigned in the plugin.ini.</p>
<p>Example Plugin.ini:<br>
<br>
[General]<br>
Name=Calculator++ 1.2<br>
Author=SiC<br>
Version=1.2<br>
ModuleType=SCRIPT<br>
FileName=calculator.htm<br>
Comments=Scientific programmable calculator.<br>
Type=Sidebar<br>
HotIcon=cpp.ico<br>
Icon=cpp.ico</p>
<p> </p>
<p><font size="+1"><a name="DHTML" id="DHTML"></a></font>Extended DHTML support
</p>
<p>MYIE2 has extended the DHTML support by adding several new commands which could
be called from script langauge. The HTML or scirpt writer could call the function
through the 'window.external' object. The function could be called from the
script in a HTML page or a scirpt plugin.</p>
<ol>
<li>addFavorite( url , title ) , addFavorite( url )<br>
<br>
This function will ask user to add the 'url' into favortes, using 'title'
for the name of the url.<br>
<br>
Example1: external.addFavorite( "http://www.google.com" ); <a href="#" onClick="external.addFavorite( 'http://www.google.com' )">Demo</a><br>
Example2: external.addFavorite( "http://www.google.com","This
is google"); <a href="#" onClick='external.addFavorite( "http://www.google.com","This is google");'>Demo</a><br>
</li>
<li>addProxy (name, address, speed, is_web_proxy)<br>
<br>
This function will call MYIE2's add proxy dialog to add the proxy named as
'name' at address 'address', giving the initial speed 'speed'. The is_web_proxy
indicates whether the proxy is a web proxy or a normal proxy.<br>
<br>
Example: external.addProxy("My proxy","192.168.1.0:8080",1,0);
<a href="#" onClick='external.addProxy("My proxy","192.168.1.0:8080",1,0);'>Demo</a>
<br>
</li>
<li>addFilter( address ) , addFilter( address, is_pop_filter )<br>
<br>
This function will call MYIE2's add filter dialog, setting the address to
be filtered as 'address'. 'is_pop_filter' indicates whether the defalut filter
type is 'pop filter'.<br>
<br>
Example1: external.addFilter("http://www.yahoo.com/ad*"); <a href="#" onClick='external.addFilter("http://www.yahoo.com/ad*");'>Demo</a><br>
Example1: external.addFilter("http://www.yahoo.com/img/*", 0); <a href="#" onClick='external.addFilter("http://www.yahoo.com/img/*", 0);'>Demo</a><br>
</li>
<li>readFile( plugin_name, file_name)<br>
<br>
This function can only be used in a script plugin, for the security reasons.
The 'plugin_name' refers to the plugin name defined in plugin.ini and the
'file_name' indicates which file it wants to read. The function will reture
the file contents. If the plugin is not enabled or the 'plugin_name' is wrong
or not found, the function will fail and return null.<br>
<br>
Example: alert(external.readFile("Test plugin","plugin.ini"))
;<br>
</li>
<li>writeFile( plugin_name, file_name, content )<br>
<br>
This function can only be used in a script plugin, for the security reasons.
The 'plugin_name' refers to the plugin name defined in plugin.ini and the
'file_name' indicates the file name which will be write. The 'content' is
the content that will be write to the file. If the plugin is not enabled or
the 'plugin_name' is wrong or not found, the function will fail and return
null. <br>
<font color="#FF0000"> Please note</font>: The file will be overwritten from
the beginning.<br>
<br>
Example: external.writeFile("Test plugin","setting.ini","username=abc\npass=qwrxcv");<br>
<br>
</li>
<li> tab_count : this property will return total number of tabs as a integer.<br>
<br>
Example: var total_tab = external.tab_count ; <a href="#" onClick="javascript:alert('total tabs='+external.tab_count)">Demo</a><br>
<br>
</li>
<li>activate_tab(index)<br>
<br>
This function will activate number 'index' tab of MyIE2.<br>
<br>
Example: external.activate_tab(1); <a href="#" onClick="javascript:external.activate_tab(0)">Demo</a><br>
<br>
</li>
<li> get_tab(index)<br>
<br>
This function will return a web page object of tab index.<br>
<br>
Example: alert(external.get_tab(0).document.URL); <a href="#" onClick="javascript:alert(external.get_tab(0).document.URL)">Demo</a><br>
<br>
</li>
<li> cur_sel<br>
<br>
This function will return the number of current active tab as a integer.<br>
<br>
Example: var cur_tab = external.cur_sel; <a href="#" onClick="javascript:alert('current tab is '+external.cur_sel)">Demo</a><br>
<br>
</li>
<li>close_tab(index)<br>
<br>
This function will close number 'index' tab of MyIE2.<br>
<br>
Example: external.close_tab(0); <a href="#" onClick="javascript:external.close_tab(0)">Demo</a><br>
</li>
<li>m2_readIni(plugin_name,file_name,section_name,key,default_value)<br>
<br>
This function will read the key using the default_value in the ini file specified
by file_name in the plugin folder.<br>
<br>
Example: path = external.m2_readIni("testplugin","settings.ini","general","save","0");<br>
</li>
<li>m2_writeIni(plugin_name,file_name,section_name,key,value)<br>
<br>
This function will write assign the key with the value to the ini file specified
by file_name.<br>
<br>
Example: external.m2_writeIni("testplugin","settings.ini","general","save","1");<br>
</li>
<li>m2_search_text<br>
<br>
This property will return the text in MyIE2's search bar.<br>
<br>
Example: alert(external.m2_search_text)<br>
</li>
<li>m2_run_cmd(id)<br>
<br>
This function will call a MyIE2's command with the ID. The id of every command
could be found in the language file.<br>
<br>
Example: external.m2_run_cmd(32772); //It will open a blank page.</li>
</ol>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -