Skip to content

Commit 708502c

Browse files
committedOct 6, 2016
Use clipboard.js and jekyll-coffeescript.
1 parent 8209429 commit 708502c

9 files changed

+164
-580
lines changed
 

‎Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source 'https://rubygems.org'
2+
gem 'github-pages'

‎Gemfile.lock

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
activesupport (4.2.7)
5+
i18n (~> 0.7)
6+
json (~> 1.7, >= 1.7.7)
7+
minitest (~> 5.1)
8+
thread_safe (~> 0.3, >= 0.3.4)
9+
tzinfo (~> 1.1)
10+
addressable (2.4.0)
11+
coffee-script (2.4.1)
12+
coffee-script-source
13+
execjs
14+
coffee-script-source (1.10.0)
15+
colorator (1.1.0)
16+
ethon (0.9.1)
17+
ffi (>= 1.3.0)
18+
execjs (2.7.0)
19+
faraday (0.9.2)
20+
multipart-post (>= 1.2, < 3)
21+
ffi (1.9.14)
22+
forwardable-extended (2.6.0)
23+
gemoji (2.1.0)
24+
github-pages (97)
25+
activesupport (= 4.2.7)
26+
github-pages-health-check (= 1.2.0)
27+
jekyll (= 3.2.1)
28+
jekyll-coffeescript (= 1.0.1)
29+
jekyll-feed (= 0.5.1)
30+
jekyll-gist (= 1.4.0)
31+
jekyll-github-metadata (= 2.1.0)
32+
jekyll-mentions (= 1.2.0)
33+
jekyll-paginate (= 1.1.0)
34+
jekyll-redirect-from (= 0.11.0)
35+
jekyll-sass-converter (= 1.3.0)
36+
jekyll-seo-tag (= 2.0.0)
37+
jekyll-sitemap (= 0.10.0)
38+
jekyll-swiss (= 0.4.0)
39+
jemoji (= 0.7.0)
40+
kramdown (= 1.11.1)
41+
liquid (= 3.0.6)
42+
listen (= 3.0.6)
43+
mercenary (~> 0.3)
44+
minima (= 1.2.0)
45+
rouge (= 1.11.1)
46+
terminal-table (~> 1.4)
47+
github-pages-health-check (1.2.0)
48+
addressable (~> 2.3)
49+
net-dns (~> 0.8)
50+
octokit (~> 4.0)
51+
public_suffix (~> 1.4)
52+
typhoeus (~> 0.7)
53+
html-pipeline (2.4.2)
54+
activesupport (>= 2)
55+
nokogiri (>= 1.4)
56+
i18n (0.7.0)
57+
jekyll (3.2.1)
58+
colorator (~> 1.0)
59+
jekyll-sass-converter (~> 1.0)
60+
jekyll-watch (~> 1.1)
61+
kramdown (~> 1.3)
62+
liquid (~> 3.0)
63+
mercenary (~> 0.3.3)
64+
pathutil (~> 0.9)
65+
rouge (~> 1.7)
66+
safe_yaml (~> 1.0)
67+
jekyll-coffeescript (1.0.1)
68+
coffee-script (~> 2.2)
69+
jekyll-feed (0.5.1)
70+
jekyll-gist (1.4.0)
71+
octokit (~> 4.2)
72+
jekyll-github-metadata (2.1.0)
73+
jekyll (~> 3.1)
74+
octokit (~> 4.0)
75+
jekyll-mentions (1.2.0)
76+
activesupport (~> 4.0)
77+
html-pipeline (~> 2.3)
78+
jekyll (~> 3.0)
79+
jekyll-paginate (1.1.0)
80+
jekyll-redirect-from (0.11.0)
81+
jekyll (>= 2.0)
82+
jekyll-sass-converter (1.3.0)
83+
sass (~> 3.2)
84+
jekyll-seo-tag (2.0.0)
85+
jekyll (~> 3.1)
86+
jekyll-sitemap (0.10.0)
87+
jekyll-swiss (0.4.0)
88+
jekyll-watch (1.5.0)
89+
listen (~> 3.0, < 3.1)
90+
jemoji (0.7.0)
91+
activesupport (~> 4.0)
92+
gemoji (~> 2.0)
93+
html-pipeline (~> 2.2)
94+
jekyll (>= 3.0)
95+
json (1.8.3)
96+
kramdown (1.11.1)
97+
liquid (3.0.6)
98+
listen (3.0.6)
99+
rb-fsevent (>= 0.9.3)
100+
rb-inotify (>= 0.9.7)
101+
mercenary (0.3.6)
102+
mini_portile2 (2.1.0)
103+
minima (1.2.0)
104+
minitest (5.9.1)
105+
multipart-post (2.0.0)
106+
net-dns (0.8.0)
107+
nokogiri (1.6.8.1)
108+
mini_portile2 (~> 2.1.0)
109+
octokit (4.3.0)
110+
sawyer (~> 0.7.0, >= 0.5.3)
111+
pathutil (0.14.0)
112+
forwardable-extended (~> 2.6)
113+
public_suffix (1.5.3)
114+
rb-fsevent (0.9.7)
115+
rb-inotify (0.9.7)
116+
ffi (>= 0.5.0)
117+
rouge (1.11.1)
118+
safe_yaml (1.0.4)
119+
sass (3.4.22)
120+
sawyer (0.7.0)
121+
addressable (>= 2.3.5, < 2.5)
122+
faraday (~> 0.8, < 0.10)
123+
terminal-table (1.7.3)
124+
unicode-display_width (~> 1.1.1)
125+
thread_safe (0.3.5)
126+
typhoeus (0.8.0)
127+
ethon (>= 0.8.0)
128+
tzinfo (1.2.2)
129+
thread_safe (~> 0.1)
130+
unicode-display_width (1.1.1)
131+
132+
PLATFORMS
133+
ruby
134+
135+
DEPENDENCIES
136+
github-pages
137+
138+
BUNDLED WITH
139+
1.13.2

