ff8d61e5597827a85891ad7ab71a6612f3aaaac6
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 // pas de barre de scroll horizontal pour les tablettes
117 FilmSlider
.prototype.resizeSlider = function(evt
) {};
120 FilmSlider
.prototype._checkSizeAfterLoad = function(evt
) {
122 this.filmBarWidth
= this._barSizes
[this._barSizes
.length
] = getObjectWidth(this.filmBar
);
125 this._checkSizeIntervalId
= setInterval(function(evt
){self
._checkSize(evt
);}, 25);
126 setTimeout(function(evt
){self
._checkSizeStability();}, 250);
129 FilmSlider
.prototype._checkSize = function(evt
) {
130 this._barSizes
[this._barSizes
.length
] = getObjectWidth(this.filmBar
);
131 if (this._barSizes
.length
>= 2 &&
132 this._barSizes
[this._barSizes
.length
-2] !== this._barSizes
[this._barSizes
.length
-1]) {
133 this.filmBarWidth
= this._barSizes
[this._barSizes
.length
-1];
134 this.initialized
= false;
139 FilmSlider
.prototype._checkSizeStability = function(evt
) {
142 for (i
=0 ; i
<this._barSizes
.length
- 1 ; i
++) {
143 if (this._barSizes
[i
] !== this._barSizes
[i
+1]) {
145 setTimeout(function(evt
){self
._checkSizeStability();}, 250);
149 clearInterval(this._checkSizeIntervalId
);
150 delete this._barSizes
;
151 delete this._checkSizeIntervalId
;
154 FilmSlider
.prototype.fitToScreen = function(evt
) {
156 var thisSlider
= this;
157 addListener(window
, 'resize', function(evt
){thisSlider
._fitToScreen();});
160 FilmSlider
.prototype._fitToScreen = function(evt
) {
161 var wh
= getWindowHeight();
162 if (!browser
.isMobile
) {
163 var rb
= getObjectTop(this.rail
) + getObjectHeight(this.rail
); // rail bottom
166 var rb
= getObjectTop(this.filmBar
) + getObjectHeight(this.filmBar
); // film bottom
169 var sh
= getObjectHeight(this.stretchable
);
170 var newSize
= sh
+ delta
;
171 this.stretchable
.style
.height
= newSize
+ 'px';
173 var ratio
= this.image
.height
/ this.image
.width
;
174 var bestFitSize
= this.getBestFitSize(ratio
);
175 var currentSize
= parseInt(imgRequestedSize
.exec(this.image
.src
)[1], 10);
176 if (currentSize
!== bestFitSize
) {
177 var src
= this.image
.src
.replace(imgRequestedSize
, 'size=' + bestFitSize
);
178 this.pendingImage
.src
= src
;
182 FilmSlider
.prototype.getBestFitSize = function(ratio
) {
183 var fw
= getObjectWidth(this.stretchable
) - 1;
184 var fh
= getObjectHeight(this.stretchable
) - 1;
188 for (i
=DEFAULT_IMAGE_SIZES
.length
-1 ; i
>0 ; i
--) {
189 irw
= DEFAULT_IMAGE_SIZES
[i
];
191 if (irw
<= fw
&& irh
<= fh
) { break; }
195 for (i
=DEFAULT_IMAGE_SIZES
.length
-1 ; i
>0 ; i
--) {
196 irh
= DEFAULT_IMAGE_SIZES
[i
];
198 if (irw
<= fw
&& irh
<= fh
) { break; }
201 return DEFAULT_IMAGE_SIZES
[i
];
204 FilmSlider
.prototype.centerSlide = function(slideIndex
) {
205 if (this.sliderRatio
> 1) { return; }
206 var filmBarWidth
= getObjectWidth(this.filmBar
);
207 var x
= slideIndex
* this.slideSize
;
208 x
= x
- (filmBarWidth
- this.slideSize
) / 2.0;
209 x
= x
* this.sliderSpeedRatio
;
210 var p
= new Point( -x
, 0 );
211 this.setSliderPosition(p
);
214 FilmSlider
.prototype.setSliderPosition = function(point
) {
215 if(point
.x
< 0) { point
.x
= 0; }
216 if (point
.x
> this.maxRightPosition
) { point
.x
= this.maxRightPosition
; }
217 this.slider
.style
.left
= point
.x
+ 'px';
218 this.setFilmPosition(point
);
221 FilmSlider
.prototype.setFilmPosition = function(point
) {
222 this.film
.style
.left
= point
.x
/ this.sliderSpeedRatio
+ 'px';
225 FilmSlider
.prototype.getSliderPosition = function() {
226 var x
= parseInt(this.slider
.style
.left
, 10);
227 var y
= parseInt(this.slider
.style
.top
, 10);
228 var p
= new Point(x
, y
);
232 FilmSlider
.prototype.getFilmPosition = function() {
233 var x
= parseInt(this.film
.style
.left
, 10);
234 var y
= parseInt(this.film
.style
.top
, 10);
235 var p
= new Point(x
, y
);
239 FilmSlider
.prototype.loadSibling = function(previous
) {
242 slide
= this.selectedSlide
.parentNode
.previousSibling
;
243 if (slide
&& slide
.nodeType
===3) { slide
= slide
.previousSibling
; }
246 slide
= this.selectedSlide
.parentNode
.nextSibling
;
247 if (slide
&& slide
.nodeType
===3) { slide
= slide
.nextSibling
; }
250 if (!slide
) { return; }
252 var target
= slide
.getElementsByTagName('a')[0];
253 raiseMouseEvent(target
, 'click');
254 var index
= parseInt(target
.getAttribute('portfolio:position'), 10);
255 this.centerSlide(index
);
259 FilmSlider
.prototype.addEventListeners = function() {
260 var thisSlider
= this;
261 addListener(window
, 'resize', function(evt
){thisSlider
.resizeSlider(evt
);});
262 addListener(this.filmBar
, 'click', function(evt
){thisSlider
.thumbnailClickHandler(evt
);});
263 addListener(this.toolbar
, 'click', function(evt
){thisSlider
.toolbarClickHandler(evt
);});
264 addListener(window
, 'load', function(evt
){thisSlider
.fitToScreen(evt
);});
265 addListener(window
, 'load', function(evt
){thisSlider
._checkSizeAfterLoad(evt
);});
268 addListener(this.slider
, 'mousedown', this.ddHandlers
.down
);
269 if(browser
.isDOM2Event
){
270 if (browser
.isAppleWebKit
) {
271 this.filmBar
.addEventListener('mousewheel', function(evt
){thisSlider
.mouseWheelHandler(evt
);}, false);
274 addListener(this.filmBar
, 'DOMMouseScroll', function(evt
){thisSlider
.mouseWheelHandler(evt
);});
277 else if (browser
.isIE6up
) {
278 addListener(this.filmBar
, 'mousewheel', function(evt
){thisSlider
.mouseWheelHandler(evt
);});
280 if (browser
.isMobile
) {
281 this.filmBar
.addEventListener('touchstart', function(evt
){thisSlider
.touchStartHandler(evt
);}, false);
282 this.filmBar
.addEventListener('touchmove', function(evt
){thisSlider
.touchMoveHandler(evt
);}, false);
283 this.filmBar
.addEventListener('touchend', function(evt
){thisSlider
.touchEndHandler(evt
);}, false);
286 addListener(document
, 'keydown', function(evt
){thisSlider
.keyDownHandler(evt
);});
287 addListener(document
, 'keypress', function(evt
){thisSlider
.keyPressHandler(evt
);});
291 FilmSlider
.prototype.mouseDownHandler = function(evt
) {
292 this.initialClickPoint
= new Point(evt
.clientX
, evt
.clientY
);
293 this.initialPosition
= this.getSliderPosition();
294 this.dragInProgress
= true;
295 addListener(document
, 'mousemove', this.ddHandlers
.move);
296 addListener(document
, 'mouseup', this.ddHandlers
.up
);
297 addListener(document
.body
, 'mouseout', this.ddHandlers
.out
);
301 FilmSlider
.prototype.mouseMoveHandler = function(evt
) {
302 if(!this.dragInProgress
) { return; }
305 evt
= getEventObject(evt
);
306 var currentPoint
= new Point(evt
.clientX
, evt
.clientY
);
307 var displacement
= currentPoint
.diff(this.initialClickPoint
);
308 this.setSliderPosition(this.initialPosition
.add(displacement
));
311 FilmSlider
.prototype.mouseUpHandler = function(evt
) {
312 this.dragInProgress
= false;
313 evt
= getEventObject(evt
);
314 this.mouseMoveHandler(evt
);
318 FilmSlider
.prototype.mouseOutHandler = function(evt
) {
319 evt
= getEventObject(evt
);
323 x
> this.winSize
.width
||
325 y
> this.winSize
.height
327 this.mouseUpHandler(evt
);
331 FilmSlider
.prototype.thumbnailClickHandler = function(evt
) {
332 var target
= getTargetedObject(evt
);
333 while (target
.tagName
!== 'A' && target
!== this.filmBar
) { target
= target
.parentNode
; }
334 if (target
.tagName
!== 'A') { return; }
336 if (this.viewMode
=== 'full') {
337 this.mosaique
.unload();
338 this.mosaique
= null;
339 this.viewMode
= 'medium';
342 disablePropagation(evt
);
344 history
.pushState(target
.href
, '', target
.href
);
346 var imgBaseUrl
= target
.href
;
348 if (this.ctxUrlTranslation
[0]) {
349 canonicalImgUrl
= imgBaseUrl
.replace(this.ctxUrlTranslation
[0],
350 this.ctxUrlTranslation
[1]);
352 else { canonicalImgUrl
= imgBaseUrl
; }
354 var ajaxUrl
= imgBaseUrl
+ '/photo_view_ajax';
357 //this.pendingImage.src = canonicalImgUrl + '/getResizedImage?size=600';
358 var thumbnail
= target
.getElementsByTagName('IMG')[0];
359 var bestFitSize
= this.getBestFitSize(thumbnail
.height
/thumbnail
.width
);
360 this.pendingImage
.src
= canonicalImgUrl
+ '/getResizedImage?size=' + bestFitSize
;
363 var fullScreenLink
= this.buttons
.full_screen
.parentNode
;
364 fullScreenLink
.href
= canonicalImgUrl
+ '/zoom_view';
366 var toggleSelectionBtn
= this.buttons
.toggle_selection
;
367 var toggleSelectionLink
= toggleSelectionBtn
.parentNode
;
368 this.selectedSlideInSelection
= (target
.className
==='selected');
369 if (this.selectedSlideInSelection
) {
370 toggleSelectionBtn
.src
= portal_url() + '/unselect_flag_btn.gif';
371 toggleSelectionBtn
.alt
= toggleSelectionLink
.title
= 'Retirer de la sélection';
372 toggleSelectionLink
.href
= canonicalImgUrl
+ '/remove_to_selection';
375 toggleSelectionBtn
.src
= portal_url() + '/select_flag_btn.gif';
376 toggleSelectionBtn
.alt
= toggleSelectionLink
.title
= 'Ajouter à la sélection';
377 toggleSelectionLink
.href
= canonicalImgUrl
+ '/add_to_selection';
380 var showBuyableButtonLink
= this.buttons
.show_buyable
.parentNode
;
381 showBuyableButtonLink
.href
= canonicalImgUrl
+ '/get_slide_buyable_items';
382 this.cartSlide
.innerHTML
= '';
383 this.cartSlide
.style
.visibility
='hidden';
386 var metadataButton
= this.buttons
.edit_metadata
;
387 if (metadataButton
) {
388 var metadataEditLink
= metadataButton
.parentNode
;
389 metadataEditLink
.href
= canonicalImgUrl
+ '/photo_edit_form';
393 var req
= new XMLHttpRequest();
394 req
.onreadystatechange = function() {
395 switch (req
.readyState
) {
401 if (! isTextMime
.exec(req
.getResponseHeader('Content-Type'))) {
402 req
.onreadystatechange
= null;
405 window
.location
.href
= thisFS
._fallBackUrl
;
412 if (req
.status
=== 200) { thisFS
.populateViewer(req
); }
417 req
.open("GET", ajaxUrl
, true);
420 // update old displayed slide className
421 var className
= this.selectedSlide
.className
;
422 var classes
= className
.split(' ');
426 for (i
=0 ; i
<classes
.length
; i
++) {
428 if (name
!== 'displayed') {
429 newClasses
.push(name
);
433 this.selectedSlide
.className
= newClasses
.join(' ');
435 // hightlight new displayed slide
436 this.selectedSlide
= target
;
437 className
= this.selectedSlide
.className
;
438 classes
= className
.split(' ');
439 classes
.push('displayed');
440 this.selectedSlide
.className
= classes
.join(' ');
444 FilmSlider
.prototype.toolbarClickHandler = function(evt
) {
445 var target
= getTargetedObject(evt
);
446 var button
, link
, url
;
447 if(target
.tagName
=== 'IMG' && target
.getAttribute('name')) {
448 switch(target
.getAttribute('name')) {
451 disablePropagation(evt
);
453 link
= button
.parentNode
;
455 this.loadSibling(true);
459 disablePropagation(evt
);
461 link
= button
.parentNode
;
463 this.loadSibling(false);
467 disablePropagation(evt
);
468 target
.parentNode
.blur();
469 if (this.viewMode
=== 'full') {
470 this.mosaique
.unload();
471 this.mosaique
= null;
472 this.viewMode
= 'medium';
475 var main
= document
.getElementById('photo_viewer');
476 url
= target
.parentNode
.href
;
477 url
= url
.substring(0, url
.length
- '/zoom_view'.length
);
478 var margins
= {'top':0, 'right':-1, 'bottom':0, 'left':0};
479 this.mosaique
= new Mosaique(main
, url
, margins
);
480 this.viewMode
= 'full';
483 case 'toggle_selection':
485 disablePropagation(evt
);
487 link
= button
.parentNode
;
490 var req
= new XMLHttpRequest();
492 req
.open("POST", url
, true);
493 req
.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
497 var parts
= url
.split('/');
498 var canonicalImgUrl
= parts
.slice(0, parts
.length
-1).join('/');
500 if (isAddToSelection
.test(url
)) {
501 button
.src
= portal_url() + '/unselect_flag_btn.gif';
502 button
.alt
= link
.title
= 'Retirer de la sélection';
503 link
.href
= canonicalImgUrl
+ '/remove_to_selection';
504 this.selectedSlide
.className
= 'selected displayed';
505 this.image
.parentNode
.className
= 'selected';
506 this.selectedSlideInSelection
= true;
509 button
.src
= portal_url() + '/select_flag_btn.gif';
510 button
.alt
= link
.title
= 'Ajouter à la sélection';
511 link
.href
= canonicalImgUrl
+ '/add_to_selection';
512 this.selectedSlide
.className
= 'displayed';
513 this.image
.parentNode
.className
= '';
514 this.selectedSlideInSelection
= false;
520 disablePropagation(evt
);
522 link
= button
.parentNode
;
524 var slide
= this.cartSlide
;
525 slide
.innerHTML
= '';
526 slide
.style
.visibility
= 'visible';
527 var cw
= new CartWidget(slide
, link
.href
);
528 cw
.onCancel = function() {
529 CartWidget
.prototype.onCancel
.apply(this);
530 slide
.style
.visibility
= 'hidden';
532 cw
.onAfterConfirm = function() {
533 slide
.style
.visibility
= 'hidden';
541 case 'edit_metadata' :
543 disablePropagation(evt);
545 if (this.viewMode === 'full') {
546 this.mosaique.unload();
547 this.mosaique = null;
548 this.viewMode = 'medium';
551 var fi = new FragmentImporter(absolute_url());
552 fi.useMacro('metadata_edit_form_macros', 'iptc', 'image_metadata');
560 if(browser
.isDOM2Event
) {
561 if (browser
.isAppleWebKit
) {
562 FilmSlider
.prototype.mouseWheelHandler = function(evt
) {
564 var pos
= this.getSliderPosition();
565 pos
.x
-= evt
.wheelDelta
/ 40;
566 this.setSliderPosition(pos
);
570 FilmSlider
.prototype.mouseWheelHandler = function(evt
) {
572 var pos
= this.getSliderPosition();
573 pos
.x
+= evt
.detail
* 3;
574 this.setSliderPosition(pos
);
578 else if (browser
.isIE6up
) {
579 FilmSlider
.prototype.mouseWheelHandler = function() {
580 var evt
= window
.event
;
581 evt
.returnValue
= false;
582 var pos
= this.getSliderPosition();
583 pos
.x
-= evt
.wheelDelta
/ 40;
584 this.setSliderPosition(pos
);
588 FilmSlider
.prototype.touchStartHandler = function(evt
) {
589 this.filmStartX
= parseInt(this.film
.style
.left
, 10);
590 this.touchStartX
= evt
.pageX
;
593 FilmSlider
.prototype.touchMoveHandler = function(evt
) {
594 var delta
= this.touchStartX
- evt
.pageX
;
595 this.film
.style
.left
= String(this.filmStartX
- delta
) + 'px';
598 FilmSlider
.prototype.touchEndHandler = function(evt
) {
599 this.touchStartX
= undefined;
603 FilmSlider
.prototype.keyDownHandler = function(evt
) {
604 evt
= getEventObject(evt
);
605 switch (evt
.keyCode
) {
607 this.loadSibling(true);
610 this.loadSibling(false);
618 FilmSlider
.prototype.keyPressHandler = function(evt
) {
619 var target
= getTargetedObject(evt
);
620 if (target
.tagName
=== 'INPUT' || target
.tagName
=== 'TEXTAREA') { return; }
621 evt
= getEventObject(evt
);
622 var charPress
= String
.fromCharCode((evt
.keyCode
) ? evt
.keyCode
: evt
.which
);
626 raiseMouseEvent(this.buttons
.full_screen
, 'click');
631 FilmSlider
.prototype.populateViewer = function(req
) {
632 var elements
= req
.responseXML
.documentElement
.childNodes
;
634 for(i
=0 ; i
< elements
.length
; i
++ ) {
635 element
= elements
[i
];
636 switch (element
.nodeName
) {
638 var dest
= document
.getElementById(element
.getAttribute('id'));
639 if (dest
) { dest
.innerHTML
= element
.firstChild
.nodeValue
; }
641 case 'imageattributes' :
642 var link
= this.buttons
.back_to_portfolio
.parentNode
;
643 link
.href
= element
.getAttribute('back_to_context_url');
644 link
= this.buttons
.show_buyable
.parentNode
;
645 var buyable
= element
.getAttribute('buyable');
646 if(buyable
=== 'True') { link
.className
= null; }
647 else if(buyable
=== 'False') { link
.className
= 'hidden'; }
648 this.image
.alt
= element
.getAttribute('alt');
649 this.updateBreadcrumbs(element
.getAttribute('last_bc_url'),
650 element
.getAttribute('img_id'));
656 FilmSlider
.prototype.refreshImage = function() {
657 this.image
.style
.visibility
= 'hidden';
658 this.image
.src
= this.pendingImage
.src
;
659 this.image
.width
= this.pendingImage
.width
;
660 this.image
.height
= this.pendingImage
.height
;
661 this.image
.style
.visibility
= 'visible';
662 if (this.selectedSlideInSelection
) { this.image
.parentNode
.className
= 'selected'; }
663 else { this.image
.parentNode
.className
= ''; }
666 FilmSlider
.prototype.updateBreadcrumbs = function(url
, title
) {
667 if (this.hasBreadcrumbs
) {
668 this.lastBCElement
.href
= element
.getAttribute('lastBcUrl');
669 this.lastBCElement
.innerHTML
= element
.getAttribute('img_id');
673 FilmSlider
.prototype.startSlideShow = function() {
674 this.slideShowSlide
= this.pendingSlideShowSlide
= this.selectedSlide
;
675 return this.slideShowSlide
.href
;
678 FilmSlider
.prototype.slideShowNext = function() {
679 var nextSlide
= this.slideShowSlide
.parentNode
.nextSibling
;
680 if (nextSlide
&& nextSlide
.nodeType
===3) { nextSlide
= nextSlide
.nextSibling
; }
683 nextSlide
= nextSlide
.getElementsByTagName('a')[0];
684 this.pendingSlideShowSlide
= nextSlide
;
685 return this.pendingSlideShowSlide
.href
;
688 var row
= this.slideShowSlide
.parentNode
.parentNode
;
689 var first
= row
.firstChild
;
690 if (first
.nodeType
===3) { first
= first
.nextSibling
; }
691 this.pendingSlideShowSlide
= first
.getElementsByTagName('a')[0];
692 return this.pendingSlideShowSlide
.href
;
696 FilmSlider
.prototype.slideShowPrevious = function() {
697 var previousSlide
= this.slideShowSlide
.parentNode
.previousSibling
;
698 if (previousSlide
&& previousSlide
.nodeType
===3) { previousSlide
= previousSlide
.previousSibling
; }
701 previousSlide
= previousSlide
.getElementsByTagName('a')[0];
702 this.pendingSlideShowSlide
= previousSlide
;
703 return this.pendingSlideShowSlide
.href
;
706 var row
= this.slideShowSlide
.parentNode
.parentNode
;
707 var last
= row
.lastChild
;
708 if (last
.nodeType
===3) { last
= last
.previousSibling
; }
709 this.pendingSlideShowSlide
= last
.getElementsByTagName('a')[0];
710 return this.pendingSlideShowSlide
.href
;
714 FilmSlider
.prototype.slideShowImageLoaded = function() {
715 this.slideShowSlide
= this.pendingSlideShowSlide
;
718 FilmSlider
.prototype.stopSlideShow = function() {
719 raiseMouseEvent(this.slideShowSlide
, 'click');
720 var index
= parseInt(this.selectedSlide
.getAttribute('portfolio:position'), 10);
721 this.centerSlide(index
);
726 function Point(x
, y
) {
727 this.x
= Math
.round(x
);
728 this.y
= Math
.round(y
);
730 Point
.prototype.diff = function(point
) { return new Point(this.x
- point
.x
, this.y
- point
.y
); };
731 Point
.prototype.add = function(point
) { return new Point(this.x
+ point
.x
, this.y
+ point
.y
); };
732 Point
.prototype.mul = function(k
) { return new Point(this.x
* k
, this.y
*k
); };
733 Point
.prototype.toString = function() { return "(" + String(this.x
) + ", " + String(this.y
) + ")"; };