See More
' + notificationContent.text + ''); let buttonsWrapper = $('
').addClass('row'); let buttonsWrapperCol = $('
').addClass('col-12').addClass('text-right'); let buttonCancel = $('
').addClass('btn').addClass('btn-danger').addClass('mr-2').html('Cancel') let buttonSuccess = $('
').addClass('btn').addClass('btn-success').html('OK') $(buttonsWrapper).append(buttonsWrapperCol); $(buttonsWrapperCol).append(buttonCancel); $(buttonsWrapperCol).append(buttonSuccess); $(modalBody).append(message).append(buttonsWrapper); $(modalContent).append(modalBody); $(modalDialog).append(modalContent); $(modal).append(modalDialog); $(buttonCancel).on('click', (event) => { event.preventDefault(); event.stopPropagation(); event.stopImmediatePropagation(); $(modal).modal('hide'); }); $(buttonSuccess).on('click', (event) => { event.preventDefault(); event.stopPropagation(); event.stopImmediatePropagation(); $(modal).modal('hide'); handleOnclickNotification(notificationContent); }); $(modal).modal('show'); setTimeout(() => { dispatchEvent(new CustomEvent('modalLoaded', {'detail': 'modal-notification' + randomId})); }, 1000); } window.addEventListener('modalLoaded', function (event) { setTimeout(() => { $('#' + event.detail).modal('hide'); }, 9000); }); function handleOnclickNotification(notificationContent) { if (notificationContent.hasOwnProperty('withConnect') && notificationContent.withConnect.length > 0) { acceptContactRequest(notificationContent); } if (notificationContent.hasOwnProperty('url')) { if (window.isSafari && isOS()) { window.location.href = notificationContent.url; } else { window.open(notificationContent.url, '_blank').focus(); } } else { if (window.isSafari && isOS()) { window.open('https://networker.copernicus.org/my-network', '_blank'); } else { window.open('https://networker.copernicus.org/my-network', '_blank').focus(); } } } /** * * @param notificationContent */ function acceptContactRequest(notificationContent) { const formData = new FormData(); formData.append('r', notificationContent.userFrom); formData.append('a', 'a'); $.ajax({ url: 'https://networker.copernicus.org/handle-request-job', type: 'POST', data: formData, processData: false, contentType: false, xhrFields: { withCredentials: true }, beforeSend: function () { $('.splash').fadeIn(); $('.lightbox').fadeIn(); } }) .done(function (dataResponse) { const data = JSON.parse(dataResponse); let text = 'Please consider joining the text chat now.'; window.sendPushNotification({ title: window.userDataCommonNetworker.name + ' aims to chat with you.', text: text, user: data.message.userIdentifier, url: notificationContent.url }); $('.splash').fadeOut(); $('.lightbox').fadeOut(); }) .fail(function (error) { $('.splash').fadeOut(); $('.lightbox').fadeOut(); }); } } function templateHasBootstrap() { const bootstrap = document.getElementById('hasBootstrap'); return bootstrap !== null && typeof bootstrap !== 'undefined'; } coNetworker_sendUsersLocation(); dispatchEvent(new CustomEvent('loadCommonNetworker')); function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; }
Copernicus Office authentication
| Copernicus.org |
Login
Create account
Resend login data