internet-sampler 0.1.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94e768283bc9ac747d870d79bebb09b9d1ba5ac0
4
- data.tar.gz: bf182b6b82aae4291bae03db5cf795f3d8d3b761
3
+ metadata.gz: 057d9cfc69ff0e8c56471323e9393c591970f618
4
+ data.tar.gz: 86018e23643b20116d7b4d76de0a86578bace964
5
5
  SHA512:
6
- metadata.gz: 9764c40abb1661392b8184eb201d53e2b8968ea85e6125ceb30be6d7f8fce39532a4f85d94a9d94c469273c4f0d718493bac1988ac8313831c3a52ad0d4bb9c0
7
- data.tar.gz: 9821603d3c7f38df52d208501d9d398e6b38f7f3cfefb8db568b07b6c47af020f281b5ad44b23338b833db790674dc483b5264c21d9271b7c0ca397c3a0a75e3
6
+ metadata.gz: d751c23dbb1e8f2c5255af0f1e0480cb0c1bfba4f2536a83a5cdf87b24be238d85ac2d12efebf6ad1e18fed57182ba571259806c83467160376589edf310fbbb
7
+ data.tar.gz: 8721e77cd6203226eb546e14d82b7f06360e237a27e339a71ed8b487b94b143f79eed517bf864727b19a446ff78981a04fa1d4b36e996efa8accee262aef5888
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
  /tmp/
10
10
 
11
11
  /dump.rdb
