| <!DOCTYPE HTML> |
| <html i18n-values="dir:textdirection;"> |
| <head> |
| <meta charset="utf-8"> |
| <title>Slideshow</title> |
| <style> |
| |
| body { |
| overflow: hidden; |
| background: black; |
| } |
| |
| #glow { |
| left: 0; |
| right: 0; |
| bottom: 30px; |
| height: 8px; |
| opacity: .4; |
| position: absolute; |
| background: -webkit-linear-gradient(transparent, white); |
| } |
| |
| #main { |
| position: absolute; |
| left: 0; |
| right:0; |
| top: 0; |
| bottom: 30px; |
| overflow: hidden; |
| } |
| |
| #playercontrols { |
| bottom: 0; |
| left: 0; |
| z-index: 999; |
| height: 30px; |
| opacity: .9; |
| right: 0; |
| align:center; |
| -webkit-box-align: center; |
| -webkit-box-pack: center; |
| display: -webkit-box; |
| position: absolute; |
| background: -webkit-linear-gradient(#323232, #070707); |
| } |
| |
| #prevbutton > div { |
| background: url('shared/images/mediaplayer_prev.png'); |
| background-repeat: no-repeat; |
| background-position: 4px 8px; |
| width: 100%; |
| height: 30px; |
| z-index: 9999; |
| } |
| |
| .currentpicture { |
| width: 100%; |
| height: 100%; |
| position: absolute; |
| top: 0; |
| -webkit-transition-property: left; |
| -webkit-transition-duration: 1s; |
| display: -webkit-box; |
| -webkit-box-align: center; |
| -webkit-box-pack: center; |
| pointer-events: none; |
| } |
| |
| .comingfromleft { |
| left: -100%; |
| } |
| |
| .comingfromright { |
| left: 100%; |
| } |
| |
| #nextbutton > div { |
| background: url('shared/images/mediaplayer_next.png'); |
| background-repeat: no-repeat; |
| background-position: 4px 8px; |
| width: 100%; |
| height: 30px; |
| z-index: 9999; |
| } |
| |
| button { |
| z-index: 9999; |
| cursor: pointer; |
| width: 28px; |
| height: 30px; |
| webkit-appearance: none; |
| padding: 0; |
| border: 0; |
| background: transparent; |
| } |
| |
| button:hover { |
| background: -webkit-linear-gradient(#6a7eac, #000000); |
| } |
| |
| </style> |
| <script src="shared/js/local_strings.js"></script> |
| <script src="shared/js/media_common.js"></script> |
| <script> |
| |
| document.addEventListener('DOMContentLoaded', load); |
| |
| document.onselectstart = function(e) { |
| e.preventDefault(); |
| }; |
| |
| function $(o) { |
| return document.getElementById(o); |
| } |
| |
| /////////////////////////////////////////////////////////////////////////////// |
| // Document Functions: |
| |
| var currentPicture = null; |
| var prevPicture = null; |
| var currentFileOffset = 0; |
| var filelist; |
| var moveRight = false; |
| var lastimg = null; |
| |
| function loadedPicture() { |
| if (prevPicture) { |
| if (moveRight) { |
| prevPicture.style.left = '-100%'; |
| } else { |
| prevPicture.style.left = '100%'; |
| } |
| } |
| if (window.innerHeight < lastimg.height || |
| window.innerWidth < lastimg.width) { |
| if (lastimg.width > lastimg.height) { |
| lastimg.style.height = 'auto'; |
| lastimg.style.width = '100%'; |
| } else { |
| lastimg.style.width = 'auto'; |
| lastimg.style.height = '100%'; |
| } |
| } |
| setTimeout(function() { |
| currentPicture.style.left = '0'; |
| }, 10); |
| } |
| |
| function transitionTo(path, fromTheRight) { |
| if (currentPicture) { |
| if (prevPicture) { |
| $('main').removeChild(prevPicture); |
| } |
| prevPicture = currentPicture; |
| } |
| |
| currentPicture = document.createElement('div'); |
| |
| $('main').appendChild(currentPicture); |
| if (fromTheRight) { |
| currentPicture.className = 'currentpicture comingfromright'; |
| } else { |
| currentPicture.className = 'currentpicture comingfromleft'; |
| } |
| var image = document.createElement('img'); |
| lastimg = image; |
| image.onload = loadedPicture; |
| image.onerror = loadedPicture; |
| document.location.hash = path; |
| image.src = 'file://' + path; |
| currentPicture.appendChild(image); |
| moveRight = fromTheRight; |
| } |
| |
| function browseFileResult(info, results) { |
| filelist = results; |
| if (info.currentOffset) { |
| currentFileOffset = info.currentOffset; |
| } else { |
| currentFileOffset = 0; |
| } |
| transitionTo(filelist[currentFileOffset].path, true); |
| } |
| |
| function keyPressed(e) { |
| // Left Pressed |
| if (e.keyCode == 37) { |
| if (currentFileOffset > 0) { |
| currentFileOffset--; |
| transitionTo(filelist[currentFileOffset].path, false); |
| } |
| } |
| // Right Pressed |
| if (e.keyCode == 39) { |
| if (currentFileOffset < (filelist.length - 1)) { |
| currentFileOffset++; |
| transitionTo(filelist[currentFileOffset].path, true); |
| } |
| } |
| } |
| |
| function load() { |
| localStrings = new LocalStrings(); |
| |
| document.onkeydown = keyPressed; |
| if (document.location.href.indexOf('#') != -1) { |
| var currentpathArray = document.location.href.split('#'); |
| var path = currentpathArray[1]; |
| chrome.send('getChildren', [path]); |
| } |
| } |
| |
| function prevButtonClick() { |
| if (currentFileOffset > 0) { |
| currentFileOffset--; |
| transitionTo(filelist[currentFileOffset].path, false); |
| } |
| } |
| |
| function nextButtonClick() { |
| if (currentFileOffset < (filelist.length - 1)) { |
| currentFileOffset++; |
| transitionTo(filelist[currentFileOffset].path, true); |
| } |
| } |
| |
| function toggleFullscreen() { |
| chrome.send('toggleFullscreen', ['']); |
| } |
| |
| </script> |
| <body> |
| <div id="main"></div> |
| <div id="glow"></div> |
| <div id="playercontrols"> |
| <button id="prevbutton" onclick="prevButtonClick()"> |
| <div></div> |
| </button> |
| <button id="nextbutton" onclick="nextButtonClick()"> |
| <div></div> |
| </button> |
| </div> |
| </body> |
| </html> |