3

I have previously installed and been working with the "StackPrinter" Greasemonkey script -- which displays a button on each Stack Exchange question to print that question with StackPrinter.

Now, that button no longer shows up. I believe this is caused by the failure of userscripts.org.

Any workarounds to get the button working again?

There is also a javascript bookmarklet on the StackPrinter page. It allows you to create a bookmark which functions similarly to the Printer button. By the way, the javascript bookmarklet needs to be tweaked by changing http to https to make it work on current Stack Exchange pages, which have been recently updated to redirect to https.

Update 2014/09/29:

I have been using the bookmarklet, which continues to work, but I've gotten the Greasemonkey script to work again, by including both http and https URLs and removing references to the broken userscripts.org. For the sake of posterity, here is the Greasemonkey script stackprinter.user.js:

// ==UserScript==
// @name           StackPrinter
// @description    Add Printer-Friendly button to question

// @include         http://stackoverflow.com/questions/*
// @include        https://stackoverflow.com/questions/*

// @include         http://serverfault.com/questions/*
// @include        https://serverfault.com/questions/*

// @include         http://superuser.com/questions/*
// @include        https://superuser.com/questions/*

// @include         https://stackapps.com/questions/*
// @include        https://stackapps.com/questions/*

// @include         http://meta.stackoverflow.com/questions/*
// @include        https://meta.stackoverflow.com/questions/*

// @include         http://*.stackexchange.com/questions/*
// @include        https://*.stackexchange.com/questions/*

// @include         http://askubuntu.com/questions/*
// @include        https://askubuntu.com/questions/*

// @include         http://answers.onstartups.com/questions/*
// @include        https://answers.onstartups.com/questions/*

// @include         http://meta.mathoverflow.net/questions/*
// @include        https://meta.mathoverflow.net/questions/*

// @include         http://mathoverflow.net/questions/*
// @include        https://mathoverflow.net/questions/*

// ==/UserScript==

function with_jquery(f) {
  var script = document.createElement("script");
  script.type = "text/javascript";
  script.textContent = "(" + f.toString() + ")(jQuery)";
  document.body.appendChild(script);
};

with_jquery(function($) {
       var re = new RegExp("^http://(.*?)\.(com|net|org)");
       var group = re.exec(window.location.href);
       var service = group[1];
       $('#question .vote:first').append(''
         +'<div id="PrinterFriendly" style="margin-top:8px">'
         +'<a alt="Printer-Friendly" title="Printer-Friendly"'
         +'  href="javascript:'
         +'    (function(){'
         +'      f=\''
                   +'http://www.stackprinter.com/export?format=HTML&service='
                   +service
                   +'&question='
                   +$('.vote').find('input[type=hidden]:first').val()
                   +'\';'
         +'      a=function(){if(!window.open(f))location.href=f};'
         +'      if(/Firefox/.test(navigator.userAgent))'
         +'       {setTimeout(a,0)}else{a()}'
         +'    })()'
         +'  "'
         +'> <img width="33px" height="33px" '
         +'    src="http://www.stackprinter.com/images/printer.gif">'
         +'  </img>'
         +'</a></div>'
       );
});

The bookmarklet is:

javascript:(function(){var%20re%20=%20new%20RegExp('^https?://(.*?)\.com/questions/([0-9]+)/');var%20group%20=%20re.exec(window.location.href);if%20(group!=null){var%20service%20=%20group[1];var%20questionid=group[2];window.open('http://www.stackprinter.com/export?format=HTML&service='+service+'&question='+questionid)}else{alert('Attention:%20question%20id%20not%20found!')}})()
5
  • @BrockAdams You may be right, but I can still print with StackPrinter and the bookmarklet I mentioned works. It's the button which doesn't work and which worked a week ago. And I notice that userscripts.org has gone offline recently. I would have posted to the StackPrinter question you referenced, but that requires 10 reputation points. Similarly, I couldn't add more than 2 links in my question.
    – jrw32982
    Jun 11, 2014 at 3:34
  • No longer shows up on which site? What browser and GM versions? I just installed the script and it works fine for me (FF latest and GM latest). Further, there is nothing in the script that relies on userscript.org. Jun 16, 2014 at 1:01
  • I'm using Firefox 30.0 on Windows XP (and Ubuntu), GreaseMonkey 1.15. Not really knowing how it all works, I do see userscript.org referenced in the script. I used to get a Printer icon showing up on each StackExchange site, but no longer. I've visited unix.stackexchange.com, programmers.stackexchange.com, etc. The Bookmarklet works fine for printing. I've also got NoScript, AdBlock, FlashBlock and a few other add-ons installed, but they weren't a problem before. If I recall correctly, I did try uninstalling and reinstalling to no avail.
    – jrw32982
    Jun 16, 2014 at 17:52
  • I just installed and the script is working for me. I've updated the link in the question replacing userscripts.org with the mirror.
    – brasofilo
    Sep 29, 2014 at 20:43
  • I'm voting to close this question as it should have been posted as an "answer" to the announcement post (but wasn't for various reasons, since remedied). Mar 7, 2019 at 22:22

0

Browse other questions tagged .