Commit d07ea18f authored by csillag's avatar csillag

Updated annotator to 8b9bc0e (fix-event-signature branch)

parent 022b9375
......@@ -71,7 +71,6 @@ 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
#
......@@ -83,7 +82,7 @@ class Delegator
# instance.addEvent('form :input', 'focus', 'onInputFocus')
#
# Returns itself.
addEvent: (bindTo, event, functionName, eventData = null) ->
addEvent: (bindTo, event, functionName) ->
f = if typeof functionName is 'string'
this[functionName]
else
......@@ -95,13 +94,12 @@ class Delegator
bindTo = @element if isBlankSelector
if typeof bindTo is 'string'
@element.delegate bindTo, event, eventData, closure
@element.delegate bindTo, event, closure
else
if this.isCustomEvent(event)
# TODO: no way to support eventData here?
this.subscribe event, closure
else
$(bindTo).bind event, eventData, closure
$(bindTo).bind event, closure
this
......
......@@ -33,25 +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),
annotator.element.delegate ".annotator-hl", "mouseover",
type: @highlightType
getAnnotations: (event) => getAnnotations event
getAnnotations: (event) => getAnnotations event,
((event) => annotator.onAnchorMouseover event)
annotator.addEvent ".annotator-hl", "mouseout",
((event) => annotator.onAnchorMouseout event),
annotator.element.delegate ".annotator-hl", "mouseout",
type: @highlightType
getAnnotations: (event) => getAnnotations event
getAnnotations: (event) => getAnnotations event,
((event) => annotator.onAnchorMouseout event)
annotator.addEvent ".annotator-hl", "mousedown",
((event) => annotator.onAnchorMousedown event),
annotator.element.delegate ".annotator-hl", "mousedown",
type: @highlightType
getAnnotations: (event) => getAnnotations event
getAnnotations: (event) => getAnnotations event,
((event) => annotator.onAnchorMousedown event)
annotator.addEvent ".annotator-hl", "click",
((event) => annotator.onAnchorClick event)
annotator.element.delegate ".annotator-hl", "click",
type: @highlightType
getAnnotations: (event) => getAnnotations event
getAnnotations: (event) => getAnnotations event,
((event) => annotator.onAnchorClick event)
@_inited.push annotator
......
......@@ -7,7 +7,7 @@
** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE
**
** Built at: 2014-03-31 08:53:05Z
** Built at: 2014-03-31 18:03:10Z
*/
......@@ -325,12 +325,9 @@
return _results;
};
Delegator.prototype.addEvent = function(bindTo, event, functionName, eventData) {
Delegator.prototype.addEvent = function(bindTo, event, functionName) {
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);
......@@ -340,12 +337,12 @@
bindTo = this.element;
}
if (typeof bindTo === 'string') {
this.element.delegate(bindTo, event, eventData, closure);
this.element.delegate(bindTo, event, closure);
} else {
if (this.isCustomEvent(event)) {
this.subscribe(event, closure);
} else {
$(bindTo).bind(event, eventData, closure);
$(bindTo).bind(event, closure);
}
}
return this;
......
This diff is collapsed.
// 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-31 08:40:00Z
** Built at: 2014-03-31 18:02:58Z
*/
......@@ -55,38 +55,38 @@
});
return TextHighlight.$.makeArray(annotations);
};
annotator.addEvent(".annotator-hl", "mouseover", (function(event) {
return annotator.onAnchorMouseover(event);
}), {
annotator.element.delegate(".annotator-hl", "mouseover", {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
annotator.addEvent(".annotator-hl", "mouseout", (function(event) {
return annotator.onAnchorMouseout(event);
}), {
}, (function(event) {
return annotator.onAnchorMouseover(event);
}));
annotator.element.delegate(".annotator-hl", "mouseout", {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
annotator.addEvent(".annotator-hl", "mousedown", (function(event) {
return annotator.onAnchorMousedown(event);
}), {
}, (function(event) {
return annotator.onAnchorMouseout(event);
}));
annotator.element.delegate(".annotator-hl", "mousedown", {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
annotator.addEvent(".annotator-hl", "click", (function(event) {
return annotator.onAnchorClick(event);
}), {
}, (function(event) {
return annotator.onAnchorMousedown(event);
}));
annotator.element.delegate(".annotator-hl", "click", {
type: this.highlightType,
getAnnotations: function(event) {
return getAnnotations(event);
}
});
}, (function(event) {
return annotator.onAnchorClick(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,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ACE,SAAA,gCAAA;CAAA;CAAA;YAAA,+BAAA;uBAAA;CAEE,GAAG,IAAH,CAAgC,GAAV,WAAnB;CAED,CAAU,CAAF,EAAR,KAAA;CAAA,CACA,EAAC,MAAD,CAAA;CADA,EAGQ,EAAR,GAAgB,EAAhB,CAAQ;CAHR,CAI+B,EAA/B,CAAK,CAAL,IAAA,CAAA;CAJA,EAKe,EAAV,CAAL,IAAA,2BALA;CAAA,IAMK,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
{"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,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F,EAAA;CAGG,GAAA,OAAD,IAAA,SAAA;QALU;CA1Gd,IA0Gc;;CA1Gd,EAkHW,EAAA,IAAX;CACE,GAAG,CAAH,CAAA;CACG,GAAA,IAAD,GAAA,IAAA,MAAA;MADF,EAAA;CAGG,GAAA,OAAD,IAAA,MAAA;QAJO;CAlHX,IAkHW;;CAlHX,EAyHoB,MAAA,SAApB;CACE,SAAA,gCAAA;CAAA;CAAA;YAAA,+BAAA;uBAAA;CAEE,GAAG,IAAH,CAAgC,GAAV,WAAnB;CAED,CAAU,CAAF,EAAR,KAAA;CAAA,CACA,EAAC,MAAD,CAAA;CADA,EAGQ,EAAR,GAAgB,EAAhB,CAAQ;CAHR,CAI+B,EAA/B,CAAK,CAAL,IAAA,CAAA;CAJA,EAKe,EAAV,CAAL,IAAA,2BALA;CAAA,IAMK,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