Skip to content

Commit c92e9f2

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 edf5f50 commit c92e9f2

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
@@ -37,6 +37,7 @@ $(document).ready(function() {
3737
Downloads.init();
3838
DownloadBox.init();
3939
PostelizeAnchor.init();
40+
Print.init();
4041
});
4142

4243
function onPopState(fn) {
@@ -808,6 +809,27 @@ var Graphviz = {
808809
}
809810
}
810811

812+
var Print = {
813+
init: function() {
814+
Print.tagline = $("#tagline");
815+
Print.scrollToTop = $("#scrollToTop");
816+
window.matchMedia("print").addListener((mediaQueryList) => {
817+
Print.toggle(mediaQueryList.matches);
818+
});
819+
},
820+
toggle: function(enable) {
821+
if (enable) {
822+
Print.taglineBackup = Print.tagline.html();
823+
Print.tagline.html("--print-out");
824+
Print.scrollToTopDisplay = Print.scrollToTop.attr("display");
825+
Print.scrollToTop.attr("display", "none");
826+
} else {
827+
Print.tagline.html(Print.taglineBackup || "--as-git-as-it-gets");
828+
Print.scrollToTop.attr("display", Print.scrollToTopDisplay);
829+
}
830+
}
831+
}
832+
811833
// Scroll to Top
812834
$('#scrollToTop').removeClass('no-js');
813835
$(window).on('scroll', function() {

0 commit comments

Comments
 (0)