Untitled
unknown
plain_text
3 years ago
26 kB
12
Indexable
window.svgObj = [
{
name: "french bulldog",
img: "https://belladuke.imgix.net/2023/01/Frenchie.svg",
breedTitle: 'Bonjour ma belle...',
breedPara: 'French bulldogs are great companions with recognisable features and a fun-loving nature. Lovingly known as "frenchies" this breed is known to have a big personality.',
ageTitle: 'A life well loved...',
agePara: 'The typical French bulldog lifespan is between 10-14 years. Feeding a nutritious diet at any age can support a healthy, happy & long life.',
weightTitle: 'Let\'s get physical...',
weightPara: 'Male french bulldogs typically weigh more than females with fully grown adults weighing between approx. 7-13kg.',
activityTitle: 'An enriching idea...',
activityPara: 'French bulldogs need regular walks combined with a healthy diet to maintain a healthy weight. As a smart breed, training and puzzle games can keep their minds active too.',
physicalTitle: 'More than just a meal...',
physicalPara: 'A French bulldog\’s diet should be designed to prevent inflammation, helping to avoid allergies that cause itchy skin and ear infections.',
behaviourTitle: 'Do right by them too...',
behaviourPara: 'French bulldogs as gentle companions love to be right by their humans. Supporting their health & happiness with a nutritious, raw diet helps you do right by them too.'
},
{
name: "staffordshire bull terrier",
img: "https://belladuke.imgix.net/2023/01/Staffy.svg",
breedTitle: 'Your loyal companion...',
breedPara: 'Known lovingly as "Staffies", this breed are highly intelligent, loyal and affectionate companions.',
ageTitle: 'A life well loved...',
agePara: 'The average lifespan for this breed is between 12-14 years. Feeding a nutritious diet at any age can support a healthy, happy & long life.',
weightTitle: 'Let\'s get physical...',
weightPara: 'Staffies are stocky, muscular dogs with great athletic ability. By feeding an appropriate, nutritious diet, they can remain at a healthy weight throughout their life.',
activityTitle: 'An enriching idea...',
activityPara: 'This energetic breed needs plenty of regular exercise. Including a variety of physical and mental challenges is a great way to support their health and happiness.',
physicalTitle: 'More than just a meal...',
physicalPara: 'Feeding this breed a healthy, natural diet makes it easier for them to maintain a suitable weight, which can help prevent common conditions such as hip dysplasia.',
behaviourTitle: '',
behaviourPara: 'A loyal, gentle and fun- loving breed, staffies are fun-loving companions. Training and socialisation are important as well as building a close bond.'
},
{
name: "german shepherd",
img: "https://belladuke.imgix.net/2023/01/German-Shepard.svg",
breedTitle: 'Your gentle giants...',
breedPara: 'German Shepherds are known for being intelligent, fearless and confident. They are often devoted to their families, but can also have strong guarding instincts.',
ageTitle: 'A life well loved...',
agePara: 'The typical lifespan for German Shephers is between 9-13 years. Feeding a nutritious, diet at any age can support a healthy, happy & long life.',
weightTitle: 'Let\'s get physical...',
weightPara: 'As excess weight puts strain on the joints with any breed, it\'s important to keep German Shepherds at a healthy weight with an appropriate, nutritious diet in the right quantities.',
activityTitle: 'An enriching idea...',
activityPara: 'A healthy adult German Shepherd should have at least 90 minutes of activity every day to make sure they are able to lead active lifestyles that support their health.',
physicalTitle: 'More than just a meal...',
physicalPara: 'A healthy, natural diet can support joint health, in turn reducing the likelihood of common conditions such as arthritis and hip dysplasia.',
behaviourTitle: '',
behaviourPara: 'German Shepherds are known for being intelligent, devoted family pets. Give them a life well loved with a healthy, nutritious, raw diet. '
},
{
name: "cocker spaniel",
img: "https://belladuke.imgix.net/2023/01/Cocker-Spaniel.svg",
breedTitle: '',
breedPara: 'Working cocker spaniels are intelligent dogs with great characters. They have plenty of stamina and energy and are typically active and prey-driven.',
ageTitle: 'A life well loved...',
agePara: 'Cocker spaniels reach their adult height between 9 and 12 months, however they continue to develop their muscularity until the age of around 18-24 months.',
weightTitle: 'Let\'s get physical...',
weightPara: 'Feeding a healthy diet to cocker spaniels makes it easier to keep a suitable weight, which reduces the chance of common health issues such as hip dysplasia and arthritis.',
activityTitle: 'An enriching idea...',
activityPara: 'As an active and energetic breed of dog, adult cocker spaniels require at least one hour of exercise per day, split between at least two walks.',
physicalTitle: 'More than just a meal...',
physicalPara: 'Cocker spaniels need the right ingredients to support their joints, coat condition and the health of their trademark beautiful ears. Nutrition can play a key role in supporting their health and mobility.',
behaviourTitle: '',
behaviourPara: 'Cocker spaniels are an energetic breed that need an active lifestyle. Feeding a raw diet can support as you channel thier energy into fun times together!'
},
{
name: "labrador",
img: "https://belladuke.imgix.net/2023/01/Labrador-retreiver.svg",
breedTitle: '',
breedPara: 'Labradors are affectionate, energetic and incredibly lovable, great as family pet, excelling as service and guide dogs.',
ageTitle: 'A life well loved...',
agePara: 'Labradors are a relatively fast maturing breed, reching adult height between 6-12 months of age. Feeding a nutritious diet can support their joints as they grow.',
weightTitle: 'Let\'s get physical...',
weightPara: 'Did you know that almost all labradors are missing a gene which helps regulate thier appetite making it harder to manage their weight? A healthy, natural diet is the best way to support their health.',
activityTitle: 'An enriching idea...',
activityPara: 'A healthy adult Labrador should have at least 60 minutes of high-quality exercise per day. The amount of exercise should be tailored to fit their health.',
physicalTitle: '',
physicalPara: 'It is important to keep Labradors within a healthy weight range, as excess weight puts additional strain on the joints, worsening symptoms of hip dysplasia and arthritis.',
behaviourTitle: '',
behaviourPara: 'Labradors are generally easily motivated by food, meaning healthy food and treats can easily be incorporated to help build a bond and with training.'
},
{
name: "border collie",
img: "https://belladuke.imgix.net/2023/01/Border-Collie.svg",
breedTitle: 'Hey smarty pants...',
breedPara: 'Border Collies are the smartest dog breed out there and can make great family dogs, as they are eager to please, lively, friendly and even-tempered.',
ageTitle: 'A life well loved...',
agePara: 'Border Collies are considered to be puppies up until they reach maturity around the age of 2 and become a senior dog around the age of 8.',
weightTitle: 'Let\'s get physical...',
weightPara: 'Feeding a Border Collie a healthy, natural diet makes it easier to maintain a suitable weight, reducing the chance of conditions such as hip dysplasia and arthritis.',
activityTitle: 'An enriching idea...',
activityPara: 'Border collies require plenty of physical and mental stimulation. An active lifestyle and a healthy diet are key to supporting their health and happiness.',
physicalTitle: '',
physicalPara: 'Living a healthy lifestyle can help to reduce the likelihood of developing some health problems such as hip dysplasia, as well as eye problems and canine epilepsy.',
behaviourTitle: '',
behaviourPara: 'Remember that a suitable exercise routine and adequate mental challenges are great ways to make sure Border Collies lead fulfilled lives.'
},
{
name: "dachsund",
img: "https://belladuke.imgix.net/2023/01/Dachshund.svg",
breedTitle: 'Hello sausage...',
breedPara: 'The Miniature Dachshund is a loyal, playful and loving dog, making them a popular family pet.',
ageTitle: 'A life well loved...',
agePara: 'They are considered to be puppies up until they reach maturity around the age of 12 months and become a senior dog around the age of 11 or 12.',
weightTitle: 'Let\'s get physical...',
weightPara: 'It\'s important to support that trademark long body, maintaining a healthy weight with a natural diet can be important in reducing the impact on the joints and spine.',
activityTitle: 'An enriching idea...',
activityPara: 'Dachsunds can be strong-willed, so training and bonding with them is important. Healthy dog treats can be a wonderful addition to any training routine.',
physicalTitle: '',
physicalPara: 'Spinal issues that Miniature Dachshunds are predisposed to can be worsened by excessive exercise or jumping, so it is important to avoid unnecessary force on these areas.',
behaviourTitle: '',
behaviourPara: 'The Miniature Dachshund is known for its playfulness and devotion to their owners. Their playful nature means they can turn almost anything into a game.'
},
{
name: "english springer spaniel",
img: "https://belladuke.imgix.net/2023/01/English-Springer-Spanial.svg",
breedTitle: '',
breedPara: 'English Springer Spaniels are known for being friendly, quick to learn and keen to please. They are full of affection, playful and love to be involved in activities.',
ageTitle: 'A life well loved...',
agePara: 'The average English Springer Spaniel lifespan is between 12 to 14 years. Feeding a nutritious, diet at any age can support a healthy, happy & long life.',
weightTitle: 'Let\'s get physical...',
weightPara: 'With obesity being a common problem in Spaniels, it is vital to keep them at a healthy weight by feeding an appropriate, nutritious diet in the right quantities.',
activityTitle: 'An enriching idea...',
activityPara: 'Full of energy, a healthy adult English Springer Spaniel should have at least 70 minutes of high-quality exercise per day, tailored to fit their health and age.',
physicalTitle: '',
physicalPara: 'Common health problems in English Springer Spaniels include elbow and hip dysplasia so it\'s important to feed a nutritious diet that supports joint health.',
behaviourTitle: '',
behaviourPara: 'Exercise and mental stimulation an important part of this breed\'s day-to-day life. A healthy diet is needed to support their athletic activities!'
},
{
name: "american bulldog",
img: "https://belladuke.imgix.net/2023/01/Jack-Russell-Terrier.svg",
breedTitle: '',
breedPara: 'The American bulldog is an intelligent, assertive, playful and loving breed of dog. They can also be incredibly caring, devoted family dogs.',
ageTitle: 'A life well loved...',
agePara: 'The typical American bulldog lifespan is between 10 and 14 years of age. Feeding a nutritious, diet at any age can support a healthy, happy & long life.',
weightTitle: '',
weightPara: 'As American bulldogs are predisposed to obesity and thyroid problems, it is important for them to maintain a healthy weight through good nutrition and regular exercise.',
activityTitle: '',
activityPara: 'The American bulldog requires plenty of exercise, helping to keep them mentally and physically stimulated, which can help to avoid destructive behaviours.',
physicalTitle: '',
physicalPara: 'Feeding an American bulldog a raw, natural diet makes it easier to maintain a healthy weight, which reduces the likelihood of conditions such as elbow and hip dysplasia.',
behaviourTitle: '',
behaviourPara: 'This breed is playful and outgoing with plenty of energy. Effective training is essential for these big, powerful dogs.'
},
]
(function () {
try {
/* main variables */
var debug = 0;
var variation_name = "";
/* helper library */
var _$;
!(function (factory) {
_$ = factory();
})(function () {
var bm = function (s) {
if (typeof s === "string") {
this.value = Array.prototype.slice.call(document.querySelectorAll(s));
}
if (typeof s === "object") {
this.value = [s];
}
};
bm.prototype = {
eq: function (n) {
this.value = [this.value[n]];
return this;
},
each: function (fn) {
[].forEach.call(this.value, fn);
return this;
},
log: function () {
console && console.log(this);
},
live : function(selector, event, callback, context) {
/****Helper Functions****/
// helper for enabling IE 8 event bindings
function addEvent(el, type, handler) {
if (el.attachEvent) el.attachEvent("on" + type, handler);
else el.addEventListener(type, handler);
}
// matches polyfill
this.Element &&
(function (ElementPrototype) {
ElementPrototype.matches =
ElementPrototype.matches ||
ElementPrototype.matchesSelector ||
ElementPrototype.webkitMatchesSelector ||
ElementPrototype.msMatchesSelector ||
function (selector) {
var node = this,
nodes = (
node.parentNode || node.document
).querySelectorAll(selector),
i = -1;
while (nodes[++i] && nodes[i] != node);
return !!nodes[i];
};
})(Element.prototype);
// live binding helper using matchesSelector
function live(selector, event, callback, context) {
addEvent(context || document, event, function (e) {
var found,
el = e.target || e.srcElement;
while (
el &&
el.matches &&
el !== context &&
!(found = el.matches(selector))
)
el = el.parentElement;
if (found) callback.call(el, e);
});
}
live(selector, event, callback, context);
},
waitForElement: function (
selector,
trigger,
delayInterval,
delayTimeout
) {
var interval = setInterval(function () {
if (_$(selector).value.length && window.svgObj) {
clearInterval(interval);
trigger();
}
}, delayInterval);
setTimeout(function () {
clearInterval(interval);
}, delayTimeout);
},
};
return function (selector) {
return new bm(selector);
};
});
function trackGAEvent(eventCategory, eventAction, eventLabel) {
if ('ga' in window) {
ga.getAll()[0].send('event', {
eventCategory: eventCategory,
eventAction: eventAction,
eventLabel: eventLabel,
});
}
}
function log1 (mutations) {
for (let mutation of mutations) {
if (mutation.type === 'attributes') {
setTimeout(function(){
document.querySelector('.eg_breedPersonalization') && document.querySelector('.eg_breedPersonalization').remove();
insertSectionInBreed();
insertForAgePage();
},200)
}
}
}
function log2 (mutations) {
for (let mutation of mutations) {
if (mutation.type === 'attributes') {
setTimeout(function(){
document.querySelector('.eg_breedPersonalization') && document.querySelector('.eg_breedPersonalization').remove();
insertForWeightAndActivityPage();
},200)
}
}
}
var helper = _$();
var eg_breedString = ''+
'<div class="eg_breedPersonalization">'+
' <div>'+
' <div class="eg_img">'+
' <img>'+
' </div>'+
' <div class="eg_brief">'+
' <h3 class="eg_title"></h3>'+
' <p class="eg_para"></p>'+
' </div>'+
' </div>'+
'</div>';
function eg_observer(element, eg_observerName, eg_attributeName){
element && eg_observerName.observe(element, {
attributes: true,
attributeFilter: eg_attributeName,
});
}
/* Variation Init */
function init() {
let list = document.querySelector('.select2-selection__rendered');
let list4 = document.querySelectorAll('#age-select .select2-selection__rendered')[1];
let list2 = document.querySelector('.noUi-handle.noUi-handle-lower');
let list3 = document.querySelectorAll('.noUi-handle.noUi-handle-lower')[1]
let observer = new MutationObserver(log1);
let observer2 = new MutationObserver(log2);
eg_observer(list, observer, ['title']);
eg_observer(list4, observer, ['title']);
eg_observer(list2,observer2, ['aria-valuemin']);
eg_observer(list3,observer2, ['aria-valuemin']);
insertSectionInBreed();
insertForAgePage();
insertForPhysicalAndBehaviourPage();
helper.live('#physical-content + div label, #behavioural-content + div label','click',function(){
insertForPhysicalAndBehaviourPage();
})
helper.live('#breed-content + div .radio:nth-of-type(2), #breed-content + div .radio:nth-of-type(3)','click',function(){
document.querySelector('.eg_breedPersonalization') && document.querySelector('.eg_breedPersonalization').remove();
sessionStorage.setItem('eg_breedName','');
})
helper.live('#breed-content + div .radio:nth-of-type(1)','click',function(){
if(!document.querySelector('.eg_breedPersonalization')){
insertSectionInBreed();
}
})
helper.live('.datepicker .day','mousedown',function(){
setTimeout(function(){
insertForAgePage();
},250)
})
}
var goal = 0;
function insertSectionInBreed(){
for(let i = 0; i < window.svgObj.length; i++){
if(document.querySelector('.select2-selection__rendered') && document.querySelector('.select2-selection__rendered').innerText.toLocaleLowerCase().indexOf(window.svgObj[i].name) > -1){
sessionStorage.setItem('eg_breedName',window.svgObj[i].name);
if(goal == 0 && !document.querySelector('.select2-container--open')){
var geValue = document.querySelector('.select2-selection__rendered').innerText.replace('×','').replace('\n','')
trackGAEvent('Wizard','Select',geValue);
goal = 1;
}
if(document.querySelector('.eg_breedPersonalization')) return;
document.querySelector('#bd_form .border-top').insertAdjacentHTML('beforebegin',eg_breedString);
document.querySelector('.eg_breedPersonalization .eg_img img').setAttribute('src', window.svgObj[i].img);
document.querySelector('.eg_breedPersonalization .eg_brief .eg_title').innerHTML = window.svgObj[i].breedTitle;
document.querySelector('.eg_breedPersonalization .eg_brief .eg_para').innerHTML = window.svgObj[i].breedPara;
setTimeout(function(){
goal = 0;
},500);
}
}
}
function insertForAgePage(){
if(window.location.pathname.indexOf('breed') == -1){
for(let i = 0; i < window.svgObj.length; i++){
if(sessionStorage.getItem('eg_breedName') == window.svgObj[i].name){
if(document.querySelector('.eg_breedPersonalization')) return
// for age page
if(window.location.pathname.indexOf('age') > -1){
if(!document.querySelector('.select2-selection__rendered[title]') && document.querySelector('#dobPickerValue').value == '') return;
document.querySelector('#bd_form .border-top').insertAdjacentHTML('beforebegin',eg_breedString);
document.querySelector('.eg_breedPersonalization .eg_img img').setAttribute('src', window.svgObj[i].img);
document.querySelector('.eg_breedPersonalization .eg_brief .eg_title').innerHTML = window.svgObj[i].ageTitle;
document.querySelector('.eg_breedPersonalization .eg_brief .eg_para').innerHTML = window.svgObj[i].agePara;
}
}
}
}
}
function insertForWeightAndActivityPage(){
if(window.location.pathname.indexOf('breed') == -1){
for(let i = 0; i < window.svgObj.length; i++){
if(sessionStorage.getItem('eg_breedName') == window.svgObj[i].name){
if(document.querySelector('.eg_breedPersonalization')) return
// for weight page
if(window.location.pathname.indexOf('weight') > -1){
document.querySelector('#bd_form .border-top').insertAdjacentHTML('beforebegin',eg_breedString);
document.querySelector('.eg_breedPersonalization .eg_img img').setAttribute('src', window.svgObj[i].img);
document.querySelector('.eg_breedPersonalization .eg_brief .eg_title').innerHTML = window.svgObj[i].weightTitle;
document.querySelector('.eg_breedPersonalization .eg_brief .eg_para').innerHTML = window.svgObj[i].weightPara;
}
// for activity page
if(window.location.pathname.indexOf('activity') > -1){
document.querySelector('#bd_form .border-top').insertAdjacentHTML('beforebegin',eg_breedString);
document.querySelector('.eg_breedPersonalization .eg_img img').setAttribute('src', window.svgObj[i].img);
document.querySelector('.eg_breedPersonalization .eg_brief .eg_title').innerHTML = window.svgObj[i].activityTitle;
document.querySelector('.eg_breedPersonalization .eg_brief .eg_para').innerHTML = window.svgObj[i].activityPara;
}
}
}
}
}
function insertForPhysicalAndBehaviourPage(){
if(window.location.pathname.indexOf('breed') == -1){
for(let i = 0; i < window.svgObj.length; i++){
if(sessionStorage.getItem('eg_breedName') == window.svgObj[i].name){
if(document.querySelector('.eg_breedPersonalization')) return
// for physical page
if(window.location.pathname.indexOf('physical') > -1){
if(!document.querySelector('#physical-content + div label.btn-primary')) return;
document.querySelector('#bd_form .border-top').insertAdjacentHTML('beforebegin',eg_breedString);
document.querySelector('.eg_breedPersonalization .eg_img img').setAttribute('src', window.svgObj[i].img);
document.querySelector('.eg_breedPersonalization .eg_brief .eg_title').innerHTML = window.svgObj[i].physicalTitle;
document.querySelector('.eg_breedPersonalization .eg_brief .eg_para').innerHTML = window.svgObj[i].physicalPara;
}
// for behaviour page
if(window.location.pathname.indexOf('behaviour') > -1){
if(!document.querySelector('#behavioural-content + div label.btn-primary')) return;
document.querySelector('#bd_form .border-top').insertAdjacentHTML('beforebegin',eg_breedString);
document.querySelector('.eg_breedPersonalization .eg_img img').setAttribute('src', window.svgObj[i].img);
document.querySelector('.eg_breedPersonalization .eg_brief .eg_title').innerHTML = window.svgObj[i].behaviourTitle;
document.querySelector('.eg_breedPersonalization .eg_brief .eg_para').innerHTML = window.svgObj[i].behaviourPara;
}
}
}
}
}
/* Initialize variation */
helper.waitForElement(".select2-selection__rendered, .noUi-handle.noUi-handle-lower, #physical-content + div label, #behavioural-content + div label", init, 50, 25000);
} catch (e) {
if (debug) console.log(e, "error in Test" + variation_name);
}
})();
<style>
html body #bd_form .border-top{
border-top: none !important;
}
html body .eg_breedPersonalization{
border-radius: 0.5rem;
background: #F7EEDE;
padding: 20px 15px;
}
html body .eg_breedPersonalization > div {
display: flex;
align-items: center;
max-width: 400px;
margin: auto;
gap: 20px;
}
html body .eg_breedPersonalization .eg_img{
width: 52%;
max-width: 145px;
flex: 1;
}
html body .eg_breedPersonalization .eg_brief{
width: 48%;
min-width: 145px;
flex: 1;
}
html body .eg_breedPersonalization .eg_brief .eg_title{
margin-bottom: 13px;
}
@media screen and (max-width: 433px){
html body .eg_breedPersonalization .eg_brief .eg_title{
font-weight: 700;
font-size: 12px;
line-height: 15px;
}
html body .eg_breedPersonalization .eg_brief .eg_para{
font-weight: 400;
font-size: 12px;
line-height: 15px;
}
}
@media screen and (max-width: 359px){
html body .eg_breedPersonalization .eg_brief{
min-width: 100px;
}
}
</style>Editor is loading...