summaryrefslogtreecommitdiff
path: root/core/js/quickedit.js
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-03 05:36:16 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-03 05:36:16 +0000
commite8f1ff580c6290060d1de8f3e9eceae9028fd1fa (patch)
treea4c6478e94f6236459a5c61542282329e15de333 /core/js/quickedit.js
parent675cc693939199fe95c08f851bec8f4e4ea6807c (diff)
Add a new quick-edit mode for editing photos when viewing albums.
Implement image rotation this way.
Diffstat (limited to 'core/js/quickedit.js')
-rw-r--r--core/js/quickedit.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/core/js/quickedit.js b/core/js/quickedit.js
new file mode 100644
index 00000000..5dad5e1f
--- /dev/null
+++ b/core/js/quickedit.js
@@ -0,0 +1,45 @@
+$(document).ready(function() {
+ $("div.gQuickEdit").hover(show_quickedit, function() { });
+});
+
+var show_quickedit = function() {
+ $("#gQuickEditPane").remove();
+ $(this).append("<div id=\"gQuickEditPane\"></div>");
+ var img = $(this).find("img");
+ var pos = img.position();
+ $("#gQuickEditPane").css({
+ "position": "absolute",
+ "top": pos.top,
+ "left": pos.left,
+ "width": img.innerWidth() + 1,
+ "height": 32
+ });
+ $(this).hover(function() { }, hide_quickedit);
+ $.get(
+ $(this).attr("quickedit_link"),
+ {},
+ function(data, textStatus) {
+ $("#gQuickEditPane").html(data);
+ $("#gQuickEditPane div").click(function() {
+ quickedit($(this).attr("quickedit_link"), img);
+ });
+ }
+ );
+};
+
+var quickedit = function(url, img) {
+ $.ajax({
+ type: "GET",
+ url: url,
+ dataType: "json",
+ success: function(data) {
+ img.attr("width", data.width);
+ img.attr("height", data.height);
+ img.attr("src", data.src);
+ }
+ });
+};
+
+var hide_quickedit = function() {
+ $("#gQuickEditPane").remove();
+};