Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
jQuery in Zotero
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alf Eaton  
View profile  
 More options Nov 29 2007, 12:34 pm
From: Alf Eaton <eaton....@googlemail.com>
Date: Thu, 29 Nov 2007 09:34:37 -0800 (PST)
Local: Thurs, Nov 29 2007 12:34 pm
Subject: jQuery in Zotero
I've been doing some work to allow Zotero translators to use jQuery.

The benefits of this are a) ease of writing translators and b)
portability. The second of these is the most important: ideally
Zotero's translators would run in Firefox, WebKit (which doesn't have
E4X, eg Safari, KHTML) and Rhino (which doesn't have XPath).

Getting this working was helped immensely by the recent posting of a
couple of new builds of Greasemonkey (based on work that's been around
for a while, incidentally) that allow user scripts to import jQuery or
other Javascript libraries.

The jquery.diff patch to Zotero at <http://alf.hubmed.org/zotero/
jquery.diff> loads jquery.js from the chrome folder (if you place the
latest jquery.js in chrome/content/zotero/), sets up a few environment
variables and evals it in the sandbox, so that the $jq function is
available to translators. It also adds one utility function ('unique')
to Zotero.Utilities.

The scrapers.diff patch to scrapers.sql at <http://alf.hubmed.org/
zotero/scrapers.diff> replaces the Amazon translator with a jQuery-
fied version. You'll need to run 'Reset Translators and Styles' from
Zotero's preferences to use it.

I still have a couple of things to work out, like whether it's safe to
set 'document' to the sandboxed, XPCNativeWrapper document so that
jQuery can access it, but otherwise - it works!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alf Eaton  
View profile  
 More options Nov 30 2007, 7:52 am
From: Alf Eaton <eaton....@googlemail.com>
Date: Fri, 30 Nov 2007 04:52:18 -0800 (PST)
Local: Fri, Nov 30 2007 7:52 am
Subject: Re: jQuery in Zotero
On Nov 29, 5:34 pm, Alf Eaton <eaton....@googlemail.com> wrote:

> I've been doing some work to allow Zotero translators to use jQuery.

As an example of how this can be useful, here's the COinS detector
rewritten to use jQuery:

-----

function detectWeb(doc, url) {
  var coins = $jq("span.Z3988[@title*='ctx_ver=']", doc); // span
element with class of "Z3988" and title attribute containing
"ctx_ver="
  switch(coins.length){
          case 0: return false;
          case 1: var item = new Zotero.Item;
Zotero.Utilities.parseContextObject($jq(coins[0]).attr("title"),
item); return item.itemType;
          default: return "multiple";
  }

}

-----

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce D'Arcus  
View profile  
 More options Nov 30 2007, 9:16 am
From: Bruce D'Arcus <bdar...@gmail.com>
Date: Fri, 30 Nov 2007 09:16:45 -0500
Local: Fri, Nov 30 2007 9:16 am
Subject: Re: jQuery in Zotero

Alf Eaton wrote:
> On Nov 29, 5:34 pm, Alf Eaton <eaton....@googlemail.com> wrote:
>> I've been doing some work to allow Zotero translators to use jQuery.

> As an example of how this can be useful, here's the COinS detector
> rewritten to use jQuery:

Just wanted to offer congrats on this work Alf. Would obviously be great
to see a shareable collection of translators that can work both in
different browsers, and on servers.

Nice job!

Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alf Eaton  
View profile  
 More options Nov 30 2007, 12:40 pm
From: Alf Eaton <eaton....@googlemail.com>
Date: Fri, 30 Nov 2007 09:40:33 -0800 (PST)
Local: Fri, Nov 30 2007 12:40 pm
Subject: Re: jQuery in Zotero
On Nov 30, 2:16 pm, Bruce D'Arcus <bdar...@gmail.com> wrote:

> Would obviously be great to see a shareable collection of translators that can work both in different browsers, and on servers.

Speaking of which, is there any work in progress for moving the
translators out of the database and into Greasemonkey-like user script
files?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce D'Arcus  
View profile  
 More options Nov 30 2007, 1:47 pm
From: Bruce D'Arcus <bdar...@gmail.com>
Date: Fri, 30 Nov 2007 13:47:29 -0500
Local: Fri, Nov 30 2007 1:47 pm
Subject: Re: jQuery in Zotero

Alf Eaton wrote:
> On Nov 30, 2:16 pm, Bruce D'Arcus <bdar...@gmail.com> wrote:

>> Would obviously be great to see a shareable collection of
>> translators that can work both in different browsers, and on
>> servers.

> Speaking of which, is there any work in progress for moving the
> translators out of the database and into Greasemonkey-like user
> script files?

This would be nice. It's the same issue when the CSL files were stuck in
the SQL code. It's good to see them now liberated!

Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Cohen  
View profile  
 More options Nov 30 2007, 1:58 pm
From: Daniel Cohen <dco...@gmu.edu>
Date: Fri, 30 Nov 2007 13:58:01 -0500
Local: Fri, Nov 30 2007 1:58 pm
Subject: Re: jQuery in Zotero

Alf,

Like Bruce, I'm incredibly impressed with your work on this.

Since recently launching the CSL repository we're taking a breather on  
other repos until we finish up some critical infrastructural work for  
the server. But we're planning on doing this soonish--as Bruce notes,  
the repo has *really* helped out with the CSL development.

jQuery has a lot to recommend it, e.g., its compactness and  
portability. But in terms of standards, XPath has been widely adopted  
(including in the latest version of WebKit) and E4X is an ECMA  
standard. And--perhaps this is nearsighted--but at the end of the day  
Zotero is a Firefox tool and we have committed a lot of resources to  
that and for obvious reasons worry a little bit about switching the  
translator architecture from using standards with native support in  
Firefox to a third-party JS-based library.

But certainly we'll keep on eye on this and hope the translator repo  
will be helpful to you and others (and out soon).

Dan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bruce D'Arcus  
View profile  
 More options Feb 11 2008, 9:12 am
From: "Bruce D'Arcus" <bdar...@gmail.com>
Date: Mon, 11 Feb 2008 09:12:03 -0500
Local: Mon, Feb 11 2008 9:12 am
Subject: Re: jQuery in Zotero
Just a followup to this ...

On Nov 30, 2007 1:58 PM, Daniel Cohen <dco...@gmu.edu> wrote:

...

> jQuery has a lot to recommend it, e.g., its compactness and
> portability. But in terms of standards, XPath has been widely adopted
> (including in the latest version of WebKit) and E4X is an ECMA
> standard. And--perhaps this is nearsighted--but at the end of the day
> Zotero is a Firefox tool and we have committed a lot of resources to
> that and for obvious reasons worry a little bit about switching the
> translator architecture from using standards with native support in
> Firefox to a third-party JS-based library.

This might be relevant:

<http://ejohn.org/blog/xpath-overnight/>

Bruce


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »