[annotator-dev] Initializing multiple annotators on one page.
Aron Carroll
aron.carroll.lists at gmail.com
Mon Jan 23 11:33:39 UTC 2012
Also I'll add that if you're looking to store/load annotations on a per region basis you could use the "annotationData" and "loadFromSearch" options. eg.
// From https://github.com/okfn/annotator/wiki/Store-Plugin
$('#one').annotator().annotator('addPlugin', 'Store', {
annotationData: {
uri: 'http://this/document/only#one'
},
loadFromSearch: {
uri: 'http://this/document/only#one'
}
});
$('#two').annotator().annotator('addPlugin', 'Store', {
annotationData: {
uri: 'http://this/document/only#two'
},
loadFromSearch: {
uri: 'http://this/document/only#two'
}
});
This will make two requests to the server and so may not be necessary depending on what you're doing.
Cheers,
Aron
On 22 Jan 2012, at 23:58, Nick Stenning wrote:
> Hi Friedrich,
>
> So, to answer your questions as best I can:
>
> 1) Should be no problem at all. Aron spent some time making sure this
> was possible. You should be able to call
>
> $('#one').annotator(); $('#two').annotator();
>
> and if you run into problems doing this, you should file a bug report.
>
> 2) I'm not entirely sure what this means, but the content of the 'uri'
> field on annotations is currently ignored by the Annotator frontend.
> The XPath 'start' and 'end' of the annotations are calculated relative
> to the element on which the annotator is initialised, however, and
> this provides a relatively easy way to achieve what you're after -- as
> long as you ensure that the markup (or at least the DOM structure:
> classes and ids won't matter) within an annotatable region is
> consistent, you should be able to load annotations just fine.
>
> (Oh, and I realise that this doesn't necessarily solve all your
> problems at once, but it's a start! If you want to grab me on IRC or
> Skype about the possibility of identifying start/end annotation nodes
> by id, please do. This is a use case I've thought about, and Annotator
> doesn't really help you get there at the moment.)
>
> Best,
> Nick
>
> On Thu, Jan 19, 2012 at 21:54, Friedrich Lindenberg
> <friedrich.lindenberg at okfn.org> wrote:
>> Hi all,
>>
>> I want to use the annotator on a page that contains many smallish text
>> fields (speech contributions of parliamentarians). Now each speech
>> fragment can appear in a variety of contexts, e.g. on a plenary
>> session page, agenda item page or as the result of a search query. Is
>> there some way to 1) initialize the annotator several times on a
>> single page, 2) assign domain-wide identifiers to HTML elements rather
>> than having annotations assigned by URI?
>>
>> Thanks for any help,
>>
>> - Friedrich
>>
>> _______________________________________________
>> annotator-dev mailing list
>> annotator-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/annotator-dev
>
> _______________________________________________
> annotator-dev mailing list
> annotator-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/annotator-dev
More information about the annotator-dev
mailing list