Add a menu where the Leave button was
This commit is contained in:
parent
5579f407e7
commit
d3a8b2b217
@ -189,7 +189,8 @@ button,
|
||||
}
|
||||
|
||||
#viewport .lt,
|
||||
#viewport .rt {
|
||||
#viewport .rt,
|
||||
#chat button.menu {
|
||||
color: #ccc;
|
||||
display: none;
|
||||
float: left;
|
||||
@ -213,10 +214,23 @@ button,
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
#chat button.menu:before {
|
||||
font: 14px FontAwesome;
|
||||
content: "\f142";
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
#viewport .rt {
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 6px -12px 0 12px;
|
||||
margin: 6px -12px 0 0;
|
||||
}
|
||||
|
||||
#chat button.menu {
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 6px -8px 0 12px;
|
||||
}
|
||||
|
||||
#viewport.rt #chat .sidebar {
|
||||
@ -1576,10 +1590,6 @@ button,
|
||||
display: block;
|
||||
}
|
||||
|
||||
#viewport .rt {
|
||||
margin-left: 18px;
|
||||
}
|
||||
|
||||
#windows .window .header {
|
||||
display: block;
|
||||
}
|
||||
|
@ -491,27 +491,32 @@ $(function() {
|
||||
}
|
||||
});
|
||||
|
||||
function positionContextMenu(e) {
|
||||
var top, left;
|
||||
function positionContextMenu(that, e) {
|
||||
var offset;
|
||||
var menuWidth = contextMenu.outerWidth();
|
||||
var menuHeight = contextMenu.outerHeight();
|
||||
|
||||
if ((window.innerWidth - e.pageX) < menuWidth) {
|
||||
left = window.innerWidth - menuWidth;
|
||||
} else {
|
||||
left = e.pageX;
|
||||
if (that.hasClass("menu")) {
|
||||
offset = that.offset();
|
||||
offset.left -= menuWidth - that.outerWidth();
|
||||
offset.top += that.outerHeight();
|
||||
return offset;
|
||||
}
|
||||
|
||||
if ((window.innerHeight - e.pageY) < menuHeight) {
|
||||
top = window.innerHeight - menuHeight;
|
||||
} else {
|
||||
top = e.pageY;
|
||||
offset = {left: e.pageX, top: e.pageY};
|
||||
|
||||
if ((window.innerWidth - offset.left) < menuWidth) {
|
||||
offset.left = window.innerWidth - menuWidth;
|
||||
}
|
||||
|
||||
return {left: left, top: top};
|
||||
if ((window.innerHeight - offset.top) < menuHeight) {
|
||||
offset.top = window.innerHeight - menuHeight;
|
||||
}
|
||||
|
||||
viewport.on("contextmenu", ".user, .network .chan", function(e) {
|
||||
return offset;
|
||||
}
|
||||
|
||||
function showContextMenu(that, e) {
|
||||
var target = $(e.currentTarget);
|
||||
var output = "";
|
||||
|
||||
@ -538,9 +543,18 @@ $(function() {
|
||||
contextMenuContainer.show();
|
||||
contextMenu
|
||||
.html(output)
|
||||
.css(positionContextMenu(e));
|
||||
.css(positionContextMenu($(that), e));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
viewport.on("contextmenu", ".user, .network .chan", function(e) {
|
||||
return showContextMenu(this, e);
|
||||
});
|
||||
|
||||
viewport.on("click", "#chat .menu", function(e) {
|
||||
e.currentTarget = $(e.currentTarget).closest(".chan")[0];
|
||||
return showContextMenu(this, e);
|
||||
});
|
||||
|
||||
contextMenuContainer.on("click contextmenu", function() {
|
||||
|
@ -1,10 +1,11 @@
|
||||
{{#each channels}}
|
||||
<div id="chan-{{id}}" data-title="{{name}}" data-id="{{id}}" data-type="{{type}}" class="chan {{type}}">
|
||||
<div id="chan-{{id}}" data-title="{{name}}" data-id="{{id}}" data-type="{{type}}" data-target="#chan-{{id}}" class="chan {{type}}">
|
||||
<div class="header">
|
||||
<button class="lt"></button>
|
||||
{{#equal type "channel"}}
|
||||
<button class="rt"></button>
|
||||
{{/equal}}
|
||||
<button class="menu"></button>
|
||||
<span class="title">{{name}}</span>
|
||||
<span class="topic">{{{parse topic}}}</span>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user