Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/balaramadurai/hugo-travelify-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBala Ramadurai <bala@balaramadurai.net>2017-08-15 02:41:33 +0300
committerBala Ramadurai <bala@balaramadurai.net>2017-08-15 02:41:33 +0300
commit65210289b8dfea5004e70085eae537a34e1a2cc7 (patch)
tree1fd7598bcd582bed17e86a65a525ed334c90e10f
parentf65b2e070f9f9ad4889d15fa7988556e6f35edb0 (diff)
added js for mailchimp
-rw-r--r--layouts/partials/widgets/mailchimp.html39
1 files changed, 38 insertions, 1 deletions
diff --git a/layouts/partials/widgets/mailchimp.html b/layouts/partials/widgets/mailchimp.html
index e0adc76..a06115c 100644
--- a/layouts/partials/widgets/mailchimp.html
+++ b/layouts/partials/widgets/mailchimp.html
@@ -17,7 +17,44 @@
<input value="Subscribe" type="submit">
</p>
</form>
-
+ <script>
+ /*
+ Custom functionality for safari and IE
+ */
+ (function( d ) {
+ // In case the placeholder functionality is available we remove labels
+ if ( ( 'placeholder' in d.createElement( 'input' ) ) ) {
+ var label = d.querySelector( 'label[for=subscribe-field-blog_subscription-2]' );
+ label.style.clip = 'rect(1px, 1px, 1px, 1px)';
+ label.style.position = 'absolute';
+ label.style.height = '1px';
+ label.style.width = '1px';
+ label.style.overflow = 'hidden';
+ }
+
+ // Make sure the email value is filled in before allowing submit
+ var form = d.getElementById('subscribe-blog-blog_subscription-2'),
+ input = d.getElementById('subscribe-field-blog_subscription-2'),
+ handler = function( event ) {
+ if ( '' === input.value ) {
+ input.focus();
+
+ if ( event.preventDefault ){
+ event.preventDefault();
+ }
+
+ return false;
+ }
+ };
+
+ if ( window.addEventListener ) {
+ form.addEventListener( 'submit', handler, false );
+ } else {
+ form.attachEvent( 'onsubmit', handler );
+ }
+ })( document );
+ </script>
+
</aside>
{{ end }}