liyongquan / fix iframe height

// ==UserScript==
// @name         fix iframe height
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  try to take over the world!
// @author       liyongquan
// @match        https://bpm.sankuai.com/taskform/*/show*
// @icon         https://www.google.com/s2/favicons?domain=cnplugins.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    window.addEventListener('load', function(){
        var iframe = document.querySelector('iframe')
        var config = {
            attributes: true
        };
        const mutationCallback = (mutationsList) => {
            for(let mutation of mutationsList) {
                if (mutation.type === 'attributes' && mutation.attributeName === 'style') {
                    console.log(333, iframe.style.height);
                    if (iframe.style.height === '0px') {
                        iframe.style.height = '1800px'
                    }
                }
            }
        };
        var observe = new MutationObserver(mutationCallback);
        observe.observe(iframe, config);// 后面介绍config的配置


        console.log(111, iframe.style.height)
        iframe.style.height=0
        console.log(222, iframe.style.height)
    })


})();