Scribd Print and Download

Changes "Upload" link to open a printable viewer (print to PDF)

  1. // ==UserScript==
  2. // @name Scribd Print and Download
  3. // @description Changes "Upload" link to open a printable viewer (print to PDF)
  4. // @author Inserio
  5. // @include http://*.scribd.com/doc/*
  6. // @include http://*.scribd.com/document/*
  7. // @include https://*.scribd.com/doc/*
  8. // @include https://*.scribd.com/document/*
  9. // @version 1.7
  10. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
  11. // @namespace https://greatest.deepsurf.us/users/11878
  12. // ==/UserScript==
  13.  
  14. var new_link;
  15.  
  16. $('script').html(function (i, text) {
  17. var idRegex = /"id":(\d{6,})/i;
  18. var keyRegex = /"access_key":"(key[-\w\d]*)"/i;
  19. var id = idRegex.exec(text);
  20. var key = keyRegex.exec(text);
  21. if (id !== null && key !== null && id !== undefined && key !== undefined)
  22. new_link = "http://d1.scribdassets.com/ScribdViewer.swf?document_id=" + id[1] + "&access_key=" + key[1];
  23. // if (new_link !== undefined)
  24. // return text.replace(/https?:\/\/www\.scribd\.com\/upload-document/gi, new_link);
  25. // Matches the "Upload" link on the page.
  26. // Click it to open the new page in a viewer that will allow printing to PDF
  27. });
  28.  
  29. $('div').html(function (i, text) {
  30. if (new_link !== undefined)
  31. return text.replace(/https?:\/\/www\.scribd\.com\/upload-document/gi, new_link);
  32. });