您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows hidden progress on qualtrics surveys
当前为
// ==UserScript== // @name (MTurk) Display Qualtrics Survey Progress // @namespace https://greasyfork.org/en/users/367017-shinobu-oshino // @version 1.27 // @description Shows hidden progress on qualtrics surveys // @author Nicholas Ramsey ([email protected]) // @match https://*.qualtrics.com/* // @grant unsafeWindow // ==/UserScript== function waitForElement(selector) { return new Promise((resolve, reject) => { const interval = setInterval(() => { const element = document.querySelector(selector); if(element) { resolve(element); clearInterval(interval); } }, 50); }); } function removeOldProgressBar(e) { const oldProgressBar = document.querySelector('#ProgressBar'); if(oldProgressBar) { oldProgressBar.style.display = 'none'; } } (async function() { 'use strict'; const page = await waitForElement('#Page'); const pageObserver = new MutationObserver(removeOldProgressBar); pageObserver.observe(page, { childList: true }); const progress = unsafeWindow.QSettings.pt.ProgressPercent; const indicator = document.createElement('span'); indicator.textContent = `${progress}%`; indicator.style.cssText = `color: white; background: black; padding: 8px 12px; position: absolute; left: 0; top: 0; font-family: 'Roboto', sans-serif; font-size: 0.9em; border-bottom-right-radius: 8px;`; document.body.appendChild(indicator); const oldXHROpen = unsafeWindow.XMLHttpRequest.prototype.open; unsafeWindow.XMLHttpRequest.prototype.open = function(method, url, async) { if(url.includes('next?rand=')) { this.addEventListener('load', function() { const result = JSON.parse(this.response); indicator.textContent = `${result.ProgressPercent}%`; }); } return oldXHROpen.apply(this, arguments); }; })();