Simple Banner - Version 2.7.0

Version Description

  • Add .simple-banner-scrolling class to allow custom scrolling styles.
Download this release

Release Info

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

Code changes from version 2.6.0 to 2.7.0

Files changed (3) hide show
  1. readme.txt +8 -2
  2. simple-banner.js +12 -0
  3. simple-banner.php +23 -8
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: rpetersen29
3
  Donate link: https://www.paypal.me/rpetersenDev
4
  Tags: banner, banners, simple, announcement, announcements, cta, notification, bar, bars, free, hello bar, hellobar, pro
5
  Requires at least: 3.0.1
6
- Tested up to: 5.5.1
7
- Stable tag: 2.6.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -106,6 +106,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
106
 
107
  == Changelog ==
108
 
 
 
 
109
  = 2.6.0 =
110
  * Add option to use Wordpress action `wp_open_body` for banner insertion.
111
 
@@ -225,6 +228,9 @@ Set your banner position to <code>relative</code> and try this in 'Website Custo
225
 
226
  == Upgrade Notice ==
227
 
 
 
 
228
  = 2.6.0 =
229
  * Add option to use Wordpress action `wp_open_body` for banner insertion.
230
 
3
  Donate link: https://www.paypal.me/rpetersenDev
4
  Tags: banner, banners, simple, announcement, announcements, cta, notification, bar, bars, free, hello bar, hellobar, pro
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.5.2
7
+ Stable tag: 2.7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
106
 
107
  == Changelog ==
108
 
109
+ = 2.7.0 =
110
+ * Add `.simple-banner-scrolling` class to allow custom scrolling styles.
111
+
112
  = 2.6.0 =
113
  * Add option to use Wordpress action `wp_open_body` for banner insertion.
114
 
228
 
229
  == Upgrade Notice ==
230
 
231
+ = 2.7.0 =
232
+ * Add `.simple-banner-scrolling` class to allow custom scrolling styles.
233
+
234
  = 2.6.0 =
235
  * Add option to use Wordpress action `wp_open_body` for banner insertion.
236
 
simple-banner.js CHANGED
@@ -18,6 +18,18 @@ jQuery(document).ready(function ($) {
18
  }
19
  }
20
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  // Debug Mode
22
  // Console log all variables
23
  if (scriptParams.pro_version_enabled && scriptParams.debug_mode) {
18
  }
19
  }
20
 
21
+ // Add scrolling class
22
+ window.onscroll = function() {scrollClass()};
23
+ function scrollClass() {
24
+ var scroll = document.documentElement.scrollTop;
25
+
26
+ if (scroll > $("#simple-banner").height()) {
27
+ $("#simple-banner").addClass("simple-banner-scrolling");
28
+ } else {
29
+ $("#simple-banner").removeClass("simple-banner-scrolling");
30
+ }
31
+ }
32
+
33
  // Debug Mode
34
  // Console log all variables
