PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 1.1
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v1.1
3.6.0 3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 All 110 releases
buttonizer-multifunctional-button / js / buttonizer.js

buttonizer.js in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder 1.1, at js/buttonizer.js

105 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 animated: false,
14 },
15 init: function(options) {
16 options = jQuery.extend({
17 scrollBarTop: 0,
18 showAfter: 0,
19 exitIntent: 0,
20 exitIntentText: 'Are you looking for this?'
21 }, options);
22
23 this.settings.scrollBarTop = options.scrollBarTop;
24 this.settings.showAfter = options.showAfter;
25 this.settings.wHeight = Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight);
26 this.settings.exitIntent = options.exitIntent;
27 this.settings.exitIntentText = options.exitIntentText;
28
29 this.ready();
30 },
31 ready: function() {
32 if(document.getElementById("buttonizer-sys") != null) {
33 document.addEventListener("click", function(e) {
34 if(buttonizer.settings.buttonizerOpened && !document.getElementById("buttonizer-button").contains(e.target)) {
35 document.getElementById("buttonizer-sys").className = 'buttonizer_inner';
36 buttonizer.settings.buttonizerOpened = false;
37
38 if(document.querySelector("#buttonizer-sys .buttonizer_head .text") != null) {
39 document.querySelector("#buttonizer-sys .buttonizer_head .text").remove();
40 }
41 }
42 }, false);
43
44 document.getElementById("buttonizer-sys").addEventListener("click", function() {
45 if(document.querySelector("#buttonizer-sys .buttonizer_head.onlyone") != null) {
46 return;
47 }
48
49 if(buttonizer.settings.buttonizerOpened == true) {
50 document.getElementById("buttonizer-sys").className = 'buttonizer_inner';
51 buttonizer.settings.buttonizerOpened = false;
52
53 if(document.querySelector("#buttonizer-sys .buttonizer_head .text") != null && typeof document.querySelector("#buttonizer-sys .buttonizer_head .text").hasClass != 'undefined') {
54 if(document.querySelector("#buttonizer-sys .buttonizer_head .text").hasClass('noremove')) {
55 document.querySelector("#buttonizer-sys .buttonizer_head .text").remove();
56 }
57 }
58 }else{
59 document.getElementById("buttonizer-sys").className = 'buttonizer_inner opened';
60 buttonizer.settings.buttonizerOpened = true;
61 }
62 });
63
64 // Attenton animation
65 if(document.getElementById("buttonizer-button").getAttribute('attention-animation') != 'none') {
66 setInterval(function() {
67 if(!buttonizer.settings.buttonizerOpened) {
68 document.getElementById("buttonizer-button").setAttribute("attention-trigger", "true");
69
70 setTimeout(function() {
71 document.getElementById("buttonizer-button").setAttribute("attention-trigger", "false");
72 }, 2000);
73 }
74 }, 10000);
75 }
76 }
77
78
79 /* Premium Code Stripped by Freemius */
80
81 }
82 }
83
84 function onButtonizerClickEvent(text) {
85 if (typeof ga == 'function') {
86 ga('send', 'event', {
87 eventCategory: 'Buttonizer',
88 eventAction: document.location.href,
89 eventLabel: text
90 });
91 }
92 }
93
94 function onButtonizerButtonFacebook() {
95 window.open('http://www.facebook.com/sharer.php?u='+ document.location.href +'&t='+ document.title +'', 'popupFacebook', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;
96 }
97
98 function onButtonizerButtonTwitter() {
99 window.open('https://twitter.com/intent/tweet?text='+ document.title +'&url='+ document.location.href +'', 'popupTwitter', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;
100 }
101
102 function onButtonizerButtonLinkedin() {
103 window.open('http://www.linkedin.com/shareArticle?mini=true&url='+ document.location.href +'&title='+ document.title +'&summary='+ document.title +'', 'popupLinkedIn', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;
104 }
105