Removing slideshow.html


BUG=chromium-os:23750
TEST=


Review URL: http://codereview.chromium.org/8821017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113251 0039d316-1c4b-4281-b951-d872f2087c98
parent 41f31d14
......@@ -25,7 +25,6 @@
<if expr="pp_ifdef('file_manager_extension')">
<include name="IDR_FILE_MANAGER_MAIN" file="file_manager/main.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_FILE_MANAGER_SLIDESHOW" file="file_manager/slideshow.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_FILE_MANAGER_MEDIAPLAYER" file="file_manager/mediaplayer.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_FILE_MANAGER_PLAYLIST" file="file_manager/playlist.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_FILE_MANAGER_IMAGE_EDITOR" file="file_manager/js/image_editor/gallery.html" flattenhtml="true" type="BINDATA" />
......
<!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;
-webkit-transform: translateZ(0);
}
#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('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('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="chrome://resources/js/local_strings.js"></script>
<script src="chrome://resources/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(filePath, 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;
image.src = filePath;
currentPicture.appendChild(image);
moveRight = fromTheRight;
}
function browseFileResult() {
currentFileOffset = 0;
if (filelist.length > 0) {
transitionTo(filelist[currentFileOffset], true);
}
}
function keyPressed(e) {
// Left Pressed
if (e.keyCode == 37) {
if (currentFileOffset > 0) {
currentFileOffset--;
transitionTo(filelist[currentFileOffset], false);
}
}
// Right Pressed
if (e.keyCode == 39) {
if (currentFileOffset < (filelist.length - 1)) {
currentFileOffset++;
transitionTo(filelist[currentFileOffset], true);
}
}
}
/**
* Pattern of siblibng files to be shown. It should match exactly the same files
* that matches the appropriate "file_filters" section in the manifest. We want
* to avoid situation whan a file is accessible via "prev"/"next" button but not
* accessible via the File Browser directly (and vise versa).
*/
const imageFilesPattern = /\.(jpg|jpeg|png|gif|webp|JPG|JPEG|PNG|GIF|WEBP)$/;
/**
* Loads directory siblings of the file what match the filePattern.
* Sets filelist. Sets currentFileOffset to index of the fileUrl.
* @param {string} fileUrl The file to show.
*/
function loadDirectorySiblings(fileUrl) {
var fileUrlFixed;
webkitResolveLocalFileSystemURL(fileUrl, function(entry) {
fileUrlFixed = entry.toURL(); // Make sure the URL has canonical shape.
entry.getParent(function(entry) {
readAllEntries(entry.createReader());
}, onError);
}, onError);
function readAllEntries(directoryReader) {
directoryReader.readEntries(function(entries) {
if (entries.length > 0) {
onReadSome(entries);
readAllEntries(directoryReader);
} else {
onReadDone();
}
}, onError);
}
function onError() {
console.error('Error reading directory content');
}
var siblings = [];
function onReadSome(entries) {
for (var i = 0; i < entries.length; i++) {
var entry = entries[i];
if (entry.isFile && imageFilesPattern.test(entry.name)) {
siblings.push(entry.toURL());
}
}
}
function onReadDone() {
// Only change the filelist if siblings have read successfully.
if (siblings.indexOf(fileUrl) >= 0) {
filelist = siblings;
currentFileOffset = filelist.indexOf(fileUrlFixed);
}
}
}
function load() {
localStrings = new LocalStrings();
var views = chrome.extension.getViews();
for (var i = 0; i < views.length; i++) {
if (views[i].g_slideshow_data) {
filelist = views[i].g_slideshow_data;
views[i].g_slideshow_data = null;
// If selected exactly one file allow user to navigate to
// directory siblings.
if (filelist && filelist.length == 1) loadDirectorySiblings(filelist[0]);
}
}
browseFileResult();
}
function prevButtonClick() {
if (currentFileOffset > 0) {
currentFileOffset--;
transitionTo(filelist[currentFileOffset], false);
}
}
function nextButtonClick() {
if (currentFileOffset < (filelist.length - 1)) {
currentFileOffset++;
transitionTo(filelist[currentFileOffset], true);
}
}
</script>
<body onkeydown="keyPressed(event)">
<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>
<!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>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment