Make the menus follow their buttons. #932

This commit is contained in:
Nicolas Stepien 2013-03-02 21:50:09 +01:00
parent 161a263d60
commit 737097e46a
10 changed files with 61 additions and 21 deletions

File diff suppressed because one or more lines are too long

View File

@ -40,6 +40,9 @@
}
/* Menu */
:root.burichan #menu {
color: #000000;
}
:root.burichan .entry {
border-bottom: 1px solid #B7C5D9;
}

View File

@ -40,6 +40,9 @@
}
/* Menu */
:root.futaba #menu {
color: #800000;
}
:root.futaba .entry {
border-bottom: 1px solid #D9BFB7;
}

View File

@ -40,6 +40,9 @@
}
/* Menu */
:root.photon #menu {
color: #333;
}
:root.photon .entry {
border-bottom: 1px solid #CCC;
}

View File

@ -133,7 +133,7 @@ a[href="javascript:;"] {
#header-bar.autohide #toggle-header-bar {
cursor: s-resize;
}
#header-bar a {
#header-bar a:not(.entry) {
text-decoration: none;
padding: 1px;
}
@ -720,6 +720,7 @@ a[href="javascript:;"] {
/* Menu */
.menu-button {
display: inline-block;
position: relative;
}
.menu-button > span {
border-top: 6px solid;

View File

@ -46,6 +46,9 @@
}
/* Menu */
:root.tomorrow #menu {
color: #C5C8C6;
}
:root.tomorrow .entry {
border-bottom: 1px solid #111;
}

View File

@ -40,6 +40,9 @@
}
/* Menu */
:root.yotsuba-b #menu {
color: #000;
}
:root.yotsuba-b .entry {
border-bottom: 1px solid #B7C5D9;
}

View File

@ -40,6 +40,9 @@
}
/* Menu */
:root.yotsuba #menu {
color: #800000;
}
:root.yotsuba .entry {
border-bottom: 1px solid #D9BFB7;
}

View File

@ -58,7 +58,7 @@ UI = do ->
@focus entry
$.on d, 'click', @close
$.on d, 'CloseMenu', @close
$.add d.body, menu
$.add button, menu
# Position
mRect = menu.getBoundingClientRect()
@ -67,19 +67,24 @@ UI = do ->
bLeft = doc.scrollLeft + d.body.scrollLeft + bRect.left
cHeight = doc.clientHeight
cWidth = doc.clientWidth
top =
if bRect.top + bRect.height + mRect.height < cHeight
bTop + bRect.height + 2
else
bTop - mRect.height - 2
left =
if bRect.left + mRect.width < cWidth
bLeft
else
bLeft + bRect.width - mRect.width
if bRect.top + bRect.height + mRect.height < cHeight
# XXX calc(100% + 2px) would have been better, but >Presto.
top = bRect.height + 2 + 'px'
bottom = 'auto'
else
top = 'auto'
bottom = bRect.height + 2 + 'px'
if bRect.left + mRect.width < cWidth
left = '0px'
right = 'auto'
else
left = 'auto'
right = '0px'
{style} = menu
style.top = top + 'px'
style.left = left + 'px'
style.top = top
style.right = right
style.bottom = bottom
style.left = left
menu.focus()

View File

@ -250,6 +250,7 @@ class Clone extends Post
@file.info = file.firstElementChild
@file.text = @file.info.firstElementChild
@file.thumb = $ 'img[data-md5]', file
@file.fullImage = $ '.full-image'
@isDead = true if origin.isDead
@isClone = true