Simple Banner - Version 2.10.6

Version Description

  • Bug fix for console error.
Download this release

Release Info

Developer rpetersen29
Plugin Icon 128x128 Simple Banner
Version 2.10.6
Comparing to
See all releases

Code changes from version 2.10.5 to 2.10.6

Files changed (3) hide show
  1. readme.txt +7 -1
  2. simple-banner.js +22 -26
  3. simple-banner.php +3 -3
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/rpetersenDev
4
  Tags: banner, simple, top, bar, announcement, top bar, topbar, bulletin, notification, notice, cta, free
5
  Requires at least: 3.0.1
6
  Tested up to: 5.8.1
7
- Stable tag: 2.10.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -118,6 +118,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
118
 
119
  == Changelog ==
120
 
 
 
 
121
  = 2.10.5 =
122
  * Bug fixes & improvements.
123
 
@@ -280,6 +283,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
280
 
281
  == Upgrade Notice ==
282
 
 
 
 
283
  = 2.10.5 =
284
  * Bug fixes & improvements.
285
 
4
  Tags: banner, simple, top, bar, announcement, top bar, topbar, bulletin, notification, notice, cta, free
5
  Requires at least: 3.0.1
6
  Tested up to: 5.8.1
7
+ Stable tag: 2.10.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
118
 
119
  == Changelog ==
120
 
121
+ = 2.10.6 =
122
+ * Bug fix for console error.
123
+
124
  = 2.10.5 =
125
  * Bug fixes & improvements.
126
 
283
 
284
  == Upgrade Notice ==
285
 
286
+ = 2.10.6 =
287
+ * Bug fix for console error.
288
+
289
  = 2.10.5 =
290
  * Bug fixes & improvements.
291
 
