]> git.parisson.com Git - pdf.js.git/commitdiff
No need to be paranoid, the code isn't going to contain both classes at once unless...
authorgigaherz <gigaherz@gmail.com>
Fri, 10 Feb 2012 16:34:38 +0000 (17:34 +0100)
committergigaherz <gigaherz@gmail.com>
Fri, 10 Feb 2012 16:34:38 +0000 (17:34 +0100)
web/viewer.js

index e0822990b4e36525afcd57de421a21c211be2750..a108591d42d345557fa85a3dd576cf1589199801 100644 (file)
@@ -576,18 +576,20 @@ var PDFView = {
     var sidebar = document.getElementById('sidebar');
     var pinIcon = document.getElementById('pinIcon');
 
-    sidebar.classList.remove('released');
-    pinIcon.classList.remove('released');
-    sidebar.classList.remove('pinned');
-    pinIcon.classList.remove('pinned');
+    var oldClass = 'released';
+    var newClass = 'pinned';
 
-    this.pinState = !this.pinState;
-
-    var newClass = this.pinState ? 'pinned' : 'released';
+    if (this.pinState) {
+      oldClass = 'pinned';
+      newClass = 'released';
+    }
 
+    sidebar.classList.remove(oldClass);
+    pinIcon.classList.remove(oldClass);
     sidebar.classList.add(newClass);
     pinIcon.classList.add(newClass);
 
+    this.pinState = !this.pinState;
   },
 
   getVisiblePages: function pdfViewGetVisiblePages() {