// ==UserScript==
// @name 超星泛雅平台学习通表格转填空题
// @namespace moe.canfire.flf
// @version 1.0.0
// @description desc超星泛雅平台学习通表格转填空题
// @author mengzonefire
// @license MIT
// @compatible firefox Tampermonkey
// @compatible firefox Violentmonkey
// @compatible chrome Violentmonkey
// @compatible chrome Tampermonkey
// @contributionURL https://afdian.net/@mengzonefire
// @match *://mooc1-1.chaoxing.com/exam/gotoimportpage?*
// @resource jquery https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js
// @resource sweetalert2Css https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css
// @require https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.js
// @require https://cdn.jsdelivr.net/npm/js-base64
// @require https://cdn.staticfile.org/spark-md5/3.0.0/spark-md5.min.js
// @require https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_deleteValue
// @grant GM_setClipboard
// @grant GM_xmlhttpRequest
// @grant GM_info
// @grant GM_getResourceText
// @grant GM_addStyle
// @grant unsafeWindow
// @run-at document-start
// @connect *
// @downloadURL none
// ==/UserScript==
"use strict";
var url=window.location.href;
String.prototype.trim = function() {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
String.prototype.replaceAll = function(s1, s2) {
return this.replace(new RegExp(s1, "gm"), s2);
}
function jkimport(){
var tabedStr=prompt("复制表格标题,在此粘帖:","");//'简化中文 单词 音标 中文意思';
if (tabedStr== null) return;
var html='';
tabedStr=tabedStr.trim();
var arr=tabedStr.split("\t");
for(i=0;i
'+(i+1)+'.'+arr[i]+' 请填写____.'+'
'; html=html+'答案:无;'+'
'; html=html+'题型:填空题'+'
'; }//for $("#questionText").html( html.trim() ); } $(function(){ var btn=$("body > div.wid1260 > p.mainTop > a.Import"); var s=$(btn).prop("outerHTML"); s=s.replace("模版导入","表格转填空") s=s.replace("onclick=\"checkFile()\"","onclick=\"jkimport()\"") $(btn).after(s); $(btn).next().css("border","1px solid red"); });