overlay_me 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -2
- data/Gemfile.lock +1 -1
- data/README.md +14 -9
- data/Rakefile +1 -0
- data/javascripts/addons/layout_resizer.js.coffee +7 -7
- data/javascripts/basics.js.coffee +19 -10
- data/javascripts/draggable.js.coffee +16 -20
- data/javascripts/init.js.coffee +8 -2
- data/javascripts/lib/backbone.js +13 -13
- data/javascripts/lib/jquery.js +802 -802
- data/javascripts/menu.js.coffee +34 -25
- data/javascripts/menu_item.js.coffee +4 -4
- data/javascripts/mixins/hideable.js.coffee +13 -0
- data/javascripts/mixins/storable.js.coffee +17 -0
- data/javascripts/overlay_me.js.coffee +4 -0
- data/javascripts/overlays.js.coffee +5 -5
- data/javascripts/overlays/content_div_mngmt.js.coffee +33 -37
- data/javascripts/overlays/draggable_image.js.coffee +15 -12
- data/javascripts/overlays/dynamic_images_mngmt.js.coffee +2 -2
- data/javascripts/overlays/image.js.coffee +31 -36
- data/javascripts/overlays/images_container.js.coffee +22 -0
- data/javascripts/overlays/images_mngt_div.js.coffee +15 -52
- data/lib/overlay_me/version.rb +1 -1
- data/overlay_me.css +86 -59
- data/overlay_me.gemspec +1 -1
- data/overlay_me.js +1134 -1052
- data/stylesheets/overlay_me.css.scss +44 -21
- data/vendor/assets/javascripts/overlay_me/addons/layout_resizer.js +11 -11
- data/vendor/assets/javascripts/overlay_me/overlay_me.min.js +326 -319
- metadata +7 -6
- data/addons/layout_resizer.js +0 -51
data/javascripts/menu.js.coffee
CHANGED
@@ -1,29 +1,38 @@
|
|
1
1
|
#= require 'draggable'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
3
|
+
class OverlayMe.MenuClass extends OverlayMe.Draggable
|
4
|
+
|
5
|
+
id: 'overlay_me_menu'
|
6
|
+
|
7
|
+
initialize: (attributes) ->
|
8
|
+
super(attributes, { default_css: { top: '50px' } })
|
9
|
+
drag_me_line = (new Backbone.View).make 'div', { class: 'drag-me' }, 'Drag me up and down'
|
10
|
+
@menu_list = (new Backbone.View).make 'ul'
|
11
|
+
|
12
|
+
# stack them together
|
13
|
+
$o(@el).append drag_me_line
|
14
|
+
$o(@el).append @menu_list
|
15
|
+
|
16
|
+
# add it to the page
|
17
|
+
$o('body').append @render()
|
18
|
+
|
19
|
+
# add listeners
|
20
|
+
$o(drag_me_line).bind 'mousedown', (event) =>
|
21
|
+
@toggleMove(event)
|
22
|
+
$o(window).bind 'mouseup', (event) =>
|
23
|
+
@endMove(event)
|
24
|
+
$o(window).bind 'overlay_me:toggle_all_display', =>
|
25
|
+
@toggleDisplay()
|
26
|
+
|
27
|
+
append: (element) ->
|
28
|
+
@menu_list.appendChild element
|
29
|
+
|
30
|
+
toggleCollapse: ->
|
31
|
+
if $o(@el).hasClass('collapsed')
|
32
|
+
$o(@el).removeClass('collapsed')
|
25
33
|
else
|
26
|
-
|
27
|
-
|
28
|
-
OverlayMe.menu_box.saveCss()
|
34
|
+
$o(@el).addClass('collapsed')
|
35
|
+
|
29
36
|
|
37
|
+
# create only 1 menu
|
38
|
+
OverlayMe.menu = new OverlayMe.MenuClass() unless OverlayMe.menu_box
|
@@ -7,7 +7,7 @@ class OverlayMe.MenuItem extends Backbone.View
|
|
7
7
|
@id = attributes.id
|
8
8
|
@el.appendChild @collapseButton()
|
9
9
|
@title = this.make 'label', { class: 'title' }, attributes.title
|
10
|
-
$(@title).bind 'click', =>
|
10
|
+
$o(@title).bind 'click', =>
|
11
11
|
@toggleCollapse()
|
12
12
|
@el.appendChild @title
|
13
13
|
@content = this.make 'div', { class: 'item-content' }
|
@@ -17,7 +17,7 @@ class OverlayMe.MenuItem extends Backbone.View
|
|
17
17
|
|
18
18
|
collapseButton: () ->
|
19
19
|
@collapseButton = this.make 'a', { class: 'collaps-button' }, '<span>o</span>'
|
20
|
-
$(@collapseButton).bind 'click', =>
|
20
|
+
$o(@collapseButton).bind 'click', =>
|
21
21
|
@toggleCollapse()
|
22
22
|
@collapseButton
|
23
23
|
|
@@ -28,9 +28,9 @@ class OverlayMe.MenuItem extends Backbone.View
|
|
28
28
|
|
29
29
|
setCollapse: (toCollapse) ->
|
30
30
|
if toCollapse
|
31
|
-
$(@el).addClass 'collapsed'
|
31
|
+
$o(@el).addClass 'collapsed'
|
32
32
|
else
|
33
|
-
$(@el).removeClass 'collapsed'
|
33
|
+
$o(@el).removeClass 'collapsed'
|
34
34
|
|
35
35
|
append: (childElemt) ->
|
36
36
|
@content.appendChild childElemt
|
@@ -0,0 +1,13 @@
|
|
1
|
+
OverlayMe.Mixin.Hideable = {
|
2
|
+
|
3
|
+
isDisplayed: ->
|
4
|
+
return $o(@el).css('display') != 'none'
|
5
|
+
|
6
|
+
toggleDisplay: (default_display_type='block') ->
|
7
|
+
if @isDisplayed()
|
8
|
+
$o(@el).css { display: 'none' }
|
9
|
+
else
|
10
|
+
$o(@el).css { display: default_display_type }
|
11
|
+
@saveCss()
|
12
|
+
|
13
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
OverlayMe.Mixin.Storable = {
|
2
|
+
|
3
|
+
loadCss: (element=@el, default_css) ->
|
4
|
+
if ( cssData = localStorage.getItem(@id) )
|
5
|
+
$o(element).css(JSON.parse(cssData))
|
6
|
+
else
|
7
|
+
$o(element).css(default_css) unless default_css == undefined
|
8
|
+
|
9
|
+
saveCss: (element=@el) ->
|
10
|
+
@css_attributes_to_save = ['top', 'left', 'display', 'opacity'] unless @css_attributes_to_save
|
11
|
+
cssData = {}
|
12
|
+
for css_attribute in @css_attributes_to_save
|
13
|
+
cssData[css_attribute] = $o(element).css(css_attribute)
|
14
|
+
localStorage.setItem(@id, JSON.stringify(cssData))
|
15
|
+
|
16
|
+
}
|
17
|
+
|
@@ -19,11 +19,11 @@ if OverlayMe.mustLoad()
|
|
19
19
|
overlay_panel.append OverlayMe.images_management_div.render()
|
20
20
|
|
21
21
|
# add the panel to the page menu
|
22
|
-
|
22
|
+
OverlayMe.menu.append overlay_panel.render()
|
23
23
|
|
24
24
|
# repeating original window#mousemove event
|
25
|
-
$(window).bind 'mousemove', (event) ->
|
26
|
-
$(window).trigger('mymousemove', event)
|
25
|
+
$o(window).bind 'mousemove', (event) ->
|
26
|
+
$o(window).trigger('mymousemove', event)
|
27
27
|
|
28
28
|
# once everything rendered, load dynamicly added images
|
29
29
|
OverlayMe.dyn_manager = new OverlayMe.Overlays.DynamicManager()
|
@@ -35,14 +35,14 @@ if OverlayMe.mustLoad()
|
|
35
35
|
OverlayMe.dyn_manager.addImage('https://a248.e.akamai.net/assets.github.com/images/modules/about_page/octocat.png')
|
36
36
|
|
37
37
|
# adding all overlay images
|
38
|
-
|
38
|
+
$o.ajax
|
39
39
|
url: '/overlay_images'
|
40
40
|
dataType: 'json'
|
41
41
|
success: (data) ->
|
42
42
|
if data.length == 0 # in case all is empty (default for newcomers)
|
43
43
|
OverlayMe.loadDefaultImage()
|
44
44
|
else
|
45
|
-
|
45
|
+
$o.each data, (index, img_path) ->
|
46
46
|
OverlayMe.images_management_div.append new OverlayMe.Overlays.Image(img_path).render()
|
47
47
|
error: ->
|
48
48
|
OverlayMe.loadDefaultImage()
|
@@ -1,7 +1,11 @@
|
|
1
|
+
#= require 'mixins/storable'
|
2
|
+
|
1
3
|
class OverlayMe.Overlays.ContentDivManagementBlock extends Backbone.View
|
2
4
|
|
3
5
|
tagName: 'fieldset'
|
4
6
|
className: 'content-mgnt-block'
|
7
|
+
id: 'content_div_management_block'
|
8
|
+
css_attributes_to_save: ['z-index', 'opacity']
|
5
9
|
|
6
10
|
normal_zindex: '0'
|
7
11
|
over_zindex: '5'
|
@@ -9,30 +13,28 @@ class OverlayMe.Overlays.ContentDivManagementBlock extends Backbone.View
|
|
9
13
|
initialize: ->
|
10
14
|
|
11
15
|
# move all page content to a sub-Div
|
12
|
-
|
13
|
-
$('body').append
|
14
|
-
$('body > *').each (index, thing) =>
|
16
|
+
@page_container_div = @make 'div', { id: 'overlay_me_page_container' }
|
17
|
+
$o('body').append @page_container_div
|
18
|
+
$o('body > *').each (index, thing) =>
|
15
19
|
unless thing.id.match(/^overlay_me/) || thing.tagName == 'SCRIPT'
|
16
|
-
$(
|
20
|
+
$o(@page_container_div).append thing
|
17
21
|
|
18
22
|
# load previous css features of that container div
|
19
|
-
|
20
|
-
if ( contentCss = localStorage.getItem("#overlay_me_page_container") )
|
21
|
-
$("#overlay_me_page_container").css(JSON.parse(contentCss))
|
23
|
+
@loadCss(@page_container_div, {'z-index': @normal_zindex})
|
22
24
|
|
23
25
|
# adding a hidden unicorny button
|
24
26
|
unicorn_button = @make 'div', { class: 'unicorns', title: 'Feeling corny?' }
|
25
|
-
$(unicorn_button).bind 'click', ->
|
27
|
+
$o(unicorn_button).bind 'click', ->
|
26
28
|
OverlayMe.dyn_manager.addImage(OverlayMe.unicorns[Math.floor(Math.random()*OverlayMe.unicorns.length)], { default_css: { opacity: 1 } })
|
27
|
-
$(@el).append unicorn_button
|
29
|
+
$o(@el).append unicorn_button
|
28
30
|
|
29
31
|
# adding panel elements
|
30
|
-
$(@el).append @make 'legend', {}, 'Page content'
|
32
|
+
$o(@el).append @make 'legend', {}, 'Page content'
|
31
33
|
slider_block = @make 'div', { class: 'slider-block' }
|
32
|
-
$(@el).append slider_block
|
34
|
+
$o(@el).append slider_block
|
33
35
|
slider_block.appendChild @make 'label', {}, 'Opacity'
|
34
36
|
slider_block.appendChild @contentSlider()
|
35
|
-
$(@el).append @zIndexSwitch()
|
37
|
+
$o(@el).append @zIndexSwitch()
|
36
38
|
@bindEvents()
|
37
39
|
|
38
40
|
# adding a checkbox to flip HTML over images
|
@@ -40,52 +42,46 @@ class OverlayMe.Overlays.ContentDivManagementBlock extends Backbone.View
|
|
40
42
|
block = @make 'div', { class: 'zindex-switch' }
|
41
43
|
|
42
44
|
@zIndexSwitch = @make 'input', { type: "checkbox" }
|
43
|
-
$(block).append @zIndexSwitch
|
45
|
+
$o(block).append @zIndexSwitch
|
44
46
|
|
45
47
|
setTimeout => # have to wait a bit to make sure to access the loaded css
|
46
|
-
@zIndexSwitch.checked = true if $("#overlay_me_page_container").css('z-index') == @over_zindex
|
48
|
+
@zIndexSwitch.checked = true if $o("#overlay_me_page_container").css('z-index') == @over_zindex
|
47
49
|
, 500
|
48
50
|
|
49
|
-
label = @make 'label', {}, 'Content on top (
|
50
|
-
$(label).bind 'click', =>
|
51
|
-
$(@zIndexSwitch).trigger 'click'
|
52
|
-
$(block).append label
|
51
|
+
label = @make 'label', {}, 'Content on top (t)'
|
52
|
+
$o(label).bind 'click', =>
|
53
|
+
$o(@zIndexSwitch).trigger 'click'
|
54
|
+
$o(block).append label
|
53
55
|
|
54
56
|
|
55
57
|
contentSlider: ->
|
56
58
|
@contentSlider = @make 'input', {
|
57
59
|
id: "contentSlider",
|
58
60
|
type: "range",
|
59
|
-
value: $("#overlay_me_page_container").css('opacity')*100
|
61
|
+
value: $o("#overlay_me_page_container").css('opacity')*100
|
60
62
|
}
|
61
63
|
|
62
64
|
bindEvents: ->
|
63
|
-
$(@contentSlider).bind('change', =>
|
64
|
-
$("#overlay_me_page_container").css('opacity', $(@contentSlider)[0].value/100)
|
65
|
-
@
|
65
|
+
$o(@contentSlider).bind('change', =>
|
66
|
+
$o("#overlay_me_page_container").css('opacity', $o(@contentSlider)[0].value/100)
|
67
|
+
@saveCss(@page_container_div)
|
66
68
|
)
|
67
|
-
$(@zIndexSwitch).bind('change', (event) =>
|
69
|
+
$o(@zIndexSwitch).bind('change', (event) =>
|
68
70
|
if @zIndexSwitch.checked
|
69
|
-
$("#overlay_me_page_container").css({'z-index': @over_zindex})
|
71
|
+
$o("#overlay_me_page_container").css({'z-index': @over_zindex})
|
70
72
|
else
|
71
|
-
$("#overlay_me_page_container").css({'z-index': @normal_zindex})
|
72
|
-
@
|
73
|
+
$o("#overlay_me_page_container").css({'z-index': @normal_zindex})
|
74
|
+
@saveCss(@page_container_div)
|
73
75
|
)
|
74
76
|
# if click is kind of boring
|
75
|
-
$(window).bind('keypress', (event) =>
|
77
|
+
$o(window).bind('keypress', (event) =>
|
76
78
|
#console.log event.keyCode, event.charCode
|
77
|
-
if event.charCode ==
|
78
|
-
$(@zIndexSwitch).trigger('click')
|
79
|
+
if event.charCode == 116 # t
|
80
|
+
$o(@zIndexSwitch).trigger('click')
|
79
81
|
)
|
80
82
|
|
81
|
-
|
82
83
|
render: ->
|
83
84
|
@el
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
localStorage.setItem("#overlay_me_page_container", JSON.stringify({
|
88
|
-
opacity: $("#overlay_me_page_container").css('opacity'),
|
89
|
-
'z-index': $("#overlay_me_page_container").css('z-index')
|
90
|
-
}))
|
91
|
-
|
86
|
+
# extending few mixins - thx Derick - http://stackoverflow.com/questions/7853731/proper-way-of-doing-view-mixins-in-backbone
|
87
|
+
_.extend OverlayMe.Overlays.ContentDivManagementBlock.prototype, OverlayMe.Mixin.Storable
|
@@ -4,29 +4,32 @@ class OverlayMe.Overlays.DraggableImage extends OverlayMe.Draggable
|
|
4
4
|
|
5
5
|
initialize: (attributes, options) ->
|
6
6
|
super(attributes, options)
|
7
|
-
@image =
|
8
|
-
$(@
|
7
|
+
@image = new Image()
|
8
|
+
$o(@image).load => # when image loaded
|
9
|
+
@fitDivToImage()
|
10
|
+
$o(@image).attr 'src', options.image_src
|
11
|
+
$o(@el).append @image
|
9
12
|
|
10
13
|
# force positioning to 0 by default
|
11
|
-
$(@el).css('left', '0px') if $(@el).css('left') == 'auto' || $(@el).css('left') == ''
|
12
|
-
$(@el).css('top', '0px') if $(@el).css('top') == 'auto' || $(@el).css('top') == ''
|
14
|
+
$o(@el).css('left', '0px') if $o(@el).css('left') == 'auto' || $o(@el).css('left') == ''
|
15
|
+
$o(@el).css('top', '0px') if $o(@el).css('top') == 'auto' || $o(@el).css('top') == ''
|
13
16
|
|
14
|
-
$(@el).bind 'mousedown', (event) =>
|
17
|
+
$o(@el).bind 'mousedown', (event) =>
|
15
18
|
@toggleMove(event)
|
16
19
|
|
17
|
-
$(window).bind 'mouseup', (event) =>
|
20
|
+
$o(window).bind 'mouseup', (event) =>
|
18
21
|
@endMove(event)
|
19
22
|
|
20
|
-
$(@el).bind 'mouseover', (event) =>
|
21
|
-
$(".overlay-image-block[data-img-id=#{@id}]").addClass 'hovered'
|
23
|
+
$o(@el).bind 'mouseover', (event) =>
|
24
|
+
$o(".overlay-image-block[data-img-id=#{@id}]").addClass 'hovered'
|
22
25
|
|
23
|
-
$(@el).bind 'mouseout', (event) =>
|
24
|
-
$(".overlay-image-block[data-img-id=#{@id}]").removeClass 'hovered'
|
26
|
+
$o(@el).bind 'mouseout', (event) =>
|
27
|
+
$o(".overlay-image-block[data-img-id=#{@id}]").removeClass 'hovered'
|
25
28
|
|
26
29
|
fitDivToImage: ->
|
27
30
|
if @image.width > 0
|
28
|
-
$(@el).css('width', @image.width)
|
29
|
-
$(@el).css('height', @image.height)
|
31
|
+
$o(@el).css('width', @image.width)
|
32
|
+
$o(@el).css('height', @image.height)
|
30
33
|
|
31
34
|
render: ->
|
32
35
|
@el
|
@@ -25,8 +25,8 @@ class OverlayMe.Overlays.DynamicManager extends Backbone.Model
|
|
25
25
|
|
26
26
|
loadImage: (src, options = {} ) ->
|
27
27
|
image_id = OverlayMe.Overlays.urlToId(src)
|
28
|
-
unless $("#overlay_me_images_container ##{image_id}").length > 0
|
29
|
-
_default_css =
|
28
|
+
unless $o("#overlay_me_images_container ##{image_id}").length > 0
|
29
|
+
_default_css = $o.extend { display: 'block' }, options.default_css
|
30
30
|
image = new OverlayMe.Overlays.Image(src, { destroyable: true, default_css: _default_css })
|
31
31
|
OverlayMe.images_management_div.append image.render()
|
32
32
|
image
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#= require 'overlays/images_container'
|
1
2
|
#= require 'overlays/draggable_image'
|
2
3
|
|
3
4
|
class OverlayMe.Overlays.Image extends Backbone.View
|
@@ -8,35 +9,30 @@ class OverlayMe.Overlays.Image extends Backbone.View
|
|
8
9
|
initialize: (image_src, options = { destroyable: false }) ->
|
9
10
|
@image_src = image_src
|
10
11
|
@image_id = OverlayMe.Overlays.urlToId(image_src)
|
11
|
-
$(@el).attr 'data-img-id', @image_id
|
12
|
+
$o(@el).attr 'data-img-id', @image_id
|
12
13
|
|
13
|
-
|
14
|
-
if @images_container.length < 1
|
15
|
-
$('body').append (new Backbone.View).make 'div', { id: 'overlay_me_images_container' }
|
16
|
-
@images_container = $('#overlay_me_images_container')
|
14
|
+
OverlayMe.images_container = new OverlayMe.Overlays.ImagesContainer() unless OverlayMe.images_container
|
17
15
|
|
18
|
-
@default_css =
|
16
|
+
@default_css = $o.extend {display: 'none', opacity: 0.5}, options.default_css
|
19
17
|
|
20
|
-
unless $("##{@image_id}",
|
21
|
-
$(
|
18
|
+
unless $o("##{@image_id}", OverlayMe.images_container.el).length > 0
|
19
|
+
$o(OverlayMe.images_container.el).append @image()
|
22
20
|
|
23
|
-
$(@el).append @checkbox()
|
24
|
-
$(@el).append @label()
|
21
|
+
$o(@el).append @checkbox()
|
22
|
+
$o(@el).append @label()
|
25
23
|
slider_block = @make 'div', { class: 'slider-block' }
|
26
|
-
$(@el).append slider_block
|
24
|
+
$o(@el).append slider_block
|
27
25
|
slider_block.appendChild @make 'label', {}, 'Opacity'
|
28
26
|
slider_block.appendChild @slider()
|
29
|
-
$(@el).append @delButton() if options.destroyable
|
30
|
-
$(@el).bind 'click', (event) =>
|
27
|
+
$o(@el).append @delButton() if options.destroyable
|
28
|
+
$o(@el).bind 'click', (event) =>
|
31
29
|
@flickCheckbox()
|
32
|
-
$(@el).bind 'mouseover', (event) =>
|
33
|
-
$(@image.el).
|
34
|
-
$(@
|
35
|
-
|
36
|
-
|
37
|
-
$(@
|
38
|
-
$(@el).removeClass 'hovered'
|
39
|
-
$(@image.el).css('opacity', $(@slider)[0].value/100)
|
30
|
+
$o(@el).bind 'mouseover', (event) =>
|
31
|
+
$o(@image.el).addClass 'highlight'
|
32
|
+
$o(@el).addClass 'hovered'
|
33
|
+
$o(@el).bind 'mouseout', (event) =>
|
34
|
+
$o(@image.el).removeClass 'highlight'
|
35
|
+
$o(@el).removeClass 'hovered'
|
40
36
|
|
41
37
|
|
42
38
|
image: ->
|
@@ -45,19 +41,19 @@ class OverlayMe.Overlays.Image extends Backbone.View
|
|
45
41
|
|
46
42
|
checkbox: ->
|
47
43
|
@checkbox = @make 'input', { type: "checkbox" }
|
48
|
-
if
|
44
|
+
if @image.isDisplayed()
|
49
45
|
@checkbox.checked = true
|
50
|
-
$(@checkbox).bind 'click', (e) =>
|
46
|
+
$o(@checkbox).bind 'click', (e) =>
|
51
47
|
e.stopPropagation()
|
52
48
|
@flickVisibility()
|
53
|
-
$(@checkbox).bind 'change', (e) =>
|
49
|
+
$o(@checkbox).bind 'change', (e) =>
|
54
50
|
e.stopPropagation()
|
55
51
|
@flickVisibility()
|
56
52
|
@checkbox
|
57
53
|
|
58
54
|
delButton: ->
|
59
55
|
@delButton = @make 'button', { class: 'del-button', title: 'Delete' }, 'x'
|
60
|
-
$(@delButton).bind 'click', (e) =>
|
56
|
+
$o(@delButton).bind 'click', (e) =>
|
61
57
|
OverlayMe.dyn_manager.delImage @image_id
|
62
58
|
@delButton
|
63
59
|
|
@@ -66,11 +62,10 @@ class OverlayMe.Overlays.Image extends Backbone.View
|
|
66
62
|
@flickVisibility()
|
67
63
|
|
68
64
|
flickVisibility: ->
|
69
|
-
@image.fitDivToImage()
|
70
65
|
if @checkbox.checked
|
71
|
-
$(@image.el).css('
|
66
|
+
$o(@image.el).css('display', 'block')
|
72
67
|
else
|
73
|
-
$(@image.el).css('
|
68
|
+
$o(@image.el).css('display', 'none')
|
74
69
|
@image.saveCss()
|
75
70
|
|
76
71
|
label: ->
|
@@ -80,19 +75,19 @@ class OverlayMe.Overlays.Image extends Backbone.View
|
|
80
75
|
slider: ->
|
81
76
|
@slider = @make 'input', {
|
82
77
|
type: "range",
|
83
|
-
value: $(@image.el).css('opacity')*100
|
78
|
+
value: $o(@image.el).css('opacity')*100
|
84
79
|
}
|
85
|
-
$(@slider).bind 'click', (e) =>
|
80
|
+
$o(@slider).bind 'click', (e) =>
|
86
81
|
e.stopPropagation()
|
87
|
-
$(@slider).bind 'change', (e) =>
|
88
|
-
$(@image.el).css('opacity', $(@slider)[0].value/100)
|
82
|
+
$o(@slider).bind 'change', (e) =>
|
83
|
+
$o(@image.el).css('opacity', $o(@slider)[0].value/100)
|
89
84
|
@image.saveCss()
|
90
|
-
$(@slider).bind 'mouseover', (e) =>
|
85
|
+
$o(@slider).bind 'mouseover', (e) =>
|
91
86
|
e.stopPropagation()
|
92
|
-
$(@el).addClass 'hovered'
|
93
|
-
$(@slider).bind 'mouseout', (e) =>
|
87
|
+
$o(@el).addClass 'hovered'
|
88
|
+
$o(@slider).bind 'mouseout', (e) =>
|
94
89
|
e.stopPropagation()
|
95
|
-
$(@el).removeClass 'hovered'
|
90
|
+
$o(@el).removeClass 'hovered'
|
96
91
|
@slider
|
97
92
|
|
98
93
|
render: ->
|