-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Richard Conrardy
authored and
Richard Conrardy
committed
Mar 15, 2024
1 parent
024acb1
commit abbea15
Showing
27 changed files
with
2,395 additions
and
2,288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"left": { | ||
"splitterpos": 183, | ||
"splitterpos": 232, | ||
"topwindowstate": "NORMAL", | ||
"panelheight": 499, | ||
"windowheight": 537 | ||
"panelheight": 657, | ||
"windowheight": 671 | ||
}, | ||
"right": { | ||
"splitterpos": 286, | ||
"splitterpos": 360, | ||
"topwindowstate": "MINIMIZE", | ||
"panelheight": 502, | ||
"windowheight": 540 | ||
"panelheight": 633, | ||
"windowheight": 671 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"TabSet1": 0, | ||
"TabSet2": 5, | ||
"TabSet2": 4, | ||
"TabZoom": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: gongtimer | ||
script: [elapsed_time_bar.js] | ||
|
||
title: gongtimer | ||
author: Andrie de Vries | ||
version: 0.1.0 | ||
quarto-required: ">=1.2.222" | ||
contributes: | ||
revealjs-plugins: | ||
- name: gongtimer | ||
script: | ||
- elapsed_time_bar.js | ||
config: | ||
gongtimer: | ||
# // - (required) your allotted time for presentation | ||
allottedTime: 5 | ||
# // - (optional) height of page/time progress bar | ||
progressBarHeight: 3 | ||
# // - (optional) bar color | ||
barColor: 'rgb(200,0,0)' | ||
# // - (optional) bar color when timer is paused | ||
pausedBarColor: 'rgba(200,0,0,.6)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
// MIT License | ||
// tkrkt/reveal.js-elapsed-time-bar | ||
// https://github.com/tkrkt/reveal.js-elapsed-time-bar | ||
// with minor modifications by Andrie de Vries to support Quarto | ||
|
||
var _gong = { | ||
// default value | ||
barColor: 'rgb(200,0,0)', | ||
pausedBarColor: 'rgba(200,0,0,.6)', | ||
|
||
isPaused: false, | ||
isFinished: false, | ||
|
||
allottedTime: null, | ||
timeProgressBar: null, | ||
startTime: null, | ||
pauseTime: null, | ||
pauseTimeDuration: 0, | ||
|
||
/** | ||
* initialize elements | ||
*/ | ||
handleReady: function(config) { | ||
// var config = Reveal.getConfig(); | ||
|
||
// activate this plugin if config.allottedTime exists. | ||
if (!config.allottedTime) { | ||
console.warn('Failed to start ElapsedTimeBar plugin. "allottedTime" property is required.'); | ||
return; | ||
} | ||
|
||
// set configurations | ||
this.barColor = config.barColor || this.barColor; | ||
this.pausedBarColor = config.pausedBarColor || this.pausedBarColor; | ||
|
||
// calc barHeight from config.barHeight or page-progress container | ||
var barHeight; | ||
var pageProgressContainer = document.querySelector('.progress'); | ||
if (config.progressBarHeight) { | ||
barHeight = parseInt(config.progressBarHeight, 10) + 'px'; | ||
|
||
// override height of page-progress container | ||
pageProgressContainer && (pageProgressContainer.style.height = barHeight); | ||
} else if (config.progress && pageProgressContainer) { | ||
// get height from page-progress container | ||
barHeight = pageProgressContainer.getBoundingClientRect().height + 'px'; | ||
} else { | ||
// default | ||
barHeight = '3px'; | ||
} | ||
|
||
// create container of time-progress | ||
var timeProgressContainer = document.createElement('div'); | ||
timeProgressContainer.classList.add('progress'); | ||
Object.entries({ | ||
display: 'block', | ||
position: 'fixed', | ||
bottom: config.progress ? barHeight : 0, | ||
width: '100%', | ||
height: barHeight | ||
}).forEach(([k, v]) => { | ||
timeProgressContainer.style[k] = v; | ||
}); | ||
document.querySelector('.reveal').appendChild(timeProgressContainer); | ||
|
||
// create content of time-progress | ||
this.timeProgressBar = document.createElement('div'); | ||
Object.entries({ | ||
height: '100%', | ||
willChange: 'width' | ||
}).forEach(([k, v]) => { | ||
this.timeProgressBar.style[k] = v; | ||
}); | ||
timeProgressContainer.appendChild(this.timeProgressBar); | ||
|
||
// start timer | ||
this.start(config.allottedTime); | ||
}, | ||
|
||
/** | ||
* update repeatedly using requestAnimationFrame. | ||
*/ | ||
loop() { | ||
if (this.isPaused) return; | ||
var now = +new Date(); | ||
var elapsedTime = now - this.startTime - this.pauseTimeDuration; | ||
if (elapsedTime > this.allottedTime) { | ||
this.timeProgressBar.style.width = '100%'; | ||
this.isFinished = true; | ||
} else { | ||
this.timeProgressBar.style.width = elapsedTime / this.allottedTime * 100 + '%'; | ||
requestAnimationFrame(this.loop.bind(this)); | ||
} | ||
}, | ||
|
||
/** | ||
* set color of progress bar | ||
*/ | ||
setBarColor() { | ||
if (this.isPaused) { | ||
this.timeProgressBar.style.backgroundColor = this.pausedBarColor; | ||
} else { | ||
this.timeProgressBar.style.backgroundColor = this.barColor; | ||
} | ||
}, | ||
|
||
/** | ||
* start(reset) timer with new allotted time. | ||
* @param {number} allottedTime | ||
* @param {number} [elapsedTime=0] | ||
*/ | ||
start(allottedTime, elapsedTime = 0) { | ||
this.isFinished = false; | ||
this.isPaused = false; | ||
this.allottedTime = allottedTime; | ||
this.startTime = +new Date() - elapsedTime; | ||
this.pauseTimeDuration = 0; | ||
this.setBarColor(); | ||
this.loop(); | ||
}, | ||
|
||
reset() { | ||
this.start(this.allottedTime); | ||
}, | ||
|
||
pause() { | ||
if (this.isPaused) return; | ||
this.isPaused = true; | ||
this.pauseTime = +new Date(); | ||
this.setBarColor(); | ||
}, | ||
|
||
resume() { | ||
if (!this.isPaused) return; | ||
|
||
// add paused time duration | ||
this.isPaused = false; | ||
this.pauseTimeDuration += new Date() - this.pauseTime; | ||
this.pauseTime = null; | ||
this.setBarColor(); | ||
this.loop(); | ||
} | ||
}; | ||
|
||
|
||
const initGong = function(deck) { | ||
const config = deck.getConfig(); | ||
const options = config.gongtimer || {}; | ||
options.allottedTime = options.allottedTime * 60 * 1000; | ||
window.addEventListener('ready', () => _gong.handleReady(options)); | ||
} | ||
|
||
|
||
window.gongtimer = window.gongtimer || function() { | ||
return { | ||
id: 'gongtimer', | ||
init: (deck) => { | ||
initGong(deck); | ||
}, | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
quarto-pub: | ||
- id: 65a90d48-d9b0-4791-b6ed-3db7ab4cbc85 | ||
url: 'https://phbern-rconrardy.quarto.pub/seminare' | ||
|
Oops, something went wrong.