playlist.js Click outside the "edit playlist name" box will end the

edit and send the new name to the server
Fixed a positioning error when the page is scrolled
This commit is contained in:
Anders Betnér 2006-03-27 21:12:28 +00:00
parent 8b46f4f586
commit 3697dbd0aa

View File

@ -83,7 +83,7 @@ var EditPlaylistName = {
},
show: function () {
input = $('edit_playlist_name');
input.style.top = RicoUtil.toViewportPosition(el).y+ 'px';
input.style.top = RicoUtil.toDocumentPosition(el).y+ 'px';
input.value = this.playlistName;
input.style.display = 'block';
Field.activate(input);
@ -95,10 +95,20 @@ var EditPlaylistName = {
GlobalEvents.removeListener(this);
},
response: function (request) {
// Check that the save gave response 200 OK
},
click: function (e) {
var x = Event.pointerX(e);
var y = Event.pointerY(e);
var el = $('edit_playlist_name');
var pos = RicoUtil.toViewportPosition(el);
if ((x > pos.x) && (x < pos.x + el.offsetWidth) &&
(y > pos.y) && (y < pos.y + el.offsetHeight)) {
// Click was in input box
return;
}
if (EditPlaylistName.playlistId) {
// EditPlaylistName.save();
EditPlaylistName.save();
}
}
}