9bbf5ef34ed61351af078c61e1d082468119617a
2 copyright 2008-2014 Benoit Pin - Centre de recherche en informatique - MINES ParisTech
4 Licence Creative Commons http://creativecommons.org/licenses/by-nc/2.0/
11 var keyLeft
= 37, keyRight
= 39;
12 var isTextMime
= /^text\/.+/i;
13 var isAddToSelection
= /.*\/add_to_selection$/;
14 var imgRequestedSize
= /size=(\d+)/;
15 var DEFAULT_IMAGE_SIZES
= [500, 600, 800];
17 FilmSlider = function(filmBar
, slider
, ctxInfos
, image
, toolbar
, breadcrumbs
) {
18 var thisSlider
= this;
19 this.filmBar
= filmBar
;
20 this.filmBarWidth
= getObjectWidth(this.filmBar
);
21 var film
= filmBar
.firstChild
;
22 if (film
.nodeType
=== 3) { film
= film
.nextSibling
; }
25 this.rail
= slider
.parentNode
;
26 this.sliderSpeedRatio
= undefined;
27 this.sliderRatio
= undefined;
28 this.selectedSlide
= undefined;
29 this.selectedSlideInSelection
= undefined;
30 this.cartSlide
= document
.getElementById('cart_slide');
32 this.stretchable
= image
.parentNode
;
33 this.viewMode
= 'medium';
36 this.toolbar
= toolbar
;
38 var bcElements
= breadcrumbs
.getElementsByTagName('a');
39 this.lastBCElement
= bcElements
[bcElements
.length
-1];
40 var imgSrcParts
= image
.src
.split('/');
41 this.lastBCElement
.innerHTML
= imgSrcParts
[imgSrcParts
.length
-2];
42 this.hasBreadcrumbs
= true;
45 this.hasBreadcrumbs
= false;
48 var buttons
= toolbar
.getElementsByTagName('img');
50 for (i
=0 ; i
<buttons
.length
; i
++) {
52 name
= b
.getAttribute('name');
53 if (name
) { this.buttons
[name
] = b
; }
56 this.pendingImage
= new Image();
57 this.pendingImage
.onload = function() {
58 thisSlider
.refreshImage();
60 this.initialized
= false;
62 this.film
.style
.left
='0';
63 this.film
.style
.top
='0';
65 this.filmLength
= ctxInfos
.filmLength
;
66 this.center
= ctxInfos
.center
;
67 this.slideSize
= ctxInfos
.slideSize
;
68 this.ctxUrlTranslation
= ctxInfos
.ctxUrlTranslation
;
70 this.ddHandlers
= {'down' : function(evt
){thisSlider
.mouseDownHandler(evt
);},
71 'move' : function(evt
){thisSlider
.mouseMoveHandler(evt
);},
72 'up' : function(evt
){thisSlider
.mouseUpHandler(evt
);},
73 'out' : function(evt
){thisSlider
.mouseOutHandler(evt
);}
76 if (browser
.isMobile
) {
77 this.rail
.className
= 'hidden';
82 this.addEventListeners();
85 if (!browser
.isMobile
) {
86 FilmSlider
.prototype.resizeSlider = function(evt
) {
87 var filmBarWidth
= this.filmBarWidth
;
88 if (!filmBarWidth
) { return; }
89 var filmWidth
= this.slideSize
* this.filmLength
;
90 var sliderRatio
= this.sliderRatio
= filmBarWidth
/ filmWidth
;
91 var sliderWidth
= filmBarWidth
* sliderRatio
;
92 this.rail
.style
.width
= filmBarWidth
+ 'px';
93 this.rail
.style
.display
= 'block';
94 this.rail
.style
.visibility
= 'visible';
95 if (sliderRatio
< 1) {
96 this.slider
.style
.width
= Math
.round(sliderWidth
) + 'px';
97 this.slider
.style
.visibility
= 'visible';
100 this.slider
.style
.visibility
= 'hidden';
103 this.winSize
= {'width' : getWindowWidth(),
104 'height' : getWindowHeight()};
105 this.maxRightPosition
= filmBarWidth
- sliderWidth
;
106 this.sliderSpeedRatio
= - (filmBarWidth
- sliderWidth
) / (filmWidth
- filmBarWidth
);
107 if (!this.initialized
) {
108 this.centerSlide(this.center
);
109 this.selectedSlide
= this.filmBar
.getElementsByTagName('img')[this.center
].parentNode
;
110 this.initialized
= true;
116 FilmSlider
.prototype.resizeSlider = function(evt
) {};
119 FilmSlider
.prototype._checkSizeAfterLoad = function(evt
) {
121 this.filmBarWidth
= this._barSizes
[this._barSizes
.length
] = getObjectWidth(this.filmBar
);
124 this._checkSizeIntervalId
= setInterval(function(evt
){self
._checkSize(evt
);}, 25);
125 setTimeout(function(evt
){self
._checkSizeStability();}, 250);
128 FilmSlider
.prototype._checkSize = function(evt
) {
129 this._barSizes
[this._barSizes
.length
] = getObjectWidth(this.filmBar
);
130 if (this._barSizes
.length
>= 2 &&
131 this._barSizes
[this._barSizes
.length
-2] !== this._barSizes
[this._barSizes
.length
-1]) {
132 this.filmBarWidth
= this._barSizes
[this._barSizes
.length
-1];
133 this.initialized
= false;
138 FilmSlider
.prototype._checkSizeStability = function(evt
) {
141 for (i
=0 ; i
<this._barSizes
.length
- 1 ; i
++) {
142 if (this._barSizes
[i
] !== this._barSizes
[i
+1]) {
144 setTimeout(function(evt
){self
._checkSizeStability();}, 250);
148 clearInterval(this._checkSizeIntervalId
);
149 delete this._barSizes
;
150 delete this._checkSizeIntervalId
;
153 FilmSlider
.prototype.fitToScreen = function(evt
) {
155 var thisSlider
= this;
156 addListener(window
, 'resize', function(evt
){thisSlider
._fitToScreen();});
159 FilmSlider
.prototype._fitToScreen = function(evt
) {
160 var wh
= getWindowHeight();
161 var rb
= getObjectTop(this.rail
) + getObjectHeight(this.rail
); // rail bottom
163 var sh
= getObjectHeight(this.stretchable
);
164 var newSize
= sh
+ delta
;
165 this.stretchable
.style
.height
= newSize
+ 'px';
167 var ratio
= this.image
.height
/ this.image
.width
;
168 var bestFitSize
= this.getBestFitSize(ratio
);
169 var currentSize
= parseInt(imgRequestedSize
.exec(this.image
.src
)[1], 10);
170 if (currentSize
!== bestFitSize
) {
171 var src
= this.image
.src
.replace(imgRequestedSize
, 'size=' + bestFitSize
);
172 this.pendingImage
.src
= src
;
176 FilmSlider
.prototype.getBestFitSize = function(ratio
) {
177 var fw
= getObjectWidth(this.stretchable
) - 1;
178 var fh
= getObjectHeight(this.stretchable
) - 1;
182 for (i
=DEFAULT_IMAGE_SIZES
.length
-1 ; i
>0 ; i
--) {
183 irw
= DEFAULT_IMAGE_SIZES
[i
];
185 if (irw
<= fw
&& irh
<= fh
) { break; }
189 for (i
=DEFAULT_IMAGE_SIZES
.length
-1 ; i
>0 ; i
--) {
190 irh
= DEFAULT_IMAGE_SIZES
[i
];
192 if (irw
<= fw
&& irh
<= fh
) { break; }
195 return DEFAULT_IMAGE_SIZES
[i
];
198 FilmSlider
.prototype.centerSlide = function(slideIndex
) {
199 if (this.sliderRatio
> 1) { return; }
200 var filmBarWidth
= getObjectWidth(this.filmBar
);
201 var x
= slideIndex
* this.slideSize
;
202 x
= x
- (filmBarWidth
- this.slideSize
) / 2.0;
203 x
= x
* this.sliderSpeedRatio
;
204 var p
= new Point( -x
, 0 );
205 this.setSliderPosition(p
);
208 FilmSlider
.prototype.setSliderPosition = function(point
) {
209 if(point
.x
< 0) { point
.x
= 0; }
210 if (point
.x
> this.maxRightPosition
) { point
.x
= this.maxRightPosition
; }
211 this.slider
.style
.left
= point
.x
+ 'px';
212 this.setFilmPosition(point
);
215 FilmSlider
.prototype.setFilmPosition = function(point
) {
216 this.film
.style
.left
= point
.x
/ this.sliderSpeedRatio
+ 'px';
219 FilmSlider
.prototype.getSliderPosition = function() {
220 var x
= parseInt(this.slider
.style
.left
, 10);
221 var y
= parseInt(this.slider
.style
.top
, 10);
222 var p
= new Point(x
, y
);
226 FilmSlider
.prototype.getFilmPosition = function() {
227 var x
= parseInt(this.film
.style
.left
, 10);
228 var y
= parseInt(this.film
.style
.top
, 10);
229 var p
= new Point(x
, y
);
233 FilmSlider
.prototype.loadSibling = function(previous
) {
236 slide
= this.selectedSlide
.parentNode
.previousSibling
;
237 if (slide
&& slide
.nodeType
===3) { slide
= slide
.previousSibling
; }
240 slide
= this.selectedSlide
.parentNode
.nextSibling
;
241 if (slide
&& slide
.nodeType
===3) { slide
= slide
.nextSibling
; }
244 if (!slide
) { return; }
246 var target
= slide
.getElementsByTagName('a')[0];
247 raiseMouseEvent(target
, 'click');
248 var index
= parseInt(target
.getAttribute('portfolio:position'), 10);
249 this.centerSlide(index
);
253 FilmSlider
.prototype.addEventListeners = function() {
254 var thisSlider
= this;
255 addListener(window
, 'resize', function(evt
){thisSlider
.resizeSlider(evt
);});
256 addListener(this.filmBar
, 'click', function(evt
){thisSlider
.thumbnailClickHandler(evt
);});
257 addListener(this.toolbar
, 'click', function(evt
){thisSlider
.toolbarClickHandler(evt
);});
258 addListener(window
, 'load', function(evt
){thisSlider
.fitToScreen(evt
);});
259 addListener(window
, 'load', function(evt
){thisSlider
._checkSizeAfterLoad(evt
);});
262 addListener(this.slider
, 'mousedown', this.ddHandlers
.down
);
263 if(browser
.isDOM2Event
){
264 if (browser
.isAppleWebKit
) {
265 this.filmBar
.addEventListener('mousewheel', function(evt
){thisSlider
.mouseWheelHandler(evt
);}, false);
268 addListener(this.filmBar
, 'DOMMouseScroll', function(evt
){thisSlider
.mouseWheelHandler(evt
);});
271 else if (browser
.isIE6up
) {
272 addListener(this.filmBar
, 'mousewheel', function(evt
){thisSlider
.mouseWheelHandler(evt
);});
274 if (browser
.isMobile
) {
275 this.filmBar
.addEventListener('touchstart', function(evt
){thisSlider
.touchStartHandler(evt
);}, false);
276 this.filmBar
.addEventListener('touchmove', function(evt
){thisSlider
.touchMoveHandler(evt
);}, false);
277 this.filmBar
.addEventListener('touchend', function(evt
){thisSlider
.touchEndHandler(evt
);}, false);
280 addListener(document
, 'keydown', function(evt
){thisSlider
.keyDownHandler(evt
);});
281 addListener(document
, 'keypress', function(evt
){thisSlider
.keyPressHandler(evt
);});
285 FilmSlider
.prototype.mouseDownHandler = function(evt
) {
286 this.initialClickPoint
= new Point(evt
.clientX
, evt
.clientY
);
287 this.initialPosition
= this.getSliderPosition();
288 this.dragInProgress
= true;
289 addListener(document
, 'mousemove', this.ddHandlers
.move);
290 addListener(document
, 'mouseup', this.ddHandlers
.up
);
291 addListener(document
.body
, 'mouseout', this.ddHandlers
.out
);
295 FilmSlider
.prototype.mouseMoveHandler = function(evt
) {
296 if(!this.dragInProgress
) { return; }
299 evt
= getEventObject(evt
);
300 var currentPoint
= new Point(evt
.clientX
, evt
.clientY
);
301 var displacement
= currentPoint
.diff(this.initialClickPoint
);
302 this.setSliderPosition(this.initialPosition
.add(displacement
));
305 FilmSlider
.prototype.mouseUpHandler = function(evt
) {
306 this.dragInProgress
= false;
307 evt
= getEventObject(evt
);
308 this.mouseMoveHandler(evt
);
312 FilmSlider
.prototype.mouseOutHandler = function(evt
) {
313 evt
= getEventObject(evt
);
317 x
> this.winSize
.width
||
319 y
> this.winSize
.height
321 this.mouseUpHandler(evt
);
325 FilmSlider
.prototype.thumbnailClickHandler = function(evt
) {
326 var target
= getTargetedObject(evt
);
327 while (target
.tagName
!== 'A' && target
!== this.filmBar
) { target
= target
.parentNode
; }
328 if (target
.tagName
!== 'A') { return; }
330 if (this.viewMode
=== 'full') {
331 this.mosaique
.unload();
332 this.mosaique
= null;
333 this.viewMode
= 'medium';
336 disablePropagation(evt
);
338 history
.pushState(target
.href
, '', target
.href
);
340 var imgBaseUrl
= target
.href
;
342 if (this.ctxUrlTranslation
[0]) {
343 canonicalImgUrl
= imgBaseUrl
.replace(this.ctxUrlTranslation
[0],
344 this.ctxUrlTranslation
[1]);
346 else { canonicalImgUrl
= imgBaseUrl
; }
348 var ajaxUrl
= imgBaseUrl
+ '/photo_view_ajax';
351 //this.pendingImage.src = canonicalImgUrl + '/getResizedImage?size=600';
352 var thumbnail
= target
.getElementsByTagName('IMG')[0];
353 var bestFitSize
= this.getBestFitSize(thumbnail
.height
/thumbnail
.width
);
354 this.pendingImage
.src
= canonicalImgUrl
+ '/getResizedImage?size=' + bestFitSize
;
357 var fullScreenLink
= this.buttons
.full_screen
.parentNode
;
358 fullScreenLink
.href
= canonicalImgUrl
+ '/zoom_view';
360 var toggleSelectionBtn
= this.buttons
.toggle_selection
;
361 var toggleSelectionLink
= toggleSelectionBtn
.parentNode
;
362 this.selectedSlideInSelection
= (target
.className
==='selected');
363 if (this.selectedSlideInSelection
) {
364 toggleSelectionBtn
.src
= portal_url() + '/unselect_flag_btn.gif';
365 toggleSelectionBtn
.alt
= toggleSelectionLink
.title
= 'Retirer de la sélection';
366 toggleSelectionLink
.href
= canonicalImgUrl
+ '/remove_to_selection';
369 toggleSelectionBtn
.src
= portal_url() + '/select_flag_btn.gif';
370 toggleSelectionBtn
.alt
= toggleSelectionLink
.title
= 'Ajouter à la sélection';
371 toggleSelectionLink
.href
= canonicalImgUrl
+ '/add_to_selection';
374 var showBuyableButtonLink
= this.buttons
.show_buyable
.parentNode
;
375 showBuyableButtonLink
.href
= canonicalImgUrl
+ '/get_slide_buyable_items';
376 this.cartSlide
.innerHTML
= '';
377 this.cartSlide
.style
.visibility
='hidden';
380 var metadataButton
= this.buttons
.edit_metadata
;
381 if (metadataButton
) {
382 var metadataEditLink
= metadataButton
.parentNode
;
383 metadataEditLink
.href
= canonicalImgUrl
+ '/photo_edit_form';
387 var req
= new XMLHttpRequest();
388 req
.onreadystatechange = function() {
389 switch (req
.readyState
) {
395 if (! isTextMime
.exec(req
.getResponseHeader('Content-Type'))) {
396 req
.onreadystatechange
= null;
399 window
.location
.href
= thisFS
._fallBackUrl
;
406 if (req
.status
=== 200) { thisFS
.populateViewer(req
); }
411 req
.open("GET", ajaxUrl
, true);
414 // update old displayed slide className
415 var className
= this.selectedSlide
.className
;
416 var classes
= className
.split(' ');
420 for (i
=0 ; i
<classes
.length
; i
++) {
422 if (name
!== 'displayed') {
423 newClasses
.push(name
);
427 this.selectedSlide
.className
= newClasses
.join(' ');
429 // hightlight new displayed slide
430 this.selectedSlide
= target
;
431 className
= this.selectedSlide
.className
;
432 classes
= className
.split(' ');
433 classes
.push('displayed');
434 this.selectedSlide
.className
= classes
.join(' ');
438 FilmSlider
.prototype.toolbarClickHandler = function(evt
) {
439 var target
= getTargetedObject(evt
);
440 var button
, link
, url
;
441 if(target
.tagName
=== 'IMG' && target
.getAttribute('name')) {
442 switch(target
.getAttribute('name')) {
445 disablePropagation(evt
);
447 link
= button
.parentNode
;
449 this.loadSibling(true);
453 disablePropagation(evt
);
455 link
= button
.parentNode
;
457 this.loadSibling(false);
461 disablePropagation(evt
);
462 target
.parentNode
.blur();
463 if (this.viewMode
=== 'full') {
464 this.mosaique
.unload();
465 this.mosaique
= null;
466 this.viewMode
= 'medium';
469 var main
= document
.getElementById('photo_viewer');
470 url
= target
.parentNode
.href
;
471 url
= url
.substring(0, url
.length
- '/zoom_view'.length
);
472 var margins
= {'top':0, 'right':-1, 'bottom':0, 'left':0};
473 this.mosaique
= new Mosaique(main
, url
, margins
);
474 this.viewMode
= 'full';
477 case 'toggle_selection':
479 disablePropagation(evt
);
481 link
= button
.parentNode
;
484 var req
= new XMLHttpRequest();
486 req
.open("POST", url
, true);
487 req
.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
491 var parts
= url
.split('/');
492 var canonicalImgUrl
= parts
.slice(0, parts
.length
-1).join('/');
494 if (isAddToSelection
.test(url
)) {
495 button
.src
= portal_url() + '/unselect_flag_btn.gif';
496 button
.alt
= link
.title
= 'Retirer de la sélection';
497 link
.href
= canonicalImgUrl
+ '/remove_to_selection';
498 this.selectedSlide
.className
= 'selected displayed';
499 this.image
.parentNode
.className
= 'selected';
500 this.selectedSlideInSelection
= true;
503 button
.src
= portal_url() + '/select_flag_btn.gif';
504 button
.alt
= link
.title
= 'Ajouter à la sélection';
505 link
.href
= canonicalImgUrl
+ '/add_to_selection';
506 this.selectedSlide
.className
= 'displayed';
507 this.image
.parentNode
.className
= '';
508 this.selectedSlideInSelection
= false;
514 disablePropagation(evt
);
516 link
= button
.parentNode
;
518 var slide
= this.cartSlide
;
519 slide
.innerHTML
= '';
520 slide
.style
.visibility
= 'visible';
521 var cw
= new CartWidget(slide
, link
.href
);
522 cw
.onCancel = function() {
523 CartWidget
.prototype.onCancel
.apply(this);
524 slide
.style
.visibility
= 'hidden';
526 cw
.onAfterConfirm = function() {
527 slide
.style
.visibility
= 'hidden';
535 case 'edit_metadata' :
537 disablePropagation(evt);
539 if (this.viewMode === 'full') {
540 this.mosaique.unload();
541 this.mosaique = null;
542 this.viewMode = 'medium';
545 var fi = new FragmentImporter(absolute_url());
546 fi.useMacro('metadata_edit_form_macros', 'iptc', 'image_metadata');
554 if(browser
.isDOM2Event
) {
555 if (browser
.isAppleWebKit
) {
556 FilmSlider
.prototype.mouseWheelHandler = function(evt
) {
558 var pos
= this.getSliderPosition();
559 pos
.x
-= evt
.wheelDelta
/ 40;
560 this.setSliderPosition(pos
);
564 FilmSlider
.prototype.mouseWheelHandler = function(evt
) {
566 var pos
= this.getSliderPosition();
567 pos
.x
+= evt
.detail
* 3;
568 this.setSliderPosition(pos
);
572 else if (browser
.isIE6up
) {
573 FilmSlider
.prototype.mouseWheelHandler = function() {
574 var evt
= window
.event
;
575 evt
.returnValue
= false;
576 var pos
= this.getSliderPosition();
577 pos
.x
-= evt
.wheelDelta
/ 40;
578 this.setSliderPosition(pos
);
582 FilmSlider
.prototype.touchStartHandler = function(evt
) {
583 this.filmStartX
= parseInt(this.film
.style
.left
, 10);
584 this.touchStartX
= evt
.pageX
;
587 FilmSlider
.prototype.touchMoveHandler = function(evt
) {
588 var delta
= this.touchStartX
- evt
.pageX
;
589 this.film
.style
.left
= String(this.filmStartX
- delta
) + 'px';
592 FilmSlider
.prototype.touchEndHandler = function(evt
) {
593 this.touchStartX
= undefined;
597 FilmSlider
.prototype.keyDownHandler = function(evt
) {
598 evt
= getEventObject(evt
);
599 switch (evt
.keyCode
) {
601 this.loadSibling(true);
604 this.loadSibling(false);
612 FilmSlider
.prototype.keyPressHandler = function(evt
) {
613 var target
= getTargetedObject(evt
);
614 if (target
.tagName
=== 'INPUT' || target
.tagName
=== 'TEXTAREA') { return; }
615 evt
= getEventObject(evt
);
616 var charPress
= String
.fromCharCode((evt
.keyCode
) ? evt
.keyCode
: evt
.which
);
620 raiseMouseEvent(this.buttons
.full_screen
, 'click');
625 FilmSlider
.prototype.populateViewer = function(req
) {
626 var elements
= req
.responseXML
.documentElement
.childNodes
;
628 for(i
=0 ; i
< elements
.length
; i
++ ) {
629 element
= elements
[i
];
630 switch (element
.nodeName
) {
632 var dest
= document
.getElementById(element
.getAttribute('id'));
633 if (dest
) { dest
.innerHTML
= element
.firstChild
.nodeValue
; }
635 case 'imageattributes' :
636 var link
= this.buttons
.back_to_portfolio
.parentNode
;
637 link
.href
= element
.getAttribute('back_to_context_url');
638 link
= this.buttons
.show_buyable
.parentNode
;
639 var buyable
= element
.getAttribute('buyable');
640 if(buyable
=== 'True') { link
.className
= null; }
641 else if(buyable
=== 'False') { link
.className
= 'hidden'; }
642 this.image
.alt
= element
.getAttribute('alt');
643 this.updateBreadcrumbs(element
.getAttribute('last_bc_url'),
644 element
.getAttribute('img_id'));
650 FilmSlider
.prototype.refreshImage = function() {
651 this.image
.style
.visibility
= 'hidden';
652 this.image
.src
= this.pendingImage
.src
;
653 this.image
.width
= this.pendingImage
.width
;
654 this.image
.height
= this.pendingImage
.height
;
655 this.image
.style
.visibility
= 'visible';
656 if (this.selectedSlideInSelection
) { this.image
.parentNode
.className
= 'selected'; }
657 else { this.image
.parentNode
.className
= ''; }
660 FilmSlider
.prototype.updateBreadcrumbs = function(url
, title
) {
661 if (this.hasBreadcrumbs
) {
662 this.lastBCElement
.href
= element
.getAttribute('lastBcUrl');
663 this.lastBCElement
.innerHTML
= element
.getAttribute('img_id');
667 FilmSlider
.prototype.startSlideShow = function() {
668 this.slideShowSlide
= this.pendingSlideShowSlide
= this.selectedSlide
;
669 return this.slideShowSlide
.href
;
672 FilmSlider
.prototype.slideShowNext = function() {
673 var nextSlide
= this.slideShowSlide
.parentNode
.nextSibling
;
674 if (nextSlide
&& nextSlide
.nodeType
===3) { nextSlide
= nextSlide
.nextSibling
; }
677 nextSlide
= nextSlide
.getElementsByTagName('a')[0];
678 this.pendingSlideShowSlide
= nextSlide
;
679 return this.pendingSlideShowSlide
.href
;
682 var row
= this.slideShowSlide
.parentNode
.parentNode
;
683 var first
= row
.firstChild
;
684 if (first
.nodeType
===3) { first
= first
.nextSibling
; }
685 this.pendingSlideShowSlide
= first
.getElementsByTagName('a')[0];
686 return this.pendingSlideShowSlide
.href
;
690 FilmSlider
.prototype.slideShowPrevious = function() {
691 var previousSlide
= this.slideShowSlide
.parentNode
.previousSibling
;
692 if (previousSlide
&& previousSlide
.nodeType
===3) { previousSlide
= previousSlide
.previousSibling
; }
695 previousSlide
= previousSlide
.getElementsByTagName('a')[0];
696 this.pendingSlideShowSlide
= previousSlide
;
697 return this.pendingSlideShowSlide
.href
;
700 var row
= this.slideShowSlide
.parentNode
.parentNode
;
701 var last
= row
.lastChild
;
702 if (last
.nodeType
===3) { last
= last
.previousSibling
; }
703 this.pendingSlideShowSlide
= last
.getElementsByTagName('a')[0];
704 return this.pendingSlideShowSlide
.href
;
708 FilmSlider
.prototype.slideShowImageLoaded = function() {
709 this.slideShowSlide
= this.pendingSlideShowSlide
;
712 FilmSlider
.prototype.stopSlideShow = function() {
713 raiseMouseEvent(this.slideShowSlide
, 'click');
714 var index
= parseInt(this.selectedSlide
.getAttribute('portfolio:position'), 10);
715 this.centerSlide(index
);
720 function Point(x
, y
) {
721 this.x
= Math
.round(x
);
722 this.y
= Math
.round(y
);
724 Point
.prototype.diff = function(point
) { return new Point(this.x
- point
.x
, this.y
- point
.y
); };
725 Point
.prototype.add = function(point
) { return new Point(this.x
+ point
.x
, this.y
+ point
.y
); };
726 Point
.prototype.mul = function(k
) { return new Point(this.x
* k
, this.y
*k
); };
727 Point
.prototype.toString = function() { return "(" + String(this.x
) + ", " + String(this.y
) + ")"; };