aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-03-08 09:39:46 +0100
committerMario Vavti <mario@mariovavti.com>2017-03-08 09:39:46 +0100
commitbc2b948f1f6e62b1c277a4042200bb6678956f3f (patch)
tree8586c30e495607eee23f16c0aad40974f0711275 /view/js
parent23e3e2c50499fab52769929a448e73012fd915af (diff)
parentff9442474d07cce24c8f66db39ec34471c3874a2 (diff)
downloadvolse-hubzilla-bc2b948f1f6e62b1c277a4042200bb6678956f3f.tar.gz
volse-hubzilla-bc2b948f1f6e62b1c277a4042200bb6678956f3f.tar.bz2
volse-hubzilla-bc2b948f1f6e62b1c277a4042200bb6678956f3f.zip
Merge branch 2.2RC2.2
Diffstat (limited to 'view/js')
-rw-r--r--view/js/acl.js1
-rw-r--r--view/js/autocomplete.js6
-rw-r--r--view/js/main.js69
-rw-r--r--view/js/mod_connedit.js98
-rw-r--r--view/js/mod_display.js7
-rw-r--r--view/js/mod_mail.js1
-rw-r--r--view/js/mod_profiles.js66
-rw-r--r--view/js/mod_settings.js45
8 files changed, 263 insertions, 30 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 62fc37420..5a616b6fc 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -270,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', 'highlight'];
+ 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);
@@ -309,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 01d562d1d..db7ad110b 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -308,12 +308,6 @@ $(function() {
}
}
- // fancyboxes
- // Is this actually used anywhere?
- $("a.popupbox").colorbox({
- 'transition' : 'elastic'
- });
-
NavUpdate();
// Allow folks to stop the ajax page updates with the pause/break key
$(document).keydown(function(event) {
@@ -374,30 +368,38 @@ function NavUpdate() {
updateCountsOnly = false;
+ if(data.network || data.home || data.intros || data.mail || data.all_events || data.notify) {
+ $('#notifications-btn').css('color', 'white').prop('disabled', false);
+ }
+ else {
+ $('#notifications-btn').css('color', 'grey').prop('disabled', true);
+ $('#navbar-collapse-1').removeClass('in');
+ }
+
if(data.network == 0) {
data.network = '';
- $('.net-update').removeClass('show');
+ $('.net-update, .net-button').hide();
} else {
- $('.net-update').addClass('show');
+ $('.net-update, .net-button').show();
}
$('.net-update').html(data.network);
- if(data.home == 0) { data.home = ''; $('.home-update').removeClass('show'); } else { $('.home-update').addClass('show'); }
+ if(data.home == 0) { data.home = ''; $('.home-update, .home-button').hide(); } else { $('.home-update, .home-button').show(); }
$('.home-update').html(data.home);
- if(data.intros == 0) { data.intros = ''; $('.intro-update').removeClass('show'); } else { $('.intro-update').addClass('show'); }
+ if(data.intros == 0) { data.intros = ''; $('.intro-update, .intro-button').hide(); } else { $('.intro-update, .intro-button').show(); }
$('.intro-update').html(data.intros);
- if(data.mail == 0) { data.mail = ''; $('.mail-update').removeClass('show'); } else { $('.mail-update').addClass('show'); }
+ if(data.mail == 0) { data.mail = ''; $('.mail-update, .mail-button').hide(); } else { $('.mail-update, .mail-button').show(); }
$('.mail-update').html(data.mail);
- if(data.notify == 0) { data.notify = ''; $('.notify-update').removeClass('show'); } else { $('.notify-update').addClass('show'); }
+ if(data.notify == 0) { data.notify = ''; $('.notify-update, .notify-button').hide(); } else { $('.notify-update, .notify-button').show(); }
$('.notify-update').html(data.notify);
if(data.register == 0) { data.register = ''; $('.register-update').removeClass('show'); } else { $('.register-update').addClass('show'); }
$('.register-update').html(data.register);
- if(data.events == 0) { data.events = ''; $('.events-update').removeClass('show'); } else { $('.events-update').addClass('show'); }
+ if(data.events == 0) { data.events = ''; $('.events-update, .events-button').hide(); } else { $('.events-update, .events-button').show(); }
$('.events-update').html(data.events);
if(data.events_today == 0) { data.events_today = ''; $('.events-today-update').removeClass('show'); } else { $('.events-today-update').addClass('show'); $('.events-update').html(data.events + '*'); }
@@ -409,7 +411,7 @@ function NavUpdate() {
if(data.birthdays_today == 0) { data.birthdays_today = ''; $('.birthdays-today-update').removeClass('show'); } else { $('.birthdays-today-update').addClass('show'); $('.birthdays-update').html(data.birthdays + '*'); }
$('.birthdays-today-update').html(data.birthdays_today);
- if(data.all_events == 0) { data.all_events = ''; $('.all_events-update').removeClass('show'); } else { $('.all_events-update').addClass('show'); }
+ if(data.all_events == 0) { data.all_events = ''; $('.all_events-update, .all_events-button').hide(); } else { $('.all_events-update, .all_events-button').show(); }
$('.all_events-update').html(data.all_events);
if(data.all_events_today == 0) { data.all_events_today = ''; $('.all_events-today-update').removeClass('show'); } else { $('.all_events-today-update').addClass('show'); $('.all_events-update').html(data.all_events + '*'); }
@@ -662,7 +664,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();
@@ -670,8 +678,8 @@ 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");
@@ -687,7 +695,7 @@ function collapseHeight() {
$(".wall-item-content, .directory-collapse").each(function() {
var orgHeight = $(this).outerHeight(true);
if(orgHeight > divmore_height) {
- if(! $(this).hasClass('divmore')) {
+ if(! $(this).hasClass('divmore') && $(this).has('div.no-collapse').length == 0) {
// 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) {
@@ -766,13 +774,6 @@ function liveUpdate() {
update_mode = 'append';
}
else {
-// if(bParam_static) {
-// in_progress = false;
-// if(timer) clearTimeout(timer);
-// timer = setTimeout(NavUpdate,10000);
-// return;
-// }
-
update_mode = 'update';
var orgHeight = $("#region_2").height();
}
@@ -1156,6 +1157,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;
diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js
index 84fff5ed1..4739c490c 100644
--- a/view/js/mod_connedit.js
+++ b/view/js/mod_connedit.js
@@ -1,6 +1,7 @@
$(document).ready(function() {
- $('form').areYouSure({'addRemoveFieldsMarksDirty':true, 'message': aStr['leavethispage'] }); // Warn user about unsaved settings
+ // Warn member about unsaved settings
+ $('form').areYouSure({'addRemoveFieldsMarksDirty':true, 'message': aStr['leavethispage'] });
if(typeof(after_following) !== 'undefined' && after_following) {
if(typeof(connectDefaultShare) !== 'undefined')
@@ -16,6 +17,80 @@ $(document).ready(function() {
connectFullShare();
});
+
+ $('#id_permcat').change(function() {
+ $('.loading-role-rotator').spin(true);
+ var permName = $('#id_permcat').val();
+ loadAbookRole(permName);
+ });
+
+
+
+ $(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() {
@@ -37,3 +112,24 @@ function connectFullShare() {
$('#me_id_perms_republish').attr('checked','checked');
$('#me_id_perms_post_like').attr('checked','checked');
}
+
+function loadAbookRole(name) {
+
+ if(! name)
+ name = 'default';
+
+ $('.abook-edit-me').each(function() {
+ if(! $(this).is(':disabled'))
+ $(this).removeAttr('checked');
+ });
+
+ $.get('permcat/' + name, function(data) {
+ $(data.perms).each(function() {
+ if(this.value)
+ $('#me_id_perms_' + this.name).attr('checked','checked');
+ });
+ $('.loading-role-rotator').spin(false);
+ });
+}
+
+
diff --git a/view/js/mod_display.js b/view/js/mod_display.js
new file mode 100644
index 000000000..60a1cdaa8
--- /dev/null
+++ b/view/js/mod_display.js
@@ -0,0 +1,7 @@
+<script>
+$(document).ready(function() {
+ $(".comment-edit-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
+ // make auto-complete work in more places
+ $(".wall-item-comment-wrapper textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
+});
+</script>
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();
+ }
+
});
diff --git a/view/js/mod_settings.js b/view/js/mod_settings.js
index db321ae70..f9faa3d5c 100644
--- a/view/js/mod_settings.js
+++ b/view/js/mod_settings.js
@@ -17,6 +17,16 @@ $(document).ready(function() {
else
$('#advanced-perm').hide();
});
+
+ $('#id_permcat_list').change(function() {
+ $('.loading-role-rotator').spin(true);
+ var permName = $('#id_permcat').val();
+ loadPermcat(permName);
+ });
+
+
+
+
});
@@ -27,12 +37,19 @@ function setTheme(elm) {
function previewTheme(elm) {
theme = $(elm).val();
+ var schema = $('#id_schema').val();
$.getJSON('theme_info/' + theme,function(data) {
$('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" style="max-width:100%; max-height:300px" alt="' + theme + '"></a>');
$('#id_schema').empty();
- $(data.schemas).each(function(index,item) {
- $('<option/>',{value:item['key'],text:item['val']}).appendTo('#id_schema');
- });
+ if(data.schemas.length) {
+ $(data.schemas).each(function(index,item) {
+ $('<option/>',{value:item['key'],text:item['val']}).appendTo('#id_schema');
+ });
+ $('#id_schema').val(schema ? schema : '---');
+ }
+ else {
+ $('<option/>',{value:'',text:'No schemes available'}).appendTo('#id_schema');
+ }
$('#custom-settings-content .section-content-tools-wrapper').html(data.config);
});
}
@@ -137,3 +154,25 @@ function channel_privacy_macro(n) {
$('#id_profile_in_directory').val(1);
}
}
+
+
+
+function loadPermcat(name) {
+
+ if(! name)
+ name = 'default';
+
+ $('.abook-edit-me').each(function() {
+ if(! $(this).is(':disabled'))
+ $(this).removeAttr('checked');
+ });
+
+ $.get('permcat/' + name, function(data) {
+ $(data.perms).each(function() {
+ if(this.value)
+ $('#me_id_perms_' + this.name).attr('checked','checked');
+ });
+ $('.loading-role-rotator').spin(false);
+ });
+}
+