You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by sz...@apache.org on 2011/09/02 13:38:27 UTC
svn commit: r1164484 - in
/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static:
annotate.coffee lib/annotate.js
Author: szabyg
Date: Fri Sep 2 11:38:27 2011
New Revision: 1164484
URL: http://svn.apache.org/viewvc?rev=1164484&view=rev
Log:
Updating the annotate.js widget. For details see https://github.com/szabyg/annotate.js
Modified:
incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js
Modified: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee?rev=1164484&r1=1164483&r2=1164484&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee (original)
+++ incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/annotate.coffee Fri Sep 2 11:38:27 2011
@@ -327,7 +327,7 @@
# Remove all not accepted text enhancement widgets
disable: ->
$( ':IKS-annotationSelector', @element ).each () ->
- $(@).annotationSelector 'disable'
+ $(@).annotationSelector 'disable' if $(@).data().annotationSelector
# processTextEnhancement deals with one TextEnhancement in an ancestor element of its occurrence
processTextEnhancement: (textEnh, parentEl) ->
@@ -340,7 +340,7 @@
context: textEnh.getContext()
start: textEnh.getStart()
end: textEnh.getEnd()
- sType = textEnh.getType()
+ sType = textEnh.getType() or "Other"
widget = @
el.addClass('entity')
.addClass ANTT.uriSuffix(sType).toLowerCase()
@@ -437,7 +437,7 @@
@dialog.element.remove()
@dialog.uiDialogTitlebar.remove()
delete @dialog
-
+
# Produce type label list out of a uri list.
# Filtered by the @options.types list
_typeLabels: (types) ->
@@ -543,11 +543,11 @@
# Place the annotation on the DOM element (about and typeof attributes)
annotate: (entityEnhancement, styleClass) ->
entityUri = entityEnhancement.getUri()
- entityType = entityEnhancement.getTextEnhancement().getType()
+ entityType = entityEnhancement.getTextEnhancement().getType() or ""
entityHtml = @element.html()
# We ignore the old style classes
# entityClass = @element.attr 'class'
- sType = entityEnhancement.getTextEnhancement().getType()
+ sType = entityEnhancement.getTextEnhancement().getType() or ""
entityClass = 'entity ' + ANTT.uriSuffix(sType).toLowerCase()
newElement = $ "<a href='#{entityUri}'
about='#{entityUri}'
@@ -614,7 +614,7 @@
@_logger.info 'rendered menu for the elements', entityEnhancements
_renderItem: (ul, eEnhancement) ->
label = eEnhancement.getLabel().replace /^\"|\"$/g, ""
- type = @_typeLabels eEnhancement.getTypes()
+ type = @_typeLabels(eEnhancement.getTypes()).toString() or "Other"
source = @_sourceLabel eEnhancement.getUri()
active = if @linkedEntity and eEnhancement.getUri() is @linkedEntity.uri
" class='ui-state-active'"
Modified: incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js?rev=1164484&r1=1164483&r2=1164484&view=diff
==============================================================================
--- incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js (original)
+++ incubator/stanbol/trunk/commons/web/webvie/src/main/resources/org/apache/stanbol/enhancer/webvie/static/lib/annotate.js Fri Sep 2 11:38:27 2011
@@ -351,7 +351,9 @@
},
disable: function() {
return $(':IKS-annotationSelector', this.element).each(function() {
- return $(this).annotationSelector('disable');
+ if ($(this).data().annotationSelector) {
+ return $(this).annotationSelector('disable');
+ }
});
},
processTextEnhancement: function(textEnh, parentEl) {
@@ -367,7 +369,7 @@
start: textEnh.getStart(),
end: textEnh.getEnd()
}));
- sType = textEnh.getType();
+ sType = textEnh.getType() || "Other";
widget = this;
el.addClass('entity').addClass(ANTT.uriSuffix(sType).toLowerCase());
if (textEnh.getEntityEnhancements().length) {
@@ -605,9 +607,9 @@
annotate: function(entityEnhancement, styleClass) {
var entityClass, entityHtml, entityType, entityUri, newElement, sType;
entityUri = entityEnhancement.getUri();
- entityType = entityEnhancement.getTextEnhancement().getType();
+ entityType = entityEnhancement.getTextEnhancement().getType() || "";
entityHtml = this.element.html();
- sType = entityEnhancement.getTextEnhancement().getType();
+ sType = entityEnhancement.getTextEnhancement().getType() || "";
entityClass = 'entity ' + ANTT.uriSuffix(sType).toLowerCase();
newElement = $("<a href='" + entityUri + "' about='" + entityUri + "' typeof='" + entityType + "' class='" + entityClass + "'>" + entityHtml + "</a>");
ANTT.cloneCopyEvent(this.element[0], newElement[0]);
@@ -680,7 +682,7 @@
_renderItem: function(ul, eEnhancement) {
var active, label, source, type;
label = eEnhancement.getLabel().replace(/^\"|\"$/g, "");
- type = this._typeLabels(eEnhancement.getTypes());
+ type = this._typeLabels(eEnhancement.getTypes()).toString() || "Other";
source = this._sourceLabel(eEnhancement.getUri());
active = this.linkedEntity && eEnhancement.getUri() === this.linkedEntity.uri ? " class='ui-state-active'" : "";
return $("<li" + active + "><a href='#'>" + label + " <small>(" + type + " from " + source + ")</small></a></li>").data('enhancement', eEnhancement).appendTo(ul);