Plugin Directory

Changeset 472817


Ignore:
Timestamp:
12/09/2011 02:40:20 PM (14 years ago)
Author:
jameslafferty
Message:

0.8.12 upgrade fixes js bug for error message.

Location:
mailchimp-widget/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mailchimp-widget/trunk/js/mailchimp-widget-min.js

    r316529 r472817  
    1 (function(a){jQuery.fn.ns_mc_widget=function(b){var e,c,d;e={url:"/",cookie_id:false,cookie_value:""};d=jQuery.extend(e,b);c=jQuery(this);c.submit(function(){var f;f=jQuery("<div></div>");f.css({"background-image":"url("+d.loader_graphic+")","background-position":"center center","background-repeat":"no-repeat",height:"100%",left:"0",position:"absolute",top:"0",width:"100%","z-index":"100"});c.css({height:"100%",position:"relative",width:"100%"});c.children().hide();c.append(f);jQuery.getJSON(d.url,c.serialize(),function(h,k){var j,g,i;if("success"===k){if(true===h.success){i=jQuery("<p>"+h.success_message+"</p>");i.hide();c.fadeTo(400,0,function(){c.html(i);i.show();c.fadeTo(400,1)});if(false!==d.cookie_id){j=new Date();j.setTime(j.getTime()+"3153600000");document.cookie=d.cookie_id+"="+d.cookie_value+"; expires="+j.toGMTString()+";"}}else{g=jQuery(".error",c);if(0===g.length){f.remove();c.children().show();g=jQuery('<div class="error"></div>');g.prependTo(c)}g.html(h.error)}}return false});return false})}}(jQuery));
     1(function(a){a.fn.ns_mc_widget=function(b){var e,c,d;e={url:"/",cookie_id:false,cookie_value:""};d=jQuery.extend(e,b);c=a(this);c.submit(function(){var f;f=jQuery("<div></div>");f.css({"background-image":"url("+d.loader_graphic+")","background-position":"center center","background-repeat":"no-repeat",height:"100%",left:"0",position:"absolute",top:"0",width:"100%","z-index":"100"});c.css({height:"100%",position:"relative",width:"100%"});c.children().hide();c.append(f);a.getJSON(d.url,c.serialize(),function(h,k){var j,g,i;if("success"===k){if(true===h.success){i=jQuery("<p>"+h.success_message+"</p>");i.hide();c.fadeTo(400,0,function(){c.html(i);i.show();c.fadeTo(400,1)});if(false!==d.cookie_id){j=new Date();j.setTime(j.getTime()+"3153600000");document.cookie=d.cookie_id+"="+d.cookie_value+"; expires="+j.toGMTString()+";"}}else{g=jQuery(".error",c);if(0===g.length){f.remove();c.children().show();g=jQuery('<div class="error"></div>');g.prependTo(c)}else{f.remove();c.children().show()}g.html(h.error)}}return false});return false})}}(jQuery));
  • mailchimp-widget/trunk/js/mailchimp-widget.js

    r316529 r472817  
    33(function ($) {
    44   
    5     jQuery.fn.ns_mc_widget = function (options) {
     5    $.fn.ns_mc_widget = function (options) {
    66       
    77        var defaults, eL, opts;
    8        
    98        defaults = {
    10        
    119            'url' : '/',
    1210            'cookie_id' : false,
    1311            'cookie_value' : ''
    14            
    1512        };
    16        
    1713        opts = jQuery.extend(defaults, options);
    18        
    19         eL = jQuery(this);
    20        
     14        eL = $(this);
    2115        eL.submit(function () {
    2216           
    2317            var ajax_loader;
    24            
    2518            ajax_loader = jQuery('<div></div>');
    26            
    2719            ajax_loader.css({
    28              
    2920                'background-image' : 'url(' + opts.loader_graphic + ')',
    3021                'background-position' : 'center center',
     
    3627                'width' : '100%',
    3728                'z-index' : '100'               
    38                
    3929            });
    4030           
    4131            eL.css({
    42            
    4332                'height' : '100%',
    4433                'position' : 'relative',
    4534                'width' : '100%'
    46            
    4735            });
    4836           
    4937            eL.children().hide();
    50            
    5138            eL.append(ajax_loader);
    5239           
    53             jQuery.getJSON(opts.url, eL.serialize(), function (data, textStatus) {
    54                
     40            $.getJSON(opts.url, eL.serialize(), function (data, textStatus) {
    5541                var cookie_date, error_container, new_content;
    56                
    5742                if ('success' === textStatus) {
    58                    
    5943                    if (true === data.success) {
    60                    
    6144                        new_content = jQuery('<p>' + data.success_message + '</p>');
    62                        
    6345                        new_content.hide();
    64                        
    6546                        eL.fadeTo(400, 0, function () {
    66                            
    6747                            eL.html(new_content);
    68                            
    6948                            new_content.show();
    70                            
    7149                            eL.fadeTo(400, 1);
    7250                           
     
    7452                       
    7553                        if (false !== opts.cookie_id) {
    76                            
    7754                            cookie_date = new Date();
    78                            
    7955                            cookie_date.setTime(cookie_date.getTime() + '3153600000');
    80                            
    8156                            document.cookie = opts.cookie_id + '=' + opts.cookie_value + '; expires=' + cookie_date.toGMTString() + ';';
    82                            
    8357                        }
    84                        
    8558                    } else {
    86                        
    8759                        error_container = jQuery('.error', eL);
    88                        
    8960                        if (0 === error_container.length) {
    90                            
    9161                            ajax_loader.remove();
    92                            
    9362                            eL.children().show();
    94                            
    9563                            error_container = jQuery('<div class="error"></div>');
    96                            
    9764                            error_container.prependTo(eL);
    98                            
     65                        } else {
     66                            ajax_loader.remove();
     67                            eL.children().show();
    9968                        }
    100                        
    10169                        error_container.html(data.error);
    102                        
    10370                    }
    104                    
    10571                }
    106                
    10772                return false;
    108                
    10973            });
    110            
    11174            return false;
    112            
    11375        });
    114        
    11576    };
    116    
    11777}(jQuery));
  • mailchimp-widget/trunk/mailchimp-widget.php

    r458542 r472817  
    55Description:
    66Author: James Lafferty
    7 Version: 0.8.11
     7Version: 0.8.12
    88Author URI: https://github.com/kalchas
    99License: GPL2
  • mailchimp-widget/trunk/readme.txt

    r458542 r472817  
    4141
    4242== Changelog ==
     43= 0.8.12 =
     44* Bugfix to account for multiple failed submissions. Also cleans up the mailchimp-widget.js file. Thank you to verify for pointing out the problem and its solution.
     45
    4346= 0.8.11 =
    4447* Added Russian translation. Thank you to Игорь Клипач for contributing!
     
    127130
    128131== Upgrade Notice ==
     132= 0.8.12 =
     133* Bugfix to account for multiple failed submissions. Also cleans up the mailchimp-widget.js file. Thank you to verify for pointing out the problem and its solution.
     134
    129135= 0.8.11 =
    130136 * Added Russian translation. Thank you to Игорь Клипач for contributing!
Note: See TracChangeset for help on using the changeset viewer.