HEX
Server: Apache
System: Linux web5.visualcom.es 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: ensaco.es (10019)
PHP: 8.3.32
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/ensaco.es/httpdocs/wp-content/themes/bb-theme/js/preview.js
/**
 * Logic for previewing a preset.
 */
(function($) {
	
	function spliceString(idx, rem, s) {
		return (this.slice(0, idx) + s + this.slice(idx + Math.abs(rem)));
	};
	
	$(function() {
		
		$('a').each(function() {
		
			var ele         = $(this),
				attrName    = 'href',
				attr        = ele.attr(attrName),
				q           = null,
				i           = 0;
		
			if(typeof attr != 'undefined' && attr.indexOf(window.location.hostname) > -1) {
			
				q = (attr.indexOf('?') > -1 ? '&' : '?') + 'fl-preview=' + preview.preset;
			
				if(attr.indexOf('#') > -1) {
					i    = attr.indexOf('#');
					attr = attr.substring(0, i) + q + attr.substring(i, attr.length);
				}
				else {
					attr += q;
				}
				
				ele.attr(attrName, attr);
			}
		});
	});
	
})(jQuery);