mediawiki-extensions-Echo/modules/overlay/ext.echo.overlay.less

203 lines
3.2 KiB
Plaintext
Raw Normal View History

@import '../mixins.less';
@offset: 200px;
@chevronHeight: 11px;
@headerFontSize: .8em;
.mw-echo-overlay {
position: absolute;
top: 30px + @chevronHeight;
border: 1px solid silver;
background-color: #fff;
width: 450px;
min-height: 2em;
padding: 0;
color: #6D6D6D;
z-index: 100;
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.35);
// IE8
&:before,
&::before {
content: '';
background-image: url('PokeyNorth.png');
background-repeat: no-repeat;
width: 21px;
height: @chevronHeight;
position: absolute;
z-index: 101;
top: -@chevronHeight;
// subtract half the width from the offset and then add the left box shadow
left: @offset - 10px + 3px;
}
button {
top: 15px;
right: 15px;
position: absolute;
padding: 0;
}
.mw-ui-progressive {
cursor: pointer;
}
a.mw-echo-grey-link {
color: #6D6D6D;
}
.mw-echo-notifications,
ul {
overflow: auto;
padding: 0;
margin: 0;
}
.mw-echo-notifications {
button {
// Add 1px border to 15px line height so lines up with tabs
line-height: 16px;
font-size: @headerFontSize;
}
}
li.mw-echo-notification {
display: block;
padding: 0;
&:hover {
.mw-echo-notification-wrapper {
background-color: #F9F9F9;
}
}
.mw-echo-notification-wrapper {
display: block;
background-color: #F1F1F1;
border-bottom: 1px solid #DDDDDD;
padding: 15px 40px 10px 10px;
white-space: normal;
font-size: 13px;
line-height: 16px;
/* Suppress standard links styles */
color: inherit;
text-decoration: inherit;
}
&.mw-echo-unread {
.mw-echo-notification-wrapper {
background-color: white;
}
&:hover {
.mw-echo-notification-wrapper {
background-color: #F9F9F9;
}
}
button {
background: none;
border: none;
}
}
&:last-child {
.mw-echo-notification-wrapper {
border-bottom: none;
}
}
}
Make items on notifications flyout behave like links We want the notifications in the flyout to behave just like links, including standard middle-click and Ctrl-click behavior. The simplest way to do that would be to actually make them links - but the area can contain a few other links, so we can't do that and have to resort to ugly hacks. Or do we? Turns out that while browsers won't accept HTML containing nested <a> tags[1], such a structure is valid XHTML, and it's possible to create such structure in HTML mode using DOM manipulation. It works like one would expect: the entire thing is clickable, but inner <a> tags' hrefs override outer ones. Firefox even had a request to make that work[2] which was happily fulfilled. Tested the basic case [see below] on Firefox 22, Opera 12, Opera 15 (which uses the Blink engine like Chrome), IE 8 and IE 6 and it works the same on all of them. Tested the XHTML variant [see below] on all of the above except for the IEs which don't grok XHTML and it exhibits the same behavior. [1] Simple test: $('<div>1<a>2<a>3</a>4</a>5</div>').html() is "1<a>2</a><a>3</a>45", not actually "1<a>2<a>3</a>4</a>5" like one might expect. [2] https://bugzilla.mozilla.org/show_bug.cgi?id=331959 ---- The test cases used are below. When trying out the XHTML one make sure that the browser uses application/xhtml+xml MIME type; saving the file with .xhtml extension should be enough. XHTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <div>1<a href="http://google.com/">2<a href="http://example.com/">3</a>4</a>5</div> </body> </html> HTML: <!DOCTYPE html> <html> <body> <script type="text/javascript"> var div = document.createElement('div'); var a1 = document.createElement('a'); a1.href = "http://google.com/"; var a2 = document.createElement('a'); a2.href = "http://example.com/"; div.appendChild( document.createTextNode('1') ); div.appendChild( a1 ); a1.appendChild( document.createTextNode('2') ); a1.appendChild( a2 ); a2.appendChild( document.createTextNode('3') ); a1.appendChild( document.createTextNode('4') ); div.appendChild( document.createTextNode('5') ); document.body.appendChild(div); </script> </body> </html> ---- Bug: 52319 Change-Id: I311eca70f025ce92129c828cd88f96686b7cff72
2013-08-05 21:10:08 +00:00
}
.mw-echo-title {
a {
font-weight: bold;
}
// Helper class to be used to force single-line text in overlay
.plainlinks {
.truncated-text();
max-width: 100%;
display: inline-block;
vertical-align: top;
}
a {
font-weight: bold;
}
}
.mw-echo-notification-primary-link {
display: none;
}
.mw-echo-overlay-title {
font-size: @headerFontSize;
line-height: 15px;
padding: 15px 15px 15px 28px;
border-bottom: 1px solid #DDDDDD;
li {
display: inline;
font-size: 1em;
margin-left: 0;
&::after {
content: " · ";
padding: 0 .25em;
}
&:last-child {
&::after {
content: '';
}
}
}
}
#mw-echo-overlay-footer {
padding: 0;
border-top: 1px solid #DDDDDD;
display: table;
width: 100%;
a {
float: none;
display: table-cell;
}
}
#mw-echo-overlay-link {
display: block;
clear: left;
float: left;
padding: 15px 15px 15px 45px;
min-height: 14px;
font-size: 13px;
font-weight: bold;
/* @embed */
background: url(../icons/NotificationsPage-ltr.png) no-repeat 20px 15px !important;
white-space: normal;
&:hover {
text-decoration: none;
}
}
#mw-echo-overlay-pref-link {
display: block;
float: left;
min-height: 14px;
font-size: 13px;
font-weight: bold;
padding: 15px 15px 15px 45px;
border-left: 1px solid #DDDDDD;
/* @embed */
background: url(../icons/Settings.png) no-repeat 20px 15px !important;
white-space: normal;
&:hover {
text-decoration: none;
}
}