-
Notifications
You must be signed in to change notification settings - Fork 165
/
browser.js
230 lines (223 loc) · 12 KB
/
browser.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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import balloon from "./lib/balloon";
import replacer from "./lib/replacer";
import faces from "./lib/faces";
import DEFAULT_COW from './cows/default.cow';
export { default as ACKBAR } from './cows/ackbar.cow';
export { default as APERTURE_BLANK } from './cows/aperture-blank.cow';
export { default as APERTURE } from './cows/aperture.cow';
export { default as ARMADILLO } from './cows/armadillo.cow';
export { default as ATAT } from './cows/atat.cow';
export { default as ATOM } from './cows/atom.cow';
export { default as AWESOME_FACE } from './cows/awesome-face.cow';
export { default as BANANA } from './cows/banana.cow';
export { default as BEARFACE } from './cows/bearface.cow';
export { default as BEAVIS_ZEN } from './cows/beavis.zen.cow';
export { default as BEES } from './cows/bees.cow';
export { default as BILL_THE_CAT } from './cows/bill-the-cat.cow';
export { default as BIOHAZARD } from './cows/biohazard.cow';
export { default as BISHOP } from './cows/bishop.cow';
export { default as BLACK_MESA } from './cows/black-mesa.cow';
export { default as BONG } from './cows/bong.cow';
export { default as BOX } from './cows/box.cow';
export { default as BROKEN_HEART } from './cows/broken-heart.cow';
export { default as BUD_FROGS } from './cows/bud-frogs.cow';
export { default as BUNNY } from './cows/bunny.cow';
export { default as C3PO } from './cows/C3PO.cow';
export { default as CAKE } from './cows/cake.cow';
export { default as CAKE_WITH_CANDLES } from './cows/cake-with-candles.cow';
export { default as CAT2 } from './cows/cat2.cow';
export { default as CAT } from './cows/cat.cow';
export { default as CATFENCE } from './cows/catfence.cow';
export { default as CHARIZARDVICE } from './cows/charizardvice.cow';
export { default as CHARLIE } from './cows/charlie.cow';
export { default as CHEESE } from './cows/cheese.cow';
export { default as CHESSMEN } from './cows/chessmen.cow';
export { default as CHITO } from './cows/chito.cow';
export { default as CLAW_ARM } from './cows/claw-arm.cow';
export { default as CLIPPY } from './cows/clippy.cow';
export { default as COMPANION_CUBE } from './cows/companion-cube.cow';
export { default as COWER } from './cows/cower.cow';
export { default as COWFEE } from './cows/cowfee.cow';
export { default as CTHULHU_MINI } from './cows/cthulhu-mini.cow';
export { default as CUBE } from './cows/cube.cow';
export { default as DAEMON } from './cows/daemon.cow';
export { default as DALEK } from './cows/dalek.cow';
export { default as DALEK_SHOOTING } from './cows/dalek-shooting.cow';
export { default as DEFAULT } from './cows/default.cow';
export { default as DOCKER_WHALE } from './cows/docker-whale.cow';
export { default as DOGE } from './cows/doge.cow';
export { default as DOLPHIN } from './cows/dolphin.cow';
export { default as DRAGON_AND_COW } from './cows/dragon-and-cow.cow';
export { default as DRAGON } from './cows/dragon.cow';
export { default as EBI_FURAI } from './cows/ebi_furai.cow';
export { default as ELEPHANT2 } from './cows/elephant2.cow';
export { default as ELEPHANT } from './cows/elephant.cow';
export { default as ELEPHANT_IN_SNAKE } from './cows/elephant-in-snake.cow';
export { default as EXPLOSION } from './cows/explosion.cow';
export { default as EYES } from './cows/eyes.cow';
export { default as FAT_BANANA } from './cows/fat-banana.cow';
export { default as FAT_COW } from './cows/fat-cow.cow';
export { default as FENCE } from './cows/fence.cow';
export { default as FIRE } from './cows/fire.cow';
export { default as FLAMING_SHEEP } from './cows/flaming-sheep.cow';
export { default as FOX } from './cows/fox.cow';
export { default as GHOSTBUSTERS } from './cows/ghostbusters.cow';
export { default as GHOST } from './cows/ghost.cow';
export { default as GLADOS } from './cows/glados.cow';
export { default as GOAT2 } from './cows/goat2.cow';
export { default as GOAT } from './cows/goat.cow';
export { default as GOLDEN_EAGLE } from './cows/golden-eagle.cow';
export { default as HAND } from './cows/hand.cow';
export { default as HAPPY_WHALE } from './cows/happy-whale.cow';
export { default as HEDGEHOG } from './cows/hedgehog.cow';
export { default as HELLOKITTY } from './cows/hellokitty.cow';
export { default as HIPPIE } from './cows/hippie.cow';
export { default as HIYA } from './cows/hiya.cow';
export { default as HIYOKO } from './cows/hiyoko.cow';
export { default as HOMER } from './cows/homer.cow';
export { default as HYPNO } from './cows/hypno.cow';
export { default as IBM } from './cows/ibm.cow';
export { default as IWASHI } from './cows/iwashi.cow';
export { default as JELLYFISH } from './cows/jellyfish.cow';
export { default as KARL_MARX } from './cows/karl_marx.cow';
export { default as KILROY } from './cows/kilroy.cow';
export { default as KING } from './cows/king.cow';
export { default as KISS } from './cows/kiss.cow';
export { default as KITTEN } from './cows/kitten.cow';
export { default as KITTY } from './cows/kitty.cow';
export { default as KNIGHT } from './cows/knight.cow';
export { default as KOALA } from './cows/koala.cow';
export { default as KOSH } from './cows/kosh.cow';
export { default as LAMB2 } from './cows/lamb2.cow';
export { default as LAMB } from './cows/lamb.cow';
export { default as LIGHTBULB } from './cows/lightbulb.cow';
export { default as LOBSTER } from './cows/lobster.cow';
export { default as LOLLERSKATES } from './cows/lollerskates.cow';
export { default as LUKE_KOALA } from './cows/luke-koala.cow';
export { default as MAILCHIMP } from './cows/mailchimp.cow';
export { default as MAZE_RUNNER } from './cows/maze-runner.cow';
export { default as MECH_AND_COW } from './cows/mech-and-cow.cow';
export { default as MEOW } from './cows/meow.cow';
export { default as MILK } from './cows/milk.cow';
export { default as MINOTAUR } from './cows/minotaur.cow';
export { default as MONA_LISA } from './cows/mona-lisa.cow';
export { default as MOOFASA } from './cows/moofasa.cow';
export { default as MOOGHIDJIRAH } from './cows/mooghidjirah.cow';
export { default as MOOJIRA } from './cows/moojira.cow';
export { default as MOOSE } from './cows/moose.cow';
export { default as MULE } from './cows/mule.cow';
export { default as MUTILATED } from './cows/mutilated.cow';
export { default as NYAN } from './cows/nyan.cow';
export { default as OCTOPUS } from './cows/octopus.cow';
export { default as OKAZU } from './cows/okazu.cow';
export { default as OWL } from './cows/owl.cow';
export { default as PAWN } from './cows/pawn.cow';
export { default as PERIODIC_TABLE } from './cows/periodic-table.cow';
export { default as PERSONALITY_SPHERE } from './cows/personality-sphere.cow';
export { default as PINBALL_MACHINE } from './cows/pinball-machine.cow';
export { default as PSYCHIATRICHELP2 } from './cows/psychiatrichelp2.cow';
export { default as PSYCHIATRICHELP } from './cows/psychiatrichelp.cow';
export { default as PTERODACTYL } from './cows/pterodactyl.cow';
export { default as QUEEN } from './cows/queen.cow';
export { default as R2_D2 } from './cows/R2-D2.cow';
export { default as RADIO } from './cows/radio.cow';
export { default as REN } from './cows/ren.cow';
export { default as RENGE } from './cows/renge.cow';
export { default as ROBOT } from './cows/robot.cow';
export { default as ROBOTFINDSKITTEN } from './cows/robotfindskitten.cow';
export { default as ROFLCOPTER } from './cows/roflcopter.cow';
export { default as ROOK } from './cows/rook.cow';
export { default as SACHIKO } from './cows/sachiko.cow';
export { default as SATANIC } from './cows/satanic.cow';
export { default as SEAHORSE_BIG } from './cows/seahorse-big.cow';
export { default as SEAHORSE } from './cows/seahorse.cow';
export { default as SHEEP } from './cows/sheep.cow';
export { default as SHIKATO } from './cows/shikato.cow';
export { default as SHRUG } from './cows/shrug.cow';
export { default as SKELETON } from './cows/skeleton.cow';
export { default as SMALL } from './cows/small.cow';
export { default as SMILING_OCTOPUS } from './cows/smiling-octopus.cow';
export { default as SNOOPY } from './cows/snoopy.cow';
export { default as SNOOPYHOUSE } from './cows/snoopyhouse.cow';
export { default as SNOOPYSLEEP } from './cows/snoopysleep.cow';
export { default as SPIDERCOW } from './cows/spidercow.cow';
export { default as SQUID } from './cows/squid.cow';
export { default as SQUIRREL } from './cows/squirrel.cow';
export { default as STEGOSAURUS } from './cows/stegosaurus.cow';
export { default as STIMPY } from './cows/stimpy.cow';
export { default as SUDOWOODO } from './cows/sudowoodo.cow';
export { default as SUPERMILKER } from './cows/supermilker.cow';
export { default as SURGERY } from './cows/surgery.cow';
export { default as TABLEFLIP } from './cows/tableflip.cow';
export { default as TAXI } from './cows/taxi.cow';
export { default as TELEBEARS } from './cows/telebears.cow';
export { default as TEMPLATE } from './cows/template.cow';
export { default as THREADER } from './cows/threader.cow';
export { default as THREECUBES } from './cows/threecubes.cow';
export { default as TOASTER } from './cows/toaster.cow';
export { default as TORTOISE } from './cows/tortoise.cow';
export { default as TURKEY } from './cows/turkey.cow';
export { default as TURTLE } from './cows/turtle.cow';
export { default as TUX_BIG } from './cows/tux-big.cow';
export { default as TUX } from './cows/tux.cow';
export { default as TWEETY_BIRD } from './cows/tweety-bird.cow';
export { default as USA } from './cows/USA.cow';
export { default as VADER } from './cows/vader.cow';
export { default as VADER_KOALA } from './cows/vader-koala.cow';
export { default as WEEPING_ANGEL } from './cows/weeping-angel.cow';
export { default as WHALE } from './cows/whale.cow';
export { default as WIZARD } from './cows/wizard.cow';
export { default as WOOD } from './cows/wood.cow';
export { default as WORLD } from './cows/world.cow';
export { default as WWW } from './cows/www.cow';
export { default as YASUNA_01 } from './cows/yasuna_01.cow';
export { default as YASUNA_02 } from './cows/yasuna_02.cow';
export { default as YASUNA_03A } from './cows/yasuna_03a.cow';
export { default as YASUNA_03 } from './cows/yasuna_03.cow';
export { default as YASUNA_04 } from './cows/yasuna_04.cow';
export { default as YASUNA_05 } from './cows/yasuna_05.cow';
export { default as YASUNA_06 } from './cows/yasuna_06.cow';
export { default as YASUNA_07 } from './cows/yasuna_07.cow';
export { default as YASUNA_08 } from './cows/yasuna_08.cow';
export { default as YASUNA_09 } from './cows/yasuna_09.cow';
export { default as YASUNA_10 } from './cows/yasuna_10.cow';
export { default as YASUNA_11 } from './cows/yasuna_11.cow';
export { default as YASUNA_12 } from './cows/yasuna_12.cow';
export { default as YASUNA_13 } from './cows/yasuna_13.cow';
export { default as YASUNA_14 } from './cows/yasuna_14.cow';
export { default as YASUNA_16 } from './cows/yasuna_16.cow';
export { default as YASUNA_17 } from './cows/yasuna_17.cow';
export { default as YASUNA_18 } from './cows/yasuna_18.cow';
export { default as YASUNA_19 } from './cows/yasuna_19.cow';
export { default as YASUNA_20 } from './cows/yasuna_20.cow';
export { default as YMD_UDON } from './cows/ymd_udon.cow';
export { default as ZEN_NOH_MILK } from './cows/zen-noh-milk.cow';
function convertToCliOptions(browserOptions) {
const cliOptions = {
e: browserOptions.eyes || 'oo',
T: browserOptions.tongue || ' ',
n: browserOptions.wrap,
W: browserOptions.wrapLength || 40,
text: browserOptions.text || '',
_: browserOptions.text || [],
f: browserOptions.cow,
};
if (browserOptions.mode) {
// converts mode: 'b' to b: true
cliOptions[browserOptions.mode] = true;
}
return cliOptions;
}
function doIt (options, sayAloud) {
const cow = options.f || DEFAULT_COW;
const face = faces(options);
face.thoughts = sayAloud ? "\\" : "o";
const action = sayAloud ? "say" : "think";
return balloon[action](options.text || options._.join(" "), options.n ? null : options.W) + "\n" + replacer(cow, face);
}
export function say(browserOptions) {
return doIt(convertToCliOptions(browserOptions), true);
}
export function think(browserOptions) {
return doIt(convertToCliOptions(browserOptions), false);
}