Scribd Print and Download

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

当前为 2015-12-08 提交的版本,查看 最新版本

  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 https://*.scribd.com/doc/*
  7. // @version 1.4
  8. // @grant none
  9. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
  10. // @namespace https://greasyfork.org/users/11878
  11. // ==/UserScript==
  12.  
  13. $('*').html(function (i, text) {
  14. var idRegex = /"id":(\d{6,})/i;
  15. var keyRegex = /"access_key":"(key[-\w\d]*)"/i;
  16. var id = idRegex.exec(text);
  17. var key = keyRegex.exec(text);
  18. if (id !== null && key !== null && id !== undefined && key !== undefined)
  19. var new_link = "http://d1.scribdassets.com/ScribdViewer.swf?document_id=" + id[1] + "&access_key=" + key[1];
  20. if (new_link !== undefined)
  21. return text.replace(/https?:\/\/www\.scribd\.com\/upload-document/gi, new_link);
  22. // Matches the "Upload" link on the page.
  23. // Click it to open the new page in a viewer that will allow printing to PDF
  24. });