aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
authornobody <nobody@zotlabs.com>2021-07-06 05:02:52 -0700
committernobody <nobody@zotlabs.com>2021-07-06 05:02:52 -0700
commit73b53675b1a339cfd950845279438e35b4e2dc7c (patch)
tree6b433b3f21585230bfbc71d955c8a8bcc82dd5e8 /view/js
parentefda8aac1d7d90fd7eda4a449332eedf74342951 (diff)
parent9b9ac5054fcc424a556f366284501882b1e02e9e (diff)
downloadvolse-hubzilla-73b53675b1a339cfd950845279438e35b4e2dc7c.tar.gz
volse-hubzilla-73b53675b1a339cfd950845279438e35b4e2dc7c.tar.bz2
volse-hubzilla-73b53675b1a339cfd950845279438e35b4e2dc7c.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'view/js')
-rw-r--r--view/js/main.js40
-rw-r--r--view/js/mod_hq.js16
-rw-r--r--view/js/mod_photos.js15
-rw-r--r--view/js/mod_settings.js8
4 files changed, 66 insertions, 13 deletions
diff --git a/view/js/main.js b/view/js/main.js
index 78bd790cd..f427df8ad 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1274,7 +1274,7 @@ function dopin(id) {
});
}
-function dropItem(url, object) {
+function dropItem(url, object, b64mid) {
var confirm = confirmDelete();
if(confirm) {
var id = url.split('/')[2];
@@ -1284,13 +1284,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;
}
@@ -1730,3 +1737,30 @@ function makeid(length) {
return result;
}
+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();
+ }
+ });
+ }
+}
+
+
+function push_notification(title, body, href) {
+ let options = {
+ body: body,
+ data: href,
+ icon: '/images/hz-64.png',
+ silent: false
+ }
+
+ let n = new Notification(title, options);
+ n.onclick = function (e) {
+ window.location.href = e.target.data;
+ }
+}
diff --git a/view/js/mod_hq.js b/view/js/mod_hq.js
index 0a3939913..ad77e0af0 100644
--- a/view/js/mod_hq.js
+++ b/view/js/mod_hq.js
@@ -1,13 +1,25 @@
$(document).ready(function() {
- $(document).on('click', '#jot-toggle', function(e) {
+ $(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) {
+ $(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..41b8ed560 100644
--- a/view/js/mod_photos.js
+++ b/view/js/mod_photos.js
@@ -8,11 +8,12 @@ $(document).ready(function() {
UploadInit();
}
- $("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'a', false, function(data) {
- $("#photo-edit-newtag").val('@' + data.name);
- });
-
+ //$("#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();
@@ -70,12 +71,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 +284,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_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);
+ });
});