Plugin: card_game: Fix issue preventing puzzle to reappear after hiding it

Add function doc
pull/2729/head
Yannick Warnier 7 years ago
parent 3bcd26bd71
commit d61c28081b
  1. 14
      plugin/card_game/resources/js/cardgame.js

@ -6,12 +6,15 @@ $(document).ready(function($){
} else {
$('.sidebar .panel-body .img-circle').parent().parent().after('<div class="enjoy-cardgame-active" onClick="installCardView()" ></div>');
}
});
/**
* This function inserts the <article> element 'home-card' for the card game
* before the .page-content element on the page (the right side of the
* "my courses" page) only if the element with id 'home-card' does not exist
* yet.
*/
function installCardView(){
if (!document.getElementById("home-card")) {
var mess1 = $("#cardgamemessage").html();
var h = '<article id="home-card" style="border:solid 1px gray;" >';
@ -58,7 +61,7 @@ function installCardView(){
$('.page-content').before(h);
} else {
$('#home-card').fadeOut();
$('#home-card').fadeToggle();
}
}
@ -168,6 +171,9 @@ function randomOpenCardView(){
}
}
/**
* This function changes the visibility of blocks inside the puzzle area
*/
function onlyOpenCardView(){
installCardView();

Loading…
Cancel
Save