Hentai Heroes image viewer

Display images of any harem girl!

Versión del día 28/04/2020. Echa un vistazo a la versión más reciente.

// ==UserScript==
// @name         Hentai Heroes image viewer
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Display images of any harem girl!
// @author       randomfapper34
// @match	 https://nutaku.haremheroes.com/*
// @match	 https://nutaku.gayharem.com/**
// @match	 https://thrix.hentaiheroes.com/*
// @match	 https://eroges.hentaiheroes.com/*
// @match        https://www.hentaiheroes.com/*
// @match        http://test.hentaiheroes.com/*
// @match        https://test.hentaiheroes.com/*
// @grant        none
// ==/UserScript==

var $ = window.jQuery;
var CurrentPage = window.location.pathname;

// css define
var sheet = (function() {
    var style = document.createElement('style');
    document.head.appendChild(style);
    return style.sheet;
})();

// current page: Harem
if (CurrentPage.indexOf('harem') != -1)
{
    var haremRight = $('#harem_right');
    haremCss();

    $( ".girls_list div[id_girl]" ).click(function() {
        var girlId = $(this).children('[girl]').attr('girl');
        var girlGrades = $(this).find('.graded').children().length;
        var girlClass = $(this).find('.icon').attr('carac');
        updateInfo(girlId, girlGrades, girlClass);
    });

    updateInfo(0, 0, 0);

    function updateInfo(girlId, girlGrades, girlClass) {
        setTimeout(function () {
            haremRight.children('[girl]').each( function() {
                if (girlId == 0) girlId = $(this).attr('girl');
                if (girlGrades == 0) girlGrades = girl.nb_grades;

                var girl = girlsDataList[girlId];

                var allImages = '';
                for (var i = 0; i <= girlGrades; i++) {
                    var selectedAvatar = $(this).find('.diamond.selected').attr('grade');
                    if (selectedAvatar === undefined) {
                        selectedAvatar = '/avb0';
                    }else{
                        selectedAvatar = '/ava' + selectedAvatar;
                    }
                    var baseLink = 'https://hh2.hh-content.com/pictures/girls/' + girlId + selectedAvatar + '.png';
                    var imgLink = 'https://hh2.hh-content.com/pictures/girls/' + girlId + '/ava' + i + '.png';
                    //var fullLink = '<a href="' + imgLink + '" target="_blank">' + i + ' </a>';
                    var fullLink = '<span link="' + imgLink + '" baseLink="' + baseLink + '">' + i + ' </span>';
                    allImages += fullLink;
                }

                //girl not yet in harem
                if(!girl.own){
                    $(this).find('.middle_part').css('margin', '0');
                    $(this).find('.dialog-box').after('<h3>' + girl.Name + '<span carac="class' + girlClass + '"></span></h3>');
                    $(this).find('h3').after('<div class="WikiLink">id: ' + girlId + ' <a href="https://harem-battle.club/wiki/Harem-Heroes/HH:' + girl.Name + '" target="_blank">(wiki page)</a></div>');
                    $(this).find('.WikiLink').append('<br/><div class="girl_images">images: ' + allImages + '</div>');
                    $(this).find('img.avatar').wrap('<div class="avatar-box"></div>');
                }

                //girl in harem
                if(girl.own){
                    $(this).find('h3').after('<div class="WikiLink">id: ' + girlId + ' <a href="https://harem-battle.club/wiki/Harem-Heroes/HH:' + girl.Name + '" target="_blank">(wiki page)</a></div>');
                    $(this).find('.WikiLink').append('<br/><div class="girl_images">images: ' + allImages + '</div>');
                    var girlOwnedImage = $(this).find('.avatar-box');
                    girlOwnedImage.css('margin-top', '0px');
                    girlOwnedImage.css('height', '390px');
                }

                $(this).find('.girl-rarity').remove();

                $( ".girl_images span" ).mouseenter(function() {
                    var mainParent = $(this).closest('.middle_part');
                    $(this).css('-webkit-text-stroke', '0.75px #FE00FE');
                    var girlAvatar = mainParent.find('img.avatar');
                    var girlAvatarLink = $(this).attr('link');
                    girlAvatar.attr('src', girlAvatarLink);
                });

                $( ".girl_images span" ).mouseleave(function() {
                    $(this).css('-webkit-text-stroke', '0px #FE00FE');
                });

                $( ".girl_images" ).mouseup(function() {
                    var mainParent = $(this).closest('.middle_part');
                    var girlAvatar = mainParent.find('img.avatar');
                    var girlAvatarLink = $(this).find('span').attr('baseLink');
                    girlAvatar.attr('src', girlAvatarLink);
                });

            });
        }, 0);
    }
}

function haremCss(){
    sheet.insertRule('#harem_right .WikiLink a {'
                     + 'color: #87CEFA;'
                     + 'text-decoration: none; }');

    sheet.insertRule('#harem_right .WikiLink a:hover {'
                     + 'color: #B14;'
                     + 'text-decoration: underline; }');

    sheet.insertRule('#harem_right .WikiLink {'
                     + 'font-size: 12px; }');

    sheet.insertRule('#harem_right .WikiLinkDialogbox a {'
                     + 'text-decoration: none;'
                     + 'color: #24a0ff !important; }');
}