Greasy Fork

Greasy Fork is available in English.

自动展开问卷星分页问卷并显示提示

自动展开问卷星的分页问卷,并在左上角显示提示

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         自动展开问卷星分页问卷并显示提示
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  自动展开问卷星的分页问卷,并在左上角显示提示
// @author       QY
// @match        https://www.wjx.cn/*
// @match        http://www.wjx.cn/*
// @match        https://www.wenjuan.com/*
// @match        http://www.wenjuan.com/*
// @grant        none
// @icon         https://pic.qqtn.com/up/2017-10/2017101813521774869.jpg
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 展开分页问卷
    function expandPage() {
        // 检查是否存在分页并展开
        $('.fieldset').css('display', 'block');
        $('#divSubmit').css('display', 'block');
        $('#divMultiPage').css('display', 'none');
    }

    // 创建提示框
    function createNotification() {
        var notification = document.createElement('div');
        notification.textContent = '检测到问卷有分页,已自动为您展开';
        notification.style.position = 'fixed';
        notification.style.top = '0';
        notification.style.left = '0';
        notification.style.width = '100%';
        notification.style.backgroundColor = 'red';
        notification.style.color = 'white';
        notification.style.textAlign = 'center';
        notification.style.padding = '15px';
        notification.style.boxShadow = '0 2px 5px rgba(0,0,0,0.2)';
        notification.style.zIndex = '9999';
        document.body.appendChild(notification);

        // 5秒后移除提示框
        setTimeout(function() {
            notification.remove();
        }, 1500);
    }

    // 检查是否存在分页
    function checkForPagination() {
        var hasPagination = $('#divMultiPage').length > 0;
        if (hasPagination) {
            expandPage();
            createNotification(); // 创建提示框
        }
    }

    // 绑定事件,在页面加载完成后执行检查分页
    window.addEventListener('load', function() {
        checkForPagination();
    });
})();