Switch to jQuery instead of Prototype?

100 views
Skip to first unread message

MarcusT

unread,
Apr 12, 2009, 10:45:56 AM4/12/09
to asp-ajaxed
I am keen to use Ajaxed but am already using jQuery and don't want to
have to load Prototype as well, not to mention that one way or the
other I will have to alter code either in my own applications or in
Ajaxed to make the two libraries play nicely together.

Is there any plan to (or would you consider) altering Ajaxed so that
it uses jQuery + jQuery UI instead of Prototype, or perhaps to give
users a choice between the two somehow?

mga...@gmail.com

unread,
Apr 12, 2009, 9:36:38 PM4/12/09
to asp-a...@googlegroups.com
hi marcus,
there were already some requests for jquery and i planned to do it .. but so far there was no time...
you are welcome to help ;)

happy easter.

MarcusT

unread,
Apr 15, 2009, 8:01:01 PM4/15/09
to asp-ajaxed
Which scripts (whether client-side or server-side) do you think will
need changing - just ajaxed.js or more?


On Apr 13, 2:36 am, mga...@gmail.com wrote:
> hi marcus,
> there were already some requests for jquery and i planned to do it .. but  
> so far there was no time...
> you are welcome to help ;)
>
> happy easter.
>

Michal Gabrukiewicz

unread,
Apr 15, 2009, 9:59:52 PM4/15/09
to MarcusT, asp-ajaxed
actually just ajaxed.org and the scripts within datatable. That should be all.

suggestion: jQuery versions of these files could be written and the appropriate files loaded due to a configuration setting.
--
michal
Sent from Bang Kapi, Bangkok, Thailand

Marcus

unread,
Apr 15, 2009, 10:46:12 PM4/15/09
to mga...@gmail.com, asp-ajaxed
Doesn't the Ajaxed console make use of Prototype & Scriptaculous too?


2009/4/16 Michal Gabrukiewicz <mga...@gmail.com>

mga...@gmail.com

unread,
Apr 15, 2009, 11:29:10 PM4/15/09
to Marcus, mga...@gmail.com, asp-ajaxed
oh ... yep you are completely right. this need to be rewritten as well.

are you planning to take a deeper look?

Marcus

unread,
Apr 15, 2009, 11:43:37 PM4/15/09
to mga...@gmail.com, asp-ajaxed
Unfortunately I'm not that familiar with the inner workings of Ajaxed (and the test suite) and you are, so I suspect that you could jQuery-ify (and properly test/debug) it in a fraction of the time it would take me, so don't think that it would be a very productive use of my time.

Perhaps you could do it in two stages, the ajaxed & datatable scripts first (most important, affecting end users), the console later (only for developers)?

