Merge pull request #824 from thelounge/xpaw/time-tooltip

Use css tooltips on time elements, ability to view time on mobile
This commit is contained in:
Jérémie Astori 2017-04-13 02:04:15 -04:00 committed by GitHub
commit 5890a3def1
5 changed files with 62 additions and 30 deletions

View File

@ -839,7 +839,6 @@ kbd {
word-wrap: break-word; word-wrap: break-word;
word-break: break-word; /* Webkit-specific */ word-break: break-word; /* Webkit-specific */
display: flex; display: flex;
overflow: hidden;
position: relative; position: relative;
} }
@ -1520,9 +1519,10 @@ kbd {
} }
/** /**
* Tooltips * Tooltips v0.5.3
* See http://primercss.io/tooltips/ * See http://primercss.io/tooltips/
*/ */
.tooltipped { .tooltipped {
position: relative; position: relative;
} }
@ -1530,12 +1530,11 @@ kbd {
.tooltipped:after { .tooltipped:after {
position: absolute; position: absolute;
z-index: 1000000; z-index: 1000000;
display: inline-block; display: none;
visibility: hidden;
opacity: 0;
padding: 5px 8px; padding: 5px 8px;
font: 12px Lato; font: 12px Lato;
line-height: 1.2; line-height: 1.2;
-webkit-font-smoothing: subpixel-antialiased;
color: #fff; color: #fff;
text-align: center; text-align: center;
text-decoration: none; text-decoration: none;
@ -1548,23 +1547,40 @@ kbd {
content: attr(aria-label); content: attr(aria-label);
background: #222; background: #222;
border-radius: 3px; border-radius: 3px;
-webkit-font-smoothing: subpixel-antialiased; opacity: 0;
transition: .2s;
} }
.tooltipped:before { .tooltipped:before {
position: absolute; position: absolute;
z-index: 1000001; z-index: 1000001;
display: inline-block; display: none;
visibility: hidden;
opacity: 0;
width: 0; width: 0;
height: 0; height: 0;
color: #fff; color: #fff;
pointer-events: none; pointer-events: none;
content: ""; content: "";
border: 5px solid transparent; border: 5px solid transparent;
transition: .2s; opacity: 0;
}
@-webkit-keyframes tooltip-appear {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes tooltip-appear {
from {
opacity: 0;
}
to {
opacity: 1;
}
} }
.tooltipped:hover:before, .tooltipped:hover:before,
@ -1573,9 +1589,18 @@ kbd {
.tooltipped:active:after, .tooltipped:active:after,
.tooltipped:focus:before, .tooltipped:focus:before,
.tooltipped:focus:after { .tooltipped:focus:after {
visibility: visible; display: inline-block;
opacity: 1;
text-decoration: none; text-decoration: none;
-webkit-animation-name: tooltip-appear;
animation-name: tooltip-appear;
-webkit-animation-duration: .1s;
animation-duration: .1s;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: ease-in;
animation-timing-function: ease-in;
-webkit-animation-delay: .4s;
animation-delay: .4s;
} }
.tooltipped-s:after, .tooltipped-s:after,
@ -1672,6 +1697,17 @@ kbd {
border-right-color: #222; border-right-color: #222;
} }
@media only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-moz-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2),
only screen and (min-resolution: 192dpi),
only screen and (min-resolution: 2dppx) {
.tooltipped-w:after {
margin-right: 4.5px;
}
}
/* End tooltips */ /* End tooltips */
/** /**
@ -1764,12 +1800,8 @@ kbd {
* - https://www.w3.org/TR/mediaqueries-4/ * - https://www.w3.org/TR/mediaqueries-4/
* - https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover * - https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover
*/ */
.tooltipped:hover:before, .tooltipped-no-touch:hover:before,
.tooltipped:hover:after, .tooltipped-no-touch:hover:after {
.tooltipped:active:before,
.tooltipped:active:after,
.tooltipped:focus:before,
.tooltipped:focus:after {
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
} }

View File

@ -34,11 +34,11 @@
</div> </div>
</aside> </aside>
<footer id="footer"> <footer id="footer">
<span class="tooltipped tooltipped-n" aria-label="Sign in"><button class="icon sign-in" data-target="#sign-in" aria-label="Sign in"></button></span> <span class="tooltipped tooltipped-n tooltipped-no-touch" aria-label="Sign in"><button class="icon sign-in" data-target="#sign-in" aria-label="Sign in"></button></span>
<span class="tooltipped tooltipped-n" aria-label="Connect to network"><button class="icon connect" data-target="#connect" aria-label="Connect to network"></button></span> <span class="tooltipped tooltipped-n tooltipped-no-touch" aria-label="Connect to network"><button class="icon connect" data-target="#connect" aria-label="Connect to network"></button></span>
<span class="tooltipped tooltipped-n" aria-label="Client settings"><button class="icon settings" data-target="#settings" aria-label="Client settings"></button></span> <span class="tooltipped tooltipped-n tooltipped-no-touch" aria-label="Client settings"><button class="icon settings" data-target="#settings" aria-label="Client settings"></button></span>
<span class="tooltipped tooltipped-n" aria-label="Help"><button class="icon help" data-target="#help" aria-label="Help"></button></span> <span class="tooltipped tooltipped-n tooltipped-no-touch" aria-label="Help"><button class="icon help" data-target="#help" aria-label="Help"></button></span>
<span class="tooltipped tooltipped-n" aria-label="Sign out"><button class="icon sign-out" id="sign-out" aria-label="Sign out"></button></span> <span class="tooltipped tooltipped-n tooltipped-no-touch" aria-label="Sign out"><button class="icon sign-out" id="sign-out" aria-label="Sign out"></button></span>
</footer> </footer>
<div id="main"> <div id="main">
<div id="windows"> <div id="windows">
@ -68,10 +68,10 @@
--><span id="save-nick-tooltip" class="tooltipped tooltipped-e" aria-label="Save"><button id="submit-nick" type="button" aria-label="Save"></button></span> --><span id="save-nick-tooltip" class="tooltipped tooltipped-e" aria-label="Save"><button id="submit-nick" type="button" aria-label="Save"></button></span>
</span> </span>
<textarea id="input" class="mousetrap"></textarea> <textarea id="input" class="mousetrap"></textarea>
<span id="cycle-nicks-tooltip" class="tooltipped tooltipped-w" aria-label="Cycle through nicks"> <span id="cycle-nicks-tooltip" class="tooltipped tooltipped-w tooltipped-no-touch" aria-label="Cycle through nicks">
<button id="cycle-nicks" type="button" aria-label="Cycle through nicks"></button> <button id="cycle-nicks" type="button" aria-label="Cycle through nicks"></button>
</span> </span>
<span id="submit-tooltip" class="tooltipped tooltipped-w" aria-label="Send message"> <span id="submit-tooltip" class="tooltipped tooltipped-w tooltipped-no-touch" aria-label="Send message">
<button id="submit" type="submit" aria-label="Send message"></button> <button id="submit" type="submit" aria-label="Send message"></button>
</span> </span>
</div> </div>

View File

@ -1,5 +1,5 @@
<div class="msg {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" id="msg-{{id}}" data-time="{{time}}" data-from="{{from}}"> <div class="msg {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" id="msg-{{id}}" data-time="{{time}}" data-from="{{from}}">
<span class="time" title="{{localetime time}}"> <span class="time tooltipped tooltipped-e" aria-label="{{localetime time}}">
{{tz time}} {{tz time}}
</span> </span>
<span class="from"> <span class="from">

View File

@ -1,5 +1,5 @@
<div class="msg {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" id="msg-{{id}}" data-time="{{time}}"> <div class="msg {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" id="msg-{{id}}" data-time="{{time}}">
<span class="time" title="{{localetime time}}"> <span class="time tooltipped tooltipped-e" aria-label="{{localetime time}}">
{{tz time}} {{tz time}}
</span> </span>
<span class="from"></span> <span class="from"></span>

View File

@ -1,5 +1,5 @@
<div class="msg {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" data-time="{{time}}"> <div class="msg {{type}}{{#if self}} self{{/if}}{{#if highlight}} highlight{{/if}}" data-time="{{time}}">
<span class="time" title="{{localetime time}}"> <span class="time tooltipped tooltipped-e" aria-label="{{localetime time}}">
{{tz time}} {{tz time}}
</span> </span>
<span class="from">[{{command}}]</span> <span class="from">[{{command}}]</span>