forked from szabyg/vie-annotation-bookmarklet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
activate.js
executable file
·51 lines (47 loc) · 1.38 KB
/
activate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
jQuery(document).ready(function(){
var appConfig = window.bookmarkletConfig;
var selector = appConfig.defaultCssSelector;
if(appConfig.cssPopup){
selector = prompt("CSS selector for the annotation (e.g. p, body, div#content...)", appConfig.defaultCssSelector);
}
jQuery('.loadingDiv')
.hide() // hide it initially
.ajaxStart(function() {
jQuery(this).show();
})
.ajaxStop(function() {
jQuery(this).hide();
});
var z = window.myVie = new VIE();
z.loadSchemaOrg();
z.use(new z.StanbolService({url : appConfig.stanbolUri, proxyDisabled: true}));
// make the content element editable
jQuery(selector)
.hallo({
plugins: {
'halloformat': {}
},
editable: true
})
.annotate({
vie: z,
vieServices: ["stanbol"],
debug: true,
decline: function(event, ui){
console.info('decline event', event, ui);
},
select: function(event, ui){
var entity = z.entities.get(ui.linkedEntity.uri);
console.info('select event', event, ui);
},
remove: function(event, ui){
console.info('remove event', event, ui);
}
})
.each(function(){
jQuery(this)
.annotate('enable', function(success, widget){
console.info("success:", success);
});
});
});