~dvko/wp-social-sharing

dea6d3cd8fc0eb06d66074731d47e22ba10e83b6 — Danny van Kooten 1 year, 5 months ago a464990
get rid of jquery dependency for admin script
3 files changed, 9 insertions(+), 16 deletions(-)

M assets/js/admin-script.js
D assets/js/admin-script.min.js
M includes/class-admin.php
M assets/js/admin-script.js => assets/js/admin-script.js +8 -14
@@ 1,14 1,8 @@
(function($) {
	
	var $f = $("#dvkss_settings");

	function toggleRows() {
		$f.find('.row-icon-size').toggle( ($f.find('.row-load-icon-css input:checked').val() == 1) );
	}

	$f.change(toggleRows);

	// run once on init
	toggleRows();

})(jQuery);
\ No newline at end of file
const form = document.getElementById('dvkss_settings');
function toggleIconSizeRow() {
	const value = form.elements.namedItem('dvk_social_sharing[load_icon_css]').value;
	form.querySelector('.row-icon-size').style.display = value === '1' ?  '' : 'none';
}

form.addEventListener('change', toggleIconSizeRow);
toggleIconSizeRow();

D assets/js/admin-script.min.js => assets/js/admin-script.min.js +0 -1
@@ 1,1 0,0 @@
!function(a){function b(){c.find(".row-icon-size").toggle(1==c.find(".row-load-icon-css input:checked").val())}var c=a("#dvkss_settings");c.change(b),b()}(jQuery);
\ No newline at end of file

M includes/class-admin.php => includes/class-admin.php +1 -1
@@ 63,7 63,7 @@ class DVKSS_Admin {

		$suffix = ( defined( SCRIPT_DEBUG ) && SCRIPT_DEBUG ) ? '' : '.min';
		wp_enqueue_style( 'dvk-social-sharing', plugins_url( '/assets/css/admin-styles' . $suffix .'.css', $this->plugin_file ) );
		wp_enqueue_script( 'dvk-social-sharing', plugins_url( 'assets/js/admin-script' . $suffix .'.js', $this->plugin_file ), array( 'jquery' ), DVKSS_VERSION , true );
		wp_enqueue_script( 'dvk-social-sharing', plugins_url( 'assets/js/admin-script.js', $this->plugin_file ), array(), DVKSS_VERSION , true );
	}

	/**