Code Monkey home page Code Monkey logo

zoterohistory's Introduction

ZoteroHistory

Never get lost! Add a history feature for paper jumping in Zotero!

I often get lost when jumping between papers. After jumping from paper A to paper B, I am unable to go back to paper A if I forget its title.

I want an extension to add a history feature for paper viewing in Zotero. I didn't find a way to build extension (how to generate a .zoteroplugin from source code?) for Zotero 5.0 in the official documentation. And I failed at compiling and installing the the source code for the hello-world-zotero extension, on Zotero 5.0.

Fortunately, with Zotero 5.0's javascript API, I've managed to manually log the paper view history in Zotero. It's not quite user friendly yet, but it barely works.

Tell me if you have better methods!

Test environment:

  • Zotero v5.0.87
  • tested on Mac OSX 10.15.4
  • windows user can try the same way and comment on how it works. thx!

Useage:

`Zotero` -> `Tools` -> `Develop` -> `Run javascript`

step1: Initialize the variable by executing the first patch of code:

//=== initialize the history ====
var items = Zotero.getActiveZoteroPane().getSelectedItems();
var cur_itemKey = items[0].key;
var tmp_key = cur_itemKey;
var key_paper_list = 'List of keys of papers your selected:\n';
cur_itemKey += '\n';

step2: Then replace the first patch of code with the below.

//==== run above once, and modify above 5 lines into: ====
items = Zotero.getActiveZoteroPane().getSelectedItems();
cur_itemKey = items[0].key + '\n';
if(items[0].key !=tmp_key){
	tmp_key = items[0].key;
	key_paper_list += cur_itemKey;
}
else{
    key_paper_list += '';
}

step3: Return to the Zotero main screen and browse papers. Return javascript interface and run the 2nd code patch every time you switch papers. The javascript interface executes the code once to log a view history.

step4: You can go back through the browsing history by searching and entering the key directly.

Tips:

on Mac OSX, use Command+` to switch between javascript running interface and Zotero paper viewing interface.

zoterohistory's People

Contributors

sonictl avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

zoterohistory's Issues

Automatically execute code when a tab is closed

Hello, I'm also upset about the fact that Zotero still doesn't offer a function of "Recent Read Papers" lol.

In your workflow, you have to manually switch to the Javascript interface and execute the code when you switch from one paper to another. However, Zotero offers a (probably unused) API to define a callback function when a tab is closed. (though it is currently not on the wiki page. I found that through reading the Zotero source code)

let win = Zotero.getMainWindow();
let zts = win.Zotero_Tabs._tabs;
// zts is a list of tab objects with many useful fields including id, title, time of last selected/unselected. 
// Usually, zts[0] is the main panel where you select papers, while the others are the papers you have opened.
let old_onClose = zts[1].onClose; // undefined
zts[1].onClose = ()={
    alert('this tab is closed');
}
// after you execute, when you close the first tab, the callback runs, and you will see the alert.

So in your case, you can define your second piece of code as a function and register it as the onClose callback of each opened tab. You can even use setInterval to iterate over all opened tabs (with zts) every given time (e.g., 10 seconds), so you only have to execute the code once and don't have to bother with it anymore!

And this can go even further, like writing the closing time into the paper's metadata (it seems #1 mentioned writing to the attachment (pdf) of the paper, but actually there is a (probably) unused access_time field in the metadata), and/or tag them "Recently Read" / add them to a collection named "Recent Read". After that, you can simply visit the "Recently Read" tag/collection and sort the paper by access time, like the way Mendeley does. I plan to work on this if I got time :)

Nice idea

I guess, that it would be nice to have something like a stack of recently opened papers and better or better - a graph of recently opened papers with the ones cited by each other connected.
Currently, I'm using MarginNote for this.

However your current routine could be made easier by simply "touching" the file and sorting by "Date Modified".
You can update a paper your reading by adding, say a simple tag or modify it's Extra field.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.