MCPcopy
hub / github.com/zxlie/FeHelper / createProgressUI

Function createProgressUI

apps/screenshot/content-script.js:229–322  ·  view source on GitHub ↗

* 创建截图进度UI * @param {string} [text='正在截取网页...'] 显示的文本 * @returns {HTMLElement} 创建的进度UI元素

(text = '正在截取网页...')

Source from the content-addressed store, hash-verified

227 * @returns {HTMLElement} 创建的进度UI元素
228 */
229 function createProgressUI(text = '正在截取网页...') {
230 // 先检查是否已存在
231 let progressContainer = document.getElementById('fehelper-screenshot-progress');
232 if (progressContainer) {
233 progressContainer.querySelector('.fh-progress-text').textContent = text;
234 progressContainer.style.display = 'flex';
235 return progressContainer;
236 }
237
238 // 创建进度UI容器
239 progressContainer = document.createElement('div');
240 progressContainer.id = 'fehelper-screenshot-progress';
241 progressContainer.setAttribute('data-fh-ui', 'true');
242 progressContainer.className = 'fehelper-ui-element';
243 progressContainer.style.cssText = `
244 position: fixed;
245 bottom: 20px;
246 left: 50%;
247 transform: translateX(-50%);
248 background-color: rgba(0, 0, 0, 0.7);
249 color: white;
250 padding: 10px 20px;
251 border-radius: 5px;
252 z-index: 10000000;
253 font-size: 14px;
254 display: flex;
255 flex-direction: column;
256 align-items: center;
257 box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
258 width: 300px;
259 `;
260
261 // 创建文本元素
262 const textElement = document.createElement('div');
263 textElement.className = 'fh-progress-text';
264 textElement.textContent = text;
265 textElement.style.cssText = 'margin-bottom: 10px; width: 100%; text-align: center;';
266 progressContainer.appendChild(textElement);
267
268 // 创建进度条容器
269 const progressBarContainer = document.createElement('div');
270 progressBarContainer.style.cssText = `
271 width: 100%;
272 height: 10px;
273 background-color: rgba(255, 255, 255, 0.2);
274 border-radius: 5px;
275 overflow: hidden;
276 margin-bottom: 10px;
277 `;
278 progressContainer.appendChild(progressBarContainer);
279
280 // 创建进度条
281 const progressBar = document.createElement('div');
282 progressBar.className = 'fh-progress-bar';
283 progressBar.style.cssText = `
284 height: 100%;
285 width: 0%;
286 background-color: #4CAF50;

Callers 2

captureVisibleFunction · 0.85
captureFullPageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected