Skip to content

Commit

Permalink
replace modernizr.js by CSS any-hover:hover media feature
Browse files Browse the repository at this point in the history
When trying to update to modernizr v3.13.0, it appeared that:
- we would have had to rename all "hidden" classes to another name because it
conflicts with the hidden class set by Modernizr v3 in its standard config
- the "touch" class was replaced by either thouchevents or pointerevents
making it less reliable for our use case
- it is possible to detect whether the device supports hover in CSS through
any-hover:hover media feature. So we make use of this.
See: Modernizr/Modernizr#873 (comment)
  • Loading branch information
tenzap committed Dec 12, 2024
1 parent 66e0c7f commit c466346
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion application/views/main/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

</style>
<link type="text/css" rel="stylesheet" href="<?php echo $this->config->item('css_path');?>jquery-ui/jquery-ui.min.css" />
<script defer language="javascript" src="<?php echo $this->config->item('js_path');?>modernizr.min.js"></script>
<script language="javascript" src="<?php echo $this->config->item('js_path');?>jquery-3.7.1.min.js"></script>
<script language="javascript" src="<?php echo $this->config->item('js_path');?>jquery-plugin/jquery.hotkeys.js"></script>
<script language="javascript" src="<?php echo $this->config->item('js_path');?>jquery-plugin/jquery.field.min.js"></script>
Expand Down
1 change: 0 additions & 1 deletion docs/CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Chart.js API 4.4.7 <https://www.chartjs.org>
b8 Bayesian spam filter 0.7 <http://nasauber.de/opensource/b8/>
Notification sound: 'ponderous.m4a' - Converted from Ponderous.ogg to M4A based on the work of Aarni Koskela <[email protected]> at <https://github.com/akx/Notifications/>, License: https://spdx.org/licenses/CC0-1.0.html or https://spdx.org/licenses/CC-BY-3.0.html
jQuery Word/Character Counter <http://www.jamesfairhurst.co.uk/posts/view/jquery_word_character_counter>
Modernizr 2.8.3 <https://github.com/Modernizr/Modernizr> - License: BSD and MIT

Developer
==========
Expand Down
6 changes: 4 additions & 2 deletions media/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,10 @@ textarea {
display: none;
}

.no-touch .no-touch-hidden {
display: none;
@media (any-hover: hover) {
.no-touch-hidden {
display: none;
}
}

.hover_show:hover .no-touch-hidden {
Expand Down
1 change: 0 additions & 1 deletion media/js/modernizr.min.js

This file was deleted.

0 comments on commit c466346

Please sign in to comment.