Commit febabf42 authored by Curtis Adam's avatar Curtis Adam

Check if the pomodoro timer is already running if the user opens the leitner or wozniak view

parent 751d4bde
......@@ -356,6 +356,12 @@ export let PomodoroTimer = class PomodoroTimer {
}
}
static stop () {
if (this.isPomodoroRunning()) {
this.clickClock();
}
}
/*if not in a session, clicking the clock opens the start up modal to begin one, and if you are in a session, clicking pops up a warning dialog before exiting the session */
static clickClock () {
/*okay, so I tried this pen on my android phone and no sounds would play. Turns out that you need to attach sounds to a click function or they won't run on chrome for android. This empty sound allows the success and failure sounds to play, but not the bell sound. Oh well, this app wouldn't work on a phone anyway, because the screen would lock and exit it.*/
......
......@@ -22,6 +22,8 @@ BrowserPolicy.content.allowOriginForAll('https://casual-effects.com');
BrowserPolicy.content.allowOriginForAll('https://www.linguee.de');
BrowserPolicy.content.allowOriginForAll('https://translate.google.com');
BrowserPolicy.content.allowOriginForAll('https://www.deepl.com');
BrowserPolicy.content.allowOriginForAll('https://arsnova.eu');
BrowserPolicy.content.allowOriginForAll('https://arsnova.click');
BrowserPolicy.content.allowFrameOrigin('*');
......
......@@ -10,8 +10,8 @@ import {PomodoroTimer} from "../../../../api/pomodoroTimer";
Template.cardSidebarItemBackToCardset.events({
"click .backToCardset": function () {
if ((Route.isBox() || Route.isMemo()) && PomodoroTimer.isPomodoroRunning()) {
PomodoroTimer.clickClock();
if (Route.isBox() || Route.isMemo()) {
PomodoroTimer.stop();
} else {
Router.go('cardsetdetailsid', {
_id: Router.current().params._id
......
......@@ -9,6 +9,8 @@ import {CardNavigation} from "../../api/cardNavigation";
import "./learn.html";
import "./modal/leitner/leitnerHelp.js";
import "./modal/wozniak/wozniakHelp.js";
import {PomodoroTimer} from "../../api/pomodoroTimer";
import {Bonus} from "../../api/bonus";
Meteor.subscribe("cardsets");
Session.set('animationPlaying', false);
......@@ -32,7 +34,9 @@ Template.learnAlgorithms.onDestroyed(function () {
});
Template.learnAlgorithms.onRendered(function () {
$('.pomodoroTimer').click();
if (Bonus.isInBonus(Router.current().params._id)) {
PomodoroTimer.start();
}
});
Template.learnAlgorithms.helpers({
......
......@@ -61,9 +61,16 @@ Template.pomodoroTimerModal.onRendered(function () {
if (Bonus.isInBonus(Router.current().params._id)) {
PomodoroTimer.start();
} else {
$('#pomodoroTimerModal').modal('show');
if (!PomodoroTimer.isPomodoroRunning()) {
$('#pomodoroTimerModal').modal('show');
}
}
}
$('#pomodoroTimerModal').on('hidden.bs.modal', function () {
if (Route.isBox() || Route.isMemo() && !PomodoroTimer.isPomodoroRunning()) {
PomodoroTimer.start();
}
});
});
Template.pomodoroTimerModalContent.helpers({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment