Greasy Fork is available in English.

Stack Overflow: StackPrinter

Add Printer-Friendly button to question. This script is forked from http://userscripts-mirror.org/scripts/show/77298 and it add supports for HTTPs

01.02.2017 itibariyledir. En son verisyonu görün.

  1. // ==UserScript==
  2. // @name Stack Overflow: StackPrinter
  3. // @namespace http://userscripts.org/users/gangsta75
  4. // @description Add Printer-Friendly button to question. This script is forked from http://userscripts-mirror.org/scripts/show/77298 and it add supports for HTTPs
  5. // @include http*://stackoverflow.com/questions/*
  6. // @include http*://serverfault.com/questions/*
  7. // @include http*://superuser.com/questions/*
  8. // @include http*://stackapps.com/questions/*
  9. // @include http*://meta.stackoverflow.com/questions/*
  10. // @include http*://*.stackexchange.com/questions/*
  11. // @include http*://askubuntu.com/questions/*
  12. // @include http*://answers.onstartups.com/questions/*
  13. // @include http*://meta.mathoverflow.net/questions/*
  14. // @include http*://mathoverflow.net/questions/*
  15. // @version 3.0
  16. // @grant none
  17. // ==/UserScript==
  18.  
  19. function ScriptContent () {
  20. var re = new RegExp('^http[s]*://(.*?).(com|net|org)');
  21. var group = re.exec(window.location.href);
  22. var service = group[1];
  23. var question = $('.vote').find('input[type=hidden]:first').val();
  24. var url = 'http://www.stackprinter.com/export?format=HTML&service=' + service + '&question=' + question;
  25.  
  26. function openUrl() {
  27. if(!window.open(url)) {
  28. location.href=url;
  29. }
  30. }
  31.  
  32. var printDiv = document.createElement('div');
  33. printDiv.id = 'PrinterFriendly';
  34. printDiv.style.marginTop = '8px';
  35.  
  36. var linkAnchor = document.createElement('a');
  37. linkAnchor.title = 'Printer-Friendly';
  38. linkAnchor.addEventListener('click', openUrl, false);
  39.  
  40. var image = document.createElement('img');
  41. image.style.width = '33px';
  42. image.style.height = '33px';
  43. image.src = 'http://www.stackprinter.com/images/printer.gif';
  44.  
  45. linkAnchor.appendChild(image);
  46. printDiv.appendChild(linkAnchor);
  47.  
  48. var elementQuestion = document.getElementById('question');
  49. var elementVote = document.getElementsByClassName('vote')[0];
  50. elementVote.appendChild(printDiv);
  51. }
  52.  
  53. function AddScript() {
  54. var script = document.createElement('script');
  55. script.type = 'text/javascript';
  56. script.text = ScriptContent.toString() + 'ScriptContent();';
  57. document.body.appendChild(script);
  58. }
  59.  
  60. AddScript();