aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js')
-rw-r--r--view/js/acl.js24
-rw-r--r--view/js/autocomplete.js130
-rw-r--r--view/js/main.js165
-rw-r--r--view/js/mod_chat.js5
-rw-r--r--view/js/mod_connections.js7
-rw-r--r--view/js/mod_events.js3
-rw-r--r--view/js/mod_mail.js1
-rw-r--r--view/js/mod_new_channel.js23
-rw-r--r--view/js/mod_photos.js2
-rw-r--r--view/js/mod_profiles.js1
-rw-r--r--view/js/mod_register.js61
11 files changed, 329 insertions, 93 deletions
diff --git a/view/js/acl.js b/view/js/acl.js
index 6d94b4987..65f1009ed 100644
--- a/view/js/acl.js
+++ b/view/js/acl.js
@@ -121,8 +121,10 @@ ACL.prototype.on_button_show = function(event) {
event.stopImmediatePropagation();
event.stopPropagation();
- that.set_allow($(this).parent().attr('id'));
- that.on_submit();
+ if(!$(this).parent().hasClass("grouphide")) {
+ that.set_allow($(this).parent().attr('id'));
+ that.on_submit();
+ }
return false;
};
@@ -231,25 +233,29 @@ ACL.prototype.update_view = function() {
}
$(that.group_uids[id]).each(function(i, v) {
if(uclass == "grouphide")
- $("#c"+v).removeClass("groupshow");
+ // we need attr selection here because the id can include an @ (diaspora/friendica xchans)
+ $('[id="c' + v + '"]').removeClass("groupshow");
if(uclass !== "") {
- var cls = $("#c"+v).attr('class');
+ var cls = $('[id="c' + v + '"]').attr('class');
if( cls === undefined)
return true;
var hiding = cls.indexOf('grouphide');
if(hiding == -1)
- $("#c"+v).addClass(uclass);
+ $('[id="c' + v + '"]').addClass(uclass);
}
});
break;
case "c":
if (that.allow_cid.indexOf(id)>=0){
- btshow.removeClass("btn-default").addClass("btn-success");
- bthide.removeClass("btn-danger").addClass("btn-default");
+ if(!$(this).hasClass("grouphide") ) {
+ btshow.removeClass("btn-default").addClass("btn-success");
+ bthide.removeClass("btn-danger").addClass("btn-default");
+ }
}
if (that.deny_cid.indexOf(id)>=0){
btshow.removeClass("btn-success").addClass("btn-default");
bthide.removeClass("btn-default").addClass("btn-danger");
+ $(this).removeClass("groupshow");
}
}
});
@@ -277,7 +283,7 @@ ACL.prototype.populate = function(data) {
$(data.items).each(function(){
html = "<div class='acl-list-item {4} {7} {5}' title='{6}' id='{2}{3}'>"+that.item_tpl+"</div>";
html = html.format(this.photo, this.name, this.type, this.xid, '', this.self, this.link, this.taggable);
- if (this.uids !== undefined) that.group_uids[this.id] = this.uids;
+ if (this.uids !== undefined) that.group_uids[this.xid] = this.uids;
//console.log(html);
that.list_content.append(html);
});
@@ -287,4 +293,4 @@ ACL.prototype.populate = function(data) {
$(el).removeAttr("data-src");
});
that.update_view();
-}; \ No newline at end of file
+};
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 511a7f815..59e3600b3 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -100,6 +100,66 @@ function submit_form(e) {
$(e).parents('form').submit();
}
+function getWord(text, caretPos) {
+ var index = text.indexOf(caretPos);
+ var postText = text.substring(caretPos, caretPos+8);
+ if ((postText.indexOf("[/list]") > 0) || postText.indexOf("[/ul]") > 0 || postText.indexOf("[/ol]") > 0) {
+ return postText;
+ }
+}
+
+function getCaretPosition(ctrl) {
+ var CaretPos = 0; // IE Support
+ if (document.selection) {
+ ctrl.focus();
+ var Sel = document.selection.createRange();
+ Sel.moveStart('character', -ctrl.value.length);
+ CaretPos = Sel.text.length;
+ }
+ // Firefox support
+ else if (ctrl.selectionStart || ctrl.selectionStart == '0')
+ CaretPos = ctrl.selectionStart;
+ return (CaretPos);
+}
+
+function setCaretPosition(ctrl, pos){
+ if(ctrl.setSelectionRange) {
+ ctrl.focus();
+ ctrl.setSelectionRange(pos,pos);
+ }
+ else if (ctrl.createTextRange) {
+ var range = ctrl.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', pos);
+ range.moveStart('character', pos);
+ range.select();
+ }
+}
+
+function listNewLineAutocomplete(id) {
+ var text = document.getElementById(id);
+ var caretPos = getCaretPosition(text)
+ var word = getWord(text.value, caretPos);
+ if (word != null) {
+ var textBefore = text.value.substring(0, caretPos);
+ var textAfter = text.value.substring(caretPos, text.length);
+ $('#' + id).val(textBefore + '\r\n[*] ' + textAfter);
+ setCaretPosition(text, caretPos + 5);
+ return true;
+ }
+}
+
+function string2bb(element) {
+ if(element == 'bold') return 'b';
+ else if(element == 'italic') return 'i';
+ else if(element == 'underline') return 'u';
+ else if(element == 'overline') return 'o';
+ else if(element == 'strike') return 's';
+ else if(element == 'superscript') return 'sup';
+ else if(element == 'subscript') return 'sub';
+ else return element;
+}
+
/**
* jQuery plugin 'editor_autocomplete'
*/
@@ -196,4 +256,72 @@ function submit_form(e) {
if(typeof onselect !== 'undefined')
a.on('textComplete:select', function(e, value, strategy) { onselect(value); });
};
-})( jQuery ); \ No newline at end of file
+})( jQuery );
+
+(function( $ ) {
+ $.fn.bbco_autocomplete = function(type) {
+
+ if(type=='bbcode') {
+ var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer'];
+ var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ];
+
+ var elements = open_close_elements.concat(open_elements);
+ }
+
+ if(type=='comanche') {
+ var open_close_elements = ['region', 'layout', 'template', 'theme', 'widget', 'block', 'menu', 'var', 'css', 'js', 'authored', 'comment', 'webpage'];
+ var open_elements = [];
+
+ var elements = open_close_elements.concat(open_elements);
+ }
+
+ if(type=='comanche-block') {
+ var open_close_elements = ['menu', 'var'];
+ var open_elements = [];
+
+ var elements = open_close_elements.concat(open_elements);
+ }
+
+ bbco = {
+ match: /\[(\w*\**)$/,
+ search: function (term, callback) {
+ callback($.map(elements, function (element) {
+ return element.indexOf(term) === 0 ? element : null;
+ }));
+ },
+ index: 1,
+ replace: function (element) {
+ element = string2bb(element);
+ if(open_elements.indexOf(element) < 0) {
+ if(element === 'list' || element === 'ol' || element === 'ul') {
+ return ['\[' + element + '\]' + '\n\[*\] ', '\n\[/' + element + '\]'];
+ }
+ else if(element === 'table') {
+ return ['\[' + element + '\]' + '\n\[tr\]', '\[/tr\]\n\[/' + element + '\]'];
+ }
+ else {
+ return ['\[' + element + '\]', '\[/' + element + '\]'];
+ }
+ }
+ else {
+ return '\[' + element + '\] ';
+ }
+ }
+ };
+
+ this.attr('autocomplete','off');
+ var a = this.textcomplete([bbco], {className:'acpopup', zIndex:1020});
+
+ a.on('textComplete:select', function(e, value, strategy) { value; });
+
+ a.keypress(function(e){
+ e.stopImmediatePropagation();
+ if (e.keyCode == 13) {
+ var x = listNewLineAutocomplete(this.id);
+ if(x)
+ e.preventDefault();
+ }
+ });
+ };
+})( jQuery );
+
diff --git a/view/js/main.js b/view/js/main.js
index d670b704a..799ae82bc 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -248,6 +248,7 @@ var updateCountsOnly = false;
var divmore_height = 400;
var last_filestorage_id = null;
var mediaPlaying = false;
+var contentHeightDiff = 0;
$(function() {
$.ajaxSetup({cache: false});
@@ -490,6 +491,7 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
+ $("> .shared_header .autotime",this).timeago();
}
else {
$('img',this).each(function() {
@@ -501,6 +503,7 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
+ $("> .shared_header .autotime",this).timeago();
}
prev = ident;
});
@@ -528,6 +531,7 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
+ $("> .shared_header .autotime",this).timeago();
}
else {
$('img',this).each(function() {
@@ -539,6 +543,7 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
+ $("> .shared_header .autotime",this).timeago();
}
});
@@ -572,6 +577,7 @@ function updateConvItems(mode,data) {
if(isVisible)
showHideComments(itmId);
$("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago();
+ $("> .shared_header .autotime",this).timeago();
}
prev = ident;
});
@@ -616,8 +622,10 @@ function updateConvItems(mode,data) {
/* autocomplete @nicknames */
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
+ /* autocomplete bbcode */
+ $(".comment-edit-form textarea").bbco_autocomplete('bbcode');
- var bimgs = $(".wall-item-body img").not(function() { return this.complete; });
+ var bimgs = ((preloadImages) ? false : $(".wall-item-body img").not(function() { return this.complete; }));
var bimgcount = bimgs.length;
if (bimgcount) {
@@ -630,32 +638,64 @@ function updateConvItems(mode,data) {
} else {
collapseHeight();
}
-}
+}
function collapseHeight() {
+ var origContentHeight = parseInt($("#region_2").height());
+ var cDiff = 0;
+ var i = 0;
+ var position = $(window).scrollTop();
+
$(".wall-item-content, .directory-collapse").each(function() {
- var orgHeight = $(this).outerHeight(true);
- if(orgHeight > divmore_height + 10) {
+ var orgHeight = parseInt($(this).css('height'));
+ if(orgHeight > divmore_height) {
if(! $(this).hasClass('divmore')) {
+
+ //var trigger = $(window).scrollTop() < $(this).offset().top ? true : false;
+ //console.log($(this).offset().top + divmore_height - $(window).scrollTop() + cDiff - ($(".divgrow-showmore").outerHeight() * i));
+
+ // check if we will collapse some content above the visible content and compensate the diff later
+ if($(this).offset().top + divmore_height - $(window).scrollTop() + cDiff - ($(".divgrow-showmore").outerHeight() * i) < 65) {
+ //$(this).css('color', 'red');
+ //console.log($(this).offset().top + divmore_height + ' / ' + $(window).scrollTop());
+ diff = orgHeight - divmore_height;
+ cDiff = cDiff + diff;
+ i++;
+ }
+
+ //if(trigger) {
$(this).readmore({
speed: 0,
heightMargin: 50,
- collapsedHeight: divmore_height,
+ collapsedHeight: divmore_height,
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>',
beforeToggle: function(trigger, element, expanded) {
if(expanded) {
if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) {
- $('html, body').animate( { scrollTop: $(window).scrollTop() - (orgHeight - divmore_height) }, {duration: 0 } );
+ $(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height));
}
}
}
});
$(this).addClass('divmore');
+ //}
}
}
});
+
+ var collapsedContentHeight = parseInt($("#region_2").height());
+ contentHeightDiff = origContentHeight - collapsedContentHeight;
+ console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px');
+
+ if(i){
+ var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i);
+ console.log('collapsed above viewport count: ' + i);
+ $(window).scrollTop(sval);
+ }
+
+
}
function liveUpdate() {
@@ -700,32 +740,74 @@ function liveUpdate() {
var orgHeight = $("#region_2").height();
}
+
+ var dstart = new Date();
+ console.log('LOADING data...');
$.get(update_url, function(data) {
- page_load = false;
- scroll_next = false;
- updateConvItems(update_mode,data);
- $("#page-spinner").spin(false);
- $("#profile-jot-text-loading").spin(false);
+ var dready = new Date();
+ console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.');
+
+ if(update_mode === 'update' || preloadImages) {
+ console.log('LOADING images...');
+
+ $('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() {
+ var iready = new Date();
+ console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.');
+
+ page_load = false;
+ scroll_next = false;
+ updateConvItems(update_mode,data);
+ $("#page-spinner").spin(false);
+ $("#profile-jot-text-loading").spin(false);
+
+ // adjust scroll position if new content was added above viewport
+ if(update_mode === 'update') {
+ $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff);
+ }
+
+ in_progress = false;
- if(update_mode === 'update') {
- $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight);
+ // FIXME - the following lines were added so that almost
+ // immediately after we update the posts on the page, we
+ // re-check and update the notification counts.
+ // As it turns out this causes a bit of an inefficiency
+ // as we're pinging twice for every update, once before
+ // and once after. A btter way to do this is to rewrite
+ // NavUpdate and perhaps LiveUpdate so that we check for
+ // post updates first and only call the notification ping
+ // once.
+
+ updateCountsOnly = true;
+ if(timer) clearTimeout(timer);
+ timer = setTimeout(NavUpdate,10);
+
+ });
}
+ else {
+ page_load = false;
+ scroll_next = false;
+ updateConvItems(update_mode,data);
+ $("#page-spinner").spin(false);
+ $("#profile-jot-text-loading").spin(false);
+
+ in_progress = false;
+
+ // FIXME - the following lines were added so that almost
+ // immediately after we update the posts on the page, we
+ // re-check and update the notification counts.
+ // As it turns out this causes a bit of an inefficiency
+ // as we're pinging twice for every update, once before
+ // and once after. A btter way to do this is to rewrite
+ // NavUpdate and perhaps LiveUpdate so that we check for
+ // post updates first and only call the notification ping
+ // once.
+
+ updateCountsOnly = true;
+ if(timer) clearTimeout(timer);
+ timer = setTimeout(NavUpdate,10);
- in_progress = false;
+ }
- // FIXME - the following lines were added so that almost
- // immediately after we update the posts on the page, we
- // re-check and update the notification counts.
- // As it turns out this causes a bit of an inefficiency
- // as we're pinging twice for every update, once before
- // and once after. A btter way to do this is to rewrite
- // NavUpdate and perhaps LiveUpdate so that we check for
- // post updates first and only call the notification ping
- // once.
-
- updateCountsOnly = true;
- if(timer) clearTimeout(timer);
- timer = setTimeout(NavUpdate,10);
});
}
@@ -971,6 +1053,7 @@ function preview_comment(id) {
function(data) {
if(data.preview) {
$("#comment-edit-preview-" + id).html(data.preview);
+ $("#comment-edit-preview-" + id + " .autotime").timeago();
$("#comment-edit-preview-" + id + " a").click(function() { return false; });
}
},
@@ -1001,6 +1084,7 @@ function preview_post() {
function(data) {
if(data.preview) {
$("#jot-preview-content").html(data.preview);
+ $("#jot-preview-content .autotime").timeago();
$("#jot-preview-content" + " a").click(function() { return false; });
}
},
@@ -1202,21 +1286,8 @@ function zFormError(elm,x) {
$(window).scroll(function () {
if(typeof buildCmd == 'function') {
// This is a content page with items and/or conversations
- $('#more').hide();
- $('#no-more').hide();
-
- if($(window).scrollTop() + $(window).height() > $(document).height() - 200) {
- $('#more').css("top","400");
- $('#more').show();
- }
-
- if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
-// if($(window).scrollTop() > $(document).height() - ($(window).height() * 1.5 )) {
-
+ if($(window).scrollTop() + $(window).height() > $(document).height() - 300) {
if((pageHasMoreContent) && (! loadingPage)) {
- $('#more').hide();
- $('#no-more').hide();
-
next_page++;
scroll_next = true;
loadingPage = true;
@@ -1226,18 +1297,8 @@ $(window).scroll(function () {
}
else {
// This is some other kind of page - perhaps a directory
-
- if($(window).scrollTop() + $(window).height() > $(document).height() - 200) {
- $('#more').css("top","400");
- $('#more').show();
- }
-
- if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
-// if($(window).scrollTop() > ($(document).height() - $(window).height() * 1.5 )) {
+ if($(window).scrollTop() + $(window).height() > $(document).height() - 300) {
if((pageHasMoreContent) && (! loadingPage) && (! justifiedGalleryActive)) {
- $('#more').hide();
- $('#no-more').hide();
-
next_page++;
scroll_next = true;
loadingPage = true;
diff --git a/view/js/mod_chat.js b/view/js/mod_chat.js
index 6c432742f..f9d2a599c 100644
--- a/view/js/mod_chat.js
+++ b/view/js/mod_chat.js
@@ -15,4 +15,7 @@ $(document).ready(function() {
$('#jot-public').show();
}
}).trigger('change');
-}); \ No newline at end of file
+
+ $('#chatText').bbco_autocomplete('bbcode');
+
+});
diff --git a/view/js/mod_connections.js b/view/js/mod_connections.js
index f29d96729..112204a5a 100644
--- a/view/js/mod_connections.js
+++ b/view/js/mod_connections.js
@@ -1,15 +1,16 @@
-$(document).ready(function() {
+$(document).ready(function() {
$("#contacts-search").contact_autocomplete(baseurl + '/acl', 'a', true);
+ $(".autotime").timeago();
});
$("#contacts-search").keyup(function(event){
if(event.keyCode == 13){
- $("#contacts-search-submit").click();
+ $("#contacts-search").click();
}
});
$(".autocomplete-w1 .selected").keyup(function(event){
if(event.keyCode == 13){
- $("#contacts-search-submit").click();
+ $("#contacts-search").click();
}
});
diff --git a/view/js/mod_events.js b/view/js/mod_events.js
index 0b7b3d24c..74b811dd6 100644
--- a/view/js/mod_events.js
+++ b/view/js/mod_events.js
@@ -3,9 +3,8 @@
*/
$(document).ready( function() {
-
enableDisableFinishDate();
-
+ $('#comment-edit-text-desc, #comment-edit-text-loc').bbco_autocomplete('bbcode');
});
function enableDisableFinishDate() {
diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js
index 561df7229..3e55c8aeb 100644
--- a/view/js/mod_mail.js
+++ b/view/js/mod_mail.js
@@ -3,4 +3,5 @@ $(document).ready(function() {
$("#recip-complete").val(data.xid);
});
$(".autotime").timeago()
+ $('#prvmail-text').bbco_autocomplete('bbcode');
});
diff --git a/view/js/mod_new_channel.js b/view/js/mod_new_channel.js
index c4d5408f2..17b354a4b 100644
--- a/view/js/mod_new_channel.js
+++ b/view/js/mod_new_channel.js
@@ -1,20 +1,27 @@
$(document).ready(function() {
// $("#id_permissions_role").sSelect();
- $("#newchannel-name").blur(function() {
+ $("#id_name").blur(function() {
$("#name-spinner").spin('small');
- var zreg_name = $("#newchannel-name").val();
+ var zreg_name = $("#id_name").val();
$.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
- $("#newchannel-nickname").val(data);
- zFormError("#newchannel-name-feedback",data.error);
+ $("#id_nickname").val(data);
+ if(data.error) {
+ $("#help_name").html("");
+ zFormError("#help_name",data.error);
+ }
$("#name-spinner").spin(false);
});
});
- $("#newchannel-nickname").blur(function() {
+
+ $("#id_nickname").blur(function() {
$("#nick-spinner").spin('small');
- var zreg_nick = $("#newchannel-nickname").val();
+ var zreg_nick = $("#id_nickname").val();
$.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
- $("#newchannel-nickname").val(data);
- zFormError("#newchannel-nickname-feedback",data.error);
+ $("#id_nickname").val(data);
+ if(data.error) {
+ $("#help_nickname").html("");
+ zFormError("#help_nickname",data.error);
+ }
$("#nick-spinner").spin(false);
});
});
diff --git a/view/js/mod_photos.js b/view/js/mod_photos.js
index d371c3f2f..34e2e3f25 100644
--- a/view/js/mod_photos.js
+++ b/view/js/mod_photos.js
@@ -11,6 +11,8 @@ $(document).ready(function() {
$("#photo-edit-newtag").val('@' + data.name);
});
+ $('#id_body').bbco_autocomplete('bbcode');
+
$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
var selstr;
$('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
diff --git a/view/js/mod_profiles.js b/view/js/mod_profiles.js
index aad2ca902..a7754e0c5 100644
--- a/view/js/mod_profiles.js
+++ b/view/js/mod_profiles.js
@@ -1,3 +1,4 @@
$(document).ready(function() {
$('form').areYouSure(); // Warn user about unsaved settings
+ $('textarea').bbco_autocomplete('bbcode');
});
diff --git a/view/js/mod_register.js b/view/js/mod_register.js
index 95bc7bbbb..f1f3e7f71 100644
--- a/view/js/mod_register.js
+++ b/view/js/mod_register.js
@@ -1,29 +1,56 @@
$(document).ready(function() {
- $("#register-email").blur(function() {
- var zreg_email = $("#register-email").val();
+ $("#id_email").blur(function() {
+ var zreg_email = $("#id_email").val();
$.get("register/email_check.json?f=&email=" + encodeURIComponent(zreg_email), function(data) {
- $("#register-email-feedback").html(data.message);
- zFormError("#register-email-feedback",data.error);
+ $("#help_email").html(data.message);
+ zFormError("#help_email",data.error);
});
});
- $("#register-password").blur(function() {
- if(($("#register-password").val()).length < 6 ) {
- $("#register-password-feedback").html(aStr.pwshort);
- zFormError("#register-password-feedback", true);
+ $("#id_password").blur(function() {
+ if(($("#id_password").val()).length < 6 ) {
+ $("#help_password").html(aStr.pwshort);
+ zFormError("#help_password", true);
}
else {
- $("#register-password-feedback").html("");
- zFormError("#register-password-feedback", false);
+ $("#help_password").html("");
+ zFormError("#help_password", false);
}
});
- $("#register-password2").blur(function() {
- if($("#register-password").val() != $("#register-password2").val()) {
- $("#register-password2-feedback").html(aStr.pwnomatch);
- zFormError("#register-password2-feedback", true);
+ $("#id_password2").blur(function() {
+ if($("#id_password").val() != $("#id_password2").val()) {
+ $("#help_password2").html(aStr.pwnomatch);
+ zFormError("#help_password2", true);
}
else {
- $("#register-password2-feedback").html("");
- zFormError("#register-password2-feedback", false);
+ $("#help_password2").html("");
+ zFormError("#help_password2", false);
}
});
-}); \ No newline at end of file
+
+ $("#id_name").blur(function() {
+ $("#name-spinner").spin('small');
+ var zreg_name = $("#id_name").val();
+ $.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) {
+ $("#id_nickname").val(data);
+ if(data.error) {
+ $("#help_name").html("");
+ zFormError("#help_name",data.error);
+ }
+ $("#name-spinner").spin(false);
+ });
+ });
+
+ $("#id_nickname").blur(function() {
+ $("#nick-spinner").spin('small');
+ var zreg_nick = $("#id_nickname").val();
+ $.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) {
+ $("#id_nickname").val(data);
+ if(data.error) {
+ $("#help_nickname").html("");
+ zFormError("#help_nickname",data.error);
+ }
+ $("#nick-spinner").spin(false);
+ });
+ });
+
+});