-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathjQuery_cheerio.javascript.txt
1492 lines (1388 loc) · 128 KB
/
jQuery_cheerio.javascript.txt
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
┏━━━━━━━━━━━━━━━━━━━━┓
┃ JQUERY_CHEERIO ┃
┗━━━━━━━━━━━━━━━━━━━━┛
┌─────────────┐
│ CHEERIO │
└─────────────┘
VERSION ==> ##Node module (0.16.0)
##Lightweight, server-side version of jQuery
CHEERIO.load(HTMLSTR[_ARR][,OBJ]) ##Returns a JC: usually assigned to $.
##OBJ members:
## - ignoreWhitespaces (déf: true): erase blank text nodes
JC(SELECTOR) ##Returns a OBJ:
## - similar to JQ (chaining and encapsulating several elements)
## - borrows JQ methods marked with ## below
┌─────────────┐
│ GENERAL │
└─────────────┘
WHY ==> #jQuery is much slower than native JavaScript.
#querySelector() can offer alternative to $().
#Use jQuery only when needed.
#Version 2.0.2
HOW ==> #Either :
# - Just include it in <head>
# - use a CDN :
# - include script src to
# "http://ajax.googleapis.com/ajax/libs/jquery/VERSION/jquery.min.js"
# VERSION is currently 2.0.2
# - why :
# - faster server
# - probably cached in client browser
# - provide a fallback if CDN fails :
# - follow CDN tag immediately by :
# <script>window.jQuery ||
# document.write('<script src="URL"><\/script>')</script>
# - où URL est une copie de jQuery en local.
SIZZLE ==> #Sizzle est l'ensemble de selector fonctions, automatiquement inclus.
JQUERY UI ==> #Depends on jQuery.
#Can download custom build or CDN.
#CDN : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"
#Can be downloaded from website with chosen themes. Download contains:
# - Useless: development_bundle/, index.html, jQuery JavaScript file
# - jQuery UI JavaScript file (minified or not): to be linked
# - jQuery UI CSS file (minified or not): to be linked
# - jQuery UI images/: referenced by CSS file (should be in same DIR, or
# change references in the CSS file)
#Current version : 1.10
#Indicated when jQuery UI is needed.
PLOBJ #Designates a plain object, i.e. a OBJ (prototype Object, not derived).
#Its VAR: VAL... are being used.
JQ.jquery #Version as STR
jQuery.noConflict() #$ is a shortcut but it conflicts with other libraries using the same
#convention (such as Prototype). To use both of those libraries, either :
# - before using jQuery, do :
# var VAR = jQuery.noConflict();
# and use VAR instead of $
# - invoque jQuery.noConflict() and give one argument VAR to ready event
# handler definition, and passing jQuery as argument :
# jQuery.noConflict();
# $( function( VAR ) { ... } )( jQuery );
# With this method, VAR can still be $
#Watch out when mixing libraries/addons based on competing libraries.
jQuery #JQuery base type (constructor), raccourci JQ dans doc.
$ #There are three kinds of functions :
# - $() : selector.
# - JQ.FUNC() : fonction on JQ.
# - $.FUNC() : fonction not on JQ
#All FUNC generally return a JQ, so chaining is possible : $().FUNC().FUNC2()
#When it's not the case :
# - When it's an obvious getter. Often setters will still return a JQ.
# - or I specify it.
#JQ is an array-like of ELEM :
# - JQ.FUNC() exécute FUNC for each item, and potentially return another JQ
# with all items.
# - convention est que VAR contenant une JQ commence par "$", e.g. "$VAR"
# - deux JQ ne sont jamais ==
ELEM #Some FUNC return/work with DOM elements, as opposed to JQ.
#They are noted "ELEM".
JQ.length #Nombre d'items dans JQ
JQ.get()
JQ.toArray() ##Renvoie JQ sous forme d'ELEM_ARR.
JQ.get(INT) #Renvoie l'ELEM numéro INT de JQ (si négatif, depuis la fin). 0-based index.
JQ[UINT] #Renvoie undefined si out-of-length.
JQ.eq(INT) ##Same as JQ.get(), mais renvoie JQ, non ELEM.
##Renvoie empty JQ si out-of-length.
JQ.first|last() ##Same as JQ.eq(1|-1)
JQ.slice(INT[, INT2]) #Renvoie items de JQ.eq(INT) à JQ.eq(INT2), exclus (déf: -1).
#Si second item avant premier, empty JQ.
┌───────────────┐
│ SELECTORS │
└───────────────┘
$() #Renvoie un empty JQ.
$(JQ) #Clone JQ et renvoie JQ2
$(ELEM[_ARRAY]) #Convertie un ELEM[_ARRAY] en JQ
$(STR[, ELEM|DOCUMENT|JQ]) #Renvoie ensemble des items de ARG2 (déf: DOCUMENT courant), filtré par
#sélector STR :
# - all standards possible, except :
# - :active, :hover, :link, :visited (but event handlers can replace some)
# - pseudo-element
# - new CSS4 selectors
# - selectors namespaces
# - combinaisons de sélectors possibles
# - escape characters :
# - "" -> '', e.g. [VAR^='VAL']
# - any non [:alnum:] -> escaped by \\, e.g. #an\\.id
# - see CSS doc for difference with querySelector[All]()
# - selectors non standards (listed below)
# - It's better to use those selectors with a JQ.filter() after $(), for
# performance reasons.
[ATTR!="STR"] #ATTR value !== "STR" (including nothing)
:data(STR) #Like [data-STR], but having used JQ.data(STR) (jQuery UI)
:selected #ELEM.selected
:input #<input>, <button>, <textarea>, <select>, <optgroup>, <option>, <label>,
#<fieldset>, etc.
:button|checkbox|file|image|password|radio|
reset|submit|text #Like [type="button|checkbox|file|image|password|radio|reset|submit|text"]
:header #<h*> (not <hgroup>)
:odd|even #Same as :nth-child(odd|even)
:parent #Has child
:eq(INT)
:lt|gt(INT)
:first|last #Of all the matching elements
:focusable|tabbable #(jQuery UI)
:animated #Currently animated
:hidden|visible #Not taking any space, e.g.:
# - diplay: none
# - width|height === 0
# - <input type="hidden">
# - hidden ancestor
#Does not cover invisible but taking space (e.g. 'transparent' or visibility: hidden)
:contains('STR') #A TEXT descendant contains STR
:has(...) #Like JQ.has(...)
$(STR[, DOCUMENT|PLOBJ]) #STR doit représenter du code HTML. Parse (via .innerHTML) et crée ELEM,
#converti ensuite en JQ.
#TEXT au début et fin de STR sont extraits comme des STR au début/fin du JQ
#renvoyé.
#Si DOCUMENT, fait que .ownerDocument est DOCUMENT (déf: DOCUMENT dans lequel
#jQuery a été loaded (same as null)).
#Si PLOBJ :
# - HTML élément doit être empty (juste l'empty tag ou start/end tags)
# - les propriétés de PLOBJ sont ajoutés comme attributs à l'ELEM créé
# - attention propriété class doit être entouré de "" (car keyword JavaScript)
$.parseHTML(STR[, DOCUMENT[, BOOL]]) #Same as $(STR[, DOCUMENT]), mais si false (déf), supprime <script> non-vide
#(mais pas les event handlers).
JQ.filter(STR|FUNC|ELEM|JQ) ##Ne garde que les items :
## - STR : matchant le CSS selector STR (same selectors as $(STR))
## - FUNC : renvoyant true pour FUNC(UINT), où UINT est l'index et this
## l'ELEM courant.
## - ELEM|JQ : identiques à VAR ou à l'un des items de JQ ou ELEM_ARRAY.
$.grep(ARRAY,FUNC[, BOOL]) #Equivaut à un ARRAY.filter(FUNC), si ARRAY.filter existait. Ou, si true, à un
#ARRAY.not(FUNC)
JQ.not(...) #Comme JQ.filter(...), mais inversé.
JQ.has(...) #Ne garde que les items dont un descendant matche JQ.filter(...)
#JQ.has(FUNC) ne marche pas.
JQ.is(...) #Renvoie false si JQ.filter(...) renvoie un empty JQ.
JQ.children([STR]) ##Renvoie enfants directs (TEXT exclus).
##If STR, effectue un JQ.filter(STR) afterwards.
JQ.contents() #Comme JQ.children(), mais TEXT inclus.
JQ.find(STR|ELEM|JQ) ##Renvoie descendants renvoyant true à JQ.is(...)
$.contains(ELEM,ELEM2) ##Renvoie true si ELEM2 (TEXT exclus) est un descendant d'ELEM.
JQ.parent([STR]) ##Comme JQ.children(), mais pour parent direct.
JQ.parents([STR]) #Pareil, mais renvoie ensemble des ancêtres.
#Par ailleurs, JQ(HTML).parent() renvoie DOCUMENT, et .parents() renvoie empty
#JQ.
JQ.parentsUntil([STR2|ELEM|JQ[, STR]]) #Comme JQ.parents(), mais s'arrête à l'ancêtre filtré par JQ.filter(...),
#exclus.
JQ.root() ##Only Cheerio
JQ.closest([STR|JQ|ELEM]) #Renvoie premier ancêtre (en commençant par item lui-même) renvoyant true à
#JQ.is(...)
JQ.siblings([STR]) ##Comme JQ.children(), mais pour siblings (JQ item exclus).
JQ.next|prev([STR]) ##Pareil, mais seulement previous/next sibling. Empty JQ si first/last sibling.
JQ.next|prevAll([STR]) #Comme JQ.children(), mais seulement pour next/previous siblings.
JQ.next|prevUntil([STR2|ELEM|JQ[, STR]]) #Comme JQ.next|prevAll(), mais même filtre que JQ.parentsUntil()
JQ.index() #Position de JQ au sein de ses siblings (TEXT exclus)
JQ.index(ELEM|JQ2) #Position d'ELEM|JQ2 au sein de JQ, ou -1 si pas partie.
JQ.end() #JQ.FUNC().end() renvoie JQ.
#Permet d'effectuer FUNC() puis de revenir à JQ avant le filtre effectué par
#FUNC().
JQ.add(...) #Rajoute items $(...) à JQ. Undefined order, and removes duplicates.
JQ.addBack([STR]) #Rajoute JQ.end() item à JQ.
#STR est un éventuel selector filtre sur JQ.end().
┌──────────────────┐
│ MANIPULATION │
└──────────────────┘
JQ.insertBefore|After(STR|ELEM|JQ) #Move JQ before|after the element designated by the argument :
# - STR can be a selector or an HTML string
# - if multiple targets are chosen by the argument, it moves copies of JQ
# after each target (and removes initial place of JQ)
#Works also on nodes detached from the document.
JQ.prepend|appendTo(...) #Comme insertBefore|After(...), mais move as the first/ladt child of the
#target(s).
JQ.after|before|prepend|append ##Comme insertBefore|after et prepend|appendTo, sauf que la target est ici JQ,
(FUNC|STR|ELEM[_ARR]|JQ...) ##et l'élement to move l'argument.
##Notes :
## - STR can only be a HTML string, not a selector : just do $(STR)
## - FUNC(UINT) returns the element to be added, where UINT is the index in JQ
## and this l'ELEM
## - ELEM_ARR : not on first arg
JQ.wrap[Inner|All](FUNC|STR|ELEM|JQ) #Insert copy of the argument as the direct parent of JQ.
#If the argument has several innermost elements, choose the first one as the
#parent of JQ.
#Argument and target should designate only one element.
# - wrapInner() doesn't target JQ, but only its children (exclude the element
# tags)
# - wrapAll() :
# - use concaténation of JQ as target. Items in JQ should be neighbor
# elements.
# - cannot take FUNC
JQ.unwrap() #Same as JQ.parent().remove()
JQ.remove([STR]) ##Remove items and returns it.
##If STR, effectue un JQ.filter(STR) before.
JQ.detach([STR]) #Same, but keeps jQuery event handlers and data()
JQ.empty() ##Remove all children (including TEXT). Returns JQ.
JQ.replaceWith(FUNC|STR|ELEM|JQ) ##Replace JQ by argument (move, not copy), and returns former JQ
##STR can't be a selector, only HTML string.
JQ.replaceAll(STR|ELEM|JQ) #Inverse : replace argument by JQ (move, not copy).
#Si plusieurs items dans JQ, concaténation des items.
#Renvoie new version d'argument.
#STR can't be HTML string, only selector.
JQ.clone([BOOL[, BOOL2]]) ##Renvoie une copie de JQ.
##Si BOOL true (déf: false), comprend event handlers et jQuery data.
##Data are referenced, not copied.
##Si BOOL2 true (déf: same as BOOL), comprend event handlers/data des children
##également.
$.isWindow(VAL) #True if WINDOW
JQ.focus(UINT[, FUNC()]) #Like setTimeout() + ELEM.focus() (jQuery UI)
┌────────────────┐
│ DIMENSIONS │
└────────────────┘
DIMENSIONS ==> #Unless specified (see CSS doc):
# - WINDOW|HTML|BODY: layout dimensions
# - ELEM: visual dimensions
# - all: include scrollbar
JQ.outerHeight|Width(true) #Margin-box
JQ.outerHeight|Width(false) #Border-box
JQ.innerHeight|Width() #Padding-box
JQ.css('height|width'[, VAL|FUNC]) #Content-box
JQ.height|width([VAL|FUNC]) #Content-box
#Same as JS.css('height|width') but:
# - return NUM instead of STR
# - doesn't take box-sizing into account
┌──────────────┐
│ POSITION │
└──────────────┘
JQ.offset([OBJ2|FUNC])->OBJ #Same as getBoundingClientRect() but:
# - OBJ only: left|right
# - can be set
# - doesn't work on hidden objects
JQ.offsetParent()->JQ2 #Same as HTMLELEM.offsetParent except BODY|null -> HTML
JQ.position([OBJ2])->OBJ #Same as HTMLELEM.offsetTop|Left except:
# - OBJ only: left|top
# - can be set
# - doesn't work on hidden objects
# - does not use ELEM.offsetParent but union of border boxes of JQ.offsetParent()'s children
#OBJ2 (jQuery UI):
# - of SELECTOR|MOUSEEVENT
# - my|at POSITION (def: center): put JQ's MY at same place as OF's AT
# - within (def: WINDOW)
# - collision STR: if positionned outside of WITHIN, continue progression from:
# - "none": same side
# - "flip" (def): opposite side once
# - "flipfit": opposite back and forth
# - "fit": stop
# - using(MY.offset(), OBJ3): does not do any positioning (let this function do it):
# - OBJ3:
# - element|target (MY|AT): left|top, width|height, element JQ
# - horizontal|vertical DIRECTION: according to MY
# - important 'horizontal|vertical'
# - this is ELEM
┌───────────────┐
│ SCROLLING │
└───────────────┘
JQ.scrollParent()->JQ2 #Parent JQ will scroll into (jQuery UI)
JQ.scrollLeft|Top()->NUM #ELEM.scrollLeft|Top or WINDOW.pageX|YOffset
┌────────────────┐
│ ATTRIBUTES │
└────────────────┘
JQ.attr(STR) ##Get the HTML attribute STR of the first item in JQ. undefined si non-set.
##To get all attributes, use :
## JQ.map(function(){ return $(this).attr(STR); })[.get()]
JQ.attr(STR, NUM|STR2|FUNC) ##Set the HTML attribute STR of all items in JQ. FUNC is like in addClass().
##If not existing, creates it.
##If NUM, assumes "px"
JQ.attr(PLOBJ) ##Same, but use propriétés VAR:VAL... de PLOBJ.
##Put "" if VAR has hyphens.
JQ.removeAttr(STR) ##Remove attributes STR (space separated list possible)
JQ.*Prop|prop*(...) #Comme JQ.*attr|Attr*, mais pour JavaScript proprieties (not HTML attributes)
JQ.css(...) #Comme JQ.attr(...), mais pour propriété CSS :
# - for getter, use getComputedStyle(). For setter, use style attribute.
# - STR can be CamelCase ou avec-tiret (préférer)
# - shorthand properties not supported
# - "+=NUM" et "-=NUM" sont possible (Pas d'espace. Peut mélanger unités.)
#Doesn't normalize vendor prefixes.
#Des propriétés custom STR peuvent être créées ou ajustées via :
# $.cssHooks[STR] = { get: FUNC(ELEM, COMPUTED, EXTRA), set: FUNC(ELEM, VAL) }
#VAL gets "px" appended if user supplies a NUM. To disable it :
# $.cssNumber[STR] = true;
JQ.html(...) ##Comme JQ.attr(...), mais pour le code HTML des enfants (TEXT inclus), via
##.innerHTML. Pas de PLOBJ.
JQ.val(...) #Comme JQ.attr(...), but for the attribute HTML "value". Pas de PLOBJ.
JQ.text(...) ##Same as JQ.html(...) but with .htmlContent (only Cheerio)
JQ.data(STR|PLOBJ[, STR2]) #Set arbitraty data dont nom est STR et value STR2.
#Similar to HTML attribute data-*, but different. data-* is retrieved by the
#getter if no jQuery data() is found.
#Can also use only a PLOBJ.
#Does not work on <object>
#JQ.on() et WIDGET also sets some data.
#Selector ":data(STR)" est possible.
JQ.data([STR]) #Retrieve data named STR ou, si no STR, PLOBJ de l'ensemble des data.
$.hasData(JQ) #Renvoie true if has data.
┌────────────┐
│ EVENTS │
└────────────┘
JQ.on(STR|PLOBJ[, STR2[, VAL]][, FUNC]) #Comme addEventListener(STR, FUNC), mais :
# - STR peut être une space-separated list of events
# - event handler obtient un JQEvent comme argument au lieu d'Event
# - VAL est la valeur de JQEvent.data pour cet event handler
# - event handler peut prendre d'autres arguments supplémentaires, à passer
# via JQ.trigger*()
# - si STR2, "event delegation" :
# - cible instead each descendant filtré par sélector STR2 (déf: null)
# - cible many descendants, but are actually only linked to the unique
# parent. It is more efficient to have a unique delegated handler on the
# parent, than many event handlers on individual objects :
# $("#ID").on(STR, "TAG", FUNC) > $("#ID TAG").on(STR, FUNC)
# - new descendants created (filtré par STR2) also get the event handler.
# - this in member functions VAR.FUNC() as event handlers != VAR, unless
# using $.proxy(VAR.FUNC(), VAR)
# - limitations :
# - not on <object>
# - event delegation doesn't work for SVG events
#Si PLOBJ :
# - FUNC est omis (sinon obligatoire)
# - PLOBJ propriétés sont VAR: FUNC, où VAR est l'event et FUNC l'handler.
#Custom events STR can be created :
# - they can use the form "[NAMESPACE.]...EVENT" : the event can then be
# designated by either NAMESPACE, NAMESPACE.EVENT or even NAMESPACE2.EVENT.
#Différences of events :
# - no error event on WINDOW
# - focusout|in events + FocusEvent, mouseenter|leave standard, but only
# crossplatform via jQuery
# - DOMContentLoaded is called ready
JQ.off(...) #Comme JQ.on(...), mais remove les handlers pour STR|PLOBJ :
# - ne cible que jQuery event handlers
# - si STR2, only for event handlers having used that selector.
# "**" can be used to designates all delegated event handlers (i.e. the ones
# having used a STR2)
# - si FUNC, only those event handlers. Ne marche pas si FUNC est $.proxy()
JQ.one(...) #Comme JQ.on(...), mais handler is triggered only once.
JQ.trigger(STR|JQEVENT[, ARRAY]) #Triggers event STR|JQEVENT
#Chaque élément d'ARRAY est passé comme argument supplémentaire au handler.
JQ.triggerHandler(STR[, ARRAY]) #Pareil, mais :
# - only triggers jQuery-registered events (not native ones)
# - only triggers event handler of first matching element
# - doesn't return JQ, but return value of that handler
# - no event bubbling
$.Event #A mêmes propriétés qu'event, sauf :
# - keyCode -> use which
# - localX|Y -> called JQEVENT.pageX|Y
# - defaultPrevented -> called JQEVENT.isDefaultPrevented()
# - getModifierState()
# - some yet unsupported KEYBOARDEVENT methods
# - media, drag&drop, storage et other API events
#Pour les rajouter, il suffit :
# - que browser sous-jacent supporte
# - faire $.event.props.push(STR) avant ou après avoir mis l'event handler,
# où STR est le membre d'EVENT.STR, e.g. "dataTransfer" for drag&drop
$.Event(STR[, PLOBJ]) #Constructor d'un JQEVENT, pour créer un custom event.
#Ajoute propriétés de PLOBJ.
JQEVENT.data #Cf JQ.on()
JQEVENT.result #Last return value for handler of same event.
JQEVENT.delegateTarget #Parent élément pour un delegated event.
JQEVENT.is[Immediate]PropagationStoped() #True si .stop[Immediate]Propagation() a été appelé
JQEVENT.which #Comme .keyCode, mais platform-independant.
#Is the Unicode point, so can be converted to STR with String.fromCharCode(UINT)
#but works only for keypress, not keydown.
#Ne prend pas en compte modifier combinaisons.
JQEVENT.namespace #Renvoie nom de l'EVENT sans éventuel [NAMESPACE.] devant
JQ.EVENT([VAL, ]FUNC) #Comme JQ.on(EVENT[,null,VAL], FUNC)
#EVENT are any event, except :
# - media, drag&drop, storage et other API events
# - events on WINDOW, except resize
# - error, abort, input
JQ.EVENT() #Comme JQ.triggers(EVENT)
JQ.hover(FUNC, FUNC2) #Comme JQ.mousenter(FUNC).mouseleave(FUNC2)
$(FUNC) #Comme JQ.ready(FUNC)
$.holdReady(BOOL) #Si true, fait que ready ne sera fired qu'à l'invocation de $.holdReady(false).
#Doit être juste après inclusion de jQuery script.
#Utile si l'on veut effectué quelque chose avant $(FUNC), même si document est
#déjà prêt.
┌────────────────┐
│ ANIMATIONS │
└────────────────┘
JQUERY UI ==> #All this part, except :
# - JQ.animate() (apart COLOR animation et easing autre que "swing" et
# "linear", requires jQuery UI.
# - *Class() without OBJ, et hasClass()
JQ.animate(PLOBJ[, UINT[, STR[, FUNC]]]) #Same as JQ.animate(PLOBJ, { duration: UINT, easing: STR, complete: FUNC })
JQ.animate(PLOBJ, PLOBJ2) #Commence une transition vers propriétés et valeurs désignées par PLOBJ.
#Put propriétés names STR in "" si contient un tiret
#Valeurs peut aussi être "+=VAL" ou "-=VAL" (no space)
#scrollLeft|Top can also be animated.
#VAL de PLOBJ peut être [ VAL, STR ] instead, où STR est l'easing.
#Limitations :
# - Can't animate POSITION, SHAPE, ANGLE, but can use step FUNC to achieve it.
#Propriétés possibles de PLOBJ2 sont paramètres :
# - duration UINT : UINT en ms.
# Can also be "fast", "normal" (déf) "slow" for 200, 400, 600
# - easing STR : timing-function of all properties, parmi "swing" (déf),
# "linear" or PART1PART2 :
# - PART1 :
# - "easeIn" : at beginning
# - "easeOut" : at end
# - "easeInOut" : at beginning + end (and not in middle)
# - PART2 is slope or shape or curve :
# - "Sine", "Quad", "Cubic", "Quart", "Quint", "Expo" : slower at PART1,
# from slower to slower. "swing" is alias for "easeInOutSine"
# - "Circ" : like "Quart", but not a smooth transition (sharp)
# - "Back" : go back|forward further at PART1 before|after passing it,
# then goes back to PART1. Only makes sense for non-clamped values
# (e.g. going past [0;1] opacity doesn't make sense).
# - "Elastic" : same but with back and forth around PART1
# - "Bounce" : same but doesn't go further PART1, but bounce at it
# - specialEasing PLOBJ : timing-function of each property, as a PLOBJ where
# STR: STR2, où STR est la propriété et STR2 l'easing
# - queue VAL : les animations commencent les unes après les autres au sein
# d'une "queue". Une queue est liée à un JQ donné.
# Par défaut, elles utilisent toutes la même queue, mais on peut désigner:
# - true (déf) : queue courante "fx"
# - STR : queue nommée STR. Ne commence qu'après JQ.dequeue(STR)
# - false : queue anonyme STR (random-generated). Commence tout de suite
# - complete FUNC : appelée à fin de cette transition (this is current ELEM)
# - step FUNC :
# - appelée à chaque micro-changement de l'animation, une fois par
# propriété animée. L'animation rate est 13ms, mais peut être changé en
# modifiant $.fx.interval
# - FUNC(VAL, PLOBJ) : VAL est la valeur courante de propriété.
# PLOBJ est un $.FX, qui a comme membres :
# - prop : propriété STR animée
# - easing STR
# - unit STR : e.g. "px"
# - start/now/end : valeur début/actuelle/fin
# - options : PLOBJ2 passé à animate()
# - pos : pourcentage de 0 à 1 du progrès de l'animation
# this est ELEM courant.
# - can be use to animate properties usually impossible : just animate a
# dummy property, and animate the real one in the step FUNC, using
# $.FX.pos to calculate current value to be set.
# - progress FUNC(PROMISE, UINT, UINT2) : exécute FUNC comme pour step.
# UINT est comme pos de step, et UINT2 est le nombre de ms restantes.
# - fail|done|always FUNC(PROMISE) : exécute FUNC si animation a échoué,
# réussi ou toujours.
# fail|done|always et progress FUNC share the same PROMISE. It can be
# manipulated by progress (adding callbacks) then used by fail|done|always.
# - children BOOL : if true (déf: false), animation affects also children.
# Can be slow. jQuery UI only.
#There should be no CSS transition property on the element.
#Doesn't work on CSS functions, e.g. rotate(), but can use step property.
JQ.effect|hide|show|toggle(STR[, OBJ][, VAL] #Apply an effect, which is a predefinied set of CSS properties to animate().
[, FUNC]) #VAL est duration, FUNC complete, et OBJ :
# - option de l'effect
# - queue VAL ou easing STR (like animate())
#hide|show|toggle put display: none at beginning|end of animation.
#Effects can be :
# - can be used with any :
# - "bounce" : bounce up UINT "times" (déf: 5) for a "distance" (déf: 20)
# of UINT pixels.
# hide|show|toggle() make it disappear|appear at highest point.
# - "shake" : same thing, but do in both "direction" (same values as
# "blind", déf: "left") and with always same distance.
# hide|show|toggle() make it disappear|appear at normal position.
# - "highlight" : transition to then from a "color" STR
# hide|show|toggle() make it disappear|appear at highlighted color.
# - "pulsate" : transition UINT "times" (déf: 5) opacity towards 0.
# - only with effect() :
# - "transfer" : creates a box with class "ui-effects-transfer" (default
# CSS : only border, but can be changed) and also (optional) "className"
# and makes its shape shift from JQ to "to" JQ2|ELEM, then disappears.
# For example to indicate drag&drop.
# - all but effect() :
# - "fade" : no effect
# - "blind" : clipping rectangle moving towards
# "direction" (parmi "up" (déf), "down", "left", "right")
# - "clip" : same but from both ends. "direction" parmi "vertical" (déf)
# ou "horizontal"
# - "drop" : sliding towards "direction" (same values as
# "blind")
# - "puff" : grows|shrinks at "percent"% (déf: 150, can't be 0)
# - "size" : rescale to "to" { width: LENP, height: LENP }.
# Can "scale" : "box", "content" or "both" (déf).
# - "fold" : clipping rectangle moving horizontally (if horizFirst BOOL
# (déf: false)), then other direction after reaching "size" UINT pixels
# - "explode" : falling into UINT "pieces" (déf: 9, should be
# perfect square)
# - only with hide() :
# - "scale" : shrink element towards "direction" ("horizontal", "vertical",
# "both" (déf)) and its content ("scale", same values), until scaling
# "percent" (déf: 100).
# - only toggle() or show() :
# - "slide" : slide towards a still clipping board at element border,
# for "distance" LENP (déf: element size) towards "direction"
# (déf: "left")
JQ.add|removeClass(VAL[, OBJ]) #Rajoute ou supprime class VAL :
# - STR (space separated list possible).
# - ou FUNC(UINT, STR), où UINT est l'index dans JQ, STR les class de l'item
# et this l'item, les class STR à rajouter/supprimer sont returned par FUNC.
#OBJ is same as animate(), except complete.
#Rajout|supression est animé.
#Préférer à JQ.animate()
JQ.add|removeClass(VAL[, VAL2[, STR[, FUNC]]]) ##Same as JQ.*Class(STR, { duration: VAL2, easing: STR, complete: FUNC })
JQ.switchClass(VAL, VAL2[, OBJ]) #
JQ.switchClass(VAL, VAL2[, VAL2[, STR[, FUNC]]])#Same but switch from class VAL to class VAL2.
JQ.toggleClass([VAL][, BOOL][, OBJ]) #Comme add|removeClass(), mais :
# - si true, comme addClass()
# - si false, comme removeClass()
# - si null (déf), addClass() si absente, removeClass() sinon
#Si VAL est absent, désigne ensemble des classes (can't be mixed with
#invocations of toggleClass() with explicite VAL).
JQ.toggleClass(VAL[,BOOL[, VAL2[, STR[,FUNC]]]])#Similar shortcut
JQ.hasClass(STR) ##Renvoie true si l'un des items de JQ a class STR (une seule).
$.Color(ARG) #Renvoie un JQCOLOR via ARG :
# - STR : "#NNN", "blue" ou tout autre STR usually possible.
# - 3 ou 4 UINT, de 0 à 255. Ou sous forme d'ARR.
# - { red, green, blue[, alpha] } (0 to 255)
# - { hue, saturation, lightness[, alpha] } (0 to 1, except hue 0 to 360)
#Peut être utilisé par tout jQuery[ UI] animation methods en lieu d'une STR
#représentant une COLOR. Mais a des propriétés en plus :
$.Color(ELEM|JQ, STR) #Renvoie JQCOLOR de CSS property STR d'ELEM|JQ.
JQCOLOR.red|green|blue|alpha|hue|saturation|
lightness([NUM]) #Getter/Setter (copy)
JQCOLOR.rgba|hsla([ARG]) #Same, with same args que constructor.
JQCOLOR.toRgba|HslaString() #Renvoie sous forme de STR "rgba|hsla(...)" to use in CSS.
JQCOLOR.toHexString([BOOL]) #Renvoie sous forme de "#NNNNNN" ou, si true (déf: false) "#NNNNNNNN"
JQCOLOR.is(JQCOLOR2) #BOOL
JQCOLOR.blend(JQCOLOR2) #Renvoie alpha-blending de JQCOLOR on top of JQCOLOR2. Result is opaque.
JQCOLOR.transition(JQCOLOR2, UINT) #Renvoie channel-blending de JQCOLOR et JQCOLOR2, avec UINT% (0 à 1) pour
#JQCOLOR.
#null can be used in a JQCOLOR constructed with UINT_ARR, in order to give
#full percentage to other JQCOLOR2 on transition() for this channel.
┌───────────────┐
│ CALLBACKS │
└───────────────┘
JQ.queue([STR, ]FUNC[_ARR]) #Rajoute FUNC (ou remplace si FUNC_ARR) à la queue nommé STR (déf: queue
#courante "fx"). Une queue est async., et ne commence qu'après un JQ.dequeue(),
#except déf courante "fx", qui commence tout de suite (si pas déjà en cours).
#this est l'ELEM courant.
#Each FUNC (dont each in FUNC_ARR) doit appelé $(this).dequeue(STR) à la fin
#pour appeler les éventuels prochaines FUNC de la queue.
JQ.queue([STR]) #Renvoie les FUNC de la queue, sous forme de FUNC_ARR.
JQ.dequeue([STR]) #Déclenche la queue STR (déf: "fx")
JQ.clearQueue([STR]) #Removes queue STR.
JQ.delay(UINT[, STR]) #Put a delay, in ms, after last FUNC of queue STR (déf: "fx")
JQ.stop([STR, ][BOOL, BOOL2]) #Stop and erase current animation :
# - for all queue, unless a queue STR is defined
# - not following animations of the queue (so can be restarted), but can be
# erased too if BOOL is true (déf: false)
# - stay at current position, but can jump to current animation end goal if
# BOOL2 is true (déf: false)
#When a previous animation could have been called while another is going to be
#run, and it's not good to have both, it's good to call stop() on the element
#before running the second animation. Example : if mouseenter then mouseleave
#quickly, doesn't wait for the mouseenter animation to complete.
JQ.finish([STR]) #Same as JQ.stop(STR, true, true), except if jumps to last animation end goal
#(as opposed to current one) of each queue.
$.fx.off #If set to true, turn off all animations
$.Deferred([FUNC]) #Renvoie un DEFERRED.
#Si FUNC, exécute FUNC d'abord.
#Un DEFERRED register des callbacks FUNC2 et les exécute les uns après les
#autres via :
# - done() FUNC : executed by resolve*()
# - fail() FUNC : executed by reject*()
# - progress() FUNC : executed by notify*()
# - always() FUNC : execute by resolve|reject*()
#resolve*(), reject*() et notify*() can provide arguments to callbacks.
#If resolve|reject*() is called (but not notify*()) :
# - subsequent calls are ignored
# - done|fail|always() are then executed right away, depending or whether
# resolve*() or reject*() has been called. So DEFERRED can be used async.
# or sync.
DEFERED.done|fail|progress|always(FUNC[_ARR]...)#Rajoute un ou plusieurs callbacks.
#progress() can only have one FUNC[_ARR]
#Renvoie DEFERRED.
DEFERRED.then(FUNC[, FUNC2[, FUNC3]]) #Shortcut : FUNC is for done(), FUNC2 for fail(), FUNC3 for progress().
#Renvoie une PROMISE.
DEFERRED.resolve|reject|notify([VAL...]) #Exécute les callbacks avec VAL... comme arguments.
DFERED.resolve|reject|notifyWith(VAL2[, VAL...])#Pareil mais VAL2 devient le this dans les callbacks (sinon this est
#$.when(DEFERRED))
DEFERRED.state() #Renvoie :
# - "resolved" si resolve*() a été appelé
# - "rejected" si reject*() a été appelé
# - "pending" sinon
DEFERRED.promise([VAR]) #Renvoie une PROMISE. Il s'agit d'une encapsultation de DEFERRED : resolve*(),
#reject*() et notify*() manquent, donc il est seulement possible de changer le
#state via DEFERRED.
#DEFERRED et le PROMISE renvoyé share le même state. Souvent le DEFERRED est
#modifié implementation-side et l'interface renvoie seulement des PROMISE.
#Si VAR, implémente les méthodes de PROMISE dans VAR, et renvoie ce nouveau
#VAR.
JQ.promise([STR,][VAR]) #Renvoie une PROMISE, éventuellemnt implémenté dans VAR, qui invoquera
#resolve() quand la queue STR (déf: "fx") de JQ sera finie.
#But possible : déclencher une action quand une animation est finie.
$.when(VAR) #Si VAR :
# - est DEFERRED|PROMISE, renvoie une PROMISE dont state() == celui de DEFERRED
# - est DEFERRED|PROMISE..., renvoie une PROMISE dont state() == union des DEFERRED
# (resolved only if all are resolved, pending if any still pending)
# - otherwise, renvoie une PROMISE considérée comme resolved.
$.Callbacks([STR]) #Ensemble de callbacks.
#Le this invoqué dans les callbacks est le CALLBACKS originel, sauf si "memory"
#STR sont des flags optionnels, as a space-separated list (déf: null) :
# - "once" : fire*() can only be called once
# - "memory" :
# - si fired already once, subsequent add() call fire() on the new FUNC,
# with same argument as last fire()
# - le this passé aux FUNC est le current CALLBACKS, non le CALLBACKS
# originel (donc on peut rajouter des membres à CALLBACKS qui seront
# utilisés dans les callbacks)
# - "unique" : add(FUNC) échoue si already has(FUNC)
# - "stopOnFalse" : fire() s'arrête si un FUNC renvoie false
#L'ensemble des méthodes renvoient CALLBACKS.
CALLBACKS.add|remove(FUNC[_ARR]) #Ajoute/supprime des callbacks.
CALLBACKS.empty() #Supprime tous les callbacks.
CALLBACKS.has(FUNC) #True si CALLBACKS a le callback FUNC. Ne renvoie true que si FUNC_VAR.
CALLBACKS.fire(...) #Invoque les callbacks avec ... comme arguments, et CALLBACKS pour this.
CALLBACKS.fireWith([VAL, ]...) #Pareil mais set this to VAL.
CALLBACKS.fired() #True si fire*() a été invoqué au moins une fois.
CALLBACKS.disable() #Nullify the next call to any method on CALLBACKS.
CALLBACKS.disabled() #Return true if disabled
CALLBACKS.lock[ed]() #Same, except that if "memory" flag, add() can be called and potentially fire.
┌─────────────┐
│ WIDGETS │
└─────────────┘
JQUERY UI ==> #Required.
THEMING ==> #In the CSS file, with selector class .ui-*, that I call JQ.CSS
#Can be customized:
# - either by tweeking theme, or by using rules with !important
# - for icons, change background-image, background-position and provide a
# 16x16px image.
#Custom WIDGET should:
# - use relevant .ui-* classes to be themable.
# - if non relevant, add new .ui-WIDGET-* classes.
#.ui-WIDGET is always the container.
#There are also class .ui-icon-* :
# - .ui-icon makes the ELEM 16px square, with image showing
# - additionnal class .ui-icon-* specifies that image (use sprites)
# Google for the list.
WIDGETS ==> #Attached in a container.
#State WIDGETSTATE stored in JQ.data("ui-ANYWIDGET"). Can test it to see if a
#JQ is a ANYWIDGET, or use selector ":data(STR)".
WIDGETSTATE.document|window #DOCUMENT|WINDOW parent, in a JQ.
WIDGETSTATE.element #ELEM container, in a JQ.
WIDGETSTATE.namespace #Namespace STR, i.e. part of name before last ".",e.g. "ui" in $.ui.progressbar
WIDGETSTATE.widgetName #Nom, e.g. "progressbar"
WIDGETSTATE.widgetFullName #STR namespace + widgetName, e.g. "ui-progressbar"
WIDGETSTATE.options #Options courante OBJ
WIDGETSTATE.uuid #UINT
WIDGETSTATE.version #STR
JQ.ANYWIDGET([OBJ]) #Initialize : attach ANYWIDGET to JQ.
#OBJ are constructor args, called "options" (can be changed later), including
#event handlers, e.g. { EVENT: FUNC }.
#Can change "options" by def. with :
# - $.ui.ANYWIDGET.prototype.options.VAR = VAL;
JQ.ANYWIDGET("option", STR[, VAL]) #Get|Set "option" STR avec VAL.
JQ.ANYWIDGET("option"[, OBJ]) #Same but with an OBJ { STR:VAL... }
JQ.ANYWIDGET(STR[, ...]) #Call pseudo-method ANYWIDGET.STR([...])
JQ.ANYWIDGET("widget") #Renvoie l'ELEM container, dans un JQ.
WIDGET ==> #Base class $.Widget
#Any method starting with _ is meant for custom WIDGET development, not
#direct use (should be encapsultated) (see online doc for custom Widget
#development)
#All other methods are used also by children, except if specified.
$.Widget(STR, TYPE, OBJ) #Crée TYPE2, hérité de TYPE (e.g. $.Widget ou $.ui.progressbar), avec prototype
#OBJ et nom STR.
JQ.Widget({ disabled: BOOL }) #Déf: false
JQ.Widget({ hide|show: VAL }) #How to show|hide WIDGET. Not always inherited. Can be :
# - true : défault
# - OBJ :
# - effect (déf: "fade")
# - VAR (effect options)
# - delay (déf: 0)
# - duration
# - easing
# - queue
# - false|null : same as { duration: 0 }
# - NUM : same as { duration: NUM }
# - STR : same as { effect: STR }
JQ.Widget("disable|enable")
JQ.Widget("destroy") #Supprime WIDGET
JQ.Widget({ create: FUNC }) #Fired at creation.
#Event handler is FUNC(JQEVENT, JQ), but most children inherit of
#FUNC(JQEVENT) (unless specified)
Z-INDEX STACKING #Widgets are appended (from less priority to more):
# - to the BODY
# - to the closest ancestor with class .ui-front
# - to the element specified by method appendTo, if it exists
JQ.accordion() #Accordion.
#Parmi children :
# - ceux matchant selector "header" (déf: first child of chaque <li>, ou
# (si non <li>) odd-numbered children) deviennent headers
# - next sibling of each header is the panel content.
# - other children are left as is.
#JQ.CSS :
# - .ui-accordion-header|content
# - .ui-accordion-icons
JQ.accordion({ header: STR }) #
JQ.accordion({ collapsible: BOOL }) #If true (déf: false), all sections can be collapsed at same time.
JQ.accordion({ active: VAL }) #Currently opened panel :
# - false : all closed
# - UINT : 0 for first, etc.
# - -UINT : same, mais depuis la fin (-1 for last)
JQ.accordion({ animate: OBJ }) #Same as show|hide, but for both and :
# - no effect, delay nor queue. STR refers to easing.
# - OBJ can have member down OBJ2 :
# - same as OBJ, but only when going to superior panel.
# OBJ will then only apply to contrary.
# Both OBJ and OBJ2 must declare same member for it to work.
JQ.accordion({ event: STR }) #Events activating panels, as space-separated list (déf: "click")
JQ.accordion({ heightStyle: STR }) #Height of panels are :
# - "auto" (déf) : biggest panel content
# - "content" : current panel content
# - "fill" : accordion container
#Needs to do JQ.accordion( "refresh" ) to update.
JQ.accordion({ icons: OBJ }) #Icones des triangles :
# - [activeH|h]eader: STR, where STR is a ui-icon-* class name.
JQ.accordion({ [beforeA|a]ctivate: FUNC }) #Fired before|when changing panels.
#Event handler is FUNC(JQEVENT, { old|newHeader|Panel }). old* are empty JQ
#if accordion was collapsed.
JQ.accordion({ create: FUNC }) #Event handler is FUNC(JQEVENT, { header, panel })
JQ.tabs() #Tabs. Should be on any container with :
# - first child UL, with LI being the tabs headers.
# - each LI wraps a A, whose href points to a panel content, which can be
# either :
# - an external URL. Makes a CORS request if other domain.
# Every time tab is opened, a request is sent, and load event is fired.
# - the ID of a container of the same document (see next)
# - next children can be any container used as a panel content
#See http://jqueryui.com/tabs/#bottom to change position of tabs (e.g. bottom)
#Has same members as JQ.accordion, except :
# - members "Header" are called "Tab"
# - has show|hide "options" instead of "animate"
# - no "header" option
# - has also following members :
JQ.tabs("load", UINT) #Event handler and method for load. Has no effect if tab with not external URL.
JQ.tabs({ [beforeL|l]oad: FUNC }) #beforeLoad event handler is FUNC({ panel, tab, jqXHR, ajaxSettings })
# - ajaxSettings est le PLOBJ de $.ajax
#load event handler is FUNC({ panel, tab })
JQ.dialog() #Put (move) any container JQ in a overlay popup, with close button and
#possibility to resize.
#No disable|enable methods nor options.
#Is JQ.draggable and JQ.resizable
#JQ CSS :
# - ui-dialog-titlebar
# - ui-dialog-title
# - ui-dialog-titlebar-close : the close button
# - ui-dialog-content
# - ui-dialog-buttonpane
# - ui-dialog-buttonset
# - ui-button[-text-only] : also the close button. Can have ui-state-hover
# or ui-state-focus
# - ui-button-text
JQ.dialog({ autoOpen: BOOL }) #If false (déf: true), needs to invoke JQ.dialog("open") to open.
#But hides container meanwhile.
JQ.dialog("isOpen") #BOOL
JQ.dialog("open|close")
JQ.dialog("destroy")
JQ.dialog({ hide|show: VAL }) #See JQ.Widget
JQ.dialog({ title: STR }) #(déf: null)
JQ.dialog({ buttons: VAL }) #Boutons (déf: {}) :
# - { LABEL: CALLBACK(JQEVENT) ... }. Can find which button with
# JQEVENT.target.textContent
# - OBJ_ARR, where OBJ a membres :
# - text STR : le label
# - EVENT FUNC : any event (click, mouseenter, etc.)
# - VAR VAL : can add any attribute on the BUTTON
JQ.dialog({ closeOnEscape: BOOL }) #(déf: true)
JQ.dialog({ closeText: STR }) #Texte du close button (déf: "close")
JQ.dialog({ dialogClass: STR }) #An extra class to add to the dialog.
JQ.dialog({ draggable|resizable: BOOL }) #(déf: true)
JQ.dialog({ height|width: NUM }) #(déf: "auto")
JQ.dialog({ modal: BOOL }) #(déf: false). Overlay has class ui-widget-overlay
JQ.dialog({ position: OBJ }) #Same OBJ as JQ.position(OBJ). Déf is {my: "center", at: "center", of: window}
JQ.dialog("moveToTop") #Change z-index to put in front of other JQ.dialog()
JQ.dialog({ open|close: FUNC })
JQ.dialog({ create: FUNC })
JQ.dialog({ beforeClose: FUNC })
JQ.dialog({ focus: FUNC }) #All event handlers are FUNC(JQEVENT)
JQ.dialog({ draggable|resizableEVENT: FUNC }) #Same but :
# - no helper nor *element attribute
# - start|stop -> drag|resizeStart|Stop
JQ.menu() #Creates a dynamic menu.
#JQ should :
# - be a UL
# - each LI should wrap its content in a <a></a>, followed optionally by a
# submenu UL
# - icons should come first inside the <a>, as SPAN with JQ icons classes
# "ui-icon" + "ui-icon-*"
# - <a>...</a> can be only a dash, to indicate a separator
# - disable elements by adding class ui-state-disabled
# - if a new item is added, menu("refresh") should be called
#JQ CSS :
# - ui-menu-item
# - ui-menu-divider
JQ.menu({ icons: { submenu: STR } }) #Arrow icon, as a JQ icon class (déf: "ui-icon-carat-1-e")
JQ.menu({ position: OBJ }) #Position (as in JQ.position()) of submenus compared to menus
#(déf: { my: "left top", at "right top" })
JQ.menu({ blur|focus: FUNC }) #Event handler is FUNC(JQEVENT, { item: JQ })
JQ.menu({ create: FUNC }) #Event handler is FUNC(JQEVENT)
JQ.menu({ select: FUNC }) #Event handler is FUNC(JQEVENT, { item: JQ })
JQ.menu("isFirst|LastItem") #Returns if currently hovered item is first|last. Returns null if no hovering.
JQ.menu("next|previous") #Moves the currently selected item to the next|previous one.
JQ.menu("next|previousPage") #Same but chooses bottom|top item of the visible view (if scrollable) or
#last|first item (if not scrollable)
JQ.menu("select") #Selects currently hovered item.
JQ.menu("blur") #Loses hovering on currently hovered item.
JQ.menu("focus", JQ2) #Gives focus to item JQ2
JQ.menu("expand|collapse")
JQ.menu("collapseAll")
JQ.button() #To do on a <button> or <input> (except type="button")
#radiobox/checkbox doivent avoir un <label> associé.
#JQ.CSS :
# - .ui-button[-text|icon[s]-only|text-icons] : container
# - .ui-button-icon-primary|secondary, .ui-button-text : content
JQ.button({ icons: OBJ }) #Icones as { primary: STR[, secondary: STR2] }, où STR|STR2 sont des ui-icon-*
#(déf: null). primary est à gauche, secondary à droite.
JQ.button({ labels: VAL }) #Contenu :
# - if null (déf), contenu de <button>, ou <label> associé pour une
# radiobox ou checkbox, ou value pour autre <input>
# - sinon STR (texte brut)
JQ.button({ text: BOOL }) #Affichage du texte (déf: true)
JQ.button("refresh") #Needs to be called if checked attribute is changed via JavaScript.
JQ.buttonset() #Ensemble de JQ.button() (même différent).
#Sur un ELEM contenant des JQ.button().
#Same members as JQ.button()
JQ.tooltip([OBJ]) #Modifie current tooltip (ELEM needs to have a non-empty title attribute)
#JQ.CSS :
# - .ui-tooltip-content
JQ.tooltip({ content: VAL }) #Text STR ou FUNC() returnant STR (déf: FUNC returnant title attribute), où
#this est ELEM. STR can be HTML string (anything, including <video>)
JQ.tooltip({ items: STR }) #Selector STR : si ne sélectionne pas, pas de tooltip (déf: "[title]")
JQ.tooltip({ track: BOOL }) #If true (déf: false), follow the mouse
JQ.tooltip({ position: OBJ }) #Position du tooltip. Même OBJ que pour JQ.position(OBJ)
#Déf is { my: "left top+15px", at: "left bottom", collision: "flipfit", of:
# ELEM (having the tooltip) }. "of" stays as ELEM if unspecified (not others).
JQ.tooltip({ hide|show: VAL }) #See JQ.Widget
JQ.tooltip("open|close") #Do it automatically otherwise.
JQ.tooltip({ open|close: FUNC }) #Event handler is FUNC(JQEVENT, { tooltip: JQ }), où JQ est la tooltip popup.
JQ.slider() #Can apply to any element : only takes its width into account, and doesn't
#erase its content.
#JQ.CSS :
# - .ui-slider-vertical|horizontal : like .ui-slider, but depending on the
# orientation
# - .ui-slider-handle.
# - .ui-slider-range[-min|max]
JQ.slider({ min|max: NUM }) #Déf: 0 to 100
JQ.slider({ values: NUM_ARR })
JQ.slider("values"[, NUM_ARR]) #Valeurs des handles (1 if only 1 handle).
JQ.slider("values"[, UINT[, NUM]]) #Same but for handle numero UINT
JQ.slider({ value: NUM })
JQ.slider("value"[, NUM]) #Same but only for first handle.
JQ.slider({ step: NUM }) #Déf: 1
JQ.slider({ range: VAL }) #Type :
# - "min|max" : 1 handle remplissant depuis le début (déf) ou fin
# - true : 2 handles définissant un range
JQ.slider({ orientation: STR }) #"horizontal" (déf) ou "vertical"
JQ.slider({ start|stop: FUNC }) #Event handler is FUNC(JQEVENT, { handle: JQ, value: NUM })
JQ.slider({ slide: FUNC }) #Event handler is FUNC(JQEVENT, { handle: JQ, value: NUM, values: NUM_ARR })
#During every move on slide.
JQ.slider({ change: FUNC }) #Event handler is FUNC(JQEVENT, { handle: JQ, value: NUM })
#After slide completes successfully (stop event is success or cancel).
JQ.spinner() #On a <input type="text">.
#Doesn't control if user puts non numbers manually.
#Currency, etc. format according to locales: use numberFormat and culture,
#which requires Globalization.js (node.js module), see online doc.
#Also STR argument de min|max|page|step|value
#JQ.CSS :
# - .ui-spinner-input : the INPUT
# - .ui-spinner-button[-up|down] : the arrows
JQ.spinner({ min|max: DOUBLE }) #Déf: null (no limit)
JQ.spinner({ step|page: DOUBLE }) #Increment normal (step, déf: 1) ou via pageUp|Down keys (page, as number
#of step times, déf: 10)
JQ.spinner({ incremental: VAL }) #How increment occurs when holding spin button :
# - false : normal
# - true (déf) : increments faster and faster
# - FUNC(TIMES) : returns how much should be incremented
JQ.spinner({ icons: OBJ }) #Icones to use : { down: STR, up: STR }, where STR is a .ui-icon-*
JQ.spinner("value"[, DOUBLE])
JQ.spinner("page|stepUp|Down"[, INT]) #Déf: 1
JQ.spinner({ spin: FUNC }) #Event handler is FUNC(JQEVENT, { value: DOUBLE })
#Fired at each incremental value change.
#DOUBLE is the new value to be set, this.value (STR) is still the old one.
JQ.spinner({ start|stop: FUNC }) #Event handler is FUNC(JQEVENT)
#Fired at each button press, including if holding.
JQ.spinner({ change: FUNC }) #Event handler is FUNC(JQEVENT).
#Fired when losing focus, including if several button presses.
JQ.autocomplete() #Autocomplete bar. On <input>, <textarea> or tout container with
#contentEditable attribute.
#How :
# - set source event handler
#Neutralizes the DOM change event.
#JQ.CSS :
# - ui-autocomplete-input : the underlying INPUT
JQ.autocomplete({ source: FUNC }) #Fired when new autocomplete popups. Feeds the popup.
#Event handler is FUNC({ term: STR }, CALLBACK) :
# - CALLBACK(STR2_ARR) needs to be invoked at the end, where STR2_ARR are the
# suggestions. Always call it, even when error.
# - STR is the current value of the input
#For the STR2 to be treated as HTML, use extension :
# https://raw.github.com/scottgonzalez/jquery-ui-extensions/master/src/
# autocomplete/jquery.ui.autocomplete.html.js
#For accent folding, use extension :
# https://raw.github.com/scottgonzalez/jquery-ui-extensions/master/src/
# autocomplete/jquery.ui.autocomplete.accentFolding.js
JQ.autocomplete({ source: STR[_ARR]|OBJ_ARR }) #Simpler versions:
# - STR_ARR sont les suggestions
# - OBJ_ARR contient { label: STR, value: STR2 }, where label is displayed and
# value is the actual value.
# - STR est une URL. Fait une CORS request si domain différent.
# Use getJSON(), with current value as GET parameter et expect same format
# as OBJ_ARR
JQ.autocomplete({ appendTo: STR }) #See z-index stacking or other appendTo methods (STR is a selector)
JQ.autocomplete({ autoFocus: BOOL }) #If true (déf: false), first element will automatically be focussed at popup
#start.
JQ.autocomplete({ delay: UINT }) #Time (in ms, déf: 300) after which, when no key is typed, the search is
#performed. Should be 0 for local data. But for remote data, higher will
#decrease the number of network requests to when user stops typing words
#(and not characters).
JQ.autocomplete({ minLength: UINT }) #Minimum characters length before start searching (déf: 1). Local/remote data :