make chat resizable
This commit is contained in:
parent
890589d176
commit
952a13e010
|
@ -161,7 +161,7 @@ data-accept-languages="@acceptLanguages.mkString(",")">
|
|||
</div>
|
||||
<div class="center last"></div>
|
||||
</div>
|
||||
<div id="chat">
|
||||
<div id="chat" style="height:@{ctx.pref.chat.height}px">
|
||||
<a class="off"></a>
|
||||
<a class="help">help</a>
|
||||
<div class="left chans"></div>
|
||||
|
@ -184,7 +184,7 @@ data-accept-languages="@acceptLanguages.mkString(",")">
|
|||
</div>
|
||||
</div>
|
||||
<div class="center room">
|
||||
<div class="lines"></div>
|
||||
<div class="lines" style="height:@{ctx.pref.chat.height - 28}px"></div>
|
||||
<div class="controls">
|
||||
<form action="#">
|
||||
<input class="input" value="" placeholder="@trans.talkInChat()" />
|
||||
|
|
|
@ -14,7 +14,7 @@ private[chat] final class Api(
|
|||
getTeamIds: String ⇒ Fu[List[String]],
|
||||
netDomain: String) {
|
||||
|
||||
private val NB_LINES = 30
|
||||
private val NB_LINES = 40
|
||||
|
||||
def join(user: User, chat: ChatHead, chan: Chan): ChatHead = {
|
||||
chanVoter(user.id, chan.key)
|
||||
|
|
|
@ -44,8 +44,7 @@ case class ChatHead(
|
|||
|
||||
def inactiveChanKeys = chanKeys filterNot activeChanKeys.contains
|
||||
|
||||
def updatePref(pref: ChatPref) = ChatPref(
|
||||
on = pref.on,
|
||||
def updatePref(pref: ChatPref) = pref.copy(
|
||||
chans = chans filterNot (_.contextual) map (_.key),
|
||||
activeChans = activeChanKeys filterNot Chan.autoActive,
|
||||
mainChan = (mainChanKey filterNot Chan.autoActive) orElse pref.mainChan)
|
||||
|
|
|
@ -46,6 +46,8 @@ private[chat] final class ChatActor(
|
|||
|
||||
case SetOpen(member, value) ⇒ prefApi.setChatPref(member.userId, _.copy(on = value))
|
||||
|
||||
case SetHeight(member, value) ⇒ prefApi.setChatPref(member.userId, _.copy(height = value))
|
||||
|
||||
case Join(member, chan) ⇒ api.join(member, chan) foreach { head ⇒
|
||||
member setHead head
|
||||
saveAndReload(member)
|
||||
|
|
|
@ -69,6 +69,8 @@ private[chat] final class Commander(
|
|||
}
|
||||
}
|
||||
|
||||
case "height" :: height :: Nil ⇒ parseIntOption(height) foreach { h ⇒ chat ! SetHeight(member, h) }
|
||||
|
||||
case ("rematch" | "resign" | "abort" | "takeback") :: Nil ⇒ gameOnlyCommand(member)
|
||||
case MoveRegex(orig, dest) :: Nil ⇒ gameOnlyCommand(member)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ case class Command(chanOption: Option[Chan], member: ChatMember, text: String)
|
|||
case class Flash(member: ChatMember, text: String)
|
||||
|
||||
case class SetOpen(member: ChatMember, value: Boolean)
|
||||
case class SetHeight(member: ChatMember, value: Int)
|
||||
|
||||
case class Query(member: ChatMember, username: String)
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package lila.pref
|
||||
|
||||
import scala._
|
||||
import play.api.libs.json._
|
||||
|
||||
import lila.db.JsTube
|
||||
import lila.db.JsTube.Helpers._
|
||||
|
||||
case class Pref(
|
||||
id: String, // user id
|
||||
|
@ -33,6 +36,7 @@ object Pref {
|
|||
|
||||
case class ChatPref(
|
||||
on: Boolean,
|
||||
height: Int,
|
||||
chans: List[String],
|
||||
activeChans: Set[String],
|
||||
mainChan: Option[String]) {
|
||||
|
@ -42,7 +46,15 @@ object Pref {
|
|||
|
||||
object ChatPref {
|
||||
|
||||
val default = ChatPref(false, Nil, Set.empty, none)
|
||||
val default = ChatPref(false, 195, Nil, Set.empty, none)
|
||||
|
||||
private[pref] implicit lazy val tube = JsTube[ChatPref](
|
||||
(__.json update merge(defaults)) andThen Json.reads[ChatPref],
|
||||
Json.writes[ChatPref])
|
||||
|
||||
private[pref] def defaults = Json.obj(
|
||||
"on" -> ChatPref.default.on,
|
||||
"height" -> ChatPref.default.height)
|
||||
}
|
||||
|
||||
object AutoQueen {
|
||||
|
@ -70,16 +82,11 @@ object Pref {
|
|||
private val booleans = Map("true" -> true, "false" -> false)
|
||||
private val bgs = Map("light" -> false, "dark" -> true)
|
||||
|
||||
import lila.db.JsTube
|
||||
import JsTube.Helpers._
|
||||
import play.api.libs.json._
|
||||
|
||||
private implicit lazy val chatFormat = Json.format[ChatPref]
|
||||
import ChatPref.tube
|
||||
|
||||
private[pref] lazy val tube = JsTube[Pref](
|
||||
(__.json update merge(defaults)) andThen Json.reads[Pref],
|
||||
Json.writes[Pref]
|
||||
)
|
||||
Json.writes[Pref])
|
||||
|
||||
private def defaults = Json.obj(
|
||||
"dark" -> default.dark,
|
||||
|
|
|
@ -862,6 +862,17 @@ var storage = {
|
|||
|
||||
self.element.click(function() {
|
||||
self.$input.focus();
|
||||
}).resizable({
|
||||
handles: 'n',
|
||||
alsoResize: self.$lines,
|
||||
minHeight: 83,
|
||||
maxHeight: $(window).height() - 30,
|
||||
resize: function() {
|
||||
$(this).css('top', 'auto');
|
||||
},
|
||||
stop: function() {
|
||||
self._send('/height ' + $(this).height());
|
||||
}
|
||||
});
|
||||
self.$form.submit(function() {
|
||||
self._tell();
|
||||
|
|
11
public/javascripts/deps.min.js
vendored
11
public/javascripts/deps.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
4
todo
4
todo
|
@ -107,16 +107,12 @@ full page recent forum posts
|
|||
en_GB, en_US, pt_PT, pt_BR = localization
|
||||
/takeback to accept (or sys message)
|
||||
badges out of screen
|
||||
chat click user to chat
|
||||
moretime button position (>1hour)
|
||||
move command sys message
|
||||
abort system message
|
||||
hide chat help after /help typed
|
||||
copy rematch chats
|
||||
chat logs
|
||||
maybe no chat transparency?
|
||||
indicator when someone talks to you but the chat is closed
|
||||
user badge is too large; also add a link to profile to it
|
||||
chat visited link color
|
||||
|
||||
deploy
|
||||
|
|
Loading…
Reference in a new issue