« Tutorial Plugin : 5 - Exemples » : différence entre les versions

De Wiki Francophone de Maxthon
Ldfa (discussion | contributions)
Aucun résumé des modifications
Ldfa (discussion | contributions)
Aucun résumé des modifications
 
(6 versions intermédiaires par 3 utilisateurs non affichées)
Ligne 1 : Ligne 1 :
Here are all Javascript examples. These are the same as the files you can download in this tutorial.<br>
<p>Voici tous les exemples Javascript. Ce sont les mêmes que ceux que vous pouvez télécharger dans ce tutoriel.
</p>
</p>


= Plugin.ini (Toolbar) =
<div class=code>
[General]<br>Name=PLUGINNAME<br>Author=YOURNAME<br>
Version=1.0<br>ModuleType=SCRIPT<br>FileName=FILENAME.html<br>
Comments=COMMENTS<br>Type=M2Plugin_BUTTON<br>HotIcon=ICONHOT.ico
<br>Icon=ICON.ico<br>[MyIE2Buttons]<br>Count=2<br>Name1=NAME1<br>
FileName1=FILENAME1.html<br>Name2=NAME2<br>FileName2=FILENAME2.html
</div>


= plugin.ini (Sidebar) =
= Plugin.ini (Barre d'outils) =
<div class=code>
 
[General]<br>Name=PLUGINNAME<br>Author=YOURNAME<br>
 
Version=1.0<br>ModuleType=SCRIPT<br>FileName=FILENAME.html<br>
<pre>
Comments=COMMENTS<br>Type=M2Plugin_SIDEBAR<br>
[General]
HotIcon=ICONHOT.ico<br>Icon=ICON.ico
Name=PLUGINNAME
</div>
Author=YOURNAME
Version=1.0
ModuleType=SCRIPT
FileName=FILENAME.html
Comments=COMMENTS
Type=M2Plugin_BUTTON
HotIcon=ICONHOT.ico
Icon=ICON.ico
 
[MyIE2Buttons]
Count=2
Name1=NAME1
FileName1=FILENAME1.html
Name2=NAME2
FileName2=FILENAME2.html
</pre>
 
 
= Plugin.ini ( Barre latérale) =
 
 
<pre>
[General]
Name=PLUGINNAME
Author=YOURNAME
Version=1.0
ModuleType=SCRIPT
FileName=FILENAME.html
Comments=COMMENTS
Type=M2Plugin_SIDEBAR
HotIcon=ICONHOT.ico
Icon=ICON.ico
</pre>
 
 
= Modèle de plugin de barre latérale =
 


= Template Sidebar plugin =
<pre>
<pre>
&lt;HTML&gt;  
&lt;HTML&gt;  
Ligne 57 : Ligne 84 :
</pre>
</pre>


= Template Toolbar plugin =
 
= Modèle de plugin de barre d'outils =
 
 
<pre>
<pre>
&lt;script language="JavaScript"&gt;
&lt;script language="JavaScript"&gt;
Ligne 89 : Ligne 119 :
</pre>
</pre>


= config.html =
 
= Config.html =
 
 
<pre>
<pre>
<head>
<head>
Ligne 159 : Ligne 192 :




 
<center> '''<''' [[Tutorial Plugin : 4 - Astuces|Partie 4 : Astuces]] | [[Tutorial Plugin|Sommaire Plugin]] | [[Tutorial Plugin : 6 - Liste des commandes|Partie 6: Liste des commandes]] '''>''' </center>
<center>[[Tutorial Plugin : 6 - Liste des commandes|Partie 6: Liste des commandes]]</center>

Dernière version du 10 octobre 2005 à 17:52

Voici tous les exemples Javascript. Ce sont les mêmes que ceux que vous pouvez télécharger dans ce tutoriel.


Plugin.ini (Barre d'outils)

[General]
Name=PLUGINNAME
Author=YOURNAME
Version=1.0
ModuleType=SCRIPT
FileName=FILENAME.html
Comments=COMMENTS
Type=M2Plugin_BUTTON
HotIcon=ICONHOT.ico
Icon=ICON.ico

[MyIE2Buttons]
Count=2
Name1=NAME1
FileName1=FILENAME1.html
Name2=NAME2
FileName2=FILENAME2.html


Plugin.ini ( Barre latérale)

[General]
Name=PLUGINNAME
Author=YOURNAME
Version=1.0
ModuleType=SCRIPT
FileName=FILENAME.html
Comments=COMMENTS
Type=M2Plugin_SIDEBAR
HotIcon=ICONHOT.ico
Icon=ICON.ico


Modèle de plugin de barre latérale

<HTML> 
<head> 
<script language="JavaScript" type="text/JavaScript" src="max.src">
</script>
<script language="JavaScript">

//Don't forget to change this to your plugin name! pluginname='PLUGINNAME' sid=max_security_id

//These functions are not required, //they make writing and reading (ini)files easier. //You can remove them if you like.

function WriteFile(FileName,Data) { external.writeFile(sid,pluginname,FileName,Data) } function ReadFile(FileName) { return external.readFile(sid,pluginname,FileName) } function WriteIni(Key, Data) { external.m2_writeIni(sid, pluginname,"plugin.ini","Settings", Key, Data) } function ReadIni(Key, Default) { return external.m2_readIni(sid, pluginname,"plugin.ini","Settings", Key, Default)

}

</script> </head> <body>

<!-- This part will be visible in the Sidebar-->

</body> </HTML>


Modèle de plugin de barre d'outils

<script language="JavaScript">
(function() {
var sid=%max_security_id

//Don't forget to change this to your plugin name!
var pluginname='PLUGINNAME' 


//These functions are not required, 
//they make writing and reading (ini)files easier. 
//You can remove them if you like.

function WriteFile(FileName,Data) {
external.writeFile(sid,pluginname,FileName,Data)
}
function ReadFile(FileName) {
return external.readFile(sid,pluginname,FileName)
}
function WriteIni(Key, Data) {
external.m2_writeIni(sid,pluginname,"plugin.ini","Settings",Key,Data)
}
function ReadIni(Key, Default) {
return external.m2_readIni(sid, 
pluginname,"plugin.ini","Settings", Key, Default)
}

}())
</script>


Config.html

<head>
<!--The width of the Configuration window-->
<meta name="Dialog-Width" content="170">
<!--The height of the Configuration window-->
<meta name="Dialog-Height" content="200">
<!--The security_id is in this file 
(max.src will be created automatically)-->
<script type="text/javascript" src=max.src>
</script>
<script type="text/javascript">
//Your pluginname
PLUGINNAME="tester" 

//load the settings from the plugin.ini file
function LoadSettings()  {


//read the plugin.ini file
if(external.m2_readIni(max_security_id,
PLUGINNAME,'plugin.ini','Settings','Test1','')=='true') 
//Test1 (the checkbox) will be checked
document.settings.Test1.checked=true  

if(external.m2_readIni(max_security_id,
PLUGINNAME,'plugin.ini','Settings','Test2','')=='true') 
document.settings.Test2.checked=true
}

function SaveSettings()  {
//write the settings to the plugin.ini file
//checked.toString() will write 'true' or 'false', 
//you have to use 'toString()' because 'checked' is a boolean 
//and you can't write that correctly to a file.
external.m2_writeIni(max_security_id,
PLUGINNAME,'plugin.ini','Settings','Test1',
document.settings.Test1.checked.toString())
external.m2_writeIni(max_security_id,
PLUGINNAME,'plugin.ini','Settings','Test2',
document.settings.Test2.checked.toString())

/*Close the window*/

//If you don't use this next line 
//you get a dialog to confirm the closing
window.opener=self; 
self.close();
}

</script> <!--The style of the window--> <style type="text/css"> body { overflow:hidden;} /*Now you don't see the scrollbar*/ </style> </head> <!-- If the body is loaded it will execute LoadSettings()--> <body onload=LoadSettings()> = Tester = <form name="settings" action="none"> <!--With the 'for=Test1' part you can click on the label to toggle 'Test1'--> <input type="checkbox" id="Test1"><label for=Test1>Test1</label> <input type="checkbox" id="Test2"><label for=Test2>Test2</label> </form> <input type="button" onclick="SaveSettings();" value="Save"> </body> </html>


< Partie 4 : Astuces | Sommaire Plugin | Partie 6: Liste des commandes >