Greasy Fork

来自缓存

Greasy Fork is available in English.

雨课堂课件导出为pdf

雨课堂课件ppt导出为pdf,需要后端支持,详见https://github.com/ShevonKuan/yuektang_ppt2pdf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         雨课堂课件导出为pdf
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @description 雨课堂课件ppt导出为pdf,需要后端支持,详见https://github.com/ShevonKuan/yuektang_ppt2pdf
// @author       shevon
// @match        https://changjiang.yuketang.cn/web/print
// @require      https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function () {
    'use strict';
    setTimeout(function () { console.log('开始执行'); }, 3000);
    $('.controls-btns').append('<p class="print fuckyuketang" title="打印">脚本打印</p>');
    $('.fuckyuketang').on('click', function () {
        var link = new Array();
        $('.fuckyuketang').html('开始获取图片资源信息...');
        var link = new Array();
        $.each($('img.pptimg'), function () {
            link.push($(this).attr('src'));
        });
        $('.fuckyuketang').html('检查打印服务器连接...');
        GM_xmlhttpRequest({
            method: "GET",
            url: "http://localhost:63321/",
            headers: {
                "Content-Type": "application/json;charset=utf-8"
            },
            data: JSON.stringify({
                'status': 'ok'
            }),
            onload: function () {
                    alert('开始打印...');
                    GM_xmlhttpRequest({
                        method: "POST",
                        url: "http://localhost:63321/print",
                        headers: {
                            "Content-Type": "application/json;charset=utf-8"
                        },
                        data: JSON.stringify({
                            'title': $(document).attr('title'),
                            'link': link
                        }),
                        onload: function () {
                                alert('已完成打印');
                        },
                        onerror: function () {
                            alert("请求失败");
                        }
                    });
                    $('.fuckyuketang').html('脚本打印');
                
            },
            onerror: function () {
                alert("找不到服务器请重试");
                $('.fuckyuketang').html('脚本打印');
            }
        });

    })


})();