upgrade moment.js
parent
35d73a94c9
commit
4ccfb6320e
|
@ -22,3 +22,6 @@
|
|||
[submodule "ui/chessli"]
|
||||
path = ui/chessli
|
||||
url = https://github.com/ornicar/chess.js
|
||||
[submodule "public/vendor/moment"]
|
||||
path = public/vendor/moment
|
||||
url = https://github.com/moment/moment
|
||||
|
|
|
@ -4,7 +4,7 @@ package templating
|
|||
import controllers.routes
|
||||
import play.twirl.api.Html
|
||||
|
||||
trait AssetHelper {
|
||||
trait AssetHelper { self: I18nHelper =>
|
||||
|
||||
val assetVersion = lila.api.Env.current.Net.AssetVersion
|
||||
|
||||
|
@ -51,9 +51,18 @@ trait AssetHelper {
|
|||
local = staticUrl("vendor/highcharts4/highstock.js"))
|
||||
|
||||
val momentjsTag = cdnOrLocal(
|
||||
cdn = "http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.3/moment.min.js",
|
||||
cdn = "http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.js",
|
||||
test = "window.moment",
|
||||
local = staticUrl("vendor/momentjs.min.js"))
|
||||
local = staticUrl("vendor/moment/min/moment.min.js"))
|
||||
|
||||
def momentLangTag(implicit ctx: lila.api.Context) = (lang(ctx).language match {
|
||||
case "en" => none
|
||||
case "pt" => "pt-br".some
|
||||
case "zh" => "zh-cn".some
|
||||
case l => l.some
|
||||
}).fold(Html("")) { l =>
|
||||
jsAt(s"vendor/moment/locale/$l.js", static = true)
|
||||
}
|
||||
|
||||
val powertipTag = cdnOrLocal(
|
||||
cdn = "http://cdnjs.cloudflare.com/ajax/libs/jquery-powertip/1.2.0/jquery.powertip.min.js",
|
||||
|
|
|
@ -63,15 +63,4 @@ trait DateHelper { self: I18nHelper =>
|
|||
def momentFromNow(date: DateTime) = Html {
|
||||
s"""<time class="moment-from-now" datetime="${isoFormatter print date}"></time>"""
|
||||
}
|
||||
|
||||
def momentLangTag(implicit ctx: Context) = Html {
|
||||
(lang(ctx).language match {
|
||||
case "en" => none
|
||||
case "pt" => "pt-br".some
|
||||
case "zh" => "zh-cn".some
|
||||
case l => l.some
|
||||
}) ?? { l =>
|
||||
s"""<script src="http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.6.0/lang/$l.js"></script>"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 2f9b330eb35a38184fd7239749c7f0feef6c5146
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue