lundi 30 mars 2015

Annotations showing on multiple pages

I have added annotator.js to some reveal.js presentations. Im also using the offline plugin for annotator.js.


The problem is that an annotation from one presentation still loads on another.


I have used code that is meant to stop this happening , but it doesn't.


jQuery('Lecture 1').text(); is changed to jQuery('Lecture 2').text(); in the other reveal presententaion.



<script>
var content = jQuery(".reveal").annotator();
content.annotator('addPlugin', 'Offline', {
setAnnotationData: function (ann) {
if (!ann.pageName) {
ann.pageName = jQuery('Lecture 1').text(); // Use the page title
}
},
shouldLoadAnnotation: function (ann) {
return ann.pageName === jQuery('Lecture 1').text();
},
online: function () {
jQuery("#status").text("Online");
},
offline: function () {
jQuery("#status").text("Offline");
}
});
var annotator = content.data('annotator');

jQuery("#clear-storage").click(function () {
if (annotator) {
annotator.plugins.Offline.store.clear()
}
});
</script>

Aucun commentaire:

Enregistrer un commentaire