highstocks-rails 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +4 -0
- data/Changelog.md +13 -0
- data/Rakefile +4 -0
- data/{README.markdown → Readme.md} +27 -10
- data/highstocks-rails.gemspec +5 -4
- data/lib/highstocks/version.rb +1 -1
- metadata +19 -16
- data/CHANGELOG.markdown +0 -4
- data/app/assets/javascripts/highstocks/adapters/mootools-adapter.src.js +0 -316
- data/app/assets/javascripts/highstocks/adapters/prototype-adapter.src.js +0 -316
- data/app/assets/javascripts/highstocks/adapters/standalone-framework.src.js +0 -583
- data/app/assets/javascripts/highstocks/modules/annotations.src.js +0 -401
- data/app/assets/javascripts/highstocks/modules/canvas-tools.src.js +0 -3113
- data/app/assets/javascripts/highstocks/modules/data.src.js +0 -582
- data/app/assets/javascripts/highstocks/modules/drilldown.src.js +0 -449
- data/app/assets/javascripts/highstocks/modules/exporting.src.js +0 -709
- data/app/assets/javascripts/highstocks/modules/funnel.src.js +0 -289
- data/app/assets/javascripts/highstocks/modules/heatmap.src.js +0 -54
- data/app/assets/javascripts/highstocks/modules/map.src.js +0 -1273
- data/app/assets/javascripts/highstocks/modules/no-data-to-display.src.js +0 -128
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmU1YWY0MTlmYjUxOGYzNmQxZTFjZjk0YjM1MTUyZTU2MDE5ZmVhNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDNlMmZjMTFhYjNkNDY3YzY5OTljNTNkYTA4ZDdhMmEzZDljZjM3Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTc2ZGU1M2VjZWQ1ZGI0NjFiOGFiOGYyNDU3ODNkOGFlNzYwZTE1OTNhMmU1
|
10
|
+
OTU5NjQ3NjJlYjcwYjUyMWUyNDU0MTQzNDJmNjU5MDM3YWI3NzQzMWEwZGU5
|
11
|
+
MmY3YmE5YmM0NjYxYzMzOGRiYjk0YWYzNDJkZDViMDc4M2E3NzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Yzc3YjI2ZmJlMWNkNmYxYzE1NDBiNDM0MjEzYWNhZGIxMWI5OTg1MjM5MTkx
|
14
|
+
OTE1NzIxNTc0YmY5MWM0YmNmZWMyZDQyYTNkOTI4MjJhMjA1YmNmODEyODkz
|
15
|
+
NjE4ZGI1NjZhNWE5Y2VhNDMwOThmMTdmZjM1YjVhZDY2MTg1Y2U=
|
data/.travis.yml
ADDED
data/Changelog.md
ADDED
data/Rakefile
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
[![Gem Version](https://badge.fury.io/rb/highstocks-rails.png)](http://badge.fury.io/rb/highstocks-rails)
|
2
|
-
|
3
|
-
[![Dependency Status](https://gemnasium.com/ankit8898/highstocks-rails.png)](https://gemnasium.com/ankit8898/highstocks-rails)
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/highstocks-rails.png)](http://badge.fury.io/rb/highstocks-rails) [![Dependency Status](https://gemnasium.com/ankit8898/highstocks-rails.png)](https://gemnasium.com/ankit8898/highstocks-rails) [![Build Status](https://travis-ci.org/ankit8898/highstocks-rails.png?branch=master)](https://travis-ci.org/ankit8898/highstocks-rails)
|
4
2
|
|
5
3
|
# Highstocks-Rails
|
6
4
|
|
@@ -12,34 +10,53 @@ The gem currently uses **Highstock 1.3.7**
|
|
12
10
|
|
13
11
|
Highstock lets you create stock or general timeline charts in pure JavaScript, including sophisticated navigation options like a small navigator series, preset date ranges, date picker, scrolling and panning.
|
14
12
|
|
15
|
-
|
13
|
+
Highstock is not free for commercial use, so make sure you have a [valid license](http://shop.highsoft.com/highstock.html) to use Highstocks.
|
16
14
|
|
17
15
|
## Will including this gem also give Higcharts features?
|
18
16
|
|
19
|
-
The answer is here [in this link](http://www.highcharts.com/errors/16),all features of Highcharts are included in Highstock.
|
17
|
+
The answer is here [in this link](http://www.highcharts.com/errors/16): Yes, all features of Highcharts are included in Highstock.
|
20
18
|
|
21
19
|
Here is a [Sample Application](http://hidden-peak-3935.herokuapp.com) showing the usage and also plotting both highstocks and highcharts. :thumbsup:
|
22
20
|
|
23
21
|
## Installation
|
24
22
|
|
25
|
-
Add the gem to the Gemfile
|
23
|
+
Add the gem to the Gemfile:
|
26
24
|
|
27
25
|
gem "highstocks-rails"
|
28
26
|
|
29
27
|
## Usage
|
30
28
|
|
31
|
-
In your JavaScript manifest (e.g. `application.js`)
|
29
|
+
In your JavaScript manifest (e.g. `application.js`):
|
32
30
|
|
33
31
|
//= require highstocks-rails
|
34
32
|
|
35
|
-
|
36
|
-
|
33
|
+
|
34
|
+
To include one of the other adapters:
|
35
|
+
|
36
|
+
//= require highstocks/adapters/mootools-adapter
|
37
|
+
//= require highstocks/adapters/prototype-adapter
|
38
|
+
//= require highstocks/adapters/standalone-framework
|
39
|
+
|
40
|
+
To include one of the other modules:
|
41
|
+
|
42
|
+
//= require highstocks/modules/annotations
|
43
|
+
//= require highstocks/modules/canvas-tools
|
44
|
+
//= require highstocks/modules/data
|
45
|
+
//= require highstocks/modules/drilldown
|
46
|
+
//= require highstocks/modules/exporting
|
47
|
+
//= require highstocks/modules/funnel
|
48
|
+
//= require highstocks/modules/heatmap
|
49
|
+
//= require highstocks/modules/no-data-to-display
|
50
|
+
|
51
|
+
To include one of the other themes:
|
52
|
+
|
37
53
|
//= require highstocks/themes/dark-blue
|
38
54
|
//= require highstocks/themes/dark-green
|
39
55
|
//= require highstocks/themes/gray
|
40
56
|
//= require highstocks/themes/grid
|
41
57
|
//= require highstocks/themes/skies
|
42
58
|
|
59
|
+
|
43
60
|
### Supports both highstocks and highcharts :neckbeard:
|
44
61
|
|
45
62
|
![alt txt](https://raw.github.com/ankit8898/hs-rails/master/app/assets/images/ss1.jpg)
|
@@ -49,7 +66,7 @@ for other themes
|
|
49
66
|
|
50
67
|
## Licensing
|
51
68
|
|
52
|
-
|
69
|
+
Highstocks, has [its own, separate licensing](http://shop.highsoft.com/highstock.html).
|
53
70
|
|
54
71
|
The gem itself is released under the MIT license
|
55
72
|
|
data/highstocks-rails.gemspec
CHANGED
@@ -6,19 +6,20 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.name = "highstocks-rails"
|
7
7
|
s.version = HighStocks::VERSION
|
8
8
|
s.authors = ["Ankit Gupta"]
|
9
|
-
s.date = '2013-11-
|
9
|
+
s.date = '2013-11-09'
|
10
10
|
s.email = ["ankit.gupta8898@gmail.com"]
|
11
11
|
s.summary = %q{Gem for easily adding Highstocks to the Rails Asset Pipeline}
|
12
12
|
s.description = %q{Gem that includes Highstocks (Interactive library to create stock or general timeline charts in pure JavaScript and including sophisticated navigation options), in the Rails Asset Pipeline introduced in Rails 3.1. Also have all the highcharts features with it.}
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
-
|
16
|
+
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.licenses = ['MIT']
|
19
|
-
s.homepage =
|
20
|
-
'https://github.com/ankit8898/highstocks-rails'
|
19
|
+
s.homepage = 'https://github.com/ankit8898/highstocks-rails'
|
21
20
|
s.add_dependency "railties", ">= 3.1"
|
22
21
|
s.add_development_dependency "bundler", "~> 1.0"
|
23
22
|
s.add_development_dependency "rails", ">= 3.1"
|
23
|
+
s.add_development_dependency 'rake'
|
24
|
+
|
24
25
|
end
|
data/lib/highstocks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: highstocks-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ankit Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Gem that includes Highstocks (Interactive library to create stock or
|
56
70
|
general timeline charts in pure JavaScript and including sophisticated navigation
|
57
71
|
options), in the Rails Asset Pipeline introduced in Rails 3.1. Also have all the
|
@@ -63,10 +77,11 @@ extensions: []
|
|
63
77
|
extra_rdoc_files: []
|
64
78
|
files:
|
65
79
|
- .gitignore
|
66
|
-
-
|
80
|
+
- .travis.yml
|
81
|
+
- Changelog.md
|
67
82
|
- Gemfile
|
68
|
-
- README.markdown
|
69
83
|
- Rakefile
|
84
|
+
- Readme.md
|
70
85
|
- app/assets/graphics/skies.jpg
|
71
86
|
- app/assets/graphics/snow.png
|
72
87
|
- app/assets/graphics/sun.png
|
@@ -75,30 +90,18 @@ files:
|
|
75
90
|
- app/assets/images/highstocks/sun.png
|
76
91
|
- app/assets/javascripts/highstocks.js
|
77
92
|
- app/assets/javascripts/highstocks/adapters/mootools-adapter.js
|
78
|
-
- app/assets/javascripts/highstocks/adapters/mootools-adapter.src.js
|
79
93
|
- app/assets/javascripts/highstocks/adapters/prototype-adapter.js
|
80
|
-
- app/assets/javascripts/highstocks/adapters/prototype-adapter.src.js
|
81
94
|
- app/assets/javascripts/highstocks/adapters/standalone-framework.js
|
82
|
-
- app/assets/javascripts/highstocks/adapters/standalone-framework.src.js
|
83
95
|
- app/assets/javascripts/highstocks/highstocks-more.js
|
84
96
|
- app/assets/javascripts/highstocks/modules/annotations.js
|
85
|
-
- app/assets/javascripts/highstocks/modules/annotations.src.js
|
86
97
|
- app/assets/javascripts/highstocks/modules/canvas-tools.js
|
87
|
-
- app/assets/javascripts/highstocks/modules/canvas-tools.src.js
|
88
98
|
- app/assets/javascripts/highstocks/modules/data.js
|
89
|
-
- app/assets/javascripts/highstocks/modules/data.src.js
|
90
99
|
- app/assets/javascripts/highstocks/modules/drilldown.js
|
91
|
-
- app/assets/javascripts/highstocks/modules/drilldown.src.js
|
92
100
|
- app/assets/javascripts/highstocks/modules/exporting.js
|
93
|
-
- app/assets/javascripts/highstocks/modules/exporting.src.js
|
94
101
|
- app/assets/javascripts/highstocks/modules/funnel.js
|
95
|
-
- app/assets/javascripts/highstocks/modules/funnel.src.js
|
96
102
|
- app/assets/javascripts/highstocks/modules/heatmap.js
|
97
|
-
- app/assets/javascripts/highstocks/modules/heatmap.src.js
|
98
103
|
- app/assets/javascripts/highstocks/modules/map.js
|
99
|
-
- app/assets/javascripts/highstocks/modules/map.src.js
|
100
104
|
- app/assets/javascripts/highstocks/modules/no-data-to-display.js
|
101
|
-
- app/assets/javascripts/highstocks/modules/no-data-to-display.src.js
|
102
105
|
- app/assets/javascripts/highstocks/themes/dark-blue.js
|
103
106
|
- app/assets/javascripts/highstocks/themes/dark-green.js
|
104
107
|
- app/assets/javascripts/highstocks/themes/gray.js
|
data/CHANGELOG.markdown
DELETED
@@ -1,316 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Highstock JS v1.3.7 (2013-10-24)
|
3
|
-
* MooTools adapter
|
4
|
-
*
|
5
|
-
* (c) 2010-2013 Torstein Hønsi
|
6
|
-
*
|
7
|
-
* License: www.highcharts.com/license
|
8
|
-
*/
|
9
|
-
|
10
|
-
// JSLint options:
|
11
|
-
/*global Fx, $, $extend, $each, $merge, Events, Event, DOMEvent */
|
12
|
-
|
13
|
-
(function () {
|
14
|
-
|
15
|
-
var win = window,
|
16
|
-
doc = document,
|
17
|
-
mooVersion = win.MooTools.version.substring(0, 3), // Get the first three characters of the version number
|
18
|
-
legacy = mooVersion === '1.2' || mooVersion === '1.1', // 1.1 && 1.2 considered legacy, 1.3 is not.
|
19
|
-
legacyEvent = legacy || mooVersion === '1.3', // In versions 1.1 - 1.3 the event class is named Event, in newer versions it is named DOMEvent.
|
20
|
-
$extend = win.$extend || function () {
|
21
|
-
return Object.append.apply(Object, arguments);
|
22
|
-
};
|
23
|
-
|
24
|
-
win.HighchartsAdapter = {
|
25
|
-
/**
|
26
|
-
* Initialize the adapter. This is run once as Highcharts is first run.
|
27
|
-
* @param {Object} pathAnim The helper object to do animations across adapters.
|
28
|
-
*/
|
29
|
-
init: function (pathAnim) {
|
30
|
-
var fxProto = Fx.prototype,
|
31
|
-
fxStart = fxProto.start,
|
32
|
-
morphProto = Fx.Morph.prototype,
|
33
|
-
morphCompute = morphProto.compute;
|
34
|
-
|
35
|
-
// override Fx.start to allow animation of SVG element wrappers
|
36
|
-
/*jslint unparam: true*//* allow unused parameters in fx functions */
|
37
|
-
fxProto.start = function (from, to) {
|
38
|
-
var fx = this,
|
39
|
-
elem = fx.element;
|
40
|
-
|
41
|
-
// special for animating paths
|
42
|
-
if (from.d) {
|
43
|
-
//this.fromD = this.element.d.split(' ');
|
44
|
-
fx.paths = pathAnim.init(
|
45
|
-
elem,
|
46
|
-
elem.d,
|
47
|
-
fx.toD
|
48
|
-
);
|
49
|
-
}
|
50
|
-
fxStart.apply(fx, arguments);
|
51
|
-
|
52
|
-
return this; // chainable
|
53
|
-
};
|
54
|
-
|
55
|
-
// override Fx.step to allow animation of SVG element wrappers
|
56
|
-
morphProto.compute = function (from, to, delta) {
|
57
|
-
var fx = this,
|
58
|
-
paths = fx.paths;
|
59
|
-
|
60
|
-
if (paths) {
|
61
|
-
fx.element.attr(
|
62
|
-
'd',
|
63
|
-
pathAnim.step(paths[0], paths[1], delta, fx.toD)
|
64
|
-
);
|
65
|
-
} else {
|
66
|
-
return morphCompute.apply(fx, arguments);
|
67
|
-
}
|
68
|
-
};
|
69
|
-
/*jslint unparam: false*/
|
70
|
-
},
|
71
|
-
|
72
|
-
/**
|
73
|
-
* Run a general method on the framework, following jQuery syntax
|
74
|
-
* @param {Object} el The HTML element
|
75
|
-
* @param {String} method Which method to run on the wrapped element
|
76
|
-
*/
|
77
|
-
adapterRun: function (el, method) {
|
78
|
-
|
79
|
-
// This currently works for getting inner width and height. If adding
|
80
|
-
// more methods later, we need a conditional implementation for each.
|
81
|
-
if (method === 'width' || method === 'height') {
|
82
|
-
return parseInt(document.id(el).getStyle(method), 10);
|
83
|
-
}
|
84
|
-
},
|
85
|
-
|
86
|
-
/**
|
87
|
-
* Downloads a script and executes a callback when done.
|
88
|
-
* @param {String} scriptLocation
|
89
|
-
* @param {Function} callback
|
90
|
-
*/
|
91
|
-
getScript: function (scriptLocation, callback) {
|
92
|
-
// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
|
93
|
-
var head = doc.getElementsByTagName('head')[0];
|
94
|
-
var script = doc.createElement('script');
|
95
|
-
|
96
|
-
script.type = 'text/javascript';
|
97
|
-
script.src = scriptLocation;
|
98
|
-
script.onload = callback;
|
99
|
-
|
100
|
-
head.appendChild(script);
|
101
|
-
},
|
102
|
-
|
103
|
-
/**
|
104
|
-
* Animate a HTML element or SVG element wrapper
|
105
|
-
* @param {Object} el
|
106
|
-
* @param {Object} params
|
107
|
-
* @param {Object} options jQuery-like animation options: duration, easing, callback
|
108
|
-
*/
|
109
|
-
animate: function (el, params, options) {
|
110
|
-
var isSVGElement = el.attr,
|
111
|
-
effect,
|
112
|
-
complete = options && options.complete;
|
113
|
-
|
114
|
-
if (isSVGElement && !el.setStyle) {
|
115
|
-
// add setStyle and getStyle methods for internal use in Moo
|
116
|
-
el.getStyle = el.attr;
|
117
|
-
el.setStyle = function () { // property value is given as array in Moo - break it down
|
118
|
-
var args = arguments;
|
119
|
-
this.attr.call(this, args[0], args[1][0]);
|
120
|
-
};
|
121
|
-
// dirty hack to trick Moo into handling el as an element wrapper
|
122
|
-
el.$family = function () { return true; };
|
123
|
-
el.getComputedStyle = function () {
|
124
|
-
return el.element.getComputedStyle.apply(el.element, arguments);
|
125
|
-
};
|
126
|
-
}
|
127
|
-
|
128
|
-
// stop running animations
|
129
|
-
win.HighchartsAdapter.stop(el);
|
130
|
-
|
131
|
-
// define and run the effect
|
132
|
-
effect = new Fx.Morph(
|
133
|
-
isSVGElement ? el : document.id(el),
|
134
|
-
$extend({
|
135
|
-
transition: Fx.Transitions.Quad.easeInOut
|
136
|
-
}, options)
|
137
|
-
);
|
138
|
-
|
139
|
-
// Make sure that the element reference is set when animating svg elements
|
140
|
-
if (isSVGElement) {
|
141
|
-
effect.element = el;
|
142
|
-
}
|
143
|
-
|
144
|
-
// special treatment for paths
|
145
|
-
if (params.d) {
|
146
|
-
effect.toD = params.d;
|
147
|
-
}
|
148
|
-
|
149
|
-
// jQuery-like events
|
150
|
-
if (complete) {
|
151
|
-
effect.addEvent('complete', complete);
|
152
|
-
}
|
153
|
-
|
154
|
-
// run
|
155
|
-
effect.start(params);
|
156
|
-
|
157
|
-
// record for use in stop method
|
158
|
-
el.fx = effect;
|
159
|
-
},
|
160
|
-
|
161
|
-
/**
|
162
|
-
* MooTool's each function
|
163
|
-
*
|
164
|
-
*/
|
165
|
-
each: function (arr, fn) {
|
166
|
-
return legacy ?
|
167
|
-
$each(arr, fn) :
|
168
|
-
Array.each(arr, fn);
|
169
|
-
},
|
170
|
-
|
171
|
-
/**
|
172
|
-
* Map an array
|
173
|
-
* @param {Array} arr
|
174
|
-
* @param {Function} fn
|
175
|
-
*/
|
176
|
-
map: function (arr, fn) {
|
177
|
-
return arr.map(fn);
|
178
|
-
},
|
179
|
-
|
180
|
-
/**
|
181
|
-
* Grep or filter an array
|
182
|
-
* @param {Array} arr
|
183
|
-
* @param {Function} fn
|
184
|
-
*/
|
185
|
-
grep: function (arr, fn) {
|
186
|
-
return arr.filter(fn);
|
187
|
-
},
|
188
|
-
|
189
|
-
/**
|
190
|
-
* Return the index of an item in an array, or -1 if not matched
|
191
|
-
*/
|
192
|
-
inArray: function (item, arr, from) {
|
193
|
-
return arr ? arr.indexOf(item, from) : -1;
|
194
|
-
},
|
195
|
-
|
196
|
-
/**
|
197
|
-
* Get the offset of an element relative to the top left corner of the web page
|
198
|
-
*/
|
199
|
-
offset: function (el) {
|
200
|
-
var offsets = el.getPosition(); // #1496
|
201
|
-
return {
|
202
|
-
left: offsets.x,
|
203
|
-
top: offsets.y
|
204
|
-
};
|
205
|
-
},
|
206
|
-
|
207
|
-
/**
|
208
|
-
* Extends an object with Events, if its not done
|
209
|
-
*/
|
210
|
-
extendWithEvents: function (el) {
|
211
|
-
// if the addEvent method is not defined, el is a custom Highcharts object
|
212
|
-
// like series or point
|
213
|
-
if (!el.addEvent) {
|
214
|
-
if (el.nodeName) {
|
215
|
-
el = document.id(el); // a dynamically generated node
|
216
|
-
} else {
|
217
|
-
$extend(el, new Events()); // a custom object
|
218
|
-
}
|
219
|
-
}
|
220
|
-
},
|
221
|
-
|
222
|
-
/**
|
223
|
-
* Add an event listener
|
224
|
-
* @param {Object} el HTML element or custom object
|
225
|
-
* @param {String} type Event type
|
226
|
-
* @param {Function} fn Event handler
|
227
|
-
*/
|
228
|
-
addEvent: function (el, type, fn) {
|
229
|
-
if (typeof type === 'string') { // chart broke due to el being string, type function
|
230
|
-
|
231
|
-
if (type === 'unload') { // Moo self destructs before custom unload events
|
232
|
-
type = 'beforeunload';
|
233
|
-
}
|
234
|
-
|
235
|
-
win.HighchartsAdapter.extendWithEvents(el);
|
236
|
-
|
237
|
-
el.addEvent(type, fn);
|
238
|
-
}
|
239
|
-
},
|
240
|
-
|
241
|
-
removeEvent: function (el, type, fn) {
|
242
|
-
if (typeof el === 'string') {
|
243
|
-
// el.removeEvents below apperantly calls this method again. Do not quite understand why, so for now just bail out.
|
244
|
-
return;
|
245
|
-
}
|
246
|
-
|
247
|
-
if (el.addEvent) { // If el doesn't have an addEvent method, there are no events to remove
|
248
|
-
if (type) {
|
249
|
-
if (type === 'unload') { // Moo self destructs before custom unload events
|
250
|
-
type = 'beforeunload';
|
251
|
-
}
|
252
|
-
|
253
|
-
if (fn) {
|
254
|
-
el.removeEvent(type, fn);
|
255
|
-
} else if (el.removeEvents) { // #958
|
256
|
-
el.removeEvents(type);
|
257
|
-
}
|
258
|
-
} else {
|
259
|
-
el.removeEvents();
|
260
|
-
}
|
261
|
-
}
|
262
|
-
},
|
263
|
-
|
264
|
-
fireEvent: function (el, event, eventArguments, defaultFunction) {
|
265
|
-
var eventArgs = {
|
266
|
-
type: event,
|
267
|
-
target: el
|
268
|
-
};
|
269
|
-
// create an event object that keeps all functions
|
270
|
-
event = legacyEvent ? new Event(eventArgs) : new DOMEvent(eventArgs);
|
271
|
-
event = $extend(event, eventArguments);
|
272
|
-
|
273
|
-
// When running an event on the Chart.prototype, MooTools nests the target in event.event
|
274
|
-
if (!event.target && event.event) {
|
275
|
-
event.target = event.event.target;
|
276
|
-
}
|
277
|
-
|
278
|
-
// override the preventDefault function to be able to use
|
279
|
-
// this for custom events
|
280
|
-
event.preventDefault = function () {
|
281
|
-
defaultFunction = null;
|
282
|
-
};
|
283
|
-
// if fireEvent is not available on the object, there hasn't been added
|
284
|
-
// any events to it above
|
285
|
-
if (el.fireEvent) {
|
286
|
-
el.fireEvent(event.type, event);
|
287
|
-
}
|
288
|
-
|
289
|
-
// fire the default if it is passed and it is not prevented above
|
290
|
-
if (defaultFunction) {
|
291
|
-
defaultFunction(event);
|
292
|
-
}
|
293
|
-
},
|
294
|
-
|
295
|
-
/**
|
296
|
-
* Set back e.pageX and e.pageY that MooTools has abstracted away. #1165, #1346.
|
297
|
-
*/
|
298
|
-
washMouseEvent: function (e) {
|
299
|
-
if (e.page) {
|
300
|
-
e.pageX = e.page.x;
|
301
|
-
e.pageY = e.page.y;
|
302
|
-
}
|
303
|
-
return e;
|
304
|
-
},
|
305
|
-
|
306
|
-
/**
|
307
|
-
* Stop running animations on the object
|
308
|
-
*/
|
309
|
-
stop: function (el) {
|
310
|
-
if (el.fx) {
|
311
|
-
el.fx.cancel();
|
312
|
-
}
|
313
|
-
}
|
314
|
-
};
|
315
|
-
|
316
|
-
}());
|