As of 2016-02-26, there will be no more posts for this blog. s/blog/pba/
Showing posts with label bookmark. Show all posts

Note

Google Docs Viewer is gone, therefore nothing here will work. (2015-12-10T03:08:02Z)

More than a year ago, I wrote a post about how to view local PDF file. To be honest, I never actually used that script, I have a bookmark for viewing PDF online for very long time even before I wrote that script. I don’t download PDF when I need to open a PDF file, just directly view it using Google Docs Viewer.

If you are a Firefox user, it’d be great to know the keyword and %s in bookmarks. Keyword of bookmark allows you to access the bookmark by just typing it in address bar, %s in bookmark URL will be replaced with the string you put after the keyword when you open a bookmark using address bar.

To show you how to use bookmark, first, create a bookmark with URL as follows:


https://docs.google.com/viewer?url=%s

and set keyword to gdv.

Next, find a random PDF link online and type in the following text in address bar:


gdv[Space]http://example.com/foobar.pdf[Enter]

Google Docs Viewer will show you the document if it’s not get blocked. I have seen one or two websites actually blocks Google Docs Viewer.

You can have embedded version with the following URL, which has less controls:


https://docs.google.com/viewer?embedded=true&url=%s

For me, as a fan of Pentadactyl, after I yank a URL of PDF, I just type in:


[o]gdv[Space]http://example.com/foobar.pdf[Enter]

If you are smart, you should have learned you can set some keywords for your most visited bookmarks with single letter or two. You don’t need to go through your bookmark bar, you just type the keyword and press enter.

Note

Thanks azuwis for the great tip of using hints in the comment below, here is the embedded code. (2012-06-26T09:38:22Z)

Press ;d to get the hints if links are PDF, DOC, etc.

1   Update on commandline.open() (2011-07-21T22:24:21Z)

Some months after I posted this, this didn’t work anymore. Yesterday, I finally decided to fix this. The JavaScript code is actually being evaluated, but the prompt with :bmark doesn’t show up. If I run manually, it still doesn’t sure, but the command has been entered into the history.

I read some plugins’ source code, but nothing really gave me any hint. They just work with virtually same commandline.open() code. But then I realized, they actually is executed after XMLHttpRequest().

So, the fix is

# map a :js my_bookmark_adder()<CR>
map a :js setTimeout(my_bookmark_adder, 0)<CR>

Or you can do it in the function.

I don’t know when and what actually cause this and I don’t really care. If you find out which commit causes this, feel free to tell me.

2   Original post

If you use bookmarks to organize your to-read list, or you bookmark on certain website a lot. You might want to tag with readlater or remove some words from bookmark titles, such as website’s name.