Version Description
- Fix bugs with preview banner onchange events and escape attributes with Simple Banner Text instead of converting to html codes.
Download this release
Release Info
Developer | rpetersen29 |
Plugin | Simple Banner |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.4.1
- readme.txt +7 -1
- simple-banner.php +16 -20
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: cta, banner, banners, announcement, announcements, notification, bar, bars, free, hello bar, hellobar
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.9.5
|
7 |
-
Stable tag: 1.4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -45,6 +45,9 @@ Yes.
|
|
45 |
|
46 |
== Changelog ==
|
47 |
|
|
|
|
|
|
|
48 |
= 1.4.0 =
|
49 |
* Added Donate button, small settings page CSS tweaks.
|
50 |
|
@@ -80,6 +83,9 @@ Yes.
|
|
80 |
|
81 |
== Upgrade Notice ==
|
82 |
|
|
|
|
|
|
|
83 |
= 1.4.0 =
|
84 |
Add Donate button and change some form CSS.
|
85 |
|
4 |
Tags: cta, banner, banners, announcement, announcements, notification, bar, bars, free, hello bar, hellobar
|
5 |
Requires at least: 3.0.1
|
6 |
Tested up to: 4.9.5
|
7 |
+
Stable tag: 1.4.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
45 |
|
46 |
== Changelog ==
|
47 |
|
48 |
+
= 1.4.1 =
|
49 |
+
* Fix bugs with preview banner onchange events and escape attributes with Simple Banner Text instead of converting to html codes.
|
50 |
+
|
51 |
= 1.4.0 =
|
52 |
* Added Donate button, small settings page CSS tweaks.
|
53 |
|
83 |
|
84 |
== Upgrade Notice ==
|
85 |
|
86 |
+
= 1.4.1 =
|
87 |
+
Fix preview banner bugs, Simple Banner can accept all formats.
|
88 |
+
|
89 |
= 1.4.0 =
|
90 |
Add Donate button and change some form CSS.
|
91 |
|
simple-banner.php
CHANGED
@@ -3,13 +3,13 @@
|
|
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: 1.4.
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
-
* @version 1.4.
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
|
@@ -52,7 +52,7 @@ function simple_banner_custom_text()
|
|
52 |
if (get_option('simple_banner_text') != ""){
|
53 |
echo '<script type="text/javascript">jQuery(document).ready(function() {
|
54 |
var bannerSpan = document.getElementById("simple-banner");
|
55 |
-
bannerSpan.innerHTML = "<div class=' . "simple-banner-text" . '><span>' .
|
56 |
});
|
57 |
</script>';
|
58 |
}
|
@@ -80,7 +80,7 @@ function simple_banner_settings_page() {
|
|
80 |
<h2>Simple Banner Settings</h2>
|
81 |
<p>Use Hex color values for the color fields.</p>
|
82 |
<p>Links in the banner text must be typed in with HTML <code><a></code> tags.
|
83 |
-
<br />e.g. <code>This is a <a href=&#
|
84 |
|
85 |
<!-- Preview Banner -->
|
86 |
<div id="preview_banner" class="simple-banner" style="width: 100%;text-align: center;">
|
@@ -101,12 +101,10 @@ function simple_banner_settings_page() {
|
|
101 |
<th scope="row">Simple Banner Background Color<br><span style="font-weight:400;">(Leaving this blank sets the color to the default value #024985)</span></th>
|
102 |
<td style="vertical-align:top;">
|
103 |
<input type="text" id="simple_banner_color" name="simple_banner_color" placeholder="Hex value"
|
104 |
-
value="<?php echo esc_attr( get_option('simple_banner_color') ); ?>"
|
105 |
-
onchange="(document.getElementById('simple_banner_color').value == '') ? document.getElementById('simple_banner_color_show').value = '#024985' : document.getElementById('simple_banner_color_show').value = document.getElementById('simple_banner_color').value" />
|
106 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_color_show"
|
107 |
value="<?php echo ((get_option('simple_banner_color') == '') ? '#024985' : esc_attr( get_option('simple_banner_color') )); ?>"
|
108 |
-
onchange="javascript:document.getElementById('simple_banner_color').value = document.getElementById('simple_banner_color_show').value;
|
109 |
-
document.getElementById('simple_banner_color').onchange();">
|
110 |
</td>
|
111 |
</tr>
|
112 |
<!-- Text Color -->
|
@@ -114,12 +112,10 @@ function simple_banner_settings_page() {
|
|
114 |
<th scope="row">Simple Banner Text Color<br><span style="font-weight:400;">(Leaving this blank sets the color to the default value white)</span></th>
|
115 |
<td style="vertical-align:top;">
|
116 |
<input type="text" id="simple_banner_text_color" name="simple_banner_text_color" placeholder="Hex value"
|
117 |
-
value="<?php echo esc_attr( get_option('simple_banner_text_color') ); ?>"
|
118 |
-
onchange="javascript:(document.getElementById('simple_banner_text_color').value == '') ? document.getElementById('simple_banner_text_color_show').value = '#ffffff' : document.getElementById('simple_banner_text_color_show').value = document.getElementById('simple_banner_text_color').value;" />
|
119 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_text_color_show"
|
120 |
value="<?php echo ((get_option('simple_banner_text_color') == '') ? '#ffffff' : esc_attr( get_option('simple_banner_text_color') )); ?>"
|
121 |
-
onchange="javascript:document.getElementById('simple_banner_text_color').value = document.getElementById('simple_banner_text_color_show').value;
|
122 |
-
document.getElementById('simple_banner_text_color').onchange();">
|
123 |
</td>
|
124 |
</tr>
|
125 |
<!-- Link Color-->
|
@@ -127,12 +123,10 @@ function simple_banner_settings_page() {
|
|
127 |
<th scope="row">Simple Banner Link Color<br><span style="font-weight:400;">(Leaving this blank sets the color to the default value #f16521)</span></th>
|
128 |
<td style="vertical-align:top;">
|
129 |
<input type="text" id="simple_banner_link_color" name="simple_banner_link_color" placeholder="Hex value"
|
130 |
-
value="<?php echo esc_attr( get_option('simple_banner_link_color') ); ?>"
|
131 |
-
onchange="javascript:(document.getElementById('simple_banner_link_color').value == '') ? document.getElementById('simple_banner_link_color_show').value = '#f16521' : document.getElementById('simple_banner_link_color_show').value = document.getElementById('simple_banner_link_color').value;" />
|
132 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_link_color_show"
|
133 |
value="<?php echo ((get_option('simple_banner_link_color') == '') ? '#f16521' : esc_attr( get_option('simple_banner_link_color') )); ?>"
|
134 |
-
onchange="javascript:document.getElementById('simple_banner_link_color').value = document.getElementById('simple_banner_link_color_show').value;
|
135 |
-
document.getElementById('simple_banner_link_color').onchange();">
|
136 |
</td>
|
137 |
</tr>
|
138 |
<!-- Text Contents -->
|
@@ -188,7 +182,6 @@ function simple_banner_settings_page() {
|
|
188 |
// Banner Text
|
189 |
document.getElementById('preview_banner_text').innerHTML = document.getElementById('simple_banner_text').value != "" ? '<span>'+document.getElementById('simple_banner_text').value+'</span>' : '<span>This is what your banner will look like with a <a href="/">link</a>.</span>';
|
190 |
document.getElementById('simple_banner_text').onchange=function(e){
|
191 |
-
console.log(e.target.value);
|
192 |
document.getElementById('preview_banner_text').innerHTML = e.target.value != "" ? '<span>'+e.target.value+'</span>' : '<span>This is what your banner will look like with a <a href="/">link</a>.</span>';
|
193 |
};
|
194 |
|
@@ -198,7 +191,8 @@ function simple_banner_settings_page() {
|
|
198 |
style_background_color.appendChild(document.createTextNode('.simple-banner{background:'+document.getElementById('simple_banner_color').value || '#024985'+'}'));
|
199 |
document.getElementsByTagName('head')[0].appendChild(style_background_color);
|
200 |
|
201 |
-
document.getElementById('simple_banner_color').onchange=function(){
|
|
|
202 |
var child = document.getElementById('preview_banner_background_color');
|
203 |
if (child){child.innerText = "";child.id='';}
|
204 |
|
@@ -219,7 +213,8 @@ function simple_banner_settings_page() {
|
|
219 |
style_text_color.appendChild(document.createTextNode('.simple-banner .simple-banner-text{color:'+document.getElementById('simple_banner_text_color').value || '#ffffff'+'}'));
|
220 |
document.getElementsByTagName('head')[0].appendChild(style_text_color);
|
221 |
|
222 |
-
document.getElementById('simple_banner_text_color').onchange=function(){
|
|
|
223 |
var child = document.getElementById('preview_banner_text_color');
|
224 |
if (child){child.innerText = "";child.id='';}
|
225 |
|
@@ -240,7 +235,8 @@ function simple_banner_settings_page() {
|
|
240 |
style_link_color.appendChild(document.createTextNode('.simple-banner .simple-banner-text a{color:'+document.getElementById('simple_banner_link_color').value || '#f16521'+'}'));
|
241 |
document.getElementsByTagName('head')[0].appendChild(style_link_color);
|
242 |
|
243 |
-
document.getElementById('simple_banner_link_color').onchange=function(){
|
|
|
244 |
var child = document.getElementById('preview_banner_link_color');
|
245 |
if (child){child.innerText = "";child.id='';}
|
246 |
|
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: 1.4.1
|
7 |
* Author: Ryan Petersen
|
8 |
* Author URI: http://rpetersen29.github.io/
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* @package Simple Banner
|
12 |
+
* @version 1.4.1
|
13 |
* @author Ryan Petersen <rpetersen.dev@gmail.com>
|
14 |
*/
|
15 |
|
52 |
if (get_option('simple_banner_text') != ""){
|
53 |
echo '<script type="text/javascript">jQuery(document).ready(function() {
|
54 |
var bannerSpan = document.getElementById("simple-banner");
|
55 |
+
bannerSpan.innerHTML = "<div class=' . "simple-banner-text" . '><span>' . addslashes( get_option('simple_banner_text') ) . '</span></div>"
|
56 |
});
|
57 |
</script>';
|
58 |
}
|
80 |
<h2>Simple Banner Settings</h2>
|
81 |
<p>Use Hex color values for the color fields.</p>
|
82 |
<p>Links in the banner text must be typed in with HTML <code><a></code> tags.
|
83 |
+
<br />e.g. <code>This is a <a href="http://www.wordpress.com">Link to Wordpress</a></code>.</p>
|
84 |
|
85 |
<!-- Preview Banner -->
|
86 |
<div id="preview_banner" class="simple-banner" style="width: 100%;text-align: center;">
|
101 |
<th scope="row">Simple Banner Background Color<br><span style="font-weight:400;">(Leaving this blank sets the color to the default value #024985)</span></th>
|
102 |
<td style="vertical-align:top;">
|
103 |
<input type="text" id="simple_banner_color" name="simple_banner_color" placeholder="Hex value"
|
104 |
+
value="<?php echo esc_attr( get_option('simple_banner_color') ); ?>" />
|
|
|
105 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_color_show"
|
106 |
value="<?php echo ((get_option('simple_banner_color') == '') ? '#024985' : esc_attr( get_option('simple_banner_color') )); ?>"
|
107 |
+
onchange="javascript:document.getElementById('simple_banner_color').value = document.getElementById('simple_banner_color_show').value;document.getElementById('simple_banner_color').dispatchEvent(new Event('change'));">
|
|
|
108 |
</td>
|
109 |
</tr>
|
110 |
<!-- Text Color -->
|
112 |
<th scope="row">Simple Banner Text Color<br><span style="font-weight:400;">(Leaving this blank sets the color to the default value white)</span></th>
|
113 |
<td style="vertical-align:top;">
|
114 |
<input type="text" id="simple_banner_text_color" name="simple_banner_text_color" placeholder="Hex value"
|
115 |
+
value="<?php echo esc_attr( get_option('simple_banner_text_color') ); ?>" />
|
|
|
116 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_text_color_show"
|
117 |
value="<?php echo ((get_option('simple_banner_text_color') == '') ? '#ffffff' : esc_attr( get_option('simple_banner_text_color') )); ?>"
|
118 |
+
onchange="javascript:document.getElementById('simple_banner_text_color').value = document.getElementById('simple_banner_text_color_show').value;document.getElementById('simple_banner_text_color').dispatchEvent(new Event('change'));">
|
|
|
119 |
</td>
|
120 |
</tr>
|
121 |
<!-- Link Color-->
|
123 |
<th scope="row">Simple Banner Link Color<br><span style="font-weight:400;">(Leaving this blank sets the color to the default value #f16521)</span></th>
|
124 |
<td style="vertical-align:top;">
|
125 |
<input type="text" id="simple_banner_link_color" name="simple_banner_link_color" placeholder="Hex value"
|
126 |
+
value="<?php echo esc_attr( get_option('simple_banner_link_color') ); ?>" />
|
|
|
127 |
<input style="height: 30px;width: 100px;" type="color" id="simple_banner_link_color_show"
|
128 |
value="<?php echo ((get_option('simple_banner_link_color') == '') ? '#f16521' : esc_attr( get_option('simple_banner_link_color') )); ?>"
|
129 |
+
onchange="javascript:document.getElementById('simple_banner_link_color').value = document.getElementById('simple_banner_link_color_show').value;document.getElementById('simple_banner_link_color').dispatchEvent(new Event('change'));">
|
|
|
130 |
</td>
|
131 |
</tr>
|
132 |
<!-- Text Contents -->
|
182 |
// Banner Text
|
183 |
document.getElementById('preview_banner_text').innerHTML = document.getElementById('simple_banner_text').value != "" ? '<span>'+document.getElementById('simple_banner_text').value+'</span>' : '<span>This is what your banner will look like with a <a href="/">link</a>.</span>';
|
184 |
document.getElementById('simple_banner_text').onchange=function(e){
|
|
|
185 |
document.getElementById('preview_banner_text').innerHTML = e.target.value != "" ? '<span>'+e.target.value+'</span>' : '<span>This is what your banner will look like with a <a href="/">link</a>.</span>';
|
186 |
};
|
187 |
|
191 |
style_background_color.appendChild(document.createTextNode('.simple-banner{background:'+document.getElementById('simple_banner_color').value || '#024985'+'}'));
|
192 |
document.getElementsByTagName('head')[0].appendChild(style_background_color);
|
193 |
|
194 |
+
document.getElementById('simple_banner_color').onchange=function(e){
|
195 |
+
document.getElementById('simple_banner_color_show').value = e.target.value || '#024985';
|
196 |
var child = document.getElementById('preview_banner_background_color');
|
197 |
if (child){child.innerText = "";child.id='';}
|
198 |
|
213 |
style_text_color.appendChild(document.createTextNode('.simple-banner .simple-banner-text{color:'+document.getElementById('simple_banner_text_color').value || '#ffffff'+'}'));
|
214 |
document.getElementsByTagName('head')[0].appendChild(style_text_color);
|
215 |
|
216 |
+
document.getElementById('simple_banner_text_color').onchange=function(e){
|
217 |
+
document.getElementById('simple_banner_text_color_show').value = e.target.value || '#ffffff';
|
218 |
var child = document.getElementById('preview_banner_text_color');
|
219 |
if (child){child.innerText = "";child.id='';}
|
220 |
|
235 |
style_link_color.appendChild(document.createTextNode('.simple-banner .simple-banner-text a{color:'+document.getElementById('simple_banner_link_color').value || '#f16521'+'}'));
|
236 |
document.getElementsByTagName('head')[0].appendChild(style_link_color);
|
237 |
|
238 |
+
document.getElementById('simple_banner_link_color').onchange=function(e){
|
239 |
+
document.getElementById('simple_banner_link_color_show').value = e.target.value || '#f16521';
|
240 |
var child = document.getElementById('preview_banner_link_color');
|
241 |
if (child){child.innerText = "";child.id='';}
|
242 |
|