InoReader - Twitter/IG Widgets

Turn twitter and instragram blockquotes in posts into widgets.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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         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");
    }    
  }

})();