‎_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
gems:
2+
- jekyll-coffeescript

‎index.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,20 @@ <h2>How easy is it for you to imagine this performs in an unexpected way after d
7979
<textarea rows="3" id="final-message" class="github-badge input-xxlarge uneditable-input">[FIAS Score:7/7/9=23](http://google.com?foo=1)</textarea>
8080
</div>
8181
<div style="position:relative" id="final-copy-btn-div">
82-
<button id="final-copy-btn" class="btn btn-primary btn-large" title="Click to copy me.">Copy to Clipboard</button>
82+
<button id="final-copy-btn" class="btn btn-primary btn-large" title="Click to copy me." data-clipboard-target="#final-message">
83+
Copy to Clipboard
84+
</button>
8385
</div>
8486
</div>
8587
</div>
8688

8789
</div> <!-- /container -->
8890
</body>
8991
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
90-
<script src="js/ZeroClipboard.js"></script>
92+
<script src="js/clipboard.js"></script>
9193
<script src="js/bootstrap.min.js"></script>
9294
<script src="js/jquery.knob.js"></script>
93-
<script src="js/main.js?v=2"></script>
95+
<script src="js/main.js"></script>
9496

9597
<script>
9698
$(function() {

‎js/ZeroClipboard.js

-311
This file was deleted.

‎js/ZeroClipboard10.swf

-1.13 KB
Binary file not shown.

‎js/clipboard.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/fias-calculator.coffee ‎js/main.coffee

+9-17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
---
2+
---
3+
14
$.fn.message = -> $("##{$(@).data("message-id")}")
25

36
fixValue = (dial, value) ->
@@ -35,7 +38,12 @@ class FIASCalculator
3538
$("[data-dial]").each ->
3639
changed.call($(@).data("knob"), $(@).val())
3740

38-
@setupCopyButton()
41+
new Clipboard('#final-copy-btn').on 'success', ({trigger}) =>
42+
original = trigger.innerHTML
43+
trigger.innerHTML = 'Copied!'
44+
setTimeout ->
45+
trigger.innerHTML = original
46+
, 1000
3947

4048
changed: (value) ->
4149
value = fixValue(@, value)
@@ -83,22 +91,6 @@ class FIASCalculator
8391
else
8492
return decodeURIComponent(results[1].replace(/\+/g, " "))
8593

86-
setupCopyButton: ->
87-
ZeroClipboard.setMoviePath('js/ZeroClipboard10.swf')
88-
clip = new ZeroClipboard.Client()
89-
clip.glue("final-copy-btn", "final-copy-btn-div")
90-
clip.addEventListener("mouseDown", (client) ->
91-
client.setText($("#final-message").val())
92-
)
93-
clip.addEventListener("complete", ->
94-
btn = $("#final-copy-btn")
95-
btn.data("old-html", btn.html())
96-
btn.html("Copied!")
97-
setTimeout(() ->
98-
btn.html(btn.data("old-html"))
99-
, 2000)
100-
)
101-
10294
class Score
10395
messages = [
10496
[

‎js/main.js

-249
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.