--- a/web/static/res/js/incchoice.js Mon Jan 21 21:00:24 2013 +0100
+++ b/web/static/res/js/incchoice.js Mon Jan 21 21:04:36 2013 +0100
@@ -18,7 +18,7 @@
// Words display
//----------------------------------------------------------------------------------------------------------------------------
- this.setMosaicImages = function(images1, images2, images3)
+ this.setMosaicImages = function(images1, images2, images3, postFirstImageCallback)
{
// Choose 2 image for the effect
this.image1 = images1[incMosaic.randomInt(0, images1.length)];
@@ -29,7 +29,7 @@
incMosaic.addImageUrl("static/res/img/" + this.image2);
incMosaic.addImageUrl("static/res/img/" + this.image3);
- incMosaic.start("mosaic", effectSpeed, 9, 5, true, true, function() {incChoice.effectIsDone();});
+ incMosaic.start("mosaic", effectSpeed, 9, 5, true, true, function() {incChoice.effectIsDone();}, postFirstImageCallback);
};
this.setWordsAndEffect = function(choiceIndex)
@@ -104,7 +104,7 @@
if (this.currentWorldIndex == 3) {
// The 3 words get choosen
- location.href = "niv1_videoplayer.html";
+ location.href = "film-aleatoire-the-end-etc.html";
} else {
// Start the mosaic effect
@@ -270,36 +270,50 @@
this.createShareUrl = function(index1, index2, index3)
{
- var index = this.getChoosenWords();
- var param = ((index[0] << 16) | (index[1] << 8) | index[2]) << 4;
+ var index = this.getChosenVideos();
+ var code = index[0] + index[2]
+ var param = (index[0] << 24) | (index[1] << 16) | (index[2] << 8) | code;
var urlBase = document.URL;
+ urlBase = urlBase.replace("partage-du-film-aleatoire-the-end-etc", "film-aleatoire-the-end-etc");
var url = urlBase + "?" + param;
+
return url;
}
this.readUrlVideosIndex = function()
{
var query = window.location.search.substring(1);
- if (query.length < 0) {
- return;
+ if (query.length == 0) {
+ return [];
}
+ return this.decodeUrlIndex(query);
+ };
+ this.decodeUrlIndex = function(query)
+ {
var number = parseInt(query);
- number >>= 4;
+ var code = number & 255;
+ number >>= 8;
var index3 = number & 255;
number >>= 8;
var index2 = number & 255;
number >>= 8;
var index1 = number & 255;
- var maxVideoIndex = this.allSequencesData.videos.length - 1;
- if (index1 > maxVideoIndex || index2 > maxVideoIndex || index3 > maxVideoIndex) {
+ if (code != index1 + index3) {
return [];
}
+ if (typeof( incPlayer ) != "undefined") {
+ var maxVideoIndex = incPlayer.allSequencesData.videos.length - 1;
+ if (index1 > maxVideoIndex || index2 > maxVideoIndex || index3 > maxVideoIndex) {
+ return [];
+ }
+ }
+
return [index1, index2, index3];
- };
+ }
//----------------------------------------------------------------------------------------------------------------------------
// Cookies tools