aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-07-29 06:59:13 +0000
committerMario <mario@mariovavti.com>2021-07-29 06:59:13 +0000
commit9722d157bf138753bc168f68c56b4963db6da4e9 (patch)
treea15bb81c35a2367fe4628614471d471ed86d2712 /view/js
parent219d47f04c7bb04dcc241b9ed6ca411fc9653f09 (diff)
parentc6133d2558ce29e44342fa7be8bb65e0059aea02 (diff)
downloadvolse-hubzilla-9722d157bf138753bc168f68c56b4963db6da4e9.tar.gz
volse-hubzilla-9722d157bf138753bc168f68c56b4963db6da4e9.tar.bz2
volse-hubzilla-9722d157bf138753bc168f68c56b4963db6da4e9.zip
Merge branch 'dev' into bs5
Diffstat (limited to 'view/js')
-rw-r--r--view/js/autocomplete.js15
-rw-r--r--view/js/main.js531
-rw-r--r--view/js/mod_hq.js31
-rw-r--r--view/js/mod_photos.js20
-rw-r--r--view/js/mod_register.js2
-rw-r--r--view/js/mod_settings.js8
6 files changed, 153 insertions, 454 deletions
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index c45c47518..f20c45982 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -162,8 +162,8 @@ function string2bb(element) {
if (typeof extra_channels === 'undefined') extra_channels = false;
// Autocomplete contacts
- contacts = {
- match: /(^|\s)(@\!*)([^ \n]{3,})$/,
+ channels = {
+ match: /(^(?=[^\!]{2})|\s)(@)([^ \n]{3,})$/,
index: 3,
cache: true,
search: function(term, callback) { contact_search(term, callback, backend_url, 'c', extra_channels, spinelement=false); },
@@ -171,6 +171,15 @@ function string2bb(element) {
template: contact_format
};
+ contacts = {
+ match: /(^|\s)(@\!)([^ \n]{3,})$/,
+ index: 3,
+ cache: true,
+ search: function(term, callback) { contact_search(term, callback, backend_url, 'm', extra_channels, spinelement=false); },
+ replace: editor_replace,
+ template: contact_format
+ };
+
// Autocomplete hashtags
tags = {
match: /(^|\s)(\#)([^ \n]{2,})$/,
@@ -202,7 +211,7 @@ function string2bb(element) {
maxCount: 100
}
});
- textcomplete.register([contacts,smilies,tags]);
+ textcomplete.register([channels,contacts,smilies,tags]);
});
};
})( jQuery );
diff --git a/view/js/main.js b/view/js/main.js
index c367021eb..bc8155c58 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -26,13 +26,6 @@ var followUpPageLoad = false;
var window_needs_alert = true;
var expanded_items = [];
-var sse_bs_active = false;
-var sse_offset = 0;
-var sse_type;
-var sse_partial_result = false;
-var sse_rmids = [];
-var sse_fallback_interval;
-
var page_cache = {};
// take care of tab/window reloads on channel change
@@ -93,7 +86,7 @@ $(document).ready(function() {
if (tao.zin.syslc == '') {
$('.zinlcx').append(tao.zin.axim);
$.ajax({
- type: 'POST', url: 'lang',
+ type: 'POST', url: 'lang',
data: { zinlc: '??' }
}).done( function(re) {
tao.zin.re = JSON.parse(re);
@@ -117,7 +110,7 @@ $(document).ready(function() {
tao.zin.me = e.target.id.substr(5);
$('#right_aside_wrapper').append(tao.zin.axim);
$.ajax({
- type: 'POST', url: 'lang',
+ type: 'POST', url: 'lang',
data: { zinlc: tao.zin.me }
}).done( function(re) {
tao.zin.re = JSON.parse(re);
@@ -161,110 +154,63 @@ $(document).ready(function() {
jQuery.timeago.settings.allowFuture = true;
- if(sse_enabled) {
- if(typeof(window.SharedWorker) === 'undefined') {
- // notifications with multiple tabs open will not work very well in this scenario
- var evtSource = new EventSource('/sse');
-
- evtSource.addEventListener('notifications', function(e) {
- var obj = JSON.parse(e.data);
- sse_handleNotifications(obj, false, false);
- }, false);
+ $(document).on('click', '.notification, .message', function(e) {
+ let b64mid = $(this).data('b64mid');
+ let notify_id = $(this).data('notify_id');
+ let path = $(this)[0].pathname.split('/')[1];
+ let stateObj = { b64mid: b64mid };
+ let singlethread_modules = ['display', 'hq', 'dm'];
+ let redirect_modules = ['display', 'notify'];
- document.addEventListener('visibilitychange', function() {
- if (!document.hidden) {
- sse_offset = 0;
- sse_bs_init();
- }
- }, false);
+ if(! b64mid && ! notify_id)
+ return;
+ if(redirect_modules.indexOf(path) !== -1) {
+ path = 'hq';
}
- else {
- var myWorker = new SharedWorker('/view/js/sse_worker.js', localUser);
-
- myWorker.port.onmessage = function(e) {
- obj = e.data;
- console.log(obj);
- sse_handleNotifications(obj, false, false);
- }
- myWorker.onerror = function(e) {
- myWorker.port.close();
- }
+ if(notify_id != null) {
+ $.ajax({
+ type: 'post',
+ url: 'notify',
+ data: {
+ 'notify_id' : notify_id
+ },
+ async: ((module !== path) ? false : true)
+ });
+ }
- myWorker.port.start();
+ if (module !== path) {
+ e.preventDefault();
+ window.location.href = path + '/' + b64mid;
}
- }
- else {
- if (!document.hidden)
- sse_fallback_interval = setInterval(sse_fallback, updateInterval);
+ else {
- document.addEventListener('visibilitychange', function() {
- if (document.hidden) {
- clearInterval(sse_fallback_interval);
+ if (singlethread_modules.indexOf(module) !== -1) {
+ history.pushState(stateObj, '', module + '/' + b64mid);
+ $('.message').removeClass('active');
+ $('[data-b64mid="' + b64mid + '"].message').addClass('active');
}
- else {
- sse_offset = 0;
- sse_bs_init();
- sse_fallback_interval = setInterval(sse_fallback, updateInterval);
- }
-
- }, false);
- }
-
- $('.notification-link').on('click', { replace: true, followup: false }, sse_bs_notifications);
-
- $('.notification-filter').on('keypress', function(e) {
- if(e.which == 13) { // enter
- this.blur();
- sse_offset = 0;
- $("#nav-" + sse_type + "-menu").html('');
- $("#nav-" + sse_type + "-loading").show();
- var cn_val = $('#cn-' + sse_type + '-input').length ? $('#cn-' + sse_type + '-input').val().toString().toLowerCase() : '';
+ if (b64mid) {
- $.get('/sse_bs/' + sse_type + '/' + sse_offset + '?nquery=' + encodeURIComponent(cn_val), function(obj) {
- console.log('sse: bootstraping ' + sse_type);
- console.log(obj);
+ e.preventDefault();
- sse_bs_active = false;
- sse_partial_result = true;
- sse_offset = obj[sse_type].offset;
- if(sse_offset < 0)
- $("#nav-" + sse_type + "-loading").hide();
-
- sse_handleNotifications(obj, true, false);
-
- });
+ if(! page_load) {
+ prepareLiveUpdate(b64mid, notify_id);
+ }
+ }
}
});
- $('.notifications-textinput-clear').on('click', function(e) {
- if(! sse_partial_result)
- return;
-
- $("#nav-" + sse_type + "-menu").html('');
- $("#nav-" + sse_type + "-loading").show();
- $.get('/sse_bs/' + sse_type, function(obj) {
- console.log('sse: bootstraping ' + sse_type);
- console.log(obj);
-
- sse_bs_active = false;
- sse_partial_result = false;
- sse_offset = obj[sse_type].offset;
- if(sse_offset < 0)
- $("#nav-" + sse_type + "-loading").hide();
-
- sse_handleNotifications(obj, true, false);
-
- });
- });
-
- $('.notification-content').on('scroll', function() {
- if(this.scrollTop > this.scrollHeight - this.clientHeight - (this.scrollHeight/7)) {
- sse_bs_notifications(sse_type, false, true);
+ window.onpopstate = function(e) {
+ if(e.state !== null && e.state.b64mid !== bParam_mid) {
+ prepareLiveUpdate(e.state.b64mid, '');
+ $('.message').removeClass('active');
+ $('[data-b64mid="' + e.state.b64mid + '"].message').addClass('active');
}
- });
+
+ };
//mod_mail only
$(".mail-conv-detail .autotime").timeago();
@@ -602,8 +548,10 @@ function markRead(notifType) {
$('#nav-' + notifType + '-menu').html('');
$('#nav-' + notifType + '-sub').removeClass('show');
sessionStorage.removeItem('notification_open');
- sse_setNotificationsStatus();
+ $(document).trigger('hz:sse_setNotificationsStatus');
});
+
+
}
function markItemRead(itemId) {
@@ -771,52 +719,18 @@ function updateConvItems(mode,data) {
}
}
- // take care of the notifications count updates
- var nmids = $(this).data('b64mids');
-
- nmids.forEach(function(nmid, index) {
-
- sse_rmids.push(nmid);
-
- if($('.notification[data-b64mid=\'' + nmid + '\']').length) {
- $('.notification[data-b64mid=\'' + nmid + '\']').each(function() {
- var n = this.parentElement.id.split('-');
- return sse_updateNotifications(n[1], nmid);
- });
- }
-
- // special handling for forum notifications
- $('.notification-forum').filter(function() {
- var fmids = decodeURIComponent($(this).data('b64mids'));
- var n = this.parentElement.id.split('-');
- if(fmids.indexOf(nmid) > -1) {
- var fcount = Number($('.' + n[1] + '-update').html());
- fcount--;
- $('.' + n[1] + '-update').html(fcount);
- if(fcount < 1)
- $('.' + n[1] + '-button').fadeOut();
-
- var count = Number($(this).find('.badge-secondary').html());
- count--;
- $(this).find('.badge-secondary').html(count);
- if(count < 1)
- $(this).remove();
- }
- });
-
-
- });
-
- sse_setNotificationsStatus();
+ $(document).trigger('hz:sse_setNotificationsStatus', [$(this).data('b64mids')]);
});
$(window).scrollTop(scroll_position);
- if(followUpPageLoad)
- sse_bs_counts();
- else
- sse_bs_init();
+ if(followUpPageLoad) {
+ $(document).trigger('hz:sse_bs_counts');
+ }
+ else {
+ $(document).trigger('hz:sse_bs_init');
+ }
if(commentBusy) {
commentBusy = false;
@@ -956,7 +870,7 @@ function updateInit() {
liveUpdate();
}
else {
- sse_bs_init();
+ $(document).trigger('hz:sse_bs_init');
}
if($('#live-photos').length || $('#live-cards').length || $('#live-articles').length ) {
@@ -967,6 +881,20 @@ function updateInit() {
}
}
+function prepareLiveUpdate(b64mid, notify_id) {
+ $(document).scrollTop(0);
+ $('.thread-wrapper').remove();
+ bParam_mid = b64mid;
+ mode = 'replace';
+ page_load = true;
+ if (module == 'hq') {
+ liveUpdate(notify_id);
+ }
+ if (module == 'display'|| module == 'dm') {
+ liveUpdate();
+ }
+}
+
function liveUpdate(notify_id) {
if(typeof profile_uid === 'undefined') profile_uid = false; /* Should probably be unified with channelId defined in head.tpl */
@@ -1052,7 +980,7 @@ function liveUpdate(notify_id) {
if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') {
$.post(
- "hq",
+ "notify",
{
"notify_id" : notify_id
}
@@ -1314,7 +1242,7 @@ function dopin(id) {
});
}
-function dropItem(url, object) {
+function dropItem(url, object, b64mid) {
var confirm = confirmDelete();
if(confirm) {
var id = url.split('/')[2];
@@ -1324,13 +1252,20 @@ function dropItem(url, object) {
$.get(url, function() {
$(object + ', #pinned-wrapper-' + id).remove();
$('body').css('cursor', 'auto');
+
+ if (typeof b64mid !== typeof undefined) {
+ $('[data-b64mid=\'' + b64mid + '\']').fadeOut(function() {
+ this.remove();
+ });
+ }
});
- if($('#wall-item-pinned-' + id).length)
+ if($('#wall-item-pinned-' + id).length) {
$.post('pin/pin', { 'id' : id });
+ }
return true;
- }
+ }
else {
return false;
}
@@ -1760,294 +1695,40 @@ function zid(s) {
return s;
}
-function sse_bs_init() {
- if(sessionStorage.getItem('notification_open') !== null || typeof sse_type !== 'undefined' ) {
- if(typeof sse_type === 'undefined')
- sse_type = sessionStorage.getItem('notification_open');
-
- $("#nav-" + sse_type + "-sub").addClass('show');
- sse_bs_notifications(sse_type, true, false);
- }
- else {
- sse_bs_counts();
- }
-}
-
-function sse_bs_counts() {
- if(sse_bs_active)
- return;
-
- sse_bs_active = true;
-
- $.ajax({
- type: 'post',
- url: '/sse_bs',
- data: { sse_rmids }
- }).done( function(obj) {
- console.log(obj);
- sse_bs_active = false;
- sse_rmids = [];
- sse_handleNotifications(obj, true, false);
- });
-}
-
-function sse_bs_notifications(e, replace, followup) {
-
- if(sse_bs_active)
- return;
-
-
- var manual = false;
-
- if(typeof replace === 'undefined')
- replace = e.data.replace;
-
- if(typeof followup === 'undefined')
- followup = e.data.followup;
-
- if(typeof e === 'string') {
- sse_type = e;
- }
- else {
- manual = true;
- sse_offset = 0;
- sse_type = e.target.dataset.sse_type;
- }
-
- if(typeof sse_type === 'undefined')
- return;
-
- if(followup || !manual || !($('#nav-' + sse_type + '-sub').hasClass('collapse') && $('#nav-' + sse_type + '-sub').hasClass('show'))) {
-
- if(sse_offset >= 0) {
- $("#nav-" + sse_type + "-loading").show();
- }
-
- sessionStorage.setItem('notification_open', sse_type);
- if(sse_offset !== -1 || replace) {
-
- var cn_val = (($('#cn-' + sse_type + '-input').length && sse_partial_result) ? $('#cn-' + sse_type + '-input').val().toString().toLowerCase() : '');
-
- $("#nav-" + sse_type + "-loading").show();
-
- sse_bs_active = true;
-
- $.ajax({
- type: 'post',
- url: '/sse_bs/' + sse_type + '/' + sse_offset,
- nquery: encodeURIComponent(cn_val),
- data: { sse_rmids }
- }).done(function(obj) {
- console.log('sse: bootstraping ' + sse_type);
- console.log(obj);
- sse_bs_active = false;
- sse_rmids = [];
- $("#nav-" + sse_type + "-loading").hide();
- sse_offset = obj[sse_type].offset;
- sse_handleNotifications(obj, replace, followup);
- });
- }
- else
- $("#nav-" + sse_type + "-loading").hide();
-
- }
- else {
- sessionStorage.removeItem('notification_open');
- }
-}
-
-function sse_handleNotifications(obj, replace, followup) {
-
- var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
- var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
- var all_notifications = primary_notifications.concat(secondary_notifications);
-
- all_notifications.forEach(function(type, index) {
- if(typeof obj[type] === typeof undefined)
- return true;
-
- if(obj[type].count) {
- $('.' + type + '-button').fadeIn();
- if(replace || followup)
- $('.' + type + '-update').html(Number(obj[type].count));
- else
- $('.' + type + '-update').html(Number(obj[type].count) + Number($('.' + type + '-update').html()));
- }
- else {
- $('.' + type + '-update').html('0');
- $('.' + type + '-button').fadeOut(function() {
- sse_setNotificationsStatus();
- });
- }
- if(obj[type].notifications.length)
- sse_handleNotificationsItems(type, obj[type].notifications, replace, followup);
- });
-
- sse_setNotificationsStatus();
-
- // notice and info
- $.jGrowl.defaults.closerTemplate = '<div>[ ' + aStr.closeAll + ']</div>';
-
- if(obj.notice) {
- $(obj.notice.notifications).each(function() {
- $.jGrowl(this, { sticky: true, theme: 'notice' });
- });
- }
-
- if(obj.info) {
- $(obj.info.notifications).each(function(){
- $.jGrowl(this, { sticky: false, theme: 'info', life: 10000 });
- });
- }
-
- // load more notifications if visible notifications count becomes low
- if(sse_type && sse_offset != -1 && $('#nav-' + sse_type + '-menu').children().length <= 20) {
- sse_offset = 0;
- sse_bs_notifications(sse_type, false, true);
- }
-
-
-}
-
-function sse_handleNotificationsItems(notifyType, data, replace, followup) {
-
- var notifications_tpl = ((notifyType == 'forums') ? decodeURIComponent($("#nav-notifications-forums-template[rel=template]").html().replace('data-src', 'src')) : decodeURIComponent($("#nav-notifications-template[rel=template]").html().replace('data-src', 'src')));
- var notify_menu = $("#nav-" + notifyType + "-menu");
- var notify_loading = $("#nav-" + notifyType + "-loading");
- var notify_count = $("." + notifyType + "-update");
-
- if(replace && !followup) {
- notify_menu.html('');
- notify_loading.hide();
- }
-
- $(data).each(function() {
-
- // do not add a notification if it is already present
- if($('#nav-' + notifyType + '-menu .notification[data-b64mid=\'' + this.b64mid + '\']').length)
- return true;
-
- html = notifications_tpl.format(this.notify_link,this.photo,this.name,this.addr,this.message,this.when,this.hclass,this.b64mid,this.notify_id,this.thread_top,this.unseen,this.private_forum, encodeURIComponent(this.mids), this.body);
- notify_menu.append(html);
- });
-
- if(!replace && !followup) {
- $("#nav-" + notifyType + "-menu .notification").sort(function(a,b) {
- a = new Date(a.dataset.when);
- b = new Date(b.dataset.when);
- return a > b ? -1 : a < b ? 1 : 0;
- }).appendTo('#nav-' + notifyType + '-menu');
- }
-
- $(document.body).trigger("sticky_kit:recalc");
- $("#nav-" + notifyType + "-menu .notifications-autotime").timeago();
-
- if($('#tt-' + notifyType + '-only').hasClass('active'))
- $('#nav-' + notifyType + '-menu [data-thread_top=false]').addClass('tt-filter-active');
-
- if($('#cn-' + notifyType + '-input').length) {
- var filter = $('#cn-' + notifyType + '-input').val().toString().toLowerCase();
- if(filter) {
- filter = filter.indexOf('%') == 0 ? filter.substring(1) : filter;
-
- $('#nav-' + notifyType + '-menu .notification').each(function(i, el) {
- var cn = $(el).data('contact_name').toString().toLowerCase();
- var ca = $(el).data('contact_addr').toString().toLowerCase();
- if(cn.indexOf(filter) === -1 && ca.indexOf(filter) === -1)
- $(el).addClass('cn-filter-active');
- else
- $(el).removeClass('cn-filter-active');
- });
- }
+function makeid(length) {
+ var result = '';
+ var characters = 'abcdef0123456789';
+ var charactersLength = characters.length;
+ for ( var i = 0; i < length; i++ ) {
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
+ return result;
}
-function sse_updateNotifications(type, mid) {
-
- if(type === 'pubs')
- return true;
-
- if(type === 'notify' && (mid !== bParam_mid || sse_type !== 'notify'))
- return true;
-/*
- var count = Number($('.' + type + '-update').html());
-
- count--;
-
- if(count < 1) {
- $('.' + type + '-update').html(count);
- $('.' + type + '-button').fadeOut(function() {
- sse_setNotificationsStatus();
+function push_notification_request(e) {
+ if (!('Notification' in window)) {
+ alert('This browser does not support push notifications');
+ }
+ else if (Notification.permission !== 'granted') {
+ Notification.requestPermission(function(permission) {
+ if(permission === 'granted') {
+ $(e.target).closest('div').hide();
+ }
});
- }
- else {
- $('.' + type + '-update').html(count);
- }
-*/
-
- $('#nav-' + type + '-menu .notification[data-b64mid=\'' + mid + '\']').fadeOut(function() {
- this.remove();
- });
-
+ }
}
-function sse_setNotificationsStatus() {
- var primary_notifications = ['dm', 'home', 'intros', 'register', 'notify', 'files'];
- var secondary_notifications = ['network', 'forums', 'all_events', 'pubs'];
- var all_notifications = primary_notifications.concat(secondary_notifications);
-
- var primary_available = false;
- var any_available = false;
- all_notifications.forEach(function(type, index) {
- if($('.' + type + '-button').css('display') == 'block') {
- any_available = true;
- if(primary_notifications.indexOf(type) > -1)
- primary_available = true;
- }
- });
-
- if(primary_available) {
- $('.notifications-btn-icon').removeClass('fa-exclamation-circle');
- $('.notifications-btn-icon').addClass('fa-exclamation-triangle');
- }
- else {
- $('.notifications-btn-icon').removeClass('fa-exclamation-triangle');
- $('.notifications-btn-icon').addClass('fa-exclamation-circle');
- }
-
- if(any_available) {
- $('.notifications-btn').css('opacity', 1);
- $('#no_notifications').hide();
- $('#notifications').show();
- }
- else {
- $('.notifications-btn').css('opacity', 0.5);
- $('#navbar-collapse-1').removeClass('show');
- $('#no_notifications').show();
- $('#notifications').hide();
+function push_notification(title, body, href) {
+ let options = {
+ body: body,
+ data: href,
+ icon: '/images/hz-64.png',
+ silent: false
}
-}
-
-function sse_fallback() {
- $.get('/sse', function(obj) {
- if(! obj)
- return;
-
- console.log('sse fallback');
- console.log(obj);
-
- sse_handleNotifications(obj, false, false);
- });
-}
-
-function makeid(length) {
- var result = '';
- var characters = 'abcdef0123456789';
- var charactersLength = characters.length;
- for ( var i = 0; i < length; i++ ) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
+ let n = new Notification(title, options);
+ n.onclick = function (e) {
+ window.location.href = e.target.data;
}
- return result;
}
diff --git a/view/js/mod_hq.js b/view/js/mod_hq.js
index b321382bd..ad77e0af0 100644
--- a/view/js/mod_hq.js
+++ b/view/js/mod_hq.js
@@ -1,10 +1,25 @@
-$(document).on('click', '#jot-toggle', function(e) {
- e.preventDefault();
- e.stopPropagation();
-
- $(this).toggleClass('active');
- $(window).scrollTop(0);
- $('#jot-popup').toggle();
- $('#profile-jot-text').focus();
+$(document).ready(function() {
+
+ $(document).on('click', '.jot-toggle', function(e) {
+ $(window).scrollTop(0);
+ $(document).trigger('hz:hqControlsClickAction');
+ $('#jot-popup').toggle();
+ $('#profile-jot-text').focus();
+ });
+
+ $(document).on('click', '.notes-toggle', function(e) {
+ $(window).scrollTop(0);
+ $(document).trigger('hz:hqControlsClickAction');
+ $('#personal-notes').toggleClass('d-none');
+ $('#note-text').focus();
+ });
+
+ $(document).on('hz:handleNetworkNotificationsItems', function(e, obj) {
+ push_notification(
+ obj.name,
+ $('<p>' + obj.message + '</p>').text(),
+ baseurl + '/hq/' + obj.b64mid
+ );
+ });
});
diff --git a/view/js/mod_photos.js b/view/js/mod_photos.js
index af675e31c..1ce410a1b 100644
--- a/view/js/mod_photos.js
+++ b/view/js/mod_photos.js
@@ -8,23 +8,11 @@ $(document).ready(function() {
UploadInit();
}
- $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
- $("#photo-edit-newtag").val('@' + data.name);
- });
-
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
+ $('textarea').editor_autocomplete(baseurl+"/acl");
$('textarea').bbco_autocomplete('bbcode');
- showHideBodyTextarea();
-
});
-function showHideBodyTextarea() {
- if( $('#id_visible').is(':checked'))
- $('#body-textarea').slideDown();
- else
- $('#body-textarea').slideUp();
-}
-
// initialize
function UploadInit() {
@@ -70,12 +58,12 @@ function UploadInit() {
progress: function(e,data) {
- // there will only be one file, the one we are looking for
+ // there will only be one file, the one we are looking for
$(data.files).each( function() {
var idx = this.count;
- // Dynamically update the percentage complete displayed in the file upload list
+ // Dynamically update the percentage complete displayed in the file upload list
$('#upload-progress-' + idx).html(Math.round(data.loaded / data.total * 100) + '%');
$('#upload-progress-bar-' + idx).css('background-size', Math.round(data.loaded / data.total * 100) + '%');
@@ -283,7 +271,7 @@ function UploadFile(file, idx) {
$('#upload-progress-' + idx).html('<span style="color: red;">ERROR</span>');
});
- // POST to the entire cloud path
+ // POST to the entire cloud path
xhr.open('post', $('#photos-upload-form').attr( 'action' ), true);
var formfields = $("#photos-upload-form").serializeArray();
diff --git a/view/js/mod_register.js b/view/js/mod_register.js
index 1fc5ad2fa..f54dd2570 100644
--- a/view/js/mod_register.js
+++ b/view/js/mod_register.js
@@ -3,7 +3,7 @@ $(document).ready(function() {
typeof(window.tao) == 'undefined' ? window.tao = {} : '';
tao.zar = { vsn: '2.0.0', form: {}, msg: {} };
tao.zar.patano = /^d[0-9]{5,10}$/;
- tao.zar.patema = /^[a-z0-9.-]{1,64}@[a-z0-9.-]{2,32}\.[a-z]{2,12}$/;
+ tao.zar.patema = /^[^@\s]{1,64}@[a-z0-9.-]{2,32}\.[a-z]{2,12}$/;
$('.register_date').each( function () {
var date = new Date($(this).data('utc'));
diff --git a/view/js/mod_settings.js b/view/js/mod_settings.js
index d3392c748..3e91dac9a 100644
--- a/view/js/mod_settings.js
+++ b/view/js/mod_settings.js
@@ -24,8 +24,14 @@ $(document).ready(function() {
loadPermcat(permName);
});
+ if (Notification.permission !== 'granted') {
+ $('#desktop-notifications-info').show();
+ }
-
+ $('#desktop-notifications-request').on('click', function(e) {
+ e.preventDefault();
+ push_notification_request(e);
+ });
});