<commit_before>package views.html.streamer

import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.String.html.richText
import lila.streamer.Stream.YouTube

object show {

  import trans.streamer._

  def apply(
      s: lila.streamer.Streamer.WithUserAndStream,
      activities: Vector[lila.activity.ActivityView]
  )(implicit ctx: Context) =
    views.html.base.layout(
      title = s"${s.titleName} streams chess",
      moreCss = cssTag("streamer.show"),
      moreJs = frag(jsTag("ads.js")),
      openGraph = lila.app.ui
        .OpenGraph(
          title = s"${s.titleName} streams chess",
          description =
            shorten(~(s.streamer.headline.map(_.value) orElse s.streamer.description.map(_.value)), 152),
          url = s"$netBaseUrl${routes.Streamer.show(s.user.username)}",
          `type` = "video",
          image = s.streamer.picturePath.map(p => dbImageUrl(p.value))
        )
        .some,
      csp = defaultCsp.withTwitch.some
    )(
      main(cls := "page-menu streamer-show")(
        st.aside(cls := "page-menu__menu")(
          s.streamer.approval.chatEnabled option div(cls := "streamer-chat")(
            s.stream match {
              case Some(YouTube.Stream(_, _, videoId, _)) =>
                iframe(
                  st.frameborder := "0",
                  frame.scrolling := "no",
                  src := s"https://www.youtube.com/live_chat?v=$videoId&embed_domain=${netConfig.domain}"
                )
              case _ =>
                s.streamer.twitch.map { twitch =>
                  iframe(
                    st.frameborder := "0",
                    frame.scrolling := "yes",
                    src := s"https://twitch.tv/embed/${twitch.userId}/chat?${(ctx.currentBg != "light") ?? "darkpopout&"}parent=${netConfig.domain}"
                  )
                }
            }
          ),
          bits.menu("show", s.withoutStream.some),
          a(cls := "ads-vulnerable blocker none button button-metal", href := "https://getublockorigin.com")(
            i(dataIcon := ""),
            strong(installBlocker()),
            beSafe()
          )
        ),
        div(cls := "page-menu__content")(
          s.stream match {
            case Some(YouTube.Stream(_, _, videoId, _)) =>
              div(cls := "box embed youTube")(
                iframe(
                  src := s"https://www.youtube.com/embed/$videoId?autoplay=1",
                  st.frameborder := "0",
                  frame.allowfullscreen
                )
              )
            case _ =>
              s.streamer.twitch.map { twitch =>
                div(cls := "box embed twitch")(
                  iframe(
                    src := s"https://player.twitch.tv/?channel=${twitch.userId}&parent=${netConfig.domain}",
                    frame.allowfullscreen
                  )
                )
              } getOrElse div(cls := "box embed")(div(cls := "nostream")(offline()))
          },
          div(cls := "box streamer")(
            views.html.streamer.header(s),
            div(cls := "description")(richText(s.streamer.description.fold("")(_.value))),
            a(cls := "ratings", href := routes.User.show(s.user.username))(
              s.user.best6Perfs.map { showPerfRating(s.user, _) }<commit_msg>{master} new ublock origin url<commit_after>package views.html.streamer

import controllers.routes
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.String.html.richText
import lila.streamer.Stream.YouTube

object show {

  import trans.streamer._

  def apply(
      s: lila.streamer.Streamer.WithUserAndStream,
      activities: Vector[lila.activity.ActivityView]
  )(implicit ctx: Context) =
    views.html.base.layout(
      title = s"${s.titleName} streams chess",
      moreCss = cssTag("streamer.show"),
      moreJs = frag(jsTag("ads.js")),
      openGraph = lila.app.ui
        .OpenGraph(
          title = s"${s.titleName} streams chess",
          description =
            shorten(~(s.streamer.headline.map(_.value) orElse s.streamer.description.map(_.value)), 152),
          url = s"$netBaseUrl${routes.Streamer.show(s.user.username)}",
          `type` = "video",
          image = s.streamer.picturePath.map(p => dbImageUrl(p.value))
        )
        .some,
      csp = defaultCsp.withTwitch.some
    )(
      main(cls := "page-menu streamer-show")(
        st.aside(cls := "page-menu__menu")(
          s.streamer.approval.chatEnabled option div(cls := "streamer-chat")(
            s.stream match {
              case Some(YouTube.Stream(_, _, videoId, _)) =>
                iframe(
                  st.frameborder := "0",
                  frame.scrolling := "no",
                  src := s"https://www.youtube.com/live_chat?v=$videoId&embed_domain=${netConfig.domain}"
                )
              case _ =>
                s.streamer.twitch.map { twitch =>
                  iframe(
                    st.frameborder := "0",
                    frame.scrolling := "yes",
                    src := s"https://twitch.tv/embed/${twitch.userId}/chat?${(ctx.currentBg != "light") ?? "darkpopout&"}parent=${netConfig.domain}"
                  )
                }
            }
          ),
          bits.menu("show", s.withoutStream.some),
          a(cls := "ads-vulnerable blocker none button button-metal", href := "https://ublockorigin.com")(
            i(dataIcon := ""),
            strong(installBlocker()),
            beSafe()
          )
        ),
        div(cls := "page-menu__content")(
          s.stream match {
            case Some(YouTube.Stream(_, _, videoId, _)) =>
              div(cls := "box embed youTube")(
                iframe(
                  src := s"https://www.youtube.com/embed/$videoId?autoplay=1",
                  st.frameborder := "0",
                  frame.allowfullscreen
                )
              )
            case _ =>
              s.streamer.twitch.map { twitch =>
                div(cls := "box embed twitch")(
                  iframe(
                    src := s"https://player.twitch.tv/?channel=${twitch.userId}&parent=${netConfig.domain}",
                    frame.allowfullscreen
                  )
                )
              } getOrElse div(cls := "box embed")(div(cls := "nostream")(offline()))
          },
          div(cls := "box streamer")(
            views.html.streamer.header(s),
            div(cls := "description")(richText(s.streamer.description.fold("")(_.value))),
            a(cls := "ratings", href := routes.User.show(s.user.username))(
              s.user.best6Perfs.map { showPerfRating(s.user, _) }
{'fraction_non_alphanumeric': 0.14690265486725665, 'fraction_numerical': 0.002359882005899705, 'mean_word_length': 1.735377168212989, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 10, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2858903', 'n_tokens_mistral': 2078, 'n_tokens_neox': 1990, 'n_words': 304}