
let plugins = navigator.plugins;

let plgs = {}

function getObj(r) {

    return {
        description: r.description,
        suffixes: r.suffixes,
        type: r.type,
    }

}

for (let i = 0; i < plugins.length; i++) {
    let p = plugins.item(i);
    let pi = {}
    let keys = ['0','1', 'application/pdf', 'text/pdf', 'description', 'filename', 'length', 'name'];
    for (const key of keys) {
        let r = p[key];
        if (typeof r === 'object'){
            r = getObj(r)
            r.enabledPlugin = [];
        }
        pi[key] = r
    }
    plgs[i] = pi
}

let mimes = navigator.mimeTypes
let res = [];
let r = Object.getOwnPropertyNames(mimes);
for (let i = 0; i < r.length; i++) {
    let a = mimes[r[i]];
    res.push({
        suffixes:a.suffixes,
        type: a.type,
        enabledPlugin: {
            filename: a.enabledPlugin.filename
        }
    })
}