I also think you should use it as an opportunity to re-factor the Ajaxed code in such a way so that anyone else could write a handler for their own favourite library (e.g. YUI) without needing to touch the main Ajaxed code? (Otherwise someone will inevitably ask about YUI/Dojo/etc and you'll have to do it all again)

Can't you just define some standard methods which Ajaxed calls (and you will document somewhere), then all that needs to be done is for someone to write a wrapper for a given JavaScript library? You write ones for Prototype and jQuery and then anyone else is welcome to use them as example implementations for rolling their own for another library...



2009/4/16 <mga...@gmail.com>

mga...@gmail.com

unread,
Apr 16, 2009, 1:43:05 AM4/16/09
to Marcus, mga...@gmail.com, asp-ajaxed
Hi Marcus,

I fully agree with you and I would love to spent the time. Unfortunately I do not have that time and therefore those implementations are missing. However, If someone has more time and wants to touch that issue then I would totally support him with my knowledge.

greets

fatcat

unread,
Apr 24, 2009, 3:04:38 AM4/24/09
to asp-ajaxed
This is replaced ajaxed.js instead of prototype

/*
ajax.js
2007-09-08 17:22
version 0.1

Licensed under the Lesser GNU (LGPL) open source license version
2.1.

This library 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.

ajaxed is a good libary for the good old asp.

This file is a client side code for ajaxed.

requirement:
jQuery 1.1.4
jQuery Form Plugin
DO NOT include prototype.js

usage:
replace ajaxed/class_ajaxPage/ajax.js with this file.

see http://www.webdevbros.net/ajaxed/ for more detail about
ajaxed.
see http://www.prototypejs.org/ for detail about prototye.
see http://jquery.com/ for detail about jquery.
see http://www.malsup.com/jquery/form/ for detail about jQuery
Form Plugin

Contact me if you have problems installing this file.
Do please,give me feedback.

enjoy.

happyjake#gmail.com
*/
String.prototype.startsWith = function(str)
{return (this.match("^"+str)==str)}

String.prototype.endsWith = function(str)
{return (this.match(str+"$")==str)}

function ajaxed() {};

ajaxed.prototype.indicator = document.createElement('div');

$(ajaxed.prototype.indicator).ajaxStart(function(){
s = ajaxed.prototype.indicator.style;
s.background = "#cc0000";
s.color = "#fff";
s.position = "absolute";
s.right = "4px";
s.top = "4px";
document.body.appendChild(ajaxed.prototype.indicator);
});

$(ajaxed.prototype.indicator).ajaxStop(function(){
document.body.removeChild(ajaxed.prototype.indicator);
});

//optional: onComplete, url (because of bug in iis5
http://support.microsoft.com/kb/216493)
ajaxed.callback = function(theAction, func, params, onComplete,
formid, url) {

uri = window.location.href.replace(/#.*$/ig, '');
alert(url);
if (ajaxed.prototype.debug) ajaxed.debug("Action (to be handled in
callback):\n\n" + theAction);
if (uri.endsWith('/') && url) uri += url;
if (url) uri = url;

if (params) {
params=jQuery.extend({}, params, {PageAjaxed: theAction});
} else {
if ($('#' + formid).length) {
params = $('#' + formid).serialize() + "&PageAjaxed=" + theAction;
} else {
if ($('#frm').length) {
params = $('#frm').serialize() + "&PageAjaxed=" + theAction;
} else {
params = {};
}
}
}

$.ajax({
type:'post',
url:uri,
cache:false,
data:params,
success:function(data, textStatus) {
if (ajaxed.prototype.debug) ajaxed.debug("Response on callback:\n
\n" + data);
if (!data.startsWith('{ "root":') && !data.startsWith('pagePart:'))
{
ajaxed.callbackFailure( data );
} else if (data.startsWith('pagePart:')) {
var content = data.replace(/^pagePart:/g, '');
if (typeof func == "string") return $('#'+func).html(content);
if (func) func(content);
} else {
var json = eval("(" + data + ")");
if (func) func(json.root);
}
},
error:ajaxed.callbackFailure,
complete:onComplete
});
}
ajaxed.callbackFailure = function(data) {
friendlyMsg = data;
friendlyMsg = friendlyMsg.replace(new RegExp("(<head[\\s\\S]*?</
head>)|(<script[\\s\\S]*?</script>)", "gi"), "");
friendlyMsg = friendlyMsg.replace(new RegExp("/<\/?[^>]+>/gi"),
'');
friendlyMsg = friendlyMsg.replace(new RegExp("[\\s]+", "gi"), "
");
alert(friendlyMsg);
}
ajaxed.debug = function(msg){
alert("<DEBUG MESSAGE>\n\n" + msg);
}







And you have to change ajaxed/class_ajaxedPage/ajaxedPage.asp

293 public sub ajaxedHeader(params)
294 'if loadPrototypeJS then loadJSFile(lib.path("prototypejs/
prototype.js")) ORIGINAL LINE
294 if loadPrototypeJS then loadJSFile("http://ajax.googleapis.com/
ajax/libs/jquery/1.2.6/jquery.min.js") ' i'm load from google ajax api
tools CDN.
Reply all
Reply to author
Forward
0 new messages