Browse Source

Removed double function naming

css_transitions
jos 10 years ago
parent
commit
0f45b7a2f1
14 changed files with 124 additions and 124 deletions
  1. +2
    -2
      src/DataSet.js
  2. +4
    -4
      src/timeline/component/Component.js
  3. +4
    -4
      src/timeline/component/CurrentTime.js
  4. +1
    -1
      src/timeline/component/CustomTime.js
  5. +14
    -14
      src/timeline/component/Group.js
  6. +31
    -31
      src/timeline/component/ItemSet.js
  7. +3
    -3
      src/timeline/component/TimeAxis.js
  8. +9
    -9
      src/timeline/component/item/Item.js
  9. +6
    -6
      src/timeline/component/item/ItemBox.js
  10. +6
    -6
      src/timeline/component/item/ItemPoint.js
  11. +6
    -6
      src/timeline/component/item/ItemRange.js
  12. +1
    -1
      src/timeline/component/item/ItemRangeOverflow.js
  13. +5
    -5
      src/timeline/stack.js
  14. +32
    -32
      src/util.js

+ 2
- 2
src/DataSet.js View File

@ -83,7 +83,7 @@ function DataSet (data, options) {
* {Object | null} params * {Object | null} params
* {String | Number} senderId * {String | Number} senderId
*/ */
DataSet.prototype.on = function on (event, callback) {
DataSet.prototype.on = function(event, callback) {
var subscribers = this.subscribers[event]; var subscribers = this.subscribers[event];
if (!subscribers) { if (!subscribers) {
subscribers = []; subscribers = [];
@ -103,7 +103,7 @@ DataSet.prototype.subscribe = DataSet.prototype.on;
* @param {String} event * @param {String} event
* @param {function} callback * @param {function} callback
*/ */
DataSet.prototype.off = function off(event, callback) {
DataSet.prototype.off = function(event, callback) {
var subscribers = this.subscribers[event]; var subscribers = this.subscribers[event];
if (subscribers) { if (subscribers) {
this.subscribers[event] = subscribers.filter(function (listener) { this.subscribers[event] = subscribers.filter(function (listener) {

+ 4
- 4
src/timeline/component/Component.js View File

@ -16,7 +16,7 @@ function Component () {
* {String | Number | function} [width] * {String | Number | function} [width]
* {String | Number | function} [height] * {String | Number | function} [height]
*/ */
Component.prototype.setOptions = function setOptions(options) {
Component.prototype.setOptions = function(options) {
if (options) { if (options) {
util.extend(this.options, options); util.extend(this.options, options);
@ -31,7 +31,7 @@ Component.prototype.setOptions = function setOptions(options) {
* @param {String} name * @param {String} name
* @return {*} value * @return {*} value
*/ */
Component.prototype.getOption = function getOption(name) {
Component.prototype.getOption = function(name) {
var value; var value;
if (this.options) { if (this.options) {
value = this.options[name]; value = this.options[name];
@ -46,7 +46,7 @@ Component.prototype.getOption = function getOption(name) {
* Repaint the component * Repaint the component
* @return {boolean} Returns true if the component is resized * @return {boolean} Returns true if the component is resized
*/ */
Component.prototype.redraw = function redraw() {
Component.prototype.redraw = function() {
// should be implemented by the component // should be implemented by the component
return false; return false;
}; };
@ -57,7 +57,7 @@ Component.prototype.redraw = function redraw() {
* @return {Boolean} Returns true if the component is resized * @return {Boolean} Returns true if the component is resized
* @protected * @protected
*/ */
Component.prototype._isResized = function _isResized() {
Component.prototype._isResized = function() {
var resized = (this.props._previousWidth !== this.props.width || var resized = (this.props._previousWidth !== this.props.width ||
this.props._previousHeight !== this.props.height); this.props._previousHeight !== this.props.height);

+ 4
- 4
src/timeline/component/CurrentTime.js View File

@ -21,7 +21,7 @@ CurrentTime.prototype = new Component();
* Create the HTML DOM for the current time bar * Create the HTML DOM for the current time bar
* @private * @private
*/ */
CurrentTime.prototype._create = function _create () {
CurrentTime.prototype._create = function() {
var bar = document.createElement('div'); var bar = document.createElement('div');
bar.className = 'currenttime'; bar.className = 'currenttime';
bar.style.position = 'absolute'; bar.style.position = 'absolute';
@ -35,7 +35,7 @@ CurrentTime.prototype._create = function _create () {
* Repaint the component * Repaint the component
* @return {boolean} Returns true if the component is resized * @return {boolean} Returns true if the component is resized
*/ */
CurrentTime.prototype.redraw = function redraw() {
CurrentTime.prototype.redraw = function() {
if (this.options.showCurrentTime) { if (this.options.showCurrentTime) {
var parent = this.timeline.dom.backgroundVertical; var parent = this.timeline.dom.backgroundVertical;
if (this.bar.parentNode != parent) { if (this.bar.parentNode != parent) {
@ -68,7 +68,7 @@ CurrentTime.prototype.redraw = function redraw() {
/** /**
* Start auto refreshing the current time bar * Start auto refreshing the current time bar
*/ */
CurrentTime.prototype.start = function start() {
CurrentTime.prototype.start = function() {
var me = this; var me = this;
function update () { function update () {
@ -92,7 +92,7 @@ CurrentTime.prototype.start = function start() {
/** /**
* Stop auto refreshing the current time bar * Stop auto refreshing the current time bar
*/ */
CurrentTime.prototype.stop = function stop() {
CurrentTime.prototype.stop = function() {
if (this.currentTimeTimer !== undefined) { if (this.currentTimeTimer !== undefined) {
clearTimeout(this.currentTimeTimer); clearTimeout(this.currentTimeTimer);
delete this.currentTimeTimer; delete this.currentTimeTimer;

+ 1
- 1
src/timeline/component/CustomTime.js View File

@ -24,7 +24,7 @@ CustomTime.prototype = new Component();
* Create the DOM for the custom time * Create the DOM for the custom time
* @private * @private
*/ */
CustomTime.prototype._create = function _create () {
CustomTime.prototype._create = function() {
var bar = document.createElement('div'); var bar = document.createElement('div');
bar.className = 'customtime'; bar.className = 'customtime';
bar.style.position = 'absolute'; bar.style.position = 'absolute';

+ 14
- 14
src/timeline/component/Group.js View File

@ -65,7 +65,7 @@ Group.prototype._create = function() {
* Set the group data for this group * Set the group data for this group
* @param {Object} data Group data, can contain properties content and className * @param {Object} data Group data, can contain properties content and className
*/ */
Group.prototype.setData = function setData(data) {
Group.prototype.setData = function(data) {
// update contents // update contents
var content = data && data.content; var content = data && data.content;
if (content instanceof Element) { if (content instanceof Element) {
@ -96,7 +96,7 @@ Group.prototype.setData = function setData(data) {
* Get the width of the group label * Get the width of the group label
* @return {number} width * @return {number} width
*/ */
Group.prototype.getLabelWidth = function getLabelWidth() {
Group.prototype.getLabelWidth = function() {
return this.props.label.width; return this.props.label.width;
}; };
@ -108,7 +108,7 @@ Group.prototype.getLabelWidth = function getLabelWidth() {
* @param {boolean} [restack=false] Force restacking of all items * @param {boolean} [restack=false] Force restacking of all items
* @return {boolean} Returns true if the group is resized * @return {boolean} Returns true if the group is resized
*/ */
Group.prototype.redraw = function redraw(range, margin, restack) {
Group.prototype.redraw = function(range, margin, restack) {
var resized = false; var resized = false;
this.visibleItems = this._updateVisibleItems(this.orderedItems, this.visibleItems, range); this.visibleItems = this._updateVisibleItems(this.orderedItems, this.visibleItems, range);
@ -179,7 +179,7 @@ Group.prototype.redraw = function redraw(range, margin, restack) {
/** /**
* Show this group: attach to the DOM * Show this group: attach to the DOM
*/ */
Group.prototype.show = function show() {
Group.prototype.show = function() {
if (!this.dom.label.parentNode) { if (!this.dom.label.parentNode) {
this.itemSet.dom.labelSet.appendChild(this.dom.label); this.itemSet.dom.labelSet.appendChild(this.dom.label);
} }
@ -200,7 +200,7 @@ Group.prototype.show = function show() {
/** /**
* Hide this group: remove from the DOM * Hide this group: remove from the DOM
*/ */
Group.prototype.hide = function hide() {
Group.prototype.hide = function() {
var label = this.dom.label; var label = this.dom.label;
if (label.parentNode) { if (label.parentNode) {
label.parentNode.removeChild(label); label.parentNode.removeChild(label);
@ -226,7 +226,7 @@ Group.prototype.hide = function hide() {
* Add an item to the group * Add an item to the group
* @param {Item} item * @param {Item} item
*/ */
Group.prototype.add = function add(item) {
Group.prototype.add = function(item) {
this.items[item.id] = item; this.items[item.id] = item;
item.setParent(this); item.setParent(this);
@ -240,7 +240,7 @@ Group.prototype.add = function add(item) {
* Remove an item from the group * Remove an item from the group
* @param {Item} item * @param {Item} item
*/ */
Group.prototype.remove = function remove(item) {
Group.prototype.remove = function(item) {
delete this.items[item.id]; delete this.items[item.id];
item.setParent(this.itemSet); item.setParent(this.itemSet);
@ -255,14 +255,14 @@ Group.prototype.remove = function remove(item) {
* Remove an item from the corresponding DataSet * Remove an item from the corresponding DataSet
* @param {Item} item * @param {Item} item
*/ */
Group.prototype.removeFromDataSet = function removeFromDataSet(item) {
Group.prototype.removeFromDataSet = function(item) {
this.itemSet.removeItem(item.id); this.itemSet.removeItem(item.id);
}; };
/** /**
* Reorder the items * Reorder the items
*/ */
Group.prototype.order = function order() {
Group.prototype.order = function() {
var array = util.toArray(this.items); var array = util.toArray(this.items);
this.orderedItems.byStart = array; this.orderedItems.byStart = array;
this.orderedItems.byEnd = this._constructByEndArray(array); this.orderedItems.byEnd = this._constructByEndArray(array);
@ -277,7 +277,7 @@ Group.prototype.order = function order() {
* @returns {ItemRange[]} * @returns {ItemRange[]}
* @private * @private
*/ */
Group.prototype._constructByEndArray = function _constructByEndArray(array) {
Group.prototype._constructByEndArray = function(array) {
var endArray = []; var endArray = [];
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
@ -296,7 +296,7 @@ Group.prototype._constructByEndArray = function _constructByEndArray(array) {
* @return {Item[]} visibleItems The new visible items. * @return {Item[]} visibleItems The new visible items.
* @private * @private
*/ */
Group.prototype._updateVisibleItems = function _updateVisibleItems(orderedItems, visibleItems, range) {
Group.prototype._updateVisibleItems = function(orderedItems, visibleItems, range) {
var initialPosByStart, var initialPosByStart,
newVisibleItems = [], newVisibleItems = [],
i; i;
@ -359,7 +359,7 @@ Group.prototype._updateVisibleItems = function _updateVisibleItems(orderedItems,
* @returns {number} * @returns {number}
* @private * @private
*/ */
Group.prototype._binarySearch = function _binarySearch(orderedItems, range, byEnd) {
Group.prototype._binarySearch = function(orderedItems, range, byEnd) {
var array = []; var array = [];
var byTime = byEnd ? 'end' : 'start'; var byTime = byEnd ? 'end' : 'start';
if (byEnd == true) {array = orderedItems.byEnd; } if (byEnd == true) {array = orderedItems.byEnd; }
@ -420,7 +420,7 @@ Group.prototype._binarySearch = function _binarySearch(orderedItems, range, byEn
* @returns {boolean} * @returns {boolean}
* @private * @private
*/ */
Group.prototype._checkIfInvisible = function _checkIfInvisible(item, visibleItems, range) {
Group.prototype._checkIfInvisible = function(item, visibleItems, range) {
if (item.isVisible(range)) { if (item.isVisible(range)) {
if (!item.displayed) item.show(); if (!item.displayed) item.show();
item.repositionX(); item.repositionX();
@ -445,7 +445,7 @@ Group.prototype._checkIfInvisible = function _checkIfInvisible(item, visibleItem
* @param {{start:number, end:number}} range * @param {{start:number, end:number}} range
* @private * @private
*/ */
Group.prototype._checkIfVisible = function _checkIfVisible(item, visibleItems, range) {
Group.prototype._checkIfVisible = function(item, visibleItems, range) {
if (item.isVisible(range)) { if (item.isVisible(range)) {
if (!item.displayed) item.show(); if (!item.displayed) item.show();
// reposition item horizontally // reposition item horizontally

+ 31
- 31
src/timeline/component/ItemSet.js View File

@ -7,7 +7,7 @@ var UNGROUPED = '__ungrouped__'; // reserved group id for ungrouped items
* @param {{dom: Object}} timeline * @param {{dom: Object}} timeline
* @param {Object} [options] See ItemSet.setOptions for the available options. * @param {Object} [options] See ItemSet.setOptions for the available options.
* @constructor ItemSet * @constructor ItemSet
* @extends Panel
* @extends Component
*/ */
function ItemSet(timeline, options) { function ItemSet(timeline, options) {
this.timeline = timeline; this.timeline = timeline;
@ -75,7 +75,7 @@ ItemSet.types = {
/** /**
* Create the HTML DOM for the ItemSet * Create the HTML DOM for the ItemSet
*/ */
ItemSet.prototype._create = function _create(){
ItemSet.prototype._create = function(){
var frame = document.createElement('div'); var frame = document.createElement('div');
frame.className = 'itemset'; frame.className = 'itemset';
frame['timeline-itemset'] = this; frame['timeline-itemset'] = this;
@ -162,7 +162,7 @@ ItemSet.prototype.setOptions = Component.prototype.setOptions;
/** /**
* Mark the ItemSet dirty so it will refresh everything with next redraw * Mark the ItemSet dirty so it will refresh everything with next redraw
*/ */
ItemSet.prototype.markDirty = function markDirty() {
ItemSet.prototype.markDirty = function() {
this.groupIds = []; this.groupIds = [];
this.stackDirty = true; this.stackDirty = true;
}; };
@ -170,7 +170,7 @@ ItemSet.prototype.markDirty = function markDirty() {
/** /**
* Hide the component from the DOM * Hide the component from the DOM
*/ */
ItemSet.prototype.hide = function hide() {
ItemSet.prototype.hide = function() {
// remove the frame containing the items // remove the frame containing the items
if (this.dom.frame.parentNode) { if (this.dom.frame.parentNode) {
this.dom.frame.parentNode.removeChild(this.dom.frame); this.dom.frame.parentNode.removeChild(this.dom.frame);
@ -191,7 +191,7 @@ ItemSet.prototype.hide = function hide() {
* Show the component in the DOM (when not already visible). * Show the component in the DOM (when not already visible).
* @return {Boolean} changed * @return {Boolean} changed
*/ */
ItemSet.prototype.show = function show() {
ItemSet.prototype.show = function() {
// show frame containing the items // show frame containing the items
if (!this.dom.frame.parentNode) { if (!this.dom.frame.parentNode) {
this.timeline.dom.center.appendChild(this.dom.frame); this.timeline.dom.center.appendChild(this.dom.frame);
@ -215,7 +215,7 @@ ItemSet.prototype.show = function show() {
* selected. If ids is an empty array, all items will be * selected. If ids is an empty array, all items will be
* unselected. * unselected.
*/ */
ItemSet.prototype.setSelection = function setSelection(ids) {
ItemSet.prototype.setSelection = function(ids) {
var i, ii, id, item; var i, ii, id, item;
if (ids) { if (ids) {
@ -247,7 +247,7 @@ ItemSet.prototype.setSelection = function setSelection(ids) {
* Get the selected items by their id * Get the selected items by their id
* @return {Array} ids The ids of the selected items * @return {Array} ids The ids of the selected items
*/ */
ItemSet.prototype.getSelection = function getSelection() {
ItemSet.prototype.getSelection = function() {
return this.selection.concat([]); return this.selection.concat([]);
}; };
@ -256,7 +256,7 @@ ItemSet.prototype.getSelection = function getSelection() {
* @param {String | Number} id * @param {String | Number} id
* @private * @private
*/ */
ItemSet.prototype._deselect = function _deselect(id) {
ItemSet.prototype._deselect = function(id) {
var selection = this.selection; var selection = this.selection;
for (var i = 0, ii = selection.length; i < ii; i++) { for (var i = 0, ii = selection.length; i < ii; i++) {
if (selection[i] == id) { // non-strict comparison! if (selection[i] == id) { // non-strict comparison!
@ -270,7 +270,7 @@ ItemSet.prototype._deselect = function _deselect(id) {
* Repaint the component * Repaint the component
* @return {boolean} Returns true if the component is resized * @return {boolean} Returns true if the component is resized
*/ */
ItemSet.prototype.redraw = function redraw() {
ItemSet.prototype.redraw = function() {
var margin = this.options.margin, var margin = this.options.margin,
range = this.timeline.range, range = this.timeline.range,
asSize = util.option.asSize, asSize = util.option.asSize,
@ -352,7 +352,7 @@ ItemSet.prototype.redraw = function redraw() {
* @return {Group | null} firstGroup * @return {Group | null} firstGroup
* @private * @private
*/ */
ItemSet.prototype._firstGroup = function _firstGroup() {
ItemSet.prototype._firstGroup = function() {
var firstGroupIndex = (this.options.orientation == 'top') ? 0 : (this.groupIds.length - 1); var firstGroupIndex = (this.options.orientation == 'top') ? 0 : (this.groupIds.length - 1);
var firstGroupId = this.groupIds[firstGroupIndex]; var firstGroupId = this.groupIds[firstGroupIndex];
var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED]; var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED];
@ -365,7 +365,7 @@ ItemSet.prototype._firstGroup = function _firstGroup() {
* there are no groups specified. * there are no groups specified.
* @protected * @protected
*/ */
ItemSet.prototype._updateUngrouped = function _updateUngrouped() {
ItemSet.prototype._updateUngrouped = function() {
var ungrouped = this.groups[UNGROUPED]; var ungrouped = this.groups[UNGROUPED];
if (this.groupsData) { if (this.groupsData) {
@ -398,7 +398,7 @@ ItemSet.prototype._updateUngrouped = function _updateUngrouped() {
* Get the element for the labelset * Get the element for the labelset
* @return {HTMLElement} labelSet * @return {HTMLElement} labelSet
*/ */
ItemSet.prototype.getLabelSet = function getLabelSet() {
ItemSet.prototype.getLabelSet = function() {
return this.dom.labelSet; return this.dom.labelSet;
}; };
@ -406,7 +406,7 @@ ItemSet.prototype.getLabelSet = function getLabelSet() {
* Set items * Set items
* @param {vis.DataSet | null} items * @param {vis.DataSet | null} items
*/ */
ItemSet.prototype.setItems = function setItems(items) {
ItemSet.prototype.setItems = function(items) {
var me = this, var me = this,
ids, ids,
oldItemsData = this.itemsData; oldItemsData = this.itemsData;
@ -453,7 +453,7 @@ ItemSet.prototype.setItems = function setItems(items) {
* Get the current items * Get the current items
* @returns {vis.DataSet | null} * @returns {vis.DataSet | null}
*/ */
ItemSet.prototype.getItems = function getItems() {
ItemSet.prototype.getItems = function() {
return this.itemsData; return this.itemsData;
}; };
@ -461,7 +461,7 @@ ItemSet.prototype.getItems = function getItems() {
* Set groups * Set groups
* @param {vis.DataSet} groups * @param {vis.DataSet} groups
*/ */
ItemSet.prototype.setGroups = function setGroups(groups) {
ItemSet.prototype.setGroups = function(groups) {
var me = this, var me = this,
ids; ids;
@ -513,7 +513,7 @@ ItemSet.prototype.setGroups = function setGroups(groups) {
* Get the current groups * Get the current groups
* @returns {vis.DataSet | null} groups * @returns {vis.DataSet | null} groups
*/ */
ItemSet.prototype.getGroups = function getGroups() {
ItemSet.prototype.getGroups = function() {
return this.groupsData; return this.groupsData;
}; };
@ -521,7 +521,7 @@ ItemSet.prototype.getGroups = function getGroups() {
* Remove an item by its id * Remove an item by its id
* @param {String | Number} id * @param {String | Number} id
*/ */
ItemSet.prototype.removeItem = function removeItem (id) {
ItemSet.prototype.removeItem = function(id) {
var item = this.itemsData.get(id), var item = this.itemsData.get(id),
dataset = this._myDataSet(); dataset = this._myDataSet();
@ -542,7 +542,7 @@ ItemSet.prototype.removeItem = function removeItem (id) {
* @param {Number[]} ids * @param {Number[]} ids
* @protected * @protected
*/ */
ItemSet.prototype._onUpdate = function _onUpdate(ids) {
ItemSet.prototype._onUpdate = function(ids) {
var me = this, var me = this,
items = this.items, items = this.items,
itemOptions = this.itemOptions; itemOptions = this.itemOptions;
@ -599,7 +599,7 @@ ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate;
* @param {Number[]} ids * @param {Number[]} ids
* @protected * @protected
*/ */
ItemSet.prototype._onRemove = function _onRemove(ids) {
ItemSet.prototype._onRemove = function(ids) {
var count = 0; var count = 0;
var me = this; var me = this;
ids.forEach(function (id) { ids.forEach(function (id) {
@ -622,7 +622,7 @@ ItemSet.prototype._onRemove = function _onRemove(ids) {
* Update the order of item in all groups * Update the order of item in all groups
* @private * @private
*/ */
ItemSet.prototype._order = function _order() {
ItemSet.prototype._order = function() {
// reorder the items in all groups // reorder the items in all groups
// TODO: optimization: only reorder groups affected by the changed items // TODO: optimization: only reorder groups affected by the changed items
util.forEach(this.groups, function (group) { util.forEach(this.groups, function (group) {
@ -635,7 +635,7 @@ ItemSet.prototype._order = function _order() {
* @param {Number[]} ids * @param {Number[]} ids
* @private * @private
*/ */
ItemSet.prototype._onUpdateGroups = function _onUpdateGroups(ids) {
ItemSet.prototype._onUpdateGroups = function(ids) {
this._onAddGroups(ids); this._onAddGroups(ids);
}; };
@ -644,7 +644,7 @@ ItemSet.prototype._onUpdateGroups = function _onUpdateGroups(ids) {
* @param {Number[]} ids * @param {Number[]} ids
* @private * @private
*/ */
ItemSet.prototype._onAddGroups = function _onAddGroups(ids) {
ItemSet.prototype._onAddGroups = function(ids) {
var me = this; var me = this;
ids.forEach(function (id) { ids.forEach(function (id) {
@ -692,7 +692,7 @@ ItemSet.prototype._onAddGroups = function _onAddGroups(ids) {
* @param {Number[]} ids * @param {Number[]} ids
* @private * @private
*/ */
ItemSet.prototype._onRemoveGroups = function _onRemoveGroups(ids) {
ItemSet.prototype._onRemoveGroups = function(ids) {
var groups = this.groups; var groups = this.groups;
ids.forEach(function (id) { ids.forEach(function (id) {
var group = groups[id]; var group = groups[id];
@ -748,7 +748,7 @@ ItemSet.prototype._orderGroups = function () {
* @param {Item} item * @param {Item} item
* @private * @private
*/ */
ItemSet.prototype._addItem = function _addItem(item) {
ItemSet.prototype._addItem = function(item) {
this.items[item.id] = item; this.items[item.id] = item;
// add to group // add to group
@ -763,7 +763,7 @@ ItemSet.prototype._addItem = function _addItem(item) {
* @param {Object} itemData * @param {Object} itemData
* @private * @private
*/ */
ItemSet.prototype._updateItem = function _updateItem(item, itemData) {
ItemSet.prototype._updateItem = function(item, itemData) {
var oldGroupId = item.data.group; var oldGroupId = item.data.group;
item.data = itemData; item.data = itemData;
@ -788,7 +788,7 @@ ItemSet.prototype._updateItem = function _updateItem(item, itemData) {
* @param {Item} item * @param {Item} item
* @private * @private
*/ */
ItemSet.prototype._removeItem = function _removeItem(item) {
ItemSet.prototype._removeItem = function(item) {
// remove from DOM // remove from DOM
item.hide(); item.hide();
@ -811,7 +811,7 @@ ItemSet.prototype._removeItem = function _removeItem(item) {
* @returns {Array} * @returns {Array}
* @private * @private
*/ */
ItemSet.prototype._constructByEndArray = function _constructByEndArray(array) {
ItemSet.prototype._constructByEndArray = function(array) {
var endArray = []; var endArray = [];
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
@ -1145,7 +1145,7 @@ ItemSet.prototype._onMultiSelectItem = function (event) {
* @param {Event} event * @param {Event} event
* @return {Item | null} item * @return {Item | null} item
*/ */
ItemSet.itemFromTarget = function itemFromTarget (event) {
ItemSet.itemFromTarget = function(event) {
var target = event.target; var target = event.target;
while (target) { while (target) {
if (target.hasOwnProperty('timeline-item')) { if (target.hasOwnProperty('timeline-item')) {
@ -1163,7 +1163,7 @@ ItemSet.itemFromTarget = function itemFromTarget (event) {
* @param {Event} event * @param {Event} event
* @return {Group | null} group * @return {Group | null} group
*/ */
ItemSet.groupFromTarget = function groupFromTarget (event) {
ItemSet.groupFromTarget = function(event) {
var target = event.target; var target = event.target;
while (target) { while (target) {
if (target.hasOwnProperty('timeline-group')) { if (target.hasOwnProperty('timeline-group')) {
@ -1181,7 +1181,7 @@ ItemSet.groupFromTarget = function groupFromTarget (event) {
* @param {Event} event * @param {Event} event
* @return {ItemSet | null} item * @return {ItemSet | null} item
*/ */
ItemSet.itemSetFromTarget = function itemSetFromTarget (event) {
ItemSet.itemSetFromTarget = function(event) {
var target = event.target; var target = event.target;
while (target) { while (target) {
if (target.hasOwnProperty('timeline-itemset')) { if (target.hasOwnProperty('timeline-itemset')) {
@ -1198,7 +1198,7 @@ ItemSet.itemSetFromTarget = function itemSetFromTarget (event) {
* @returns {null | DataSet} dataset * @returns {null | DataSet} dataset
* @private * @private
*/ */
ItemSet.prototype._myDataSet = function _myDataSet() {
ItemSet.prototype._myDataSet = function() {
// find the root DataSet // find the root DataSet
var dataset = this.itemsData; var dataset = this.itemsData;
while (dataset instanceof DataView) { while (dataset instanceof DataView) {

+ 3
- 3
src/timeline/component/TimeAxis.js View File

@ -29,7 +29,7 @@ function TimeAxis (timeline, options) {
lineTop: 0 lineTop: 0
}; };
this.options = options || {};
this.options = Object.create(options) || {};
this.defaultOptions = { this.defaultOptions = {
orientation: 'bottom', // supported: 'top', 'bottom' orientation: 'bottom', // supported: 'top', 'bottom'
// TODO: implement timeaxis orientations 'left' and 'right' // TODO: implement timeaxis orientations 'left' and 'right'
@ -58,7 +58,7 @@ TimeAxis.prototype.setOptions = Component.prototype.setOptions;
/** /**
* Create the HTML DOM for the TimeAxis * Create the HTML DOM for the TimeAxis
*/ */
TimeAxis.prototype._create = function _create() {
TimeAxis.prototype._create = function() {
this.dom.foreground = document.createElement('div'); this.dom.foreground = document.createElement('div');
this.dom.background = document.createElement('div'); this.dom.background = document.createElement('div');
@ -376,6 +376,6 @@ TimeAxis.prototype._calculateCharSize = function () {
* @param {Date} date the date to be snapped. * @param {Date} date the date to be snapped.
* @return {Date} snappedDate * @return {Date} snappedDate
*/ */
TimeAxis.prototype.snap = function snap (date) {
TimeAxis.prototype.snap = function(date) {
return this.step.snap(date); return this.step.snap(date);
}; };

+ 9
- 9
src/timeline/component/item/Item.js View File

@ -27,7 +27,7 @@ function Item (data, options, defaultOptions) {
/** /**
* Select current item * Select current item
*/ */
Item.prototype.select = function select() {
Item.prototype.select = function() {
this.selected = true; this.selected = true;
if (this.displayed) this.redraw(); if (this.displayed) this.redraw();
}; };
@ -35,7 +35,7 @@ Item.prototype.select = function select() {
/** /**
* Unselect current item * Unselect current item
*/ */
Item.prototype.unselect = function unselect() {
Item.prototype.unselect = function() {
this.selected = false; this.selected = false;
if (this.displayed) this.redraw(); if (this.displayed) this.redraw();
}; };
@ -44,7 +44,7 @@ Item.prototype.unselect = function unselect() {
* Set a parent for the item * Set a parent for the item
* @param {ItemSet | Group} parent * @param {ItemSet | Group} parent
*/ */
Item.prototype.setParent = function setParent(parent) {
Item.prototype.setParent = function(parent) {
if (this.displayed) { if (this.displayed) {
this.hide(); this.hide();
this.parent = parent; this.parent = parent;
@ -62,7 +62,7 @@ Item.prototype.setParent = function setParent(parent) {
* @returns {{start: Number, end: Number}} range with a timestamp for start and end * @returns {{start: Number, end: Number}} range with a timestamp for start and end
* @returns {boolean} True if visible * @returns {boolean} True if visible
*/ */
Item.prototype.isVisible = function isVisible (range) {
Item.prototype.isVisible = function(range) {
// Should be implemented by Item implementations // Should be implemented by Item implementations
return false; return false;
}; };
@ -71,7 +71,7 @@ Item.prototype.isVisible = function isVisible (range) {
* Show the Item in the DOM (when not already visible) * Show the Item in the DOM (when not already visible)
* @return {Boolean} changed * @return {Boolean} changed
*/ */
Item.prototype.show = function show() {
Item.prototype.show = function() {
return false; return false;
}; };
@ -79,28 +79,28 @@ Item.prototype.show = function show() {
* Hide the Item from the DOM (when visible) * Hide the Item from the DOM (when visible)
* @return {Boolean} changed * @return {Boolean} changed
*/ */
Item.prototype.hide = function hide() {
Item.prototype.hide = function() {
return false; return false;
}; };
/** /**
* Repaint the item * Repaint the item
*/ */
Item.prototype.redraw = function redraw() {
Item.prototype.redraw = function() {
// should be implemented by the item // should be implemented by the item
}; };
/** /**
* Reposition the Item horizontally * Reposition the Item horizontally
*/ */
Item.prototype.repositionX = function repositionX() {
Item.prototype.repositionX = function() {
// should be implemented by the item // should be implemented by the item
}; };
/** /**
* Reposition the Item vertically * Reposition the Item vertically
*/ */
Item.prototype.repositionY = function repositionY() {
Item.prototype.repositionY = function() {
// should be implemented by the item // should be implemented by the item
}; };

+ 6
- 6
src/timeline/component/item/ItemBox.js View File

@ -36,7 +36,7 @@ ItemBox.prototype = new Item (null);
* @returns {{start: Number, end: Number}} range with a timestamp for start and end * @returns {{start: Number, end: Number}} range with a timestamp for start and end
* @returns {boolean} True if visible * @returns {boolean} True if visible
*/ */
ItemBox.prototype.isVisible = function isVisible (range) {
ItemBox.prototype.isVisible = function(range) {
// determine visibility // determine visibility
// TODO: account for the real width of the item. Right now we just add 1/4 to the window // TODO: account for the real width of the item. Right now we just add 1/4 to the window
var interval = (range.end - range.start) / 4; var interval = (range.end - range.start) / 4;
@ -46,7 +46,7 @@ ItemBox.prototype.isVisible = function isVisible (range) {
/** /**
* Repaint the item * Repaint the item
*/ */
ItemBox.prototype.redraw = function redraw() {
ItemBox.prototype.redraw = function() {
var dom = this.dom; var dom = this.dom;
if (!dom) { if (!dom) {
// create DOM // create DOM
@ -141,7 +141,7 @@ ItemBox.prototype.redraw = function redraw() {
* Show the item in the DOM (when not already displayed). The items DOM will * Show the item in the DOM (when not already displayed). The items DOM will
* be created when needed. * be created when needed.
*/ */
ItemBox.prototype.show = function show() {
ItemBox.prototype.show = function() {
if (!this.displayed) { if (!this.displayed) {
this.redraw(); this.redraw();
} }
@ -150,7 +150,7 @@ ItemBox.prototype.show = function show() {
/** /**
* Hide the item from the DOM (when visible) * Hide the item from the DOM (when visible)
*/ */
ItemBox.prototype.hide = function hide() {
ItemBox.prototype.hide = function() {
if (this.displayed) { if (this.displayed) {
var dom = this.dom; var dom = this.dom;
@ -169,7 +169,7 @@ ItemBox.prototype.hide = function hide() {
* Reposition the item horizontally * Reposition the item horizontally
* @Override * @Override
*/ */
ItemBox.prototype.repositionX = function repositionX() {
ItemBox.prototype.repositionX = function() {
var start = this.defaultOptions.toScreen(this.data.start), var start = this.defaultOptions.toScreen(this.data.start),
align = this.options.align || this.defaultOptions.align, align = this.options.align || this.defaultOptions.align,
left, left,
@ -203,7 +203,7 @@ ItemBox.prototype.repositionX = function repositionX() {
* Reposition the item vertically * Reposition the item vertically
* @Override * @Override
*/ */
ItemBox.prototype.repositionY = function repositionY () {
ItemBox.prototype.repositionY = function() {
var orientation = this.options.orientation || this.defaultOptions.orientation, var orientation = this.options.orientation || this.defaultOptions.orientation,
box = this.dom.box, box = this.dom.box,
line = this.dom.line, line = this.dom.line,

+ 6
- 6
src/timeline/component/item/ItemPoint.js View File

@ -37,7 +37,7 @@ ItemPoint.prototype = new Item (null);
* @returns {{start: Number, end: Number}} range with a timestamp for start and end * @returns {{start: Number, end: Number}} range with a timestamp for start and end
* @returns {boolean} True if visible * @returns {boolean} True if visible
*/ */
ItemPoint.prototype.isVisible = function isVisible (range) {
ItemPoint.prototype.isVisible = function(range) {
// determine visibility // determine visibility
// TODO: account for the real width of the item. Right now we just add 1/4 to the window // TODO: account for the real width of the item. Right now we just add 1/4 to the window
var interval = (range.end - range.start) / 4; var interval = (range.end - range.start) / 4;
@ -47,7 +47,7 @@ ItemPoint.prototype.isVisible = function isVisible (range) {
/** /**
* Repaint the item * Repaint the item
*/ */
ItemPoint.prototype.redraw = function redraw() {
ItemPoint.prototype.redraw = function() {
var dom = this.dom; var dom = this.dom;
if (!dom) { if (!dom) {
// create DOM // create DOM
@ -137,7 +137,7 @@ ItemPoint.prototype.redraw = function redraw() {
* Show the item in the DOM (when not already visible). The items DOM will * Show the item in the DOM (when not already visible). The items DOM will
* be created when needed. * be created when needed.
*/ */
ItemPoint.prototype.show = function show() {
ItemPoint.prototype.show = function() {
if (!this.displayed) { if (!this.displayed) {
this.redraw(); this.redraw();
} }
@ -146,7 +146,7 @@ ItemPoint.prototype.show = function show() {
/** /**
* Hide the item from the DOM (when visible) * Hide the item from the DOM (when visible)
*/ */
ItemPoint.prototype.hide = function hide() {
ItemPoint.prototype.hide = function() {
if (this.displayed) { if (this.displayed) {
if (this.dom.point.parentNode) { if (this.dom.point.parentNode) {
this.dom.point.parentNode.removeChild(this.dom.point); this.dom.point.parentNode.removeChild(this.dom.point);
@ -163,7 +163,7 @@ ItemPoint.prototype.hide = function hide() {
* Reposition the item horizontally * Reposition the item horizontally
* @Override * @Override
*/ */
ItemPoint.prototype.repositionX = function repositionX() {
ItemPoint.prototype.repositionX = function() {
var start = this.defaultOptions.toScreen(this.data.start); var start = this.defaultOptions.toScreen(this.data.start);
this.left = start - this.props.dot.width; this.left = start - this.props.dot.width;
@ -176,7 +176,7 @@ ItemPoint.prototype.repositionX = function repositionX() {
* Reposition the item vertically * Reposition the item vertically
* @Override * @Override
*/ */
ItemPoint.prototype.repositionY = function repositionY () {
ItemPoint.prototype.repositionY = function() {
var orientation = this.options.orientation || this.defaultOptions.orientation, var orientation = this.options.orientation || this.defaultOptions.orientation,
point = this.dom.point; point = this.dom.point;

+ 6
- 6
src/timeline/component/item/ItemRange.js View File

@ -36,7 +36,7 @@ ItemRange.prototype.baseClassName = 'item range';
* @returns {{start: Number, end: Number}} range with a timestamp for start and end * @returns {{start: Number, end: Number}} range with a timestamp for start and end
* @returns {boolean} True if visible * @returns {boolean} True if visible
*/ */
ItemRange.prototype.isVisible = function isVisible (range) {
ItemRange.prototype.isVisible = function(range) {
// determine visibility // determine visibility
return (this.data.start < range.end) && (this.data.end > range.start); return (this.data.start < range.end) && (this.data.end > range.start);
}; };
@ -44,7 +44,7 @@ ItemRange.prototype.isVisible = function isVisible (range) {
/** /**
* Repaint the item * Repaint the item
*/ */
ItemRange.prototype.redraw = function redraw() {
ItemRange.prototype.redraw = function() {
var dom = this.dom; var dom = this.dom;
if (!dom) { if (!dom) {
// create DOM // create DOM
@ -121,7 +121,7 @@ ItemRange.prototype.redraw = function redraw() {
* Show the item in the DOM (when not already visible). The items DOM will * Show the item in the DOM (when not already visible). The items DOM will
* be created when needed. * be created when needed.
*/ */
ItemRange.prototype.show = function show() {
ItemRange.prototype.show = function() {
if (!this.displayed) { if (!this.displayed) {
this.redraw(); this.redraw();
} }
@ -131,7 +131,7 @@ ItemRange.prototype.show = function show() {
* Hide the item from the DOM (when visible) * Hide the item from the DOM (when visible)
* @return {Boolean} changed * @return {Boolean} changed
*/ */
ItemRange.prototype.hide = function hide() {
ItemRange.prototype.hide = function() {
if (this.displayed) { if (this.displayed) {
var box = this.dom.box; var box = this.dom.box;
@ -150,7 +150,7 @@ ItemRange.prototype.hide = function hide() {
* Reposition the item horizontally * Reposition the item horizontally
* @Override * @Override
*/ */
ItemRange.prototype.repositionX = function repositionX() {
ItemRange.prototype.repositionX = function() {
var props = this.props, var props = this.props,
parentWidth = this.parent.width, parentWidth = this.parent.width,
start = this.defaultOptions.toScreen(this.data.start), start = this.defaultOptions.toScreen(this.data.start),
@ -188,7 +188,7 @@ ItemRange.prototype.repositionX = function repositionX() {
* Reposition the item vertically * Reposition the item vertically
* @Override * @Override
*/ */
ItemRange.prototype.repositionY = function repositionY() {
ItemRange.prototype.repositionY = function() {
var orientation = this.options.orientation || this.defaultOptions.orientation, var orientation = this.options.orientation || this.defaultOptions.orientation,
box = this.dom.box; box = this.dom.box;

+ 1
- 1
src/timeline/component/item/ItemRangeOverflow.js View File

@ -26,7 +26,7 @@ ItemRangeOverflow.prototype.baseClassName = 'item rangeoverflow';
* Reposition the item horizontally * Reposition the item horizontally
* @Override * @Override
*/ */
ItemRangeOverflow.prototype.repositionX = function repositionX() {
ItemRangeOverflow.prototype.repositionX = function() {
var parentWidth = this.parent.width, var parentWidth = this.parent.width,
start = this.defaultOptions.toScreen(this.data.start), start = this.defaultOptions.toScreen(this.data.start),
end = this.defaultOptions.toScreen(this.data.end), end = this.defaultOptions.toScreen(this.data.end),

+ 5
- 5
src/timeline/stack.js View File

@ -7,7 +7,7 @@ var stack = {};
* Order items by their start data * Order items by their start data
* @param {Item[]} items * @param {Item[]} items
*/ */
stack.orderByStart = function orderByStart(items) {
stack.orderByStart = function(items) {
items.sort(function (a, b) { items.sort(function (a, b) {
return a.data.start - b.data.start; return a.data.start - b.data.start;
}); });
@ -18,7 +18,7 @@ stack.orderByStart = function orderByStart(items) {
* is used. * is used.
* @param {Item[]} items * @param {Item[]} items
*/ */
stack.orderByEnd = function orderByEnd(items) {
stack.orderByEnd = function(items) {
items.sort(function (a, b) { items.sort(function (a, b) {
var aTime = ('end' in a.data) ? a.data.end : a.data.start, var aTime = ('end' in a.data) ? a.data.end : a.data.start,
bTime = ('end' in b.data) ? b.data.end : b.data.start; bTime = ('end' in b.data) ? b.data.end : b.data.start;
@ -38,7 +38,7 @@ stack.orderByEnd = function orderByEnd(items) {
* If true, all items will be repositioned. If false (default), only * If true, all items will be repositioned. If false (default), only
* items having a top===null will be re-stacked * items having a top===null will be re-stacked
*/ */
stack.stack = function _stack (items, margin, force) {
stack.stack = function(items, margin, force) {
var i, iMax; var i, iMax;
if (force) { if (force) {
@ -83,7 +83,7 @@ stack.stack = function _stack (items, margin, force) {
* @param {{item: number, axis: number}} margin * @param {{item: number, axis: number}} margin
* Margins between items and between items and the axis. * Margins between items and between items and the axis.
*/ */
stack.nostack = function nostack (items, margin) {
stack.nostack = function(items, margin) {
var i, iMax; var i, iMax;
// reset top position of all items // reset top position of all items
@ -104,7 +104,7 @@ stack.nostack = function nostack (items, margin) {
* the requested margin. * the requested margin.
* @return {boolean} true if a and b collide, else false * @return {boolean} true if a and b collide, else false
*/ */
stack.collision = function collision (a, b, margin) {
stack.collision = function(a, b, margin) {
return ((a.left - margin) < (b.left + b.width) && return ((a.left - margin) < (b.left + b.width) &&
(a.left + a.width + margin) > b.left && (a.left + a.width + margin) > b.left &&
(a.top - margin) < (b.top + b.height) && (a.top - margin) < (b.top + b.height) &&

+ 32
- 32
src/util.js View File

@ -8,7 +8,7 @@ var util = {};
* @param {*} object * @param {*} object
* @return {Boolean} isNumber * @return {Boolean} isNumber
*/ */
util.isNumber = function isNumber(object) {
util.isNumber = function(object) {
return (object instanceof Number || typeof object == 'number'); return (object instanceof Number || typeof object == 'number');
}; };
@ -17,7 +17,7 @@ util.isNumber = function isNumber(object) {
* @param {*} object * @param {*} object
* @return {Boolean} isString * @return {Boolean} isString
*/ */
util.isString = function isString(object) {
util.isString = function(object) {
return (object instanceof String || typeof object == 'string'); return (object instanceof String || typeof object == 'string');
}; };
@ -26,7 +26,7 @@ util.isString = function isString(object) {
* @param {Date | String} object * @param {Date | String} object
* @return {Boolean} isDate * @return {Boolean} isDate
*/ */
util.isDate = function isDate(object) {
util.isDate = function(object) {
if (object instanceof Date) { if (object instanceof Date) {
return true; return true;
} }
@ -49,7 +49,7 @@ util.isDate = function isDate(object) {
* @param {*} object * @param {*} object
* @return {Boolean} isDataTable * @return {Boolean} isDataTable
*/ */
util.isDataTable = function isDataTable(object) {
util.isDataTable = function(object) {
return (typeof (google) !== 'undefined') && return (typeof (google) !== 'undefined') &&
(google.visualization) && (google.visualization) &&
(google.visualization.DataTable) && (google.visualization.DataTable) &&
@ -61,7 +61,7 @@ util.isDataTable = function isDataTable(object) {
* source: http://stackoverflow.com/a/105074/1262753 * source: http://stackoverflow.com/a/105074/1262753
* @return {String} uuid * @return {String} uuid
*/ */
util.randomUUID = function randomUUID () {
util.randomUUID = function() {
var S4 = function () { var S4 = function () {
return Math.floor( return Math.floor(
Math.random() * 0x10000 /* 65536 */ Math.random() * 0x10000 /* 65536 */
@ -103,7 +103,7 @@ util.extend = function (a, b) {
* @param {Object} b * @param {Object} b
* @returns {Object} * @returns {Object}
*/ */
util.deepExtend = function deepExtend (a, b) {
util.deepExtend = function(a, b) {
// TODO: add support for Arrays to deepExtend // TODO: add support for Arrays to deepExtend
if (Array.isArray(b)) { if (Array.isArray(b)) {
throw new TypeError('Arrays are not supported by deepExtend'); throw new TypeError('Arrays are not supported by deepExtend');
@ -116,7 +116,7 @@ util.deepExtend = function deepExtend (a, b) {
a[prop] = {}; a[prop] = {};
} }
if (a[prop].constructor === Object) { if (a[prop].constructor === Object) {
deepExtend(a[prop], b[prop]);
util.deepExtend(a[prop], b[prop]);
} }
else { else {
a[prop] = b[prop]; a[prop] = b[prop];
@ -157,7 +157,7 @@ util.equalArray = function (a, b) {
* @return {*} object * @return {*} object
* @throws Error * @throws Error
*/ */
util.convert = function convert(object, type) {
util.convert = function(object, type) {
var match; var match;
if (object === undefined) { if (object === undefined) {
@ -307,7 +307,7 @@ var ASPDateRegex = /^\/?Date\((\-?\d+)/i;
* @param {*} object * @param {*} object
* @return {String} type * @return {String} type
*/ */
util.getType = function getType(object) {
util.getType = function(object) {
var type = typeof object; var type = typeof object;
if (type == 'object') { if (type == 'object') {
@ -350,7 +350,7 @@ util.getType = function getType(object) {
* @return {number} left The absolute left position of this element * @return {number} left The absolute left position of this element
* in the browser page. * in the browser page.
*/ */
util.getAbsoluteLeft = function getAbsoluteLeft (elem) {
util.getAbsoluteLeft = function(elem) {
var doc = document.documentElement; var doc = document.documentElement;
var body = document.body; var body = document.body;
@ -370,7 +370,7 @@ util.getAbsoluteLeft = function getAbsoluteLeft (elem) {
* @return {number} top The absolute top position of this element * @return {number} top The absolute top position of this element
* in the browser page. * in the browser page.
*/ */
util.getAbsoluteTop = function getAbsoluteTop (elem) {
util.getAbsoluteTop = function(elem) {
var doc = document.documentElement; var doc = document.documentElement;
var body = document.body; var body = document.body;
@ -389,7 +389,7 @@ util.getAbsoluteTop = function getAbsoluteTop (elem) {
* @param {Event} event * @param {Event} event
* @return {Number} pageY * @return {Number} pageY
*/ */
util.getPageY = function getPageY (event) {
util.getPageY = function(event) {
if ('pageY' in event) { if ('pageY' in event) {
return event.pageY; return event.pageY;
} }
@ -415,7 +415,7 @@ util.getPageY = function getPageY (event) {
* @param {Event} event * @param {Event} event
* @return {Number} pageX * @return {Number} pageX
*/ */
util.getPageX = function getPageX (event) {
util.getPageX = function(event) {
if ('pageY' in event) { if ('pageY' in event) {
return event.pageX; return event.pageX;
} }
@ -441,7 +441,7 @@ util.getPageX = function getPageX (event) {
* @param {Element} elem * @param {Element} elem
* @param {String} className * @param {String} className
*/ */
util.addClassName = function addClassName(elem, className) {
util.addClassName = function(elem, className) {
var classes = elem.className.split(' '); var classes = elem.className.split(' ');
if (classes.indexOf(className) == -1) { if (classes.indexOf(className) == -1) {
classes.push(className); // add the class to the array classes.push(className); // add the class to the array
@ -454,7 +454,7 @@ util.addClassName = function addClassName(elem, className) {
* @param {Element} elem * @param {Element} elem
* @param {String} className * @param {String} className
*/ */
util.removeClassName = function removeClassname(elem, className) {
util.removeClassName = function(elem, className) {
var classes = elem.className.split(' '); var classes = elem.className.split(' ');
var index = classes.indexOf(className); var index = classes.indexOf(className);
if (index != -1) { if (index != -1) {
@ -472,7 +472,7 @@ util.removeClassName = function removeClassname(elem, className) {
* the object or array with three parameters: * the object or array with three parameters:
* callback(value, index, object) * callback(value, index, object)
*/ */
util.forEach = function forEach (object, callback) {
util.forEach = function(object, callback) {
var i, var i,
len; len;
if (object instanceof Array) { if (object instanceof Array) {
@ -497,7 +497,7 @@ util.forEach = function forEach (object, callback) {
* @param {Object} object * @param {Object} object
* @param {Array} array * @param {Array} array
*/ */
util.toArray = function toArray(object) {
util.toArray = function(object) {
var array = []; var array = [];
for (var prop in object) { for (var prop in object) {
@ -514,7 +514,7 @@ util.toArray = function toArray(object) {
* @param {*} value * @param {*} value
* @return {Boolean} changed * @return {Boolean} changed
*/ */
util.updateProperty = function updateProperty (object, key, value) {
util.updateProperty = function(object, key, value) {
if (object[key] !== value) { if (object[key] !== value) {
object[key] = value; object[key] = value;
return true; return true;
@ -532,7 +532,7 @@ util.updateProperty = function updateProperty (object, key, value) {
* @param {function} listener The callback function to be executed * @param {function} listener The callback function to be executed
* @param {boolean} [useCapture] * @param {boolean} [useCapture]
*/ */
util.addEventListener = function addEventListener(element, action, listener, useCapture) {
util.addEventListener = function(element, action, listener, useCapture) {
if (element.addEventListener) { if (element.addEventListener) {
if (useCapture === undefined) if (useCapture === undefined)
useCapture = false; useCapture = false;
@ -554,7 +554,7 @@ util.addEventListener = function addEventListener(element, action, listener, use
* @param {function} listener The listener function * @param {function} listener The listener function
* @param {boolean} [useCapture] * @param {boolean} [useCapture]
*/ */
util.removeEventListener = function removeEventListener(element, action, listener, useCapture) {
util.removeEventListener = function(element, action, listener, useCapture) {
if (element.removeEventListener) { if (element.removeEventListener) {
// non-IE browsers // non-IE browsers
if (useCapture === undefined) if (useCapture === undefined)
@ -577,7 +577,7 @@ util.removeEventListener = function removeEventListener(element, action, listene
* @param {Event} event * @param {Event} event
* @return {Element} target element * @return {Element} target element
*/ */
util.getTarget = function getTarget(event) {
util.getTarget = function(event) {
// code from http://www.quirksmode.org/js/events_properties.html // code from http://www.quirksmode.org/js/events_properties.html
if (!event) { if (!event) {
event = window.event; event = window.event;
@ -605,7 +605,7 @@ util.getTarget = function getTarget(event) {
* @param {Element} element * @param {Element} element
* @param {Event} event * @param {Event} event
*/ */
util.fakeGesture = function fakeGesture (element, event) {
util.fakeGesture = function(element, event) {
var eventType = null; var eventType = null;
// for hammer.js 1.0.5 // for hammer.js 1.0.5
@ -721,7 +721,7 @@ util.option.asElement = function (value, defaultValue) {
util.GiveDec = function GiveDec(Hex) {
util.GiveDec = function(Hex) {
var Value; var Value;
if (Hex == "A") if (Hex == "A")
@ -742,7 +742,7 @@ util.GiveDec = function GiveDec(Hex) {
return Value; return Value;
}; };
util.GiveHex = function GiveHex(Dec) {
util.GiveHex = function(Dec) {
var Value; var Value;
if(Dec == 10) if(Dec == 10)
@ -846,7 +846,7 @@ util.parseColor = function(color) {
* @param {String} hex * @param {String} hex
* @returns {{r: *, g: *, b: *}} * @returns {{r: *, g: *, b: *}}
*/ */
util.hexToRGB = function hexToRGB(hex) {
util.hexToRGB = function(hex) {
hex = hex.replace("#","").toUpperCase(); hex = hex.replace("#","").toUpperCase();
var a = util.GiveDec(hex.substring(0, 1)); var a = util.GiveDec(hex.substring(0, 1));
@ -863,7 +863,7 @@ util.hexToRGB = function hexToRGB(hex) {
return {r:r,g:g,b:b}; return {r:r,g:g,b:b};
}; };
util.RGBToHex = function RGBToHex(red,green,blue) {
util.RGBToHex = function(red,green,blue) {
var a = util.GiveHex(Math.floor(red / 16)); var a = util.GiveHex(Math.floor(red / 16));
var b = util.GiveHex(red % 16); var b = util.GiveHex(red % 16);
var c = util.GiveHex(Math.floor(green / 16)); var c = util.GiveHex(Math.floor(green / 16));
@ -885,7 +885,7 @@ util.RGBToHex = function RGBToHex(red,green,blue) {
* @returns {*} * @returns {*}
* @constructor * @constructor
*/ */
util.RGBToHSV = function RGBToHSV (red,green,blue) {
util.RGBToHSV = function(red,green,blue) {
red=red/255; green=green/255; blue=blue/255; red=red/255; green=green/255; blue=blue/255;
var minRGB = Math.min(red,Math.min(green,blue)); var minRGB = Math.min(red,Math.min(green,blue));
var maxRGB = Math.max(red,Math.max(green,blue)); var maxRGB = Math.max(red,Math.max(green,blue));
@ -913,7 +913,7 @@ util.RGBToHSV = function RGBToHSV (red,green,blue) {
* @returns {{r: number, g: number, b: number}} * @returns {{r: number, g: number, b: number}}
* @constructor * @constructor
*/ */
util.HSVToRGB = function HSVToRGB(h, s, v) {
util.HSVToRGB = function(h, s, v) {
var r, g, b; var r, g, b;
var i = Math.floor(h * 6); var i = Math.floor(h * 6);
@ -934,22 +934,22 @@ util.HSVToRGB = function HSVToRGB(h, s, v) {
return {r:Math.floor(r * 255), g:Math.floor(g * 255), b:Math.floor(b * 255) }; return {r:Math.floor(r * 255), g:Math.floor(g * 255), b:Math.floor(b * 255) };
}; };
util.HSVToHex = function HSVToHex(h, s, v) {
util.HSVToHex = function(h, s, v) {
var rgb = util.HSVToRGB(h, s, v); var rgb = util.HSVToRGB(h, s, v);
return util.RGBToHex(rgb.r, rgb.g, rgb.b); return util.RGBToHex(rgb.r, rgb.g, rgb.b);
}; };
util.hexToHSV = function hexToHSV(hex) {
util.hexToHSV = function(hex) {
var rgb = util.hexToRGB(hex); var rgb = util.hexToRGB(hex);
return util.RGBToHSV(rgb.r, rgb.g, rgb.b); return util.RGBToHSV(rgb.r, rgb.g, rgb.b);
}; };
util.isValidHex = function isValidHex(hex) {
util.isValidHex = function(hex) {
var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex); var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(hex);
return isOk; return isOk;
}; };
util.copyObject = function copyObject(objectFrom, objectTo) {
util.copyObject = function(objectFrom, objectTo) {
for (var i in objectFrom) { for (var i in objectFrom) {
if (objectFrom.hasOwnProperty(i)) { if (objectFrom.hasOwnProperty(i)) {
if (typeof objectFrom[i] == "object") { if (typeof objectFrom[i] == "object") {

Loading…
Cancel
Save