InoReader - Twitter/IG Widgets

Turn twitter and instragram blockquotes in posts into widgets.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         InoReader - Twitter/IG Widgets
// @version      1.0.2
// @description  Turn twitter and instragram blockquotes in posts into widgets.
// @grant        unsafeWindow
// @include      http*://*.inoreader.com/*
// @require      https://greasyfork.org/scripts/31694-ondom/code/OnDom.js
// @namespace    https://greasyfork.org/users/316912
// ==/UserScript==

(function(){

  'use strict';
  
  onDom('.article_content', replaceTwitter);

  function replaceTwitter(element) {

    let $ = unsafeWindow.jQuery;
    let $this = $(element);
    
    let tweets = $this.find('blockquote a[href*="twitter.com"]').closest("blockquote");
    
    if( tweets.length !== 0 ) {
      tweets.addClass("twitter-tweet");
      $.getScript("https://platform.twitter.com/widgets.js");
    }
    
    let grams = $this.find('blockquote a[href*="instagram.com"]').closest("blockquote");
    
    if( grams.length !== 0 ) {
      grams.addClass("instagram-media");
      $.getScript("https://www.instagram.com/embed.js");
    }    
  }

})();