ModelMayham Viewer

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

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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);