Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
documents it adds example of it makes throttle configurable
- Loading branch information
Showing
16 changed files
with
288 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
/js | ||
/.idea | ||
pom.xml | ||
pom.xml.asc | ||
*.jar | ||
*.class | ||
.lein-deps-sum | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 1.1.2 | ||
|
||
* autocomplete field - improved key event handling | ||
* autocomplete field does not throttle by default. Throttling is configurable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/target | ||
/lib | ||
/classes | ||
/checkouts | ||
/js | ||
pom.xml | ||
*.jar | ||
*.class | ||
.lein-deps-sum | ||
.lein-failures | ||
.lein-plugins | ||
.lein-repl-history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#! /usr/bin/env phantomjs | ||
|
||
var fs = require("fs"); | ||
var p = require('webpage').create(); | ||
var sys = require('system'); | ||
|
||
p.onConsoleMessage = function (x) { | ||
fs.write("/dev/stdout", x, "w"); | ||
}; | ||
|
||
p.injectJs(phantom.args[0]); | ||
|
||
var result = p.evaluate(function () { | ||
specljs.run.standard.armed = true; | ||
return specljs.run.standard.run_specs( | ||
cljs.core.keyword("color"), true | ||
); | ||
}); | ||
|
||
phantom.exit(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.autocomplete-dropdown { | ||
background-color: white; | ||
border: 1px solid #25a8e0; | ||
border-top-width: 0; | ||
margin: 1px 0 2px 0; | ||
padding: 0; | ||
position: absolute; | ||
z-index: 2900; | ||
-moz-border-radius: 3px; | ||
-webkit-border-radius: 3px; | ||
border-radius: 3px; | ||
-webkit-box-shadow: 0px 1px 5px rgba(64, 56, 41, 0.4); | ||
-moz-box-shadow: 0px 1px 5px rgba(64, 56, 41, 0.4); | ||
box-shadow: 0px 1px 5px rgba(64, 56, 41, 0.4); | ||
} | ||
|
||
.autocomplete-dropdown li { | ||
list-style: none; | ||
width: 100%; | ||
padding-left: 10px; | ||
} | ||
|
||
.autocomplete-dropdown li:hover { | ||
background-color: #ccc; | ||
} | ||
|
||
.autocomplete-dropdown .highlighted { | ||
background-color: #25a8e0; | ||
color: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset='UTF-8'> | ||
<title>Filament Example</title> | ||
<script src="js/example_dev.js" type="text/javascript"></script> | ||
<link href="example.css" media="screen" rel="stylesheet" type="text/css" /> | ||
</head> | ||
<body> | ||
<h1>Filament Examples</h1> | ||
|
||
<script type="text/javascript">//<![CDATA[ | ||
example.main.init(); | ||
//]]></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(defproject example "1.0.0" | ||
:description "Example App using com.8thlight/Filament" | ||
:license {:name "Eclipse Public License" | ||
:url "http://www.eclipse.org/legal/epl-v10.html"} | ||
|
||
:dependencies [[com.8thlight/filament "1.1.2"] | ||
[com.8thlight/hiccup "1.1.1"] | ||
[org.clojure/clojure "1.5.1"]] | ||
|
||
:profiles {:dev {:dependencies [[org.clojure/clojurescript "0.0-2014"] | ||
[speclj "2.9.1"] | ||
[specljs "2.9.1"]]}} | ||
:plugins [[speclj "2.9.1"] | ||
[specljs "2.9.1"] | ||
[lein-cljsbuild "1.0.0"]] | ||
|
||
:cljsbuild ~(let [run-specs ["bin/specljs" "js/example_dev.js"]] | ||
{:builds {:dev {:source-paths ["src/cljs" "spec/cljs"] | ||
:compiler {:output-to "js/example_dev.js" | ||
:optimizations :whitespace | ||
:pretty-print true} | ||
:notify-command run-specs}} | ||
|
||
:test-commands {"test" run-specs}}) | ||
|
||
:source-paths ["src/clj" "src/cljs"] | ||
:test-paths ["spec/clj"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(ns example.main-spec | ||
(:require-macros [specljs.core :refer [describe it should=]]) | ||
(:require [specljs.core] | ||
[example.main])) | ||
|
||
(describe "A ClojureScript test" | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(ns example.autocomplete-demo | ||
(:require-macros [hiccup.core :as h]) | ||
(:require [clojure.string :as string] | ||
[com.eighthlight.filament.autocomplete-field :as autocomplete] | ||
[domina :as dom] | ||
[hiccup.core])) | ||
|
||
(def colors ["red" | ||
"orange" | ||
"yellow" | ||
"green" | ||
"blue" | ||
"indigo" | ||
"violet"]) | ||
|
||
(def dom [:form {:action "/fooey" :autocomplete "off"} | ||
[:label {:for "autocomplete-field"} "Autocomplete:"] | ||
[:input#autocomplete-field {:type "text"}]]) | ||
|
||
(defn autocomplete-on-select [[name value]] | ||
(dom/set-value! (dom/by-id "autocomplete-field") value)) | ||
|
||
(defn autocomplete-on-search [q] | ||
(autocomplete/show-dropdown (dom/by-id "autocomplete-field") | ||
(map #(vector % %) | ||
(filter #(re-find (re-pattern q) %) colors)))) | ||
|
||
(defn demo-autocomplete [] | ||
(dom/append! (.-body js/document) (h/html dom)) | ||
(let [field (dom/by-id "autocomplete-field")] | ||
(autocomplete/arm-field field {:on-select autocomplete-on-select | ||
:on-search autocomplete-on-search}))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(ns example.main | ||
(:require [example.autocomplete-demo :refer [demo-autocomplete]])) | ||
|
||
(defn ^:export init [] | ||
(demo-autocomplete)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.