Skip to content
Permalink
Browse files

Some code linting and todo

  • Loading branch information
raffaelemasotti committed Oct 7, 2015
1 parent 2eaeb43 commit 82b670a595cd6b53e509992338e8f622b4a9d841
@@ -659,7 +659,9 @@ module.exports = function(grunt) {
},
"predef": [
"waitsFor",
"runs"
"runs",
"element",
"by"
]
},
tests: {
@@ -87,7 +87,7 @@ angular.module('Pundit2.AnnotationSidebar')
overActiveId = '',
highlightFragments = [];

var modalTimeoutPromise;
// var modalTimeoutPromise;

ContextualMenu.addAction({
type: [
@@ -62,7 +62,7 @@ angular.module('Pundit2.AnnotationSidebar')
$scope.fromMaxDate = new Date();
$scope.fromToDate = new Date();

$scope.proMode = clientMode === 'pro';
$scope.proMode = clientMode === 'pro';

body.css('position', 'static');
container.css('height', body.innerHeight() + 'px');
@@ -536,7 +536,7 @@ angular.module('Pundit2.AnnotationSidebar')
annotationId = e.args;

annotationsQueques[eventType].push(annotationId);
EventDispatcher.sendEvent('AnnotationSidebar.forceUpdate');
EventDispatcher.sendEvent('AnnotationSidebar.forceUpdate');
}
);

@@ -559,7 +559,7 @@ angular.module('Pundit2.AnnotationSidebar')
EventDispatcher.addListener('TextFragmentAnnotator.updateItems', function(e) {
var updatedItems = e.args,
updatedAnnotations = {};

angular.forEach(updatedItems, function(itemUri) {
var annList = AnnotationsExchange.getAnnotationsByItem(itemUri);
for (var i in annList) {
@@ -571,7 +571,7 @@ angular.module('Pundit2.AnnotationSidebar')
if (typeof $scope.annotations[annotation.id] !== 'undefined') {
activateFragments(annotation.items);
}
})
});
});

angular.element($window).bind('resize', function() {
@@ -172,10 +172,10 @@ angular.module('Pundit2.Annotators')
fragments,
elemFragments = elem.attr('fragments'),
cleanElemFragments = elemFragments.replace(fragmentId, '').split(',').filter(function(s) {
return s.length > 0
return s.length > 0;
}).join(','),
elemTempFragments = elem.attr('temp-fragments'),
cleanTempFragmentsA = [],
// cleanTempFragmentsA = [],
cleanElemFragmentsA = cleanElemFragments.split(','),
mergeWithPrev = false,
frIntersectWithPrev = false,
@@ -186,9 +186,9 @@ angular.module('Pundit2.Annotators')

if (typeof elemTempFragments !== 'undefined') {
elemTempFragments = elemTempFragments.replace(fragmentId, '').split(',').filter(function(s) {
return s.length > 0
}).join(',')
elemTempFragments = elemTempFragments.length == 0 ? undefined : elemTempFragments;
return s.length > 0;
}).join(',');
elemTempFragments = elemTempFragments.length === 0 ? undefined : elemTempFragments;
}

// #1 TEXT<SPAN>TEXT
@@ -214,7 +214,7 @@ angular.module('Pundit2.Annotators')
} else {
// Check if prev fragments list intersects with current element fragments list purged by fragmentId
fragmentIntersection = fragments.split(',').filter(function(n) {
return cleanElemFragmentsA.indexOf(n) !== -1
return cleanElemFragmentsA.indexOf(n) !== -1;
});
frIntersectWithPrev = fragmentIntersection.length !== 0;
}
@@ -230,7 +230,7 @@ angular.module('Pundit2.Annotators')
} else {
// Check if next fragments list intersects with current element fragments list purged by fragmentId
fragmentIntersection = fragments.split(',').filter(function(n) {
return cleanElemFragmentsA.indexOf(n) !== -1
return cleanElemFragmentsA.indexOf(n) !== -1;
});
frIntersectWithNext = fragmentIntersection.length !== 0;
}
@@ -274,13 +274,13 @@ angular.module('Pundit2.Annotators')
if (tempFragments.length > 0) {
var tempObj = {};
tempFragments.forEach(function(e) {
tempObj[e] = true
tempObj[e] = true;
});
tempFragments = Object.keys(tempObj);
wrapNode.jElement.attr('temp-fragments', tempFragments.join(','));
wrapNode.jElement.addClass(XpointersHelper.options.tempWrapNodeClass);
}
elementsToRemove.forEach(function(e, i) {
elementsToRemove.forEach(function(e) {
e.remove();
});
angular.extend(mod, modObj);
@@ -367,8 +367,8 @@ angular.module('Pundit2.Annotators')
// TODO: refactor!!
angular.forEach(Object.keys(modifiedFragmentsId), function(fr) {
var currentUri = fragmentById[fr].uri,
currentReferences = angular.element('.' + fr),
referencesList = [];
currentReferences = angular.element('.' + fr),
referencesList = [];

currentReferences.each(function(i) {
referencesList.unshift(currentReferences.eq(i));
@@ -118,7 +118,9 @@ angular.module('Pundit2.Communication')
var ann = annListById[id];
for (var uri in ann.items) {
if (typeof annByItemUri[uri] !== 'undefined') {
annByItemUri[uri] = annByItemUri[uri].filter(function(e) {return e.id !== id;});
annByItemUri[uri] = annByItemUri[uri].filter(function(e) {
return e.id !== id;
});
if (annByItemUri[uri].length === 0) {
delete annByItemUri[uri];
}
@@ -132,11 +134,12 @@ angular.module('Pundit2.Communication')
}
};

annotationExchange.updateAnnotationStructureInfo = function(id) {
if (id in annListById) {
var ann = annListById[id];
}
};
// TODO: full structure update
// annotationExchange.updateAnnotationStructureInfo = function(id) {
// if (id in annListById) {
// var ann = annListById[id];
// }
// };

annotationExchange.getAnnotations = function() {
return annList;
@@ -133,7 +133,7 @@ angular.module('Pundit2.Core')
linking: _oa + 'linking',
tagging: _oa + 'tagging',
commenting: _oa + 'commenting'
}
};

// TODO: move to Consolidation.options ??
// Consolidation use this to know what items are consolidable
@@ -1,5 +1,6 @@
angular.module('Pundit2.FragmentPopover')
.service('FragmentPopover', function(BaseComponent, PndPopover, $window) {

.service('FragmentPopover', function(BaseComponent, PndPopover) {
var fragmentPopover = new BaseComponent('FragmentPopover');

fragmentPopover.show = function(x, y, data) {
@@ -44,7 +44,7 @@ angular.module('Pundit2.LiteTool')
debug: false
})

.service('LiteTool', function(BaseComponent, EventDispatcher, LITETOOLDEFAULTS, Config, MyPundit) {
.service('LiteTool', function(BaseComponent, EventDispatcher, LITETOOLDEFAULTS/*, Config, MyPundit*/) {

var liteTool = new BaseComponent('LiteTool', LITETOOLDEFAULTS);

0 comments on commit 82b670a

Please sign in to comment.
You can’t perform that action at this time.