12
+
13
+ /*.gem
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- internet-sampler (0.1.0)
4
+ internet-sampler (0.2.1)
5
5
  redis
6
- sinatra (~> 1.4.6)
7
- sinatra-contrib (~> 1.4.6)
6
+ sinatra (~> 1.4)
7
+ sinatra-contrib (~> 1.4)
8
8
  sinatra-websocket
9
- slim (~> 3.0.6)
9
+ slim (~> 3.0)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
data/app/public/main.css CHANGED
@@ -1,9 +1,13 @@
1
1
  body {
2
2
  font-family: sans-serif;
3
- background-color: #efefef;
3
+ background-color: #D9D8D5;
4
4
  margin: 0 1.5em;
5
5
  }
6
6
 
7
+ h1 {
8
+ font-weight: 700;
9
+ }
10
+
7
11
  #number {
8
12
  position: fixed;
9
13
  z-index: -1;
@@ -27,7 +31,6 @@ body {
27
31
 
28
32
  .play-container {
29
33
  display: block;
30
- padding-top: 1em;
31
34
  }
32
35
 
33
36
  .play {
@@ -38,6 +41,7 @@ body {
38
41
  vertical-align: top;
39
42
 
40
43
  margin-right: 14px;
44
+ margin-bottom: 14px;
41
45
  padding: 14px;
42
46
 
43
47
  text-align: center;
@@ -47,23 +51,22 @@ body {
47
51
  font-weight: bold;
48
52
  font-size: 20px;
49
53
 
50
- border: 2px solid #555;
51
- border-radius: 10px;
52
- background-color: #ccc;
54
+ border-radius: 4px;
55
+ background-color: #8A8B91;
56
+
57
+ box-shadow: 0 0 9px #777;
53
58
 
54
59
  transition: all .1s ease 0s;
55
60
  }
56
61
 
57
62
  .play:hover {
58
- border: 2px solid #333;
59
63
  background-color: #999;
60
64
  }
61
65
 
62
66
  .play:active {
63
67
  color: #fff;
64
- border: 2px solid #111;
65
68
  background-color: #777;
66
- transform: scale(0.95, 0.95);
69
+ box-shadow: 0 0 7px #C63851, 0 0 3px #333 inset;
67
70
  }
68
71
 
69
72
  .play audio {
@@ -77,22 +80,76 @@ body {
77
80
  font-size: 3em;
78
81
  }
79
82
 
83
+ .checkbox-wrapper {
84
+ margin-top: 3.5em;
85
+ }
86
+
87
+ .checkbox {
88
+ display: inline-block;
89
+ }
90
+
91
+ .checkbox input[type="checkbox"] {
92
+ display: none;
93
+ }
94
+
95
+ .checkbox label {
96
+ display: inline-block;
97
+ cursor: pointer;
98
+ font-size: .8em;
99
+ padding: .3em .7em;
100
+ border: 1px solid #888;
101
+ border-radius: 3px;
102
+ box-shadow: 0 0 3px #888 inset;
103
+ background-color: #ccc;
104
+ color: #666;
105
+
106
+ transition: all .1s ease 0s;
107
+ }
108
+
109
+ .checkbox label:hover {
110
+ opacity: .8;
111
+ }
112
+
113
+ .checkbox label:active {
114
+ transform: translateY(1px);
115
+ }
116
+
117
+ .checkbox input[type="checkbox"]:checked ~ label {
118
+ background-color: #E1A6A2;
119
+ box-shadow: 0 0 2px 1px #EF5F55 inset;
120
+ border-color: #A5554F;
121
+ color: #000;
122
+ }
123
+
124
+ .checkbox + .checkbox {
125
+ margin-left: .5em;
126
+ }
127
+
80
128
  #msgs {
81
129
  display: block;
82
130
  border: 1px solid #777;
131
+ margin-top: 1em;
83
132
  padding: .3em;
84
- margin-top: 5em;
85
133
  font-family: monospace;
86
134
  font-size: 10px;
87
135
  max-height: 10em;
88
136
  overflow: scroll;
89
137
  }
90
138
 
91
- @media only screen and (max-device-width: 736px) {
139
+ @media only screen and (max-width: 550px) {
92
140
  .play {
93
141
  width: 90%;
142
+ height: 140px;
94
143
  margin: 14px auto;
95
144
  }
145
+
146
+ .checkbox {
147
+ display: block;
148
+ }
149
+ .checkbox + .checkbox {
150
+ margin-top: .3em;
151
+ margin-left: 0;
152
+ }
96
153
  }
97
154
 
98
155
  .widgets .widget {
data/app/public/main.js CHANGED
@@ -4,15 +4,15 @@ window.onload = (function(){
4
4
  el.innerHTML = msg + '<br>' + el.innerHTML;
5
5
  };
6
6
 
7
- var ws = new WebSocket(ws_url);
7
+ var ws = new WebSocket(ws_url);
8
8
 
9
9
  var play = function(slug, count) {
10
10
  if (document.getElementById('checkbox-play-on-device').checked) {
11
- var target = $(".play[data-track=" + slug + "] audio")[0];
11
+ var $target = $(".play[data-track=" + slug + "] audio")[0];
12
12
  if (document.getElementById('checkbox-rewind-on-play').checked) {
13
- target.currentTime = 0;
13
+ $target.currentTime = 0;
14
14
  }
15
- target.play();
15
+ $target.play();
16
16
  if (typeof(window.navigator.vibrate) === "function") { window.navigator.vibrate(70); }
17
17
  }
18
18
 
@@ -46,7 +46,7 @@ window.onload = (function(){
46
46
  }
47
47
  };
48
48
 
49
- var evname = ('ontouchstart' in document) ? 'touchstart' : 'click';
49
+ var evname = ('ontouchstart' in document) ? 'touchstart' : 'mousedown';
50
50
  $('.play').on(evname, function(f){
51
51
  var tg = f.currentTarget.getAttribute('data-track');
52
52
  ws.send(
@@ -56,6 +56,5 @@ window.onload = (function(){
56
56
  })
57
57
  );
58
58
  show('Sent: ' + tg);
59
- play(tg, null);
60
59
  });
61
60
  });
Binary file
data/app/views/index.slim CHANGED
@@ -11,13 +11,7 @@ html
11
11
  script src="/main.js"
12
12
  body
13
13
  h1 Internet Sampler
14
- #number = "*"
15
- .checkbox.clickable
16
- input type='checkbox' name='play-on-device' id='checkbox-play-on-device' checked="checked"
17
- label for='checkbox-play-on-device' Play sound on this device
18
- .checkbox.clickable
19
- input type='checkbox' name='rewind-on-play' id='checkbox-rewind-on-play' checked="checked"
20
- label for='checkbox-rewind-on-play' Rewind on play
14
+ #number *
21
15
 
22
16
  .play-container
23
17
  - @tracks.each do |track|
@@ -25,7 +19,17 @@ html
25
19
  .tag = track[:slug]
26
20
  audio src="#{track[:path]}" preload="auto" controls="none"
27
21
  .count = (track[:count] || 0)
22
+
23
+ .checkbox-wrapper
24
+ .checkbox.clickable
25
+ input type='checkbox' name='play-on-device' id='checkbox-play-on-device' checked="checked"
26
+ label for='checkbox-play-on-device' Play sound on this device
27
+ .checkbox.clickable
28
+ input type='checkbox' name='rewind-on-play' id='checkbox-rewind-on-play' checked="checked"
29
+ label for='checkbox-rewind-on-play' Rewind on play
30
+
28
31
  #msgs
32
+
29
33
  footer
30
34
  p
31
35
  .widgets
data/config.ru CHANGED
@@ -9,5 +9,7 @@ InternetSampler::Application.run_with_sampler_options!(
9
9
  { slug: 'Frontliner', path: '/mp3/frontliner-fsharp-kick.mp3' },
10
10
  ]
11
11
  },
12
- { port: 9292, bind: 'localhost' }
12
+ {}
13
13
  )
14
+
15
+ # run InternetSampler::Application
@@ -8,6 +8,7 @@ module InternetSampler
8
8
  sinatra_options = {
9
9
  port: 9292,
10
10
  bind: 'localhost',
11
+ environment: :development,
11
12
  }
12
13
  sampler_options = {
13
14
  tracks: []
@@ -17,6 +18,11 @@ module InternetSampler
17
18
 
18
19
  opt.on('-p port', '--port port', 'port to listen (default is 9292)') { |i| sinatra_options[:port] = i.to_i }
19
20
  opt.on('-b host', '--bind host', 'host to bind (default is localhost)') { |i| sinatra_options[:bind] = i }
21
+ opt.on('-e env', '--environment env', 'environment to run (production, test or development; default is development)') { |i|
22
+ if %w{development test production}.include? i
23
+ sinatra_options[:environment] = i.to_sym
24
+ end
25
+ }
20
26
  opt.on('-t slug:url', '--track slug:url', 'sample sound to serve (note that `url\' is not path to file but URL to serve)') { |i|
21
27
  if track = i.match(/^([^:]*):(.*)$/)
22
28
  sampler_options[:tracks] << {
@@ -1,3 +1,3 @@
1
1
  module InternetSampler
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: internet-sampler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - polamjag
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-13 00:00:00.000000000 Z
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra