~dvko/wp-social-sharing

ad9e3b0025e78f3d6a537087d5816dc78514c4ad — Danny van Kooten 1 year, 5 months ago 7954dd1
use terser instead of uglifyjs, mangle names
M Makefile => Makefile +2 -2
@@ 8,7 8,7 @@ assets/css/styles.min.css: assets/css/styles.css
	lightningcss --minify $^  -o $@

assets/js/admin-script.min.js: assets/js/admin-script.js
	uglifyjs $^  -o $@
	terser $^ --compress --mangle -o $@

assets/js/script.min.js: assets/js/script.js
	uglifyjs $^  -o $@
	terser $^ --compress --mangle -o $@

M assets/js/admin-script.js => assets/js/admin-script.js +10 -7
@@ 1,8 1,11 @@
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';
}
(function() {
	const form = document.getElementById('dvkss_settings');

form.addEventListener('change', toggleIconSizeRow);
toggleIconSizeRow();
	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();
})();

M assets/js/admin-script.min.js => assets/js/admin-script.min.js +1 -1
@@ 1,1 1,1 @@
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();
\ No newline at end of file
!function(){const e=document.getElementById("dvkss_settings");function n(){const n=e.elements.namedItem("dvk_social_sharing[load_icon_css]").value;e.querySelector(".row-icon-size").style.display="1"===n?"":"none"}e.addEventListener("change",n),n()}();
\ No newline at end of file

M assets/js/script.js => assets/js/script.js +29 -27
@@ 1,32 1,34 @@
/**
 * Open a popup
 *
 * @param {MouseEvent} evt
 * @returns {boolean}
 */
function openSocialSharingPopup(evt) {
	const top = (screen.availHeight - 500) / 2;
	const left = (screen.availWidth - 500) / 2;
	const popup = window.open(
		this.href,
		'social',
		'width=550,height=420,left='+ left +',top='+ top +',location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1'
	);
(function() {
	/**
	 * Open a popup
	 *
	 * @param {MouseEvent} evt
	 * @returns {boolean}
	 */
	function openSocialSharingPopup (evt) {
		const top = (screen.availHeight - 500) / 2;
		const left = (screen.availWidth - 500) / 2;
		const popup = window.open(
			this.href,
			'social',
			'width=550,height=420,left=' + left + ',top=' + top + ',location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1'
		);

	if(popup) {
		popup.focus();
		evt.preventDefault();
		if (popup) {
			popup.focus();
			evt.preventDefault();
		}
	}
}

/**
 * Adds the click event handler to all links inside the .dvk-social-sharing wrapper element
 */
function initSocialSharing() {
	const links = document.querySelectorAll('.dvk-social-sharing a');
	for (let i = 0; i < links.length; i++) {
		links[i].addEventListener('click', openSocialSharingPopup);
	/**
	 * Adds the click event handler to all links inside the .dvk-social-sharing wrapper element
	 */
	function initSocialSharing () {
		const links = document.querySelectorAll('.dvk-social-sharing a');
		for (let i = 0; i < links.length; i++) {
			links[i].addEventListener('click', openSocialSharingPopup);
		}
	}
}

window.addEventListener('load', initSocialSharing)
	window.addEventListener('load', initSocialSharing)
})();

M assets/js/script.min.js => assets/js/script.min.js +1 -1
@@ 1,1 1,1 @@
function openSocialSharingPopup(evt){const top=(screen.availHeight-500)/2;const left=(screen.availWidth-500)/2;const popup=window.open(this.href,"social","width=550,height=420,left="+left+",top="+top+",location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1");if(popup){popup.focus();evt.preventDefault()}}function initSocialSharing(){const links=document.querySelectorAll(".dvk-social-sharing a");for(let i=0;i<links.length;i++){links[i].addEventListener("click",openSocialSharingPopup)}}window.addEventListener("load",initSocialSharing);
\ No newline at end of file
!function(){function e(e){const t=(screen.availHeight-500)/2,n=(screen.availWidth-500)/2,o=window.open(this.href,"social","width=550,height=420,left="+n+",top="+t+",location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1");o&&(o.focus(),e.preventDefault())}window.addEventListener("load",(function(){const t=document.querySelectorAll(".dvk-social-sharing a");for(let n=0;n<t.length;n++)t[n].addEventListener("click",e)}))}();
\ No newline at end of file