(function () {
var SHARE_BAR_ID = 'evercare-share-bar';
function isClothingCareArticle() {
return window.location.href.indexOf('p852196760') !== -1;
}
function addShareBar() {
if (!isClothingCareArticle()) return;
if (document.getElementById(SHARE_BAR_ID)) return;
```
var url = window.location.href.split('?')[0];
var title = document.title;
var bar = document.createElement('div');
bar.id = SHARE_BAR_ID;
bar.innerHTML =
'' +
'
📤 Share this Helpful Guide
' +
'
Found this guide useful? Share it with family and friends! 💚
' +
'
' +
'
Thank you for sharing and helping others discover Evercare Australia! 🌿
' +
'
';
document.body.appendChild(bar);
var copyLink = document.getElementById('evercare-copy-link');
if (copyLink) {
copyLink.onclick = function () {
var originalText = copyLink.textContent;
function copied() {
copyLink.textContent = '✓ Link Copied!';
setTimeout(function () {
copyLink.textContent = originalText;
}, 2500);
}
function failed() {
copyLink.textContent = 'Please copy URL';
setTimeout(function () {
copyLink.textContent = originalText;
}, 2500);
}
if (navigator.clipboard) {
navigator.clipboard.writeText(url).then(copied).catch(function () {
failed();
});
} else {
var textArea = document.createElement('textarea');
textArea.value = url;
textArea.style.position = 'fixed';
textArea.style.top = '0';
textArea.style.left = '0';
textArea.style.width = '1px';
textArea.style.height = '1px';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
if (document.execCommand('copy')) {
copied();
} else {
failed();
}
} catch (e) {
failed();
}
document.body.removeChild(textArea);
}
return false;
};
}
```
}
/* Try after page loads */
window.addEventListener('load', function () {
setTimeout(addShareBar, 1000);
setTimeout(addShareBar, 2500);
setTimeout(addShareBar, 5000);
});
/* Also try immediately in case the page is already loaded */
setTimeout(addShareBar, 2500);
})();