Skip to content

Commit 03ebc9e

Browse files
committed
Add the button
Default is this hidden as only 50% of the browser engines on my system support this feature.
1 parent 30c977e commit 03ebc9e

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

webapp/public/js/domjudge.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,3 +1292,22 @@ function initScoreboardSubmissions() {
12921292
});
12931293
});
12941294
}
1295+
1296+
$(function () {
1297+
function checkExperimentalFeature() {
1298+
if ("documentPictureInPicture" in window) {
1299+
// Only the team interface has this button.
1300+
const togglePipButton = document.querySelector("#pop-out-button");
1301+
if (togglePipButton) {
1302+
togglePipButton.style.display = 'inline';
1303+
togglePipButton.addEventListener("click", togglePictureInPicture, false);
1304+
}
1305+
} else {
1306+
const pipMessage = document.querySelector("#no-picture-in-picture");
1307+
if (pipMessage) {
1308+
pipMessage.style.display = 'inline';
1309+
}
1310+
}
1311+
}
1312+
checkExperimentalFeature();
1313+
});

webapp/public/style_domjudge.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,3 +757,11 @@ blockquote {
757757
height: 80vh;
758758
border: 1px solid grey;
759759
}
760+
761+
#pop-out-button {
762+
display: none;
763+
}
764+
765+
#no-picture-in-picture {
766+
display: none;
767+
}

webapp/templates/team/index.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
}
4747
4848
$('[data-flash-messages]').html($flash);
49+
50+
checkExperimentalFeature();
4951
}
5052
5153
window.initModalClarificationPreviewAdd = function() {

webapp/templates/team/partials/index_content.html.twig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@
4646
Request clarification
4747
</a>
4848
</div>
49+
<h1 class="teamoverview">Experimental feature</h1>
50+
<div class="m-1">
51+
<p id="no-picture-in-picture">
52+
Ask your Tech team for another browser (<code>Document Picture-in-Picture API not available
53+
<p>
54+
<span class="btn btn-warning btn-sm" id="pop-out-button">
55+
<i class="fa-solid fa-explosion"></i> PR Pop-out
56+
</span>
57+
</div>
4958
</div>
5059
</div>
5160
{% endif %}

0 commit comments

Comments
 (0)