您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
- // ==UserScript==
- // @name fix edx
- // @namespace http://tampermonkey.net/
- // @version 0.2
- // @description try to take over the world!
- // @author You
- // @match https://courses.edx.org/*
- // @match https://inginious-lti.info.ucl.ac.be/*
- // @grant none
- // ==/UserScript==
- if (window.top === window.self) {
- window.onmessage = function(e){
- if (e.data.startsWith("height: ")) {
- var height = e.data.substring("height: ".length);
- console.log("READ height: " + height);
- if (height > 0) {
- var iframe = document.getElementsByTagName('iframe')[0];
- console.log("scroll height: " + iframe.scrollHeight);
- var currentHeight = iframe.offsetHeight;
- var heightDiff = Math.abs(height - currentHeight);
- if ((heightDiff > 2) || (currentHeight == 800)){
- iframe.style.height = height + "px";
- }
- }
- }
- };
- } else {
- MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
- var observer = new MutationObserver(function(mutations, observer) {
- var height = document.body.offsetHeight;
- console.log("WRITE height: " + height);
- window.parent.postMessage("height: " + height , "https://courses.edx.org/");
- });
- observer.observe(document, {
- subtree: true,
- childList: true
- });
- }