return isDirty;
};
+ /**
+ * Wrapper for toggle function which is deprecated in from jQuery 1.8;
+ * @param fn1,fn2 handlers
+ */
+
+ $.fn.toggleClick = function( fn1, fn2 ) {
+ // Don't mess with animation or css toggles
+ if ( !$.isFunction( fn1 ) || !$.isFunction( fn2 ) ) {
+ return;
+ }
+ // migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
+ // Save reference to arguments for access in closure
+ var args = arguments,
+ guid = fn1.guid || $.guid++,
+ i = 0,
+ toggler = function( event ) {
+ // Figure out which function to execute
+ var lastToggle = ( $._data( this, "lastToggle" + fn1.guid ) || 0 ) % i;
+ $._data( this, "lastToggle" + fn1.guid, lastToggle + 1 );
+ // Make sure that clicks stop
+ event.preventDefault();
+ // and execute the function
+ return args[ lastToggle ].apply( this, arguments ) || false;
+ };
+ // link all the functions, so any of them can unbind this click handler
+ toggler.guid = guid;
+ while ( i < args.length ) {
+ args[ i++ ].guid = guid;
+ }
+ return this.click( toggler );
+ };
+
/**
* Wrapper for select2 initialization function; supplies defaults
* @param options object
{literal}
CRM.$(function($){
- cj('#addcc').toggle( function() { cj(this).text('Remove CC');
+ cj('#addcc').toggleClick( function() { cj(this).text('Remove CC');
cj('tr#cc').show().find('ul').find('input').focus();
},function() { cj(this).text('Add CC');cj('#cc_id').val('');
cj('tr#cc ul li:not(:last)').remove();cj('#cc').hide();
});
- cj('#addbcc').toggle( function() { cj(this).text('Remove BCC');
+ cj('#addbcc').toggleClick( function() { cj(this).text('Remove BCC');
cj('tr#bcc').show().find('ul').find('input').focus();
},function() { cj(this).text('Add BCC');cj('#bcc_id').val('');
cj('tr#bcc ul li:not(:last)').remove();cj('#bcc').hide();