您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add "Show answers" button to LearningApps crossword
- // ==UserScript==
- // @name LearningApps Show Crossword Answers
- // @version 0.1
- // @description Add "Show answers" button to LearningApps crossword
- // @author stennen
- // @match *://learningapps.org/display?v=*
- // @grant none
- // @namespace http://tampermonkey.net/
- // @icon https://www.google.com/s2/favicons?sz=64&domain=learningapps.org
- // @license MIT
- // ==/UserScript==
- (function() {
- setTimeout(() => {
- function handler2() {
- let appcnt = document.body.getElementsByTagName("iframe")[0].contentWindow.document.getElementsByTagName("iframe")[0].contentWindow;
- if (!appcnt.eval('AppClient')) {
- return;
- }
- if (!appcnt.document.body.innerHTML.includes('<script type="text/javascript" src="crossword.js"></script>')) {
- return;
- }
- let dc = document.getElementById("content_container");
- let cntr = document.createElement("center");
- let el = document.createElement("button");
- el.setAttribute("id", "showAnswersBtn");
- el.innerText='Show Answers';
- el.style.fontFamily='Arial';
- el.style.fontSize='30px';
- el.style.textAlign='center';
- cntr.appendChild(el);
- dc.appendChild(cntr);
- el = document.getElementById("showAnswersBtn");
- el.onclick = () => {
- let appClient = document.body.getElementsByTagName("iframe")[0].contentWindow.document.getElementsByTagName("iframe")[0].contentWindow.eval('AppClient');
- let answers='';
- for (let i=0;i<50;i++) {
- let answr = appClient.getParameter("word" + i);
- if (answr) {
- answers+='<h3>Word ' + i + ': ' + answr + '</h3>';
- }
- }
- let wnd = window.open("about:blank");
- wnd.document.body.innerHTML = '<style>h1,h2,h3,h4,h5,h6{font-family:Arial}</style><center><h1>Answers</h1><hr>' + answers + '<hr><p>made by stennen</p></center>'
- };
- }
- if (document.getElementById("showAnswersBtn")) {
- return;
- }
- if (!document.body.getElementsByTagName("iframe")) {
- return;
- }
- if (!document.body.getElementsByTagName("iframe")[0].contentWindow.document.getElementsByTagName("iframe")) {
- return;
- }
- handler2();
- }, 1500);
- /* made by Stennen */
- })();