This shows you the differences between two versions of the page.
plugins:own_javascript_plugin [2015/07/08 09:00] octazid add zip file |
plugins:own_javascript_plugin [2019/09/17 15:35] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======Create you own pure Javascript plugins====== | ||
- | =====(Tutorial)===== | ||
- | |||
- | =====Introduction===== | ||
- | |||
- | ===Here is the announcement from Dave, developer of DroidScript: | ||
- | (posted in the DroidScript-Beta-Testers google-group) | ||
- | |||
- | //Hi Guys, | ||
- | For those of you that would like to have a go at creating pure JavaScript plugins for DroidScript, | ||
- | //You simply need to drop this zip file into a folder called / | ||
- | When you come to renaming and making your own plugins, please make sure you use the same format and case for file names as those shown in this sample. | ||
- | Let us know how you get on :) | ||
- | |||
- | (Note: You can make sub folders in the zip file for your documentation images etc if you like)// | ||
- | |||
- | *(The Sample is a simple **Zip-File** with 4 files. You can find this files below. All you have to do is to Download the files. Put them in one folder and zip this folder.) | ||
- | |||
- | ---- | ||
- | |||
- | =====Usage of the Example===== | ||
- | |||
- | ====First Step:==== | ||
- | |||
- | Download the following 4 Files: | ||
- | |||
- | * **File 1: The html-page for the Documentation** | ||
- | |||
- | <code html MyPlugin.html> | ||
- | |||
- | < | ||
- | < | ||
- | |||
- | < | ||
- | < | ||
- | <meta name=" | ||
- | <style type=" | ||
- | </ | ||
- | </ | ||
- | |||
- | < | ||
- | |||
- | <div data-role=" | ||
- | |||
- | <div data-role=" | ||
- | <a href='#' | ||
- | < | ||
- | </ | ||
- | |||
- | <div data-role=" | ||
- | |||
- | <p> Todo: Documentation for MyPlugin</ | ||
- | |||
- | < | ||
- | using the < | ||
- | |||
- | <div class=" | ||
- | |||
- | < | ||
- | |||
- | <div class=" | ||
- | | ||
- | < | ||
- | < | ||
- | |||
- | <div data-role=" | ||
- | < | ||
- | <div id=" | ||
- | app.LoadPlugin( " | ||
- | < | ||
- | function OnStart()< | ||
- | {< | ||
- | & | ||
- | & | ||
- | & | ||
- | & | ||
- | <b id=" | ||
- | & | ||
- | </ | ||
- | & | ||
- | }< | ||
- | < | ||
- | function CallPlugin()< | ||
- | {< | ||
- | & | ||
- | }< | ||
- | |||
- | </ | ||
- | <div name=" | ||
- | <a href="#" | ||
- | <a href="#" | ||
- | <a href="#" | ||
- | </ | ||
- | </ | ||
- | |||
- | |||
- | <div data-role=" | ||
- | < | ||
- | <div id=" | ||
- | app.LoadPlugin( " | ||
- | < | ||
- | function OnStart()< | ||
- | {< | ||
- | & | ||
- | & | ||
- | & | ||
- | & | ||
- | <b id=" | ||
- | & | ||
- | & | ||
- | </ | ||
- | & | ||
- | }< | ||
- | < | ||
- | function CallPlugin()< | ||
- | {< | ||
- | & | ||
- | }< | ||
- | function OnMyReply( txt, num, bool )<br> | ||
- | {< | ||
- | & | ||
- | }< | ||
- | </ | ||
- | <div name=" | ||
- | <a href="#" | ||
- | <a href="#" | ||
- | <a href="#" | ||
- | </ | ||
- | </ | ||
- | |||
- | </ | ||
- | |||
- | </ | ||
- | |||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | * **File 2: The inc-file with the Plugin-code (Javascript)** | ||
- | |||
- | <code Javascript MyPlugin.inc> | ||
- | |||
- | function MyPlugin() | ||
- | { | ||
- | this.callback = null; | ||
- | |||
- | this.GetVersion = function( num, txt ) | ||
- | { | ||
- | return 1.0; | ||
- | } | ||
- | |||
- | this.MyFunc = function( txt, num, bool ) | ||
- | { | ||
- | this.callback( txt + " World!!", | ||
- | } | ||
- | |||
- | this.SetOnMyReply = function( cb ) | ||
- | { | ||
- | this.callback = cb; | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | * **File 3: The text-file with the Versionnumber** | ||
- | |||
- | <code text Version.txt> | ||
- | 1.00 | ||
- | </ | ||
- | |||
- | * **File 4: A blanc jar-file without any text** | ||
- | |||
- | <code Java MyPlugin.jar> | ||
- | |||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | |||
- | ====Second Step:==== | ||
- | |||
- | Create a Zip-folder called " | ||
- | |||
- | * Select the 4 Files and use a tool on a Windows Desktop-PC like [[http:// | ||
- | * after this process you should have a file with the following structure: | ||
- | |||
- | MyPlugin.zip | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | |||
- | * Now you go on your Android Device to the folder **/ | ||
- | * Copy the zip-file in this folder and start Droidscript | ||
- | * DroidScript imports the Plugin now in the Droidscript-Pluginfolder in the systempath | ||
- | * Now you can see your plugin if you press the left " | ||
- | * The folder **/ | ||
- | |||
- | =====Notes===== | ||
- | |||
- | * If your Plugin had another name like " | ||
- | * When you come to renaming and making your own plugins, please make sure you use the same format and case for file names as those shown in this sample! | ||
- | * You can make sub folders in the zip file for your documentation images etc | ||
- | |||
- | =====How can uninstall your plugin? | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ===== Zip file with all 4 files ===== | ||
- | You can find the Zip-file with all 4 files here: {{: | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||