Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't wrap the overridden element with a container #21

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 23 additions & 28 deletions dist/pikaday-package.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

/*
* PikadayResponsive
* A responsive datepicker built on top of Pikaday. It shows the native datepicker on mobile devices and a nice JS-picker on desktop.
*
* @author: Francesco Novy
* @licence: MIT <http://www.opensource.org/licenses/mit-license.php>
* @link https://github.com/mydea/PikadayResponsive
* @copyright: (c) 2016
* @version: 0.7.0
*/
/*
* PikadayResponsive
* A responsive datepicker built on top of Pikaday. It shows the native datepicker on mobile devices and a nice JS-picker on desktop.
*
* @author: Francesco Novy
* @licence: MIT <http://www.opensource.org/licenses/mit-license.php>
* @link https://github.com/mydea/PikadayResponsive
* @copyright: (c) 2016
* @version: 0.7.0
*/

//! moment.js
//! version : 2.14.1
Expand Down Expand Up @@ -5291,16 +5291,16 @@
}));


/*
* PikadayResponsive
* A responsive datepicker built on top of Pikaday. It shows the native datepicker on mobile devices and a nice JS-picker on desktop.
*
* @author: Francesco Novy
* @licence: MIT <http://www.opensource.org/licenses/mit-license.php>
* @link https://github.com/mydea/PikadayResponsive
* @copyright: (c) 2016
* @version: 0.7.0
*/
/*
* PikadayResponsive
* A responsive datepicker built on top of Pikaday. It shows the native datepicker on mobile devices and a nice JS-picker on desktop.
*
* @author: Francesco Novy
* @licence: MIT <http://www.opensource.org/licenses/mit-license.php>
* @link https://github.com/mydea/PikadayResponsive
* @copyright: (c) 2016
* @version: 0.7.0
*/

(function(root, factory) {
if (typeof define === 'function') {
Expand Down Expand Up @@ -5346,8 +5346,6 @@
var $el = $(el);
var settings = $.extend({}, defaultOptions, options);

// The container element for the input
var $container;
// The actual input field
var $input;
// The display input field
Expand All @@ -5368,9 +5366,6 @@

// The original input field is made hidden. This field will contain the actual value.
$el.attr("type", "hidden");
// Wrap the input in a container
$el.wrap("<span class='pikaday__container'></span>");
$container = $el.parent(".pikaday__container");

// If the original input has an ID, use it to generate IDs for the generated display inputs
var originalId = $el.attr('id');
Expand All @@ -5381,10 +5376,10 @@
if (originalId) {
$input.attr('id', originalId + '-input');
}
$container.append($input);
$el.after($input);

$display = $("<input type='text' readonly='readonly' class='pikaday__display pikaday__display--native " + settings.classes + "' placeholder='" + settings.placeholder + "' />");
$container.append($display);
$el.after($display);

$input.on("change", function() {
var val = $(this).val();
Expand Down Expand Up @@ -5421,7 +5416,7 @@
if (originalId) {
$input.attr('id', originalId + '-input');
}
$container.append($input);
$el.after($input);

var hasSelected = false;
var selectTimer = null;
Expand Down
31 changes: 13 additions & 18 deletions dist/pikaday-responsive.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

/*
* PikadayResponsive
* A responsive datepicker built on top of Pikaday. It shows the native datepicker on mobile devices and a nice JS-picker on desktop.
*
* @author: Francesco Novy
* @licence: MIT <http://www.opensource.org/licenses/mit-license.php>
* @link https://github.com/mydea/PikadayResponsive
* @copyright: (c) 2016
* @version: 0.7.0
*/
/*
* PikadayResponsive
* A responsive datepicker built on top of Pikaday. It shows the native datepicker on mobile devices and a nice JS-picker on desktop.
*
* @author: Francesco Novy
* @licence: MIT <http://www.opensource.org/licenses/mit-license.php>
* @link https://github.com/mydea/PikadayResponsive
* @copyright: (c) 2016
* @version: 0.7.0
*/

(function(root, factory) {
if (typeof define === 'function') {
Expand Down Expand Up @@ -54,8 +54,6 @@
var $el = $(el);
var settings = $.extend({}, defaultOptions, options);

// The container element for the input
var $container;
// The actual input field
var $input;
// The display input field
Expand All @@ -76,9 +74,6 @@

// The original input field is made hidden. This field will contain the actual value.
$el.attr("type", "hidden");
// Wrap the input in a container
$el.wrap("<span class='pikaday__container'></span>");
$container = $el.parent(".pikaday__container");

// If the original input has an ID, use it to generate IDs for the generated display inputs
var originalId = $el.attr('id');
Expand All @@ -89,10 +84,10 @@
if (originalId) {
$input.attr('id', originalId + '-input');
}
$container.append($input);
$el.after($input);

$display = $("<input type='text' readonly='readonly' class='pikaday__display pikaday__display--native " + settings.classes + "' placeholder='" + settings.placeholder + "' />");
$container.append($display);
$el.after($display);

$input.on("change", function() {
var val = $(this).val();
Expand Down Expand Up @@ -129,7 +124,7 @@
if (originalId) {
$input.attr('id', originalId + '-input');
}
$container.append($input);
$el.after($input);

var hasSelected = false;
var selectTimer = null;
Expand Down
11 changes: 3 additions & 8 deletions src/pikaday-responsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
var $el = $(el);
var settings = $.extend({}, defaultOptions, options);

// The container element for the input
var $container;
// The actual input field
var $input;
// The display input field
Expand All @@ -64,9 +62,6 @@

// The original input field is made hidden. This field will contain the actual value.
$el.attr("type", "hidden");
// Wrap the input in a container
$el.wrap("<span class='pikaday__container'></span>");
$container = $el.parent(".pikaday__container");

// If the original input has an ID, use it to generate IDs for the generated display inputs
var originalId = $el.attr('id');
Expand All @@ -77,10 +72,10 @@
if (originalId) {
$input.attr('id', originalId + '-input');
}
$container.append($input);
$el.after($input);

$display = $("<input type='text' readonly='readonly' class='pikaday__display pikaday__display--native " + settings.classes + "' placeholder='" + settings.placeholder + "' />");
$container.append($display);
$el.after($display);

$input.on("change", function() {
var val = $(this).val();
Expand Down Expand Up @@ -117,7 +112,7 @@
if (originalId) {
$input.attr('id', originalId + '-input');
}
$container.append($input);
$el.after($input);

var hasSelected = false;
var selectTimer = null;
Expand Down