overlay_me 0.13.0 → 0.13.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +10 -1
- data/Gemfile +10 -1
- data/Gemfile.lock +32 -12
- data/Guardfile +13 -0
- data/README.md +32 -16
- data/Rakefile +67 -88
- data/javascripts/{addons → coffeescripts/addons}/layout_resizer.js.coffee +0 -0
- data/javascripts/coffeescripts/basics_panel.js.coffee +42 -0
- data/javascripts/{draggable.js.coffee → coffeescripts/draggable.js.coffee} +0 -0
- data/javascripts/{init.js.coffee → coffeescripts/init.js.coffee} +11 -2
- data/javascripts/{lib → coffeescripts/lib}/backbone.js +0 -0
- data/javascripts/{lib → coffeescripts/lib}/html5slider.js +0 -0
- data/javascripts/{lib → coffeescripts/lib}/jquery.js +0 -0
- data/javascripts/{lib → coffeescripts/lib}/underscore.js +0 -0
- data/javascripts/{menu.js.coffee → coffeescripts/menu.js.coffee} +8 -3
- data/javascripts/{menu_item.js.coffee → coffeescripts/menu_item.js.coffee} +5 -5
- data/javascripts/{mixins → coffeescripts/mixins}/hideable.js.coffee +0 -0
- data/javascripts/{mixins → coffeescripts/mixins}/storable.js.coffee +0 -0
- data/javascripts/coffeescripts/overlay_me.js.coffee +7 -0
- data/javascripts/{overlays → coffeescripts/overlays}/content_div_mngmt.js.coffee +0 -0
- data/javascripts/{overlays → coffeescripts/overlays}/draggable_image.js.coffee +0 -0
- data/javascripts/{overlays → coffeescripts/overlays}/dynamic_images_mngmt.js.coffee +0 -0
- data/javascripts/{overlays → coffeescripts/overlays}/image.js.coffee +0 -0
- data/javascripts/{overlays → coffeescripts/overlays}/images_container.js.coffee +0 -0
- data/javascripts/{overlays → coffeescripts/overlays}/images_directory.js.coffee +0 -0
- data/javascripts/{overlays → coffeescripts/overlays}/images_mngt_div.js.coffee +0 -0
- data/javascripts/{overlays → coffeescripts/overlays}/init.js.coffee +0 -0
- data/javascripts/coffeescripts/overlays_panel.js.coffee +90 -0
- data/javascripts/overlay_me.css_embedded.js +13166 -0
- data/{overlay_me.js → javascripts/overlay_me.js} +216 -150
- data/lib/overlay_me.rb +15 -0
- data/lib/overlay_me/version.rb +1 -1
- data/spec/SpecRunner.html +56 -0
- data/spec/javascripts/coffeescripts/init.spec.js.coffee +21 -0
- data/spec/javascripts/coffeescripts/menu.spec.js.coffee +36 -0
- data/spec/javascripts/coffeescripts/menu_item.spec.js.coffee +66 -0
- data/spec/javascripts/init.spec.js +25 -0
- data/spec/javascripts/menu.spec.js +38 -0
- data/spec/javascripts/menu_item.spec.js +81 -0
- data/spec/lib/jasmine-1.2.0.rc3/MIT.LICENSE +20 -0
- data/spec/lib/jasmine-1.2.0.rc3/jasmine-html.js +616 -0
- data/spec/lib/jasmine-1.2.0.rc3/jasmine.css +81 -0
- data/spec/lib/jasmine-1.2.0.rc3/jasmine.js +2530 -0
- data/{overlay_me.css → stylesheets/overlay_me.css} +27 -78
- data/stylesheets/{overlay_me.css.scss → scss/overlay_me.css.scss} +2 -1
- data/vendor/assets/javascripts/overlay_me/addons/layout_resizer.js +0 -51
- data/vendor/assets/javascripts/overlay_me/overlay_me.min.js +10 -8
- metadata +42 -29
- data/javascripts/basics.js.coffee +0 -38
- data/javascripts/overlay_me.js.coffee +0 -7
- data/javascripts/overlays.js.coffee +0 -87
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,13 @@
|
|
1
|
-
|
1
|
+
- add jasmine tests
|
2
|
+
- refactorings
|
3
|
+
|
4
|
+
### 0.13.3 - [Diff](https://github.com/frontfoot/overlay_me/compare/v0.13.0...v0.13.3)
|
5
|
+
- handle Rails assets pipeline
|
6
|
+
|
7
|
+
### 0.13.1, 0.13.2
|
8
|
+
- some troubles with these gem builds, no idea what I fucked up !
|
9
|
+
|
10
|
+
### 0.13.0 - [Diff](https://github.com/frontfoot/overlay_me/compare/v0.12.1...v0.13.0)
|
2
11
|
- multi/sub directories images can be added !
|
3
12
|
- updated style and collapsing events
|
4
13
|
|
data/Gemfile
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
source "http://www.rubygems.org"
|
2
2
|
|
3
|
+
## gems dependencies in overlay_me.gemspec
|
3
4
|
gemspec
|
4
5
|
|
6
|
+
## packaging
|
5
7
|
gem 'jsmin'
|
6
8
|
gem 'yui-compressor'
|
7
|
-
|
9
|
+
|
10
|
+
## tests
|
11
|
+
gem 'guard-coffeescript', "~>1.2.0"
|
12
|
+
gem 'rb-fsevent'
|
13
|
+
gem 'guard-rake'
|
14
|
+
|
15
|
+
# debug
|
16
|
+
gem 'ruby-debug'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
overlay_me (0.13.
|
4
|
+
overlay_me (0.13.4)
|
5
5
|
coffee-script
|
6
6
|
compass
|
7
7
|
haml
|
@@ -17,24 +17,35 @@ GEM
|
|
17
17
|
Platform (>= 0.4.0)
|
18
18
|
open4
|
19
19
|
Platform (0.4.0)
|
20
|
-
chunky_png (1.2.
|
20
|
+
chunky_png (1.2.6)
|
21
21
|
coffee-script (2.2.0)
|
22
22
|
coffee-script-source
|
23
23
|
execjs
|
24
24
|
coffee-script-source (1.3.1)
|
25
|
-
|
25
|
+
columnize (0.3.2)
|
26
|
+
compass (0.12.2)
|
26
27
|
chunky_png (~> 1.2)
|
27
28
|
fssm (>= 0.2.7)
|
28
29
|
sass (~> 3.1)
|
29
|
-
execjs (1.
|
30
|
+
execjs (1.4.0)
|
30
31
|
multi_json (~> 1.0)
|
31
|
-
ffi (1.
|
32
|
+
ffi (1.1.5)
|
32
33
|
fssm (0.2.9)
|
33
|
-
|
34
|
+
guard (1.3.2)
|
35
|
+
listen (>= 0.4.2)
|
36
|
+
thor (>= 0.14.6)
|
37
|
+
guard-coffeescript (1.2.0)
|
38
|
+
coffee-script (>= 2.2.0)
|
39
|
+
guard (>= 1.1.0)
|
40
|
+
guard-rake (0.0.7)
|
41
|
+
guard
|
42
|
+
rake
|
43
|
+
haml (3.1.7)
|
34
44
|
hike (1.2.1)
|
35
45
|
jsmin (1.0.1)
|
36
|
-
json (1.7.
|
37
|
-
|
46
|
+
json (1.7.5)
|
47
|
+
linecache (0.43)
|
48
|
+
listen (0.4.7)
|
38
49
|
rb-fchange (~> 0.0.5)
|
39
50
|
rb-fsevent (~> 0.9.1)
|
40
51
|
rb-inotify (~> 0.8.8)
|
@@ -47,15 +58,21 @@ GEM
|
|
47
58
|
rb-fsevent (0.9.1)
|
48
59
|
rb-inotify (0.8.8)
|
49
60
|
ffi (>= 0.5.0)
|
50
|
-
|
51
|
-
|
61
|
+
ruby-debug (0.10.4)
|
62
|
+
columnize (>= 0.1)
|
63
|
+
ruby-debug-base (~> 0.10.4.0)
|
64
|
+
ruby-debug-base (0.10.4)
|
65
|
+
linecache (>= 0.3)
|
66
|
+
sass (3.2.1)
|
67
|
+
sprockets (2.4.5)
|
52
68
|
hike (~> 1.2)
|
53
69
|
multi_json (~> 1.0)
|
54
70
|
rack (~> 1.0)
|
55
71
|
tilt (~> 1.1, != 1.3.0)
|
56
|
-
sprockets-sass (0.
|
72
|
+
sprockets-sass (0.9.0)
|
57
73
|
sprockets (~> 2.0)
|
58
74
|
tilt (~> 1.1)
|
75
|
+
thor (0.16.0)
|
59
76
|
tilt (1.3.3)
|
60
77
|
yui-compressor (0.9.6)
|
61
78
|
POpen4 (>= 0.1.4)
|
@@ -64,7 +81,10 @@ PLATFORMS
|
|
64
81
|
ruby
|
65
82
|
|
66
83
|
DEPENDENCIES
|
84
|
+
guard-coffeescript (~> 1.2.0)
|
85
|
+
guard-rake
|
67
86
|
jsmin
|
68
|
-
listen
|
69
87
|
overlay_me!
|
88
|
+
rb-fsevent
|
89
|
+
ruby-debug
|
70
90
|
yui-compressor
|
data/Guardfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# A Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
require 'coffee_script'
|
5
|
+
require 'sass'
|
6
|
+
|
7
|
+
guard 'rake', :task => 'assets:compile_debug', :run_on_start => false do
|
8
|
+
watch(%r{^javascripts/coffeescripts/*})
|
9
|
+
watch(%r{^stylesheets/scss/overlay_me.css.scss})
|
10
|
+
end
|
11
|
+
|
12
|
+
guard 'coffeescript', :input => 'spec/javascripts/coffeescripts', :output => 'spec/javascripts', :all_on_start => true
|
13
|
+
|
data/README.md
CHANGED
@@ -4,41 +4,56 @@ Store the bookmarklet from [this page](http://frontfoot.github.com/overlay_me/de
|
|
4
4
|
|
5
5
|
If you just want download the compiled, minified archive: [overlay_me.min.js](https://raw.github.com/frontfoot/overlay_me/master/vendor/assets/javascripts/overlay_me/overlay_me.min.js) (CSS embedded!)
|
6
6
|
|
7
|
-
note:
|
7
|
+
note: javascripts/*.js and stylesheets/*.css are both generated unminified archives, original source code is in respective coofeescripts and scss subfolders
|
8
8
|
|
9
9
|
## Screenshot
|
10
10
|
|
11
11
|
![Screenshot](http://github.com/frontfoot/overlay_me/raw/master/screenshot_frontfoot_website.jpg)
|
12
12
|
|
13
13
|
|
14
|
+
## Why
|
15
|
+
|
16
|
+
The purpose of this tool is to help the developer to meet designers requirements by overlaying images on the page.
|
17
|
+
|
18
|
+
We were struggling to see the gap between designers photoshop files and our HTML/CSS implementation, the best way to figure it out was to load their rendered work in the page and play with opacity to see the differences, that's what this tool facilitate.
|
19
|
+
|
20
|
+
|
14
21
|
## Features
|
15
22
|
|
16
|
-
- overlay images over a web page
|
17
|
-
-
|
23
|
+
- overlay images over a web page
|
24
|
+
- position and opacity of each image is saved locally to the browser (using HTML5 localStorage)
|
25
|
+
- images can be loaded from a project directory (see Project base use underneath)
|
18
26
|
- an image can be added on the fly with its absolute url
|
19
|
-
-
|
27
|
+
- hideable / collapsible toolbox ('h' and 'c' keys)
|
28
|
+
- HTML on top of the overlays
|
29
|
+
- page content can be brought back on top of the overlays ('t' key switch)
|
20
30
|
- control the opacity of the page content
|
21
|
-
- keep on playing with the CSS while having
|
22
|
-
- addon layout_resizer
|
31
|
+
- keep on playing with the CSS while having the visual overlay by transparency
|
32
|
+
- addon layout_resizer: switch between pre-recorded devices format
|
23
33
|
|
24
34
|
|
25
|
-
##
|
35
|
+
## Compare
|
26
36
|
|
27
|
-
|
37
|
+
I've found 2 other similar tools
|
28
38
|
|
29
|
-
|
39
|
+
- [http://makiapp.com/](http://makiapp.com/) - really nice if you're not a dev guy and want to upload local files
|
40
|
+
- [http://pixelperfectplugin.com/](http://pixelperfectplugin.com/) - same idea than overlay_me but firefox only (extension) and really less smooth on the dragging
|
30
41
|
|
31
42
|
|
32
43
|
## Todo
|
33
44
|
|
34
|
-
- fix styles for firefox
|
45
|
+
- fix styles for firefox and IE (may not happen)
|
35
46
|
- allow local image uploading (hosting on amazon s3 ?), [makiapp.com](http://makiapp.com/) does it!
|
36
47
|
- add another dragging bar at the bottom (or not)
|
37
48
|
- prevent the dragging bar(s) to be out of reach
|
38
49
|
- overlays
|
39
50
|
- make a cycling system, by click or keypress, to iterate through overlays one by one
|
40
|
-
-
|
41
|
-
|
51
|
+
- make a pixel by pixel motion feature - see https://github.com/madrobby/keymaster
|
52
|
+
- write more tests
|
53
|
+
- tests are in progress
|
54
|
+
- why not a CI service - see [travis-ci.org](http://travis-ci.org/#!/michelson/lazy_high_charts/builds/527014)
|
55
|
+
- investigate non working sites
|
56
|
+
- http://www.informit.com/articles/article.aspx?p=1383760
|
42
57
|
|
43
58
|
|
44
59
|
## Usage
|
@@ -114,7 +129,6 @@ using middleman
|
|
114
129
|
end
|
115
130
|
|
116
131
|
|
117
|
-
|
118
132
|
## Plug on!
|
119
133
|
|
120
134
|
You can add some app specific menu for specific project.. Have a look at layout_resizer.coffee addon to have a quick view of how to use OverlayMe.Menu and OverlayMe.MenuItem
|
@@ -122,12 +136,10 @@ You can add some app specific menu for specific project.. Have a look at layout_
|
|
122
136
|
= javascript_include_tag 'overlay_me/addons/layout_resizer.js'
|
123
137
|
|
124
138
|
|
125
|
-
|
126
139
|
## Known problems
|
127
140
|
|
128
141
|
- you can't find the panel? it's probably hidden aside (previous bigger screen location) or hidden (press 'h')
|
129
|
-
- you see the overlay but can't drag it? the 'Content on Top' option is probably on (press '
|
130
|
-
|
142
|
+
- you see the overlay but can't drag it? the 'Content on Top' option is probably on (press 't')
|
131
143
|
|
132
144
|
|
133
145
|
## Author
|
@@ -141,3 +153,7 @@ You can add some app specific menu for specific project.. Have a look at layout_
|
|
141
153
|
- Lachlan Sylvester - Ruby advisor - Frontfoot Media Solutions
|
142
154
|
- Dan Smith - User Experience Strategist and Califloridian - former workmate
|
143
155
|
|
156
|
+
|
157
|
+
## License
|
158
|
+
|
159
|
+
MIT License
|
data/Rakefile
CHANGED
@@ -3,114 +3,93 @@ require "bundler/setup"
|
|
3
3
|
require 'sprockets'
|
4
4
|
require 'sprockets-sass'
|
5
5
|
require 'compass'
|
6
|
-
require 'rake/sprocketstask'
|
7
6
|
require 'jsmin'
|
8
7
|
require 'yui/compressor'
|
9
|
-
require 'listen'
|
10
8
|
|
11
|
-
|
12
|
-
ENV['js_minified'] = "vendor/assets/javascripts/overlay_me/overlay_me.min.js"
|
13
|
-
ENV['css_sprocket'] = "overlay_me.css"
|
14
|
-
ENV['css_minified'] = "style.min.css"
|
9
|
+
namespace :assets do
|
15
10
|
|
16
|
-
ENV['
|
11
|
+
ENV['js_sprocket'] = "javascripts/overlay_me.js"
|
12
|
+
ENV['js_with_css'] = "javascripts/overlay_me.css_embedded.js"
|
13
|
+
ENV['js_minified'] = "vendor/assets/javascripts/overlay_me/overlay_me.min.js"
|
14
|
+
ENV['css_sprocket'] = "stylesheets/overlay_me.css"
|
15
|
+
ENV['css_minified'] = "stylesheets/overlay_me.min.css"
|
16
|
+
ENV['addon_layout_resizer'] = "vendor/assets/javascripts/overlay_me/addons/layout_resizer.js"
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
environment = Sprockets::Environment.new
|
21
|
-
environment.append_path 'javascripts'
|
22
|
-
environment.append_path 'stylesheets'
|
18
|
+
# config to remove the original filenames into generated css (bloody useful for dev though)
|
19
|
+
Sprockets::Sass.options[:line_comments] = false
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
desc "sprockets compiling/jamming"
|
22
|
+
puts "\n** Sprocketting #{ENV['js_sprocket']}, #{ENV['css_sprocket']}, #{ENV['addon_layout_resizer']} **"
|
23
|
+
task :compile do
|
24
|
+
environment = Sprockets::Environment.new
|
25
|
+
environment.append_path 'javascripts/coffeescripts'
|
26
|
+
environment.append_path 'stylesheets/scss'
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
Dir["{.,addons}/*-*.{js,css}"].each do |file|
|
33
|
-
new_file = file.sub /(.*)-[^\.]+(\.[^\.]+)/, '\1\2'
|
34
|
-
puts "#{file} -> #{new_file}"
|
35
|
-
`mv #{file} #{new_file}`
|
28
|
+
File.open(ENV['js_sprocket'], 'w'){ |f| f.write(environment[File.basename(f.path)].to_s) }
|
29
|
+
File.open(ENV['css_sprocket'], 'w'){ |f| f.write(environment[File.basename(f.path)].to_s) }
|
30
|
+
File.open(ENV['addon_layout_resizer'], 'w'){ |f| f.write(environment[File.basename(f.path)].to_s) }
|
36
31
|
end
|
37
|
-
end
|
38
|
-
|
39
|
-
desc "compile assets with Sprockets, remove DIGEST, move some files"
|
40
|
-
task :compile => [:assets, :remove_digest] do
|
41
|
-
puts "\n** Move addons into vendor/asssets/ **"
|
42
|
-
`rm -rf vendor/assets/javascripts/overlay_me/addons`
|
43
|
-
`mv addons vendor/assets/javascripts/overlay_me/`
|
44
|
-
end
|
45
32
|
|
33
|
+
desc "minify the assets"
|
34
|
+
namespace :minify do
|
46
35
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
File.open(ENV['css_minified'], 'w') do |file|
|
53
|
-
file.write(YUI::CssCompressor.new.compress(File.read(ENV['css_sprocket'])))
|
36
|
+
task :css do
|
37
|
+
puts "\n** Minify CSS file #{ENV['css_sprocket']} -> #{ENV['css_minified']} **"
|
38
|
+
File.open(ENV['css_minified'], 'w') do |file|
|
39
|
+
file.write(YUI::CssCompressor.new.compress(File.read(ENV['css_sprocket'])))
|
40
|
+
end
|
54
41
|
end
|
55
|
-
end
|
56
42
|
|
57
|
-
|
58
|
-
|
43
|
+
task :add_minified_css_to_js do
|
44
|
+
puts "\n** Add CSS minified blob inline in the javascript :! **"
|
59
45
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
46
|
+
css_blob = File.read(ENV['css_minified'])
|
47
|
+
js_string = File.read(ENV['js_sprocket']).gsub(/#CSS_BLOB#/, css_blob)
|
48
|
+
File.open(ENV['js_with_css'], 'w') { |f| f.write(js_string) }
|
49
|
+
`rm #{ENV['css_minified']}` # remove minified css file
|
50
|
+
end
|
65
51
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
52
|
+
task :js do
|
53
|
+
puts "\n** Minify JS file #{ENV['js_with_css']} -> #{ENV['js_minified']} **"
|
54
|
+
File.open(ENV['js_minified'], 'w') do |file|
|
55
|
+
file.write(JSMin.minify(File.read(ENV['js_with_css'])))
|
56
|
+
end
|
70
57
|
end
|
71
|
-
end
|
72
58
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
59
|
+
desc "add a header on the minified js file to properly redirect curious"
|
60
|
+
task :prepend_header do
|
61
|
+
puts "\n** Prepend header to compiled files **"
|
62
|
+
|
63
|
+
header = "// OverlayMe v#{OverlayMe::VERSION}\n"
|
64
|
+
header += "// http://github.com/frontfoot/overlay_me\n"
|
65
|
+
header += "//\n"
|
66
|
+
header += "// #{File.open('LICENSE'){|f| f.readline().chomp() }}\n"
|
67
|
+
header += "// OverlayMe is freely distributable under the MIT license.\n"
|
68
|
+
header += "//\n"
|
69
|
+
header += "// Includes:\n"
|
70
|
+
header += "// - jQuery - http://jquery.com/ - Copyright 2011, John Resig\n"
|
71
|
+
header += "// - Backbone.js - http://documentcloud.github.com/backbone - (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.\n"
|
72
|
+
header += "// - Underscore.js - http://documentcloud.github.com/underscore - (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.\n"
|
73
|
+
header += "// - html5slider - https://github.com/fryn/html5slider - Copyright (c) 2010-2011 Frank Yan\n"
|
74
|
+
header += "\n"
|
75
|
+
puts header
|
76
|
+
|
77
|
+
original_content = File.read(ENV['js_minified'])
|
78
|
+
File.open(ENV['js_minified'], 'w') do |f|
|
79
|
+
f.write(header)
|
80
|
+
f.write(original_content)
|
81
|
+
end
|
95
82
|
end
|
83
|
+
|
84
|
+
task :all_in_one => [:css, :add_minified_css_to_js, :js, :prepend_header]
|
85
|
+
task :only_css_for_js_debug => [:css, :add_minified_css_to_js]
|
96
86
|
end
|
97
87
|
|
98
|
-
|
99
|
-
|
88
|
+
desc "package, aka prepare the minified .js"
|
89
|
+
task :package => [:compile, 'minify:all_in_one']
|
100
90
|
|
101
|
-
desc "
|
102
|
-
task :
|
91
|
+
desc "compile all js in 1, but no minifying (useful for jasmine tests via guard-rake)"
|
92
|
+
task :compile_debug => [:compile, 'minify:only_css_for_js_debug']
|
103
93
|
|
104
|
-
desc "Watch javascripts and stylesheets folders re-package the assets at each change"
|
105
|
-
task :watch do
|
106
|
-
callback = Proc.new do
|
107
|
-
`rake package` # trust me I'm not proud... but couldn't find any better
|
108
|
-
puts 'done'
|
109
|
-
end
|
110
|
-
listener = Listen.to('stylesheets', 'javascripts')
|
111
|
-
listener.latency(0.5)
|
112
|
-
listener.change(&callback)
|
113
|
-
listener.start
|
114
94
|
end
|
115
95
|
|
116
|
-
|
File without changes
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#= require 'menu'
|
2
|
+
#= require 'menu_item'
|
3
|
+
|
4
|
+
class OverlayMe.BasicsPanel extends OverlayMe.MenuItem
|
5
|
+
|
6
|
+
initialize: (attributes, options) ->
|
7
|
+
super({id: "basics-options-panel", title: "Basics" }, options)
|
8
|
+
|
9
|
+
collapse_button = (new Backbone.View).make 'button', { class: 'collapse'}, 'Collapse (c)'
|
10
|
+
$o(collapse_button).bind 'click', (event) =>
|
11
|
+
OverlayMe.menu.toggleCollapse()
|
12
|
+
@append collapse_button
|
13
|
+
|
14
|
+
clear_all_button = (new Backbone.View).make 'button', { class: 'reset', onClick: "javascript: OverlayMe.clearAndReload()" }, 'Reset All (r)'
|
15
|
+
@append clear_all_button
|
16
|
+
|
17
|
+
toggle_all_display = ->
|
18
|
+
$o(window).trigger 'overlay_me:toggle_all_display'
|
19
|
+
$o(window).trigger 'overlay_me:toggle_overlay_me_images_container_display'
|
20
|
+
|
21
|
+
hide_button = (new Backbone.View).make 'button', { class: 'hide' }, 'Hide (h)'
|
22
|
+
$o(hide_button).bind 'click', (event) =>
|
23
|
+
toggle_all_display()
|
24
|
+
@append hide_button
|
25
|
+
|
26
|
+
# add the element to the menu (so yes it has to be there!)
|
27
|
+
OverlayMe.menu.append @render()
|
28
|
+
|
29
|
+
# add listener for keypress
|
30
|
+
$o(window).bind('keypress', (event) =>
|
31
|
+
# console.log event.keyCode, event.charCode
|
32
|
+
if event.charCode == 104 # h
|
33
|
+
toggle_all_display()
|
34
|
+
if event.charCode == 99 # c
|
35
|
+
OverlayMe.menu.toggleCollapse()
|
36
|
+
if event.charCode == 114 # r
|
37
|
+
OverlayMe.clearAndReload()
|
38
|
+
)
|
39
|
+
|
40
|
+
# create one at DOM loaded
|
41
|
+
$o ->
|
42
|
+
OverlayMe.basics_panel = new OverlayMe.BasicsPanel() unless OverlayMe.basics_panel
|