aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js')
-rw-r--r--view/js/acl.js1
-rw-r--r--view/js/autocomplete.js7
-rw-r--r--view/js/main.js67
-rw-r--r--view/js/mod_connedit.js65
-rw-r--r--view/js/mod_mail.js1
-rw-r--r--view/js/mod_profiles.js66
6 files changed, 190 insertions, 17 deletions
diff --git a/view/js/acl.js b/view/js/acl.js
index c11997c43..4dd60d303 100644
--- a/view/js/acl.js
+++ b/view/js/acl.js
@@ -276,6 +276,7 @@ ACL.prototype.update_view = function(value) {
/* jot acl */
$('#jot-perms-icon, #dialog-perms-icon, #' + that.form_id[0].id + ' .jot-perms-icon').removeClass('fa-lock').addClass('fa-unlock');
+ $('#jot-perms-icon').removeClass('jot-lock-warn');
$('#dbtn-jotnets').show();
$('.profile-jot-net input').attr('disabled', false);
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index aa47a6e19..5a616b6fc 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -164,6 +164,7 @@ function string2bb(element) {
else if(element == 'strike') return 's';
else if(element == 'superscript') return 'sup';
else if(element == 'subscript') return 'sub';
+ else if(element == 'highlight') return 'hl';
else return element;
}
@@ -269,7 +270,7 @@ function string2bb(element) {
$.fn.bbco_autocomplete = function(type) {
if(type=='bbcode') {
- var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'embed'];
+ var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'observer.language','embed', 'highlight'];
var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ];
var elements = open_close_elements.concat(open_elements);
@@ -308,6 +309,10 @@ function string2bb(element) {
return ['\[' + element + '\]' + '\n\[*=Item name\] ', '\n\[/' + element + '\]'];
} else if(element === 'table') {
return ['\[' + element + '\]' + '\n\[tr\]', '\[/tr\]\n\[/' + element + '\]'];
+ } else if(element === 'observer') {
+ return ['\[' + element + '=1\]', '\[/observer\]'];
+ } else if(element === 'observer.language') {
+ return ['\[' + element + '=en\]', '\[/observer\]'];
}
else {
return ['\[' + element + '\]', '\[/' + element + '\]'];
diff --git a/view/js/main.js b/view/js/main.js
index 96adf0be3..2fc912093 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -434,26 +434,36 @@ function contextualHelp() {
if(container.hasClass('contextual-help-content-open')) {
container.removeClass('contextual-help-content-open');
- $('main').css('top', '')
+ $('main').css('margin-top', '')
}
else {
container.addClass('contextual-help-content-open');
var mainTop = container.outerHeight(true);
- $('main').css('top', mainTop + 'px');
+ $('main').css('margin-top', mainTop + 'px');
}
}
function contextualHelpFocus(target, openSidePanel) {
- if (openSidePanel) {
- $("main").addClass('region_1-on'); // Open the side panel to highlight element
- }
- else {
- $("main").removeClass('region_1-on');
- }
- $('html,body').animate({ scrollTop: $(target).offset().top - $('nav').outerHeight(true) - $('#contextual-help-content').outerHeight(true)}, 'slow');
- for (i = 0; i < 3; i++) {
- $(target).fadeTo('slow', 0.1).fadeTo('slow', 1.0);
- }
+ if($(target).length) {
+ if (openSidePanel) {
+ $("main").addClass('region_1-on'); // Open the side panel to highlight element
+ }
+ else {
+ $("main").removeClass('region_1-on');
+ }
+
+ var css_position = $(target).parent().css('position');
+ if (css_position === 'fixed') {
+ $(target).parent().css('position', 'static');
+ }
+
+ $('html,body').animate({ scrollTop: $(target).offset().top - $('nav').outerHeight(true) - $('#contextual-help-content').outerHeight(true)}, 'slow');
+ for (i = 0; i < 3; i++) {
+ $(target).fadeTo('slow', 0.1).fadeTo('slow', 1.0);
+ }
+
+ $(target).parent().css('position', css_position);
+ }
}
function updatePageItems(mode, data) {
@@ -652,7 +662,13 @@ function updateConvItems(mode,data) {
}
// auto-scroll to a particular comment in a thread (designated by mid) when in single-thread mode
- if($('.item_' + bParam_mid.substring(0,32)).length && !$('.item_' + bParam_mid.substring(0,32)).hasClass('toplevel_item') && mode == 'replace') {
+ // use the same method to generate the submid as we use in ThreadItem,
+ // substr(0,32) + base64_encode + replace(['+','='],['','']);
+ var submid = bParam_mid;
+ var submid_encoded = ((submid.length) ? submid.substring(0,32) : 'abcdefg');
+ submid_encoded = window.btoa(submid_encoded);
+ submid_encoded = submid_encoded.replace(/[\+\=]/g,'');
+ if($('.item_' + submid_encoded).length && !$('.item_' + submid_encoded).hasClass('toplevel_item') && mode == 'replace') {
if($('.collapsed-comments').length) {
var scrolltoid = $('.collapsed-comments').attr('id').substring(19);
$('#collapsed-comments-' + scrolltoid + ' .autotime').timeago();
@@ -660,10 +676,12 @@ function updateConvItems(mode,data) {
$('#hide-comments-' + scrolltoid).html(aStr.showfewer);
$('#hide-comments-total-' + scrolltoid).hide();
}
- $('html, body').animate({ scrollTop: $('.item_' + bParam_mid.substring(0,32)).offset().top - $('nav').outerHeight() }, 'slow');
- $('.item_' + bParam_mid.substring(0,32)).addClass('item-highlight');
+ $('html, body').animate({ scrollTop: $('.item_' + submid_encoded).offset().top - $('nav').outerHeight() }, 'slow');
+ $('.item_' + submid_encoded).addClass('item-highlight');
}
+ $(document.body).trigger("sticky_kit:recalc");
+
}
function collapseHeight() {
@@ -1144,6 +1162,24 @@ function preview_post() {
return true;
}
+function preview_mail() {
+ $("#mail-preview").val("1");
+ $("#mail-preview-content").show();
+ $.post(
+ "mail",
+ $("#prvmail-form").serialize(),
+ function(data) {
+ if(data.preview) {
+ $("#mail-preview-content").html(data.preview);
+ $("#mail-preview-content" + " a").click(function() { return false; });
+ }
+ },
+ "json"
+ );
+ $("#mail-preview").val("0");
+ return true;
+}
+
function unpause() {
// unpause auto reloads if they are currently stopped
totStopped = false;
@@ -1313,7 +1349,6 @@ $(document).ready(function() {
numbers : aStr['t17'],
};
- $("#toc").toc();
});
function zFormError(elm,x) {
diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js
index 84fff5ed1..252ed9e7c 100644
--- a/view/js/mod_connedit.js
+++ b/view/js/mod_connedit.js
@@ -16,6 +16,71 @@ $(document).ready(function() {
connectFullShare();
});
+ $(document).on('click', '.vcard-header, .vcard-cancel-btn', updateView);
+ $(document).on('click', '.add-field', doAdd);
+ $(document).on('click', '.remove-field', doRemove);
+
+ function updateView() {
+ var id = $(this).data('id');
+ var action = $(this).data('action');
+ var header = $('#vcard-header-' + id);
+ var cancel = $('#vcard-cancel-' + id);
+ var addField = $('#vcard-add-field-' + id);
+ var info = $('#vcard-info-' + id);
+ var vcardPreview = $('#vcard-preview-' + id);
+ var fn = $('#vcard-fn-' + id);
+
+ if(action === 'open') {
+ $(header).addClass('active');
+ $(cancel).show();
+ $(addField).show();
+ $(info).show();
+ $(fn).show();
+ $(vcardPreview).hide();
+ }
+ else {
+ $(header).removeClass('active');
+ $(cancel).hide();
+ $(addField).hide();
+ $(info).hide();
+ $(fn).hide();
+ $(vcardPreview).show();
+ }
+ }
+
+ function doAdd() {
+ var what = $(this).data('add');
+ var id = $(this).data('id');
+ var element = '#template-form-' + what;
+ var where = '#abook-edit-form';
+
+ $(element + ' .remove-field').attr('data-id', id)
+
+ if(what === 'vcard-adr') {
+ var adrCount = $(where + ' .form-' + what).length;
+ var attrName = 'adr[' + adrCount + '][]';
+ $(element + ' input').attr('name', attrName);
+ }
+
+ if(what === 'vcard-org' || what === 'vcard-title' || what === 'vcard-note') {
+ $(where + ' .add-' + what).hide()
+ }
+
+ $(element).clone().removeAttr('id').appendTo(where + ' .form-' + what + '-wrapper');
+ }
+
+ function doRemove() {
+ var what = $(this).data('remove');
+ var element = $(this).parents('div.form-' + what);
+ var where = '#abook_edit_form' + $(this).data('id');
+
+ if(what === 'vcard-org' || what === 'vcard-title' || what === 'vcard-note') {
+ $(where + ' .add-' + what).show()
+ }
+
+ $(element).remove();
+ }
+
});
function connectFullShare() {
diff --git a/view/js/mod_mail.js b/view/js/mod_mail.js
index 46574a63d..15a45519b 100644
--- a/view/js/mod_mail.js
+++ b/view/js/mod_mail.js
@@ -4,4 +4,5 @@ $(document).ready(function() {
});
$(".autotime").timeago()
$('#prvmail-text').bbco_autocomplete('bbcode');
+ $("#prvmail-text").editor_autocomplete(baseurl+"/acl");
});
diff --git a/view/js/mod_profiles.js b/view/js/mod_profiles.js
index a7754e0c5..acc9f9953 100644
--- a/view/js/mod_profiles.js
+++ b/view/js/mod_profiles.js
@@ -1,4 +1,70 @@
$(document).ready(function() {
$('form').areYouSure(); // Warn user about unsaved settings
$('textarea').bbco_autocomplete('bbcode');
+
+ $(document).on('click', '.vcard-header, .vcard-cancel-btn', updateView);
+ $(document).on('click', '.add-field', doAdd);
+ $(document).on('click', '.remove-field', doRemove);
+
+ function updateView() {
+ var id = $(this).data('id');
+ var action = $(this).data('action');
+ var header = $('#vcard-header-' + id);
+ var cancel = $('#vcard-cancel-' + id);
+ var addField = $('#vcard-add-field-' + id);
+ var info = $('#vcard-info-' + id);
+ var vcardPreview = $('#vcard-preview-' + id);
+ var fn = $('#vcard-fn-' + id);
+
+ if(action === 'open') {
+ $(header).addClass('active');
+ $(cancel).show();
+ $(addField).show();
+ $(info).show();
+ $(fn).show();
+ $(vcardPreview).hide();
+ }
+ else {
+ $(header).removeClass('active');
+ $(cancel).hide();
+ $(addField).hide();
+ $(info).hide();
+ $(fn).hide();
+ $(vcardPreview).show();
+ }
+ }
+
+ function doAdd() {
+ var what = $(this).data('add');
+ var id = $(this).data('id');
+ var element = '#template-form-' + what;
+ var where = '#abook-edit-form';
+
+ $(element + ' .remove-field').attr('data-id', id)
+
+ if(what === 'vcard-adr') {
+ var adrCount = $(where + ' .form-' + what).length;
+ var attrName = 'adr[' + adrCount + '][]';
+ $(element + ' input').attr('name', attrName);
+ }
+
+ if(what === 'vcard-org' || what === 'vcard-title' || what === 'vcard-note') {
+ $(where + ' .add-' + what).hide()
+ }
+
+ $(element).clone().removeAttr('id').appendTo(where + ' .form-' + what + '-wrapper');
+ }
+
+ function doRemove() {
+ var what = $(this).data('remove');
+ var element = $(this).parents('div.form-' + what);
+ var where = '#abook_edit_form' + $(this).data('id');
+
+ if(what === 'vcard-org' || what === 'vcard-title' || what === 'vcard-note') {
+ $(where + ' .add-' + what).show()
+ }
+
+ $(element).remove();
+ }
+
});