Re: [jtalk-project] JTalk + Iliad

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [jtalk-project] JTalk + Iliad

Bernat Romagosa
YES!

I found the collision between jTalk and Iliad! :D

My fix is awful, but there it goes:

In iliad.js (ILPharoJavascriptsDirectory >> iliadJs in Pharo), you need to find the following piece of code:

/* update head */
for (var i in json.head) {
jQuery(''head'').append(json.head[i]);
}

and replace it with:

/* update head */
for (var i in json.head) {
if ( parseInt(i) >=0 ) 
{jQuery(''head'').append(json.head[i]);}
}

and also find:

/* evaluate scripts */
//var scripts = json.scripts;
for(var i in scripts) {
evalScript(scripts[i]);
}

and replace it with:

/* evaluate scripts */
//var scripts = json.scripts;
for(var i in scripts) {
if ( parseInt(i) >=0 )
{evalScript(scripts[i]);}
}

The problem is that json.head and json.scripts contain some jTalk function names (such as remove), and Iliad expects only numbers in there. The parseInt() part is to check whether the string contains a number or not.

Ugly as can be, I know, but it works!

Cheers,

--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: [jtalk-project] JTalk + Iliad

Bernat Romagosa
Seems like I had missed yet another one, there it goes:

replace the original function evaluateAction(actionUrl, method, data, lock) in iliad.js for:

function evaluateAction(actionUrl, method, data, lock) {
if ( typeof(actionUrl) != "undefined" )
{
if(!actionsLocked) {
if(!method) method = ''get'';
if(lock == null) lock = true;
if(lock) {lockActions();};
jQuery.ajax({
url: actionUrl,
type: method,
processUpdates: true,
dataType: ''json'',
data: data,
beforeSend: function(xhr) {
if(ajaxLoader) insertAjaxLoader();},
success: function(json) {
processUpdates(json);
if(ajaxLoader) removeAjaxLoader();
unlockActions();
},
error: function(err) {
showError(err, actionUrl);
unlockActions();
}
});
}
}
}

2011/9/2 Bernat Romagosa <[hidden email]>
YES!

I found the collision between jTalk and Iliad! :D

My fix is awful, but there it goes:

In iliad.js (ILPharoJavascriptsDirectory >> iliadJs in Pharo), you need to find the following piece of code:

/* update head */
for (var i in json.head) {
jQuery(''head'').append(json.head[i]);
}

and replace it with:

/* update head */
for (var i in json.head) {
if ( parseInt(i) >=0 ) 
{jQuery(''head'').append(json.head[i]);}
}

and also find:

/* evaluate scripts */
//var scripts = json.scripts;
for(var i in scripts) {
evalScript(scripts[i]);
}

and replace it with:

/* evaluate scripts */
//var scripts = json.scripts;
for(var i in scripts) {
if ( parseInt(i) >=0 )
{evalScript(scripts[i]);}
}

The problem is that json.head and json.scripts contain some jTalk function names (such as remove), and Iliad expects only numbers in there. The parseInt() part is to check whether the string contains a number or not.

Ugly as can be, I know, but it works!

Cheers,

--
Bernat Romagosa.



--
Bernat Romagosa.
Reply | Threaded
Open this post in threaded view
|

Re: [jtalk-project] JTalk + Iliad

Nicolas Petton
That's odd.

I think using for(var i=0;i<bar;i++) would be better, but anyway this
should break. I'm gonna see what's wrong.

Cheers,
Nico

On Fri, 2011-09-02 at 16:32 +0200, Bernat Romagosa wrote:

> Seems like I had missed yet another one, there it goes:
>
>
> replace the original function evaluateAction(actionUrl, method, data,
> lock) in iliad.js for:
>
>
> function evaluateAction(actionUrl, method, data, lock) {
> if ( typeof(actionUrl) != "undefined" )
> {
> if(!actionsLocked) {
> if(!method) method = ''get'';
> if(lock == null) lock = true;
> if(lock) {lockActions();};
> jQuery.ajax({
> url: actionUrl,
> type: method,
> processUpdates: true,
> dataType: ''json'',
> data: data,
> beforeSend: function(xhr) {
> if(ajaxLoader) insertAjaxLoader();},
> success: function(json) {
> processUpdates(json);
> if(ajaxLoader) removeAjaxLoader();
> unlockActions();
> },
> error: function(err) {
> showError(err, actionUrl);
> unlockActions();
> }
> });
> }
> }
> }
>
> 2011/9/2 Bernat Romagosa <[hidden email]>
>         YES!
>        
>        
>         I found the collision between jTalk and Iliad! :D
>        
>        
>         My fix is awful, but there it goes:
>        
>        
>         In iliad.js (ILPharoJavascriptsDirectory >> iliadJs in Pharo),
>         you need to find the following piece of code:
>        
>        
>         /* update head */
>         for (var i in json.head) {
>         jQuery(''head'').append(json.head[i]);
>         }
>        
>        
>         and replace it with:
>        
>        
>         /* update head */
>         for (var i in json.head) {
>         if ( parseInt(i) >=0 )
>         {jQuery(''head'').append(json.head[i]);}
>         }
>        
>        
>         and also find:
>        
>        
>         /* evaluate scripts */
>         //var scripts = json.scripts;
>         for(var i in scripts) {
>         evalScript(scripts[i]);
>         }
>        
>        
>         and replace it with:
>        
>        
>         /* evaluate scripts */
>         //var scripts = json.scripts;
>         for(var i in scripts) {
>         if ( parseInt(i) >=0 )
>         {evalScript(scripts[i]);}
>         }
>        
>        
>         The problem is that json.head and json.scripts contain some
>         jTalk function names (such as remove), and Iliad expects only
>         numbers in there. The parseInt() part is to check whether the
>         string contains a number or not.
>        
>        
>         Ugly as can be, I know, but it works!
>        
>        
>         Cheers,
>        
>        
>         --
>         Bernat Romagosa.
>        
>
>
>
>
> --
> Bernat Romagosa.
>

--
Nicolas Petton
http://www.nicolas-petton.fr