]> git.parisson.com Git - pdf.js.git/commitdiff
Lint nits
authorSaebekassebil <saebekassebil@gmail.com>
Wed, 21 Dec 2011 22:37:52 +0000 (23:37 +0100)
committerSaebekassebil <saebekassebil@gmail.com>
Wed, 21 Dec 2011 22:37:52 +0000 (23:37 +0100)
src/core.js
web/viewer.js

index f78b4f7ecf7011a76cef9a7a5a082a478793c2f6..e28ec4d21aebfddaed34c5598f634bae65444fce 100644 (file)
@@ -383,12 +383,12 @@ var Page = (function PageClosure() {
           case 'Text':
             var content = annotation.get('Contents');
             var title = annotation.get('T');
-            item.content = (typeof content == 'string') ? stringToPDFString(content) : null;
-            item.title = (typeof title == 'string') ? stringToPDFString(title) : null;
+            item.content = stringToPDFString(content || '');
+            item.title = stringToPDFString(title || '');
             item.name = annotation.get('Name').name;
             break;
 
-          default: 
+          default:
             TODO('unimplemented annotation type: ' + subtype.name);
             break;
         }
index eba6d93e65abe85ff38b0b7bbe19be1dbfefe7cf..533a84dc374a82a1e823075018dea368d8ccc107 100644 (file)
@@ -476,7 +476,7 @@ var PageView = function pageView(container, content, id, pageWidth, pageHeight,
       return element;
     }
     function createCommentAnnotation(type, item) {
-      var annotContainer = document.createElement('section'); 
+      var annotContainer = document.createElement('section');
       annotContainer.className = 'annotComment';
 
       var annotImage = createElementWithStyle('div', item);
@@ -486,20 +486,21 @@ var PageView = function pageView(container, content, id, pageWidth, pageHeight,
       var annotTitle = document.createElement('h1');
       var annotContent = document.createElement('p');
 
-      annotDetails.style.left = (Math.floor(item.x - view.x + item.width) * scale) + 'px';
+      var offsetPos = Math.floor(item.x - view.x + item.width);
+      annotDetails.style.left = (offsetPos * scale) + 'px';
       annotDetails.style.top = (Math.floor(item.y - view.y) * scale) + 'px';
       annotTitle.textContent = item.title;
 
-      if(!item.content) {
+      if (!item.content) {
         annotContent.style.display = 'none';
       } else {
         annotContent.innerHTML = item.content.replace('\n', '<br />');
         annotImage.addEventListener('mouseover', function() {
-           this.nextSibling.style.display = 'block'; 
+           this.nextSibling.style.display = 'block';
         }, true);
 
         annotImage.addEventListener('mouseout', function() {
-           this.nextSibling.style.display = 'none'; 
+           this.nextSibling.style.display = 'none';
         }, true);
       }
 
@@ -526,7 +527,7 @@ var PageView = function pageView(container, content, id, pageWidth, pageHeight,
         case 'Text':
         case 'Check':
           var comment = createCommentAnnotation(item.name, item);
-          if(comment)
+          if (comment)
             div.appendChild(comment);
           break;
       }