summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/jcrop/jquery.Jcrop.go.js46
-rw-r--r--js/jcrop/jquery.Jcrop.pack.js (renamed from js/jquery.Jcrop.pack.js)0
-rw-r--r--js/jquery.Jcrop.go.js41
-rw-r--r--js/util.js20
4 files changed, 56 insertions, 51 deletions
diff --git a/js/jcrop/jquery.Jcrop.go.js b/js/jcrop/jquery.Jcrop.go.js
new file mode 100644
index 000000000..b2737407b
--- /dev/null
+++ b/js/jcrop/jquery.Jcrop.go.js
@@ -0,0 +1,46 @@
+ $(function(){
+ var x = ($('#avatar_crop_x').val()) ? $('#avatar_crop_x').val() : 0;
+ var y = ($('#avatar_crop_y').val()) ? $('#avatar_crop_y').val() : 0;
+ var w = ($('#avatar_crop_w').val()) ? $('#avatar_crop_w').val() : $("#avatar_original img").attr("width");
+ var h = ($('#avatar_crop_h').val()) ? $('#avatar_crop_h').val() : $("#avatar_original img").attr("height");
+
+ jQuery("#avatar_original img").Jcrop({
+ onChange: showPreview,
+ setSelect: [ x, y, w, h ],
+ onSelect: updateCoords,
+ aspectRatio: 1,
+ boxWidth: 480,
+ boxHeight: 480,
+ bgColor: '#000',
+ bgOpacity: .4
+ });
+ });
+
+ function showPreview(coords) {
+ var rx = 96 / coords.w;
+ var ry = 96 / coords.h;
+
+ var img_width = $("#avatar_original img").attr("width");
+ var img_height = $("#avatar_original img").attr("height");
+
+ $('#avatar_preview img').css({
+ width: Math.round(rx *img_width) + 'px',
+ height: Math.round(ry * img_height) + 'px',
+ marginLeft: '-' + Math.round(rx * coords.x) + 'px',
+ marginTop: '-' + Math.round(ry * coords.y) + 'px'
+ });
+ };
+
+ function updateCoords(c) {
+ $('#avatar_crop_x').val(c.x);
+ $('#avatar_crop_y').val(c.y);
+ $('#avatar_crop_w').val(c.w);
+ $('#avatar_crop_h').val(c.h);
+ };
+
+ function checkCoords() {
+ if (parseInt($('#avatar_crop_w').val())) return true;
+ alert('Please select a crop region then press submit.');
+ return false;
+ };
+
diff --git a/js/jquery.Jcrop.pack.js b/js/jcrop/jquery.Jcrop.pack.js
index aa82e8abe..aa82e8abe 100644
--- a/js/jquery.Jcrop.pack.js
+++ b/js/jcrop/jquery.Jcrop.pack.js
diff --git a/js/jquery.Jcrop.go.js b/js/jquery.Jcrop.go.js
deleted file mode 100644
index e5d587354..000000000
--- a/js/jquery.Jcrop.go.js
+++ /dev/null
@@ -1,41 +0,0 @@
- $(function(){
- jQuery("#photo_original img").Jcrop({
- onChange: showPreview,
- setSelect: [ 0, 0, $("#photo_original img").attr("width"), $("#photo_original img").attr("height") ],
- onSelect: updateCoords,
- aspectRatio: 1,
- boxWidth: 480,
- boxHeight: 480,
- bgColor: '#000',
- bgOpacity: .4
- });
- });
-
- function showPreview(coords) {
- var rx = 96 / coords.w;
- var ry = 96 / coords.h;
-
- var img_width = $("#photo_original img").attr("width");
- var img_height = $("#photo_original img").attr("height");
-
- $('#photo_preview img').css({
- width: Math.round(rx *img_width) + 'px',
- height: Math.round(ry * img_height) + 'px',
- marginLeft: '-' + Math.round(rx * coords.x) + 'px',
- marginTop: '-' + Math.round(ry * coords.y) + 'px'
- });
- };
-
- function updateCoords(c) {
- $('#photo_crop_x').val(c.x);
- $('#photo_crop_y').val(c.y);
- $('#photo_crop_w').val(c.w);
- $('#photo_crop_h').val(c.h);
- };
-
- function checkCoords() {
- if (parseInt($('#photo_crop_w').val())) return true;
- alert('Please select a crop region then press submit.');
- return false;
- };
-
diff --git a/js/util.js b/js/util.js
index bb68c2587..579b4952a 100644
--- a/js/util.js
+++ b/js/util.js
@@ -108,16 +108,16 @@ $(document).ready(function(){
$("form.form_group_join").each(addAjaxHidden);
$("form.form_group_leave").each(addAjaxHidden);
- $("#nudge").ajaxForm ({ dataType: 'xml',
- beforeSubmit: function(xml) { $("form#nudge input[type=submit]").attr("disabled", "disabled");
- $("form#nudge input[type=submit]").addClass("disabled");
- },
- success: function(xml) { $("#nudge").replaceWith(document._importNode($("#nudge_response", xml).get(0),true));
- $("#nudge input[type=submit]").removeAttr("disabled");
- $("#nudge input[type=submit]").removeClass("disabled");
- }
- });
- $("#nudge").each(addAjaxHidden);
+ $("#form_user_nudge").ajaxForm ({ dataType: 'xml',
+ beforeSubmit: function(xml) { $("#form_user_nudge input[type=submit]").attr("disabled", "disabled");
+ $("#form_user_nudge input[type=submit]").addClass("disabled");
+ },
+ success: function(xml) { $("#form_user_nudge").replaceWith(document._importNode($("#nudge_response", xml).get(0),true));
+ $("#form_user_nudge input[type=submit]").removeAttr("disabled");
+ $("#form_user_nudge input[type=submit]").removeClass("disabled");
+ }
+ });
+ $("#form_user_nudge").each(addAjaxHidden);
var Subscribe = { dataType: 'xml',
beforeSubmit: function(formData, jqForm, options) { $(".form_user_subscribe input[type=submit]").attr("disabled", "disabled");