Browse Source

Merge pull request #1179 from gigaherz/sidebar-pinning

Implement sidebar pinning
notmasteryet 13 years ago
parent
commit
27b9ae79ee
  1. 1
      test/test.py
  2. BIN
      web/images/pin_down.png
  3. BIN
      web/images/pin_up.png
  4. 25
      web/viewer.css
  5. 1
      web/viewer.html
  6. 4
      web/viewer.js

1
test/test.py

@ -65,6 +65,7 @@ MIMEs = {
'.pdf': 'application/pdf', '.pdf': 'application/pdf',
'.xhtml': 'application/xhtml+xml', '.xhtml': 'application/xhtml+xml',
'.ico': 'image/x-icon', '.ico': 'image/x-icon',
'.png': 'image/png',
'.log': 'text/plain' '.log': 'text/plain'
} }

BIN
web/images/pin_down.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
web/images/pin_up.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

25
web/viewer.css

@ -89,7 +89,8 @@ span#info {
z-index: 1; z-index: 1;
} }
#sidebar:hover { #sidebar:hover,
#sidebar.pinned {
left: 0px; left: 0px;
transition: left 0.25s ease-in-out 0s; transition: left 0.25s ease-in-out 0s;
-o-transition: left 0.25s ease-in-out 0s; -o-transition: left 0.25s ease-in-out 0s;
@ -97,6 +98,24 @@ span#info {
-webkit-transition: left 0.25s ease-in-out 0s; -webkit-transition: left 0.25s ease-in-out 0s;
} }
#pinIcon {
position: absolute;
top: 4px;
right: 55px;
width: 15px;
height: 15px;
background: center no-repeat;
background-image: url('images/pin_up.png');
}
#pinIcon:hover {
background-color: rgba(255,255,255,0.35);
}
#sidebar.pinned #pinIcon {
background-image: url('images/pin_down.png');
}
#sidebarBox { #sidebarBox {
background-color: rgba(0, 0, 0, 0.7); background-color: rgba(0, 0, 0, 0.7);
width: 300px; width: 300px;
@ -116,7 +135,7 @@ span#info {
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
overflow-y: auto; overflow-y: auto;
top: 10px; top: 20px;
bottom: 10px; bottom: 10px;
left: 10px; left: 10px;
width: 280px; width: 280px;
@ -147,7 +166,7 @@ span#info {
position: absolute; position: absolute;
background-color: #fff; background-color: #fff;
overflow: auto; overflow: auto;
top: 10px; top: 20px;
bottom: 10px; bottom: 10px;
left: 10px; left: 10px;
width: 280px; width: 280px;

1
web/viewer.html

@ -122,6 +122,7 @@
<div id="sidebar"> <div id="sidebar">
<div id="sidebarBox"> <div id="sidebarBox">
<div id="pinIcon" onClick="PDFView.pinSidebar()"></div>
<div id="sidebarScrollView"> <div id="sidebarScrollView">
<div id="sidebarView"></div> <div id="sidebarView"></div>
</div> </div>

4
web/viewer.js

@ -571,6 +571,10 @@ var PDFView = {
} }
}, },
pinSidebar: function pdfViewPinSidebar() {
document.getElementById('sidebar').classList.toggle('pinned');
},
getVisiblePages: function pdfViewGetVisiblePages() { getVisiblePages: function pdfViewGetVisiblePages() {
var pages = this.pages; var pages = this.pages;
var kBottomMargin = 10; var kBottomMargin = 10;

Loading…
Cancel
Save