imgur output formatter

Adds fully formatted output containers

当前为 2015-09-15 提交的版本,查看 最新版本

  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.0
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. function extractUrls() {
  14. var imgUrls = [];
  15. $('.post-images .post-image-share-links').each(function (i, v) {
  16. imgUrls.push($(v).find('.clipboard-wrapper:eq(0) > .share-link').attr('value'));
  17. });
  18. return imgUrls;
  19. }
  20.  
  21. $(document).ready(function () {
  22. var imgUrls = extractUrls();
  23. var decoratedLinks = '<center><img src="' + imgUrls.join('">\n\n<img src="') + '"></center>';
  24. var plainLinks = imgUrls.join("\n");
  25.  
  26. var preformattedLinksPanel = '<div class="new-panel post-options-panel">'
  27. + '<h2 class="new-panel-header">Preformatted Links</h2>'
  28. + '<div class="post-options">'
  29. + '<textarea id="preformatted-links-decorated" style="height: 100px; width: 100%;" onclick="this.select();" title="Click to select">' + decoratedLinks + '</textarea>'
  30. + '<textarea id="preformatted-links-plain" style="height: 100px; width: 100%;" onclick="this.select();" title="Click to select">' + plainLinks + '</textarea>'
  31. + '</div></div>';
  32.  
  33. $('#right-content').prepend(preformattedLinksPanel);
  34. });