PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.2
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.2
2.9.1 2.9.0 2.8.9 2.8.8 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7
mystickymenu / js / mystickymenu-admin.js
mystickymenu / js Last commit date
detectmobilebrowser.js 7 years ago iris-script.js 6 years ago mystickymenu-admin.js 6 years ago mystickymenu.js 7 years ago mystickymenu.min.js 7 years ago
mystickymenu-admin.js
243 lines
1 (function( $ ) {
2 "use strict";
3
4 jQuery(document).ready(function($){
5
6 var handle = $( "#custom-handle" );
7 $( "#slider" ).slider({
8 create: function() {
9 handle.text( $( this ).slider( "value" ) );
10 handle.text( $('#myfixed_opacity').val() );
11 handle.css('left', $('#myfixed_opacity').val() + '%')
12 },
13 slide: function( event, ui ) {
14 $('#myfixed_opacity').val(ui.value);
15 handle.text( ui.value );
16 }
17 });
18 jQuery(
19 '<div class="pt_number"><div class="pt_numberbutton pt_numberup">+</div><div class="pt_numberbutton pt_numberdown">-</div></div>'
20 ).insertAfter("input.mysticky-number1");
21
22 jQuery(".mystickynumber1").each(function() {
23
24 var spinner = jQuery(this),
25 input = spinner.find('input[type="number"]'),
26 btnUp = spinner.find(".pt_numberup"),
27 btnDown = spinner.find(".pt_numberdown"),
28 min = input.attr("min"),
29 max = input.attr("max"),
30 valOfAmout = input.val(),
31 newVal = 0;
32
33 btnUp.on("click", function() {
34
35 var oldValue = parseFloat(input.val());
36
37 if (oldValue >= max) {
38 var newVal = oldValue;
39 } else {
40 var newVal = oldValue + 1;
41 }
42 spinner.find("input").val(newVal);
43 spinner.find("input").trigger("change");
44 console.log(newVal);
45 });
46 btnDown.on("click", function() {
47 var oldValue = parseFloat(input.val());
48 if (oldValue <= min) {
49 var newVal = oldValue;
50 } else {
51 var newVal = oldValue - 1;
52 }
53 spinner.find("input").val(newVal);
54 spinner.find("input").trigger("change");
55 });
56 });
57
58
59 $(".confirm").on( 'click', function() {
60 return window.confirm("Reset to default settings?");
61 });
62
63 var flag = 0;
64 $( "#mystickymenu-select option" ).each(function( i ) {
65
66 if ($('select#mystickymenu-select option:selected').val() !== '' ) {
67 flag = 1;
68 }
69 if( $('select#mystickymenu-select option:selected').val() == $(this).val() ){
70 $('#mysticky_class_selector').show();
71 }else {
72 $('#mysticky_class_selector').hide();
73 }
74 });
75 if ( flag === 0 ) {
76 $('#mysticky_class_selector').show();
77 $("select#mystickymenu-select option[value=custom]").attr('selected', 'selected');
78 }
79
80 $("#mystickymenu-select").on( 'change', function() {
81 if ($(this).val() == 'custom' ) {
82 $('#mysticky_class_selector').show();
83 }else {
84 $('#mysticky_class_selector').hide();
85 }
86
87 });
88 /*02-08-2019 welcom bar js*/
89 $( '.mysticky-welcomebar-action' ).on( 'change', function(){
90 var mysticky_welcomebar_action = $( this ).val();
91 if ( mysticky_welcomebar_action == 'close_bar' ) {
92 $( '.mysticky-welcomebar-redirect' ).hide();
93 } else {
94 $( '.mysticky-welcomebar-redirect' ).show();
95 }
96 } );
97 //$( '#mysticky_welcomebar_expirydate' ).datepicker( );
98 //$( "#mysticky_welcomebar_expirydate" ).datepicker( "option", "dateFormat", 'mm/dd/yy' );
99
100 var page_option_content = "";
101 page_option_content = $( '.mysticky-welcomebar-page-options-html' ).html();
102 $( '.mysticky-welcomebar-page-options-html' ).remove();
103
104 $( '#create-rule' ).on( 'click', function(){
105 var append_html = page_option_content.replace(/__count__/g, '1', page_option_content);
106 $( '.mysticky-welcomebar-page-options' ).append( append_html );
107 $( this ).remove();
108 });
109 $( '.sticky-header-menu ul li a' ).on( 'click', function(){
110 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
111 check_for_preview_pos();
112 }
113 } );
114 jQuery(window).scroll(function(){
115 if ( $( "#sticky-header-welcome-bar" ).is( ":visible" ) ) {
116 check_for_preview_pos();
117 }
118 });
119 /* welcome bar live preview */
120 /* Apply Wp Color Picker */
121 var myOptions = {
122 change: function(event, ui){
123 var color_id = $(this).attr('id');
124 var slug = $(this).data('slug');
125
126 var color_code = ui.color.toString();
127 if ( color_id === 'mysticky_welcomebar_bgcolor'){
128 $('.mysticky-welcomebar-fixed').css('background-color', color_code );
129 }
130 if ( color_id === 'mysticky_welcomebar_bgtxtcolor'){
131 $('.mysticky-welcomebar-fixed .mysticky-welcomebar-content p').css('color', color_code );
132 }
133 if ( color_id === 'mysticky_welcomebar_btncolor'){
134 $('.mysticky-welcomebar-btn a').css('background-color', color_code );
135 }
136 if ( color_id === 'mysticky_welcomebar_btntxtcolor'){
137 $('.mysticky-welcomebar-btn a').css('color', color_code );
138 }
139 }
140 };
141 $('.mysticky-welcomebar-setting-wrap .my-color-field').wpColorPicker(myOptions);
142
143 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_desktop]"]' ).on( 'change', function(){
144 if( $( this ).prop( "checked" ) == true ) {
145 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-desktop' );
146 } else {
147 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-desktop' );
148 }
149 } );
150 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_x_mobile]"]' ).on( 'change', function(){
151 if( $( this ).prop( "checked" ) == true ) {
152 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-showx-mobile' );
153 } else {
154 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-showx-mobile' );
155 }
156 } );
157
158 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_desktop]"]' ).on( 'change', function(){
159 if( $( this ).prop( "checked" ) == true ) {
160 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-desktop' );
161 } else {
162 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-desktop' );
163 }
164 } );
165 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_mobile]"]' ).on( 'change', function(){
166 if( $( this ).prop( "checked" ) == true ) {
167 $( '.mysticky-welcomebar-fixed' ).addClass( 'mysticky-welcomebar-btn-mobile' );
168 } else {
169 $( '.mysticky-welcomebar-fixed' ).removeClass( 'mysticky-welcomebar-btn-mobile' );
170 }
171 } );
172
173 $( 'select[name="mysticky_option_welcomebar[mysticky_welcomebar_font]"]' ).on( 'change', function(){
174 var myfixed_font_val = $( this ).val();
175 $( 'head' ).append( '<link href="https://fonts.googleapis.com/css?family='+ myfixed_font_val +':400,600,700" rel="stylesheet" type="text/css" class="sfba-google-font">' );
176 $( '.mysticky-welcomebar-fixed' ).css( 'font-family', myfixed_font_val );
177 } );
178
179 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_fontsize]"]' ).on( 'keyup click', function(){
180 var mysticky_welcomebar_fontsize_val = $( this ).val();
181 $( '.mysticky-welcomebar-fixed p' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
182 $( '.mysticky-welcomebar-btn a' ).css( 'font-size', mysticky_welcomebar_fontsize_val + 'px' );
183 } );
184
185 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_bar_text]"]' ).on( 'keyup', function(){
186 var mysticky_bar_text_val = $( this ).val();
187 $( '.mysticky-welcomebar-content p' ).text( mysticky_bar_text_val );
188 } );
189
190 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_btn_text]"]' ).on( 'keyup', function(){
191 var mysticky_btn_text_val = $( this ).val();
192 $( '.mysticky-welcomebar-btn a' ).text( mysticky_btn_text_val );
193 } );
194
195 $( '.mysticky-welcomebar-submit input#submit' ).on( 'click', function(e){
196 if ( $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked' ) == false && $( 'input#save_welcome_bar' ).val() == '' ) {
197 e.preventDefault();
198 $( "#mysticky-welcomebar-save-confirm" ).dialog({
199 resizable: false,
200 modal: true,
201 draggable: false,
202 height: 'auto',
203 width: 600,
204 buttons: {
205 "Yes, show it on my site": {
206 click:function () {
207 $( 'input[name="mysticky_option_welcomebar[mysticky_welcomebar_enable]"]' ).prop( 'checked', true );
208 $( '.mysticky-welcomebar-submit input#submit' ).trigger('click');
209 $( this ).dialog('close');
210 },
211 text: 'Yes, show it on my site',
212 class: 'green-btn'
213 },
214 "Just save and keep it off": function () {
215 $( 'input#save_welcome_bar' ).val('1');
216 $( '.mysticky-welcomebar-submit input#submit' ).trigger('click');
217 $( this ).dialog( 'close' );
218 }
219 }
220 });
221 }
222 //return false;
223 } );
224
225 });
226 $( window ).load( function(){
227 $( '.mysticky-welcomebar-url-options' ).each( function(){
228 $( this ).trigger( 'change' );
229 });
230 });
231 function check_for_preview_pos() {
232 if($(".show-on-apper").length && $(".mysticky-welcomebar-setting-right").length) {
233 var topPos = $(".show-on-apper").offset().top - $(window).scrollTop() - 650;
234 if (topPos < 0) {
235 topPos = Math.abs(topPos);
236 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", ((-1)*topPos)+"px");
237 } else {
238 jQuery(".mysticky-welcomebar-setting-right").css("margin-top", "0");
239 }
240 }
241 }
242
243 })(jQuery);