Skip to content

Commit

Permalink
fixed issue with functions returning
Browse files Browse the repository at this point in the history
  • Loading branch information
Eonasdan committed Aug 12, 2017
1 parent 990af2b commit 2dd322c
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 53 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tempusdominus-bootstrap-3",
"version": "5.0.0-alpha7",
"version": "5.0.0-alpha8",
"main": [
"build/css/tempusdominus-bootstrap-3.min.css",
"build/js/tempusdominus-bootstrap-3.min.js"
Expand Down
43 changes: 27 additions & 16 deletions build/js/tempusdominus-bootstrap-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ var DateTimePicker = function ($) {
this.currentViewMode = Math.max(MinViewModeNumber, this.currentViewMode);

if (!this.unset) {
this._setValue(this._date);
this._setValue(this._dates[0], 0);
}
};

Expand Down Expand Up @@ -2666,24 +2666,35 @@ var TempusDominusBootstrap3 = function ($) {
//static


TempusDominusBootstrap3._jQueryInterface = function _jQueryInterface(option, argument) {
return this.each(function () {
var data = $(this).data(DateTimePicker.DATA_KEY);
if ((typeof option === 'undefined' ? 'undefined' : _typeof(option)) === 'object') {
$.extend({}, DateTimePicker.Default, option);
}
TempusDominusBootstrap3._jQueryHandleThis = function _jQueryHandleThis(me, option, argument) {
var data = $(me).data(DateTimePicker.DATA_KEY);
if ((typeof option === 'undefined' ? 'undefined' : _typeof(option)) === 'object') {
$.extend({}, DateTimePicker.Default, option);
}

if (!data) {
data = new TempusDominusBootstrap3($(this), option);
$(this).data(DateTimePicker.DATA_KEY, data);
}
if (!data) {
data = new TempusDominusBootstrap3($(me), option);
$(me).data(DateTimePicker.DATA_KEY, data);
}

if (typeof option === 'string') {
if (data[option] === undefined) {
throw new Error('No method named "' + option + '"');
}
data[option](argument);
if (typeof option === 'string') {
if (data[option] === undefined) {
throw new Error('No method named "' + option + '"');
}
if (argument === undefined) {
return data[option]();
} else {
return data[option](argument);
}
}
};

TempusDominusBootstrap3._jQueryInterface = function _jQueryInterface(option, argument) {
if (this.length === 1) {
return TempusDominusBootstrap3._jQueryHandleThis(this[0], option, argument);
}
return this.each(function () {
TempusDominusBootstrap3._jQueryHandleThis(this, option, argument);
});
};

Expand Down
4 changes: 2 additions & 2 deletions build/js/tempusdominus-bootstrap-3.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tempusdominus-bootstrap-3",
"version": "5.0.0-alpha7",
"version": "5.0.0-alpha8",
"main": "build/js/tempusdominus-bootstrap-3.min.js",
"scripts": [ "build/js/tempusdominus-bootstrap-3.min.js" ],
"styles": [ "build/css/tempusdominus-bootstrap-3.min.css" ],
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tempusdominus/bootstrap-3",
"type": "component",
"version": "5.0.0-alpha7",
"version": "5.0.0-alpha8",
"description": "Date/time picker widget based on twitter bootstrap",
"keywords": [
"bootstrap",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"type": "git",
"url": "https://github.com/tempusdominus/bootstrap-3.git"
},
"version": "5.0.0-alpha7",
"version": "5.0.0-alpha8",
"files": [
"build",
"src/js/**/*.js",
Expand Down
43 changes: 27 additions & 16 deletions src/docs/theme/js/tempusdominus-bootstrap-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ var DateTimePicker = function ($) {
this.currentViewMode = Math.max(MinViewModeNumber, this.currentViewMode);

if (!this.unset) {
this._setValue(this._date);
this._setValue(this._dates[0], 0);
}
};

Expand Down Expand Up @@ -2666,24 +2666,35 @@ var TempusDominusBootstrap3 = function ($) {
//static


TempusDominusBootstrap3._jQueryInterface = function _jQueryInterface(option, argument) {
return this.each(function () {
var data = $(this).data(DateTimePicker.DATA_KEY);
if ((typeof option === 'undefined' ? 'undefined' : _typeof(option)) === 'object') {
$.extend({}, DateTimePicker.Default, option);
}
TempusDominusBootstrap3._jQueryHandleThis = function _jQueryHandleThis(me, option, argument) {
var data = $(me).data(DateTimePicker.DATA_KEY);
if ((typeof option === 'undefined' ? 'undefined' : _typeof(option)) === 'object') {
$.extend({}, DateTimePicker.Default, option);
}

if (!data) {
data = new TempusDominusBootstrap3($(this), option);
$(this).data(DateTimePicker.DATA_KEY, data);
}
if (!data) {
data = new TempusDominusBootstrap3($(me), option);
$(me).data(DateTimePicker.DATA_KEY, data);
}

if (typeof option === 'string') {
if (data[option] === undefined) {
throw new Error('No method named "' + option + '"');
}
data[option](argument);
if (typeof option === 'string') {
if (data[option] === undefined) {
throw new Error('No method named "' + option + '"');
}
if (argument === undefined) {
return data[option]();
} else {
return data[option](argument);
}
}
};

TempusDominusBootstrap3._jQueryInterface = function _jQueryInterface(option, argument) {
if (this.length === 1) {
return TempusDominusBootstrap3._jQueryHandleThis(this[0], option, argument);
}
return this.each(function () {
TempusDominusBootstrap3._jQueryHandleThis(this, option, argument);
});
};

Expand Down
42 changes: 27 additions & 15 deletions src/js/tempusdominus-bootstrap-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -1064,24 +1064,36 @@ const TempusDominusBootstrap3 = ($ => { // eslint-disable-line no-unused-vars
}

//static
static _jQueryInterface(option, argument) {
return this.each(function () {
let data = $(this).data(DateTimePicker.DATA_KEY);
if (typeof option === 'object') {
$.extend({}, DateTimePicker.Default, option);
}
static _jQueryHandleThis(me, option, argument) {
let data = $(me).data(DateTimePicker.DATA_KEY);
if (typeof option === 'object') {
$.extend({}, DateTimePicker.Default, option);
}

if (!data) {
data = new TempusDominusBootstrap3($(this), option);
$(this).data(DateTimePicker.DATA_KEY, data);
}
if (!data) {
data = new TempusDominusBootstrap3($(me), option);
$(me).data(DateTimePicker.DATA_KEY, data);
}

if (typeof option === 'string') {
if (data[option] === undefined) {
throw new Error(`No method named "${option}"`);
}
data[option](argument);
if (typeof option === 'string') {
if (data[option] === undefined) {
throw new Error(`No method named "${option}"`);
}
if (argument === undefined) {
return data[option]();
}
else {
return data[option](argument);
}
}
}

static _jQueryInterface(option, argument) {
if (this.length === 1) {
return TempusDominusBootstrap3._jQueryHandleThis(this[0], option, argument);
}
return this.each(function () {
TempusDominusBootstrap3._jQueryHandleThis(this, option, argument);
});
}
}
Expand Down

0 comments on commit 2dd322c

Please sign in to comment.