| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 | Object subclass: #JQuery	instanceVariableNames: 'jquery'	category: 'JQuery'!!JQuery class methodsFor: 'instance creation'!fromString: aString    | newJQuery |    {'newJQuery = jQuery(String(aString))'}.    ^self from: newJQuery!from: anObject    ^self new	initializeWithJQueryObject: anObject;	yourself! !!JQuery methodsFor: 'attributes'!removeAttribute: aString    "Remove an attribute from each element in the set of matched elements."    ^self call: 'removeAttribute' withArgument: aString!attr: aString    "Get the value of an attribute for the first element in the set of matched elements."    ^self call: 'attr' withArgument: aString!val    "Get the current value of the first element in the set of matched elements."    ^self call: 'val'!val: aString    self call: 'val' withArgument: aString! !!JQuery methodsFor: 'css'!cssAt: aString    ^{'return self[''@jquery''].css(aString)'}!cssAt: aString put: anotherString    {'self[''@jquery''].css(aString, anotherString)'}! addClass: aString    "Adds the specified class(es) to each of the set of matched elements."    self call: 'addClass' withArgument: aString!removeClass: aString    "Remove a single class, multiple classes, or all classes from each element in the set of matched elements."    self call: 'removeClass' withArgument: aString!toggleClass: aString    "Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument."    self call: 'toggleClass' withArgument: aString!height     "Get the current computed height for the first element in the set of matched elements."    ^self call: 'height'!height: anInteger    self call: 'height' withArgument: anInteger!width: anInteger    self call: 'width' withArgument: anInteger! width    "Get the current computed width for the first element in the set of matched elements."    ^self call: 'width'!innerHeight    "Get the current computed height for the first element in the set of matched elements, including padding but not border."    ^self call: 'innerHeight'!innerWidth    "Get the current computed width for the first element in the set of matched elements, including padding but not border."    ^self call: 'innerWidth'!outerHeight    "Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin."    ^self call: 'outerHeight'!outerWidth    "Get the current computed width for the first element in the set of matched elements, including padding and border."    ^self call: 'outerWidth'!top    "Get the current y coordinate of the first element in the set of matched elements, relative to the offset parent."    ^(self call: 'position') basicAt: 'top'!left    "Get the current x coordinate of the first element in the set of matched elements, relative to the offset parent."    ^(self call: 'position') basicAt: 'left'!offsetLeft    "Get the current coordinates of the first element in the set of matched elements, relative to the document."    ^(self call: 'offset') basicAt: 'left'!offsetTop    "Get the current coordinates of the first element in the set of matched elements, relative to the document."    ^(self call: 'offset') basicAt: 'top'!scrollLeft    "Get the current horizontal position of the scroll bar for the first element in the set of matched elements."    ^self call: 'scrollLeft'!scrollTop    "Get the current vertical position of the scroll bar for the first element in the set of matched elements."    ^self call: 'scrollTop'!scrollLeft: anInteger    self call: 'scrollLeft' withArgument: anInteger!scrollTop: anInteger    self call: 'scrollTop' withArgument: anInteger! !!JQuery methodsFor: 'events'!focus    self call: 'focus'!show    self call: 'show'!hide    self call: 'hide'!remove    self call: 'remove'!on: anEventString do: aBlock    "Attach aBlock for anEventString on the element"    {'self[''@jquery''].bind(anEventString, function(e){aBlock(self)})'}!removeEvents: aString    "Unbind all handlers attached to the event aString"    self call: 'unbind' withArgument: aString! !!JQuery methodsFor: 'DOM insertion'!append: anObject    "Append anObject at the end of the element."    anObject appendToJQuery: self!appendElement: anElement    "Append anElement at the end of the element.     Dont't call this method directly, use #append: instead"    self call: 'append' withArgument: anElement!appendToJQuery: aJQuery    aJQuery appendElement: jquery!contents: anObject    self empty.    self append: anObject!empty    self call: 'empty'! !!JQuery methodsFor: 'initialization'!initializeWithJQueryObject: anObject    jquery := anObject! !!JQuery methodsFor: 'private'!call: aString    ^{'return self[''@jquery''][aString]()'}!call: aString withArgument: anObject    ^{'return self[''@jquery''][aString](anObject)'}! !!JQuery methodsFor: 'testing'!hasClass: aString    "Determine whether any of the matched elements are assigned the given class."    ^self call: 'hasClass' withArgument: aString! !Object subclass: #Ajax	instanceVariableNames: 'settings'	category: 'JQuery'!!Ajax commentStamp!instance variable names:- settings  A set of key/value pairs that configure the Ajax request. All settings are optional.Full list of settings options at http://api.jquery.com/jQuery.ajax/!!Ajax class methodsFor: 'instance creation'!url: aString    ^self new	url: aString;	yourself! !!Ajax methodsFor: 'initialization'!initialize    super initialize.    settings := Dictionary new! !!Ajax methodsFor: 'accessing'!at: aKey    ^settings at: aKey ifAbsent: [nil]!at: aKey put: aValue    settings at: aKey put: aValue!url    ^self at: 'url'!url: aString    self at: 'url' put: aString! !!Ajax methodsFor: 'actions'!send    {'jQuery.ajax(self[''@settings''])'}! !    
 |