Compare commits
2 Commits
65147a9ac6
...
d21febaaa1
| Author | SHA1 | Date | |
|---|---|---|---|
| d21febaaa1 | |||
| 6acba9c082 |
@@ -3,20 +3,11 @@
|
||||
<head>
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script>
|
||||
(function (w, d, s, l, i) {
|
||||
w[l] = w[l] || [];
|
||||
w[l].push({
|
||||
'gtm.start': new Date().getTime(), event: 'gtm.js'
|
||||
});
|
||||
var f = d.getElementsByTagName(s)[0],
|
||||
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||
j.async = true;
|
||||
j.src =
|
||||
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||
f.parentNode.insertBefore(j, f);
|
||||
})(window, document, 'script', 'dataLayer', 'UA-98246968-1');
|
||||
</script>
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-P4G65WJ');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
<script type="text/javascript" defer="defer" src="https://extend.vimeocdn.com/ga/64189815.js"></script>
|
||||
|
||||
|
||||
@@ -3,20 +3,11 @@
|
||||
<head>
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script>
|
||||
(function (w, d, s, l, i) {
|
||||
w[l] = w[l] || [];
|
||||
w[l].push({
|
||||
'gtm.start': new Date().getTime(), event: 'gtm.js'
|
||||
});
|
||||
var f = d.getElementsByTagName(s)[0],
|
||||
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||
j.async = true;
|
||||
j.src =
|
||||
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||
f.parentNode.insertBefore(j, f);
|
||||
})(window, document, 'script', 'dataLayer', 'GTM-P4G65WJ');
|
||||
</script>
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-P4G65WJ');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
<script type="text/javascript" defer="defer" src="https://extend.vimeocdn.com/ga/64189815.js"></script>
|
||||
|
||||
|
||||
@@ -83,13 +83,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{#<div id="newApp" class="container-fluid">
|
||||
<div id="newApp" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col s12 m12">
|
||||
<p>"Nouveau ! Trouvez un job plus facilement avec notre <a href="http://pp.app.talentstube.com">web application</a>.📲"</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>#}
|
||||
</div>
|
||||
</div>
|
||||
<div class="nav-wrapper">
|
||||
<ul class="side-nav collapsible" data-collapsible="accordion" id="mobile-demo">
|
||||
|
||||
@@ -745,7 +745,8 @@ EdeclicLib = window.EdeclicLib || {},
|
||||
|
||||
navigator.serviceWorker.addEventListener('message', event => {
|
||||
|
||||
var toastHTML = '<div class="card white horizontal"><div class="card-image">' +
|
||||
var toastHTML =
|
||||
'<div class="card white horizontal"><div class="card-image">' +
|
||||
'<img style="max-height:100px;" src="' +
|
||||
event.data.image + '"></div><div class="card-stacked"><div class="card-content dark-text">' +
|
||||
'<span class="card-title dark-text">' +
|
||||
@@ -759,5 +760,5 @@ EdeclicLib = window.EdeclicLib || {},
|
||||
'</div></div></div>'
|
||||
Materialize.toast(toastHTML, 10000000);
|
||||
});
|
||||
|
||||
|
||||
}(jQuery)
|
||||
File diff suppressed because one or more lines are too long
@@ -4610,4 +4610,340 @@ $("#profile_picture_file, #profile_logo_file").change(function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
EdeclicLib = window.EdeclicLib || {},
|
||||
function (d) {
|
||||
|
||||
"use strict";
|
||||
d.extend(EdeclicLib, {
|
||||
/* GESTION des cookies pour la modal du tuto */
|
||||
setCookie: function (name, value, days) {
|
||||
var expires = "";
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/";
|
||||
},
|
||||
getCookie: function (name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
eraseCookie: function (name) {
|
||||
document.cookie = name + '=; Max-Age=-99999999;';
|
||||
}
|
||||
})
|
||||
}(jQuery);
|
||||
|
||||
/// EdeclicPushAndNotificationClient.js
|
||||
/// A push and notification client
|
||||
/// inspired by https://github.com/gauntface/web-push-book
|
||||
///
|
||||
EdeclicLib = window.EdeclicLib || {},
|
||||
function (d) {
|
||||
"use strict";
|
||||
|
||||
d.extend(EdeclicLib, {
|
||||
|
||||
askForNotifications: function (resolve, reject) {
|
||||
var publicKey, saveUrl, deleteUrl, serviceWorkerUrl;
|
||||
|
||||
if (!IsFeatureDetected()) {
|
||||
//alert feature unavailable
|
||||
alert("Votre navigateur ne permet pas d'envoyer des push.");
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
var conf = document.getElementById('pushParams');
|
||||
if (conf === null) {
|
||||
console.warn('The pushParams div is not found. can\'t get datadash config.');
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
publicKey = conf.dataset.pushPublicKey;
|
||||
saveUrl = conf.dataset.saveSubscriptionUrl;
|
||||
deleteUrl = conf.dataset.deleteSubscriptionUrl;
|
||||
serviceWorkerUrl = conf.dataset.serviceWorkerUrl;
|
||||
|
||||
return Promise.all([
|
||||
registerServiceWorker(),
|
||||
getNotificationPermissionState()
|
||||
])
|
||||
.then(function (results) {
|
||||
const registration = results[0];
|
||||
const currentPermissionState = results[1];
|
||||
|
||||
if (currentPermissionState === 'denied') {
|
||||
console.warn('The notification permission has been blocked. Nothing we can do.');
|
||||
|
||||
alert("Les notifications sont désactivés, veuillez modifier vos paramètres pour bénéficier de cette fonctionnalité.");
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
let promiseChain = Promise.resolve();
|
||||
if (currentPermissionState !== 'granted') {
|
||||
promiseChain = askPermission();
|
||||
}
|
||||
|
||||
promiseChain
|
||||
.then(subscribeUserToPush)
|
||||
.then(function (subscription) {
|
||||
if (subscription) {
|
||||
return sendSubscriptionToBackEnd(subscription)
|
||||
.then(function () {
|
||||
return subscription;
|
||||
});
|
||||
}
|
||||
|
||||
return subscription;
|
||||
})
|
||||
.then(function (subscription) {
|
||||
// We got a subscription AND it was sent to our backend,
|
||||
// re-enable our UI and set up state.
|
||||
console.log('SUBSCRIPTION', subscription);
|
||||
resolve();
|
||||
return;
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Failed to subscribe the user.', err);
|
||||
reject();
|
||||
return;
|
||||
});
|
||||
|
||||
// if (currentPermissionState !== 'granted') {
|
||||
// // If permission isn't granted then we can't be subscribed for Push.
|
||||
// console.log("permission isn't granted then we can't be subscribed for Push.");
|
||||
|
||||
// return;
|
||||
// }
|
||||
},
|
||||
reject
|
||||
).catch(function (err) {
|
||||
console.log('Unable to register the service worker: ' + err);
|
||||
reject();
|
||||
return;
|
||||
});
|
||||
|
||||
function IsFeatureDetected() {
|
||||
if (!('serviceWorker' in navigator)) {
|
||||
// Service Worker isn't supported on this browser, disable or hide UI.
|
||||
console.info("Service Worker isn't supported on this browser, disable or hide UI.");
|
||||
return false;
|
||||
}
|
||||
if (!('PushManager' in window)) {
|
||||
// Push isn't supported on this browser, disable or hide UI.
|
||||
console.info("Push isn't supported on this browser, disable or hide UI.");
|
||||
return false;
|
||||
}
|
||||
console.info("Push and serviceWorker supported on this browser.");
|
||||
return true;
|
||||
}
|
||||
//https://stackoverflow.com/questions/39136625/service-worker-registration-failed
|
||||
function registerServiceWorker() {
|
||||
console.log('registerServiceWorker');
|
||||
return navigator.serviceWorker.register(serviceWorkerUrl)
|
||||
.then(function (registration) {
|
||||
console.log('Service worker successfully registered.');
|
||||
registration.update();
|
||||
return registration;
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Unable to register service worker.', err);
|
||||
});
|
||||
}
|
||||
|
||||
function askPermission() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
const permissionResult = Notification.requestPermission(function (result) {
|
||||
resolve(result);
|
||||
});
|
||||
if (permissionResult) {
|
||||
permissionResult.then(resolve, reject);
|
||||
}
|
||||
})
|
||||
.then(function (permissionResult) {
|
||||
if (permissionResult !== 'granted') {
|
||||
throw new Error('We weren\'t granted permission.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getNotificationPermissionState() {
|
||||
if (navigator.permissions) {
|
||||
return navigator.permissions.query({ name: 'notifications' })
|
||||
.then((result) => {
|
||||
return result.state;
|
||||
});
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
resolve(Notification.permission);
|
||||
});
|
||||
}
|
||||
|
||||
function getSWRegistration() {
|
||||
return navigator.serviceWorker.register(serviceWorkerUrl);
|
||||
}
|
||||
|
||||
function urlBase64ToUint8Array(base64String) {
|
||||
const padding = '='.repeat((4 - base64String.length % 4) % 4);
|
||||
const base64 = (base64String + padding)
|
||||
.replace(/\-/g, '+')
|
||||
.replace(/_/g, '/');
|
||||
|
||||
const rawData = window.atob(base64);
|
||||
const outputArray = new Uint8Array(rawData.length);
|
||||
|
||||
for (let i = 0; i < rawData.length; ++i) {
|
||||
outputArray[i] = rawData.charCodeAt(i);
|
||||
}
|
||||
return outputArray;
|
||||
}
|
||||
|
||||
function subscribeUserToPush() {
|
||||
getSWRegistration();
|
||||
return navigator.serviceWorker.ready.then(function (registration) {
|
||||
const subscribeOptions = {
|
||||
// At the moment you must pass in a value of true. If you don’t include the
|
||||
// userVisibleOnly key or pass in false you’ll get the following error:
|
||||
// 9
|
||||
// Chrome currently only supports the Push API for subscriptions that
|
||||
// will result in user-visible messages. You can indicate this by calling
|
||||
// pushManager.subscribe({userVisibleOnly: true}) instead.
|
||||
// See https://goo.gl/yqv4Q4 for more details.
|
||||
userVisibleOnly: true,
|
||||
applicationServerKey: urlBase64ToUint8Array(
|
||||
publicKey)
|
||||
};
|
||||
return registration.pushManager.subscribe(subscribeOptions);
|
||||
})
|
||||
.then(function (pushSubscription) {
|
||||
|
||||
return pushSubscription;
|
||||
});
|
||||
}
|
||||
|
||||
function sendSubscriptionToBackEnd(subscription) {
|
||||
|
||||
return fetch(saveUrl, {
|
||||
method: 'POST',
|
||||
//edge requirements
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(subscription)
|
||||
})
|
||||
.then(function (response) {
|
||||
if (!response.ok) {
|
||||
throw new Error('Bad status code from server.');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(function (responseData) {
|
||||
if (!(responseData && responseData.success)) {
|
||||
throw new Error('Bad response from server.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
delayedAsk: function () {
|
||||
var pushTrigger = EdeclicLib.getCookie("pushTrigger") * 1;
|
||||
if (pushTrigger == 3) {
|
||||
new Promise(EdeclicLib.askForNotifications)
|
||||
.then(() =>Materialize.toast("Vous êtes bien enregistré aux alertes.", 5000));
|
||||
}
|
||||
|
||||
if (pushTrigger <= 3) {
|
||||
EdeclicLib.setCookie("pushTrigger", pushTrigger + 1);
|
||||
}
|
||||
},
|
||||
unsubscribe: function () {
|
||||
navigator.serviceWorker.ready
|
||||
.then((serviceWorkerRegistration) => {
|
||||
serviceWorkerRegistration.pushManager.getSubscription()
|
||||
.then((subscription) => {
|
||||
if (!subscription) {
|
||||
console.log("Not subscribed, nothing to do.");
|
||||
return;
|
||||
}
|
||||
|
||||
subscription.unsubscribe()
|
||||
.then(function () {
|
||||
console.log("Successfully unsubscribed!.");
|
||||
})
|
||||
.catch((e) => {
|
||||
logger.error('Error thrown while unsubscribing from push messaging', e);
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
unsubscribeUserFromPush: function () {
|
||||
|
||||
return registration.pushManager.getSubscription()
|
||||
|
||||
.then(function (subscription) {
|
||||
if (subscription) {
|
||||
|
||||
return subscription.unsubscribe();
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
return fetch(deleteUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(subscription)
|
||||
})
|
||||
.then(function (response) {
|
||||
if (!response.ok) {
|
||||
throw new Error('Bad status code from server.');
|
||||
}
|
||||
///TODO bind UI
|
||||
return true;
|
||||
})
|
||||
|
||||
})
|
||||
.catch(function (err) {
|
||||
console.error('Failed to unsubscribe the user.', err);
|
||||
getNotificationPermissionState()
|
||||
.then((permissionState) => {
|
||||
// pushCheckbox.disabled = permissionState === 'denied';
|
||||
// pushCheckbox.checked = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
navigator.serviceWorker.addEventListener('message', event => {
|
||||
|
||||
var toastHTML =
|
||||
'<div class="card white horizontal"><div class="card-image">' +
|
||||
'<img style="max-height:100px;" src="' +
|
||||
event.data.image + '"></div><div class="card-stacked"><div class="card-content dark-text">' +
|
||||
'<span class="card-title dark-text">' +
|
||||
event.data.title +
|
||||
'</span>' +
|
||||
'<p>' +
|
||||
event.data.body +
|
||||
'</p>' +
|
||||
'</div><div class="card-action right-align">' +
|
||||
'<a href="' + event.data.data.link + '">Voir</a>' +
|
||||
'</div></div></div>'
|
||||
Materialize.toast(toastHTML, 10000000);
|
||||
});
|
||||
|
||||
}(jQuery)
|
||||
@@ -17766,7 +17766,7 @@ a.link-white-underline:hover {
|
||||
|
||||
.fix-search {
|
||||
position: fixed;
|
||||
top: 60px;
|
||||
top: 89px;
|
||||
width: 100%;
|
||||
-webkit-transition: all 0.5s;
|
||||
-moz-transition: all 0.5s;
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
.fix-search{
|
||||
position: fixed;
|
||||
top: 60px;
|
||||
top: 89px;
|
||||
width: 100%;
|
||||
-webkit-transition: all 0.5s;
|
||||
-moz-transition: all 0.5s;
|
||||
|
||||
Reference in New Issue
Block a user