====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
script_template [2015/01/21 08:56] ajasei [How to use the script] |
script_template [2015/05/05 20:27] (current) trianguloy |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== About the script ====== | ====== About the script ====== | ||
- | * Purpose : show battery "charging" or "discharging" state | + | * Purpose : explain what the script does |
- | * Author : Abednego JS ( https://plus.google.com/u/0/118095355037125433304 ) | + | * Author : who wrote this script |
- | * Link: https://plus.google.com/u/0/118095355037125433304/posts/UXfaG9YQyqX | + | * Link: if needed, you may add a link here |
====== How to use the script ====== | ====== How to use the script ====== | ||
- | This script will NOT showing anything when the power cable unplugged, just change the batstat value (in variable declaration or onReceive function) to change this. :D | + | Explain everything needed to use the script, whether some item configuration need to be done before, on which event to trigger the script, and so on |
- | Create shortcut to run this script, it'll be dynamic label where the script show battery state. Give it name "batv". | + | ====== Script code ====== |
+ | <sxh javascript> | ||
- | Also assign script to running when displaying the page where "batv" placed (follow this step if user want to see battery state updated/checked when access spesific page instad of checking the state everytime). | + | //New tag, line completion and colors. |
- | How to assign: Lightning Setting >> Current desktop >> Event & Actions >> Resumed >> Run a script [choose this script]. | + | //The previous one was <code> script(); </code> |
+ | //remove those lines and write here your script | ||
+ | yourJavaScriptCodeHere(); | ||
- | Dictionary: | + | </sxh> |
- | + | ||
- | var: | + | |
- | + | ||
- | item (get LLX item), batcon (get LLX context), batstat ( String value to edit the "batv" label), curd (get current page), curi (get "batv"), | + | |
- | ifilter (filtering android intent), batterystatus (intent where activity to change batstat's value executed), text (temporary place used as bridge between batstat value to "batv" label), | + | |
- | etc (status, isCharging, chargePlug, usbCharge, acCharge they're variable used to change batstat's value) | + | |
- | + | ||
- | function: | + | |
- | + | ||
- | onReceive(context, intent) = function to change batstat's value; | + | |
- | manref () = function to manual update "batv" label; | + | |
- | + | ||
- | ====== Script code ====== | + | |
- | <code> | + | |
- | yourJavaScriptCodeHere(); | + | |
- | </code> | + |