1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
|
(function() { 'use strict'; if (window.top !== window.self) { return; }
const classData = [ { chapter: "1.1", title: "国防的内涵", id: "1018955373" }, { chapter: "1.2", title: "国防的职能与使命【上】", id: "1018955374" }, { chapter: "1.3", title: "国防的职能与使命【中】", id: "1018955375" }, { chapter: "1.4", title: "国防的职能与使命【下】", id: "1018955376" }, { chapter: "1.5", title: "国防的扩张类型", id: "1018955377" }, { chapter: "1.6", title: "国防的自卫防御类型【上】", id: "1018955378" }, { chapter: "1.7", title: "国防的自卫防御类型【下】", id: "1018955379" }, { chapter: "1.8", title: "国防的联盟类型【上】", id: "1018955380" }, { chapter: "1.9", title: "国防的联盟类型【下】", id: "1018955381" }, { chapter: "1.10", title: "国防的中立类型", id: "1018955382" }, { chapter: "1.11", title: "中国古代国防兵制建设", id: "1018955383" }, { chapter: "1.12", title: "中国古代国防工程建设", id: "1018955384" }, { chapter: "1.13", title: "中国近现代国防历程【上】", id: "1018955385" }, { chapter: "1.14", title: "中国近现代国防历程【下】", id: "1018955386" }, { chapter: "1.15", title: "牢记中国国防耻辱【上】", id: "1018955387" }, { chapter: "1.16", title: "牢记中国国防耻辱【下】", id: "1018955388" }, { chapter: "1.17", title: "中国国防历史的主要启示【上】", id: "1018955389" }, { chapter: "1.18", title: "中国国防历史的主要启示【下】", id: "1018955391" }, { chapter: "1.19", title: "现代国防观", id: "1018955392" }, { chapter: "1.20", title: "现代国防存在多种斗争形式", id: "1018955393" }, { chapter: "1.21", title: "现代国防走质量建军是国家综合国力的体现", id: "1018955394" }, { chapter: "1.22", title: "现代国防是国家行为具有威慑作用", id: "1018955396" }, { chapter: "2.1", title: "国防法规与体系", id: "1018955395" }, { chapter: "2.2", title: "公民的国防义务与权利", id: "1018955398" }, { chapter: "3.1", title: "国防体制", id: "1018955399" }, { chapter: "3.2", title: "我国的国防建设目标和战略任务", id: "1018955400" }, { chapter: "3.3", title: "国防(军事)战略【上】", id: "1018955401" }, { chapter: "3.4", title: "国防(军事)战略【中】", id: "1018955402" }, { chapter: "3.5", title: "国防(军事)战略【下】", id: "1018955403" }, { chapter: "3.6", title: "中国的国防政策", id: "1018955404" }, { chapter: "3.7", title: "新中国国防建设成就【上】", id: "1018955405" }, { chapter: "3.8", title: "新中国国防建设成就【中】", id: "1018955406" }, { chapter: "3.9", title: "新中国国防建设成就【下】", id: "1018955408" }, { chapter: "3.10", title: "我国国防工业和国防科技所取得的成就", id: "1018955409" }, { chapter: "3.11", title: "军民融合", id: "1018955410" }, { chapter: "4.1", title: "中国武装力量的性质、宗旨与使命", id: "1018955411" }, { chapter: "4.2", title: "中国武装力量构成", id: "1018955412" }, { chapter: "4.3", title: "中国人民解放军军兵种", id: "1018955413" }, { chapter: "4.4", title: "中国人民解放军预备役、武警部队与中国民兵", id: "1018955414" }, { chapter: "4.5", title: "人民军队的发展历程:土地革命战争", id: "1018955415" }, { chapter: "4.6", title: "人民军队的发展历程:抗日战争", id: "1018955535" }, { chapter: "4.7", title: "人民军队的发展历程:解放战争", id: "1018955536" }, { chapter: "4.8", title: "人民军队的发展历程:社会主义革命与建设", id: "1018955537" }, { chapter: "4.9", title: "服从大局支援国家经济建设", id: "1018955538" }, { chapter: "5.1", title: "国防动员内涵与地位作用", id: "1018955416" }, { chapter: "5.2", title: "国防动员主要内容与意义", id: "1018955417" }, { chapter: "6.1", title: "国家安全的内涵", id: "1018955418" }, { chapter: "6.2", title: "国家安全的原则", id: "1018955419" }, { chapter: "6.3", title: "总体国家安全观", id: "1018955420" }, { chapter: "7.1", title: "中国地缘环境基本概况【上】", id: "1018955422" }, { chapter: "7.2", title: "中国地缘环境基本概况【下】", id: "1018955423" }, { chapter: "7.3", title: "中国地缘安全坚持统一遏制“台独”", id: "1018955424" }, { chapter: "7.4", title: "中国地缘安全东北亚方向", id: "1018955425" }, { chapter: "7.5", title: "中国地缘安全俄罗斯、蒙古方向", id: "1018955427" }, { chapter: "7.6", title: "中国地缘安全中亚方向", id: "1018955428" }, { chapter: "7.7", title: "中国地缘安全南亚方向", id: "1018955429" }, { chapter: "7.8", title: "中国地缘安全南海方向", id: "1018955431" }, { chapter: "7.9", title: "新形势下的国家安全【上】", id: "1018955432" }, { chapter: "7.10", title: "新形势下的国家安全【下】", id: "1018955433" }, { chapter: "7.11", title: "新兴领域的国家安全", id: "1018955434" }, { chapter: "8.1", title: "国际战略形势现状与战略格局的内涵", id: "1018955435" }, { chapter: "8.2", title: "国际战略格局形势特点", id: "1018955436" }, { chapter: "8.3", title: "国际战略格局历史演变(上)", id: "1018955437" }, { chapter: "8.4", title: "国际战略格局历史演变(下)", id: "1018955438" }, { chapter: "8.5", title: "国际战略形势发展趋势【上】", id: "1018955439" }, { chapter: "8.6", title: "国际战略形势发展趋势【中】", id: "1018955440" }, { chapter: "8.7", title: "国际战略形势发展趋势【下】", id: "1018955441" }, { chapter: "8.8", title: "当前国际战略格局中的大国关系", id: "1018955444" }, { chapter: "8.9", title: "世界主要国家军事力量及战略动向", id: "1018955445" }, { chapter: "9.1", title: "军事思想的内涵与特征", id: "1018955446" }, { chapter: "9.2", title: "军事思想的发展历程及地位作用", id: "1018955447" }, { chapter: "10.1", title: "外国军事思想的主要内容与特点", id: "1018955448" }, { chapter: "10.2", title: "外国军事思想代表性理论及著作简介", id: "1018955449" }, { chapter: "11.1", title: "中国古代军事思想的主要内容", id: "1018955450" }, { chapter: "11.2", title: "中国古代军事思想的特色及其影响", id: "1018955451" }, { chapter: "11.3", title: "中国古代军事思想代表著作《孙子兵法》简介", id: "1018955452" }, { chapter: "11.4", title: "《孙子兵法》内容", id: "1018955453" }, { chapter: "11.5", title: "《孙子兵法》影响", id: "1018955455" }, { chapter: "12.1", title: "毛泽东军事思想的科学含义(上)", id: "1018955456" }, { chapter: "12.2", title: "毛泽东军事思想的科学含义(下)", id: "1018955457" }, { chapter: "12.3", title: "毛泽东军事思想的形成与发展(上)", id: "1018955458" }, { chapter: "12.4", title: "毛泽东军事思想的形成与发展(下)", id: "1018955459" }, { chapter: "12.5", title: "战争观和方法论(上)", id: "1018955460" }, { chapter: "12.6", title: "战争观和方法论(下)", id: "1018955461" }, { chapter: "12.7", title: "人民军队建设思想", id: "1018955462" }, { chapter: "12.8", title: "人民战争思想(上)", id: "1018955463" }, { chapter: "12.9", title: "人民战争思想(下)", id: "1018955464" }, { chapter: "12.10", title: "人民战争的战略战术思想(上)", id: "1018955465" }, { chapter: "12.11", title: "人民战争的战略战术思想(下)", id: "1018955467" }, { chapter: "12.12", title: "国防建设思想", id: "1018955468" }, { chapter: "12.13", title: "毛泽东军事思想的历史地位与现实意义", id: "1018955469" }, { chapter: "12.14", title: "邓小平新时期军队建设思想的形成", id: "1018955470" }, { chapter: "12.15", title: "邓小平新时期军队建设思想的主要内容(上)", id: "1018955471" }, { chapter: "12.16", title: "邓小平新时期军队建设思想的主要内容(下)", id: "1018955473" }, { chapter: "12.17", title: "邓小平新时期军队建设思想的历史地位和实践意义", id: "1018955474" }, { chapter: "12.18", title: "江泽民国防和军队建设思想的科学含义", id: "1018955475" }, { chapter: "12.19", title: "江泽民国防和军队建设思想产生的时代背景", id: "1018955476" }, { chapter: "12.20", title: "江泽民国防和军队建设思想的主要内容", id: "1018955477" }, { chapter: "12.21", title: "江泽民国防和军队建设思想的地位与作用", id: "1018955478" }, { chapter: "12.22", title: "胡锦涛关于国防和军队建设重要论述(上)", id: "1018955479" }, { chapter: "12.23", title: "胡锦涛关于国防和军队建设重要论述(下)", id: "1018955480" }, { chapter: "12.24", title: "胡锦涛关于国防和军队建设重要论述的地位与作用", id: "1018955482" }, { chapter: "12.25", title: "习近平强军思想的核心内容", id: "1018955483" }, { chapter: "12.26", title: "习近平强军思想在国防和军队建设中的指导地位与作用", id: "1018955539" }, { chapter: "13.1", title: "战争的内涵与特点", id: "1018955485" }, { chapter: "13.2", title: "战争的发展历程", id: "1018955486" }, { chapter: "14.1", title: "新军事革命的内涵及特点", id: "1018955488" }, { chapter: "14.2", title: "新军事革命的发展演变", id: "1018955489" }, { chapter: "14.3", title: "新军事变革的主要内容", id: "1018955491" }, { chapter: "14.4", title: "中国特色新军事革命", id: "1018955542" }, { chapter: "15.1", title: "机械化战争的基本内涵、形态与特征", id: "1018955493" }, { chapter: "15.2", title: "机械化战争的代表性战例", id: "1018955495" }, { chapter: "16.1", title: "信息化战争的基本内涵", id: "1018955497" }, { chapter: "16.2", title: "信息化战争的演变及主要形态", id: "1018955499" }, { chapter: "16.3", title: "信息化战争的主要特征", id: "1018955501" }, { chapter: "16.4", title: "信息化战争形态发展趋势", id: "1018955504" }, { chapter: "16.5", title: "信息化时代我国未来面临的战争威胁", id: "1018955506" }, { chapter: "16.6", title: "信息化战争对国防建设的新要求", id: "1018955508" }, { chapter: "16.7", title: "信息化战代表性战例", id: "1018955510" }, { chapter: "17.1", title: "信息化装备的内涵与分类", id: "1018955512" }, { chapter: "17.2", title: "信息化装备对现代作战的影响以及发展趋势", id: "1018955513" }, { chapter: "18.1", title: "地面信息化作战平台", id: "1018955514" }, { chapter: "18.2", title: "水面(下)信息化作战平台", id: "1018955515" }, { chapter: "18.3", title: "空中信息化作战平台", id: "1018955516" }, { chapter: "18.4", title: "信息化作战平台的发展趋势", id: "1018955517" }, { chapter: "18.5", title: "信息化武器装备的应用战例探析", id: "1018955518" }, { chapter: "19.1", title: "指挥控制系统", id: "1018955519" }, { chapter: "19.2", title: "预警探测系统", id: "1018955520" }, { chapter: "19.3", title: "导航系统", id: "1018955521" }, { chapter: "19.4", title: "电子对抗技术", id: "1018955522" }, { chapter: "19.5", title: "综合电子信息系统的发展趋势", id: "1018955523" }, { chapter: "19.6", title: "综合电子信息系统在战场应用战例简介", id: "1018955524" }, { chapter: "20.1", title: "新概念武器的定义与特征", id: "1018955525" }, { chapter: "20.2", title: "定向能武器", id: "1018955526" }, { chapter: "20.3", title: "基因武器", id: "1018955527" }, { chapter: "20.4", title: "纳米武器", id: "1018955528" }, { chapter: "20.5", title: "新概念武器对未来作战的影响", id: "1018955529" }, { chapter: "20.6", title: "精确制导技术", id: "1018955530" }, { chapter: "20.7", title: "核武器的产生和发展趋势", id: "1018955531" }, { chapter: "20.8", title: "化学武器产生与发展趋势", id: "1018955532" }, { chapter: "20.9", title: "生物武器产生与发展趋势", id: "1018955533" }, { chapter: "20.10", title: "广岛长崎投原子弹", id: "1018955534" }, { chapter: "21.1", title: "阅读", id: "1018955540" }, ]; let scriptRunning = false; let observer = null; let videoPlayer = null; let pauseAction = null; GM_registerMenuCommand("启动脚本", () => { console.log("用户点击启动按钮!获取视频标题..."); const videoTitleDiv = document.querySelector("div.prev_title"); if (!videoTitleDiv) { alert("无法获取到当前视频的标题!"); return; } const videoTitle = videoTitleDiv.getAttribute("title"); if (!videoTitle) { alert("脚本可能获取到了错误的视频标题,请检查!"); return; } console.log("通过视频标题获取id..."); const currentClass = classData.find(item => item.title === videoTitle); if (currentClass) { scriptRunning = true; playVideo(currentClass.id); observer = new MutationObserver(() => { const newTitleDiv = document.querySelector("div.prev_title"); if (newTitleDiv && newTitleDiv.getAttribute("title") !== videoTitle) { const newClass = classData.find(item => item.title === newTitleDiv.getAttribute("title")); if (newClass) { console.log("已切换到下一个视频!脚本将继续执行..."); setTimeout(() => {playVideo(newClass.id);}, 3000); } } }); observer.observe(document.body, { childList: true, subtree: true }); return; } else { alert("无法根据标题获取当前视频id!"); return; } }); GM_registerMenuCommand("停止脚本", () => { console.log("用户已停止脚本"); scriptRunning = false; if (videoPlayer) { videoPlayer.pause = pauseAction; } if (observer) { observer.disconnect(); observer = null; } }); function waitForVideoFrames(callback) { const timer = setInterval(() => { const videoBigFrame = document.querySelector("#iframe"); if (!videoBigFrame) return; let videoBigFrameDocument; try { videoBigFrameDocument = videoBigFrame.contentDocument || videoBigFrame.contentWindow.document; } catch (e) { return; } if (!videoBigFrameDocument) return; const videoFrame = videoBigFrameDocument.querySelector("iframe.ans-attach-online.ans-insertvideo-online"); if (!videoFrame) return; let videoFrameDocument; try { videoFrameDocument = videoFrame.contentDocument || videoFrame.contentWindow.document; } catch (e) { return; } if (!videoFrameDocument) return; let videoPlayer; try { videoPlayer = videoFrame.contentWindow.videojs("video_html5_api"); } catch (e) { return; } if (!videoPlayer) return; clearInterval(timer); callback(videoFrame, videoFrameDocument); }, 500); } function playVideo(id) { if (!scriptRunning) {return;} console.log("播放视频的函数已执行!当前id为" + id + ",开始获取视频播放器的信息..."); waitForVideoFrames((videoFrame, videoFrameDocument) => { videoPlayer = videoFrame.contentWindow.videojs("video_html5_api"); pauseAction = videoPlayer.pause.bind(videoPlayer); console.log("尝试点击播放按钮..."); const videoPlayButton = videoFrameDocument.querySelector('.vjs-big-play-button'); if (videoPlayButton) { videoPlayButton.click(); } else { alert("找不到播放按钮!"); return; } videoPlayer.pause = () => {}; console.log("尝试获取视频时长..."); const passedSpan = videoFrameDocument.querySelector(".vjs-current-time-display"); let passedDuration = 0; if (passedSpan) { passedDuration = passedSpan.textContent.trim(); } else { alert("无法获取当前视频播放进度!"); return; } console.log("当前播放进度:" + passedDuration); let duration = 0; setTimeout(() => { console.log("尝试获取视频时长..."); const durationSpan = videoFrameDocument.querySelector(".vjs-duration-display"); if (durationSpan) { duration = durationSpan.textContent.trim(); } else { alert("无法获取视频总时长!"); return; } console.log("当前视频时长:" + duration); let durationMs = timeStringToMs(duration) - timeStringToMs(passedDuration); console.log("将于" + durationMs + "ms后跳转下一节..."); setTimeout(() => { if (!scriptRunning) {return;} console.log("视频播放结束,获取下一个id并重新开始函数..."); const currentIndex = classData.findIndex(item => item.id === id); if (currentIndex === -1) { alert("传入的id不正确!"); return; } if (currentIndex < classData.length - 1) { getTeacherAjax('254540282','125640414',classData[currentIndex + 1].id); return; } else { scriptRunning = false; if (videoPlayer) { videoPlayer.pause = pauseAction; } if (observer) { observer.disconnect(); observer = null; } alert("恭喜结束刷课!"); return; } }, durationMs); }, 3000); });
} function timeStringToMs(duration) { const parts = duration.split(':'); if (parts.length !== 2) { alert("无法将传入的时长换算成毫秒!传入内容:" + duration); return; } const minutes = parseInt(parts[0], 10); const seconds = parseInt(parts[1], 10); return (minutes * 60 + seconds) * 1000; } })();
|