diamonds 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +36 -0
- data/lib/diamonds.rb +74 -0
- data/lib/diamonds/Gemfile +28 -0
- data/lib/diamonds/README.md +254 -0
- data/lib/diamonds/Rakefile +5 -0
- data/lib/diamonds/apps/application.rb +15 -0
- data/lib/diamonds/apps/library.rb +321 -0
- data/lib/diamonds/apps/user_app.rb +5 -0
- data/lib/diamonds/config.ru +98 -0
- data/lib/diamonds/db/mysiteDB Back.sqlite3 +0 -0
- data/lib/diamonds/db/mysiteDB.sqlite3 +0 -0
- data/lib/diamonds/gems/auto_launch_browser.rb +22 -0
- data/lib/diamonds/gems/io.rb +146 -0
- data/lib/diamonds/gems/ruby_to_js.rb +173 -0
- data/lib/diamonds/gems/server_utils.rb +96 -0
- data/lib/diamonds/lib/opal-browser.rb +1 -0
- data/lib/diamonds/lib/opal/browser.rb +4 -0
- data/lib/diamonds/opal-browser.gemspec +21 -0
- data/lib/diamonds/opal/browser.rb +11 -0
- data/lib/diamonds/opal/browser/animation_frame.rb +111 -0
- data/lib/diamonds/opal/browser/canvas.rb +321 -0
- data/lib/diamonds/opal/browser/canvas/data.rb +63 -0
- data/lib/diamonds/opal/browser/canvas/gradient.rb +27 -0
- data/lib/diamonds/opal/browser/canvas/style.rb +113 -0
- data/lib/diamonds/opal/browser/canvas/text.rb +45 -0
- data/lib/diamonds/opal/browser/console.rb +103 -0
- data/lib/diamonds/opal/browser/cookies.rb +133 -0
- data/lib/diamonds/opal/browser/css.rb +24 -0
- data/lib/diamonds/opal/browser/css/declaration.rb +83 -0
- data/lib/diamonds/opal/browser/css/rule.rb +48 -0
- data/lib/diamonds/opal/browser/css/rule/style.rb +16 -0
- data/lib/diamonds/opal/browser/css/style_sheet.rb +83 -0
- data/lib/diamonds/opal/browser/css/unit.rb +188 -0
- data/lib/diamonds/opal/browser/database/sql.rb +194 -0
- data/lib/diamonds/opal/browser/delay.rb +78 -0
- data/lib/diamonds/opal/browser/dom.rb +84 -0
- data/lib/diamonds/opal/browser/dom/attribute.rb +26 -0
- data/lib/diamonds/opal/browser/dom/builder.rb +88 -0
- data/lib/diamonds/opal/browser/dom/cdata.rb +9 -0
- data/lib/diamonds/opal/browser/dom/character_data.rb +73 -0
- data/lib/diamonds/opal/browser/dom/comment.rb +9 -0
- data/lib/diamonds/opal/browser/dom/document.rb +149 -0
- data/lib/diamonds/opal/browser/dom/document_fragment.rb +7 -0
- data/lib/diamonds/opal/browser/dom/element.rb +474 -0
- data/lib/diamonds/opal/browser/dom/element/attributes.rb +87 -0
- data/lib/diamonds/opal/browser/dom/element/data.rb +67 -0
- data/lib/diamonds/opal/browser/dom/element/image.rb +23 -0
- data/lib/diamonds/opal/browser/dom/element/input.rb +28 -0
- data/lib/diamonds/opal/browser/dom/element/offset.rb +89 -0
- data/lib/diamonds/opal/browser/dom/element/position.rb +46 -0
- data/lib/diamonds/opal/browser/dom/element/scroll.rb +136 -0
- data/lib/diamonds/opal/browser/dom/element/select.rb +36 -0
- data/lib/diamonds/opal/browser/dom/element/size.rb +34 -0
- data/lib/diamonds/opal/browser/dom/element/template.rb +9 -0
- data/lib/diamonds/opal/browser/dom/element/textarea.rb +24 -0
- data/lib/diamonds/opal/browser/dom/mutation_observer.rb +178 -0
- data/lib/diamonds/opal/browser/dom/node.rb +464 -0
- data/lib/diamonds/opal/browser/dom/node_set.rb +110 -0
- data/lib/diamonds/opal/browser/dom/text.rb +36 -0
- data/lib/diamonds/opal/browser/effects.rb +50 -0
- data/lib/diamonds/opal/browser/event.rb +253 -0
- data/lib/diamonds/opal/browser/event/animation.rb +38 -0
- data/lib/diamonds/opal/browser/event/audio_processing.rb +33 -0
- data/lib/diamonds/opal/browser/event/base.rb +430 -0
- data/lib/diamonds/opal/browser/event/before_unload.rb +15 -0
- data/lib/diamonds/opal/browser/event/clipboard.rb +28 -0
- data/lib/diamonds/opal/browser/event/close.rb +47 -0
- data/lib/diamonds/opal/browser/event/composition.rb +50 -0
- data/lib/diamonds/opal/browser/event/custom.rb +65 -0
- data/lib/diamonds/opal/browser/event/device_light.rb +23 -0
- data/lib/diamonds/opal/browser/event/device_motion.rb +51 -0
- data/lib/diamonds/opal/browser/event/device_orientation.rb +48 -0
- data/lib/diamonds/opal/browser/event/device_proximity.rb +33 -0
- data/lib/diamonds/opal/browser/event/drag.rb +119 -0
- data/lib/diamonds/opal/browser/event/focus.rb +39 -0
- data/lib/diamonds/opal/browser/event/gamepad.rb +60 -0
- data/lib/diamonds/opal/browser/event/hash_change.rb +28 -0
- data/lib/diamonds/opal/browser/event/keyboard.rb +115 -0
- data/lib/diamonds/opal/browser/event/message.rb +70 -0
- data/lib/diamonds/opal/browser/event/mouse.rb +254 -0
- data/lib/diamonds/opal/browser/event/page_transition.rb +23 -0
- data/lib/diamonds/opal/browser/event/pop_state.rb +33 -0
- data/lib/diamonds/opal/browser/event/progress.rb +43 -0
- data/lib/diamonds/opal/browser/event/sensor.rb +15 -0
- data/lib/diamonds/opal/browser/event/storage.rb +43 -0
- data/lib/diamonds/opal/browser/event/touch.rb +60 -0
- data/lib/diamonds/opal/browser/event/ui.rb +38 -0
- data/lib/diamonds/opal/browser/event/wheel.rb +49 -0
- data/lib/diamonds/opal/browser/event_source.rb +70 -0
- data/lib/diamonds/opal/browser/history.rb +90 -0
- data/lib/diamonds/opal/browser/http.rb +169 -0
- data/lib/diamonds/opal/browser/http/binary.rb +58 -0
- data/lib/diamonds/opal/browser/http/headers.rb +109 -0
- data/lib/diamonds/opal/browser/http/request.rb +344 -0
- data/lib/diamonds/opal/browser/http/response.rb +115 -0
- data/lib/diamonds/opal/browser/immediate.rb +163 -0
- data/lib/diamonds/opal/browser/interval.rb +111 -0
- data/lib/diamonds/opal/browser/location.rb +87 -0
- data/lib/diamonds/opal/browser/navigator.rb +173 -0
- data/lib/diamonds/opal/browser/screen.rb +66 -0
- data/lib/diamonds/opal/browser/socket.rb +123 -0
- data/lib/diamonds/opal/browser/storage.rb +252 -0
- data/lib/diamonds/opal/browser/support.rb +287 -0
- data/lib/diamonds/opal/browser/utils.rb +74 -0
- data/lib/diamonds/opal/browser/version.rb +3 -0
- data/lib/diamonds/opal/browser/window.rb +120 -0
- data/lib/diamonds/opal/browser/window/scroll.rb +59 -0
- data/lib/diamonds/opal/browser/window/size.rb +59 -0
- data/lib/diamonds/opal/browser/window/view.rb +36 -0
- data/lib/diamonds/opal/opal-browser.rb +1 -0
- data/lib/diamonds/public/__OPAL_SOURCE_MAPS__/application.map +0 -0
- data/lib/diamonds/public/javascripts/font-awesome/HELP-US-OUT.txt +7 -0
- data/lib/diamonds/public/javascripts/font-awesome/css/font-awesome.css +2026 -0
- data/lib/diamonds/public/javascripts/font-awesome/css/font-awesome.min.css +1 -0
- data/lib/diamonds/public/javascripts/font-awesome/fonts/FontAwesome.otf +0 -0
- data/lib/diamonds/public/javascripts/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- data/lib/diamonds/public/javascripts/font-awesome/fonts/fontawesome-webfont.svg +640 -0
- data/lib/diamonds/public/javascripts/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- data/lib/diamonds/public/javascripts/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- data/lib/diamonds/public/javascripts/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/animated.less +34 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/bordered-pulled.less +25 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/core.less +12 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/fixed-width.less +6 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/font-awesome.less +17 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/icons.less +677 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/larger.less +13 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/list.less +19 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/mixins.less +26 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/path.less +15 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/rotated-flipped.less +20 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/stacked.less +20 -0
- data/lib/diamonds/public/javascripts/font-awesome/less/variables.less +688 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_animated.scss +34 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_bordered-pulled.scss +25 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_core.scss +12 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_fixed-width.scss +6 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_icons.scss +677 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_larger.scss +13 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_list.scss +19 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_mixins.scss +26 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_path.scss +15 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_rotated-flipped.scss +20 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_stacked.scss +20 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/_variables.scss +688 -0
- data/lib/diamonds/public/javascripts/font-awesome/scss/font-awesome.scss +17 -0
- data/lib/diamonds/public/javascripts/jquery-2.1.4.min.js +4 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-icons_228ef1_256x240.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-icons_ef8c08_256x240.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-icons_ffd27a_256x240.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/images/ui-icons_ffffff_256x240.png +0 -0
- data/lib/diamonds/public/javascripts/jquery-ui/jquery-ui.min.css +7 -0
- data/lib/diamonds/public/javascripts/jquery-ui/jquery-ui.min.js +13 -0
- data/lib/diamonds/public/javascripts/jquery-ui/jquery-ui.structure.min.css +5 -0
- data/lib/diamonds/public/javascripts/jquery-ui/jquery-ui.theme.min.css +5 -0
- data/lib/diamonds/public/javascripts/jquery.js +4 -0
- data/lib/diamonds/public/javascripts/jquery.ui.touch-punch.min.js +11 -0
- data/lib/diamonds/public/javascripts/ne pas utiliser version en retard jeezs_editor.js b/data/lib/diamonds/public/javascripts/ne pas utiliser version en retard → jeezs_editor.js +0 -0
- data/lib/diamonds/public/javascripts/standalone.js +2316 -0
- data/lib/diamonds/public/javascripts/standalone.min.js +1 -0
- data/lib/diamonds/public/javascripts/wysiwyg-editor.min.css +1 -0
- data/lib/diamonds/public/javascripts/wysiwyg-editor.min.js +1 -0
- data/lib/diamonds/public/javascripts/wysiwyg.min.js +1 -0
- data/lib/diamonds/user_app/main.rb +45 -0
- data/lib/diamonds/version.rb +3 -0
- data/lib/diamonds/views/index.erb +35 -0
- data/lib/diamonds/views/javascripts/jeezs_editor.js.erb +365 -0
- data/lib/diamonds/views/stylesheets/main.css.erb +244 -0
- metadata +490 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class BeforeUnload < Event
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.BeforeUnload'
|
6
|
+
end
|
7
|
+
|
8
|
+
if Browser.supports? 'Event.constructor'
|
9
|
+
def self.construct(name, desc)
|
10
|
+
`new BeforeUnloadEvent(#{name}, #{desc})`
|
11
|
+
end
|
12
|
+
end if supported?
|
13
|
+
end
|
14
|
+
|
15
|
+
end; end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class Clipboard < Event
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.Clipboard'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Definition < Definition
|
9
|
+
def data=(value)
|
10
|
+
`#@native.data = #{value}`
|
11
|
+
end
|
12
|
+
|
13
|
+
def type=(value)
|
14
|
+
`#@native.dataType = #{value}`
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if Browser.supports? 'Event.constructor'
|
19
|
+
def self.construct(name, desc)
|
20
|
+
`new ClipboardEvent(#{name}, #{desc})`
|
21
|
+
end
|
22
|
+
end if supported?
|
23
|
+
|
24
|
+
alias_native :data
|
25
|
+
alias_native :type, :dataType
|
26
|
+
end
|
27
|
+
|
28
|
+
end; end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class Close < Event
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.Close'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Definition < Definition
|
9
|
+
def code=(value)
|
10
|
+
`#@native.code = #{value}`
|
11
|
+
end
|
12
|
+
|
13
|
+
def reason=(value)
|
14
|
+
`#@native.reason = #{value}`
|
15
|
+
end
|
16
|
+
|
17
|
+
def clean!(value)
|
18
|
+
`#@native.wasClean = true`
|
19
|
+
end
|
20
|
+
|
21
|
+
def not_clean!(value)
|
22
|
+
`#@native.wasClean = false`
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if Browser.supports? 'Event.constructor'
|
27
|
+
def self.construct(name, desc)
|
28
|
+
`new CloseEvent(#{name}, #{desc})`
|
29
|
+
end
|
30
|
+
elsif Browser.supports? 'Event.create'
|
31
|
+
def self.construct(name, desc)
|
32
|
+
%x{
|
33
|
+
var event = document.createEvent("CloseEvent");
|
34
|
+
event.initCloseEvent(name, desc.bubbles, desc.cancelable,
|
35
|
+
desc.wasClean, desc.code, desc.reason);
|
36
|
+
|
37
|
+
return event;
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end if supported?
|
41
|
+
|
42
|
+
alias_native :code
|
43
|
+
alias_native :reason
|
44
|
+
alias_native :clean?, :wasClean
|
45
|
+
end
|
46
|
+
|
47
|
+
end; end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class Composition < UI
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.Composition'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Definition < UI::Definition
|
9
|
+
def data=(value)
|
10
|
+
`#@native.data = #{value}`
|
11
|
+
end
|
12
|
+
|
13
|
+
def locale=(value)
|
14
|
+
`#@native.locale = #{value}`
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if Browser.supports? 'Event.constructor'
|
19
|
+
def self.construct(name, desc)
|
20
|
+
`new CompositionEvent(#{name}, #{desc})`
|
21
|
+
end
|
22
|
+
elsif Browser.supports? 'Event.create'
|
23
|
+
def self.construct(name, desc)
|
24
|
+
%x{
|
25
|
+
var event = document.createEvent("CompositionEvent");
|
26
|
+
event.initCompositionEvent(name, desc.bubbles, desc.cancelable,
|
27
|
+
desc.view || window, desc.data, desc.locale);
|
28
|
+
|
29
|
+
return event;
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end if supported?
|
33
|
+
|
34
|
+
alias_native :data
|
35
|
+
alias_native :locale
|
36
|
+
|
37
|
+
def start?
|
38
|
+
name.downcase == 'compositionstart'
|
39
|
+
end
|
40
|
+
|
41
|
+
def update?
|
42
|
+
name.downcase == 'compositionupdate'
|
43
|
+
end
|
44
|
+
|
45
|
+
def end?
|
46
|
+
name.downcase == 'compositionend'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end; end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
module Browser; class Event
|
4
|
+
|
5
|
+
class Custom < Event
|
6
|
+
def self.supported?
|
7
|
+
Browser.supports? 'Event.Custom'
|
8
|
+
end
|
9
|
+
|
10
|
+
class Definition < Definition
|
11
|
+
def method_missing(name, value)
|
12
|
+
if name.end_with? ?=
|
13
|
+
`#@native[#{name[0 .. -2]}] = value`
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if Browser.supports? 'Event.constructor'
|
19
|
+
def self.construct(name, desc)
|
20
|
+
`new CustomEvent(name, {
|
21
|
+
bubbles: desc.bubbles,
|
22
|
+
cancelable: desc.cancelable,
|
23
|
+
detail: desc })`
|
24
|
+
end
|
25
|
+
elsif Browser.supports? 'Event.create'
|
26
|
+
def self.construct(name, desc)
|
27
|
+
%x{
|
28
|
+
var event = document.createEvent("CustomEvent");
|
29
|
+
event.initCustomEvent(name, desc.bubbles, desc.cancelable, desc);
|
30
|
+
|
31
|
+
return event;
|
32
|
+
}
|
33
|
+
end
|
34
|
+
elsif Browser.supports? 'Event.createObject'
|
35
|
+
def self.construct(name, desc)
|
36
|
+
Native(`document.createEventObject()`).merge!(`{
|
37
|
+
type: name,
|
38
|
+
bubbles: desc.bubbles,
|
39
|
+
cancelable: desc.cancelable,
|
40
|
+
detail: desc }`).to_n
|
41
|
+
end
|
42
|
+
else
|
43
|
+
def self.construct(name, desc)
|
44
|
+
Native(desc).merge!(`{
|
45
|
+
type: name,
|
46
|
+
bubbles: desc.bubbles,
|
47
|
+
cancelable: desc.cancelable,
|
48
|
+
detail: desc }`).to_n
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def initialize(event, callback = nil)
|
53
|
+
super(event, callback)
|
54
|
+
|
55
|
+
@detail = Hash.new(`#{event}.detail`)
|
56
|
+
end
|
57
|
+
|
58
|
+
def method_missing(id, *)
|
59
|
+
return @detail[id] if @detail.has_key?(id)
|
60
|
+
|
61
|
+
super
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end; end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class DeviceLight < Event
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.DeviceLight'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Definition < Definition
|
9
|
+
def value=(value)
|
10
|
+
`#@native.value = #{value}`
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
if Browser.supports? 'Event.constructor'
|
15
|
+
def self.construct(name, desc)
|
16
|
+
`new DeviceLightEvent(#{name}, #{desc})`
|
17
|
+
end
|
18
|
+
end if supported?
|
19
|
+
|
20
|
+
alias_native :value
|
21
|
+
end
|
22
|
+
|
23
|
+
end; end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class DeviceMotion < Event
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.DeviceMotion'
|
6
|
+
end
|
7
|
+
|
8
|
+
Acceleration = Struct.new(:x, :y, :z)
|
9
|
+
|
10
|
+
class Definition < Definition
|
11
|
+
def acceleration=(value)
|
12
|
+
`#@native.acceleration = #{value.to_n}`
|
13
|
+
end
|
14
|
+
|
15
|
+
def acceleration_with_gravity=(value)
|
16
|
+
`#@native.accelerationIncludingGravity = #{value.to_n}`
|
17
|
+
end
|
18
|
+
|
19
|
+
def rotation=(value)
|
20
|
+
`#@native.rotationRate = #{value}`
|
21
|
+
end
|
22
|
+
|
23
|
+
def interval=(value)
|
24
|
+
`#@native.interval = #{value}`
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if Browser.supports? 'Event.constructor'
|
29
|
+
def self.construct(name, desc)
|
30
|
+
`new DeviceMotionEvent(#{name}, #{desc})`
|
31
|
+
end
|
32
|
+
elsif Browser.supports? 'Event.create'
|
33
|
+
def self.construct(name, desc)
|
34
|
+
%x{
|
35
|
+
var event = document.createEvent("DeviceMotionEvent");
|
36
|
+
event.initDeviceMotionEvent(name, desc.bubbles, desc.cancelable,
|
37
|
+
desc.acceleration, desc.accelerationIncludingGravity,
|
38
|
+
desc.rotationRate, desc.interval);
|
39
|
+
|
40
|
+
return event;
|
41
|
+
}
|
42
|
+
end
|
43
|
+
end if supported?
|
44
|
+
|
45
|
+
alias_native :acceleration
|
46
|
+
alias_native :acceleration_with_gravity, :accelerationIncludingGravity
|
47
|
+
alias_native :rotation, :rotationRate
|
48
|
+
alias_native :interval
|
49
|
+
end
|
50
|
+
|
51
|
+
end; end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class DeviceOrientation < Event
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.DeviceOrientation'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Definition < Definition
|
9
|
+
def absolute=(value)
|
10
|
+
`#@native.absolute = #{value}`
|
11
|
+
end
|
12
|
+
|
13
|
+
def alpha=(value)
|
14
|
+
`#@native.alpha = #{value}`
|
15
|
+
end
|
16
|
+
|
17
|
+
def beta=(value)
|
18
|
+
`#@native.beta = #{value}`
|
19
|
+
end
|
20
|
+
|
21
|
+
def gamma=(value)
|
22
|
+
`#@native.gamma = #{value}`
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if Browser.supports? 'Event.constructor'
|
27
|
+
def self.construct(name, desc)
|
28
|
+
`new DeviceOrientationEvent(#{name}, #{desc})`
|
29
|
+
end
|
30
|
+
elsif Browser.supports? 'Event.create'
|
31
|
+
def self.construct(name, desc)
|
32
|
+
%x{
|
33
|
+
var event = document.createEvent("DeviceOrientationEvent");
|
34
|
+
event.initDeviceOrientationEvent(name, desc.bubbles, desc.cancelable,
|
35
|
+
desc.alpha, desc.beta, desc.gamma, desc.absolute);
|
36
|
+
|
37
|
+
return event;
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end if supported?
|
41
|
+
|
42
|
+
alias_native :absolute
|
43
|
+
alias_native :alpha
|
44
|
+
alias_native :beta
|
45
|
+
alias_native :gamma
|
46
|
+
end
|
47
|
+
|
48
|
+
end; end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
class DeviceProximity < Event
|
4
|
+
def self.supported?
|
5
|
+
Browser.supports? 'Event.DeviceProximity'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Definition < Definition
|
9
|
+
def value=(value)
|
10
|
+
`#@native.value = #{value}`
|
11
|
+
end
|
12
|
+
|
13
|
+
def min=(value)
|
14
|
+
`#@native.min = #{value}`
|
15
|
+
end
|
16
|
+
|
17
|
+
def max=(value)
|
18
|
+
`#@native.max = #{value}`
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if Browser.supports? 'Event.constructor'
|
23
|
+
def self.construct(name, desc)
|
24
|
+
`new DeviceProximityEvent(#{name}, #{desc})`
|
25
|
+
end
|
26
|
+
end if supported?
|
27
|
+
|
28
|
+
alias_native :value
|
29
|
+
alias_native :min
|
30
|
+
alias_native :max
|
31
|
+
end
|
32
|
+
|
33
|
+
end; end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
module Browser; class Event
|
2
|
+
|
3
|
+
# TODO: handle transfers
|
4
|
+
class Drag < Event
|
5
|
+
def self.supported?
|
6
|
+
Browser.supports? 'Event.Drag'
|
7
|
+
end
|
8
|
+
|
9
|
+
class Definition < Definition
|
10
|
+
class Client
|
11
|
+
include Native
|
12
|
+
|
13
|
+
def x=(value)
|
14
|
+
`#@native.clientX = #{value}`
|
15
|
+
end
|
16
|
+
|
17
|
+
def y=(value)
|
18
|
+
`#@native.clientY = #{value}`
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Screen
|
23
|
+
include Native
|
24
|
+
|
25
|
+
def x=(value)
|
26
|
+
`#@native.screenX = #{value}`
|
27
|
+
end
|
28
|
+
|
29
|
+
def y=(value)
|
30
|
+
`#@native.screenY = #{value}`
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def alt!
|
35
|
+
`#@native.altKey = true`
|
36
|
+
end
|
37
|
+
|
38
|
+
def ctrl!
|
39
|
+
`#@native.ctrlKey = true`
|
40
|
+
end
|
41
|
+
|
42
|
+
def meta!
|
43
|
+
`#@native.metaKey = true`
|
44
|
+
end
|
45
|
+
|
46
|
+
def button=(value)
|
47
|
+
`#@native.button = #{value}`
|
48
|
+
end
|
49
|
+
|
50
|
+
def client
|
51
|
+
Client.new(@native)
|
52
|
+
end
|
53
|
+
|
54
|
+
def screen
|
55
|
+
Screen.new(@native)
|
56
|
+
end
|
57
|
+
|
58
|
+
def related=(elem)
|
59
|
+
`#@native.relatedTarget = #{Native.convert(elem)}`
|
60
|
+
end
|
61
|
+
|
62
|
+
def transfer=(value)
|
63
|
+
`#@native.dataTransfer = #{Native.convert(elem)}`
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
if Browser.supports? 'Event.constructor'
|
68
|
+
def self.construct(name, desc)
|
69
|
+
`new DragEvent(#{name}, #{desc})`
|
70
|
+
end
|
71
|
+
elsif Browser.supports? 'Event.create'
|
72
|
+
def self.construct(name, desc)
|
73
|
+
%x{
|
74
|
+
var event = document.createEvent("DragEvent");
|
75
|
+
event.initDragEvent(name, desc.bubbles, desc.cancelable,
|
76
|
+
desc.view || window, 0,
|
77
|
+
desc.screenX || 0, desc.screenY || 0,
|
78
|
+
desc.clientX || 0, desc.clientY || 0,
|
79
|
+
desc.ctrlKey, desc.altKey, desc.shiftKey, desc.metaKey,
|
80
|
+
desc.button || 0, desc.relatedTarget, desc.dataTransfer);
|
81
|
+
|
82
|
+
return event;
|
83
|
+
}
|
84
|
+
end
|
85
|
+
end if supported?
|
86
|
+
|
87
|
+
alias_native :alt?, :altKey
|
88
|
+
alias_native :ctrl?, :ctrlKey
|
89
|
+
alias_native :meta?, :metaKey
|
90
|
+
alias_native :shift?, :shiftKey
|
91
|
+
alias_native :button
|
92
|
+
|
93
|
+
def client
|
94
|
+
Position.new(`#@native.clientX`, `#@native.clientY`)
|
95
|
+
end
|
96
|
+
|
97
|
+
def screen
|
98
|
+
Position.new(`#@native.screenX`, `#@native.screenY`) if defined?(`#@native.screenX`)
|
99
|
+
end
|
100
|
+
|
101
|
+
def x
|
102
|
+
screen.x
|
103
|
+
end
|
104
|
+
|
105
|
+
def y
|
106
|
+
screen.y
|
107
|
+
end
|
108
|
+
|
109
|
+
def related
|
110
|
+
DOM(`#@native.relatedTarget`)
|
111
|
+
end
|
112
|
+
|
113
|
+
# @see https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer
|
114
|
+
def transfer
|
115
|
+
raise NotImplementedError
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end; end
|