thibaud-rohmer / PhotoShow

A free web gallery in PHP with drag-n-drop support
http://www.photoshow-gallery.com
502 stars 151 forks source link

"Esc" and Play/Stop Slideshow put the FullScreen at a mess #354

Open vletroye opened 6 years ago

vletroye commented 6 years ago

Once one enters the fullscreen mode to play a slideshow, playing with Esc/Stop/Play/etc... will result in a mess, with the image_panel maximized although it should not.

Here the changes I did in src\js\slideshow.js to fix this:


function toggleFullScreen() {
  var doc = window.document;
  var docEl = doc.getElementById("image_panel");

  var requestFullScreen = docEl.requestFullscreen || docEl.mozRequestFullScreen || docEl.webkitRequestFullScreen || docEl.msRequestFullscreen;
  var cancelFullScreen = doc.exitFullscreen || doc.mozCancelFullScreen || doc.webkitExitFullscreen || doc.msExitFullscreen;

  if(!isFullScreen()) {  //<<=========================== Changed
    requestFullScreen.call(docEl);
  }
  else {
    cancelFullScreen.call(doc);
  }
}

function isFullScreen() { //<<=========================== New Method
  var doc = window.document;
  return (doc.fullscreenElement || doc.mozFullScreenElement || doc.webkitFullscreenElement || doc.msFullscreenElement);
}

function start_slideshow(){ 
    slideshow_status = 1; 
    timer = setInterval('run_slideshow()',3000);
    $(".image_panel").css("position","fixed");
    $(".image_panel").css("z-index",5000);
    $(".image_panel").animate({bottom:'0'},200);
    hide_links();

    if(!isFullScreen()) {  //<<=========================== Add an if
      toggleFullScreen();
    }
}

function play_slideshow(){
    slideshow_status = 1;  //<<======================== Changed
    timer = setInterval('run_slideshow()',3000);  //<<=========== Changed
    $("#pause").show();
    $("#play").hide();
}

function stop_slideshow(){
    slideshow_status = 0;
    clearInterval(timer);
    $(".image_panel").animate({bottom:'150'},200);
    $(".image_panel").css("position","absolute");
    $(".image_panel").css("z-index",50);
    show_links();

    if(isFullScreen()) {  //<<=========================== Add an if
      toggleFullScreen();
    }   
}
andiges commented 6 years ago

@vletroye maybe it will be better, if you create a patch and do a pull request? I think it will be easier to understand what you did and it can be faster merged into master. This also affects other issues: #353 #352 #351 created by you.

thibaud-rohmer commented 6 years ago

Entirely agree (in fact, I was going to write basically the same answer).

Thanks Andrej for the reactivity :D and thanks Valery for the proposals : indeed, a pull request (or several, as you prefer) would be better !

On Thu, 2 Nov 2017 at 14:25 Andrej notifications@github.com wrote:

@vletroye https://github.com/vletroye maybe it will be better, if you create a patch and do a pull request? I think it will be easier to understand what you did and it can be faster merged into master. This also affects other issues: #353 https://github.com/thibaud-rohmer/PhotoShow/issues/353 #352 https://github.com/thibaud-rohmer/PhotoShow/issues/352 #351 https://github.com/thibaud-rohmer/PhotoShow/issues/351 created by you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thibaud-rohmer/PhotoShow/issues/354#issuecomment-341419740, or mute the thread https://github.com/notifications/unsubscribe-auth/AAgnQzm1ZuTSeUjlmKB2EZ8Q5iQhE6Qnks5sycLIgaJpZM4QOeAu .

vletroye commented 6 years ago

You are 100% right ! But I am still trying to figure out how to work with github from command line... I was much more confortable with CodePlex (TFS) I have to say (And only able to use it from Visual Studio)

I have now installed Git on my Synology, but I am still reading Git documentation and... it's actually far from clear for me I have to say. I was only able to clone a branch using git clone https://.....//.git --branch xxx... :(

Do you have a clear and straightforward how-to for dummies ? Ex.: Git Clone xxx, Git Pull xxx, Change your code, Gut Push xxx ? (I will continue to google on that in the mean time ;)

vletroye commented 6 years ago

Ok, as I am lost with Git commands, I did a fork and opened it with Visual Studio... I was finally ably to create a Pull Request: https://github.com/thibaud-rohmer/PhotoShow/pull/355

I hope it's ok?!