JAV Library Sukebei Link

A a link to search on Sukebei from a JAV Library video.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         JAV Library Sukebei Link
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  A a link to search on Sukebei from a JAV Library video.
// @author       ReaperUnreal
// @match        https://*.javlibrary.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=javlibrary.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const movieId = document.title.split(' ')[0];
    if (movieId.match(/\w{2,7}-\d{2,5}/).length < 1) {
        console.warn(`Movie '${movieId}' is not in appropriate format.`);
        return;
    }

    const searchUrl = `https://sukebei.nyaa.si/?f=0&c=0_0&q=${movieId.toLocaleLowerCase()}`;

    const videoInfoSection = document.getElementById('video_info');

    const linkSection = document.createElement('div');
    videoInfoSection.appendChild(linkSection);

    const link = document.createElement('a');
    linkSection.appendChild(link);

    link.href = searchUrl;
    link.innerText = 'Sukebei Link';
    link.style.paddingLeft = '2em';
    link.style.paddingTop = '1em';
})();