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
* {String | Number} senderId
*/
DataSet.prototype.on = function on (event, callback) {
DataSet.prototype.on = function(event, callback) {
var subscribers = this.subscribers[event];
if (!subscribers) {
subscribers = [];
@ -103,7 +103,7 @@ DataSet.prototype.subscribe = DataSet.prototype.on;
* @param {String} event
* @param {function} callback
*/
DataSet.prototype.off = function off(event, callback) {
DataSet.prototype.off = function(event, callback) {
var subscribers = this.subscribers[event];
if (subscribers) {
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} [height]
*/
Component.prototype.setOptions = function setOptions(options) {
Component.prototype.setOptions = function(options) {
if (options) {
util.extend(this.options, options);
@ -31,7 +31,7 @@ Component.prototype.setOptions = function setOptions(options) {
* @param {String} name
* @return {*} value
*/
Component.prototype.getOption = function getOption(name) {
Component.prototype.getOption = function(name) {
var value;
if (this.options) {
value = this.options[name];
@ -46,7 +46,7 @@ Component.prototype.getOption = function getOption(name) {
* Repaint the component
* @return {boolean} Returns true if the component is resized
*/
Component.prototype.redraw = function redraw() {
Component.prototype.redraw = function() {
// should be implemented by the component
return false;
};
@ -57,7 +57,7 @@ Component.prototype.redraw = function redraw() {
* @return {Boolean} Returns true if the component is resized
* @protected
*/
Component.prototype._isResized = function _isResized() {
Component.prototype._isResized = function() {
var resized = (this.props._previousWidth !== this.props.width ||
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
* @private
*/
CurrentTime.prototype._create = function _create () {
CurrentTime.prototype._create = function() {
var bar = document.createElement('div');
bar.className = 'currenttime';
bar.style.position = 'absolute';
@ -35,7 +35,7 @@ CurrentTime.prototype._create = function _create () {
* Repaint the component
* @return {boolean} Returns true if the component is resized
*/
CurrentTime.prototype.redraw = function redraw() {
CurrentTime.prototype.redraw = function() {
if (this.options.showCurrentTime) {
var parent = this.timeline.dom.backgroundVertical;
if (this.bar.parentNode != parent) {
@ -68,7 +68,7 @@ CurrentTime.prototype.redraw = function redraw() {
/**
* Start auto refreshing the current time bar
*/
CurrentTime.prototype.start = function start() {
CurrentTime.prototype.start = function() {
var me = this;
function update () {
@ -92,7 +92,7 @@ CurrentTime.prototype.start = function start() {
/**
* Stop auto refreshing the current time bar
*/
CurrentTime.prototype.stop = function stop() {
CurrentTime.prototype.stop = function() {
if (this.currentTimeTimer !== undefined) {
clearTimeout(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
* @private
*/
CustomTime.prototype._create = function _create () {
CustomTime.prototype._create = function() {
var bar = document.createElement('div');
bar.className = 'customtime';
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
* @param {Object} data Group data, can contain properties content and className
*/
Group.prototype.setData = function setData(data) {
Group.prototype.setData = function(data) {
// update contents
var content = data && data.content;
if (content instanceof Element) {
@ -96,7 +96,7 @@ Group.prototype.setData = function setData(data) {
* Get the width of the group label
* @return {number} width
*/
Group.prototype.getLabelWidth = function getLabelWidth() {
Group.prototype.getLabelWidth = function() {
return this.props.label.width;
};
@ -108,7 +108,7 @@ Group.prototype.getLabelWidth = function getLabelWidth() {
* @param {boolean} [restack=false] Force restacking of all items
* @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;
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
*/
Group.prototype.show = function show() {
Group.prototype.show = function() {
if (!this.dom.label.parentNode) {
this.itemSet.dom.labelSet.appendChild(this.dom.label);
}
@ -200,7 +200,7 @@ Group.prototype.show = function show() {
/**
* Hide this group: remove from the DOM
*/
Group.prototype.hide = function hide() {
Group.prototype.hide = function() {
var label = this.dom.label;
if (label.parentNode) {
label.parentNode.removeChild(label);
@ -226,7 +226,7 @@ Group.prototype.hide = function hide() {
* Add an item to the group
* @param {Item} item
*/
Group.prototype.add = function add(item) {
Group.prototype.add = function(item) {
this.items[item.id] = item;
item.setParent(this);
@ -240,7 +240,7 @@ Group.prototype.add = function add(item) {
* Remove an item from the group
* @param {Item} item
*/
Group.prototype.remove = function remove(item) {
Group.prototype.remove = function(item) {
delete this.items[item.id];
item.setParent(this.itemSet);
@ -255,14 +255,14 @@ Group.prototype.remove = function remove(item) {
* Remove an item from the corresponding DataSet
* @param {Item} item
*/
Group.prototype.removeFromDataSet = function removeFromDataSet(item) {
Group.prototype.removeFromDataSet = function(item) {
this.itemSet.removeItem(item.id);
};
/**
* Reorder the items
*/
Group.prototype.order = function order() {
Group.prototype.order = function() {
var array = util.toArray(this.items);
this.orderedItems.byStart = array;
this.orderedItems.byEnd = this._constructByEndArray(array);
@ -277,7 +277,7 @@ Group.prototype.order = function order() {
* @returns {ItemRange[]}
* @private
*/
Group.prototype._constructByEndArray = function _constructByEndArray(array) {
Group.prototype._constructByEndArray = function(array) {
var endArray = [];
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.
* @private
*/
Group.prototype._updateVisibleItems = function _updateVisibleItems(orderedItems, visibleItems, range) {
Group.prototype._updateVisibleItems = function(orderedItems, visibleItems, range) {
var initialPosByStart,
newVisibleItems = [],
i;
@ -359,7 +359,7 @@ Group.prototype._updateVisibleItems = function _updateVisibleItems(orderedItems,
* @returns {number}
* @private
*/
Group.prototype._binarySearch = function _binarySearch(orderedItems, range, byEnd) {
Group.prototype._binarySearch = function(orderedItems, range, byEnd) {
var array = [];
var byTime = byEnd ? 'end' : 'start';
if (byEnd == true) {array = orderedItems.byEnd; }
@ -420,7 +420,7 @@ Group.prototype._binarySearch = function _binarySearch(orderedItems, range, byEn
* @returns {boolean}
* @private
*/
Group.prototype._checkIfInvisible = function _checkIfInvisible(item, visibleItems, range) {
Group.prototype._checkIfInvisible = function(item, visibleItems, range) {
if (item.isVisible(range)) {
if (!item.displayed) item.show();
item.repositionX();
@ -445,7 +445,7 @@ Group.prototype._checkIfInvisible = function _checkIfInvisible(item, visibleItem
* @param {{start:number, end:number}} range
* @private
*/
Group.prototype._checkIfVisible = function _checkIfVisible(item, visibleItems, range) {
Group.prototype._checkIfVisible = function(item, visibleItems, range) {
if (item.isVisible(range)) {
if (!item.displayed) item.show();
// 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 {Object} [options] See ItemSet.setOptions for the available options.
* @constructor ItemSet
* @extends Panel
* @extends Component
*/
function ItemSet(timeline, options) {
this.timeline = timeline;
@ -75,7 +75,7 @@ ItemSet.types = {
/**
* Create the HTML DOM for the ItemSet
*/
ItemSet.prototype._create = function _create(){
ItemSet.prototype._create = function(){
var frame = document.createElement('div');
frame.className = 'itemset';
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
*/
ItemSet.prototype.markDirty = function markDirty() {
ItemSet.prototype.markDirty = function() {
this.groupIds = [];
this.stackDirty = true;
};
@ -170,7 +170,7 @@ ItemSet.prototype.markDirty = function markDirty() {
/**
* Hide the component from the DOM
*/
ItemSet.prototype.hide = function hide() {
ItemSet.prototype.hide = function() {
// remove the frame containing the items
if (this.dom.frame.parentNode) {
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).
* @return {Boolean} changed
*/
ItemSet.prototype.show = function show() {
ItemSet.prototype.show = function() {
// show frame containing the items
if (!this.dom.frame.parentNode) {
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
* unselected.
*/
ItemSet.prototype.setSelection = function setSelection(ids) {
ItemSet.prototype.setSelection = function(ids) {
var i, ii, id, item;
if (ids) {
@ -247,7 +247,7 @@ ItemSet.prototype.setSelection = function setSelection(ids) {
* Get the selected items by their id
* @return {Array} ids The ids of the selected items
*/
ItemSet.prototype.getSelection = function getSelection() {
ItemSet.prototype.getSelection = function() {
return this.selection.concat([]);
};
@ -256,7 +256,7 @@ ItemSet.prototype.getSelection = function getSelection() {
* @param {String | Number} id
* @private
*/
ItemSet.prototype._deselect = function _deselect(id) {
ItemSet.prototype._deselect = function(id) {
var selection = this.selection;
for (var i = 0, ii = selection.length; i < ii; i++) {
if (selection[i] == id) { // non-strict comparison!
@ -270,7 +270,7 @@ ItemSet.prototype._deselect = function _deselect(id) {
* Repaint the component
* @return {boolean} Returns true if the component is resized
*/
ItemSet.prototype.redraw = function redraw() {
ItemSet.prototype.redraw = function() {
var margin = this.options.margin,
range = this.timeline.range,
asSize = util.option.asSize,
@ -352,7 +352,7 @@ ItemSet.prototype.redraw = function redraw() {
* @return {Group | null} firstGroup
* @private
*/
ItemSet.prototype._firstGroup = function _firstGroup() {
ItemSet.prototype._firstGroup = function() {
var firstGroupIndex = (this.options.orientation == 'top') ? 0 : (this.groupIds.length - 1);
var firstGroupId = this.groupIds[firstGroupIndex];
var firstGroup = this.groups[firstGroupId] || this.groups[UNGROUPED];
@ -365,7 +365,7 @@ ItemSet.prototype._firstGroup = function _firstGroup() {
* there are no groups specified.
* @protected
*/
ItemSet.prototype._updateUngrouped = function _updateUngrouped() {
ItemSet.prototype._updateUngrouped = function() {
var ungrouped = this.groups[UNGROUPED];
if (this.groupsData) {
@ -398,7 +398,7 @@ ItemSet.prototype._updateUngrouped = function _updateUngrouped() {
* Get the element for the labelset
* @return {HTMLElement} labelSet
*/
ItemSet.prototype.getLabelSet = function getLabelSet() {
ItemSet.prototype.getLabelSet = function() {
return this.dom.labelSet;
};
@ -406,7 +406,7 @@ ItemSet.prototype.getLabelSet = function getLabelSet() {
* Set items
* @param {vis.DataSet | null} items
*/
ItemSet.prototype.setItems = function setItems(items) {
ItemSet.prototype.setItems = function(items) {
var me = this,
ids,
oldItemsData = this.itemsData;
@ -453,7 +453,7 @@ ItemSet.prototype.setItems = function setItems(items) {
* Get the current items
* @returns {vis.DataSet | null}
*/
ItemSet.prototype.getItems = function getItems() {
ItemSet.prototype.getItems = function() {
return this.itemsData;
};
@ -461,7 +461,7 @@ ItemSet.prototype.getItems = function getItems() {
* Set groups
* @param {vis.DataSet} groups
*/
ItemSet.prototype.setGroups = function setGroups(groups) {
ItemSet.prototype.setGroups = function(groups) {
var me = this,
ids;
@ -513,7 +513,7 @@ ItemSet.prototype.setGroups = function setGroups(groups) {
* Get the current groups
* @returns {vis.DataSet | null} groups
*/
ItemSet.prototype.getGroups = function getGroups() {
ItemSet.prototype.getGroups = function() {
return this.groupsData;
};
@ -521,7 +521,7 @@ ItemSet.prototype.getGroups = function getGroups() {
* Remove an item by its id
* @param {String | Number} id
*/
ItemSet.prototype.removeItem = function removeItem (id) {
ItemSet.prototype.removeItem = function(id) {
var item = this.itemsData.get(id),
dataset = this._myDataSet();
@ -542,7 +542,7 @@ ItemSet.prototype.removeItem = function removeItem (id) {
* @param {Number[]} ids
* @protected
*/
ItemSet.prototype._onUpdate = function _onUpdate(ids) {
ItemSet.prototype._onUpdate = function(ids) {
var me = this,
items = this.items,
itemOptions = this.itemOptions;
@ -599,7 +599,7 @@ ItemSet.prototype._onAdd = ItemSet.prototype._onUpdate;
* @param {Number[]} ids
* @protected
*/
ItemSet.prototype._onRemove = function _onRemove(ids) {
ItemSet.prototype._onRemove = function(ids) {
var count = 0;
var me = this;
ids.forEach(function (id) {
@ -622,7 +622,7 @@ ItemSet.prototype._onRemove = function _onRemove(ids) {
* Update the order of item in all groups
* @private
*/
ItemSet.prototype._order = function _order() {
ItemSet.prototype._order = function() {
// reorder the items in all groups
// TODO: optimization: only reorder groups affected by the changed items
util.forEach(this.groups, function (group) {
@ -635,7 +635,7 @@ ItemSet.prototype._order = function _order() {
* @param {Number[]} ids
* @private
*/
ItemSet.prototype._onUpdateGroups = function _onUpdateGroups(ids) {
ItemSet.prototype._onUpdateGroups = function(ids) {
this._onAddGroups(ids);
};
@ -644,7 +644,7 @@ ItemSet.prototype._onUpdateGroups = function _onUpdateGroups(ids) {
* @param {Number[]} ids
* @private
*/
ItemSet.prototype._onAddGroups = function _onAddGroups(ids) {
ItemSet.prototype._onAddGroups = function(ids) {
var me = this;
ids.forEach(function (id) {
@ -692,7 +692,7 @@ ItemSet.prototype._onAddGroups = function _onAddGroups(ids) {
* @param {Number[]} ids
* @private
*/
ItemSet.prototype._onRemoveGroups = function _onRemoveGroups(ids) {
ItemSet.prototype._onRemoveGroups = function(ids) {
var groups = this.groups;
ids.forEach(function (id) {
var group = groups[id];
@ -748,7 +748,7 @@ ItemSet.prototype._orderGroups = function () {
* @param {Item} item
* @private
*/
ItemSet.prototype._addItem = function _addItem(item) {
ItemSet.prototype._addItem = function(item) {
this.items[item.id] = item;
// add to group
@ -763,7 +763,7 @@ ItemSet.prototype._addItem = function _addItem(item) {
* @param {Object} itemData
* @private
*/
ItemSet.prototype._updateItem = function _updateItem(item, itemData) {
ItemSet.prototype._updateItem = function(item, itemData) {
var oldGroupId = item.data.group;
item.data = itemData;
@ -788,7 +788,7 @@ ItemSet.prototype._updateItem = function _updateItem(item, itemData) {
* @param {Item} item
* @private
*/
ItemSet.prototype._removeItem = function _removeItem(item) {
ItemSet.prototype._removeItem = function(item) {
// remove from DOM
item.hide();
@ -811,7 +811,7 @@ ItemSet.prototype._removeItem = function _removeItem(item) {
* @returns {Array}
* @private
*/
ItemSet.prototype._constructByEndArray = function _constructByEndArray(array) {
ItemSet.prototype._constructByEndArray = function(array) {
var endArray = [];
for (var i = 0; i < array.length; i++) {
@ -1145,7 +1145,7 @@ ItemSet.prototype._onMultiSelectItem = function (event) {
* @param {Event} event
* @return {Item | null} item
*/
ItemSet.itemFromTarget = function itemFromTarget (event) {
ItemSet.itemFromTarget = function(event) {
var target = event.target;
while (target) {
if (target.hasOwnProperty('timeline-item')) {
@ -1163,7 +1163,7 @@ ItemSet.itemFromTarget = function itemFromTarget (event) {
* @param {Event} event
* @return {Group | null} group
*/
ItemSet.groupFromTarget = function groupFromTarget (event) {
ItemSet.groupFromTarget = function(event) {
var target = event.target;
while (target) {
if (target.hasOwnProperty('timeline-group')) {
@ -1181,7 +1181,7 @@ ItemSet.groupFromTarget = function groupFromTarget (event) {
* @param {Event} event
* @return {ItemSet | null} item
*/
ItemSet.itemSetFromTarget = function itemSetFromTarget (event) {
ItemSet.itemSetFromTarget = function(event) {
var target = event.target;
while (target) {
if (target.hasOwnProperty('timeline-itemset')) {
@ -1198,7 +1198,7 @@ ItemSet.itemSetFromTarget = function itemSetFromTarget (event) {
* @returns {null | DataSet} dataset
* @private
*/
ItemSet.prototype._myDataSet = function _myDataSet() {
ItemSet.prototype._myDataSet = function() {
// find the root DataSet
var dataset = this.itemsData;
while (dataset instanceof DataView) {

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

@ -29,7 +29,7 @@ function TimeAxis (timeline, options) {
lineTop: 0
};
this.options = options || {};
this.options = Object.create(options) || {};
this.defaultOptions = {
orientation: 'bottom', // supported: 'top', 'bottom'
// TODO: implement timeaxis orientations 'left' and 'right'
@ -58,7 +58,7 @@ TimeAxis.prototype.setOptions = Component.prototype.setOptions;
/**
* Create the HTML DOM for the TimeAxis
*/
TimeAxis.prototype._create = function _create() {
TimeAxis.prototype._create = function() {
this.dom.foreground = 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.
* @return {Date} snappedDate
*/
TimeAxis.prototype.snap = function snap (date) {
TimeAxis.prototype.snap = function(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
*/
Item.prototype.select = function select() {
Item.prototype.select = function() {
this.selected = true;
if (this.displayed) this.redraw();
};
@ -35,7 +35,7 @@ Item.prototype.select = function select() {
/**
* Unselect current item
*/
Item.prototype.unselect = function unselect() {
Item.prototype.unselect = function() {
this.selected = false;
if (this.displayed) this.redraw();
};
@ -44,7 +44,7 @@ Item.prototype.unselect = function unselect() {
* Set a parent for the item
* @param {ItemSet | Group} parent
*/
Item.prototype.setParent = function setParent(parent) {
Item.prototype.setParent = function(parent) {
if (this.displayed) {
this.hide();
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 {boolean} True if visible
*/
Item.prototype.isVisible = function isVisible (range) {
Item.prototype.isVisible = function(range) {
// Should be implemented by Item implementations
return false;
};
@ -71,7 +71,7 @@ Item.prototype.isVisible = function isVisible (range) {
* Show the Item in the DOM (when not already visible)
* @return {Boolean} changed
*/
Item.prototype.show = function show() {
Item.prototype.show = function() {
return false;
};
@ -79,28 +79,28 @@ Item.prototype.show = function show() {
* Hide the Item from the DOM (when visible)
* @return {Boolean} changed
*/
Item.prototype.hide = function hide() {
Item.prototype.hide = function() {
return false;
};
/**
* Repaint the item
*/
Item.prototype.redraw = function redraw() {
Item.prototype.redraw = function() {
// should be implemented by the item
};
/**
* Reposition the Item horizontally
*/
Item.prototype.repositionX = function repositionX() {
Item.prototype.repositionX = function() {
// should be implemented by the item
};
/**
* Reposition the Item vertically
*/
Item.prototype.repositionY = function repositionY() {
Item.prototype.repositionY = function() {
// 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 {boolean} True if visible
*/
ItemBox.prototype.isVisible = function isVisible (range) {
ItemBox.prototype.isVisible = function(range) {
// determine visibility
// 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;
@ -46,7 +46,7 @@ ItemBox.prototype.isVisible = function isVisible (range) {
/**
* Repaint the item
*/
ItemBox.prototype.redraw = function redraw() {
ItemBox.prototype.redraw = function() {
var dom = this.dom;
if (!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
* be created when needed.
*/
ItemBox.prototype.show = function show() {
ItemBox.prototype.show = function() {
if (!this.displayed) {
this.redraw();
}
@ -150,7 +150,7 @@ ItemBox.prototype.show = function show() {
/**
* Hide the item from the DOM (when visible)
*/
ItemBox.prototype.hide = function hide() {
ItemBox.prototype.hide = function() {
if (this.displayed) {
var dom = this.dom;
@ -169,7 +169,7 @@ ItemBox.prototype.hide = function hide() {
* Reposition the item horizontally
* @Override
*/
ItemBox.prototype.repositionX = function repositionX() {
ItemBox.prototype.repositionX = function() {
var start = this.defaultOptions.toScreen(this.data.start),
align = this.options.align || this.defaultOptions.align,
left,
@ -203,7 +203,7 @@ ItemBox.prototype.repositionX = function repositionX() {
* Reposition the item vertically
* @Override
*/
ItemBox.prototype.repositionY = function repositionY () {
ItemBox.prototype.repositionY = function() {
var orientation = this.options.orientation || this.defaultOptions.orientation,
box = this.dom.box,
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 {boolean} True if visible
*/
ItemPoint.prototype.isVisible = function isVisible (range) {
ItemPoint.prototype.isVisible = function(range) {
// determine visibility
// 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;
@ -47,7 +47,7 @@ ItemPoint.prototype.isVisible = function isVisible (range) {
/**
* Repaint the item
*/
ItemPoint.prototype.redraw = function redraw() {
ItemPoint.prototype.redraw = function() {
var dom = this.dom;
if (!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
* be created when needed.
*/
ItemPoint.prototype.show = function show() {
ItemPoint.prototype.show = function() {
if (!this.displayed) {
this.redraw();
}
@ -146,7 +146,7 @@ ItemPoint.prototype.show = function show() {
/**
* Hide the item from the DOM (when visible)
*/
ItemPoint.prototype.hide = function hide() {
ItemPoint.prototype.hide = function() {
if (this.displayed) {
if (this.dom.point.parentNode) {
this.dom.point.parentNode.removeChild(this.dom.point);
@ -163,7 +163,7 @@ ItemPoint.prototype.hide = function hide() {
* Reposition the item horizontally
* @Override
*/
ItemPoint.prototype.repositionX = function repositionX() {
ItemPoint.prototype.repositionX = function() {
var start = this.defaultOptions.toScreen(this.data.start);
this.left = start - this.props.dot.width;
@ -176,7 +176,7 @@ ItemPoint.prototype.repositionX = function repositionX() {
* Reposition the item vertically
* @Override
*/
ItemPoint.prototype.repositionY = function repositionY () {
ItemPoint.prototype.repositionY = function() {
var orientation = this.options.orientation || this.defaultOptions.orientation,
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 {boolean} True if visible
*/
ItemRange.prototype.isVisible = function isVisible (range) {
ItemRange.prototype.isVisible = function(range) {
// determine visibility
return (this.data.start < range.end) && (this.data.end > range.start);
};
@ -44,7 +44,7 @@ ItemRange.prototype.isVisible = function isVisible (range) {
/**
* Repaint the item
*/
ItemRange.prototype.redraw = function redraw() {
ItemRange.prototype.redraw = function() {
var dom = this.dom;
if (!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
* be created when needed.
*/
ItemRange.prototype.show = function show() {
ItemRange.prototype.show = function() {
if (!this.displayed) {
this.redraw();
}
@ -131,7 +131,7 @@ ItemRange.prototype.show = function show() {
* Hide the item from the DOM (when visible)
* @return {Boolean} changed
*/
ItemRange.prototype.hide = function hide() {
ItemRange.prototype.hide = function() {
if (this.displayed) {
var box = this.dom.box;
@ -150,7 +150,7 @@ ItemRange.prototype.hide = function hide() {
* Reposition the item horizontally
* @Override
*/
ItemRange.prototype.repositionX = function repositionX() {
ItemRange.prototype.repositionX = function() {
var props = this.props,
parentWidth = this.parent.width,
start = this.defaultOptions.toScreen(this.data.start),
@ -188,7 +188,7 @@ ItemRange.prototype.repositionX = function repositionX() {
* Reposition the item vertically
* @Override
*/
ItemRange.prototype.repositionY = function repositionY() {
ItemRange.prototype.repositionY = function() {
var orientation = this.options.orientation || this.defaultOptions.orientation,
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
* @Override
*/
ItemRangeOverflow.prototype.repositionX = function repositionX() {
ItemRangeOverflow.prototype.repositionX = function() {
var parentWidth = this.parent.width,
start = this.defaultOptions.toScreen(this.data.start),
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
* @param {Item[]} items
*/
stack.orderByStart = function orderByStart(items) {
stack.orderByStart = function(items) {
items.sort(function (a, b) {
return a.data.start - b.data.start;
});
@ -18,7 +18,7 @@ stack.orderByStart = function orderByStart(items) {
* is used.
* @param {Item[]} items
*/
stack.orderByEnd = function orderByEnd(items) {
stack.orderByEnd = function(items) {
items.sort(function (a, b) {
var aTime = ('end' in a.data) ? a.data.end : a.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
* 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;
if (force) {
@ -83,7 +83,7 @@ stack.stack = function _stack (items, margin, force) {
* @param {{item: number, axis: number}} margin
* Margins between items and between items and the axis.
*/
stack.nostack = function nostack (items, margin) {
stack.nostack = function(items, margin) {
var i, iMax;
// reset top position of all items
@ -104,7 +104,7 @@ stack.nostack = function nostack (items, margin) {
* the requested margin.
* @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) &&
(a.left + a.width + margin) > b.left &&
(a.top - margin) < (b.top + b.height) &&

+ 32
- 32
src/util.js View File

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

Loading…
Cancel
Save