-
Notifications
You must be signed in to change notification settings - Fork 8
/
jQuery.ml
executable file
·321 lines (314 loc) · 11.8 KB
/
jQuery.ml
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
(*
* JQuery binding for Js_of_ocaml - 2011-2012
* jQuery module
*
* 2011 Gabriel Cardoso - [email protected]
* 2012 Cagdas Bozman - [email protected]
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)
open Js
open Effects
class type jQuery = object
method add : js_string t -> jQuery t meth
method add_element : #Dom_html.element t -> jQuery t meth
method add_jquery : jQuery t -> jQuery t meth
method addClass : js_string t -> jQuery t meth
method addClass_ : (int -> js_string t -> js_string t) callback
-> jQuery t meth
method after : (js_string t, #Dom_html.element t, jQuery t) Tools.Choice3.t
-> jQuery t meth
method after_fun :
(int -> (js_string t, #Dom_html.element t, jQuery t) Tools.Choice3.t)
-> jQuery t meth
method ajaxComplete :
(#Dom_html.event t -> #XmlHttpRequest.xmlHttpRequest t -> 'a) callback
-> jQuery t meth
method animate : Dom_html.cssStyleDeclaration t -> duration_pre opt
-> easing_pre opt -> ('a, 'b) meth_callback opt -> jQuery t meth
method append : js_string t -> jQuery t meth
method appendTo : js_string t -> jQuery t meth
method appendTo_jquery : jQuery t -> jQuery t meth
method attr : js_string t -> js_string t optdef meth
method attr_set : js_string t -> js_string t -> jQuery t meth
method before : (js_string t, #Dom_html.element t, jQuery t) Tools.Choice3.t
-> jQuery t meth
method bind : js_string t -> ('a, 'b) meth_callback opt -> jQuery t meth
method blur : ('a, 'b) meth_callback opt -> jQuery t meth
method change : ('a, 'b) meth_callback opt -> jQuery t meth
method clearQueue : js_string t opt -> jQuery t meth
method click : ('a, 'b) meth_callback opt -> jQuery t meth
method css_get : js_string t -> js_string t meth
method css : js_string t -> js_string t -> jQuery t meth
method delay : int -> js_string t opt -> jQuery t meth
method dequeue : js_string t opt -> jQuery t meth
method each : (int -> #Dom_html.element t -> 'a) callback -> jQuery t meth
method eq : int -> jQuery t meth
method fadeIn : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method fadeOut : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method fadeTo : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method fadeToggle : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method find : jQuery t -> jQuery t meth
method focus : ('a, 'b) meth_callback opt -> jQuery t meth
method has : js_string t -> jQuery t meth
method hasClass : js_string t -> bool t meth
method height : int meth
method height_set : int -> jQuery t meth
method hide : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method hover : ('a, 'b) meth_callback -> ('a, 'b) meth_callback opt -> jQuery t meth
method html : js_string t meth
method html_set : js_string t -> jQuery t meth
method insertAfter : (js_string t, #Dom_html.element t, jQuery t)
Tools.Choice3.t -> jQuery t meth
method insertBefore : (js_string t, #Dom_html.element t, jQuery t)
Tools.Choice3.t -> jQuery t meth
method length : int readonly_prop
method live : 'a Dom.Event.typ-> ('a, 'b) meth_callback -> jQuery t meth
method prepend : js_string t -> unit meth
method queue : js_string t opt -> js_string t js_array t meth
method ready : ('a, 'b) meth_callback -> jQuery t meth
method remove : unit meth
method removeClass : js_string t opt -> jQuery t meth
method removeClass_ : (int -> js_string t -> js_string t) callback
-> jQuery t meth
method select : ('a, 'b) meth_callback opt -> jQuery t meth
method serialize : unit -> js_string meth
method show : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method size : int meth
method slideDown : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method slideToggle : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method slideUp : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method stop : bool t opt -> bool t opt -> jQuery t meth
method submit : ('a, 'b) meth_callback opt -> jQuery t meth
method toggle : bool t -> jQuery t meth
method toggle_ : duration_pre opt -> easing_pre opt -> ('a, 'b) meth_callback opt
-> jQuery t meth
method toggleClass : js_string t -> jQuery t meth
method text : js_string t meth
method text_set : js_string t -> jQuery t meth
method unbind : js_string t -> jQuery t meth
method val_ : string_array t meth
method val_set : js_string t -> jQuery t meth
method width : int meth
method width_set : int -> jQuery t meth
method tableFilter : unit meth
method tableFilterApplyFilterValues : unit meth
(* TODO : implement the right types for these methods c.f. jQuery API
method ajaxError
method ajaxSend
method ajaxStart
method ajaxStop
method ajaxSuccess
method andSelf
method change
method children
method click
method clone
method closest
method contents
method context
method data
method dblclick
method delegate
method die
method each
method empty
method end_
method error
method filter
method first
method focusin
method focusout
method get
method has
method hasClass
method height
method hover
method index
method innerHeight
method innerWidth
method is
method jquery
method keydown
method keypress
method keyup
method last
method live
method load
method load
method map
method mousedown
method mouseenter
method mouseleave
method mousemove
method mouseout
method mouseover
method mouseup
method next
method nextAll
method nextUntil
method not
method offset
method offsetParent
method one
method outerHeight
method outerWidth
method parent
method parents
method parentsUntil
method position
method prependTo
method prev
method prevAll
method prevUntil
method promise
method prop
method pushStack
method ready
method removeAttr
method removeData
method removeProp
method replaceAll
method replaceWith
method resize
method scroll
method scrollLeft
method scrollTop
method serializeArray
method siblings
method size
method slice
method toArray
method trigger
method triggerHandler
method undelegate
method unload
method unwrap
method width
method wrap
method wrapAll
method wrapInner*)
end
let jQ s = Unsafe.fun_call
(Unsafe.variable "jQuery") [|Unsafe.inject (Js.string s)|]
let jQuery
(selector : (js_string t,
#Dom_html.element t,
#Dom_html.element t js_array t,
jQuery t) Tools.Choice4.t)
(context_opt : (#Dom_html.element t,
#Dom_html.document,
jQuery t) Tools.Choice3.t opt) : jQuery t =
Unsafe.fun_call
(Unsafe.variable "jQuery")
[|Unsafe.inject selector; Unsafe.inject context_opt|]
let ajax : js_string t -> unit = Unsafe.variable "jQuery.ajax"
(* TODO implement these values as in the jQuery API *)
(*let ajaxPrefilter = Unsafe.variable "jQuery.ajaxPrefilter"
let ajaxSetup = Unsafe.variable "jQuery.ajaxSetup"
let boxModel = Unsafe.variable "jQuery.boxModel"
let browser = Unsafe.variable "jQuery.browser"
module Deferred = struct
let always = Unsafe.variable "jQuery.deferred.always"
let done_ = Unsafe.variable "jQuery.deferred.done"
let fail = Unsafe.variable "jQuery.deferred.fail"
let isRejected = Unsafe.variable "jQuery.deferred.isRejected"
let isResolved = Unsafe.variable "jQuery.deferred.isResolved"
let pipe = Unsafe.variable "jQuery.deferred.pipe"
let promise = Unsafe.variable "jQuery.deferred.promise"
let reject = Unsafe.variable "jQuery.deferred.reject"
let rejectWith = Unsafe.variable "jQuery.deferred.rejectWith"
let resolve = Unsafe.variable "jQuery.deferred.resolve"
let resolveWith = Unsafe.variable "jQuery.deferred.resolveWith"
let then_ = Unsafe.variable "jQuery.deferred.then"
end
let dequeue = Unsafe.variable "jQuery.browser"
let each = Unsafe.variable "jQuery.each"
let error = Unsafe.variable "jQuery.error"
module Event = struct
let currentTarget = Unsafe.variable "jQuery.event.currentTarget"
let data = Unsafe.variable "jQuery.event.data"
let isDefaultPrevented = Unsafe.variable "jQuery.event.isDefaultPrevented"
let preventDefault = Unsafe.variable "jQuery.event.preventDefault"
let isImmediatePropagationStopped =
Unsafe.variable "jQuery.event.isImmediatePropagationStopped"
let stopImmediatePropagation =
Unsafe.variable "jQuery.event.stopImmediatePropagation"
let isPropagationStopped =
Unsafe.variable "jQuery.event.isPropagationStopped"
let stopPropagation = Unsafe.variable "jQuery.event.stopPropagation"
let namespace = Unsafe.variable "jQuery.event.namespace"
let pageX = Unsafe.variable "jQuery.event.pageX"
let pageY = Unsafe.variable "jQuery.event.pageY"
let preventDefault = Unsafe.variable "jQuery.event.preventDefault"
let relatedTarget = Unsafe.variable "jQuery.event.relatedTarget"
let result = Unsafe.variable "jQuery.event.result"
let stopImmediatePropagation =
Unsafe.variable "jQuery.event.stopImmediatePropagation"
let stopPropagation = Unsafe.variable "jQuery.event.stopPropagation"
let target = Unsafe.variable "jQuery.event.target"
let timeStamp = Unsafe.variable "jQuery.event.timeStamp"
let type_ = Unsafe.variable "jQuery.event.type"
let which = Unsafe.variable "jQuery.event.which"
end
let extend = Unsafe.variable "jQuery.extend"
module Fx = struct
let interval = Unsafe.variable "jQuery.fx.interval"
let off = Unsafe.variable "jQuery.fx.off"
end
let get = Unsafe.variable "jQuery.get"
let getJSON = Unsafe.variable "jQuery.getJSON"
let getScript = Unsafe.variable "jQuery.getScript"
let globalEval = Unsafe.variable "jQuery.globalEval"
let grep = Unsafe.variable "jQuery.grep"
let hasData = Unsafe.variable "jQuery.hasData"
let holdReady = Unsafe.variable "jQuery.holdReady"
let inArray = Unsafe.variable "jQuery.inArray"
let isArray = Unsafe.variable "jQuery.isArray"
let isEmptyObject = Unsafe.variable "jQuery.isEmptyObject"
let isFunction = Unsafe.variable "jQuery.isFunction"
let isPlainObject = Unsafe.variable "jQuery.isPlainObject"
let isWindow = Unsafe.variable "jQuery.isWindow"
let isXMLDoc = Unsafe.variable "jQuery.isXMLDoc"
let makeArray = Unsafe.variable "jQuery.makeArray"
let map = Unsafe.variable "jQuery.map"
let merge = Unsafe.variable "jQuery.merge"
let noConflict = Unsafe.variable "jQuery.noConflict"
let noop = Unsafe.variable "jQuery.noop"
let now = Unsafe.variable "jQuery.now"*)
let param : Unsafe.any t -> bool t opt -> js_string t =
Unsafe.variable "jQuery.param"
(*let parseJSON = Unsafe.variable "jQuery.parseJSON"
let parseXML = Unsafe.variable "jQuery.parseXML"
let post = Unsafe.variable "jQuery.post"
let proxy = Unsafe.variable "jQuery.proxy"
let queue = Unsafe.variable "jQuery.queue"
let removeData = Unsafe.variable "jQuery.removeData"
let sub = Unsafe.variable "jQuery.sub"
let suppo = Unsafe.variable "jQuery.suppo"
let trim = Unsafe.variable "jQuery.trim"
let type_ = Unsafe.variable "jQuery.type"
let unique = Unsafe.variable "jQuery.unique"
let when_ = Unsafe.variable "jQuery.when"
*)