rasvaan / accurator

Accurator cpack
7 stars 3 forks source link

Formulate specific target of annotation #205

Closed rasvaan closed 8 years ago

rasvaan commented 8 years ago

Write a function determining the specific target of a annotation, based on annotations.js:

    findTarget : function(tag) {
        result = this.findSpecificTarget(tag);
        if (result) return result;
        else return this.findGenericTarget(tag)
    },
    findSpecificTarget : function(tag) {
        var targets = tag.hasTarget;
        var target = undefined;
        if (!targets)
            return null;
        if (targets.hasSelector)
            return targets;
        for (var t in targets) {
            target = targets[t];
            if (target.hasSelector)
            return target;
        }
        return null;
    },