Sleazy Fork is available in English.

Rule34Hentai Improved

Fixes stuff, adds like and favorite under images, highlights animated in lists, compact header

Από την 23/05/2019. Δείτε την τελευταία έκδοση.

// ==UserScript==
// @name         Rule34Hentai Improved
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  Fixes stuff, adds like and favorite under images, highlights animated in lists, compact header
// @author       Hentiedup
// @match        https://rule34hentai.net/post/*
// @require      https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    //=========Settings========//
    var autoplayVideos = true;
    var nextPrevImageWithArrowKeys = true;
    var CompactHeader = true;
    //=========================//

    addGlobalStyle(`
		a.shm-thumb-link > img {
			padding: 0;
		}
		a.tagit-close {
			display: inline;
			padding: 0;
		}
		.custom-button {
			cursor: pointer;
			width: 35px;
			padding: 3px;
			margin: 0;
			border-radius: 20px;
		}
		.custom-button:hover {
			background-color: rgba(255,255,255,.75);
		}
	`);

    if(CompactHeader)
        addGlobalStyle(`
			header {margin: 0; padding: 0;}
			header p {display: none;}
			header ul.ui-widget {
				margin: 5px;
				display: inline-block;
				vertical-align: middle;
				box-sizing: border-box;
				width: calc(100% - 100px);
			}
			header form > input[value=Search],
			header form > input[value=Search]:visited {
				vertical-align: middle;
				height: 36px;
				border-radius: 8px;
				background-color: #dec4a0;
				border-color: #725327;
				font-weight: 700;
				cursor: pointer;
			}
			header form > input[value=Search]:hover,
			header form > input[value=Search]:active {
				background-color: #dabc92;
			}
			#header h1 {font-size: 14px;}
			#header img.wp-image-67962 {
				height: 50px;
				width: auto;
			}
			#header img.wp-image-69454 {
				display: none;
			}
			#header td > center > ul {margin: 2px 0 0 0;}
		`);

    setTimeout(function(){
        if(nextPrevImageWithArrowKeys) {
            var currentImage = window.location.href;
            if(currentImage.includes("/post/view/"))
                currentImage = parseInt(currentImage.split("/post/view/")[1], 10);
            else
                currentImage = null;
        }

        if(autoplayVideos) {
            $("#video-id_fluid_state_button").click();
            $("body").click(); //remove focus from player
        }

        $("a.shm-thumb-link > img[title*='// webm'], a.shm-thumb-link > img[title*='// mp4'], a.shm-thumb-link > img[title*='// gif']").attr("style", "border: solid 2px #fb2ccc !important; box-shadow: 0 0 5px 1px red;");

        $(".image_info").parent().parent().prepend('<img id="like-butt" class="custom-button" src="https://i.imgur.com/Kh1HzGr.png" alt="like"><img id="favorite-butt" class="custom-button" src="https://i.imgur.com/dTpBrIj.png" alt="favorite">');
        $("#like-butt").click(function() {
            $("#Image_Scoreleft form input[value='Vote Up']").click();
        });
        $("#favorite-butt").click(function() {
            $("#Image_Controlsleft form input[value='Favorite']").click();
        });

        if(nextPrevImageWithArrowKeys && currentImage) {
            $("body").keyup(function(event){
                console.log("keypress");
                if(event.which == 39) {
                    ChangeImage(currentImage);
                }
                else if(event.which == 37) {
                    ChangeImage(currentImage, false);
                }
            });
        }

    }, 200);

    function addGlobalStyle(css) {
        var head, style;
        head = document.getElementsByTagName('head')[0];
        if (!head) { return; }
        style = document.createElement('style');
        style.type = 'text/css';
        style.innerHTML = css;
        head.appendChild(style);
    }
    function ChangeImage(currentImg, next = true) {
        window.open("https://rule34hentai.net/post/view/" + (currentImg+(next ? 1 : -1)) + "","_self");
    }
})();