| 1 |
var buttonizer = { |
| 2 |
settings: { |
| 3 |
buttonizerOpened: false, |
| 4 |
buttonizerHasOpened: false, |
| 5 |
wHeight: 0, |
| 6 |
scrollBarTop: 0, |
| 7 |
showAfter: 0, |
| 8 |
exitIntent: 0, |
| 9 |
exitIntentText: 'Are you looking for this?', |
| 10 |
currentPageUrl: '', |
| 11 |
currentPageTitle: '', |
| 12 |
showedExitIntent: false, |
| 13 |
}, |
| 14 |
init: function(options) { |
| 15 |
options = jQuery.extend({ |
| 16 |
scrollBarTop: 0, |
| 17 |
showAfter: 0, |
| 18 |
exitIntent: 0, |
| 19 |
exitIntentText: 'Are you looking for this?' |
| 20 |
}, options); |
| 21 |
|
| 22 |
this.settings.scrollBarTop = options.scrollBarTop; |
| 23 |
this.settings.showAfter = options.showAfter; |
| 24 |
this.settings.wHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight); |
| 25 |
this.settings.exitIntent = options.exitIntent; |
| 26 |
this.settings.exitIntentText = options.exitIntentText; |
| 27 |
|
| 28 |
document.addEventListener('DOMContentLoaded', this.ready); |
| 29 |
}, |
| 30 |
ready: function() { |
| 31 |
if(document.getElementById("buttonizer-sys") != null) { |
| 32 |
document.addEventListener("click", function(e) { |
| 33 |
if(buttonizer.settings.buttonizerOpened && !document.getElementById("buttonizer-button").contains(e.target)) { |
| 34 |
document.getElementById("buttonizer-sys").className = 'buttonizer_inner'; |
| 35 |
buttonizer.settings.buttonizerOpened = false; |
| 36 |
|
| 37 |
if(document.querySelector("#buttonizer-sys .buttonizer_head .text") != null) { |
| 38 |
document.querySelector("#buttonizer-sys .buttonizer_head .text").remove(); |
| 39 |
} |
| 40 |
} |
| 41 |
}, false); |
| 42 |
|
| 43 |
document.getElementById("buttonizer-sys").addEventListener("click", function() { |
| 44 |
if(buttonizer.settings.buttonizerOpened == true) { |
| 45 |
document.getElementById("buttonizer-sys").className = 'buttonizer_inner'; |
| 46 |
buttonizer.settings.buttonizerOpened = false; |
| 47 |
|
| 48 |
if(document.querySelector("#buttonizer-sys .buttonizer_head .text") != null) { |
| 49 |
document.querySelector("#buttonizer-sys .buttonizer_head .text").remove(); |
| 50 |
} |
| 51 |
}else{ |
| 52 |
document.getElementById("buttonizer-sys").className = 'buttonizer_inner opened'; |
| 53 |
buttonizer.settings.buttonizerOpened = true; |
| 54 |
} |
| 55 |
}); |
| 56 |
} |
| 57 |
|
| 58 |
|
| 59 |
/* Premium Code Stripped by Freemius */ |
| 60 |
|
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
function onButtonizerClickEvent(text) { |
| 65 |
if (typeof ga == 'function') { |
| 66 |
ga('send', 'event', { |
| 67 |
eventCategory: 'Buttonizer', |
| 68 |
eventAction: document.location.href, |
| 69 |
eventLabel: text |
| 70 |
}); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
function onButtonizerButtonFacebook() { |
| 75 |
window.open('http://www.facebook.com/sharer.php?u='+ buttonizer.settings.currentPageUrl +'&t='+ buttonizer.settings.currentPageTitle +'', 'popupFacebook', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false; |
| 76 |
} |
| 77 |
|
| 78 |
function onButtonizerButtonTwitter() { |
| 79 |
window.open('https://twitter.com/intent/tweet?text='+ buttonizer.settings.currentPageTitle +'&url='+ buttonizer.settings.currentPageUrl +'', 'popupTwitter', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false; |
| 80 |
} |
| 81 |
|
| 82 |
function onButtonizerButtonLinkedin() { |
| 83 |
window.open('http://www.linkedin.com/shareArticle?mini=true&url='+ buttonizer.settings.currentPageUrl +'&title='+ buttonizer.settings.currentPageTitle +'&summary='+ buttonizer.settings.currentPageTitle +'', 'popupLinkedIn', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false; |
| 84 |
} |
| 85 |
|