Merge branch 'master' of github.com:ornicar/lila into palantir

* 'master' of github.com:ornicar/lila:
  Use nonEmpty
  Only show more button if timeline exists
  Use a class instead of an attribute
  Remove accidental css
  tweak chess variant row in /features
  Remove filter numbers and colour the filter button icon instead
  no need for unsafe-inline fallback for nonce since safari 10
  nav implies role navigation
  spec recommends sligtly longer nonces
  fix html syntax
  Removed ALL tabs this time
  Updated renderSan()
  Add space between anon and number so it is now Anonymous (1)
  Replace tabs with spaces (oops)
  Leaderboard hover transition to blue
  Tournament schedule links blue on hover
palantir
Thibault Duplessis 2019-08-08 10:38:44 +02:00
commit 9090afd491
12 changed files with 30 additions and 19 deletions

View File

@ -62,7 +62,7 @@ object layout {
private def anonDasher(playing: Boolean)(implicit ctx: Context) = spaceless(s"""<div class="dasher">
<a class="toggle link anon">
<span title="${trans.preferences().render}" data-icon="%"</span>
<span title="${trans.preferences().render}" data-icon="%"></span>
</a>
<div id="dasher_app" class="dropdown" data-playing="$playing"></div>
</div>

View File

@ -11,7 +11,7 @@ object topnav {
private def linkTitle(url: String, name: Frag)(implicit ctx: Context) =
if (ctx.blind) h3(name) else a(href := url)(name)
def apply()(implicit ctx: Context) = st.nav(id := "topnav", role := "navigation", cls := "hover")(
def apply()(implicit ctx: Context) = st.nav(id := "topnav", cls := "hover")(
st.section(
linkTitle("/", frag(
span(cls := "play")(trans.play()),

View File

@ -110,7 +110,7 @@ object home {
ctx.blind option h2("Timeline"),
views.html.timeline entries userTimeline,
// userTimeline.size >= 8 option
if (userTimeline.size > 0) a(cls := "more", href := routes.Timeline.home)(trans.more(), " »")
userTimeline.nonEmpty option a(cls := "more", href := routes.Timeline.home)(trans.more(), " »")
)
} getOrElse div(cls := "about-side")(
ctx.blind option h2("About"),

View File

@ -34,7 +34,8 @@ object features {
"Correspondence chess with conditional premoves"
),
tr(check)(
a(href := routes.Page.variantHome)("9 Chess variants (Crazyhouse, Chess960, Horde, ...)")
"Standard chess and ",
a(href := routes.Page.variantHome)("8 chess variants (Crazyhouse, Chess960, Horde, ...)")
),
tr(custom("30 per day"))(
s"Deep $engineName server analysis"

View File

@ -12,13 +12,7 @@ case class ContentSecurityPolicy(
baseUri: List[String]
) {
private def withScriptSrc(source: String) = copy(scriptSrc = source :: scriptSrc)
def withNonce(nonce: Nonce) = copy(
// Nonces are not supported by Safari but 'unsafe-inline' is ignored by
// better browsers if there are also nonces.
scriptSrc = nonce.scriptSrc :: "'unsafe-inline'" :: scriptSrc
)
def withNonce(nonce: Nonce) = copy(scriptSrc = nonce.scriptSrc :: scriptSrc)
def withStripe = copy(
connectSrc = "https://*.stripe.com" :: connectSrc,

View File

@ -8,5 +8,5 @@ case class Nonce(value: String) extends AnyVal with StringValue {
object Nonce {
def random: Nonce = Nonce(Random.secureString(20))
def random: Nonce = Nonce(Random.secureString(24))
}

View File

@ -42,6 +42,8 @@ $c-secondary-over: #fff; /* text over secondary background */
/* Accent: orange */
$c-accent: hsl(22, 100%, 42%);
$c-accent-dim: c-dimmer($c-accent);
$c-accent-clear: c-clearer($c-accent);
$c-accent-over: #fff; /* text over accent background */
/* Brag: gold */

View File

@ -50,4 +50,12 @@
color: $c-accent;
}
}
.gamesFiltered {
color: $c-accent;
@include transition();
&:hover {
color: $c-accent-dim;
}
}
}

View File

@ -62,13 +62,13 @@ function initialize(ctrl: LobbyController, el) {
export function toggle(ctrl: LobbyController, nbFiltered: number) {
return h('i.toggle.toggle-filter', {
class: { active: ctrl.filterOpen },
class: { gamesFiltered: nbFiltered > 0, active: ctrl.filterOpen },
hook: bind('mousedown', ctrl.toggleFilter, ctrl.redraw),
attrs: {
'data-icon': ctrl.filterOpen ? 'L' : '%',
title: ctrl.trans.noarg('filterGames')
}
}, nbFiltered > 0 ? '' + nbFiltered : '');
});
}
export interface FilterNode extends HTMLElement {

View File

@ -690,7 +690,7 @@
if (data.users) {
var tags = data.users.map($.userLink);
if (data.anons === 1) tags.push('Anonymous');
else if (data.anons) tags.push('Anonymous(' + data.anons + ')');
else if (data.anons) tags.push('Anonymous (' + data.anons + ')');
this.list.html(tags.join(', '));
} else if (!this.number.length) this.list.html(data.nb + ' players in the chat');
this.element.removeClass('none');

View File

@ -4,19 +4,17 @@ function renderSan(san: San) {
let move: string;
if (san.includes('O-O-O')) move = 'long castle';
else if (san.includes('O-O')) move = 'short castle';
else move = san.replace(/[\+#]/, '').split('').map(c => {
else move = san.split('').map(c => {
if (c == 'x') return 'takes';
if (c == '+') return 'check';
if (c == '#') return 'checkmate';
if (c == '=') return 'promotion';
if (c == '=') return 'promotes to';
if (c == '@') return 'at';
const code = c.charCodeAt(0);
if (code > 48 && code < 58) return c; // 1-8
if (code > 96 && code < 105) return c.toUpperCase();
return roles[c] || c;
}).join(' ');
if (san.includes('+')) move += ' check';
if (san.includes('#')) move += ' checkmate';
return move;
}

View File

@ -22,6 +22,7 @@
white-space: nowrap;
padding: .2em 0;
line-height: 1.5;
@include transition();
&:hover a {
color: $c-link;
}
@ -40,6 +41,13 @@
.tour__links {
margin-top: 1em;
a {
color: $c-font;
@include transition();
&:hover {
color: $c-link;
}
}
}
.scheduled {