// ==UserScript== // @name 三亚学院新教务评教 // @namespace http://tampermonkey.net/ // @version 0.2 // @author 初七 // @description 借鉴了南昌航空大学教务处一键评教,地址为https://greasyfork.org/zh-CN/scripts/375660-%E5%8D%97%E6%98%8C%E8%88%AA%E7%A9%BA%E5%A4%A7%E5%AD%A6-%E6%95%99%E5%8A%A1%E5%A4%84-%E4%B8%80%E9%94%AE%E8%AF%84%E6%95%99 // @include http://jwxt.sanyau.edu.cn/syxy_jsxsd/xspj/xspj_list.do* // @include http://jwxt.sanyau.edu.cn/syxy_jsxsd/xspj/xspj_edit_syxy.do* // @grant unsafeWindow // @grant window // @reqire http://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js // @downloadURL none // ==/UserScript== (function() { var markPosition=1 var flag1=0; var href=document.location.href; if(href.search('jwxt.sanyau.edu.cn/syxy_jsxsd/xspj/xspj_list.do')!=-1){//判断是否为加载网页 hook(); addBtn() }else { remark(); } function hook() { unsafeWindow.JsMod = function (htmlurl, tmpWidth, tmpHeight) { htmlurl = getRandomUrl(htmlurl); var newwin = window.open(htmlurl, window, "dialogWidth:" + tmpWidth + "px;status:no;dialogHeight:" + tmpHeight + "px") if (newwin == "refresh" || newwin == "ok") { if (getOs() == "chrome") { alert(getOs()); window.location.reload();// 谷歌浏览器要用此方法刷新 } else { window.location.reload() //window.location.href = window.location.href; } } } } function remarkAll() { $('#dataList a').each(function (index) { var a = $('#dataList a')[index] a.click() }) } function remark() { //hookRemark(); //hookAlert() //执行评分 var length=$("input[type='radio']").length; $("input[type='radio']").each(function (index) { //if(length-1-index<4){ var position=3; if((length-1)-index==position){ $(this).attr('checked','checked') } /*}else*/ if(index%5==0){ $(this).attr('checked','checked') } }) $('textarea').val('老师的课很好听'); document.getElementById("issubmit").value = "1"; $.ajax({ async: false, type: "POST", url:'/syxy_jsxsd/xspj/xspj_save_syxy.do', contentType : "application/x-www-form-urlencoded; charset=utf-8", data:$("#Form1").serialize(), success: function () { window.close() }, error: function () { alert('error') } }) } function addBtn() { var btn="" $('#dataList a').attr("target", "_blank") $('#btnShenshen').after(btn); $('#btnRemarkAll').click(function () { var isConfirm=confirm('是否一键评分') if(isConfirm){ remarkAll(); }else{ return; } }) } })();