Scribd Print and Download

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

Fra 08.12.2015. Se den seneste versjonen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Scribd Print and Download
// @description	Changes "Upload" link to open a printable viewer (print to PDF)
// @author      Inserio
// @include     http://*.scribd.com/doc/*
// @include     https://*.scribd.com/doc/*
// @version     1.5
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @grant       GM_log
// @namespace https://greatest.deepsurf.us/users/11878
// ==/UserScript==
/*- The @grant directive is needed to work around a design change introduced in GM 1.0,
    It restores the sandbox.
*/

var my_jquery = jQuery;
jQuery.noConflict(true);
var $ = my_jquery, jQuery = my_jquery;

$('*').html(function (i, text) {
	var idRegex = /"id":(\d{6,})/i;
	var keyRegex = /"access_key":"(key[-\w\d]*)"/i;
	var id = idRegex.exec(text);
	var key = keyRegex.exec(text);
	if (id !== null && key !== null && id !== undefined && key !== undefined)
		var new_link = "http://d1.scribdassets.com/ScribdViewer.swf?document_id=" + id[1] + "&access_key=" + key[1];
	if (new_link !== undefined)
		return text.replace(/https?:\/\/www\.scribd\.com\/upload-document/gi, new_link);
		// Matches the "Upload" link on the page.
		// Click it to open the new page in a viewer that will allow printing to PDF
});