Skip to content

Commit 350ec93

Browse files
committed
Show a different tagline for print media
The taglines are a little fun thing to have, but in printouts, they cannot change all the time, so let's have a fixed one there. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 84bdc9f commit 350ec93

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

assets/js/application.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ $(document).ready(function() {
3939
Downloads.init();
4040
DownloadBox.init();
4141
PostelizeAnchor.init();
42+
Print.init();
4243
});
4344

4445
function onPopState(fn) {
@@ -784,6 +785,27 @@ var PostelizeAnchor = {
784785
},
785786
}
786787

788+
var Print = {
789+
init: function() {
790+
Print.tagline = $("#tagline");
791+
Print.scrollToTop = $("#scrollToTop");
792+
window.matchMedia("print").addListener((mediaQueryList) => {
793+
Print.toggle(mediaQueryList.matches);
794+
});
795+
},
796+
toggle: function(enable) {
797+
if (enable) {
798+
Print.taglineBackup = Print.tagline.html();
799+
Print.tagline.html("--print-out");
800+
Print.scrollToTopDisplay = Print.scrollToTop.attr("display");
801+
Print.scrollToTop.attr("display", "none");
802+
} else {
803+
Print.tagline.html(Print.taglineBackup || "--as-git-as-it-gets");
804+
Print.scrollToTop.attr("display", Print.scrollToTopDisplay);
805+
}
806+
}
807+
}
808+
787809
// Scroll to Top
788810
$('#scrollToTop').removeClass('no-js');
789811
$(window).scroll(function() {

0 commit comments

Comments
 (0)