Spaces:
Running
Running
Alfredo Villegas
commited on
Commit
•
839ae79
1
Parent(s):
31c7711
DEV: prueba 3 de switch button
Browse files- static/js/windowHandler.js +15 -8
- static/main.html +1 -1
static/js/windowHandler.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
class WindowHandler{
|
|
|
2 |
constructor(){
|
3 |
this.chatbox = $("#chat");
|
4 |
this.template = $('<div class="message"><div><p></p></div></div>');
|
@@ -18,6 +19,12 @@ class WindowHandler{
|
|
18 |
$("#input-text").keypress(() => this.recalcularTextarea());
|
19 |
$("#input-text").keyup(() => this.recalcularTextarea());
|
20 |
$("#input-text").keydown(() => this.recalcularTextarea());
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
this.cargarChat(chatH.convesacion);
|
22 |
|
23 |
$(document).on("precarga:inicio", (event, params) => {
|
@@ -152,13 +159,13 @@ class WindowHandler{
|
|
152 |
|
153 |
|
154 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
}
|
157 |
-
function toggleSwitch() {
|
158 |
-
let checkBox = document.querySelector(".switch input[type='checkbox']");
|
159 |
-
if (checkBox.checked) {
|
160 |
-
console.log("Switch is turned on.");
|
161 |
-
} else {
|
162 |
-
console.log("Switch is turned off.");
|
163 |
-
}
|
164 |
-
}
|
|
|
1 |
class WindowHandler{
|
2 |
+
//en este se hacen los cambios visuales
|
3 |
constructor(){
|
4 |
this.chatbox = $("#chat");
|
5 |
this.template = $('<div class="message"><div><p></p></div></div>');
|
|
|
19 |
$("#input-text").keypress(() => this.recalcularTextarea());
|
20 |
$("#input-text").keyup(() => this.recalcularTextarea());
|
21 |
$("#input-text").keydown(() => this.recalcularTextarea());
|
22 |
+
|
23 |
+
|
24 |
+
$("#input-activar").change((event) => this.toggleSwitch(event));
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
this.cargarChat(chatH.convesacion);
|
29 |
|
30 |
$(document).on("precarga:inicio", (event, params) => {
|
|
|
159 |
|
160 |
|
161 |
}
|
162 |
+
toggleSwitch(event) {
|
163 |
+
let checkBox = event.currentTarget;
|
164 |
+
if (checkBox.checked) {
|
165 |
+
console.log("Switch is turned on.");
|
166 |
+
} else {
|
167 |
+
console.log("Switch is turned off.");
|
168 |
+
}
|
169 |
+
}
|
170 |
|
171 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/main.html
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
<textarea class='input-text' id='input-text' placeholder="Type something" type="text" autofocus=""></textarea>
|
20 |
<button class='input-send' id='input-send' ></button>
|
21 |
<label class="switch">
|
22 |
-
<input type="checkbox"
|
23 |
<span class="slider round"></span>
|
24 |
</label>
|
25 |
<button class='input-delete' id='input-delete' ></button>
|
|
|
19 |
<textarea class='input-text' id='input-text' placeholder="Type something" type="text" autofocus=""></textarea>
|
20 |
<button class='input-send' id='input-send' ></button>
|
21 |
<label class="switch">
|
22 |
+
<input type="checkbox" id="input-activar">
|
23 |
<span class="slider round"></span>
|
24 |
</label>
|
25 |
<button class='input-delete' id='input-delete' ></button>
|