fix edx

try to take over the world!

2016-10-06 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         fix edx
// @namespace    http://tampermonkey.net/
// @version      0.3
// @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];

                var currentHeight = iframe.offsetHeight;

                var heightDiff = height - currentHeight;

                if ((heightDiff > 0) || (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
    });
}