$('body').click(function(e){
if( $('#nav-panel').hasClass('open') ){
e.stopPropagation();
$('header .grid-container .nav .transformico-btn').toggleClass('close');
$('#nav-panel').toggleClass('open');
return false;
}
})
$('header .grid-container #nav-panel').click(function(e){
e.stopPropagation();
})
$('header .grid-container .nav').click(function(e){
e.stopPropagation();
$(this).find('.transformico-btn').toggleClass('close');
$('#nav-panel').toggleClass('open');
return false;
});
var srcDomain = window.location.protocol + "//" + window.location.hostname
var src = srcDomain + "/action/formelec/"
function sendProjectToFormElec(output, totalPrice, theme, recaptcha) {
window.frames['form_elec'].contentWindow.postMessage('project+'+JSON.stringify({'excel': {output, totalPrice, theme, recaptcha}}), '*')
}
function toggleFormElec(display) {
var value = display ? 'block' : 'none'
document.querySelector('#containerForIframe').style.display = value
if (!display) {
window.frames['form_elec'].contentWindow.location = src
}
}
function receiveMessage (event) {
if(typeof event.data !== 'string') {
return
}
if (event.origin.indexOf('mon-interrupteur.fr') == -1) {
return
}
if (event.data.indexOf('success+') != -1) {
window.dataLayer.push({
'event' : 'eventGA',
'eventCategory' : 'pro',
'eventAction' : 'Contact',
'eventLabel' : 'Formulaire validé'
});
}
if (event.data.indexOf('project+') != -1) {
toggleFormElec(false)
}
}
if (navigator.appName == "Microsoft Internet Explorer") {
w.attachEvent("onmessage", receiveMessage)
} else {
window.addEventListener("message", receiveMessage, false)
}
(function(w, d, t, u, o, a, m) {
w['MysConnectorObject'] = o;
w[o] = w[o] || function() {
(w[o].q = w[o].q || []).push(arguments)
}, w[o].l = 1 * new Date();
a = d.createElement(t),
m = d.getElementsByTagName(t)[0];
a.async = 1;
a.src = u;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', window.location.protocol + "//" + window.location.hostname + '/static/2/tools/mysconnect-formelec.js', 'MysConnector');
// REQUIS :
MysConnector("setProperty","DOM","containerForIframe"); // id de l'élément qui recevra l'iframe
MysConnector("setProperty","src",src)
// FACULTATIF :
MysConnector("setProperty","iframe_height","100%"); // Hauteur de l'iframe optimale : 800px
// LANCEMENT DE VOTRE INTERFACE
MysConnector("create","formelec");
MYS.CONFIG.layout ={"starterPackMessage":{"title":"Tout savoir sur ", "link":{"label":"le pack de démarrage","url":"https://www.legrand.fr/pro/catalogue/pack-de-demarrage-celiane-with-netatmo-avec-prise-control-et-commande-generale-departarrivee-blanc"}}};
// DÉFINITION DES GAMMES
MYS.CONFIG.doigts = {"celiane":["blanc","titane","graphite"],"mosaic":["blanc","alu","noir-mat"],"art":["art-memoire-acier-brosse","art-memoire-or-brosse","art-memoire-cristal","art-epure-acier-brosse","art-epure-acier-satin","art-epure-acier-miroir","art-epure-or-miroir","art-epure-noir-mat","art-epure-bronze","art-epure-blanc-satin"]};
// DONNÉES REVENDEUR => Données des produits accessibles
MYS.CONFIG.URLS.DB_produits.url = '/action/PRODUITS/get.php?contour=pro'; //"/static/2/database/db/db_produits.min.json";
// MAPPAGE DU FICHIER JSON DES PRODUITS
MYS.CONFIG.MAPPAGE.DB_produits = {"id":"id","id_reseller":"id","name":"name","prix":"price"};
// TEMPLATE JS
if (MYS.CONFIG.URLS.templates) {
MYS.CONFIG.URLS.templates.url = "/static/2/js/templates/app.html?t=1527009870";
}
MYS.CONFIG.themePrimaryColor = [107, 100, 216];
MYS.CONFIG.themeTransitionColor = [125, 55, 152];
MYS.CONFIG.displayElectricienButton = true;
MYS.CONFIG.pdfTheme = 'pro';
MYS.CONFIG.contour = 'pro';
MYS.CONFIG.pdfUrlPath = '/action/PDF/distributor/selection/';
MYS.CONFIG.excelUrlPath = '/action/EXCEL/';
MYS.CONFIG.cart = {
"pdfAction":true,
"elecCertifieAction":false,
"elecCertifieLimit":500,
"_additionnalLinks":[
{
"title":"Trouver un électricien",
"url":"https://www.electriciencertifie.legrand.fr/"
}]
}
MYS.CONFIG.themeLeftContainerWidth = 55;
MYS.CONFIG.themeLeftContainerLimit = 1024;
MYS.CONFIG.themeRightContainerWidth = false;
MYS.CONFIG.themeRightContainerLimit = false;
MYS.CONFIG.themeAvailableLegrandLogo = true;
MYS.CONFIG.adBanners = {
"gammes":
{
"enable":true,
"link":"https://www.legrand.fr/maison-connectee/celiane-tm-with-netatmo-la-maison-simplement-connectee?utm_source=mon-interrupteur&utm_medium=display&utm_campaign=push-celiane-with-netatmo",
"img":"legrand-celiane-with-netatmo-1200x600px1.png",
"imgHover":"legrand-celiane-with-netatmo-1200x600px1-hover.png"
}
}
MYS.CONFIG.add_tva = '1.20';
MYS.CONFIG.cameraEnabled = true
$(document).ready(function() {
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('body, .content').height(window.innerHeight);
window.scrollTo(0, 0);
$('html').addClass('ipad ios7');
}
MYS.construct();
})
let viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
let viewportHeigth = Math.max(document.documentElement.clientHeight, window.innerHeight || 0)
let deviceType = 'mobile'
if ( viewportWidth > 1023 && viewportHeigth > 549) {
deviceType = 'desktop';
}
let reseller_name = "mon-interrupteur";
let gtmDatas = {
'page_category': 'configurator',
'page_name': document.title,
'clientType': reseller_name
};
gtmDatas['typeEnv'] = deviceType;
dataLayer.push(gtmDatas);