# copy-the-code/4.0.2/assets/js/notice.js

Copy Anything to Clipboard for WordPress – Copy Button, Copy Text &amp; Copy Code, version 4.0.2. 77 lines.

- Page: https://pluginprobe.com/plugins/copy-the-code/4.0.2/code/assets/js/notice.js
- Raw: https://pluginprobe.com/plugins/copy-the-code/4.0.2/raw/assets/js/notice.js
- Modified: 2024-10-10T19:27:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/copy-the-code/4.0.2/code/assets/js/notice.js#L10-L20`.

```javascript
(function($) {

	CopyTheCodeNotice = {

		/**
		 * Init
		 */
		init: function()
		{
			this._bind();
		},

		_bind: function()
		{
			$( document ).on( 'click', '.copy-the-code-allow-tracking', CopyTheCodeNotice.allow );
			$( document ).on( 'click', '.copy-the-code-not-allow-tracking, .copy-the-code-notice .notice-dismiss', CopyTheCodeNotice.not_allow );
		},

		/**
		 * Copy to Clipboard
		 */
		allow: function( event ) {
			event.preventDefault();

			$.ajax(
				{
					url: copy_the_code_notice.ajax_url,
					type: 'POST',
					data: {
						action: 'copy_the_code_allow_tracking',
						security: copy_the_code_notice.nonce,
					},
					success: function( response ) {
						if ( response.success ) {
							$( '.copy-the-code-notice' ).remove();
						}
					}
				}
			);
		},

		/**
		 * Copy to Clipboard
		 */
		not_allow: function( event ) {
			event.preventDefault();

			$.ajax(
				{
					url: copy_the_code_notice.ajax_url,
					type: 'POST',
					data: {
						action: 'copy_the_code_dont_allow_tracking',
						security: copy_the_code_notice.nonce,
					},
					success: function( response ) {
						if ( response.success ) {
							$( '.copy-the-code-notice' ).remove();
						}
					}
				}
			);
		}

	};

	/**
	 * Initialization
	 */
	$(
		function() {
			CopyTheCodeNotice.init();
		}
	);

})( jQuery );

```
