[annotator-dev] Passing URL into GET
Albert Juhé
albertjuhe at gmail.com
Wed Jun 18 06:46:17 UTC 2014
Hi Prateek,
I don't know if this could be useful for you, but I load annotations from
the URL using GET method. I've created a plug-in that do that, some times
in the discussions group of the University the lecturer need to highlight
some text in several documents, but the student don't want to store it.
The lecturer have a tool for generate a special URL, I have this kind of
url to do that:
*http://localhost:3000/annotation/share/PID_00205228/1/anotations.html
<http://localhost:3000/annotation/share/PID_00205228/1/anotations.html>?*
*share*
={%22permissions%22:{%22read%22:[],%22update%22:[%22consultor1%22],%22delete%22:[%22consultor1%22],%22admin%22:[%22consultor1%22]},%22user%22:%22consultor1%22,%22ranges%22:[{%22start%22:%22/div[1]/div[1]/div[3]/div[1]/div[5]/div[2]/div[1]/div[4]%22,%22startOffset%22:0,%22end%22:%22/div[1]/div[1]/div[3]/div[1]/div[5]/div[2]/div[1]/div[4]%22,%22endOffset%22:205}],%22quote%22:%22El%20resultat%20%C3%A9s%20una%20representaci%C3%B3%20que%20fa%20d%E2%80%99intermedi%C3%A0ria%20i%20difusora%20entre%20una%20col%C2%B7lecci%C3%B3%20de%20documents%20i\n%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20els%20usuaris.%22,%22order%22:%22w26aab5b9c11%22,%22text%22:%22La%20representaci%C3%B3%20que%20fa%20no%20%C3%A9s%20correcte%22,%22category%22:%22destacat%22,%22id%22:238,%22estat%22:1,%22role%22:%22CONSULTOR%22,%22propietary%22:0,%22data_creacio%22:%222014-01-13T11:51:17.000Z%22,%22highlights%22:[{%22jQuery19102105689524820209%22:141},{%22jQuery19102105689524820209%22:142},{%22jQuery19102105689524820209%22:143},{%22jQuery19102105689524820209%22:144},{%22jQuery19102105689524820209%22:145}]}
the *share *parameter is the json annotation.
I've attached the plug-in.
I use the plug in: $('body').annotator().annotator('addPlugin',
'ShareAnnotation',{code:pid,modul:modul});
Code: is code document, modul: is the seccion of the document, this
parameters aren't important, these are important for my back end in nodejs.
When the document is loaded, this plug-in detect if in the GET url has
share parameter )ShareAnnotation.prototype.pluginInit). I use the function
ShareAnnotation.prototype.urlParam to extract parameters from de get. If
the share parameter exists the annotation is loaded.
*var an = [JSON.parse(decodeURI(annotation))];
this.annotator.loadAnnotations(an.slice());*
the next step is create a small URL similar to http://goo.gl/.
Universitat Oberta de Catalunya,
Albert
2014-05-31 9:28 GMT+02:00 Prateek Narendra <prateek at dronamobile.com>:
> I had a small problem...
>
> I'm doing a project using annotator.js. But i'm facing a small
> problem.....
>
> Is there any way to pass the URL into GET method?
> I want this feature as i selectively want to display the annotations of
> any webpage. But if he is on a certain webpage, only the annotations of
> that webpage will be shown.
>
> _______________________________________________
> annotator-dev mailing list
> annotator-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/annotator-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/annotator-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140618/4c05cd03/attachment-0004.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shareAnnotation.js
Type: application/x-javascript
Size: 2959 bytes
Desc: not available
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20140618/4c05cd03/attachment-0004.js>
More information about the annotator-dev
mailing list