MovieChat.org Message Boards on IMDb.com [Desktop]

Brings message boards back on IMDb by using MovieChat.org boards.

От 02.05.2018. Виж последната версия.

// ==UserScript==
// @name               MovieChat.org Message Boards on IMDb.com [Desktop]
// @namespace          https://greasyfork.org/en/users/105361-randomusername404
// @version            2.04
// @description        Brings message boards back on IMDb by using MovieChat.org boards.
// @run-at             document-start
// @include            *://*.imdb.com/title/*
// @include            *://*.imdb.com/name/*
// @exclude            http://m.imdb.com/*
// @exclude            *://*.imdb.com/title/*/trivia?tab=mc&ref_=tt_trv_cnn
// @exclude            *://*.imdb.com/title/*/technical?ref_=tt_dt_spec
// @require            https://code.jquery.com/jquery-3.3.1.min.js
// @author             RandomUsername404
// @grant              none
// @icon               http://ia.media-imdb.com/images/G/01/imdb/images/favicon-2165806970._CB522736556_.ico
// ==/UserScript==

$(window).on( "load", function() {
    // Get movie ID
    var movieID = window.location.pathname;
    movieID = movieID.split("title/").pop();
    movieID = movieID.split("/").shift();

    // Get iframe position and dimensions
    var positionReference = $('.article.contribute');
    var height = $(window).innerHeight()*0.9;
    var width;
    if (window.location.pathname.includes("reference")) {
		width = $("#main").width();
    }
    else {
        width = $(".title_bar_wrapper").width();
    }

    // Create iframe
    var movieChat = document.createElement("iframe");
    $(movieChat).attr({"src":"https://moviechat.org/" + movieID,"allowtransparency":"false"});
    $(movieChat).css( {"height":height+"px","width":width+"px","border":"none","margin-top":"-20px"} );
    $(movieChat).insertBefore(positionReference);

    // Add title and separator above iframe
    var title = document.createElement("div");
    $(title).addClass('article');
    var movieTitle;
    if (window.location.pathname.includes("reference")) {
		movieTitle = $('h3[itemprop="name"]').text();
    }
    else {
        movieTitle = $('h1[itemprop="name"]').text();
    }
    $(title).html('<h2>Discuss <i>' + movieTitle + '</i> on MovieChat</h2>');
    $(title).insertBefore(movieChat);
});