-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
1990 lines (1552 loc) · 44.2 KB
/
index.html
File metadata and controls
1990 lines (1552 loc) · 44.2 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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WordWanderer – take your text for a walk</title>
<meta property="og:title" content="WordWanderer – take your text for a walk" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="We are experimenting with visual ways in which we can enhance people's engagement with language. By fusing the information we can obtain from corpus searches, concordance outputs and word clouds we are aiming to enable and encourage people to notice and wander through the words they read, write and speak." />
<meta property="og:description" content="We are experimenting with visual ways in which we can enhance people's engagement with language. By fusing the information we can obtain from corpus searches, concordance outputs and word clouds we are aiming to enable and encourage people to notice and wander through the words they read, write and speak." />
<link rel="canonical" href="http://wordwanderer.org" />
<meta property="og:url" content="http://wordwanderer.org" />
<meta property="og:site_name" content="WordWanderer" />
<meta property="og:image" content="http://wordwanderer.org//img/visgif2.gif" />
<meta property="og:type" content="website" />
<link rel="icon" type="image/png" href="favicon.png?v=2">
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/jspos-0.2.2/lexer.js"></script>
<script src="js/jspos-0.2.2/lexicon.js"></script>
<script src="js/jspos-0.2.2/POSTagger.js"></script>
<script src="js/prefixfree.min.js"></script>
<style type="text/css" media="screen">
body {
font-family: "HelveticaNeueLight", "HelveticaNeue-Light", "Helvetica Neue Light", "HelveticaNeue", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
font-weight: 200;
margin: 0;
font-size: 16px;
width: 1000px;
height: 750px;
margin: auto;
background-color: #eee;
overflow-y: scroll;
}
#intro p img {
margin: -10px 10px 10px 175px;
float: left;
border-radius: 5px;
}
* {
xborder: 1px solid #999;
}
a, a:link, a:visited, a:active {
color: #000;
}
h1, h2 {
font-weight: 200;
}
/* INTRO */
#intro {
border: 1px solid transparent;
text-align: center;
position: absolute;
width: 1000px;
height: 750px;
background: #eee url("img/bg.svg") no-repeat top center;
background-size: 1000px 750px;
z-index: 30;
transition: opacity .5s ease-in-out;
}
#intro h1, #intro h2 {
width: 650px;
margin: auto;
padding: 0;
text-align: right;
}
#intro h1 {
font-size: 40px;
line-height: 45px;
margin-top: 25px;
}
#intro h2 {
font-size: 22px;
line-height: 30px;
font-style: italic;
margin-bottom: 50px;
}
#intro p {
margin-top: 30px;
}
p#wanderp {
margin: 30px 0;
padding-top: 0;
}
p#wanderp label {font-size: 14px; }
#wander {
margin-left: 20px;
font-size: 16px;
xfont-weight: bold;
}
#wander.disabled {
}
@keyframes rotate {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
#loading {
width: 20px;
height: 20px;
background: transparent url("img/loading.svg") no-repeat center;
background-size: 15px 15px;
display: inline-block;
opacity: 0;
animation-duration: 1s;
animation-name: rotate;
animation-timing-function: linear;
animation-iteration-count: infinite;
}
#loading.active {
opacity: 1;
}
#intro #tooshort {
visibility: hidden;
margin: 5px 0;
padding: 0;
font-size: 14px;
margin-left: 325px;
}
#intro p.teaser {
clear: both;
margin: auto;
padding-top: 0px;
width: 475px;
padding-right: 175px;
text-align: left;;
height: 190px;
}
#intro #tooshort.active {
visibility: visible;
}
#intro #tooshort.active span {
padding: 3px 6px;
border-radius: 6px;
}
#intro p.tolowercase {
margin-top: 10px;
font-size: 14px;
}
#intro p.tolowercase label {
padding-left: 3px;
}
#textwrap {
width: 1000px;
margin-top: 25px;
}
#selecttext {
width: 200px;
float: left;
margin: auto;
padding-top: 40px;
margin-left: 225px;
text-align: left;
line-height: 20px;
}
#intro p#selecttext {
margin-top: 0;
}
#intro textarea {
font-size: 14px;
resize: none;
width: 300px;
height: 100px;
border: 1px solid #000;
margin: 0;
padding: 2;
margin-top: 0px;
margin-right: 150px
}
#intro #sharebuttons {
margin-top: 60px;
}
#sharebuttons2 {
margin-top: 20px;
}
#sharebuttons .fb-like, #sharebutton twitter-share-button {
width: 95px;
text-align: center;
}
#sharebuttons .fb-like {
display: inline !important;
float: left;
}
#sharebuttons iframe.twitter-share-button {
padding-left: 410px;
float: left;
}
#intro #contact {
margin-top: 0px;
font-size: 12px;
}
/* MAIN */
#header {
margin: auto;
padding: 0;
top: 5px;
position: absolute;
width: 1000px;
height: 50px;
font-size: 36px;
z-index: 20;
}
#header h1 {
font-size: 24px;
line-height: 45px;
margin-top: 2px;
margin-left: 5px;
float: left;
user-select: none;
}
#header h1:hover {
cursor: pointer;
}
#header h2 {
user-select: none;
float: right;
font-size: 16px;
line-height: 45px;
margin-top: 2px;
margin-right: 0px;
text-align: right;
font-weight: normal;
}
#header h2 span {
background-color: #fff;
color: #000;
margin: 0px;
font-size: 16px;
border-radius: 5px;
padding: 2px 4px;
}
#header h2 span:hover {
background-color: #ddd;
xcolor: #fff;
cursor: pointer;
}
#header h2 span.active {
background-color: #000;
color: #fff;
cursor: pointer;
}
#search {
margin: 0px;
font-size: 16px;
display: block;
position: absolute;
margin: auto;
margin-top: 15px;
clear: both;
xpadding: 0 2px;
width: 200px;
left: 400px;
z-index: 21;
}
#suggestions {
overflow: hidden;
white-space: nowrap;
border: 1px solid #000;
width: 200px;
left: 400px;
color: #000;
background-color: #fff;
margin: 0px;
font-size: 16px;
line-height: 20px;
display: block;
position: absolute;
margin: auto;
margin-top: 40px;
padding: 0px;
z-index: 20;
opacity: 0;
box-shadow: 3px 3px 6px rgba(0,0,0,.25);
}
#suggestions div {
padding: 2px 8px;
}
#suggestions:hover div:hover {
cursor: pointer;
xtext-decoration: underline;
background-color: #ddd !important;
}
#suggestions:hover div {
background-color: #fff !important;
}
#suggestions div.active {
background-color: #ddd;
}
#options, #help {
display: none;
margin: auto;
border: 1px solid #000;
position: absolute;
padding: 10px;
margin-top: 45px;
width: 400px;
margin-left: 580px;
background-color: #fff;
box-shadow: 3px 3px 6px rgba(0,0,0,.25);
z-index: 25;
}
#help p {
margin-top: 0px;
margin-bottom: 12px;
}
#help {
width: 525px;
margin-left: 445px;
padding: 15px;
padding-bottom: 0;
}
#help img {
clear: left;
float: left;
padding: 5px 15px 10px 0;
}
#options ul {
padding: 0;
margin: 0;
margin-bottom: 20px;
margin-left: 15px;
float: left;
}
#exclude {
width: 250px;
}
#options p.exclude {
margin-bottom: 5px;
}
#options p {
margin: 0;
margin-bottom: 20px;
padding-left: 4px;
clear: both;
}
#options p.types { margin-bottom: 5px;}
#options p.buttons { margin-bottom: 5px;}
#options ul li {
list-style-type: none;
padding-bottom: 3px;
}
#options ul li label { padding-left: 4px; }
#selectall:hover {
cursor: pointer;
text-decoration: underline;
}
#options.active, #help.active {
display: block;
}
#apply {
xfont-weight: bold;
font-size: 16px;
}
label {
user-select: none;
cursor: pointer;
}
input[type="checkbox"], input[type="submit"] {
cursor: pointer;
}
#options p input {
margin: 0;
margin-right: 10px;
}
#vis, #vis2 {
margin: auto;
top: 60px;
position: absolute;;
width: 1000px;
height: 500px;
border: 1px solid transparent;
font-size: 36px;
z-index: 1;
}
#can {
position: absolute;
top: 60px;
margin: auto;
border: 0px solid transparent;
background-color: #fff;
border-radius: 10px;
z-index: 0;
}
#vis2 {
border: 1px solid #999;
text-align: center;
margin: 0;
position: absolute;
top: -1000px;
overflow: hidden;
left: 0;
background-color: transparent;
opacity: 0;
user-select: none;
}
#vis {
/* background-color: #fff;*/
}
#vis span, #vis2 span {
user-select: none !important;
padding: 0px;
white-space: nowrap;
border-radius: .35em;
border: .1em solid transparent;
}
#vis span {
cursor: pointer !important;
z-index: 1;
color: rgba(0,0,0,.5);
position: absolute;
display: block;
left: 0px;
top: 0px;
transition: transform 1s ease-in-out, opacity ease-in-out 1s, color linear .2s, background linear .2s;
transform-origin: 0% 50%;
tap-highlight-color: transparent;
background: white none no-repeat right center;
background-size: 1em 1em;
}
#vis span.justadded {
opacity: 0;
transition: left 0, top 0, font-size 0, opacity 1s;
transition-delay: 1s;
}
#vis span.toberemoved {
opacity: 0;
transition: opacity .5s;
transition-delay: 0s;
}
#vis span.notlinked {
color: rgba(0,0,0,.15);
xtransition-duration: .25s;
transition-delay: 0s;
}
#vis span.linked {
color: rgba(0,0,0,1);
xtransition-duration: .25s;
transition-delay: 0s;
}
#vis span:hover, #vis span.hover {
display: block;
color: black;
visibility: visible;
background-color: white !important;
border: .1em solid black;
z-index: 10;
xpadding-left: 20px;
xpadding-right: .75em;
xbackground: white url("img/arrow2.svg") no-repeat right center;
xbackground-size: .75em .75em;
}
#vis span.compare:hover, #vis span.compare.hover {
xbackground: white url("img/arrow2.svg") no-repeat right center;
xbackground-size: .75em .75em;
}
#vis span.active, #vis span.active:hover {
z-index: 10;
background-color: black !important;
color: white !important;
xtransform-origin: 50% 50%;
}
#instances {
display: none;
position: absolute;
padding-bottom: 25px;
top: 575px;
width: 1000px;
overflow: hidden;
margin: auto;
text-align: center;
font-size: 14px;
transition: opacity .5s ease-in-out;
user-select: none;
}
#instances.active {
display: block;
}
#instances span {
padding: 2px;
color: #999;
cursor: default;
border: 1px solid transparent;
border-radius: .35em;
}
#instances span.hover {
xtext-decoration: underline;
background-color: #fff;
color: #000;
cursor: pointer;
border: 1px solid #000;
}
#instances div {
white-space: nowrap;
line-height: 25px;
}
#instances div.left {
clear: both;
float: left;
text-align: right;
}
#instances div.middle {
float: left;
text-align: center;
xfont-weight: bold;
}
#instances div.middle span {
color: #000;
}
#instances div.right {
float: right;
text-align: left;
}
#instances div.left { xbackground-color: #FFD2B1;}
#instances div.middle { xbackground-color: #DDE8C7;}
#instances div.right { xbackground-color: #BFD7EA;}
#instances span.ellipsis {
color: #777;
}
#instances span.active {
color: #fff;
background-color: #000;
}
#instances div#showall {
padding-top: 15px;
width: 1000px;
height: 50px;
clear: both;
text-align: center;
}
#instances div#showall span {
border-radius: 5px;
color: #000;
background-color: #fff;
}
#instances div#showall span:hover {
background-color: #ddd;
cursor: pointer;
}
/* HELP */
</style>
</head>
<body>
<div id="intro">
<p><img src="img/visgif2.gif" width=250 height=123 alt="VisGIF"></p>
<h1>WordWanderer</h1>
<h2>take your text for a walk</h2>
<p class="teaser">
We are experimenting with visual ways in which we can enhance people's engagement with language. By fusing the information we can obtain from corpus searches, concordance outputs and word clouds we are aiming to enable and encourage people to notice and wander through the words they read, write and speak.<br><br>
To try an early prototype of the WordWanderer <br>
just select a text below or paste your own and take it for a walk.</p>
<div id="textwrap">
<p id="selecttext">
<select name="selecttext">
<option selected value="own">Your own text →</option>
<optgroup label="Or choose an example text:">
<option value="hanselgretel">Hansel and Gretel (Brothers Grimm)</option>
<!-- <option value="beowulf">Beowulf</option> -->
<option value="gillman">The Yellow Wallpaper (Gillman)</option>
<option value="kafka">In the Penal Colony (Kafka)</option>
<!-- <option value="hesse">Siddhartha (Hesse)</option> -->
<!-- <option value="wilde">Dorian Gray (Wilde)</option> -->
<!-- <option value="conrad">Heart of Darkness (Conrad)</option> -->
<option value="vonnegut">2 B R 0 2 B (Vonnegut)</option>
<option value="borges">The Library of Babel (Borges)</option>
<option value="stevenson">Jekyll & Hyde (Stevenson)</option>
</optgroup>
</select>
</p>
<textarea id="text" placeholder="Paste your text here."></textarea>
</div>
<p id="tooshort"><span></span></p>
<p id="wanderp">
<input checked type="checkbox" id="lowercase" /> <label for="lowercase">turn text to lower case</label><br>
<input type="submit" class="disabled" name="wander" value="wander" id="wander">
<span id="loading"> </span></p>
<p id="contact">
By <a href="http://mariandoerk.de/">Marian Dörk</a> and <a href="https://www.cardiff.ac.uk/people/view/142032-knight-dawn">Dawn Knight</a> carried out when at <a href="https://www.ncl.ac.uk">Newcastle University</a><br>
funded by the RCUK Digital Economy programme’s <a href="http://www.patina.ac.uk/">PATINA project</a>.<br>
More details about the concept and methods are in this <a href="http://mariandoerk.de/wordwanderer/corpora2015.pdf">article</a>.<br>
The code of the WordWanderer prototype is on <a href="https://github.com/nrchtct/WordWanderer">GitHub</a>.
</p>
</div>
<div id="header">
<h1>WordWanderer</h1>
<h2>
<span id="options_button">Options</span>
<span id="help_button">Help</span>
</h2>
<input type="search" id="search" name="search" placeholder="search for words">
<div id="suggestions"> </div>
</div>
<div id="vis"></div>
<div id="vis2"></div>
<canvas id="can" width="1000" height="500"></canvas>
<div class="" id="help">
<p>The WordWanderer interface has three main views:</p>
<img src="img/view0.svg" width=150 alt="cloud view">
<p>The cloud view displays the most common words of a text using font size
to represent relative frequencies.
The ordering of the words is alphabetical from top to bottom, left to right. When hovering over a word, its relationship with other words, in terms of their rate of proximal co-occurrence in a text, are highlighted in colour.</p>
<img src="img/view1.svg" width=150 alt="context view">
<p>Clicking on a word selects it for the context view.
The word sizing corresponds to how often they occurr in the text near
the selected word: the larger the word, the stronger the association between the words and the selected term.
Vertical positioning is alphabetical and horizontal positioning represents sentence positions relative to the selected word.</p>
<img src="img/view2.svg" width=150 alt="comparison view">
<p>Dragging a line between two words triggers the comparison view.
In this view a word's size corresponds to the combined association strength with the two words.
Here, the horizontal position represents the difference in association between the two selected words.
If a word occurs more often with the left word, it will be placed more towards the left side of the screen.</p>
<p>All views show a limited a number of words. To find a specific word there is a search
function above the visualization. Simply type in a word and hit enter to activate this function. In the options (top right), you can set which types of words are included, based on their parts of speech.
When in context view, the instances of the selected word are displayed below the visualization.</p>
<div id="sharebuttons2">
</div>
</div>
<div class="" id="options">
<p class='types'><strong>Show</strong> (<span id="selectall">select all</span>)</p>
<ul>
<li> <input checked type="checkbox" id="type_JJ" /><label for="type_JJ">Adjectives</label></li>
<li> <input checked type="checkbox" id="type_RR" /><label for="type_RR">Adverbs</label></li>
<li> <input checked type="checkbox" id="type_NN" /><label for="type_NN">Nouns</label></li>
<li> <input checked type="checkbox" id="type_VV" /><label for="type_VV">Verbs</label></li>
</ul>
<ul>
<li> <input checked type="checkbox" id="type_CC" /><label for="type_CC">Conjunctions</label></li>
<li> <input checked type="checkbox" id="type_DD" /><label for="type_DD">Determiners</label></li>
<li> <input checked type="checkbox" id="type_II" /><label for="type_II">Prepositions</label></li>
<li> <input checked type="checkbox" id="type_PP" /><label for="type_PP">Pronouns</label></li>
</ul>
<ul>
<li> <input type="checkbox" id="type_PU" /><label for="type_PU">Punctuation</label></li>
<li> <input type="checkbox" id="type_MC" /><label for="type_MC">Numbers</label></li>
<li> <input type="checkbox" id="type_SY" /><label for="type_SY">Symbols</label></li>
<li> <input type="checkbox" id="type_FU" /><label for="type_FU">Other</label></li>
</ul>
<p class='exclude'><strong>Hide</strong> </p>
<ul>
<li> <input checked type="checkbox" id="stopwords" /><label for="stopwords">Common words such as: the, is, at, in, and of</label> </li>
<li> <input type="checkbox" id="excludeopt" /> <input id="exclude" placeholder="enter words separated by space" name="exclude">
</ul>
<p class='buttons'>
<input type="submit" name="apply" value="Apply" id="apply">
</p>
</div>
<div id="instances">
</div>
<div id="post">
</div>
<script>
var beyondhome = false;
var sourcetext = "";
// config
var windowside = 10;
var limit = 300; // for cloud
var limit_context = 100; // for context
var limit_compare = 100; // per word
var snippetlimit = 10;
var lowercase = true;
var baseurl = document.URL.split("#")[0];
var Words = {};
var words = [];
var indices = {};
var selection = [];
var suggestions = [];
var suggestionindex = 0;
var hoverTimeout = null;
var worddist = 5;
var wordmap = {};
var maxcount = 0;
var active = [];
var min_text_length = 50;
$("#tooshort").html("<span>Please paste at least "+min_text_length+" words.</span>");
var canel = document.getElementById("can");
var can = canel.getContext("2d");
// make sure text is long enough
function check_text() {
var text = $("#text").val();
var textA = text.split(" ");;
var textchoice = $('#selecttext select').prop("value");
if (textA.length < min_text_length && textchoice=="own") {
$("#tooshort").addClass("active");
$("#wander").addClass("disabled");
}
else {
$("#tooshort").removeClass("active");
$("#wander").removeClass('disabled');
}
}
$("#text").unbind().change(check_text);
$("#wander").unbind().mouseover(check_text)
$("#wander").click(function(){
var text = $("#text").val();
var textA = text.split(" ");;
var textchoice = $('#selecttext select').prop("value");
if (textA.length > min_text_length || textchoice!="own") {
$("#loading").addClass("active");
if (textchoice=='own') setTimeout(function(){
sourcetext = text;
analyse();
}, 10);
else jQuery.get(baseurl+"texts/"+textchoice+".txt", function(data){
sourcetext = data;
analyse();
});
}
})
function events() {
// general events
$(document).unbind().keyup(function(e) {
// return
if (e.keyCode == 13) {
if ($("#options").hasClass("active")) {
apply();
}
$("#exclude").blur();
}
// escape
else if (e.keyCode == 27) {
if ($("#options").hasClass("active")) options();
if ($("#help").hasClass("active")) help();
if ($("#search").is(":focus")) {
suggest();
$("#search").blur();
}
else if (active.length>0) {
$(".active").addClass("hover");
active = [];
layout();
}
}
});
$("#selectall").unbind().click(function(){
var types = ["JJ", "RR", "CC", "DD", "NN", "MC", "II", "PP", "PU", "SY", "FU", "VV"];
for (var i=0; i < types.length; i+=1) {
$("#type_"+types[i]).prop("checked", true);
}
})
$("#search").unbind().keyup(function(e){
$("#suggestions div.active").removeClass("active");
// return
if (e.keyCode==13) {
var index = parseInt($($("#suggestions div")[suggestionindex]).prop("id").split("s_")[1]);
$("#search").blur();
active = [index];
layout();
}
else if (e.keyCode==38 || e.keyCode==40) {
var suglength = $("#suggestions div").length;
if (e.keyCode==38) suggestionindex--;
else if (e.keyCode==40) suggestionindex++;
if (suggestionindex < 0) suggestionindex = suglength-1;
else if (suggestionindex > suglength-1) suggestionindex = 0;
$($("#suggestions div")[suggestionindex]).addClass("active");
// highlight selection
var index = parseInt($($("#suggestions div")[suggestionindex]).prop("id").split("s_")[1]);
hover();
hover(index);
}
else suggest($("#search").val());
});
$("#exclude").unbind().keyup(function(){
var txt = $(this).val();
if (txt.length>0) $("#excludeopt").prop("checked", true);
});
$("#apply").unbind().click(apply);
$("#header h1").unbind().click(home);
$("#options_button").unbind().click(function(e){options();});
$("#help_button").unbind().click(function(e){help();});
}
function options(show) {
if (typeof show === "undefined") {
if ($("#options").hasClass('active')) show = false;
else show = true;
}
// show
if (show) {
help(false);
suggest();
$("#exclude").focus();
$("#options_button").addClass('active');
$("#options").addClass('active');
}
// hide
else {
$("#options_button").removeClass('active');
$("#options").removeClass('active');
}
}
function help(show) {