-
-
Save stuarthendren/34723 to your computer and use it in GitHub Desktop.
PrintWhatYouLike.com Ubiquity Command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
names: ["print what you like"], | |
homepage: "http://stuarthendren.net/", | |
author: { name: "Stuart Hendren", email: "stuarthendren@gmail.com"}, | |
contributors: ["Stuart Hendren"], | |
license: "CC by-sa, http://creativecommons.org/licenses/by-sa/2.0/", | |
description: "Sends the current page to PrintWhatYouLike.com", | |
icon: "http://www.printwhatyoulike.com/static/img/favicon.png", | |
help: "Print the current tab using <a href='http://printwhatyoulike.com'>PrintWhatYouLike.com</a>", | |
preview: function( pblock ) { | |
var msg = "Opens a new tab to print "; | |
msg += context.focusedWindow.document.location.href; | |
msg += " using PrintWhatYouLike.com."; | |
pblock.innerHTML = msg; | |
}, | |
execute: function( ) { | |
var url = context.focusedWindow.document.location.href; | |
var encodedUrl=escape(url); | |
encodedUrl=encodedUrl.replace(/\+/g, "%2B"); | |
encodedUrl=encodedUrl.replace(/\//g, "%2F"); | |
var send = "http://www.printwhatyoulike.com/print?url="; | |
send += encodedUrl; | |
Utils.openUrlInBrowser(send); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment