# woo-additional-terms/1.5.1/assets/js/admin.js

Additional Terms Lite for WooCommerce, version 1.5.1. 40 lines.

- Page: https://pluginprobe.com/plugins/woo-additional-terms/1.5.1/code/assets/js/admin.js
- Raw: https://pluginprobe.com/plugins/woo-additional-terms/1.5.1/raw/assets/js/admin.js
- Modified: 2023-01-05T16:20:58+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/woo-additional-terms/1.5.1/code/assets/js/admin.js#L10-L20`.

```javascript
/* global jQuery, ajaxurl, watVars */

( function ( wp, $ ) {
	'use strict';

	if ( ! wp ) {
		return;
	}

	const watAdmin = {
		cache() {
			this.vars = {};
			this.vars.rate = '#woo-additional-terms-dismiss-rate .notice-dismiss';
			this.vars.upsell = '#woo-additional-terms-dismiss-upsell .notice-dismiss';
		},

		init() {
			this.cache();
			$( document.body ).on( 'click', this.vars.rate, ( event ) => this.handleOnDismiss( event, 'rate' ) );
			$( document.body ).on( 'click', this.vars.upsell, ( event ) => this.handleOnDismiss( event, 'upsell' ) );
		},

		handleOnDismiss( event, action ) {
			event.preventDefault();

			$.ajax( {
				type: 'POST',
				url: ajaxurl,
				data: {
					_ajax_nonce: watVars.dismiss_nonce,
					action: `woo_additional_terms_dismiss_${ action }`,
				},
				dataType: 'json',
			} );
		},
	};

	watAdmin.init();
} )( window.wp, jQuery );

```
