Greasy Fork

Cinematik Enhancer

Display changes for Cinematik

目前为 2015-09-16 提交的版本。查看 最新版本

// ==UserScript==
// @name           Cinematik Enhancer
// @namespace      surrealmoviez.info
// @description    Display changes for Cinematik
// @include        https://cinematik.net/details.php?id=*
// @include        https://cinematik.net/upload.php
// @include        https://cinematik.net/upload2.php
// @require        http://code.jquery.com/jquery-1.11.1.min.js
// @version        0.0.4
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);

$(document).ready(function () {
    // Torrent details page
    if (document.documentURI.indexOf("details.php?id=") !== -1) {
        // List the IMDb ID(s) found in the description as a linked list in a dedicated row
        var imdbInfoRow = $('.outer .rowhead:contains("IMDB info")').parent();
        var description = $('.outer .heading:contains("Description")').next('td').html();
        var pattern = /(tt\d+)/gi;
        var found = description.match(pattern);
        var imdbIdRowContent = 'Nothing found in the description';
        var s = '';

        if (found.length > 0) {
            var uniqueIds = [];
            $.each(found, function (i, el) {
                if ($.inArray(el, uniqueIds) === -1)
                    uniqueIds.push(el);
            });
            if (uniqueIds.length > 1) {
                s = 's';
            }
            var imdbIdRowContent = "";
            for (var i = 0; i < uniqueIds.length; i++) {
                imdbIdRowContent += '<a href="http://anonym.to/?http://www.imdb.com/title/' + uniqueIds[i] + '/" target="_blank">' + uniqueIds[i] + '</a> ';
            }
        }

        var imdbIdRow = '<tr><td valign="top" align="right" class="heading">IMDb ID' + s + '</td><td valign="top" align="left">' + imdbIdRowContent + '</td></tr>';
        $(imdbIdRow).insertBefore(imdbInfoRow);
    }

    // Pre-upload page
    if (document.documentURI.indexOf("cinematik.net/upload.php") !== -1) {
        var expressSubmit = '<center><input id="express-checkbox" type="checkbox" value="99" name=""><label style="font-size:1.1em" for="express-checkbox">I know the rules. The part about <b>me getting banned</b> if I don\'t, too.</label><br><input type="submit" value="I have read the rules"><center>';
        $(expressSubmit).prependTo('td.outer > form');
        $('#express-checkbox').click(function () {
            $('form > div > div > input').prop('checked', $(this).prop('checked'));
        });
    }
});