Added login request
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
|
||||
/* eslint no-var: 0 */
|
||||
|
||||
( function( $ ) {
|
||||
var $document = $( document );
|
||||
|
||||
$document.on( 'ready', function() {
|
||||
var maybeShowNotice = function( e, policyUrl ) {
|
||||
var $policyUrl = $( policyUrl || this )
|
||||
.closest( '.eu-cookie-law-widget-policy-url' );
|
||||
|
||||
if ( $policyUrl.find( 'input[type="radio"][value="default"]' ).is( ':checked' ) ) {
|
||||
$policyUrl.find( '.notice.default-policy' ).css( 'display', 'block' );
|
||||
$policyUrl.find( '.notice.custom-policy' ).hide();
|
||||
} else {
|
||||
$policyUrl.find( '.notice.default-policy' ).hide();
|
||||
$policyUrl.find( '.notice.custom-policy' ).css( 'display', 'block' );
|
||||
}
|
||||
};
|
||||
|
||||
$document.on( 'click', '.eu-cookie-law-widget-policy-url input[type="radio"]', maybeShowNotice );
|
||||
$document.on( 'widget-updated widget-added', function( e, widget ) {
|
||||
var widgetId = $( widget ).attr( 'id' );
|
||||
if ( widgetId.indexOf( 'eu_cookie_law_widget' ) !== -1 ) {
|
||||
maybeShowNotice( null, $( '#' + widgetId + ' .eu-cookie-law-widget-policy-url' ) );
|
||||
}
|
||||
} );
|
||||
$( '.eu-cookie-law-widget-policy-url' ).each( maybeShowNotice );
|
||||
} );
|
||||
} )( jQuery );
|
||||
@@ -0,0 +1,63 @@
|
||||
( function( $ ) {
|
||||
var cookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)eucookielaw\s*\=\s*([^;]*).*$)|^.*$/, '$1' ),
|
||||
overlay = $( '#eu-cookie-law' ),
|
||||
initialScrollPosition,
|
||||
scrollFunction;
|
||||
|
||||
if ( overlay.hasClass( 'top' ) ) {
|
||||
$( '.widget_eu_cookie_law_widget' ).addClass( 'top' );
|
||||
}
|
||||
|
||||
if ( overlay.hasClass( 'ads-active' ) ) {
|
||||
var adsCookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)personalized-ads-consent\s*\=\s*([^;]*).*$)|^.*$/, '$1' );
|
||||
if ( '' !== cookieValue && '' !== adsCookieValue ) {
|
||||
overlay.remove();
|
||||
}
|
||||
} else if ( '' !== cookieValue ) {
|
||||
overlay.remove();
|
||||
}
|
||||
|
||||
$( '.widget_eu_cookie_law_widget' ).appendTo( 'body' ).fadeIn();
|
||||
|
||||
overlay.find( 'form' ).on( 'submit', accept );
|
||||
|
||||
if ( overlay.hasClass( 'hide-on-scroll' ) ) {
|
||||
initialScrollPosition = $( window ).scrollTop();
|
||||
scrollFunction = function() {
|
||||
if ( Math.abs( $( window ).scrollTop() - initialScrollPosition ) > 50 ) {
|
||||
accept();
|
||||
}
|
||||
};
|
||||
$( window ).on( 'scroll', scrollFunction );
|
||||
} else if ( overlay.hasClass( 'hide-on-time' ) ) {
|
||||
setTimeout( accept, overlay.data( 'hide-timeout' ) * 1000 );
|
||||
}
|
||||
|
||||
var accepted = false;
|
||||
function accept( event ) {
|
||||
if ( accepted ) {
|
||||
return;
|
||||
}
|
||||
accepted = true;
|
||||
|
||||
if ( event && event.preventDefault ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if ( overlay.hasClass( 'hide-on-scroll' ) ) {
|
||||
$( window ).off( 'scroll', scrollFunction );
|
||||
}
|
||||
|
||||
var expireTime = new Date();
|
||||
expireTime.setTime( expireTime.getTime() + ( overlay.data( 'consent-expiration' ) * 24 * 60 * 60 * 1000 ) );
|
||||
|
||||
document.cookie = 'eucookielaw=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString();
|
||||
if ( overlay.hasClass( 'ads-active' ) && overlay.hasClass( 'hide-on-button' ) ) {
|
||||
document.cookie = 'personalized-ads-consent=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString();
|
||||
}
|
||||
|
||||
overlay.fadeOut( 400, function() {
|
||||
overlay.remove();
|
||||
} );
|
||||
}
|
||||
} )( jQuery );
|
||||
@@ -0,0 +1,277 @@
|
||||
<p>
|
||||
<strong>
|
||||
<?php esc_html_e( 'Banner text', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['text'], 'default' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<?php esc_html_e( 'Default', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['text'], 'custom' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'text' ) ); ?>"
|
||||
type="radio"
|
||||
value="custom"
|
||||
/>
|
||||
<?php esc_html_e( 'Custom:', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
<textarea
|
||||
class="widefat"
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'customtext' ) ); ?>"
|
||||
placeholder="<?php echo esc_attr( $instance['default-text'] ); ?>"
|
||||
><?php echo esc_html( $instance['customtext'] ); ?></textarea>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
<?php esc_html_e( 'Privacy Policy Link', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<ul class="eu-cookie-law-widget-policy-url">
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['policy-url'], 'default' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'policy-url' ) ); ?>"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<?php esc_html_e( 'Default', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['policy-url'], 'custom' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'policy-url' ) ); ?>"
|
||||
type="radio"
|
||||
value="custom"
|
||||
/>
|
||||
<?php esc_html_e( 'Custom URL:', 'jetpack' ); ?>
|
||||
</label>
|
||||
<input
|
||||
class="widefat"
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'custom-policy-url' ) ); ?>"
|
||||
placeholder="<?php echo esc_url( $instance['default-policy-url'] ); ?>"
|
||||
style="margin-top: .5em;"
|
||||
type="text"
|
||||
value="<?php echo esc_url( $instance['custom-policy-url'] ); ?>"
|
||||
/>
|
||||
<span class="notice notice-warning default-policy" style="display: none;">
|
||||
<span style="display: block; margin: .5em 0;">
|
||||
<strong><?php esc_html_e( 'Caution:', 'jetpack' ); ?></strong>
|
||||
<?php esc_html_e( 'The default policy URL only covers cookies set by Jetpack. If you’re running other plugins, custom cookies, or third-party tracking technologies, you should create and link to your own cookie statement.', 'jetpack' ); ?>
|
||||
</span>
|
||||
</span>
|
||||
<?php if ( Jetpack::is_module_active( 'wordads' ) ) : ?>
|
||||
<span class="notice notice-warning custom-policy" style="display: none;">
|
||||
<span style="display: block; margin: .5em 0;">
|
||||
<strong><?php esc_html_e( 'Caution:', 'jetpack' ); ?></strong>
|
||||
<?php echo sprintf(
|
||||
__( 'For GDPR compliance, please make sure your policy contains <a href="%s" target="_blank">privacy information relating to Jetpack Ads</a>.', 'jetpack' ),
|
||||
esc_url( 'https://jetpack.com/support/ads/#privacy' )
|
||||
); ?>
|
||||
</span>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
<?php esc_html_e( 'Link text', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<label>
|
||||
<input
|
||||
class="widefat"
|
||||
name="<?php echo $this->get_field_name( 'policy-link-text' ); ?>"
|
||||
type="text"
|
||||
value="<?php echo esc_attr( $instance['policy-link-text'] ); ?>"
|
||||
/>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
<?php esc_html_e( 'Button text', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<label>
|
||||
<input
|
||||
class="widefat"
|
||||
name="<?php echo $this->get_field_name( 'button' ); ?>"
|
||||
type="text"
|
||||
value="<?php echo esc_attr( $instance['button'] ); ?>"
|
||||
/>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
<?php _ex( 'Capture consent & hide the banner', 'action', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['hide'], 'button' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'hide' ) ); ?>"
|
||||
type="radio"
|
||||
value="button"
|
||||
<?php echo Jetpack::is_module_active( 'wordads' ) ? 'disabled' : ''; ?>
|
||||
/>
|
||||
<?php esc_html_e( 'after the user clicks the dismiss button', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['hide'], 'scroll' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'hide' ) ); ?>"
|
||||
type="radio"
|
||||
value="scroll"
|
||||
<?php echo Jetpack::is_module_active( 'wordads' ) ? 'disabled' : ''; ?>
|
||||
/>
|
||||
<?php esc_html_e( 'after the user scrolls the page', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['hide'], 'time' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'hide' ) ); ?>"
|
||||
type="radio"
|
||||
value="time"
|
||||
<?php echo Jetpack::is_module_active( 'wordads' ) ? 'disabled' : ''; ?>
|
||||
/>
|
||||
<?php esc_html_e( 'after this amount of time', 'jetpack' ); ?>
|
||||
</label>
|
||||
<input
|
||||
max="1000"
|
||||
min="3"
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'hide-timeout' ) ); ?>"
|
||||
style="padding: 3px 5px; width: 3em;"
|
||||
type="number"
|
||||
value="<?php echo esc_attr( $instance['hide-timeout'] ); ?>"
|
||||
/>
|
||||
<?php esc_html_e( 'seconds', 'jetpack' ); ?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php if ( Jetpack::is_module_active( 'wordads' ) ) : ?>
|
||||
<span class="notice notice-warning" style="display: block;">
|
||||
<span style="display: block; margin: .5em 0;">
|
||||
<?php esc_html_e( 'Visitors must provide consent by clicking the dismiss button when Jetpack Ads is turned on.', 'jetpack' ); ?>
|
||||
</span>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
<?php _ex( 'Consent expires after', 'action', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<input
|
||||
max="365"
|
||||
min="1"
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'consent-expiration' ) ); ?>"
|
||||
style="padding: 3px 5px; width: 3.75em;"
|
||||
type="number"
|
||||
value="<?php echo esc_attr( $instance['consent-expiration'] ); ?>"
|
||||
/>
|
||||
<?php esc_html_e( 'days', 'jetpack' ); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
<?php _e( 'Color scheme', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['color-scheme'], 'default' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'color-scheme' ) ); ?>"
|
||||
type="radio"
|
||||
value="default"
|
||||
/>
|
||||
<?php esc_html_e( 'Light', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['color-scheme'], 'negative' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'color-scheme' ) ); ?>"
|
||||
type="radio"
|
||||
value="negative"
|
||||
/>
|
||||
<?php esc_html_e( 'Dark', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
<?php _e( 'Position', 'jetpack' ); ?>
|
||||
</strong>
|
||||
<ul>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['position'], 'bottom' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'position' ) ); ?>"
|
||||
type="radio"
|
||||
value="bottom"
|
||||
/>
|
||||
<?php esc_html_e( 'Bottom', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<label>
|
||||
<input
|
||||
<?php checked( $instance['position'], 'top' ); ?>
|
||||
name="<?php echo esc_attr( $this->get_field_name( 'position' ) ); ?>"
|
||||
type="radio"
|
||||
value="top"
|
||||
/>
|
||||
<?php esc_html_e( 'Top', 'jetpack' ); ?>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p class="small">
|
||||
<?php esc_html_e( 'It is your own responsibility to ensure that your site complies with the relevant laws.', 'jetpack' ); ?>
|
||||
<a href="https://jetpack.com/support/extra-sidebar-widgets/eu-cookie-law-widget/">
|
||||
<?php esc_html_e( 'Click here for more information', 'jetpack' ); ?>
|
||||
</a>
|
||||
</p>
|
||||
@@ -0,0 +1,104 @@
|
||||
.widget_eu_cookie_law_widget {
|
||||
border: none;
|
||||
bottom: 1em;
|
||||
display: none;
|
||||
left: 1em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
position: fixed;
|
||||
right: 1em;
|
||||
width: auto;
|
||||
z-index: 50001;
|
||||
}
|
||||
|
||||
.widget_eu_cookie_law_widget.widget.top {
|
||||
bottom: auto;
|
||||
top: 1em;
|
||||
}
|
||||
|
||||
.admin-bar .widget_eu_cookie_law_widget.widget.top {
|
||||
top: 3em;
|
||||
}
|
||||
|
||||
#eu-cookie-law {
|
||||
background-color: #fff;
|
||||
border: 1px solid #dedede;
|
||||
color: #2e4467;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
overflow: hidden;
|
||||
padding: 6px 6px 6px 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#eu-cookie-law a,
|
||||
#eu-cookie-law a:active,
|
||||
#eu-cookie-law a:visited {
|
||||
color: inherit;
|
||||
cursor: inherit;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#eu-cookie-law a:hover {
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#eu-cookie-law.negative {
|
||||
background-color: #000;
|
||||
border: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Using a highly-specific rule to make sure that certain form styles
|
||||
* will be reset
|
||||
*/
|
||||
#eu-cookie-law form {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Using a highly-specific rule to make sure that all button styles
|
||||
* will be reset
|
||||
*/
|
||||
#eu-cookie-law input,
|
||||
#eu-cookie-law input:hover,
|
||||
#eu-cookie-law input:focus {
|
||||
background: #f3f3f3;
|
||||
border: 1px solid #dedede;
|
||||
border-radius: 4px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
color: #2e4453;
|
||||
cursor: pointer;
|
||||
display: inline;
|
||||
float: right;
|
||||
font-family: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: inherit;
|
||||
line-height: inherit;
|
||||
margin: 0 0 0 5%;
|
||||
padding: 8px 12px;
|
||||
position: static;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
#eu-cookie-law.negative input,
|
||||
#eu-cookie-law.negative input:hover,
|
||||
#eu-cookie-law.negative input:focus {
|
||||
background: #282828;
|
||||
border-color: #535353;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@media ( max-width: 600px ) {
|
||||
#eu-cookie-law {
|
||||
padding-bottom: 55px;
|
||||
}
|
||||
#eu-cookie-law input.accept {
|
||||
bottom: 8px;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<div
|
||||
class="<?php echo implode( ' ', $classes ); ?>"
|
||||
data-hide-timeout="<?php echo intval( $instance['hide-timeout'] ); ?>"
|
||||
data-consent-expiration="<?php echo intval( $instance['consent-expiration'] ); ?>"
|
||||
id="eu-cookie-law"
|
||||
>
|
||||
<form method="post">
|
||||
<input type="submit" value="<?php echo esc_attr( $instance['button'] ); ?>" class="accept" />
|
||||
</form>
|
||||
|
||||
<?php if ( 'default' == $instance['text'] || empty( $instance['customtext'] ) ) {
|
||||
echo nl2br( $instance['default-text'] );
|
||||
} else {
|
||||
echo nl2br( esc_html( $instance['customtext'] ) );
|
||||
} ?>
|
||||
|
||||
<a href="<?php
|
||||
$policy_link_text = 'default' === $instance['policy-url'] || empty( $instance['custom-policy-url'] )
|
||||
? $instance['default-policy-url']
|
||||
: $instance['custom-policy-url'];
|
||||
echo esc_url( $policy_link_text );
|
||||
?>" >
|
||||
<?php echo esc_html( $instance['policy-link-text'] ); ?>
|
||||
</a>
|
||||
</div>
|
||||
Reference in New Issue
Block a user