imgur output formatter

Adds fully formatted output containers

  1. // ==UserScript==
  2. // @name imgur output formatter
  3. // @namespace surrealmoviez.info
  4. // @description Adds fully formatted output containers
  5. // @include http://imgur.com/*
  6. // @include http://www.imgur.com/*
  7. // @include https://imgur.com/*
  8. // @include https://www.imgur.com/*
  9. // @version 1.0.1
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. function extractUrls() {
  14. var imgUrls = [];
  15. $('head > meta[property="og:image"]').each(function (i, v) {
  16. link = $(v).attr('content');
  17. if (!link.endsWith('?fb')) {
  18. imgUrls.push(link);
  19. }
  20. });
  21. return imgUrls;
  22. }
  23.  
  24. $(document).ready(function () {
  25. var imgUrls = extractUrls();
  26. var decoratedLinks = '<center><img src="' + imgUrls.join('">\n\n<img src="') + '"></center>';
  27. var plainLinks = imgUrls.join("\n");
  28.  
  29. var preformattedLinksPanel = '<div class="new-panel post-options-panel">'
  30. + '<h2 class="new-panel-header">Preformatted Links</h2>'
  31. + '<div class="post-options">'
  32. + '<textarea id="preformatted-links-decorated" style="height: 100px; width: 100%;" onclick="this.select();" title="Click to select">' + decoratedLinks + '</textarea>'
  33. + '<textarea id="preformatted-links-plain" style="height: 100px; width: 100%;" onclick="this.select();" title="Click to select">' + plainLinks + '</textarea>'
  34. + '</div></div>';
  35.  
  36. $('#right-content').prepend(preformattedLinksPanel);
  37. });