more work on cljs/react puzzles
This commit is contained in:
parent
a13c3582f9
commit
4d769f4b46
|
@ -79,7 +79,7 @@ trait AssetHelper {
|
|||
test = "window.React",
|
||||
local = staticUrl("vendor/react-0.11.2.min.js"))
|
||||
|
||||
val reactDevTag = jsAt("vendor/react-0.11.1.js")
|
||||
val reactDevTag = jsAt("vendor/react-0.11.2.js")
|
||||
|
||||
private def cdnOrLocal(cdn: String, test: String, local: String) = Html {
|
||||
if (isProd)
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
@jsTag("vendor/chess.min.js")
|
||||
@jsTagCompiled("chessboard.js")
|
||||
@jsTag("vendor/sparkline.min.js")
|
||||
@jsAt("vendor/interact.min.js")
|
||||
@if(false && isProd) {
|
||||
@if(true && isProd) {
|
||||
@reactTag
|
||||
@jsAt("compiled/puzzle/puzzle.prod.js")
|
||||
} else {
|
||||
|
|
|
@ -9,6 +9,5 @@ var Chess = {
|
|||
undo: function() {}
|
||||
};
|
||||
jQuery.prototype.sparkline = function(points, options) {};
|
||||
jQuery.displayBoardMarks = function(board, white) {};
|
||||
jQuery.buttonset = function() {};
|
||||
jQuery.disableSelection = function() {};
|
||||
|
|
2182
cljs/puzzle2/externs/jquery.js
vendored
Normal file
2182
cljs/puzzle2/externs/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
cljs/puzzle2/externs/misc.js
Normal file
10
cljs/puzzle2/externs/misc.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
var Chess = {
|
||||
load: function(fen) {},
|
||||
fen: function() {},
|
||||
turn: function() {},
|
||||
in_check: function() {},
|
||||
history: function() {},
|
||||
moves: function() {},
|
||||
undo: function() {}
|
||||
};
|
||||
jQuery.prototype.sparkline = function(points, options) {};
|
|
@ -3,12 +3,12 @@
|
|||
:license {:name "MIT" :url "http://opensource.org/licenses/MIT"}
|
||||
:plugins [[lein-cljsbuild "1.0.3"]]
|
||||
:dependencies [[org.clojure/clojure "1.6.0"]
|
||||
[org.clojure/clojurescript "0.0-2322"]
|
||||
[org.clojure/clojurescript "0.0-2342"]
|
||||
[org.clojure/core.async "0.1.338.0-5c5012-alpha"]
|
||||
[com.facebook/react "0.11.1"]
|
||||
[quiescent "0.1.4"]
|
||||
[jayq "2.5.2"]
|
||||
[org.lichess/chessground "0.4.3"]]
|
||||
[org.lichess/chessground "0.5.3"]]
|
||||
:cljsbuild
|
||||
{:builds
|
||||
{:dev
|
||||
|
@ -23,7 +23,7 @@
|
|||
:compiler
|
||||
{:output-dir "../../public/compiled/puzzle/out-prod"
|
||||
:output-to "../../public/compiled/puzzle/puzzle.prod.js"
|
||||
:externs ["libs/interact.js" "react/externs/react.js"]
|
||||
:externs ["react/externs/react.js" "externs/jquery.js" "externs/misc.js"]
|
||||
:optimizations :advanced
|
||||
:pretty-print false
|
||||
:output-wrapper true
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
(fn [action & args]
|
||||
(let [actions (.split (name action) ".")
|
||||
function (reduce (fn [o a] (aget o a)) (aget play-router "controllers") actions)]
|
||||
(.-url (apply function args)))))
|
||||
(aget (apply function args) "url"))))
|
||||
|
||||
(defn- make-trans [i18n]
|
||||
(fn [k & args]
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
(letfn [(load-chart [el]
|
||||
(let [dark (jq/has-class ($ :body) :dark)]
|
||||
(.sparkline ($ :.user_chart el)
|
||||
(-> q/*component* .-_owner .-props (aget "value") :history clj->js)
|
||||
(-> q/*component* (aget "_owner") (aget "props") (aget "value") :history clj->js)
|
||||
#js {:type "line" :width "213px" :height "80px"
|
||||
:lineColor (if dark "#4444ff" "#0000ff")
|
||||
:fillColor (if dark "#222255" "#ccccff")})))]
|
||||
|
@ -123,7 +123,7 @@
|
|||
:className (str "downvote" (when (= (:vote attempt) false) " active"))
|
||||
:onClick #(ctrl :vote 0)})))
|
||||
|
||||
(q/defcomponent ViewTable [{:keys [puzzle voted attempt auth? win]} trans ctrl]
|
||||
(q/defcomponent ViewTable [{:keys [puzzle voted attempt auth? win]} router trans ctrl]
|
||||
(d/div {}
|
||||
(when (and (:enabled puzzle)
|
||||
(= voted false))
|
||||
|
@ -139,7 +139,7 @@
|
|||
(Vote {:puzzle puzzle
|
||||
:attempt attempt} trans ctrl))
|
||||
(d/h2 {}
|
||||
(d/a {:href (.-url (js/puzzleRoutes.controllers.Puzzle.show (:id puzzle)))}
|
||||
(d/a {:href (router :Puzzle.show (:id puzzle))}
|
||||
(trans :puzzleId (:id puzzle))))
|
||||
(d/p (->> puzzle :rating strong (trans :ratingX) plain-html))
|
||||
(d/p (->> puzzle :attempts strong (trans :playedXTimes) plain-html))
|
||||
|
@ -225,7 +225,7 @@
|
|||
(ViewTable {:auth? (boolean user)
|
||||
:attempt attempt
|
||||
:voted voted
|
||||
:puzzle puzzle} trans ctrl)
|
||||
:puzzle puzzle} router trans ctrl)
|
||||
(PlayTable {:turn-color (-> state :chessground :turn-color)
|
||||
:color (:color puzzle)} trans ctrl)))
|
||||
(d/div {:className "center"}
|
||||
|
|
3
public/vendor/interact.min.js
vendored
3
public/vendor/interact.min.js
vendored
File diff suppressed because one or more lines are too long
18484
public/vendor/react-0.11.2.js
vendored
Normal file
18484
public/vendor/react-0.11.2.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue