職教雲課堂刷題軟體自動答題播放下一集

楓ic發表於2020-10-23

軟體簡介:

支援職教雲(智慧職教)所有課程,有學習時間,支援所有型別:視訊、ppt、課件、作業、…等等


軟體下載:

https://www.lanzous.com/b01hhxyeh 無需安裝任何瀏覽器外掛,開啟即可使用


效果圖

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

在這裡插入圖片描述

2、原始碼

const hrefs = []
const arrowDown = 'am-icon-caret-down'
const cl = 'class'
const sp = 'span'
const st = setTimeout
var zjsqInfoDom
var currentLessonIndex = 0
var lessonFailed = 0
var totalStudyTime = 0
var losingStreak = 0
var stopFlag = false
var skipProgress = 0
var totalLessons = 0
 
// funcs --------------------------------
function main () {
  try {
    const input = prompt('[職教書籤v3] 跳過已學進度超過百分之幾的課程?\n\n輸入百分比,但是不要輸入百分號\n如:90\n\n輸入100或者更大的數字就不會跳過任何課程:', '90') || '100'
    skipProgress = parseInt(input.replace(/[^0-9]/ig, '')) || 100
    // fetch global datas
    log('開始獲取課件資料!')
    globalDataHander()
    // get datas
    st(() => {
      log('正在準備刷取學習進度及時間的必要資訊...')
      // started
      directoryDataRequester(0)
    }, 12000)
    return 'started'
  } catch (e) {
    log('主程式異常,可能無法正常工作:' + e)
  };
};
 
function log (text) {
  const info = `[${new Date().format()}] ${text}`
  console.log(info)
  zjsqInfoDom.append(info + '<br>')
  var ele = zjsqInfoDom[0]
  ele.scrollTop = ele.scrollHeight + 999
};
 
function initial () {
  // 請保持這種格式,否則getText函式無法從註釋中正確提取此處的css
  function zjsqCss () {/*
.zjsqInfoBox {
    width: 700px;
    height: 450px;
    background-color:white;
    position:absolute;
    top:50%;
    left:50%;
    transform:translateX(-50%) translateY(-50%);
    -moz-transform:translateX(-50%) translateY(-50%);
    -webkit-transform:translateX(-50%) translateY(-50%);
    -ms-transform:translateX(-50%) translateY(-50%);
    border-radius:5px;
    z-index: 9999;
    box-shadow: 3px 3px 10px rgba(0,0,0,.2);
    padding: 20px;
}
.zjsqTitle {
    font-weight: bold;
    font-size: 16px;
    width: 100%;
    text-align: center;
}
#zjysqInfo {
    border-radius: 4px;
    margin-top: 15px;
    padding: 15px;
    width: 100%;
    height: 370px;
    word-wrap: break-word;
    overflow-y: scroll;
    font-size: 14px;
    color: #FAFAFA;
    background-color: rgba(0,0,0,.8);
} */
  };
 
    // 請保持這種格式,否則getText函式無法從註釋中正確提取此處的html
  function zjsqHtml () {/*
<div id="zjsqInfoBoxId" class="zjsqInfoBox">
    <div class="zjsqTitle">職教書籤 v3 Beta2</div>
    <div id="zjysqInfo">
        -time-歡迎使用職教書籤~! | 官網:<a href="https://zj.miya.ink" target="_blank">https://zj.miya.ink</a>(開源)<br>
        -time-開始初始化...請勿隨意操作頁面...<br>
    </div>
</div> */
  };
 
  function getText (func) {
    var str = func.toString().split('\n')
    str = str.slice(1, str.length - 1).join('\n')
    return str.replace(/-time-/g, `[${new Date().format()}] `)
  };
 
  function makeDivDraggable (id) {
    var Drag = document.getElementById(id)
    Drag.onmousedown = function (event) {
      var ev = event || window.event
      event.stopPropagation()
      var disX = ev.clientX - Drag.offsetLeft
      var disY = ev.clientY - Drag.offsetTop
      document.onmousemove = function (event) {
        var ev = event || window.event
        Drag.style.left = ev.clientX - disX + 'px'
        Drag.style.top = ev.clientY - disY + 'px'
        Drag.style.cursor = 'move'
      }
    }
    Drag.onmouseup = function () {
      document.onmousemove = null
      this.style.cursor = 'default'
    }
  };
 
  try {
    console.log('職教書籤 v3 beta2 | 官網:https://zj.miya.ink')
    console.log('開始初始化...請勿隨意操作頁面...')
    Date.prototype.format = function () {
      var format = 'yyyy-MM-dd HH:mm:ss'
      var o = {
        'M+': this.getMonth() + 1, // month
        'd+': this.getDate(), // day
        'H+': this.getHours(), // hour
        'm+': this.getMinutes(), // minute
        's+': this.getSeconds(), // second
        'q+': Math.floor((this.getMonth() + 3) / 3), // quarter
        S: this.getMilliseconds() // millisecond
      }
 
      if (/(y+)/.test(format)) {
        format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
      };
 
      for (var k in o) {
        if (new RegExp('(' + k + ')').test(format)) {
          format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
        };
      };
      return format
    }
    $('<style></style>').text(getText(zjsqCss)).appendTo($('head'))
    $('body').append(getText(zjsqHtml))
    makeDivDraggable('zjsqInfoBoxId')
    zjsqInfoDom = $('#zjysqInfo')
    return true
  } catch (e) {
    log('初始化控制檯框架異常:' + e)
    return false
  };
};
 
function hrefParamsToArray (url) {
  return url
    .substring(url.indexOf('?') + 1)
    .split('&')
    .map((query) => query.split('='))
    .reduce((params, pairs) => (params[pairs[0]] = pairs[1] || '', params), {})
};
 
function studyProcessRequester (data) {
  function getProcessText () {
    return `[${new Date().format()}] 完成進度:(${totalCount}/${randomRequestTimes}) / 成功數:${successCount} / 失敗數:${failedCount}`
  };
 
  if (stopFlag === true) return 0
  var lessonId = `lesson${currentLessonIndex}`
  var successCount = 0
  var failedCount = 0
  var totalCount = 0
  var randomRequestTimes = Math.floor((Math.random() * 87) + 56)
  const requestData = {
    courseOpenId: data.courseOpenId,
    openClassId: data.openClassId,
    cellId: data.cellId,
    cellLogId: data.cellLogId,
    picNum: Math.round(324 / randomRequestTimes),
    studyNewlyTime: Math.round(14640 / randomRequestTimes),
    studyNewlyPicNum: Math.round(324 / randomRequestTimes),
    token: data.guIdToken
  }
  log(`第(${currentLessonIndex}/${hrefs.length})課,課件:${data.cellName},型別:[${data.categoryName}]`)
  log(`本次隨機學習時間:${(randomRequestTimes * 10 / 60).toFixed(2)}分鐘 總請求次數:${randomRequestTimes}`)
  log('現在開始上課!')
  zjsqInfoDom.append(`<div id="${lessonId}">${getProcessText()}</div>`)
  var ele = zjsqInfoDom[0]
  ele.scrollTop = ele.scrollHeight + 999
  var lessonProcessDom = $(`#${lessonId}`)
  for (let i = 0; i < randomRequestTimes; i++) {
    var defer = $.Deferred()
    $.ajax({
      async: true,
      timeout: 5000,
      type: 'post',
      url: urls2.Directory_stuProcessCellLog,
      data: requestData,
      dataType: 'json',
      success: function (responseData) {
        successCount += 1
      },
      error: function (response) {
        failedCount += 1
      },
      complete: function (response) {
        totalCount += 1
        lessonProcessDom.text(getProcessText())
        if (totalCount === randomRequestTimes) {
          totalStudyTime += randomRequestTimes * 10
          log(`當前課程(${lessonId}),已完成學習!三秒後開始下一課程...`)
          st(function () {
            return directoryDataRequester(currentLessonIndex)
          }, 4000)
        };
      }
    })
    requestData.picNum += Math.round(300 / randomRequestTimes)
    requestData.studyNewlyTime += Math.round(12640 / randomRequestTimes)
    requestData.studyNewlyPicNum += Math.round(300 / randomRequestTimes)
  };
  return defer
};
 
function directoryDataRequester (hrefIndex, changeDirectory = false, addData = false) {
  if (stopFlag === true) return 0
  var changedFlag = false
  if (hrefIndex < hrefs.length) {
    currentLessonIndex = hrefIndex + 1
    if (!addData && changeDirectory !== true) log(`正在獲取課件(${currentLessonIndex}/${hrefs.length})的請求令牌...`)
    var requestData = hrefParamsToArray(hrefs[hrefIndex])
    if (addData) {
      Object.assign(requestData, addData)
      console.log(requestData)
      delete (requestData.flag)
    };

 

相關文章