Nemotaku / TwitterShowOriginalsPicturesAndLinks

// ==UserScript==
// @name        TwitterShowOriginalsPicturesAndLinks
// @namespace   nemotaku.thalie
// @include     https://twitter.com*
// @version     1
// @require     https://code.jquery.com/jquery-3.1.1.min.js
// @grant       none
// @description Afficher les images ou les liens vers les images originales dans une page de Twitter
// @licence MIT
// ==/UserScript==
window.getImage = function(){
  var images = [
  ];
  var display_images = '';
  $('.AdaptiveMedia-photoContainer img').each(function (i, e)
  {
    var image = ($(e).attr('src')) + ':orig';
    if (images.indexOf(image) == - 1)
    {
      images.push(image);
      display_images += '<img src=\'' + image + '\'/><br/>';
    }
  });
  $('body').first().html(display_images);
}; 

window.getImageURL = function(){
  var images = [
  ];
  var display_images = '';
  $('.AdaptiveMedia-photoContainer img').each(function (i, e)
  {
    var image = ($(e).attr('src')) + ':orig';
    if (images.indexOf(image) == - 1)
    {
      images.push(image);
      display_images +=  image + "<br/>" ;
    }
  });
  $('body').first().html(display_images);
}; 


$(document).ready()
{
  $("#global-actions").append("<li class='dm-nav'>"+
                                "   <a href='# 'id='get-images' class='js-tooltip js-dynamic-tooltip'>"+
                                "       <span class='text'>Afficher les images</span>"+
                                "   </a>"+
                                "</li>");
  $("#global-actions").append("<li class='dm-nav'>"+
                              "   <a href='# 'id='get-images-url' class='js-tooltip js-dynamic-tooltip'>"+
                              "       <span class='text'>Afficher les URL</span>"+
                              "   </a>"+
                              "</li>");
  
  $("#get-images").click(function()
  {
    window.getImage();
  });
  
  $("#get-images-url").click(function()
  {
    window.getImageURL();
  });

}