-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathstuck.js
138 lines (132 loc) · 3.36 KB
/
stuck.js
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
var script = {
'INITIAL': {
'question': 'Which mode are you in?',
'responses': [
{
'text': 'Normal',
'nextState': 'USER_MODE_NORMAL'
},
{
'text': 'Ex',
'nextState': 'USER_MODE_EX'
},
{
'text': 'Insert/Replace/Visual',
'nextState': 'USER_MODE_NOT_NORMAL'
},
{
'text': 'What does “mode” mean?',
'nextState': 'USER_MODE_DONT_KNOW'
}
]
},
'USER_MODE_NORMAL': {
'question': 'Do you want to save your changes to disk?',
'responses': [
{
'text': 'Yes',
'nextState': 'USER_WANTS_TO_SAVE_CHANGES'
},
{
'text': 'No',
'nextState': 'USER_DOES_NOT_WANT_TO_SAVE_CHANGES'
}
]
},
'USER_MODE_NOT_NORMAL': {
'question': 'We need the “normal” mode first. Press Escape to do that.',
'responses': [
{
'text': 'Done!',
'nextState': 'USER_MODE_NORMAL'
}
]
},
'USER_MODE_EX': {
'question': 'We need the “normal” mode first. Type “visual” to do that.',
'responses': [
{
'text': 'Done!',
'nextState': 'USER_MODE_NORMAL'
}
]
},
'USER_MODE_DONT_KNOW': {
'question': 'What does the bottom line say?',
'responses': [
{
'text': '-- INSERT --',
'nextState': 'USER_MODE_NOT_NORMAL'
},
{
'text': '-- REPLACE --',
'nextState': 'USER_MODE_NOT_NORMAL'
},
{
'text': '-- VISUAL --',
'nextState': 'USER_MODE_NOT_NORMAL'
},
{
'text': ': ',
'nextState': 'USER_MODE_EX'
},
{
'text': 'Nothing',
'nextState': 'USER_MODE_NORMAL'
}
]
},
'USER_WANTS_TO_SAVE_CHANGES': {
'question': 'Type :wqa and hit Enter.',
'responses': [
{
'text': 'Done!',
'nextState': 'USER_DONE'
}
]
},
'USER_DOES_NOT_WANT_TO_SAVE_CHANGES': {
'question': 'Type :qa! and hit Enter.',
'responses': [
{
'text': 'Done!',
'nextState': 'USER_DONE'
}
]
},
'USER_DONE': {
'question': 'You made it! Wasn’t that fun? 🙂',
'responses': [
{
'text': 'Start over!',
'nextState': 'INITIAL'
}
]
}
};
new Vue({
el: '#app',
computed: {
question: function() {
return script[this.state].question;
},
responses: function() {
return script[this.state].responses;
}
},
data: function() {
return {
capsWarning: true,
state: 'INITIAL'
};
},
methods: {
hideCapsWarning() {
this.capsWarning = false;
},
setState(state) {
this.state = state;
this.capsWarning = false;
}
}
})