ModelMayham Viewer

View images on modelmayhem that are only available for active members.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         ModelMayham Viewer
// @namespace    daniel_watson
// @version      0.3
// @description  View images on modelmayhem that are only available for active members.
// @author       daniel_watson
// @match        http://www.modelmayhem.com/portfolio/pic/*
// @match        https://www.modelmayhem.com/portfolio/pic/*
// ==/UserScript==

function unlock() {
    'use strict';
    var check = document.getElementById('viewpic').getElementsByTagName("strong");
    var metas = document.querySelectorAll('[property="og:image"]');
    if (metas.length === 0 || check.length === 0){
        console.log("Nothing found");
        return 0;
    }
    var imgurl = "";
    for (var i = 0; i < metas.length; i++){
        imgurl = metas[i].content;
        break;
    }
    for (i = 0; i < check.length; i++) {
        var s = check[i];
        if (s.innerText.indexOf("Image Not Viewable By Non-Active Members") !== -1 || s.innerText.indexOf("Image Not Viewable By Non-Members") !== -1){
            var p = document.createElement("p");
            p.setAttribute("align","center");
            var b = document.createElement ('img');
            b.setAttribute('src', imgurl);
            b.setAttribute('border', '0');
            p.appendChild(b);
            var parent = s.parentNode;
            parent.parentNode.replaceChild(p,parent);
            break;
        }
    }
}

window.addEventListener("load", unlock);