web/index.html
changeset 5 62959dc4ff0d
parent 4 678402f3f5cd
child 6 9b3c3c34a288
equal deleted inserted replaced
4:678402f3f5cd 5:62959dc4ff0d
    79         </div>
    79         </div>
    80       </div>
    80       </div>
    81     </footer>
    81     </footer>
    82   </div>
    82   </div>
    83   <script type="text/javascript" src="./lib/jquery-1.9.1.js"></script>
    83   <script type="text/javascript" src="./lib/jquery-1.9.1.js"></script>
       
    84   <script type="text/javascript" src="./lib/jquery.history.js"></script>
    84   <script type="text/javascript" src="./lib/bootstrap/js/bootstrap.min.js"></script>
    85   <script type="text/javascript" src="./lib/bootstrap/js/bootstrap.min.js"></script>
    85   <script type="text/javascript">
    86   <script type="text/javascript">
    86 
    87     
    87     var iframes = {
    88     var iframes = {
    88       "0" : "<iframe src='http://ldt.iri.centrepompidou.fr//ldtplatform/ldt/embediframe/?content_id=53574ae4-49e9-11e2-b4ad-00145ea4a2be&project_id=a94ee060-49e9-11e2-b4ad-00145ea4a2be&createannotation=True&tag_titles=&polemic=all&annotations_list=True&autostart=True&annotation=True' width='570' height='1300' seamless='seamless'></iframe>",
    89       "0" : "<iframe src='http://ldt.iri.centrepompidou.fr//ldtplatform/ldt/embediframe/?content_id=53574ae4-49e9-11e2-b4ad-00145ea4a2be&project_id=a94ee060-49e9-11e2-b4ad-00145ea4a2be&createannotation=True&tag_titles=&polemic=all&annotations_list=True&autostart=True&annotation=True' width='570' height='1300' seamless='seamless'></iframe>",
    89       "1" : "<p>iframe à venir, vidéo n°1</p>",
    90       "1" : "<p>iframe à venir, vidéo n°1</p>",
    90       "2" : "<p>iframe à venir, vidéo n°2</p>",
    91       "2" : "<p>iframe à venir, vidéo n°2</p>",
    91       "3" : "<p>iframe à venir, vidéo n°3</p>",
    92       "3" : "<p>iframe à venir, vidéo n°3</p>",
    94       "6" : "<p>iframe à venir, vidéo n°6</p>",
    95       "6" : "<p>iframe à venir, vidéo n°6</p>",
    95       "7" : "<p>iframe à venir, vidéo n°7</p>",
    96       "7" : "<p>iframe à venir, vidéo n°7</p>",
    96       "full" : "<iframe src='http://ldt.iri.centrepompidou.fr//ldtplatform/ldt/embediframe/?content_id=62083f72-363c-11e3-8068-00145ea4a2be&project_id=032aebaa-37de-11e3-a863-00145ea4a2be&createannotation=True&tag_titles=&polemic=all&annotations_list=True&autostart=True&annotation=True' width='570' height='1300' seamless='seamless'></iframe>",
    97       "full" : "<iframe src='http://ldt.iri.centrepompidou.fr//ldtplatform/ldt/embediframe/?content_id=62083f72-363c-11e3-8068-00145ea4a2be&project_id=032aebaa-37de-11e3-a863-00145ea4a2be&createannotation=True&tag_titles=&polemic=all&annotations_list=True&autostart=True&annotation=True' width='570' height='1300' seamless='seamless'></iframe>",
    97     };
    98     };
    98 
    99 
    99     $(function() {
   100     function displayIframe(n, update_h){
   100       $(".videolink").click(function(e){
       
   101         playVideo($(this).attr("data-videoid"));
       
   102       });
       
   103       // load first video
       
   104       playVideo("full");
       
   105     });
       
   106 
       
   107     function displayIframe(n){
       
   108       $("#videocontainer").html(iframes[n]);
   101       $("#videocontainer").html(iframes[n]);
   109     }
   102       
   110     
   103       // update history
   111     function playVideo(n){
   104       update_h = typeof update_h !== 'undefined' ? update_h : true;
       
   105       if(update_h){
       
   106         update_history("iframe=" + n);
       
   107       }
       
   108     }
       
   109     
       
   110     function playVideo(n, update_h){
   112       if (n=="1" || n=="2" || n=="3" || n=="4" || n=="5" || n=="6" || n=="7" || n=="1r" || n=="2r" || n=="3r" || n=="4r" || n=="5r" || n=="6r" || n=="7r"){
   111       if (n=="1" || n=="2" || n=="3" || n=="4" || n=="5" || n=="6" || n=="7" || n=="1r" || n=="2r" || n=="3r" || n=="4r" || n=="5r" || n=="6r" || n=="7r"){
   113         $("#videocontainer").html("<p>à venir, vidéo n°" + n + "</p>");
   112         $("#videocontainer").html("<p>à venir, vidéo n°" + n + "</p>");
   114       }
   113       }
   115       else{
   114       else{
   116         var s = ''
   115         var s = ''
   211  + '</div>'
   210  + '</div>'
   212  + '<div><p class="text-right"><a style="margin-top: 10px;" class="btn btn-info" href="#" onclick="displayIframe(\'__NUM_JSON__\');return false;"><i class="glyphicon glyphicon-comment"></i> Ajouter votre commentaire sur cette vidéo</a></p></div>';
   211  + '<div><p class="text-right"><a style="margin-top: 10px;" class="btn btn-info" href="#" onclick="displayIframe(\'__NUM_JSON__\');return false;"><i class="glyphicon glyphicon-comment"></i> Ajouter votre commentaire sur cette vidéo</a></p></div>';
   213       
   212       
   214         $("#videocontainer").html(s.replace(/__NUM_JSON__/g, n));
   213         $("#videocontainer").html(s.replace(/__NUM_JSON__/g, n));
   215       }
   214       }
   216     }
   215       
       
   216       // update history
       
   217       update_h = typeof update_h !== 'undefined' ? update_h : true;
       
   218       if(update_h){
       
   219         update_history("v=" + n);
       
   220       }
       
   221     }
       
   222     
       
   223     //Functions to manage history with parameters
       
   224     function getURLParameter(name) {
       
   225         return decodeURI(
       
   226             (RegExp(name + '=' + '(.+?)(&|$)').exec(location.hash)||[,null])[1]
       
   227         );
       
   228     }
       
   229     function update_history(s){
       
   230         History.replaceState(null, null, "#" + s);
       
   231     }
       
   232     
       
   233     // on load
       
   234     $(function() {
       
   235       $(".videolink").click(function(e){
       
   236         playVideo($(this).attr("data-videoid"));
       
   237       });
       
   238       // load first video with get parameter
       
   239       var first = "full";
       
   240       var iframe = getURLParameter("iframe");
       
   241       if(iframe=="null"){
       
   242         var v = getURLParameter("v");
       
   243         if(v=="null"){
       
   244           playVideo(first, false);
       
   245         }
       
   246         else{
       
   247           playVideo(v, false);
       
   248         }
       
   249       }
       
   250       else{
       
   251         displayIframe(iframe, false)
       
   252 	  }
       
   253     });
       
   254     
   217   </script>
   255   </script>
   218 </body>
   256 </body>
   219 </html>
   257 </html>