35
  if (scriptParams.pro_version_enabled && scriptParams.debug_mode) {
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.6.0
7
  * Author: Ryan Petersen
8
  * Author URI: http://rpetersen29.github.io/
9
  * License: GPL2
10
  *
11
  * @package Simple Banner
12
- * @version 2.6.0
13
  * @author Ryan Petersen <rpetersen.dev@gmail.com>
14
  */
15
- define ('VERSION', '2.6.0');
16
 
17
  register_activation_hook( __FILE__, 'simple_banner_activate' );
18
  function simple_banner_activate() {
@@ -44,6 +44,7 @@ function simple_banner() {
44
  'simple_banner_link_color' => get_option('simple_banner_link_color'),
45
  'simple_banner_text' => get_option('simple_banner_text'),
46
  'simple_banner_custom_css' => get_option('simple_banner_custom_css'),
 
47
  'site_custom_css' => get_option('site_custom_css'),
48
  'keep_site_custom_css' => get_option('keep_site_custom_css'),
49
  'site_custom_js' => get_option('site_custom_js'),
@@ -114,6 +115,10 @@ function simple_banner_custom_color()
114
  echo '<style type="text/css" media="screen">.simple-banner{'. get_option('simple_banner_custom_css') . '}</style>';
115
  }
116
 
 
 
 
 
117
  $remove_site_custom_css = $banner_is_disabled && get_option('keep_site_custom_css') == "";
118
  if (!$remove_site_custom_css && get_option('site_custom_css') != "" && get_option('pro_version_enabled')) {
119
  echo '<style type="text/css" media="screen">'. get_option('site_custom_css') . '</style>';
@@ -167,6 +172,7 @@ function simple_banner_settings() {
167
  register_setting( 'simple-banner-settings-group', 'simple_banner_link_color' );
168
  register_setting( 'simple-banner-settings-group', 'simple_banner_text' );
169
  register_setting( 'simple-banner-settings-group', 'simple_banner_custom_css' );
 
170
  register_setting( 'simple-banner-settings-group', 'simple_banner_position' );
171
  register_setting( 'simple-banner-settings-group', 'header_margin' );
172
  register_setting( 'simple-banner-settings-group', 'header_padding' );
@@ -292,20 +298,29 @@ function simple_banner_settings_page() {
292
  <br><span style="font-weight:400;">Leaving this blank removes the banner</span>
293
  </th>
294
  <td>
295
- <textarea id="simple_banner_text" style="height: 150px;width: 75%;" name="simple_banner_text"><?php echo get_option('simple_banner_text'); ?></textarea>
296
  </td>
297
  </tr>
298
  <!-- Custom CSS -->
299
  <tr valign="top">
300
  <th scope="row">
301
  Simple Banner Custom CSS
302
- <br><span style="font-weight:400;">CSS will be applied directly to the <code>simple-banner</code> class.</span>
303
  <br><span style="font-weight:400;color:red;">Be very careful, bad CSS can break the banner.</span>
304
  </th>
305
  <td>
306
- <div>.simple-banner {</div>
307
- <textarea id="simple_banner_custom_css" style="height: 150px;width: 75%;" name="simple_banner_custom_css"><?php echo get_option('simple_banner_custom_css'); ?></textarea>
308
- <div>}</div>
 
 
 
 
 
 
 
 
 
309
  </td>
310
  </tr>
311
  <!-- Position -->
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.7.0
7
  * Author: Ryan Petersen
8
  * Author URI: http://rpetersen29.github.io/
9
  * License: GPL2
10
  *
11
  * @package Simple Banner
12
+ * @version 2.7.0
13
  * @author Ryan Petersen <rpetersen.dev@gmail.com>
14
  */
15
+ define ('VERSION', '2.7.0');
16
 
17
  register_activation_hook( __FILE__, 'simple_banner_activate' );
18
  function simple_banner_activate() {
44
  'simple_banner_link_color' => get_option('simple_banner_link_color'),
45
  'simple_banner_text' => get_option('simple_banner_text'),
46
  'simple_banner_custom_css' => get_option('simple_banner_custom_css'),
47
+ 'simple_banner_scrolling_custom_css' => get_option('simple_banner_scrolling_custom_css'),
48
  'site_custom_css' => get_option('site_custom_css'),
49
  'keep_site_custom_css' => get_option('keep_site_custom_css'),
50
  'site_custom_js' => get_option('site_custom_js'),
115
  echo '<style type="text/css" media="screen">.simple-banner{'. get_option('simple_banner_custom_css') . '}</style>';
116
  }
117
 
118
+ if (get_option('simple_banner_scrolling_custom_css') != ""){
119
+ echo '<style type="text/css" media="screen">.simple-banner.simple-banner-scrolling{'. get_option('simple_banner_scrolling_custom_css') . '}</style>';
120
+ }
121
+
122
  $remove_site_custom_css = $banner_is_disabled && get_option('keep_site_custom_css') == "";
123
  if (!$remove_site_custom_css && get_option('site_custom_css') != "" && get_option('pro_version_enabled')) {
124
  echo '<style type="text/css" media="screen">'. get_option('site_custom_css') . '</style>';
172
  register_setting( 'simple-banner-settings-group', 'simple_banner_link_color' );
173
  register_setting( 'simple-banner-settings-group', 'simple_banner_text' );
174
  register_setting( 'simple-banner-settings-group', 'simple_banner_custom_css' );
175
+ register_setting( 'simple-banner-settings-group', 'simple_banner_scrolling_custom_css' );
176
  register_setting( 'simple-banner-settings-group', 'simple_banner_position' );
177
  register_setting( 'simple-banner-settings-group', 'header_margin' );
178
  register_setting( 'simple-banner-settings-group', 'header_padding' );
298
  <br><span style="font-weight:400;">Leaving this blank removes the banner</span>
299
  </th>
300
  <td>
301
+ <textarea id="simple_banner_text" class="large-text code" style="height: 150px;width: 95%;" name="simple_banner_text"><?php echo get_option('simple_banner_text'); ?></textarea>
302
  </td>
303
  </tr>
304
  <!-- Custom CSS -->
305
  <tr valign="top">
306
  <th scope="row">
307
  Simple Banner Custom CSS
308
+ <br><span style="font-weight:400;">CSS will be applied directly to the <code>simple-banner</code> class or the <code>simple-banner-scrolling</code> class for scrolling styles.</span>
309
  <br><span style="font-weight:400;color:red;">Be very careful, bad CSS can break the banner.</span>
310
  </th>
311
  <td>
312
+ <div style="display:flex">
313
+ <div style="flex-grow:1;">
314
+ <div>.simple-banner {</div>
315
+ <textarea id="simple_banner_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_custom_css"><?php echo get_option('simple_banner_custom_css'); ?></textarea>
316
+ <div>}</div>
317
+ </div>
318
+ <div style="flex-grow:1;">
319
+ <div>.simple-banner-scrolling {</div>
320
+ <textarea id="simple_banner_scrolling_custom_css" class="code" style="height: 150px;width: 90%;" name="simple_banner_scrolling_custom_css"><?php echo get_option('simple_banner_scrolling_custom_css'); ?></textarea>
321
+ <div>}</div>
322
+ </div>
323
+ </div>
324
  </td>
325
  </tr>
326
  <!-- Position -->