Zotero URI vs. select item

Hello,

the following two are the same item:

http://zotero.org/groups/2339240/items/9FNQ8D8G
zotero://select/items/5568133_9FNQ8D8G

Would somebody be able to remind me how the library ids (2339240, 5568133) are related?

I would like to make a bookmarklet that uses http://zotero.org/groups/2339240/items/9FNQ8D8G
to open zotero://select/items/5568133_9FNQ8D8G.

However, if the numbers aren't related (or the latter is a local number), then it won't work.

Many thanks!
Bjoern
  • The latter isn't a current URL and shouldn't be used. The current format would be zotero://select/groups/2339240/items/9FNQ8D8G.
  • Ah ok! It comes from zutilo, I'll raise an issue in github!

    Many thanks for the help!
    Bjoern
  • Here's a bookmarklet:

    javascript:(function(){
    var href = window.location.href;
    var url = href.replace(/https?\:\/\/(www\.)?zotero\.org\//,"zotero://select/");
    url = url.replace(/\/[^\/]+\/items\/(collection|item)Key/,"/$1s");
    window.location.href = url;
    })();

    When on a zotero web-library page, it opens the corresponding item in Zotero. Works on items and collections. Not very robust - e.g. ought to display warning when not on a zotero page.

    https://github.com/bjohas/zoteroSelectItem/blob/master/bookmarklet.js
  • Note that for your personal library it'd be zotero://select/library/items/ABCD2345.

    (Zotero could theoretically allow zotero://select/users/12345/items/ABCD2345 to work if you've synced, but that doesn't happen now — instead if just uses a default path for My Library regardless of whether you've synced.)
  • Ah ok - yes, true. My apologies. I mainly work in shared libraries, so tend to neglect the personal library a bit!
  • But how would the bookmarklet know whether to use zotero://select/library/ or zotero://select/groups/?
  • because the URL is also different (/user/ vs. /groups/) you can just use a conditional to toggle between the two.
Sign In or Register to comment.