Rule34 Preview Videos

Rule34 Video Preview

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name        Rule34 Preview Videos
// @namespace   VideoPreview
// @match     https://rule34.xxx/*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @version     0.2
// @author      Zeus
// @license     MIT
// @description Rule34 Video Preview
// ==/UserScript==

var cdn = "https://api-cdn-us-mp4.rule34.xxx/"

/*           *CDN Location*
If you have problems with loading videos you can try other servers here

Chicago, IL, USA:    https://uswebm.rule34.xxx/
New York, NY, USA:   https://nymp4.rule34.xxx/
Phoenix, AZ, USA:    https://ahrimp4.rule34.xxx/
Netherlands:         https://ws-cdn-video.rule34.xxx/
Netherlands:         https://wwebm.rule34.xxx/
Default:             https://api-cdn-us-mp4.rule34.xxx/
*/

jQuery(document).ready(function ($) {
    $(".image-list .thumb").each(function () {
        var container = $(this);
        var link = container.find('img').attr('src');
        var img = container.find('img')
        var classlink = container.find('img').attr('class')
        if (link && classlink == 'preview webm-thumb') {
            var first = false;
            var videoCreated = "";
            var TimeOut;
            container.on("mouseenter", function () {
                TimeOut = setTimeout(function () {
                    if (first == false) {
                        var videoUrl = cdn+"/images/"+link;
                        var videoUrlCleaned = videoUrl.replace("https://wimg.rule34.xxx/thumbnails/", "").replace("thumbnail_", "").replace("jpg", "mp4");
                        videoCreated = $('<video muted autoplay controls style="max-width:100%; height:auto;" poster = "'+link+'" preload="metadata"><source src="' + videoUrlCleaned + '" type="video/mp4"></video>');
                        container.append(videoCreated);
                        videoCreated.css("position", "relative"); videoCreated.css("opacity", 0); videoCreated.css("width", 0);
                        first = true;
                    }
                    img.css("opacity", 0);
                    videoCreated.css("opacity", 1); videoCreated.css("width", "auto"); videoCreated.get(0).play();
                }, 500);
            });
            container.on("mouseleave", function () {
                clearTimeout(TimeOut);
                img.css("opacity", 1)
                videoCreated.css("opacity", 0); videoCreated.css("width", 0); videoCreated.get(0).stop();
            });
        }
    });
});

//THANKS FOR SUPPORT: SepiaMoon