/usr/share/horde/ansel/js/slideshow.js is in php-horde-ansel 3.0.5+debian0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | /**
* You can only have one SlideController on a page.
*/
var SlideController = {
photos: null,
photoId: 0,
slide: null,
interval: null,
intervalSeconds: 5,
/**
* CSS border size x 2
*/
borderSize: 0,
/**
* So we can update the links
*/
baseUrl: null,
galleryId: 0,
playing: false,
interval: null,
tempImage: new Image(),
/**
* Initialization.
*/
initialize: function(photos, start, baseUrl, galleryId)
{
SlideController.photoId = start || 0;
SlideController.baseUrl = baseUrl;
SlideController.galleryId = galleryId;
Event.observe(window, 'load', function() {
SlideController.photos = photos;
SlideController.photo = new Slide(SlideController.photoId);
Event.observe(SlideController.tempImage, 'load', function() {
SlideController.photo.initSwap(SlideController.tempImage.width, SlideController.tempImage.height);
});
Event.observe($(SlideController.photo.photo), 'load', function() {
SlideController.photo.showPhoto();
});
SlideController.photo.initSwap();
SlideController.play();
});
},
/**
* Play the slideshow.
*/
play: function()
{
$('ssPlay').hide();
$('ssPause').show();
// This sets the first interval for the currently displayed image.
if (SlideController.interval) {
clearTimeout(SlideController.interval);
}
SlideController.interval = setTimeout(SlideController.next, SlideController.intervalSeconds * 1000);
SlideController.playing = true;
},
/**
* Leaving this in here, but currently we just redirect back to the Image view
*/
pause: function()
{
$('ssPause').hide();
$('ssPlay').show();
if (SlideController.interval) {
clearTimeout(SlideController.interval);
}
SlideController.playing = false;
},
/**
* Move to previous image.
*/
prev: function()
{
SlideController.photo.prevPhoto();
},
/**
* Move to next image.
*/
next: function()
{
SlideController.photo.nextPhoto();
}
}
// -----------------------------------------------------------------------------------
//
// This page coded by Scott Upton
// http://www.uptonic.com | http://www.couloir.org
//
// This work is licensed under a Creative Commons License
// Attribution-ShareAlike 2.0
// http://creativecommons.org/licenses/by-sa/2.0/
//
// Associated APIs copyright their respective owners
//
// -----------------------------------------------------------------------------------
// --- version date: 11/28/05 --------------------------------------------------------
//
// Various changes for properly updating image links, image comments, get rid
// of redundant functions that prototype can take care of etc...
// added 4/07 by Michael Rubinsky <mrubinsk@horde.org>
var Slide = Class.create();
Slide.prototype =
{
initialize: function(photoId)
{
this.photoId = photoId;
this.photo = 'anselphoto';
this.captionBox = 'anselcaptioncontainer';
this.caption = 'anselcaption';
},
setNewPhotoParams: function()
{
// Set source of new image.
$(this.photo).src = SlideController.photos[SlideController.photoId][0];
// Add caption from gallery array.
$(this.caption).update(SlideController.photos[SlideController.photoId][2]);
document.title = document.title.replace(SlideController.photos[this.photoId][1],
SlideController.photos[SlideController.photoId][1]);
},
updateLinks: function()
{
var params = '?gallery=' + SlideController.galleryId + '&image=' + SlideController.photos[SlideController.photoId][3] + '&page=' + SlideController.photos[SlideController.photoId][4];
$('PhotoName').update(SlideController.photos[SlideController.photoId][1]);
if ($('image_properties_link')) {
$('image_properties_link').href = SlideController.baseUrl + '/image.php' + params + '&actionID=modify';
$('image_properties_link').stopObserving('click');
$('image_properties_link').observe('click', function(e){ SlideController.pause();HordePopup.popup({ url: this.href }); e.stop(); });
}
if ($('image_edit_link')) {
$('image_edit_link').href = SlideController.baseUrl + '/image.php' + params + '&actionID=editimage';
}
if ($('image_ecard_link')) {
$('image_ecard_link').href = SlideController.baseUrl + '/img/ecard.php?image=' + SlideController.photos[SlideController.photoId][3] + '&gallery=' + SlideController.galleryId;
$('image_ecard_link').stopObserving('click');
$('image_ecard_link').observe('click', function(e){ SlideController.pause();HordePopup.popup({ url: this.href }); e.stop(); });
}
if ($('image_delete_link')) {
//TODO : Guess we should have PHP save the localized text for this...
var deleteAction = function() { SlideController.pause(); if (!window.confirm("Do you want to permanently delete " + SlideController.photos[SlideController.photoId][1])) { alert("blah"); return false; } return true;};
$('image_delete_link').href = SlideController.baseUrl + '/image.php' + params + '&actionID=delete';
$('image_delete_link').stopObserving('click');
$('image_delete_link').observe('click', function(e) { return deleteAction(); e.stop(); });
}
$('image_download_link').href = SlideController.baseUrl + '/img/download.php?image=' + SlideController.photos[SlideController.photoId][3];
$('image_download_link').stopObserving('click');
$('image_download_link').observe('click', function(e) { SlideController.pause(); e.stop(); });
},
showPhoto: function()
{
new Effect.Appear(this.photo, { duration: 1.0, queue: 'end', afterFinish: (function() { $(this.captionBox).show(); this.updateLinks();}).bind(this) });
if (SlideController.playing) {
if (SlideController.interval) {
clearTimeout(SlideController.interval);
}
SlideController.interval = setTimeout(SlideController.next, SlideController.intervalSeconds * 1000);
}
},
nextPhoto: function()
{
// Figure out which photo is next.
(SlideController.photoId == (SlideController.photos.length - 1)) ? SlideController.photoId = 0 : ++SlideController.photoId;
// Make sure the photo is loaded locally before we fade the current image.
SlideController.tempImage.src = SlideController.photos[SlideController.photoId][0];
},
prevPhoto: function()
{
// Figure out which photo is previous.
(SlideController.photoId == 0) ? SlideController.photoId = SlideController.photos.length - 1 : --SlideController.photoId;
SlideController.tempImage.src = SlideController.photos[SlideController.photoId][0];
},
initSwap: function(w, h)
{
// Begin by hiding main elements.
new Effect.Fade(this.captionBox, {duration: 0.5 });
new Effect.Fade(this.photo, { duration: 1.0, afterFinish: (function(w, h) { if (w) { this.fixSize(w, h); } SlideController.photo.setNewPhotoParams();}.bind(this, w, h))});
// Update the current photo id.
this.photoId = SlideController.photoId;
},
fixSize: function(w, h)
{
$(this.photo).width = w;
$(this.photo).height = h;
$(this.captionBox).style.width = w + 'px';
}
}
// Arrow keys for navigation
document.observe('keydown', function(e) {
if (e.altKey || e.shiftKey || e.ctrlKey) {
return;
}
switch (e.keyCode || e.charCode) {
case Event.KEY_LEFT:
SlideController.prev();
break;
case Event.KEY_RIGHT:
SlideController.next();
break;
}
});
|