1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

replace prototype.js with jquery, i think everything is working...

This commit is contained in:
John Moore 2013-07-26 23:18:39 -05:00
parent 4a0a737e32
commit de35a43d54
25 changed files with 9638 additions and 7111 deletions

View file

@ -16,40 +16,23 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Some cutesy flashing thing while we run
Ajax.Responders.register({
onCreate: function(){
$('ajax-loading').style.display = 'block';
},
onComplete: function() {
$('ajax-loading').style.display = 'none';
}
$(document).ajaxSend(function () {
$('#ajax-loading').show();
});
$(document).ajaxComplete(function () {
$('#ajax-loading').hide();
});
// ajaxPost
// Post the contents of a form.
function ajaxPost(url, input, source) {
if ($(source)) {
Event.stopObserving(source, 'click', function() { ajaxPost(url, input, source); });
}
new Ajax.Request(url, {
method: 'post',
parameters: $(input).serialize(true),
onSuccess: processContents
});
$.ajax(url, { success: processContents, type: 'post', data: input });
} // ajaxPost
// ajaxPut
// Get response from the specified URL.
function ajaxPut(url, source) {
if ($(source)) {
Event.stopObserving(source, 'click', function(){ ajaxPut(url, source); });
}
new Ajax.Request(url, {
method: 'put',
onSuccess: processContents
});
$.ajax(url, { success: processContents, type: 'post', dataType: 'xml' });
} // ajaxPut
// ajaxState
@ -65,16 +48,8 @@ function ajaxState(url, input) {
// processContents
// Iterate over a response and do any updates we received.
function processContents(transport) {
$A(transport.responseXML.getElementsByTagName('content')).each(updateElement);
function processContents(data, status) {
$(data).find("content").each(function () {
$('#' + $(this).attr('div')).html($(this).text())
})
} // processContents
// updateElement
// This isn't an anonymous function because I'm ornery. Does the actual
// updates for processContents.
function updateElement(contentXML) {
var newID = contentXML.getAttribute('div');
if($(newID)) {
$(newID).update(contentXML.firstChild.nodeValue);
}
} // updateElement