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 .lt,
|
||||||
#viewport .rt {
|
#viewport .rt,
|
||||||
|
#chat button.menu {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
display: none;
|
display: none;
|
||||||
float: left;
|
float: left;
|
||||||
@ -213,10 +214,23 @@ button,
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-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 {
|
#viewport .rt {
|
||||||
display: block;
|
display: block;
|
||||||
float: right;
|
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 {
|
#viewport.rt #chat .sidebar {
|
||||||
@ -1576,10 +1590,6 @@ button,
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
#viewport .rt {
|
|
||||||
margin-left: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#windows .window .header {
|
#windows .window .header {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
@ -491,27 +491,32 @@ $(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function positionContextMenu(e) {
|
function positionContextMenu(that, e) {
|
||||||
var top, left;
|
var offset;
|
||||||
var menuWidth = contextMenu.outerWidth();
|
var menuWidth = contextMenu.outerWidth();
|
||||||
var menuHeight = contextMenu.outerHeight();
|
var menuHeight = contextMenu.outerHeight();
|
||||||
|
|
||||||
if ((window.innerWidth - e.pageX) < menuWidth) {
|
if (that.hasClass("menu")) {
|
||||||
left = window.innerWidth - menuWidth;
|
offset = that.offset();
|
||||||
} else {
|
offset.left -= menuWidth - that.outerWidth();
|
||||||
left = e.pageX;
|
offset.top += that.outerHeight();
|
||||||
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((window.innerHeight - e.pageY) < menuHeight) {
|
offset = {left: e.pageX, top: e.pageY};
|
||||||
top = window.innerHeight - menuHeight;
|
|
||||||
} else {
|
if ((window.innerWidth - offset.left) < menuWidth) {
|
||||||
top = e.pageY;
|
offset.left = window.innerWidth - menuWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {left: left, top: top};
|
if ((window.innerHeight - offset.top) < menuHeight) {
|
||||||
|
offset.top = window.innerHeight - menuHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
viewport.on("contextmenu", ".user, .network .chan", function(e) {
|
function showContextMenu(that, e) {
|
||||||
var target = $(e.currentTarget);
|
var target = $(e.currentTarget);
|
||||||
var output = "";
|
var output = "";
|
||||||
|
|
||||||
@ -538,9 +543,18 @@ $(function() {
|
|||||||
contextMenuContainer.show();
|
contextMenuContainer.show();
|
||||||
contextMenu
|
contextMenu
|
||||||
.html(output)
|
.html(output)
|
||||||
.css(positionContextMenu(e));
|
.css(positionContextMenu($(that), e));
|
||||||
|
|
||||||
return false;
|
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() {
|
contextMenuContainer.on("click contextmenu", function() {
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
{{#each channels}}
|
{{#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">
|
<div class="header">
|
||||||
<button class="lt"></button>
|
<button class="lt"></button>
|
||||||
{{#equal type "channel"}}
|
{{#equal type "channel"}}
|
||||||
<button class="rt"></button>
|
<button class="rt"></button>
|
||||||
{{/equal}}
|
{{/equal}}
|
||||||
|
<button class="menu"></button>
|
||||||
<span class="title">{{name}}</span>
|
<span class="title">{{name}}</span>
|
||||||
<span class="topic">{{{parse topic}}}</span>
|
<span class="topic">{{{parse topic}}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user