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. 29
      web/viewer.css
  5. 3
      web/viewer.html
  6. 4
      web/viewer.js

1
test/test.py

@ -65,6 +65,7 @@ MIMEs = { @@ -65,6 +65,7 @@ MIMEs = {
'.pdf': 'application/pdf',
'.xhtml': 'application/xhtml+xml',
'.ico': 'image/x-icon',
'.png': 'image/png',
'.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

29
web/viewer.css

@ -89,7 +89,8 @@ span#info { @@ -89,7 +89,8 @@ span#info {
z-index: 1;
}
#sidebar:hover {
#sidebar:hover,
#sidebar.pinned {
left: 0px;
transition: left 0.25s ease-in-out 0s;
-o-transition: left 0.25s ease-in-out 0s;
@ -97,6 +98,24 @@ span#info { @@ -97,6 +98,24 @@ span#info {
-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 {
background-color: rgba(0, 0, 0, 0.7);
width: 300px;
@ -116,7 +135,7 @@ span#info { @@ -116,7 +135,7 @@ span#info {
position: absolute;
overflow: hidden;
overflow-y: auto;
top: 10px;
top: 20px;
bottom: 10px;
left: 10px;
width: 280px;
@ -147,7 +166,7 @@ span#info { @@ -147,7 +166,7 @@ span#info {
position: absolute;
background-color: #fff;
overflow: auto;
top: 10px;
top: 20px;
bottom: 10px;
left: 10px;
width: 280px;
@ -381,6 +400,6 @@ canvas { @@ -381,6 +400,6 @@ canvas {
}
#loading {
margin: 100px 0;
text-align: center;
margin: 100px 0;
text-align: center;
}

3
web/viewer.html

@ -122,6 +122,7 @@ @@ -122,6 +122,7 @@
<div id="sidebar">
<div id="sidebarBox">
<div id="pinIcon" onClick="PDFView.pinSidebar()"></div>
<div id="sidebarScrollView">
<div id="sidebarView"></div>
</div>
@ -136,7 +137,7 @@ @@ -136,7 +137,7 @@
<img src="images/nav-outline.svg" align="top" height="16" alt="Document Outline" />
</button>
</div>
</div>
</div>
</div>
<div id="loading">Loading... 0%</div>

4
web/viewer.js

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

Loading…
Cancel
Save