simple-banner.js CHANGED
@@ -1,42 +1,40 @@
1
  jQuery(document).ready(function ($) {
2
- // Banner text is set to "" if disabled so this extra `!simpleBannerScriptParams.disabled_on_current_page` is unnecessary,
3
- // Leaving in for potential backwards compatibility issues, revisit when testing is done.
4
- var simpleBannerVisible = !simpleBannerScriptParams.pro_version_enabled || (simpleBannerScriptParams.pro_version_enabled && !simpleBannerScriptParams.disabled_on_current_page);
5
- if (simpleBannerScriptParams.simple_banner_text != "") {
6
- if (simpleBannerVisible) {
7
- if (!simpleBannerScriptParams.wp_body_open || !simpleBannerScriptParams.wp_body_open_enabled) {
8
- var closeButton = simpleBannerScriptParams.close_button_enabled ? '<button id="simple-banner-close-button" class="simple-banner-button">&#x2715;</button>' : '';
9
- $('<div id="simple-banner" class="simple-banner"><div class="simple-banner-text"><span>'
10
- + simpleBannerScriptParams.simple_banner_text
11
- + '</span></div>' + closeButton + '</div>')
12
- .prependTo('body');
13
- }
14
 
15
- var bodyPaddingLeft = $('body').css('padding-left')
16
- var bodyPaddingRight = $('body').css('padding-right')
 
 
 
 
 
 
17
 
18
- if (bodyPaddingLeft != "0px") {
19
- $('head').append('<style type="text/css" media="screen">.simple-banner{margin-left:-' + bodyPaddingLeft + ';padding-left:' + bodyPaddingLeft + ';}</style>');
20
- }
21
- if (bodyPaddingRight != "0px") {
22
- $('head').append('<style type="text/css" media="screen">.simple-banner{margin-right:-' + bodyPaddingRight + ';padding-right:' + bodyPaddingRight + ';}</style>');
23
- }
 
 
24
  }
25
 
26
  // Add scrolling class
27
- window.onscroll = function() {scrollClass()};
28
  function scrollClass() {
29
  var scroll = document.documentElement.scrollTop;
30
-
31
  if (scroll > $("#simple-banner").height()) {
32
  $("#simple-banner").addClass("simple-banner-scrolling");
33
  } else {
34
  $("#simple-banner").removeClass("simple-banner-scrolling");
35
  }
36
  }
 
37
  }
38
 
39
-
40
  // Add close button function to close button and close if cookie found
41
  function closeBanner() {
42
  if (!simpleBannerScriptParams.keep_site_custom_css && document.getElementById('simple-banner-site-custom-css')) document.getElementById('simple-banner-site-custom-css').remove();
@@ -46,7 +44,7 @@ jQuery(document).ready(function ($) {
46
  if (document.getElementById('simple-banner')) document.getElementById('simple-banner').remove();
47
  }
48
 
49
- if (simpleBannerVisible) {
50
  var sbCookie = "simplebannerclosed";
51
  if (simpleBannerScriptParams.close_button_enabled){
52
  if (getCookie(sbCookie) === "true") {
@@ -58,8 +56,6 @@ jQuery(document).ready(function ($) {
58
  setCookie(sbCookie, "true", expiration);
59
  };
60
  }
61
-
62
-
63
  } else {
64
  // disable cookie if it exists
65
  if (getCookie(sbCookie) === "true") {
1
  jQuery(document).ready(function ($) {
2
+ var isSimpleBannerTextSet = simpleBannerScriptParams.simple_banner_text != "";
3
+ var isSimpleBannerEnabledOnPage = !simpleBannerScriptParams.pro_version_enabled ||
4
+ (simpleBannerScriptParams.pro_version_enabled && !simpleBannerScriptParams.disabled_on_current_page);
5
+ var isSimpleBannerVisible = isSimpleBannerTextSet && isSimpleBannerEnabledOnPage;
 
 
 
 
 
 
 
 
6
 
7
+ if (isSimpleBannerVisible) {
8
+ if (!simpleBannerScriptParams.wp_body_open || !simpleBannerScriptParams.wp_body_open_enabled) {
9
+ var closeButton = simpleBannerScriptParams.close_button_enabled ? '<button id="simple-banner-close-button" class="simple-banner-button">&#x2715;</button>' : '';
10
+ $('<div id="simple-banner" class="simple-banner"><div class="simple-banner-text"><span>'
11
+ + simpleBannerScriptParams.simple_banner_text
12
+ + '</span></div>' + closeButton + '</div>')
13
+ .prependTo('body');
14
+ }
15
 
16
+ var bodyPaddingLeft = $('body').css('padding-left')
17
+ var bodyPaddingRight = $('body').css('padding-right')
18
+
19
+ if (bodyPaddingLeft != "0px") {
20
+ $('head').append('<style type="text/css" media="screen">.simple-banner{margin-left:-' + bodyPaddingLeft + ';padding-left:' + bodyPaddingLeft + ';}</style>');
21
+ }
22
+ if (bodyPaddingRight != "0px") {
23
+ $('head').append('<style type="text/css" media="screen">.simple-banner{margin-right:-' + bodyPaddingRight + ';padding-right:' + bodyPaddingRight + ';}</style>');
24
  }
25
 
26
  // Add scrolling class
 
27
  function scrollClass() {
28
  var scroll = document.documentElement.scrollTop;
 
29
  if (scroll > $("#simple-banner").height()) {
30
  $("#simple-banner").addClass("simple-banner-scrolling");
31
  } else {
32
  $("#simple-banner").removeClass("simple-banner-scrolling");
33
  }
34
  }
35
+ window.onscroll = function() {scrollClass()};
36
  }
37
 
 
38
  // Add close button function to close button and close if cookie found
39
  function closeBanner() {
40
  if (!simpleBannerScriptParams.keep_site_custom_css && document.getElementById('simple-banner-site-custom-css')) document.getElementById('simple-banner-site-custom-css').remove();
44
  if (document.getElementById('simple-banner')) document.getElementById('simple-banner').remove();
45
  }
46
 
47
+ if (isSimpleBannerVisible) {
48
  var sbCookie = "simplebannerclosed";
49
  if (simpleBannerScriptParams.close_button_enabled){
50
  if (getCookie(sbCookie) === "true") {
56
  setCookie(sbCookie, "true", expiration);
57
  };
58
  }
 
 
59
  } else {
60
  // disable cookie if it exists
61
  if (getCookie(sbCookie) === "true") {
simple-banner.php CHANGED
@@ -3,16 +3,16 @@
3
  * Plugin Name: Simple Banner
4
  * Plugin URI: https://github.com/rpetersen29/simple-banner
5
  * Description: Display a simple banner at the top of your website.
6
- * Version: 2.10.5
7
  * Author: Ryan Petersen
8
  * Author URI: http://rpetersen29.github.io/
9
  * License: GPL2
10
  *
11
  * @package Simple Banner
12
- * @version 2.10.5
13
  * @author Ryan Petersen <rpetersen.dev@gmail.com>
14
  */
15
- define ('VERSION', '2.10.5');
16
 
17
  register_activation_hook( __FILE__, 'simple_banner_activate' );
18
  function simple_banner_activate() {
3
  * Plugin Name: Simple Banner
4
  * Plugin URI: https://github.com/rpetersen29/simple-banner
5
  * Description: Display a simple banner at the top of your website.
6
+ * Version: 2.10.6
7
  * Author: Ryan Petersen
8
  * Author URI: http://rpetersen29.github.io/
9
  * License: GPL2
10
  *
11
  * @package Simple Banner
12
+ * @version 2.10.6
13
  * @author Ryan Petersen <rpetersen.dev@gmail.com>
14
  */
15
+ define ('VERSION', '2.10.6');
16
 
17
  register_activation_hook( __FILE__, 'simple_banner_activate' );
18
  function simple_banner_activate() {