Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
( () => {
for ( const unitSelect of document.getElementsByClassName( 'advads-option-placement-parallax-unit' ) ) {
unitSelect.addEventListener( 'change', event => {
event.target.closest( '.advads-option-placement-parallax-height' ).querySelector( 'input' ).max = event.target.value === 'vh' ? '100' : '';
} );
}
} )();

View File

@@ -0,0 +1,272 @@
/* eslint-disable camelcase */
/**
* Placement definition.
*
* @typedef ParallaxPlacement
* @type {Object.<string, Object>}
*
* @property {boolean} enabled - Whether the placement is enabled.
* @property {Object} height - Height of the parallax placement.
* @property {number} height.value - Height value.
* @property {string} height.unit - Height unit.
*/
/**
* Associative array with parallax options.
*
* @typedef ParallaxOptions
* @type {Object}
*
* @property {ParallaxPlacement[]} placements - Parallax placements.
*
* @property {Array} classes - Parallax classes.
* @property {string} classes.prefix - Current frontend prefix.
* @property {string} classes.container - Parallax container class prefix.
* @property {string} classes.clip - Parallax clip div class.
* @property {string} classes.inner - Parallax inner div class.
*/
(
() => {
// The current viewport height. Re-assign on window.resize event.
let viewportHeight;
// Object to save placement keys that have been initialized.
const initializedPlacements = {};
// Object to save initialized image instances.
const imageInstances = {};
// Test via a getter in the options object to see if the passive property is accessed
let supportsPassive = false;
try {
const opts = Object.defineProperty({}, 'passive', {
get: () => {
supportsPassive = { passive: true };
},
});
window.addEventListener('testPassive', null, opts);
window.removeEventListener('testPassive', null, opts);
} catch (e) {}
/** @type {ParallaxOptions} see type definition at top of file */
const options = window.advads_parallax_placement_options;
/**
* Set styles on the inner container when the parallax placement gets initialized and on window.resize.
*
* @param {Element} placementContainer
* @param {Element} placementInner
*/
const onLoad = (placementContainer, placementInner) => {
placementInner.style.maxWidth =
placementContainer.offsetWidth + 'px';
placementInner.style.visibility = 'visible';
viewportHeight = window.innerHeight;
};
/**
* Iterate all parallax placements. If a placement is found, call the passed callback.
*
* @param {Function} callback
* @param {ParallaxPlacement[]} placements
*/
const calculate = (callback, placements) => {
for (const placementsKey in placements) {
const placementContainer = document.getElementById(
options.classes.prefix +
options.classes.container +
placementsKey
);
if (placementContainer === null) {
continue;
}
const placementInner =
placementContainer.getElementsByClassName(
options.classes.prefix + options.classes.inner
)[0];
if (placementContainer && placementInner) {
initializedPlacements[placementsKey] = true;
callback(
placementContainer,
placementInner,
options.placements[placementsKey]
);
}
}
};
/**
* Fit the parallax image into the container.
*
* @param {Element} placementContainer
* @param {Element} placementInner
* @param {string} event
*/
const fitImage = (placementContainer, placementInner, event = '') => {
const imgElement = placementInner.querySelector('img');
if (!imageInstances[imgElement.src]) {
imageInstances[imgElement.src] = {
// eslint-disable-next-line no-undef
image: new Image(),
isLoaded: false,
};
}
const containerRect = placementContainer.getBoundingClientRect();
const resizeCallback = (img) => {
if (
img.naturalHeight / img.naturalWidth >
viewportHeight / placementContainer.clientWidth
) {
imgElement.style.objectFit = 'contain';
}
placementInner.style.left =
containerRect.width / 2 + containerRect.left + 'px';
if (
img.naturalHeight >= viewportHeight &&
img.naturalWidth <= placementContainer.clientWidth
) {
imgElement.style.height = '100vh';
placementInner.style.transform = 'translateX(-50%)';
return;
}
if (
placementInner.getBoundingClientRect().height <
containerRect.height
) {
placementInner.style.height = containerRect.height + 'px';
imgElement.style.objectFit = 'cover';
}
};
const scrollCallback = () => {
let offsetY;
if (
containerRect.bottom >= viewportHeight &&
containerRect.top <= viewportHeight
) {
offsetY =
viewportHeight -
placementInner.getBoundingClientRect().height;
} else if (containerRect.top <= 0 && containerRect.bottom > 0) {
offsetY = 0;
} else {
offsetY = (
((viewportHeight -
placementInner.getBoundingClientRect().height) /
(viewportHeight - containerRect.height)) *
containerRect.top
).toFixed(2);
}
placementInner.style.transform =
'translate3d(-50%,' + offsetY + 'px, 0)';
};
if (imageInstances[imgElement.src].isLoaded) {
if (event !== 'scroll') {
resizeCallback(imageInstances[imgElement.src].image);
}
scrollCallback();
return;
}
imageInstances[imgElement.src].image.addEventListener(
'load',
(e) => {
imageInstances[imgElement.src].isLoaded =
e.target.complete && e.target.naturalHeight !== 0;
resizeCallback(e.target);
scrollCallback();
}
);
imageInstances[imgElement.src].image.src = imgElement.src;
};
/**
* Initialize Placements.
* Use this on page load and as a callback for deferred injection.
*/
const initializePlacements = () => {
const placements = Object.assign({}, options.placements);
for (const placementsKey in initializedPlacements) {
delete placements[placementsKey];
}
if (!Object.keys(placements).length) {
return;
}
calculate((placementContainer, placementInner) => {
placementContainer.style.visibility = 'hidden';
onLoad(placementContainer, placementInner);
fitImage(placementContainer, placementInner);
placementContainer.style.visibility = 'visible';
}, placements);
};
// register event listeners and initialize existing parallax placements.
initializePlacements();
document.addEventListener(
'DOMContentLoaded',
initializePlacements,
supportsPassive
);
window.addEventListener(
'resize',
() =>
calculate((placementContainer, placementInner) => {
onLoad(placementContainer, placementInner);
fitImage(placementContainer, placementInner, 'resize');
}, options.placements),
supportsPassive
);
const fitImageOnScroll = () =>
calculate((placementContainer, placementInner) => {
fitImage(placementContainer, placementInner, 'scroll');
}, options.placements);
let ticking = false;
const onScroll = () => {
if (!ticking) {
window.requestAnimationFrame(() => {
fitImageOnScroll();
ticking = false;
});
ticking = true;
}
};
window.addEventListener('scroll', onScroll, supportsPassive);
window.addEventListener('touchmove', onScroll, supportsPassive);
// add cache-busting event listeners.
if (
typeof advanced_ads_pro !== 'undefined' &&
typeof advanced_ads_pro.observers !== 'undefined'
) {
advanced_ads_pro.observers.add((event) => {
if (
['inject_passive_ads', 'inject_ajax_ads'].indexOf(
event.event
) === -1 ||
(event.ad_ids && !Object.keys(event.ad_ids).length)
) {
return;
}
initializePlacements();
});
}
}
)();

View File

@@ -0,0 +1 @@
(()=>{let e;const t={},s={};let i=!1;try{const e=Object.defineProperty({},"passive",{get:()=>{i={passive:!0}}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(e){}const n=window.advads_parallax_placement_options,a=(t,s)=>{s.style.maxWidth=t.offsetWidth+"px",s.style.visibility="visible",e=window.innerHeight},d=(e,s)=>{for(const i in s){const s=document.getElementById(n.classes.prefix+n.classes.container+i);if(null===s)continue;const a=s.getElementsByClassName(n.classes.prefix+n.classes.inner)[0];s&&a&&(t[i]=!0,e(s,a,n.placements[i]))}},o=(t,i,n="")=>{const a=i.querySelector("img");s[a.src]||(s[a.src]={image:new Image,isLoaded:!1});const d=t.getBoundingClientRect(),o=s=>{if(s.naturalHeight/s.naturalWidth>e/t.clientWidth&&(a.style.objectFit="contain"),i.style.left=d.width/2+d.left+"px",s.naturalHeight>=e&&s.naturalWidth<=t.clientWidth)return a.style.height="100vh",void(i.style.transform="translateX(-50%)");i.getBoundingClientRect().height<d.height&&(i.style.height=d.height+"px",a.style.objectFit="cover")},l=()=>{let t;t=d.bottom>=e&&d.top<=e?e-i.getBoundingClientRect().height:d.top<=0&&d.bottom>0?0:((e-i.getBoundingClientRect().height)/(e-d.height)*d.top).toFixed(2),i.style.transform="translate3d(-50%,"+t+"px, 0)"};if(s[a.src].isLoaded)return"scroll"!==n&&o(s[a.src].image),void l();s[a.src].image.addEventListener("load",(e=>{s[a.src].isLoaded=e.target.complete&&0!==e.target.naturalHeight,o(e.target),l()})),s[a.src].image.src=a.src},l=()=>{const e=Object.assign({},n.placements);for(const s in t)delete e[s];Object.keys(e).length&&d(((e,t)=>{e.style.visibility="hidden",a(e,t),o(e,t),e.style.visibility="visible"}),e)};l(),document.addEventListener("DOMContentLoaded",l,i),window.addEventListener("resize",(()=>d(((e,t)=>{a(e,t),o(e,t,"resize")}),n.placements)),i);const r=()=>d(((e,t)=>{o(e,t,"scroll")}),n.placements);window.addEventListener("scroll",r,i),window.addEventListener("touchmove",r,i),"undefined"!=typeof advanced_ads_pro&&void 0!==advanced_ads_pro.observers&&advanced_ads_pro.observers.add((e=>{-1===["inject_passive_ads","inject_ajax_ads"].indexOf(e.event)||e.ad_ids&&!Object.keys(e.ad_ids).length||l()}))})();