Commit db61d527 authored by csillag's avatar csillag

Updated annotator to 04d14657 (fix-event-signature branch)

parent 76e7496b
......@@ -825,8 +825,8 @@ class Annotator extends Delegator
for anchor in @anchors[index] ? []
anchor.virtualize index
onAnchorMouseover: (event, annotations, highlightType) ->
#console.log "Mouse over annotations:", annotations
onAnchorMouseover: (event) ->
#console.log "Mouse over annotations:", event.data.getAnnotations event
# Cancel any pending hiding of the viewer.
this.clearViewerHideTimer()
......@@ -835,17 +835,18 @@ class Annotator extends Delegator
# already displaying the viewer
return false if @mouseIsDown or @viewer.isShown()
this.showViewer(annotations, util.mousePosition(event, @wrapper[0]))
this.showViewer event.data.getAnnotations(event),
util.mousePosition(event, @wrapper[0])
onAnchorMouseout: (event, annotations, highlightType) ->
#console.log "Mouse out on annotations:", annotations
onAnchorMouseout: (event) ->
#console.log "Mouse out on annotations:", event.data.getAnnotations event
this.startViewerHideTimer()
onAnchorMousedown: (event, annotations, highlightType) ->
#console.log "Mouse down on annotations:", annotations
onAnchorMousedown: (event) ->
#console.log "Mouse down on annotations:", event.data.getAnnotations event
onAnchorClick: (event, annotations, highlightType) ->
#console.log "Click on annotations:", annotations
onAnchorClick: (event) ->
#console.log "Click on annotations:", event.data.getAnnotations event
# Create namespace for Annotator plugins
class Annotator.Plugin extends Delegator
......
......@@ -71,6 +71,7 @@ class Delegator
# bindTo - Selector String matching child elements. (default: @element)
# event - The event to listen for.
# functionName - A String function name to bind to the event.
# eventData - eventData to pass to jQuery (which will be present in event.data)
#
# Examples
#
......@@ -82,7 +83,7 @@ class Delegator
# instance.addEvent('form :input', 'focus', 'onInputFocus')
#
# Returns itself.
addEvent: (bindTo, event, functionName) ->
addEvent: (bindTo, event, functionName, eventData = null) ->
f = if typeof functionName is 'string'
this[functionName]
else
......@@ -94,12 +95,13 @@ class Delegator
bindTo = @element if isBlankSelector
if typeof bindTo is 'string'
@element.delegate bindTo, event, closure
@element.delegate bindTo, event, eventData, closure
else
if this.isCustomEvent(event)
# TODO: no way to support eventData here?
this.subscribe event, closure
else
$(bindTo).bind event, closure
$(bindTo).bind event, eventData, closure
this
......
......@@ -33,17 +33,25 @@ class TextHighlight extends Annotator.Highlight
# Make a proper array out of the list
TextHighlight.$.makeArray annotations
annotator.addEvent ".annotator-hl", "mouseover", (event) =>
annotator.onAnchorMouseover event, getAnnotations event, @highlightType
annotator.addEvent ".annotator-hl", "mouseout", (event) =>
annotator.onAnchorMouseout event, getAnnotations event, @highlightType
annotator.addEvent ".annotator-hl", "mousedown", (event) =>
annotator.onAnchorMousedown event, getAnnotations event, @highlightType
annotator.addEvent ".annotator-hl", "click", (event) =>
annotator.onAnchorClick event, getAnnotations event, @highlightType
annotator.addEvent ".annotator-hl", "mouseover",
((event) => annotator.onAnchorMouseover event),
type: @highlightType
getAnnotations: (event) => getAnnotations event
annotator.addEvent ".annotator-hl", "mouseout",
((event) => annotator.onAnchorMouseout event),
type: @highlightType
getAnnotations: (event) => getAnnotations event
annotator.addEvent ".annotator-hl", "mousedown",
((event) => annotator.onAnchorMousedown event),
type: @highlightType
getAnnotations: (event) => getAnnotations event
annotator.addEvent ".annotator-hl", "click",
((event) => annotator.onAnchorClick event)
type: @highlightType
getAnnotations: (event) => getAnnotations event
@_inited.push annotator
......
// Generated by CoffeeScript 1.6.3
/*
** Annotator 1.2.6-dev-b10dad7
** Annotator 1.2.6-dev-04d1465
** https://github.com/okfn/annotator/
**
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2014-03-29 07:07:40Z
** Built at: 2014-03-31 08:53:05Z
*/
......@@ -325,9 +325,12 @@
return _results;
};
Delegator.prototype.addEvent = function(bindTo, event, functionName) {
Delegator.prototype.addEvent = function(bindTo, event, functionName, eventData) {
var closure, f, isBlankSelector,
_this = this;
if (eventData == null) {
eventData = null;
}
f = typeof functionName === 'string' ? this[functionName] : functionName;
closure = function() {
return f.apply(_this, arguments);
......@@ -337,12 +340,12 @@
bindTo = this.element;
}
if (typeof bindTo === 'string') {
this.element.delegate(bindTo, event, closure);
this.element.delegate(bindTo, event, eventData, closure);
} else {
if (this.isCustomEvent(event)) {
this.subscribe(event, closure);
} else {
$(bindTo).bind(event, closure);
$(bindTo).bind(event, eventData, closure);
}
}
return this;
......@@ -1694,21 +1697,21 @@
return _results;
};
Annotator.prototype.onAnchorMouseover = function(event, annotations, highlightType) {
Annotator.prototype.onAnchorMouseover = function(event) {
this.clearViewerHideTimer();
if (this.mouseIsDown || this.viewer.isShown()) {
return false;
}
return this.showViewer(annotations, util.mousePosition(event, this.wrapper[0]));
return this.showViewer(event.data.getAnnotations(event), util.mousePosition(event, this.wrapper[0]));
};
Annotator.prototype.onAnchorMouseout = function(event, annotations, highlightType) {
Annotator.prototype.onAnchorMouseout = function(event) {
return this.startViewerHideTimer();
};
Annotator.prototype.onAnchorMousedown = function(event, annotations, highlightType) {};
Annotator.prototype.onAnchorMousedown = function(event) {};
Annotator.prototype.onAnchorClick = function(event, annotations, highlightType) {};
Annotator.prototype.onAnchorClick = function(event) {};
return Annotator;
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2014-03-29 07:07:50Z
** Built at: 2014-03-31 08:40:00Z
*/
......@@ -55,17 +55,37 @@
});
return TextHighlight.$.makeArray(annotations);
};
annotator.addEvent(".annotator-hl", "mouseover", function(event) {
return annotator.onAnchorMouseover(event, getAnnotations(event, _this.highlightType));
annotator.addEvent(".annotator-hl", "mouseover", (function(event) {
return annotator.onAnchorMouseover(event);
}), {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
annotator.addEvent(".annotator-hl", "mouseout", function(event) {
return annotator.onAnchorMouseout(event, getAnnotations(event, _this.highlightType));
annotator.addEvent(".annotator-hl", "mouseout", (function(event) {
return annotator.onAnchorMouseout(event);
}), {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
annotator.addEvent(".annotator-hl", "mousedown", function(event) {
return annotator.onAnchorMousedown(event, getAnnotations(event, _this.highlightType));
annotator.addEvent(".annotator-hl", "mousedown", (function(event) {
return annotator.onAnchorMousedown(event);
}), {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
annotator.addEvent(".annotator-hl", "click", function(event) {
return annotator.onAnchorClick(event, getAnnotations(event, _this.highlightType));
annotator.addEvent(".annotator-hl", "click", (function(event) {
return annotator.onAnchorClick(event);
}), {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
return this._inited.push(annotator);
};
......
{"version":3,"file":"annotator.texthighlights.js","sources":["_preamble.coffee","_annotator_mapsrc/src/plugin/texthighlights.coffee"],"names":[],"mappings":";AAAA;;;;;;;;;;CAAA;CAAA;;;;;;;ACGA;CAAA,KAAA,aAAA;KAAA;;0JAAA;;CAAA,CAAM;CAIJ;;CAAA,EAAa,CAAb,KAAA,IAAC;;CAAD,EACK,CAAL,KAAc,IAAb;;CADD,EAEiB,CAAjB,SAAC,EAFD;;CAAA,EAKa,CAAb,GAAa,EAAC,CAAd,GAAC;CAA0B,GAAA,GAAD,CAAA,KAAA,CAAA;CAL1B,IAKa;;CALb,EAQuB,CAAvB,GAAuB,EAAC,IAAvB,OAAD;CACG,GAAA,GAAD,MAAA,gBAAA;CATF,IAQuB;;CARvB,CAAA,CAYU,CAAV,GAAA,MAAC;;CAZD,EAeQ,CAAR,CAAA,IAAS,IAAR;CACC,SAAA,IAAA;SAAA,GAAA;CAAA,CAAU,EAAA,EAAV,CAAU,EAAA,MAAa;CAAvB,aAAA;QAAA;CAAA,EAEiB,EAAA,CAAjB,GAAkB,KAAlB;CAEE,UAAA,CAAA;CAAA,EAAc,EAAqB,CAArB,CAAA,CAAd,CAGO,EAHP,EAA2B,EAAb;CAGJ,GAAO,QAAA,CAAa,IAAb;CAHH,QAGP;CAGO,QAAd,EAAA,EAAa,EAAb;C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IAAgB,GAAP;CAGb;;;;;CAAA;;CAAA,EAAY,MAAA,CAAZ;CAEY,EAAgB,MAAjB,IAAT;CAFF,IAAY;;CAAZ;;CAH4C,QAAS;CArIvD"}
\ No newline at end of file
{"version":3,"file":"annotator.texthighlights.js","sources":["_preamble.coffee","_annotator_mapsrc/src/plugin/texthighlights.coffee"],"names":[],"mappings":";AAAA;;;;;;;;;;CAAA;CAAA;;;;;;;ACGA;CAAA,KAAA,aAAA;KAAA;;0JAAA;;CAAA,CAAM;CAIJ;;CAAA,EAAa,CAAb,KAAA,IAAC;;CAAD,EACK,CAAL,KAAc,IAAb;;CADD,EAEiB,CAAjB,SAAC,EAFD;;CAAA,EAKa,CAAb,GAAa,EAAC,CAAd,GAAC;CAA0B,GAAA,GAAD,CAAA,KAAA,CAAA;CAL1B,IAKa;;CALb,EAQuB,CAAvB,GAAuB,EAAC,IAAvB,OAAD;CACG,GAAA,GAAD,MAAA,gBAAA;CATF,IAQuB;;CARvB,CAAA,CAYU,CAAV,GAAA,MAAC;;CAZD,EAeQ,CAAR,CAAA,IAAS,IAAR;CACC,SAAA,IAAA;SAAA,GAAA;CAAA,CAAU,EAAA,EAAV,CAAU,EAAA,MAAa;CAAvB,aAAA;QAAA;CAAA,EAEiB,EAAA,CAAjB,GAAkB,KAAlB;CAEE,UAAA,CAAA;CAAA,EAAc,EAAqB,CAArB,CAAA,CAAd,CAGO,EAHP,EAA2B,EAAb;CAGJ,GAAO,QAAA,CAAa,IAAb;CAHH,QAGP;CAGO,QAAd,EAAA,EAAa,EAAb;CAVF,MAEiB;CAFjB,CAYoC,CAChC,EAAA,CADJ,EAAA,CAAS,EAAT,IAAA;CACyB,IAAV,IAAS,MAAT,EAAA;CAAZ,CACA,KADC;CACD,CAAM,EAAN,IAAA,KAAA;CAAA,CACgB,CAAA,EAAA,GAAhB,CAAiB,KAAjB;CAA0C,IAAf,SAAA,GAAA;CAD3B,QACgB;CAfnB,OAYA;CAZA,CAiBoC,CAChC,EAAA,C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,KAAW,GAAhB;MARF,IAAA;CAAA;UAFF;CAAA;uBADkB;CAzHpB,IAyHoB;;CAzHpB,EAuIiB,MAAA,MAAjB;CAAqB,GAAA,SAAD;CAvIpB,IAuIiB;;CAvIjB;;CAJ0B,QAAS;;CAArC,CA6IM,IAAgB,GAAP;CAGb;;;;;CAAA;;CAAA,EAAY,MAAA,CAAZ;CAEY,EAAgB,MAAjB,IAAT;CAFF,IAAY;;CAAZ;;CAH4C,QAAS;CA7IvD"}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment