Procházet zdrojové kódy

- new Ajax class
- Fixed the method category selection in the Browser
- Rebuilt jtalk.js and jtalk.deploy.js

Nicolas Petton před 14 roky
rodič
revize
c29b8d536c
8 změnil soubory, kde provedl 920 přidání a 412 odebrání
  1. 12 0
      js/canvas.js
  2. 8 7
      js/ide.js
  3. 91 2
      js/jQuery.js
  4. 103 2
      js/jtalk.deploy.js
  5. 623 382
      js/jtalk.js
  6. 4 0
      st/canvas.st
  7. 22 18
      st/ide.st
  8. 57 1
      st/jQuery.st

+ 12 - 0
js/canvas.js

@@ -610,6 +610,18 @@ return self;},
 source: unescape('asJQuery%0A%20%20%20%20%5E%7B%27return%20smalltalk.JQuery._from_%28jQuery%28self%5B%27%27@element%27%27%5D%29%29%27%7D%0A')}),
 smalltalk.TagBrush);
 
+smalltalk.addMethod(
+'_asJQueryDo_',
+smalltalk.method({
+selector: 'asJQueryDo:',
+category: 'converting',
+fn: function (aBlock){
+var self=this;
+aBlock._value_(self._asJQuery());
+return self;},
+source: unescape('asJQueryDo%3A%20aBlock%0A%20%20%20%20aBlock%20value%3A%20self%20asJQuery%0A')}),
+smalltalk.TagBrush);
+
 smalltalk.addMethod(
 '_onKeyDown_',
 smalltalk.method({

+ 8 - 7
js/ide.js

@@ -1008,6 +1008,7 @@ var method=nil;
 var source=nil;
 var node=nil;
 source=self['@sourceTextarea']._asJQuery()._val();
+self['@selectedProtocol']._ifNil_((function(){return self['@selectedProtocol']=self['@selectedMethod']._category();}));
 compiler=smalltalk.Compiler._new();
 node=compiler._parse_(source);
 node._isParseFailure()._ifTrue_((function(){return (function(){throw({name: 'stReturn', selector: '_compileMethodDefinitionFor_', fn: function(){return self._alert_("PARSE ERROR: ".__comma(node._reason()).__comma(unescape("%2C%20position%3A%20")).__comma(node._position()._asString()))}})})();}));
@@ -1019,7 +1020,7 @@ self._updateMethodsList();
 self._selectMethod_(method);
 return self;
 } catch(e) {if(e.name === 'stReturn' && e.selector === '_compileMethodDefinitionFor_'){return e.fn()} throw(e)}},
-source: unescape('compileMethodDefinitionFor%3A%20aClass%0A%20%20%20%20%7C%20compiler%20method%20source%20node%20%7C%0A%20%20%20%20source%20%3A%3D%20sourceTextarea%20asJQuery%20val.%0A%20%20%20%20compiler%20%3A%3D%20Compiler%20new.%0A%20%20%20%20node%20%3A%3D%20compiler%20parse%3A%20source.%0A%20%20%20%20node%20isParseFailure%20ifTrue%3A%20%5B%0A%09%5Eself%20alert%3A%20%27PARSE%20ERROR%3A%20%27%2C%20node%20reason%2C%20%27%2C%20position%3A%20%27%2C%20node%20position%20asString%5D.%0A%20%20%20%20compiler%20currentClass%3A%20selectedClass.%0A%20%20%20%20method%20%3A%3D%20compiler%20eval%3A%20%28compiler%20compileNode%3A%20node%29.%0A%20%20%20%20method%20category%3A%20selectedProtocol.%0A%20%20%20%20aClass%20addCompiledMethod%3A%20method.%0A%20%20%20%20self%20updateMethodsList.%0A%20%20%20%20self%20selectMethod%3A%20method%0A')}),
+source: unescape('compileMethodDefinitionFor%3A%20aClass%0A%20%20%20%20%7C%20compiler%20method%20source%20node%20%7C%0A%20%20%20%20source%20%3A%3D%20sourceTextarea%20asJQuery%20val.%0A%20%20%20%20selectedProtocol%20ifNil%3A%20%5BselectedProtocol%20%3A%3D%20selectedMethod%20category%5D.%0A%20%20%20%20compiler%20%3A%3D%20Compiler%20new.%0A%20%20%20%20node%20%3A%3D%20compiler%20parse%3A%20source.%0A%20%20%20%20node%20isParseFailure%20ifTrue%3A%20%5B%0A%09%5Eself%20alert%3A%20%27PARSE%20ERROR%3A%20%27%2C%20node%20reason%2C%20%27%2C%20position%3A%20%27%2C%20node%20position%20asString%5D.%0A%20%20%20%20compiler%20currentClass%3A%20selectedClass.%0A%20%20%20%20method%20%3A%3D%20compiler%20eval%3A%20%28compiler%20compileNode%3A%20node%29.%0A%20%20%20%20method%20category%3A%20selectedProtocol.%0A%20%20%20%20aClass%20addCompiledMethod%3A%20method.%0A%20%20%20%20self%20updateMethodsList.%0A%20%20%20%20self%20selectMethod%3A%20method%0A')}),
 smalltalk.Browser);
 
 smalltalk.addMethod(
@@ -1079,9 +1080,9 @@ selector: 'setMethodProtocol:',
 category: 'actions',
 fn: function (aString){
 var self=this;
-self._cancelChanges()._ifTrue_((function(){self['@selectedMethod']._category_(aString);self['@selectedProtocol']=aString;self['@selectedMethod']=self['@selectedMethod'];return (function($rec){$rec._updateProtocolsList();$rec._updateMethodsList();return $rec._updateSourceAndButtons();})(self);}));
+self._cancelChanges()._ifTrue_((function(){return self._protocols()._includes_(aString)._ifFalse_ifTrue_((function(){return self._addNewProtocol();}),(function(){self['@selectedMethod']._category_(aString);self['@selectedProtocol']=aString;self['@selectedMethod']=self['@selectedMethod'];return (function($rec){$rec._updateProtocolsList();$rec._updateMethodsList();return $rec._updateSourceAndButtons();})(self);}));}));
 return self;},
-source: unescape('setMethodProtocol%3A%20aString%0A%20%20%20%20self%20cancelChanges%20ifTrue%3A%20%5B%0A%09selectedMethod%20category%3A%20aString.%0A%09selectedProtocol%20%3A%3D%20aString.%0A%09selectedMethod%20%3A%3D%20selectedMethod.%0A%09self%20%0A%09%20%20%20%20updateProtocolsList%3B%0A%09%20%20%20%20updateMethodsList%3B%0A%09%20%20%20%20updateSourceAndButtons%5D%0A')}),
+source: unescape('setMethodProtocol%3A%20aString%0A%20%20%20%20self%20cancelChanges%20ifTrue%3A%20%5B%0A%09%28self%20protocols%20includes%3A%20aString%29%0A%09%20%20%20%20ifFalse%3A%20%5Bself%20addNewProtocol%5D%0A%09%20%20%20%20ifTrue%3A%20%5B%0A%09%09selectedMethod%20category%3A%20aString.%0A%09%09selectedProtocol%20%3A%3D%20aString.%0A%09%09selectedMethod%20%3A%3D%20selectedMethod.%0A%09%09self%20%0A%09%09%20%20%20%20updateProtocolsList%3B%0A%09%09%20%20%20%20updateMethodsList%3B%0A%09%09%20%20%20%20updateSourceAndButtons%5D%5D%0A')}),
 smalltalk.Browser);
 
 smalltalk.addMethod(
@@ -1093,9 +1094,9 @@ fn: function (){
 var self=this;
 var newProtocol=nil;
 newProtocol=self._prompt_("New method protocol");
-newProtocol._notEmpty()._ifTrue_((function(){return self._setMethodProtocol_(newProtocol);}));
+newProtocol._notEmpty()._ifTrue_((function(){self['@selectedMethod']._category_(newProtocol);return self._setMethodProtocol_(newProtocol);}));
 return self;},
-source: unescape('addNewProtocol%0A%20%20%20%20%7C%20newProtocol%20%7C%0A%20%20%20%20newProtocol%20%3A%3D%20self%20prompt%3A%20%27New%20method%20protocol%27.%0A%20%20%20%20newProtocol%20notEmpty%20ifTrue%3A%20%5B%0A%09self%20setMethodProtocol%3A%20newProtocol%5D%0A')}),
+source: unescape('addNewProtocol%0A%20%20%20%20%7C%20newProtocol%20%7C%0A%20%20%20%20newProtocol%20%3A%3D%20self%20prompt%3A%20%27New%20method%20protocol%27.%0A%20%20%20%20newProtocol%20notEmpty%20ifTrue%3A%20%5B%0A%09selectedMethod%20category%3A%20newProtocol.%0A%09self%20setMethodProtocol%3A%20newProtocol%5D%0A')}),
 smalltalk.Browser);
 
 smalltalk.addMethod(
@@ -1298,11 +1299,11 @@ fn: function (){
 var self=this;
 self._disableSaveButton();
 self['@classButtons']._contents_((function(html){return (function($rec){$rec._with_("Remove class");return $rec._onClick_((function(){return self._removeClass();}));})(html._button());}));
-self['@methodButtons']._contents_((function(html){(function($rec){$rec._with_("Remove method");return $rec._onClick_((function(){return self._removeMethod();}));})(html._button());return html._select()._with_((function(){(function($rec){$rec._with_("Method protocol");return $rec._at_put_("disabled","disabled");})(html._option());(function($rec){$rec._class_("important");$rec._with_("New...");return $rec._onClick_((function(){return self._addNewProtocol();}));})(html._option());return self._protocols()._do_((function(each){return (function($rec){$rec._with_(each);return $rec._onClick_((function(){return self._setMethodProtocol_(each);}));})(html._option());}));}));}));
+self['@methodButtons']._contents_((function(html){(function($rec){$rec._with_("Remove method");return $rec._onClick_((function(){return self._removeMethod();}));})(html._button());return (function($rec){$rec._onChange_((function(s){return self._setMethodProtocol_(s._val());}));return $rec._with_((function(){(function($rec){$rec._with_("Method protocol");return $rec._at_put_("disabled","disabled");})(html._option());(function($rec){$rec._class_("important");return $rec._with_("New...");})(html._option());return self._protocols()._do_((function(each){return html._option()._with_(each);}));}));})(html._select());}));
 self['@selectedMethod']._ifNil_ifNotNil_((function(){self._hideMethodButtons();return self['@selectedClass']._ifNil_ifNotNil_((function(){return self._hideClassButtons();}),(function(){return self._showClassButtons();}));}),(function(){self._hideClassButtons();return self._showMethodButtons();}));
 self['@sourceTextarea']._asJQuery()._val_(self._source());
 return self;},
-source: unescape('updateSourceAndButtons%0A%20%20%20%20self%20disableSaveButton.%0A%20%20%20%20classButtons%20contents%3A%20%5B%3Ahtml%20%7C%0A%09html%20button%0A%09%20%20%20%20with%3A%20%27Remove%20class%27%3B%0A%09%20%20%20%20onClick%3A%20%5Bself%20removeClass%5D%5D.%0A%20%20%20%20methodButtons%20contents%3A%20%5B%3Ahtml%20%7C%0A%09html%20button%0A%09%20%20%20%20with%3A%20%27Remove%20method%27%3B%0A%09%20%20%20%20onClick%3A%20%5Bself%20removeMethod%5D.%0A%09html%20select%20with%3A%20%5B%0A%09%20%20%20%20html%20option%0A%09%09with%3A%20%27Method%20protocol%27%3B%0A%09%09at%3A%20%27disabled%27%20put%3A%20%27disabled%27.%0A%09%20%20%20%20html%20option%0A%09%09class%3A%20%27important%27%3B%0A%09%09with%3A%20%27New...%27%3B%0A%09%09onClick%3A%20%5Bself%20addNewProtocol%5D.%0A%09%20%20%20%20self%20protocols%20do%3A%20%5B%3Aeach%20%7C%0A%09%09html%20option%0A%09%09%20%20%20%20with%3A%20each%3B%0A%09%09%20%20%20%20onClick%3A%20%5Bself%20setMethodProtocol%3A%20each%5D%5D%5D%5D.%0A%20%20%20%20selectedMethod%20%0A%09ifNil%3A%20%5B%0A%09%20%20%20%20self%20hideMethodButtons.%0A%09%20%20%20%20selectedClass%20%0A%09%09ifNil%3A%20%5Bself%20hideClassButtons%5D%0A%09%20%20%20%20ifNotNil%3A%20%5Bself%20showClassButtons%5D%5D%0A%09ifNotNil%3A%20%5B%0A%09%20%20%20%20self%20hideClassButtons.%0A%09%20%20%20%20self%20showMethodButtons%5D.%0A%20%20%20%20sourceTextarea%20asJQuery%20val%3A%20self%20source%0A')}),
+source: unescape('updateSourceAndButtons%0A%20%20%20%20self%20disableSaveButton.%0A%20%20%20%20classButtons%20contents%3A%20%5B%3Ahtml%20%7C%0A%09html%20button%0A%09%20%20%20%20with%3A%20%27Remove%20class%27%3B%0A%09%20%20%20%20onClick%3A%20%5Bself%20removeClass%5D%5D.%0A%20%20%20%20methodButtons%20contents%3A%20%5B%3Ahtml%20%7C%0A%09html%20button%0A%09%20%20%20%20with%3A%20%27Remove%20method%27%3B%0A%09%20%20%20%20onClick%3A%20%5Bself%20removeMethod%5D.%0A%09html%20select%20%0A%09%20%20%20%20onChange%3A%20%5B%3As%20%7C%20self%20setMethodProtocol%3A%20s%20val%5D%3B%0A%09%20%20%20%20with%3A%20%5B%0A%09%09html%20option%0A%09%09%20%20%20%20with%3A%20%27Method%20protocol%27%3B%0A%09%09%20%20%20%20at%3A%20%27disabled%27%20put%3A%20%27disabled%27.%0A%09%09html%20option%0A%09%09%20%20%20%20class%3A%20%27important%27%3B%0A%09%09%20%20%20%20with%3A%20%27New...%27.%0A%09%09self%20protocols%20do%3A%20%5B%3Aeach%20%7C%0A%09%09%20%20%20%20html%20option%20with%3A%20each%5D%5D%5D.%0A%20%20%20%20selectedMethod%20%0A%09ifNil%3A%20%5B%0A%09%20%20%20%20self%20hideMethodButtons.%0A%09%20%20%20%20selectedClass%20%0A%09%09ifNil%3A%20%5Bself%20hideClassButtons%5D%0A%09%20%20%20%20ifNotNil%3A%20%5Bself%20showClassButtons%5D%5D%0A%09ifNotNil%3A%20%5B%0A%09%20%20%20%20self%20hideClassButtons.%0A%09%20%20%20%20self%20showMethodButtons%5D.%0A%20%20%20%20sourceTextarea%20asJQuery%20val%3A%20self%20source%0A')}),
 smalltalk.Browser);
 
 smalltalk.addMethod(

+ 91 - 2
js/jQuery.js

@@ -354,9 +354,9 @@ selector: 'on:do:',
 category: 'events',
 fn: function (anEventString, aBlock){
 var self=this;
-(function(){self['@jquery'].bind(anEventString, aBlock)})();
+(function(){self['@jquery'].bind(anEventString, function(e){aBlock(self)})})();
 return self;},
-source: unescape('on%3A%20anEventString%20do%3A%20aBlock%0A%20%20%20%20%22Attach%20aBlock%20for%20anEventString%20on%20the%20element%22%0A%20%20%20%20%7B%27self%5B%27%27@jquery%27%27%5D.bind%28anEventString%2C%20aBlock%29%27%7D%0A')}),
+source: unescape('on%3A%20anEventString%20do%3A%20aBlock%0A%20%20%20%20%22Attach%20aBlock%20for%20anEventString%20on%20the%20element%22%0A%20%20%20%20%7B%27self%5B%27%27@jquery%27%27%5D.bind%28anEventString%2C%20function%28e%29%7BaBlock%28self%29%7D%29%27%7D%0A')}),
 smalltalk.JQuery);
 
 smalltalk.addMethod(
@@ -508,4 +508,93 @@ source: unescape('from%3A%20anObject%0A%20%20%20%20%5Eself%20new%0A%09initialize
 smalltalk.JQuery.klass);
 
 
+smalltalk.addClass('Ajax', smalltalk.Object, ['settings'], 'JQuery');
+smalltalk.Ajax.comment=unescape('instance%20variable%20names%3A%0A-%20settings%20%20A%20set%20of%20key/value%20pairs%20that%20configure%20the%20Ajax%20request.%20All%20settings%20are%20optional.%0A%0AFull%20list%20of%20settings%20options%20at%20http%3A//api.jquery.com/jQuery.ajax/%0A')
+smalltalk.addMethod(
+'_initialize',
+smalltalk.method({
+selector: 'initialize',
+category: 'initialization',
+fn: function (){
+var self=this;
+self.klass.superclass.fn.prototype['_initialize'].apply(self, []);
+self['@settings']=smalltalk.Dictionary._new();
+return self;},
+source: unescape('initialize%0A%20%20%20%20super%20initialize.%0A%20%20%20%20settings%20%3A%3D%20Dictionary%20new%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_at_',
+smalltalk.method({
+selector: 'at:',
+category: 'accessing',
+fn: function (aKey){
+var self=this;
+return self['@settings']._at_ifAbsent_(aKey,(function(){return nil;}));
+return self;},
+source: unescape('at%3A%20aKey%0A%20%20%20%20%5Esettings%20at%3A%20aKey%20ifAbsent%3A%20%5Bnil%5D%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_at_put_',
+smalltalk.method({
+selector: 'at:put:',
+category: 'accessing',
+fn: function (aKey, aValue){
+var self=this;
+self['@settings']._at_put_(aKey,aValue);
+return self;},
+source: unescape('at%3A%20aKey%20put%3A%20aValue%0A%20%20%20%20settings%20at%3A%20aKey%20put%3A%20aValue%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_url',
+smalltalk.method({
+selector: 'url',
+category: 'accessing',
+fn: function (){
+var self=this;
+return self._at_("url");
+return self;},
+source: unescape('url%0A%20%20%20%20%5Eself%20at%3A%20%27url%27%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_url_',
+smalltalk.method({
+selector: 'url:',
+category: 'accessing',
+fn: function (aString){
+var self=this;
+self._at_put_("url",aString);
+return self;},
+source: unescape('url%3A%20aString%0A%20%20%20%20self%20at%3A%20%27url%27%20put%3A%20aString%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_send',
+smalltalk.method({
+selector: 'send',
+category: 'actions',
+fn: function (){
+var self=this;
+(function(){jQuery.ajax(self['@settings'])})();
+return self;},
+source: unescape('send%0A%20%20%20%20%7B%27jQuery.ajax%28self%5B%27%27@settings%27%27%5D%29%27%7D%0A')}),
+smalltalk.Ajax);
+
+
+smalltalk.addMethod(
+'_url_',
+smalltalk.method({
+selector: 'url:',
+category: 'instance creation',
+fn: function (aString){
+var self=this;
+return (function($rec){$rec._url_(aString);return $rec._yourself();})(self._new());
+return self;},
+source: unescape('url%3A%20aString%0A%20%20%20%20%5Eself%20new%0A%09url%3A%20aString%3B%0A%09yourself%0A')}),
+smalltalk.Ajax.klass);
+
+
 

+ 103 - 2
js/jtalk.deploy.js

@@ -4415,9 +4415,9 @@ selector: 'on:do:',
 category: 'events',
 fn: function (anEventString, aBlock){
 var self=this;
-(function(){self['@jquery'].bind(anEventString, aBlock)})();
+(function(){self['@jquery'].bind(anEventString, function(e){aBlock(self)})})();
 return self;},
-source: unescape('on%3A%20anEventString%20do%3A%20aBlock%0A%20%20%20%20%22Attach%20aBlock%20for%20anEventString%20on%20the%20element%22%0A%20%20%20%20%7B%27self%5B%27%27@jquery%27%27%5D.bind%28anEventString%2C%20aBlock%29%27%7D%0A')}),
+source: unescape('on%3A%20anEventString%20do%3A%20aBlock%0A%20%20%20%20%22Attach%20aBlock%20for%20anEventString%20on%20the%20element%22%0A%20%20%20%20%7B%27self%5B%27%27@jquery%27%27%5D.bind%28anEventString%2C%20function%28e%29%7BaBlock%28self%29%7D%29%27%7D%0A')}),
 smalltalk.JQuery);
 
 smalltalk.addMethod(
@@ -4569,6 +4569,95 @@ source: unescape('from%3A%20anObject%0A%20%20%20%20%5Eself%20new%0A%09initialize
 smalltalk.JQuery.klass);
 
 
+smalltalk.addClass('Ajax', smalltalk.Object, ['settings'], 'JQuery');
+smalltalk.Ajax.comment=unescape('instance%20variable%20names%3A%0A-%20settings%20%20A%20set%20of%20key/value%20pairs%20that%20configure%20the%20Ajax%20request.%20All%20settings%20are%20optional.%0A%0AFull%20list%20of%20settings%20options%20at%20http%3A//api.jquery.com/jQuery.ajax/%0A')
+smalltalk.addMethod(
+'_initialize',
+smalltalk.method({
+selector: 'initialize',
+category: 'initialization',
+fn: function (){
+var self=this;
+self.klass.superclass.fn.prototype['_initialize'].apply(self, []);
+self['@settings']=smalltalk.Dictionary._new();
+return self;},
+source: unescape('initialize%0A%20%20%20%20super%20initialize.%0A%20%20%20%20settings%20%3A%3D%20Dictionary%20new%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_at_',
+smalltalk.method({
+selector: 'at:',
+category: 'accessing',
+fn: function (aKey){
+var self=this;
+return self['@settings']._at_ifAbsent_(aKey,(function(){return nil;}));
+return self;},
+source: unescape('at%3A%20aKey%0A%20%20%20%20%5Esettings%20at%3A%20aKey%20ifAbsent%3A%20%5Bnil%5D%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_at_put_',
+smalltalk.method({
+selector: 'at:put:',
+category: 'accessing',
+fn: function (aKey, aValue){
+var self=this;
+self['@settings']._at_put_(aKey,aValue);
+return self;},
+source: unescape('at%3A%20aKey%20put%3A%20aValue%0A%20%20%20%20settings%20at%3A%20aKey%20put%3A%20aValue%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_url',
+smalltalk.method({
+selector: 'url',
+category: 'accessing',
+fn: function (){
+var self=this;
+return self._at_("url");
+return self;},
+source: unescape('url%0A%20%20%20%20%5Eself%20at%3A%20%27url%27%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_url_',
+smalltalk.method({
+selector: 'url:',
+category: 'accessing',
+fn: function (aString){
+var self=this;
+self._at_put_("url",aString);
+return self;},
+source: unescape('url%3A%20aString%0A%20%20%20%20self%20at%3A%20%27url%27%20put%3A%20aString%0A')}),
+smalltalk.Ajax);
+
+smalltalk.addMethod(
+'_send',
+smalltalk.method({
+selector: 'send',
+category: 'actions',
+fn: function (){
+var self=this;
+(function(){jQuery.ajax(self['@settings'])})();
+return self;},
+source: unescape('send%0A%20%20%20%20%7B%27jQuery.ajax%28self%5B%27%27@settings%27%27%5D%29%27%7D%0A')}),
+smalltalk.Ajax);
+
+
+smalltalk.addMethod(
+'_url_',
+smalltalk.method({
+selector: 'url:',
+category: 'instance creation',
+fn: function (aString){
+var self=this;
+return (function($rec){$rec._url_(aString);return $rec._yourself();})(self._new());
+return self;},
+source: unescape('url%3A%20aString%0A%20%20%20%20%5Eself%20new%0A%09url%3A%20aString%3B%0A%09yourself%0A')}),
+smalltalk.Ajax.klass);
+
+
 
 smalltalk.addClass('HTMLCanvas', smalltalk.Object, ['root'], 'Canvas');
 smalltalk.addMethod(
@@ -5182,6 +5271,18 @@ return self;},
 source: unescape('asJQuery%0A%20%20%20%20%5E%7B%27return%20smalltalk.JQuery._from_%28jQuery%28self%5B%27%27@element%27%27%5D%29%29%27%7D%0A')}),
 smalltalk.TagBrush);
 
+smalltalk.addMethod(
+'_asJQueryDo_',
+smalltalk.method({
+selector: 'asJQueryDo:',
+category: 'converting',
+fn: function (aBlock){
+var self=this;
+aBlock._value_(self._asJQuery());
+return self;},
+source: unescape('asJQueryDo%3A%20aBlock%0A%20%20%20%20aBlock%20value%3A%20self%20asJQuery%0A')}),
+smalltalk.TagBrush);
+
 smalltalk.addMethod(
 '_onKeyDown_',
 smalltalk.method({

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 623 - 382
js/jtalk.js


+ 4 - 0
st/canvas.st

@@ -242,6 +242,10 @@ element
 
 asJQuery
     ^{'return smalltalk.JQuery._from_(jQuery(self[''@element'']))'}
+!
+
+asJQueryDo: aBlock
+    aBlock value: self asJQuery
 ! !
 
 !TagBrush methodsFor: 'events'!

+ 22 - 18
st/ide.st

@@ -604,6 +604,7 @@ compileMethodDefinition
 compileMethodDefinitionFor: aClass
     | compiler method source node |
     source := sourceTextarea asJQuery val.
+    selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
     compiler := Compiler new.
     node := compiler parse: source.
     node isParseFailure ifTrue: [
@@ -647,19 +648,23 @@ removeMethod
 
 setMethodProtocol: aString
     self cancelChanges ifTrue: [
-	selectedMethod category: aString.
-	selectedProtocol := aString.
-	selectedMethod := selectedMethod.
-	self 
-	    updateProtocolsList;
-	    updateMethodsList;
-	    updateSourceAndButtons]
+	(self protocols includes: aString)
+	    ifFalse: [self addNewProtocol]
+	    ifTrue: [
+		selectedMethod category: aString.
+		selectedProtocol := aString.
+		selectedMethod := selectedMethod.
+		self 
+		    updateProtocolsList;
+		    updateMethodsList;
+		    updateSourceAndButtons]]
 !
 
 addNewProtocol
     | newProtocol |
     newProtocol := self prompt: 'New method protocol'.
     newProtocol notEmpty ifTrue: [
+	selectedMethod category: newProtocol.
 	self setMethodProtocol: newProtocol]
 !
 
@@ -840,18 +845,17 @@ updateSourceAndButtons
 	html button
 	    with: 'Remove method';
 	    onClick: [self removeMethod].
-	html select with: [
-	    html option
-		with: 'Method protocol';
-		at: 'disabled' put: 'disabled'.
-	    html option
-		class: 'important';
-		with: 'New...';
-		onClick: [self addNewProtocol].
-	    self protocols do: [:each |
+	html select 
+	    onChange: [:s | self setMethodProtocol: s val];
+	    with: [
+		html option
+		    with: 'Method protocol';
+		    at: 'disabled' put: 'disabled'.
 		html option
-		    with: each;
-		    onClick: [self setMethodProtocol: each]]]].
+		    class: 'important';
+		    with: 'New...'.
+		self protocols do: [:each |
+		    html option with: each]]].
     selectedMethod 
 	ifNil: [
 	    self hideMethodButtons.

+ 57 - 1
st/jQuery.st

@@ -158,7 +158,7 @@ remove
 
 on: anEventString do: aBlock
     "Attach aBlock for anEventString on the element"
-    {'self[''@jquery''].bind(anEventString, aBlock)'}
+    {'self[''@jquery''].bind(anEventString, function(e){aBlock(self)})'}
 !
 
 removeEvents: aString
@@ -215,3 +215,59 @@ 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''])'}
+! !
+
+
+    

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů