MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / addLoadingAnimationAtPos

Function addLoadingAnimationAtPos

scripts/magnify_image.js:1188–1210  ·  view source on GitHub ↗
(
  x,
  y,
  size = 40,
  containerStyle = "",
  loadingStyle = ""
)

Source from the content-addressed store, hash-verified

1186// #region utils
1187
1188function addLoadingAnimationAtPos(
1189 x,
1190 y,
1191 size = 40,
1192 containerStyle = "",
1193 loadingStyle = ""
1194) {
1195 let ele = document.createElement("div");
1196 ele.style.cssText = `
1197 position: fixed;
1198 left: ${x - size / 2}px;
1199 top: ${y - size / 2}px;
1200 width: ${size}px;
1201 height: ${size}px;
1202 z-index: 2147483647;
1203 pointer-events: none;
1204 user-select: none;
1205 ${containerStyle}
1206 `;
1207 addLoadingAnimation(ele, size, loadingStyle);
1208 document.body.appendChild(ele);
1209 return () => ele.remove();
1210}
1211function addLoadingAnimation(
1212 element,
1213 size = Math.min(element?.clientWidth, element?.clientHeight) || 0,

Callers 2

magnifyImageFunction · 0.85
createPreviewFunction · 0.85

Calls 2

addLoadingAnimationFunction · 0.85
removeMethod · 0.45

Tested by

no test coverage detected