-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
173 lines (114 loc) · 4.39 KB
/
index.html
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/[email protected]/dist/axios.min.js"></script>
<script src="https://unpkg.com/[email protected]/lodash.min.js"></script>
<link href="style.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Rock+Salt" rel="stylesheet">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body>
<div class="header">
<h1>Pedro responses</h1>
</div>
<div id="app">
<div class="form-initial">
<div :class="mantraForm">
<label class="text" for="question">Realiza la oración:</label>
<i :title="mantra" class="material-icons" style="font-size:15px; margin-top: 7px">help</i>
<input class="question-input" id="mantra" v-model="input" @input="transformInput($event)">
<br>
</div>
<div :class="questionForm">
<label class="text" for="question">Ya que me adoras puedes preguntar:</label>
<input class="question-input" id="question" v-model="question">
</div>
<div class="response-container" :class="response">
<div class="response-header"> Pedro responde: </div>
{{answer}}
</div>
</div>
</div>
<script>
var mantraIndex = 0
var reverseCount = 0
var isInReverse = false
var isCheater = false
mantra ='Pedro te la chupo, responde mi pregunta'
var vm = new Vue({
el: '#app',
data: {
input: '',
answer: '',
question: '',
mantra: mantra,
questionForm: {'hidden-element': true},
mantraForm: {'hidden-element': false},
response: {'hidden-element': true}
},
watch: {
question: function () {
if (this.question.endsWith('?')) {
this.questionForm['hidden-element'] = true
this.mantraForm['hidden-element'] = false
if (!isCheater) {
this.answer = 'No puedo responder ahora'
}
this.response['hidden-element'] = false
this.input = ''
this.question = ''
isCheater = false
mantraIndex = 0
}
}
},
methods: {
transformInput: function (event) {
this.response['hidden-element'] = true
if (this.input.startsWith(".")) {
isCheater = true;
this.input = mantra.charAt(mantraIndex)
mantraIndex++
return
}
if (this.input.endsWith(':')) {
this.response['hidden-element'] = true
if(!isCheater){
if(this.input !== mantra+':'){
this.answer = 'Introduce bien mi oración >:v'
this.response['hidden-element'] = false
return
}
}
this.input = mantra + ':'
this.questionForm['hidden-element'] = false
this.mantraForm['hidden-element'] = true
document.getElementById('question').focus()
return
}
/* if(mantraIndex > mantra.length-1) isInReverse = true
if(reverseCount < 8 && isInReverse){
this.input = this.input.slice(0, -1)
mantraIndex--
reverseCount++
return
}*/
if(mantraIndex > 0){
this.storeSecretInput()
this.input = this.input.slice(0, -1)
this.input = this.input.concat(mantra.charAt(mantraIndex))
mantraIndex++
}
},
storeSecretInput: function() {
this.answer = this.answer.concat(this.input.slice(-1))
}
},
});
</script>
</body>
</html>