-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPage.Html
More file actions
68 lines (64 loc) · 3.18 KB
/
Page.Html
File metadata and controls
68 lines (64 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!DOCTYPE html>
<html>
<head>
<title>Function Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="autotoolswebscreen" type="variablejs" id="title" label="Titles" description="A list of comma seperated titles" defaultValue="Title 1,Title 2,Title 3"/>
<meta name="autotoolswebscreen" type="variablejs" id="text" label="Texts" description="A list of comma seperated texts" defaultValue="text 1,text 2,text 3"/>
<meta name="autotoolswebscreen" type="variablejs" id="checked" label="Checked" description="A list of comma seperated true or false values" defaultValue="true,false,true"/>
<script type="text/javascript">
//This will set the default values for the various variables. These values will be set if they are not set from Tasker, so you can be sure they always have a value even if the user deletes the values in Tasker.
//The "title" variable will be "Title 1,Title 2,Title 3" by default
//The "text" variable will be "text 1,text 2,text 3" by default
AutoTools.setDefaultValues({
"title":"Title 1,Title 2,Title 3",
"text":"text 1,text 2,text 3",
"checked":"true,false,true",
});
</script>
</head>
<body>
<div id="items"></div>
<div class="item">
<h2 class="title">Sample Title</h2>
<input type="checkbox" class="checked"></input>
<div class="text">Sample Text</div>
</div>
<script type="text/javascript">
//This has to be called AFTER the element with the "item" class is declared above.
//["title", "text"] is an array with the AutoTools Web Screen variables that you want to convert to a list
//"items" is the ID of the element in which the list should be created
//"item" is the class of the element that will be used as a template to create each element on the list. The original element you declared will be hidden automatically.
/*Using the default values for the Web Screen Variables above, the following elements would be created inside the "items" element when this is ran in an AutoTools Web Screen:
<div class="item">
<h2 class="title">Title 1</h2>
<div class="text">text 1</div>
</div>
<div class="item">
<h2 class="title">Title 2</h2>
<div class="text">text 2</div>
</div>
<div class="item">
<h2 class="title">Title 3</h2>
<div class="text">text 3</div>
</div>
*/
AutoTools.variablesToElements(["title", "text", "checked"], "items","item",{
"onclick":item=>{
if(!item){
return;
}
console.log(item);
AutoTools.sendCommand(item.text);
AutoTools.say(item.text);
AutoTools.hapticFeedback();
},
"events":[{
"name":"change",
"query":".checked",
"handler":element=>console.log(element.checked)
}]
});
</script>
</body>
</html>