seedman 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/focus_watcher.js.coffee +47 -0
- data/lib/seedman.rb +4 -0
- data/lib/seedman/engine.rb +5 -0
- data/lib/seedman/version.rb +3 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 392da1357cec3048d4070a89b315d5610b25fa59
|
4
|
+
data.tar.gz: 86f16f31b2cc03ffd2cd2a09818e56ddd19b8eb8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cd44f8dbe0a4b97b3ba14223178fc30026fe5d23fb08c760b433e2d8ac91f326d1868f29b0b58caee9714091d24efa328a606efc647fbe2c20cdefaa3fa87afc
|
7
|
+
data.tar.gz: d5bf1876eb73cba92515caeb7a718df848a5471ac7dc9e6c7eed57d4d44694cde7cdb3558c3fb3efde1cc2627a7ed3a12cd4b8367a1e2a9bbf5e861a57fefc98
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 Alexander Gorbunov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'FocusWatcher'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class FocusWatcher
|
2
|
+
elements: []
|
3
|
+
focus: {
|
4
|
+
current: null
|
5
|
+
currentParents: []
|
6
|
+
currentObserved: []
|
7
|
+
previous: null
|
8
|
+
previousParents: []
|
9
|
+
previousObserved: []
|
10
|
+
}
|
11
|
+
|
12
|
+
register: (element) ->
|
13
|
+
@elements.push(element) for element in $(element)
|
14
|
+
|
15
|
+
constructor: ->
|
16
|
+
$(document).on 'click', (e) => @changeFocus(e.target)
|
17
|
+
|
18
|
+
changeFocus: (target) =>
|
19
|
+
return unless target?
|
20
|
+
cleanTarget = if target instanceof jQuery then target.get(0) else target
|
21
|
+
return if @focus.current == cleanTarget
|
22
|
+
# Копируем предыдущий элемент
|
23
|
+
@focus.previous = @focus.current
|
24
|
+
@focus.current = cleanTarget
|
25
|
+
# Копируем предыдущих предков
|
26
|
+
@focus.previousParents = @focus.currentParents
|
27
|
+
(@focus.currentParents = $(@focus.current).parents().toArray()).unshift(cleanTarget)
|
28
|
+
# Копируем предыдущие контроллируемые элементы
|
29
|
+
@focus.previousObserved = @focus.currentObserved
|
30
|
+
@focus.currentObserved = []
|
31
|
+
for parent in @focus.currentParents
|
32
|
+
@focus.currentObserved.push(parent) if @elements.indexOf(parent) > -1
|
33
|
+
@_processChange()
|
34
|
+
@focus.current
|
35
|
+
|
36
|
+
_processChange: ->
|
37
|
+
@_sendDefocused(parent) if @focus.currentObserved.indexOf(parent) is -1 for parent in @focus.previousObserved
|
38
|
+
@_sendFocused(parent) if @focus.previousObserved.indexOf(parent) is -1 for parent in @focus.currentObserved
|
39
|
+
|
40
|
+
|
41
|
+
_sendFocused: (target) =>
|
42
|
+
$(target).trigger('focused', [@focus.previous, @focus.current])
|
43
|
+
|
44
|
+
_sendDefocused: (target) =>
|
45
|
+
$(target).trigger('defocused', [@focus.previous, @focus.current])
|
46
|
+
|
47
|
+
window.FocusWatcher = new FocusWatcher
|
data/lib/seedman.rb
ADDED
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: seedman
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Gorbunov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
description: Gem for add progressbar at seed
|
28
|
+
email:
|
29
|
+
- lexgorbunov@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- MIT-LICENSE
|
35
|
+
- Rakefile
|
36
|
+
- app/assets/javascripts/focus_watcher.js.coffee
|
37
|
+
- lib/seedman.rb
|
38
|
+
- lib/seedman/engine.rb
|
39
|
+
- lib/seedman/version.rb
|
40
|
+
homepage: https://github.com/lexgorbunov/seedman
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.2.2
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Gem for add progressbar at seed
|
64
|
+
test_files: []
|