Extensions designed to enrich your browsing experience

Documents 2.0.3

In order to provide you with a bit of diversification, I'll sandwich an RC of Documents between all those modern scroll builds 😉 …

What changed?

The changelog really contains only one single item this time, but it's the most important part of the whole extension:
new: more efficient and flexible algorithm detecting more links

Here's the download link of Documents 2.0.3 :up:

And for those who like to know how stuff works a bit of an inside view: :sherlock:

The algorithm, which I used to use for a really long time is pretty simple, but worked nicely:


it checks, if the link ends with a . followed by a file type of a selected document

After a bug report I altered that a bit in version 2.0.1 to allow for page numbers:


now it checks, if the link ends with a ., the file type and optionally the wording "#page" and a number.
Additionally, I checked for ? in both versions separately to ensure that the matched document isn't a variable.

Since I got another bug report, I took a whole different approach now for version 2.0.3:


Instead of checking the end of the link, it now starts at the beginning.
The algorithm basically checks for a . followed by a /, another . and finally the file type.
Before and between them the algorithm allows for any number of different characters except the ?, after the file type any number of any characters.

Why that?
Excluding the ? makes sure that we do not match documents passed as a variable of a regular website (So I combined both regular expressions into one, which is of course more efficient). 😉
Then the first . ensures, that we start within the host, the following / guarantees, that everything behind is within a folder of this host. Finally, there's the same check as in earlier versions, but allowing for junk-data (e.g. Datamover-10.11.pdf?version=2&modificationDate=1289922519381) behind it.

Since I hereby kind of exchanged the heart of the extension, it's not too unlikely that it'll also have some regressions. If you stumble across a link which doesn't work or which is opened accidentally by Documents, please let me know!

As I already guessed, this algorithm did accidentally try to open some web pages, e.g. "http://www2.le.ac.uk/Members/davidwickins/old/test.docx/view". Hence, I had to adjust it another time and that's what I ended up with:


The difference to the variant before is that now the whole address from the first to the last character is checked.
The front part is identical, but I now specified, that the allowed junk-data has to begin with a ? or #.

I think the risk of having accidental matches is next to zero now, but you never know. I'll give you guys another week to test it before it's made public just to be on the safe side 😉

Other than that: Have fun with it :cheers:


Comments on: "Documents 2.0.3" (11)

  1. :cheers: handful extension

  2. Just when I found about this update, the download links are down.One of the best extensions for Opera to date! Keep up the good job.

  3. Have you ever tried to use document.contenttype?

        var docs = 'https://docs.google.com/viewer?docex=1&url=';
        window.location.href = docs + encodeURIComponent(window.location);

  4. christoph142 said:

    No, I didn't.I just gave it a try (since it sounded promising for the "extended mode"), but it turns out that it's not usable for this extension. It works fine for PDF-files, but Autocad (.dxf) for example sends text/plain as its ContentType :down:Thanks for the idea, though. I really appreciate it :up:

  5. When will the extension be made available? I'm eagerly waiting for it (the update I mean).

  6. Barry writes:Thanks

  7. christoph142 said:

    Originally posted by Acryion:

    When will the extension be made available?

    Now :PI'm sorry, that it took me a while. Developing is just a PITA when you can't rely on that stuff which is working in developer mode is still working when you zip it up as an extension… :down:@Barry: You're welcome and sorry that I can't be more of a help for you with your issue.

  8. So….now this extension made itself a "duplicate". I had 2.0.2 and 2.0.3 installed side by side. Oh well…

  9. christoph142 said:

    I'm pretty sure that this is happening because of installing the extension from different sources (catalog and github)…Cryio, is the algorithm working for you?Should 2.0.3 get published like this?

  10. I can't scroll anymore. Is it just me?

  11. christoph142 said:

    That's probably because you're using modern scroll 1.4 as well.Update modern scroll to the newest snapshot and you should be fine 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: