Initial commit
This commit is contained in:
13
public/UEditor/third-party/highcharts/adapters/mootools-adapter.js
vendored
Normal file
13
public/UEditor/third-party/highcharts/adapters/mootools-adapter.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
Highcharts JS v3.0.6 (2013-10-04)
|
||||
MooTools adapter
|
||||
|
||||
(c) 2010-2013 Torstein Hønsi
|
||||
|
||||
License: www.highcharts.com/license
|
||||
*/
|
||||
(function(){var e=window,h=document,f=e.MooTools.version.substring(0,3),i=f==="1.2"||f==="1.1",j=i||f==="1.3",g=e.$extend||function(){return Object.append.apply(Object,arguments)};e.HighchartsAdapter={init:function(a){var b=Fx.prototype,c=b.start,d=Fx.Morph.prototype,e=d.compute;b.start=function(b,d){var e=this.element;if(b.d)this.paths=a.init(e,e.d,this.toD);c.apply(this,arguments);return this};d.compute=function(b,c,d){var f=this.paths;if(f)this.element.attr("d",a.step(f[0],f[1],d,this.toD));else return e.apply(this,
|
||||
arguments)}},adapterRun:function(a,b){if(b==="width"||b==="height")return parseInt($(a).getStyle(b),10)},getScript:function(a,b){var c=h.getElementsByTagName("head")[0],d=h.createElement("script");d.type="text/javascript";d.src=a;d.onload=b;c.appendChild(d)},animate:function(a,b,c){var d=a.attr,f=c&&c.complete;if(d&&!a.setStyle)a.getStyle=a.attr,a.setStyle=function(){var a=arguments;this.attr.call(this,a[0],a[1][0])},a.$family=function(){return!0};e.HighchartsAdapter.stop(a);c=new Fx.Morph(d?a:$(a),
|
||||
g({transition:Fx.Transitions.Quad.easeInOut},c));if(d)c.element=a;if(b.d)c.toD=b.d;f&&c.addEvent("complete",f);c.start(b);a.fx=c},each:function(a,b){return i?$each(a,b):Array.each(a,b)},map:function(a,b){return a.map(b)},grep:function(a,b){return a.filter(b)},inArray:function(a,b,c){return b?b.indexOf(a,c):-1},offset:function(a){a=a.getPosition();return{left:a.x,top:a.y}},extendWithEvents:function(a){a.addEvent||(a.nodeName?$(a):g(a,new Events))},addEvent:function(a,b,c){typeof b==="string"&&(b===
|
||||
"unload"&&(b="beforeunload"),e.HighchartsAdapter.extendWithEvents(a),a.addEvent(b,c))},removeEvent:function(a,b,c){typeof a!=="string"&&a.addEvent&&(b?(b==="unload"&&(b="beforeunload"),c?a.removeEvent(b,c):a.removeEvents&&a.removeEvents(b)):a.removeEvents())},fireEvent:function(a,b,c,d){b={type:b,target:a};b=j?new Event(b):new DOMEvent(b);b=g(b,c);if(!b.target&&b.event)b.target=b.event.target;b.preventDefault=function(){d=null};a.fireEvent&&a.fireEvent(b.type,b);d&&d(b)},washMouseEvent:function(a){if(a.page)a.pageX=
|
||||
a.page.x,a.pageY=a.page.y;return a},stop:function(a){a.fx&&a.fx.cancel()}}})();
|
313
public/UEditor/third-party/highcharts/adapters/mootools-adapter.src.js
vendored
Normal file
313
public/UEditor/third-party/highcharts/adapters/mootools-adapter.src.js
vendored
Normal file
@ -0,0 +1,313 @@
|
||||
/**
|
||||
* @license Highcharts JS v3.0.6 (2013-10-04)
|
||||
* MooTools adapter
|
||||
*
|
||||
* (c) 2010-2013 Torstein Hønsi
|
||||
*
|
||||
* License: www.highcharts.com/license
|
||||
*/
|
||||
|
||||
// JSLint options:
|
||||
/*global Fx, $, $extend, $each, $merge, Events, Event, DOMEvent */
|
||||
|
||||
(function () {
|
||||
|
||||
var win = window,
|
||||
doc = document,
|
||||
mooVersion = win.MooTools.version.substring(0, 3), // Get the first three characters of the version number
|
||||
legacy = mooVersion === '1.2' || mooVersion === '1.1', // 1.1 && 1.2 considered legacy, 1.3 is not.
|
||||
legacyEvent = legacy || mooVersion === '1.3', // In versions 1.1 - 1.3 the event class is named Event, in newer versions it is named DOMEvent.
|
||||
$extend = win.$extend || function () {
|
||||
return Object.append.apply(Object, arguments);
|
||||
};
|
||||
|
||||
win.HighchartsAdapter = {
|
||||
/**
|
||||
* Initialize the adapter. This is run once as Highcharts is first run.
|
||||
* @param {Object} pathAnim The helper object to do animations across adapters.
|
||||
*/
|
||||
init: function (pathAnim) {
|
||||
var fxProto = Fx.prototype,
|
||||
fxStart = fxProto.start,
|
||||
morphProto = Fx.Morph.prototype,
|
||||
morphCompute = morphProto.compute;
|
||||
|
||||
// override Fx.start to allow animation of SVG element wrappers
|
||||
/*jslint unparam: true*//* allow unused parameters in fx functions */
|
||||
fxProto.start = function (from, to) {
|
||||
var fx = this,
|
||||
elem = fx.element;
|
||||
|
||||
// special for animating paths
|
||||
if (from.d) {
|
||||
//this.fromD = this.element.d.split(' ');
|
||||
fx.paths = pathAnim.init(
|
||||
elem,
|
||||
elem.d,
|
||||
fx.toD
|
||||
);
|
||||
}
|
||||
fxStart.apply(fx, arguments);
|
||||
|
||||
return this; // chainable
|
||||
};
|
||||
|
||||
// override Fx.step to allow animation of SVG element wrappers
|
||||
morphProto.compute = function (from, to, delta) {
|
||||
var fx = this,
|
||||
paths = fx.paths;
|
||||
|
||||
if (paths) {
|
||||
fx.element.attr(
|
||||
'd',
|
||||
pathAnim.step(paths[0], paths[1], delta, fx.toD)
|
||||
);
|
||||
} else {
|
||||
return morphCompute.apply(fx, arguments);
|
||||
}
|
||||
};
|
||||
/*jslint unparam: false*/
|
||||
},
|
||||
|
||||
/**
|
||||
* Run a general method on the framework, following jQuery syntax
|
||||
* @param {Object} el The HTML element
|
||||
* @param {String} method Which method to run on the wrapped element
|
||||
*/
|
||||
adapterRun: function (el, method) {
|
||||
|
||||
// This currently works for getting inner width and height. If adding
|
||||
// more methods later, we need a conditional implementation for each.
|
||||
if (method === 'width' || method === 'height') {
|
||||
return parseInt($(el).getStyle(method), 10);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Downloads a script and executes a callback when done.
|
||||
* @param {String} scriptLocation
|
||||
* @param {Function} callback
|
||||
*/
|
||||
getScript: function (scriptLocation, callback) {
|
||||
// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
|
||||
var head = doc.getElementsByTagName('head')[0];
|
||||
var script = doc.createElement('script');
|
||||
|
||||
script.type = 'text/javascript';
|
||||
script.src = scriptLocation;
|
||||
script.onload = callback;
|
||||
|
||||
head.appendChild(script);
|
||||
},
|
||||
|
||||
/**
|
||||
* Animate a HTML element or SVG element wrapper
|
||||
* @param {Object} el
|
||||
* @param {Object} params
|
||||
* @param {Object} options jQuery-like animation options: duration, easing, callback
|
||||
*/
|
||||
animate: function (el, params, options) {
|
||||
var isSVGElement = el.attr,
|
||||
effect,
|
||||
complete = options && options.complete;
|
||||
|
||||
if (isSVGElement && !el.setStyle) {
|
||||
// add setStyle and getStyle methods for internal use in Moo
|
||||
el.getStyle = el.attr;
|
||||
el.setStyle = function () { // property value is given as array in Moo - break it down
|
||||
var args = arguments;
|
||||
this.attr.call(this, args[0], args[1][0]);
|
||||
};
|
||||
// dirty hack to trick Moo into handling el as an element wrapper
|
||||
el.$family = function () { return true; };
|
||||
}
|
||||
|
||||
// stop running animations
|
||||
win.HighchartsAdapter.stop(el);
|
||||
|
||||
// define and run the effect
|
||||
effect = new Fx.Morph(
|
||||
isSVGElement ? el : $(el),
|
||||
$extend({
|
||||
transition: Fx.Transitions.Quad.easeInOut
|
||||
}, options)
|
||||
);
|
||||
|
||||
// Make sure that the element reference is set when animating svg elements
|
||||
if (isSVGElement) {
|
||||
effect.element = el;
|
||||
}
|
||||
|
||||
// special treatment for paths
|
||||
if (params.d) {
|
||||
effect.toD = params.d;
|
||||
}
|
||||
|
||||
// jQuery-like events
|
||||
if (complete) {
|
||||
effect.addEvent('complete', complete);
|
||||
}
|
||||
|
||||
// run
|
||||
effect.start(params);
|
||||
|
||||
// record for use in stop method
|
||||
el.fx = effect;
|
||||
},
|
||||
|
||||
/**
|
||||
* MooTool's each function
|
||||
*
|
||||
*/
|
||||
each: function (arr, fn) {
|
||||
return legacy ?
|
||||
$each(arr, fn) :
|
||||
Array.each(arr, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Map an array
|
||||
* @param {Array} arr
|
||||
* @param {Function} fn
|
||||
*/
|
||||
map: function (arr, fn) {
|
||||
return arr.map(fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Grep or filter an array
|
||||
* @param {Array} arr
|
||||
* @param {Function} fn
|
||||
*/
|
||||
grep: function (arr, fn) {
|
||||
return arr.filter(fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the index of an item in an array, or -1 if not matched
|
||||
*/
|
||||
inArray: function (item, arr, from) {
|
||||
return arr ? arr.indexOf(item, from) : -1;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the offset of an element relative to the top left corner of the web page
|
||||
*/
|
||||
offset: function (el) {
|
||||
var offsets = el.getPosition(); // #1496
|
||||
return {
|
||||
left: offsets.x,
|
||||
top: offsets.y
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Extends an object with Events, if its not done
|
||||
*/
|
||||
extendWithEvents: function (el) {
|
||||
// if the addEvent method is not defined, el is a custom Highcharts object
|
||||
// like series or point
|
||||
if (!el.addEvent) {
|
||||
if (el.nodeName) {
|
||||
el = $(el); // a dynamically generated node
|
||||
} else {
|
||||
$extend(el, new Events()); // a custom object
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Add an event listener
|
||||
* @param {Object} el HTML element or custom object
|
||||
* @param {String} type Event type
|
||||
* @param {Function} fn Event handler
|
||||
*/
|
||||
addEvent: function (el, type, fn) {
|
||||
if (typeof type === 'string') { // chart broke due to el being string, type function
|
||||
|
||||
if (type === 'unload') { // Moo self destructs before custom unload events
|
||||
type = 'beforeunload';
|
||||
}
|
||||
|
||||
win.HighchartsAdapter.extendWithEvents(el);
|
||||
|
||||
el.addEvent(type, fn);
|
||||
}
|
||||
},
|
||||
|
||||
removeEvent: function (el, type, fn) {
|
||||
if (typeof el === 'string') {
|
||||
// el.removeEvents below apperantly calls this method again. Do not quite understand why, so for now just bail out.
|
||||
return;
|
||||
}
|
||||
|
||||
if (el.addEvent) { // If el doesn't have an addEvent method, there are no events to remove
|
||||
if (type) {
|
||||
if (type === 'unload') { // Moo self destructs before custom unload events
|
||||
type = 'beforeunload';
|
||||
}
|
||||
|
||||
if (fn) {
|
||||
el.removeEvent(type, fn);
|
||||
} else if (el.removeEvents) { // #958
|
||||
el.removeEvents(type);
|
||||
}
|
||||
} else {
|
||||
el.removeEvents();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
fireEvent: function (el, event, eventArguments, defaultFunction) {
|
||||
var eventArgs = {
|
||||
type: event,
|
||||
target: el
|
||||
};
|
||||
// create an event object that keeps all functions
|
||||
event = legacyEvent ? new Event(eventArgs) : new DOMEvent(eventArgs);
|
||||
event = $extend(event, eventArguments);
|
||||
|
||||
// When running an event on the Chart.prototype, MooTools nests the target in event.event
|
||||
if (!event.target && event.event) {
|
||||
event.target = event.event.target;
|
||||
}
|
||||
|
||||
// override the preventDefault function to be able to use
|
||||
// this for custom events
|
||||
event.preventDefault = function () {
|
||||
defaultFunction = null;
|
||||
};
|
||||
// if fireEvent is not available on the object, there hasn't been added
|
||||
// any events to it above
|
||||
if (el.fireEvent) {
|
||||
el.fireEvent(event.type, event);
|
||||
}
|
||||
|
||||
// fire the default if it is passed and it is not prevented above
|
||||
if (defaultFunction) {
|
||||
defaultFunction(event);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set back e.pageX and e.pageY that MooTools has abstracted away. #1165, #1346.
|
||||
*/
|
||||
washMouseEvent: function (e) {
|
||||
if (e.page) {
|
||||
e.pageX = e.page.x;
|
||||
e.pageY = e.page.y;
|
||||
}
|
||||
return e;
|
||||
},
|
||||
|
||||
/**
|
||||
* Stop running animations on the object
|
||||
*/
|
||||
stop: function (el) {
|
||||
if (el.fx) {
|
||||
el.fx.cancel();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
15
public/UEditor/third-party/highcharts/adapters/prototype-adapter.js
vendored
Normal file
15
public/UEditor/third-party/highcharts/adapters/prototype-adapter.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Highcharts JS v3.0.6 (2013-10-04)
|
||||
Prototype adapter
|
||||
|
||||
@author Michael Nelson, Torstein Hønsi.
|
||||
|
||||
Feel free to use and modify this script.
|
||||
Highcharts license: www.highcharts.com/license.
|
||||
*/
|
||||
var HighchartsAdapter=function(){var f=typeof Effect!=="undefined";return{init:function(a){if(f)Effect.HighchartsTransition=Class.create(Effect.Base,{initialize:function(b,c,d,g){var e;this.element=b;this.key=c;e=b.attr?b.attr(c):$(b).getStyle(c);if(c==="d")this.paths=a.init(b,b.d,d),this.toD=d,e=0,d=1;this.start(Object.extend(g||{},{from:e,to:d,attribute:c}))},setup:function(){HighchartsAdapter._extend(this.element);if(!this.element._highchart_animation)this.element._highchart_animation={};this.element._highchart_animation[this.key]=
|
||||
this},update:function(b){var c=this.paths,d=this.element;c&&(b=a.step(c[0],c[1],b,this.toD));d.attr?d.element&&d.attr(this.options.attribute,b):(c={},c[this.options.attribute]=b,$(d).setStyle(c))},finish:function(){this.element&&this.element._highchart_animation&&delete this.element._highchart_animation[this.key]}})},adapterRun:function(a,b){return parseInt($(a).getStyle(b),10)},getScript:function(a,b){var c=$$("head")[0];c&&c.appendChild((new Element("script",{type:"text/javascript",src:a})).observe("load",
|
||||
b))},addNS:function(a){var b=/^(?:click|mouse(?:down|up|over|move|out))$/;return/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/.test(a)||b.test(a)?a:"h:"+a},addEvent:function(a,b,c){a.addEventListener||a.attachEvent?Event.observe($(a),HighchartsAdapter.addNS(b),c):(HighchartsAdapter._extend(a),a._highcharts_observe(b,c))},animate:function(a,b,c){var d,c=c||{};c.delay=0;c.duration=(c.duration||500)/1E3;c.afterFinish=c.complete;if(f)for(d in b)new Effect.HighchartsTransition($(a),
|
||||
d,b[d],c);else{if(a.attr)for(d in b)a.attr(d,b[d]);c.complete&&c.complete()}a.attr||$(a).setStyle(b)},stop:function(a){var b;if(a._highcharts_extended&&a._highchart_animation)for(b in a._highchart_animation)a._highchart_animation[b].cancel()},each:function(a,b){$A(a).each(b)},inArray:function(a,b,c){return b?b.indexOf(a,c):-1},offset:function(a){return $(a).cumulativeOffset()},fireEvent:function(a,b,c,d){a.fire?a.fire(HighchartsAdapter.addNS(b),c):a._highcharts_extended&&(c=c||{},a._highcharts_fire(b,
|
||||
c));c&&c.defaultPrevented&&(d=null);d&&d(c)},removeEvent:function(a,b,c){$(a).stopObserving&&(b&&(b=HighchartsAdapter.addNS(b)),$(a).stopObserving(b,c));window===a?Event.stopObserving(a,b,c):(HighchartsAdapter._extend(a),a._highcharts_stop_observing(b,c))},washMouseEvent:function(a){return a},grep:function(a,b){return a.findAll(b)},map:function(a,b){return a.map(b)},_extend:function(a){a._highcharts_extended||Object.extend(a,{_highchart_events:{},_highchart_animation:null,_highcharts_extended:!0,
|
||||
_highcharts_observe:function(b,a){this._highchart_events[b]=[this._highchart_events[b],a].compact().flatten()},_highcharts_stop_observing:function(b,a){b?a?this._highchart_events[b]=[this._highchart_events[b]].compact().flatten().without(a):delete this._highchart_events[b]:this._highchart_events={}},_highcharts_fire:function(a,c){var d=this;(this._highchart_events[a]||[]).each(function(a){if(!c.stopped)c.preventDefault=function(){c.defaultPrevented=!0},c.target=d,a.bind(this)(c)===!1&&c.preventDefault()}.bind(this))}})}}}();
|
316
public/UEditor/third-party/highcharts/adapters/prototype-adapter.src.js
vendored
Normal file
316
public/UEditor/third-party/highcharts/adapters/prototype-adapter.src.js
vendored
Normal file
@ -0,0 +1,316 @@
|
||||
/**
|
||||
* @license Highcharts JS v3.0.6 (2013-10-04)
|
||||
* Prototype adapter
|
||||
*
|
||||
* @author Michael Nelson, Torstein Hønsi.
|
||||
*
|
||||
* Feel free to use and modify this script.
|
||||
* Highcharts license: www.highcharts.com/license.
|
||||
*/
|
||||
|
||||
// JSLint options:
|
||||
/*global Effect, Class, Event, Element, $, $$, $A */
|
||||
|
||||
// Adapter interface between prototype and the Highcharts charting library
|
||||
var HighchartsAdapter = (function () {
|
||||
|
||||
var hasEffect = typeof Effect !== 'undefined';
|
||||
|
||||
return {
|
||||
|
||||
/**
|
||||
* Initialize the adapter. This is run once as Highcharts is first run.
|
||||
* @param {Object} pathAnim The helper object to do animations across adapters.
|
||||
*/
|
||||
init: function (pathAnim) {
|
||||
if (hasEffect) {
|
||||
/**
|
||||
* Animation for Highcharts SVG element wrappers only
|
||||
* @param {Object} element
|
||||
* @param {Object} attribute
|
||||
* @param {Object} to
|
||||
* @param {Object} options
|
||||
*/
|
||||
Effect.HighchartsTransition = Class.create(Effect.Base, {
|
||||
initialize: function (element, attr, to, options) {
|
||||
var from,
|
||||
opts;
|
||||
|
||||
this.element = element;
|
||||
this.key = attr;
|
||||
from = element.attr ? element.attr(attr) : $(element).getStyle(attr);
|
||||
|
||||
// special treatment for paths
|
||||
if (attr === 'd') {
|
||||
this.paths = pathAnim.init(
|
||||
element,
|
||||
element.d,
|
||||
to
|
||||
);
|
||||
this.toD = to;
|
||||
|
||||
|
||||
// fake values in order to read relative position as a float in update
|
||||
from = 0;
|
||||
to = 1;
|
||||
}
|
||||
|
||||
opts = Object.extend((options || {}), {
|
||||
from: from,
|
||||
to: to,
|
||||
attribute: attr
|
||||
});
|
||||
this.start(opts);
|
||||
},
|
||||
setup: function () {
|
||||
HighchartsAdapter._extend(this.element);
|
||||
// If this is the first animation on this object, create the _highcharts_animation helper that
|
||||
// contain pointers to the animation objects.
|
||||
if (!this.element._highchart_animation) {
|
||||
this.element._highchart_animation = {};
|
||||
}
|
||||
|
||||
// Store a reference to this animation instance.
|
||||
this.element._highchart_animation[this.key] = this;
|
||||
},
|
||||
update: function (position) {
|
||||
var paths = this.paths,
|
||||
element = this.element,
|
||||
obj;
|
||||
|
||||
if (paths) {
|
||||
position = pathAnim.step(paths[0], paths[1], position, this.toD);
|
||||
}
|
||||
|
||||
if (element.attr) { // SVGElement
|
||||
|
||||
if (element.element) { // If not, it has been destroyed (#1405)
|
||||
element.attr(this.options.attribute, position);
|
||||
}
|
||||
|
||||
} else { // HTML, #409
|
||||
obj = {};
|
||||
obj[this.options.attribute] = position;
|
||||
$(element).setStyle(obj);
|
||||
}
|
||||
|
||||
},
|
||||
finish: function () {
|
||||
// Delete the property that holds this animation now that it is finished.
|
||||
// Both canceled animations and complete ones gets a 'finish' call.
|
||||
if (this.element && this.element._highchart_animation) { // #1405
|
||||
delete this.element._highchart_animation[this.key];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Run a general method on the framework, following jQuery syntax
|
||||
* @param {Object} el The HTML element
|
||||
* @param {String} method Which method to run on the wrapped element
|
||||
*/
|
||||
adapterRun: function (el, method) {
|
||||
|
||||
// This currently works for getting inner width and height. If adding
|
||||
// more methods later, we need a conditional implementation for each.
|
||||
return parseInt($(el).getStyle(method), 10);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Downloads a script and executes a callback when done.
|
||||
* @param {String} scriptLocation
|
||||
* @param {Function} callback
|
||||
*/
|
||||
getScript: function (scriptLocation, callback) {
|
||||
var head = $$('head')[0]; // Returns an array, so pick the first element.
|
||||
if (head) {
|
||||
// Append a new 'script' element, set its type and src attributes, add a 'load' handler that calls the callback
|
||||
head.appendChild(new Element('script', { type: 'text/javascript', src: scriptLocation}).observe('load', callback));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Custom events in prototype needs to be namespaced. This method adds a namespace 'h:' in front of
|
||||
* events that are not recognized as native.
|
||||
*/
|
||||
addNS: function (eventName) {
|
||||
var HTMLEvents = /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
|
||||
MouseEvents = /^(?:click|mouse(?:down|up|over|move|out))$/;
|
||||
return (HTMLEvents.test(eventName) || MouseEvents.test(eventName)) ?
|
||||
eventName :
|
||||
'h:' + eventName;
|
||||
},
|
||||
|
||||
// el needs an event to be attached. el is not necessarily a dom element
|
||||
addEvent: function (el, event, fn) {
|
||||
if (el.addEventListener || el.attachEvent) {
|
||||
Event.observe($(el), HighchartsAdapter.addNS(event), fn);
|
||||
|
||||
} else {
|
||||
HighchartsAdapter._extend(el);
|
||||
el._highcharts_observe(event, fn);
|
||||
}
|
||||
},
|
||||
|
||||
// motion makes things pretty. use it if effects is loaded, if not... still get to the end result.
|
||||
animate: function (el, params, options) {
|
||||
var key,
|
||||
fx;
|
||||
|
||||
// default options
|
||||
options = options || {};
|
||||
options.delay = 0;
|
||||
options.duration = (options.duration || 500) / 1000;
|
||||
options.afterFinish = options.complete;
|
||||
|
||||
// animate wrappers and DOM elements
|
||||
if (hasEffect) {
|
||||
for (key in params) {
|
||||
// The fx variable is seemingly thrown away here, but the Effect.setup will add itself to the _highcharts_animation object
|
||||
// on the element itself so its not really lost.
|
||||
fx = new Effect.HighchartsTransition($(el), key, params[key], options);
|
||||
}
|
||||
} else {
|
||||
if (el.attr) { // #409 without effects
|
||||
for (key in params) {
|
||||
el.attr(key, params[key]);
|
||||
}
|
||||
}
|
||||
if (options.complete) {
|
||||
options.complete();
|
||||
}
|
||||
}
|
||||
|
||||
if (!el.attr) { // HTML element, #409
|
||||
$(el).setStyle(params);
|
||||
}
|
||||
},
|
||||
|
||||
// this only occurs in higcharts 2.0+
|
||||
stop: function (el) {
|
||||
var key;
|
||||
if (el._highcharts_extended && el._highchart_animation) {
|
||||
for (key in el._highchart_animation) {
|
||||
// Cancel the animation
|
||||
// The 'finish' function in the Effect object will remove the reference
|
||||
el._highchart_animation[key].cancel();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// um.. each
|
||||
each: function (arr, fn) {
|
||||
$A(arr).each(fn);
|
||||
},
|
||||
|
||||
inArray: function (item, arr, from) {
|
||||
return arr ? arr.indexOf(item, from) : -1;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the cumulative offset relative to the top left of the page. This method, unlike its
|
||||
* jQuery and MooTools counterpart, still suffers from issue #208 regarding the position
|
||||
* of a chart within a fixed container.
|
||||
*/
|
||||
offset: function (el) {
|
||||
return $(el).cumulativeOffset();
|
||||
},
|
||||
|
||||
// fire an event based on an event name (event) and an object (el).
|
||||
// again, el may not be a dom element
|
||||
fireEvent: function (el, event, eventArguments, defaultFunction) {
|
||||
if (el.fire) {
|
||||
el.fire(HighchartsAdapter.addNS(event), eventArguments);
|
||||
} else if (el._highcharts_extended) {
|
||||
eventArguments = eventArguments || {};
|
||||
el._highcharts_fire(event, eventArguments);
|
||||
}
|
||||
|
||||
if (eventArguments && eventArguments.defaultPrevented) {
|
||||
defaultFunction = null;
|
||||
}
|
||||
|
||||
if (defaultFunction) {
|
||||
defaultFunction(eventArguments);
|
||||
}
|
||||
},
|
||||
|
||||
removeEvent: function (el, event, handler) {
|
||||
if ($(el).stopObserving) {
|
||||
if (event) {
|
||||
event = HighchartsAdapter.addNS(event);
|
||||
}
|
||||
$(el).stopObserving(event, handler);
|
||||
} if (window === el) {
|
||||
Event.stopObserving(el, event, handler);
|
||||
} else {
|
||||
HighchartsAdapter._extend(el);
|
||||
el._highcharts_stop_observing(event, handler);
|
||||
}
|
||||
},
|
||||
|
||||
washMouseEvent: function (e) {
|
||||
return e;
|
||||
},
|
||||
|
||||
// um, grep
|
||||
grep: function (arr, fn) {
|
||||
return arr.findAll(fn);
|
||||
},
|
||||
|
||||
// um, map
|
||||
map: function (arr, fn) {
|
||||
return arr.map(fn);
|
||||
},
|
||||
|
||||
// extend an object to handle highchart events (highchart objects, not svg elements).
|
||||
// this is a very simple way of handling events but whatever, it works (i think)
|
||||
_extend: function (object) {
|
||||
if (!object._highcharts_extended) {
|
||||
Object.extend(object, {
|
||||
_highchart_events: {},
|
||||
_highchart_animation: null,
|
||||
_highcharts_extended: true,
|
||||
_highcharts_observe: function (name, fn) {
|
||||
this._highchart_events[name] = [this._highchart_events[name], fn].compact().flatten();
|
||||
},
|
||||
_highcharts_stop_observing: function (name, fn) {
|
||||
if (name) {
|
||||
if (fn) {
|
||||
this._highchart_events[name] = [this._highchart_events[name]].compact().flatten().without(fn);
|
||||
} else {
|
||||
delete this._highchart_events[name];
|
||||
}
|
||||
} else {
|
||||
this._highchart_events = {};
|
||||
}
|
||||
},
|
||||
_highcharts_fire: function (name, args) {
|
||||
var target = this;
|
||||
(this._highchart_events[name] || []).each(function (fn) {
|
||||
// args is never null here
|
||||
if (args.stopped) {
|
||||
return; // "throw $break" wasn't working. i think because of the scope of 'this'.
|
||||
}
|
||||
|
||||
// Attach a simple preventDefault function to skip default handler if called
|
||||
args.preventDefault = function () {
|
||||
args.defaultPrevented = true;
|
||||
};
|
||||
args.target = target;
|
||||
|
||||
// If the event handler return false, prevent the default handler from executing
|
||||
if (fn.bind(this)(args) === false) {
|
||||
args.preventDefault();
|
||||
}
|
||||
}
|
||||
.bind(this));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}());
|
17
public/UEditor/third-party/highcharts/adapters/standalone-framework.js
vendored
Normal file
17
public/UEditor/third-party/highcharts/adapters/standalone-framework.js
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
Highcharts JS v3.0.6 (2013-10-04)
|
||||
|
||||
Standalone Highcharts Framework
|
||||
|
||||
License: MIT License
|
||||
*/
|
||||
var HighchartsAdapter=function(){function o(c){function a(a,b,d){a.removeEventListener(b,d,!1)}function d(a,b,d){d=a.HCProxiedMethods[d.toString()];a.detachEvent("on"+b,d)}function b(b,c){var f=b.HCEvents,i,g,k,j;if(b.removeEventListener)i=a;else if(b.attachEvent)i=d;else return;c?(g={},g[c]=!0):g=f;for(j in g)if(f[j])for(k=f[j].length;k--;)i(b,j,f[j][k])}c.HCExtended||Highcharts.extend(c,{HCExtended:!0,HCEvents:{},bind:function(b,a){var d=this,c=this.HCEvents,g;if(d.addEventListener)d.addEventListener(b,
|
||||
a,!1);else if(d.attachEvent){g=function(b){a.call(d,b)};if(!d.HCProxiedMethods)d.HCProxiedMethods={};d.HCProxiedMethods[a.toString()]=g;d.attachEvent("on"+b,g)}c[b]===r&&(c[b]=[]);c[b].push(a)},unbind:function(c,h){var f,i;c?(f=this.HCEvents[c]||[],h?(i=HighchartsAdapter.inArray(h,f),i>-1&&(f.splice(i,1),this.HCEvents[c]=f),this.removeEventListener?a(this,c,h):this.attachEvent&&d(this,c,h)):(b(this,c),this.HCEvents[c]=[])):(b(this),this.HCEvents={})},trigger:function(b,a){var d=this.HCEvents[b]||
|
||||
[],c=d.length,g,k,j;k=function(){a.defaultPrevented=!0};for(g=0;g<c;g++){j=d[g];if(a.stopped)break;a.preventDefault=k;a.target=this;a.type=b;j.call(this,a)===!1&&a.preventDefault()}}});return c}var r,l=document,p=[],m=[],q,n;Math.easeInOutSine=function(c,a,d,b){return-d/2*(Math.cos(Math.PI*c/b)-1)+a};return{init:function(c){if(!l.defaultView)this._getStyle=function(a,d){var b;return a.style[d]?a.style[d]:(d==="opacity"&&(d="filter"),b=a.currentStyle[d.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()})],
|
||||
d==="filter"&&(b=b.replace(/alpha\(opacity=([0-9]+)\)/,function(b,a){return a/100})),b===""?1:b)},this.adapterRun=function(a,d){var b={width:"clientWidth",height:"clientHeight"}[d];if(b)return a.style.zoom=1,a[b]-2*parseInt(HighchartsAdapter._getStyle(a,"padding"),10)};if(!Array.prototype.forEach)this.each=function(a,d){for(var b=0,c=a.length;b<c;b++)if(d.call(a[b],a[b],b,a)===!1)return b};if(!Array.prototype.indexOf)this.inArray=function(a,d){var b,c=0;if(d)for(b=d.length;c<b;c++)if(d[c]===a)return c;
|
||||
return-1};if(!Array.prototype.filter)this.grep=function(a,d){for(var b=[],c=0,h=a.length;c<h;c++)d(a[c],c)&&b.push(a[c]);return b};n=function(a,c,b){this.options=c;this.elem=a;this.prop=b};n.prototype={update:function(){var a;a=this.paths;var d=this.elem,b=d.element;a&&b?d.attr("d",c.step(a[0],a[1],this.now,this.toD)):d.attr?b&&d.attr(this.prop,this.now):(a={},a[d]=this.now+this.unit,Highcharts.css(d,a));this.options.step&&this.options.step.call(this.elem,this.now,this)},custom:function(a,c,b){var e=
|
||||
this,h=function(a){return e.step(a)},f;this.startTime=+new Date;this.start=a;this.end=c;this.unit=b;this.now=this.start;this.pos=this.state=0;h.elem=this.elem;h()&&m.push(h)===1&&(q=setInterval(function(){for(f=0;f<m.length;f++)m[f]()||m.splice(f--,1);m.length||clearInterval(q)},13))},step:function(a){var c=+new Date,b;b=this.options;var e;if(this.elem.stopAnimation)b=!1;else if(a||c>=b.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();a=this.options.curAnim[this.prop]=
|
||||
!0;for(e in b.curAnim)b.curAnim[e]!==!0&&(a=!1);a&&b.complete&&b.complete.call(this.elem);b=!1}else e=c-this.startTime,this.state=e/b.duration,this.pos=b.easing(e,0,1,b.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update(),b=!0;return b}};this.animate=function(a,d,b){var e,h="",f,i,g;a.stopAnimation=!1;if(typeof b!=="object"||b===null)e=arguments,b={duration:e[2],easing:e[3],complete:e[4]};if(typeof b.duration!=="number")b.duration=400;b.easing=Math[b.easing]||Math.easeInOutSine;
|
||||
b.curAnim=Highcharts.extend({},d);for(g in d)i=new n(a,b,g),f=null,g==="d"?(i.paths=c.init(a,a.d,d.d),i.toD=d.d,e=0,f=1):a.attr?e=a.attr(g):(e=parseFloat(HighchartsAdapter._getStyle(a,g))||0,g!=="opacity"&&(h="px")),f||(f=parseFloat(d[g])),i.custom(e,f,h)}},_getStyle:function(c,a){return window.getComputedStyle(c).getPropertyValue(a)},getScript:function(c,a){var d=l.getElementsByTagName("head")[0],b=l.createElement("script");b.type="text/javascript";b.src=c;b.onload=a;d.appendChild(b)},inArray:function(c,
|
||||
a){return a.indexOf?a.indexOf(c):p.indexOf.call(a,c)},adapterRun:function(c,a){return parseInt(HighchartsAdapter._getStyle(c,a),10)},grep:function(c,a){return p.filter.call(c,a)},map:function(c,a){for(var d=[],b=0,e=c.length;b<e;b++)d[b]=a.call(c[b],c[b],b,c);return d},offset:function(c){for(var a=0,d=0;c;)a+=c.offsetLeft,d+=c.offsetTop,c=c.offsetParent;return{left:a,top:d}},addEvent:function(c,a,d){o(c).bind(a,d)},removeEvent:function(c,a,d){o(c).unbind(a,d)},fireEvent:function(c,a,d,b){var e;l.createEvent&&
|
||||
(c.dispatchEvent||c.fireEvent)?(e=l.createEvent("Events"),e.initEvent(a,!0,!0),e.target=c,Highcharts.extend(e,d),c.dispatchEvent?c.dispatchEvent(e):c.fireEvent(a,e)):c.HCExtended===!0&&(d=d||{},c.trigger(a,d));d&&d.defaultPrevented&&(b=null);b&&b(d)},washMouseEvent:function(c){return c},stop:function(c){c.stopAnimation=!0},each:function(c,a){return Array.prototype.forEach.call(c,a)}}}();
|
583
public/UEditor/third-party/highcharts/adapters/standalone-framework.src.js
vendored
Normal file
583
public/UEditor/third-party/highcharts/adapters/standalone-framework.src.js
vendored
Normal file
@ -0,0 +1,583 @@
|
||||
/**
|
||||
* @license Highcharts JS v3.0.6 (2013-10-04)
|
||||
*
|
||||
* Standalone Highcharts Framework
|
||||
*
|
||||
* License: MIT License
|
||||
*/
|
||||
|
||||
|
||||
/*global Highcharts */
|
||||
var HighchartsAdapter = (function () {
|
||||
|
||||
var UNDEFINED,
|
||||
doc = document,
|
||||
emptyArray = [],
|
||||
timers = [],
|
||||
timerId,
|
||||
Fx;
|
||||
|
||||
Math.easeInOutSine = function (t, b, c, d) {
|
||||
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Extend given object with custom events
|
||||
*/
|
||||
function augment(obj) {
|
||||
function removeOneEvent(el, type, fn) {
|
||||
el.removeEventListener(type, fn, false);
|
||||
}
|
||||
|
||||
function IERemoveOneEvent(el, type, fn) {
|
||||
fn = el.HCProxiedMethods[fn.toString()];
|
||||
el.detachEvent('on' + type, fn);
|
||||
}
|
||||
|
||||
function removeAllEvents(el, type) {
|
||||
var events = el.HCEvents,
|
||||
remove,
|
||||
types,
|
||||
len,
|
||||
n;
|
||||
|
||||
if (el.removeEventListener) {
|
||||
remove = removeOneEvent;
|
||||
} else if (el.attachEvent) {
|
||||
remove = IERemoveOneEvent;
|
||||
} else {
|
||||
return; // break on non-DOM events
|
||||
}
|
||||
|
||||
|
||||
if (type) {
|
||||
types = {};
|
||||
types[type] = true;
|
||||
} else {
|
||||
types = events;
|
||||
}
|
||||
|
||||
for (n in types) {
|
||||
if (events[n]) {
|
||||
len = events[n].length;
|
||||
while (len--) {
|
||||
remove(el, n, events[n][len]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!obj.HCExtended) {
|
||||
Highcharts.extend(obj, {
|
||||
HCExtended: true,
|
||||
|
||||
HCEvents: {},
|
||||
|
||||
bind: function (name, fn) {
|
||||
var el = this,
|
||||
events = this.HCEvents,
|
||||
wrappedFn;
|
||||
|
||||
// handle DOM events in modern browsers
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener(name, fn, false);
|
||||
|
||||
// handle old IE implementation
|
||||
} else if (el.attachEvent) {
|
||||
|
||||
wrappedFn = function (e) {
|
||||
fn.call(el, e);
|
||||
};
|
||||
|
||||
if (!el.HCProxiedMethods) {
|
||||
el.HCProxiedMethods = {};
|
||||
}
|
||||
|
||||
// link wrapped fn with original fn, so we can get this in removeEvent
|
||||
el.HCProxiedMethods[fn.toString()] = wrappedFn;
|
||||
|
||||
el.attachEvent('on' + name, wrappedFn);
|
||||
}
|
||||
|
||||
|
||||
if (events[name] === UNDEFINED) {
|
||||
events[name] = [];
|
||||
}
|
||||
|
||||
events[name].push(fn);
|
||||
},
|
||||
|
||||
unbind: function (name, fn) {
|
||||
var events,
|
||||
index;
|
||||
|
||||
if (name) {
|
||||
events = this.HCEvents[name] || [];
|
||||
if (fn) {
|
||||
index = HighchartsAdapter.inArray(fn, events);
|
||||
if (index > -1) {
|
||||
events.splice(index, 1);
|
||||
this.HCEvents[name] = events;
|
||||
}
|
||||
if (this.removeEventListener) {
|
||||
removeOneEvent(this, name, fn);
|
||||
} else if (this.attachEvent) {
|
||||
IERemoveOneEvent(this, name, fn);
|
||||
}
|
||||
} else {
|
||||
removeAllEvents(this, name);
|
||||
this.HCEvents[name] = [];
|
||||
}
|
||||
} else {
|
||||
removeAllEvents(this);
|
||||
this.HCEvents = {};
|
||||
}
|
||||
},
|
||||
|
||||
trigger: function (name, args) {
|
||||
var events = this.HCEvents[name] || [],
|
||||
target = this,
|
||||
len = events.length,
|
||||
i,
|
||||
preventDefault,
|
||||
fn;
|
||||
|
||||
// Attach a simple preventDefault function to skip default handler if called
|
||||
preventDefault = function () {
|
||||
args.defaultPrevented = true;
|
||||
};
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
fn = events[i];
|
||||
|
||||
// args is never null here
|
||||
if (args.stopped) {
|
||||
return;
|
||||
}
|
||||
|
||||
args.preventDefault = preventDefault;
|
||||
args.target = target;
|
||||
args.type = name; // #2297
|
||||
|
||||
// If the event handler return false, prevent the default handler from executing
|
||||
if (fn.call(this, args) === false) {
|
||||
args.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
/**
|
||||
* Initialize the adapter. This is run once as Highcharts is first run.
|
||||
*/
|
||||
init: function (pathAnim) {
|
||||
|
||||
/**
|
||||
* Compatibility section to add support for legacy IE. This can be removed if old IE
|
||||
* support is not needed.
|
||||
*/
|
||||
if (!doc.defaultView) {
|
||||
this._getStyle = function (el, prop) {
|
||||
var val;
|
||||
if (el.style[prop]) {
|
||||
return el.style[prop];
|
||||
} else {
|
||||
if (prop === 'opacity') {
|
||||
prop = 'filter';
|
||||
}
|
||||
/*jslint unparam: true*/
|
||||
val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b) { return b.toUpperCase(); })];
|
||||
if (prop === 'filter') {
|
||||
val = val.replace(
|
||||
/alpha\(opacity=([0-9]+)\)/,
|
||||
function (a, b) {
|
||||
return b / 100;
|
||||
}
|
||||
);
|
||||
}
|
||||
/*jslint unparam: false*/
|
||||
return val === '' ? 1 : val;
|
||||
}
|
||||
};
|
||||
this.adapterRun = function (elem, method) {
|
||||
var alias = { width: 'clientWidth', height: 'clientHeight' }[method];
|
||||
|
||||
if (alias) {
|
||||
elem.style.zoom = 1;
|
||||
return elem[alias] - 2 * parseInt(HighchartsAdapter._getStyle(elem, 'padding'), 10);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.forEach) {
|
||||
this.each = function (arr, fn) { // legacy
|
||||
var i = 0,
|
||||
len = arr.length;
|
||||
for (; i < len; i++) {
|
||||
if (fn.call(arr[i], arr[i], i, arr) === false) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.indexOf) {
|
||||
this.inArray = function (item, arr) {
|
||||
var len,
|
||||
i = 0;
|
||||
|
||||
if (arr) {
|
||||
len = arr.length;
|
||||
|
||||
for (; i < len; i++) {
|
||||
if (arr[i] === item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
if (!Array.prototype.filter) {
|
||||
this.grep = function (elements, callback) {
|
||||
var ret = [],
|
||||
i = 0,
|
||||
length = elements.length;
|
||||
|
||||
for (; i < length; i++) {
|
||||
if (!!callback(elements[i], i)) {
|
||||
ret.push(elements[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
//--- End compatibility section ---
|
||||
|
||||
|
||||
/**
|
||||
* Start of animation specific code
|
||||
*/
|
||||
Fx = function (elem, options, prop) {
|
||||
this.options = options;
|
||||
this.elem = elem;
|
||||
this.prop = prop;
|
||||
};
|
||||
Fx.prototype = {
|
||||
|
||||
update: function () {
|
||||
var styles,
|
||||
paths = this.paths,
|
||||
elem = this.elem,
|
||||
elemelem = elem.element; // if destroyed, it is null
|
||||
|
||||
// Animating a path definition on SVGElement
|
||||
if (paths && elemelem) {
|
||||
elem.attr('d', pathAnim.step(paths[0], paths[1], this.now, this.toD));
|
||||
|
||||
// Other animations on SVGElement
|
||||
} else if (elem.attr) {
|
||||
if (elemelem) {
|
||||
elem.attr(this.prop, this.now);
|
||||
}
|
||||
|
||||
// HTML styles
|
||||
} else {
|
||||
styles = {};
|
||||
styles[elem] = this.now + this.unit;
|
||||
Highcharts.css(elem, styles);
|
||||
}
|
||||
|
||||
if (this.options.step) {
|
||||
this.options.step.call(this.elem, this.now, this);
|
||||
}
|
||||
|
||||
},
|
||||
custom: function (from, to, unit) {
|
||||
var self = this,
|
||||
t = function (gotoEnd) {
|
||||
return self.step(gotoEnd);
|
||||
},
|
||||
i;
|
||||
|
||||
this.startTime = +new Date();
|
||||
this.start = from;
|
||||
this.end = to;
|
||||
this.unit = unit;
|
||||
this.now = this.start;
|
||||
this.pos = this.state = 0;
|
||||
|
||||
t.elem = this.elem;
|
||||
|
||||
if (t() && timers.push(t) === 1) {
|
||||
timerId = setInterval(function () {
|
||||
|
||||
for (i = 0; i < timers.length; i++) {
|
||||
if (!timers[i]()) {
|
||||
timers.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!timers.length) {
|
||||
clearInterval(timerId);
|
||||
}
|
||||
}, 13);
|
||||
}
|
||||
},
|
||||
|
||||
step: function (gotoEnd) {
|
||||
var t = +new Date(),
|
||||
ret,
|
||||
done,
|
||||
options = this.options,
|
||||
i;
|
||||
|
||||
if (this.elem.stopAnimation) {
|
||||
ret = false;
|
||||
|
||||
} else if (gotoEnd || t >= options.duration + this.startTime) {
|
||||
this.now = this.end;
|
||||
this.pos = this.state = 1;
|
||||
this.update();
|
||||
|
||||
this.options.curAnim[this.prop] = true;
|
||||
|
||||
done = true;
|
||||
for (i in options.curAnim) {
|
||||
if (options.curAnim[i] !== true) {
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (done) {
|
||||
if (options.complete) {
|
||||
options.complete.call(this.elem);
|
||||
}
|
||||
}
|
||||
ret = false;
|
||||
|
||||
} else {
|
||||
var n = t - this.startTime;
|
||||
this.state = n / options.duration;
|
||||
this.pos = options.easing(n, 0, 1, options.duration);
|
||||
this.now = this.start + ((this.end - this.start) * this.pos);
|
||||
this.update();
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The adapter animate method
|
||||
*/
|
||||
this.animate = function (el, prop, opt) {
|
||||
var start,
|
||||
unit = '',
|
||||
end,
|
||||
fx,
|
||||
args,
|
||||
name;
|
||||
|
||||
el.stopAnimation = false; // ready for new
|
||||
|
||||
if (typeof opt !== 'object' || opt === null) {
|
||||
args = arguments;
|
||||
opt = {
|
||||
duration: args[2],
|
||||
easing: args[3],
|
||||
complete: args[4]
|
||||
};
|
||||
}
|
||||
if (typeof opt.duration !== 'number') {
|
||||
opt.duration = 400;
|
||||
}
|
||||
opt.easing = Math[opt.easing] || Math.easeInOutSine;
|
||||
opt.curAnim = Highcharts.extend({}, prop);
|
||||
|
||||
for (name in prop) {
|
||||
fx = new Fx(el, opt, name);
|
||||
end = null;
|
||||
|
||||
if (name === 'd') {
|
||||
fx.paths = pathAnim.init(
|
||||
el,
|
||||
el.d,
|
||||
prop.d
|
||||
);
|
||||
fx.toD = prop.d;
|
||||
start = 0;
|
||||
end = 1;
|
||||
} else if (el.attr) {
|
||||
start = el.attr(name);
|
||||
} else {
|
||||
start = parseFloat(HighchartsAdapter._getStyle(el, name)) || 0;
|
||||
if (name !== 'opacity') {
|
||||
unit = 'px';
|
||||
}
|
||||
}
|
||||
|
||||
if (!end) {
|
||||
end = parseFloat(prop[name]);
|
||||
}
|
||||
fx.custom(start, end, unit);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Internal method to return CSS value for given element and property
|
||||
*/
|
||||
_getStyle: function (el, prop) {
|
||||
return window.getComputedStyle(el).getPropertyValue(prop);
|
||||
},
|
||||
|
||||
/**
|
||||
* Downloads a script and executes a callback when done.
|
||||
* @param {String} scriptLocation
|
||||
* @param {Function} callback
|
||||
*/
|
||||
getScript: function (scriptLocation, callback) {
|
||||
// We cannot assume that Assets class from mootools-more is available so instead insert a script tag to download script.
|
||||
var head = doc.getElementsByTagName('head')[0],
|
||||
script = doc.createElement('script');
|
||||
|
||||
script.type = 'text/javascript';
|
||||
script.src = scriptLocation;
|
||||
script.onload = callback;
|
||||
|
||||
head.appendChild(script);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return the index of an item in an array, or -1 if not found
|
||||
*/
|
||||
inArray: function (item, arr) {
|
||||
return arr.indexOf ? arr.indexOf(item) : emptyArray.indexOf.call(arr, item);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* A direct link to adapter methods
|
||||
*/
|
||||
adapterRun: function (elem, method) {
|
||||
return parseInt(HighchartsAdapter._getStyle(elem, method), 10);
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter an array
|
||||
*/
|
||||
grep: function (elements, callback) {
|
||||
return emptyArray.filter.call(elements, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Map an array
|
||||
*/
|
||||
map: function (arr, fn) {
|
||||
var results = [], i = 0, len = arr.length;
|
||||
|
||||
for (; i < len; i++) {
|
||||
results[i] = fn.call(arr[i], arr[i], i, arr);
|
||||
}
|
||||
|
||||
return results;
|
||||
},
|
||||
|
||||
offset: function (el) {
|
||||
var left = 0,
|
||||
top = 0;
|
||||
|
||||
while (el) {
|
||||
left += el.offsetLeft;
|
||||
top += el.offsetTop;
|
||||
el = el.offsetParent;
|
||||
}
|
||||
|
||||
return {
|
||||
left: left,
|
||||
top: top
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Add an event listener
|
||||
*/
|
||||
addEvent: function (el, type, fn) {
|
||||
augment(el).bind(type, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove event added with addEvent
|
||||
*/
|
||||
removeEvent: function (el, type, fn) {
|
||||
augment(el).unbind(type, fn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Fire an event on a custom object
|
||||
*/
|
||||
fireEvent: function (el, type, eventArguments, defaultFunction) {
|
||||
var e;
|
||||
|
||||
if (doc.createEvent && (el.dispatchEvent || el.fireEvent)) {
|
||||
e = doc.createEvent('Events');
|
||||
e.initEvent(type, true, true);
|
||||
e.target = el;
|
||||
|
||||
Highcharts.extend(e, eventArguments);
|
||||
|
||||
if (el.dispatchEvent) {
|
||||
el.dispatchEvent(e);
|
||||
} else {
|
||||
el.fireEvent(type, e);
|
||||
}
|
||||
|
||||
} else if (el.HCExtended === true) {
|
||||
eventArguments = eventArguments || {};
|
||||
el.trigger(type, eventArguments);
|
||||
}
|
||||
|
||||
if (eventArguments && eventArguments.defaultPrevented) {
|
||||
defaultFunction = null;
|
||||
}
|
||||
|
||||
if (defaultFunction) {
|
||||
defaultFunction(eventArguments);
|
||||
}
|
||||
},
|
||||
|
||||
washMouseEvent: function (e) {
|
||||
return e;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Stop running animation
|
||||
*/
|
||||
stop: function (el) {
|
||||
el.stopAnimation = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Utility for iterating over an array. Parameters are reversed compared to jQuery.
|
||||
* @param {Array} arr
|
||||
* @param {Function} fn
|
||||
*/
|
||||
each: function (arr, fn) { // modern browsers
|
||||
return Array.prototype.forEach.call(arr, fn);
|
||||
}
|
||||
};
|
||||
}());
|
Reference in New Issue
Block a user