-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Easier to maintain the demo code and dependencies.
- Loading branch information
Showing
15 changed files
with
783 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div id="mdp-demo"></div> | ||
<input type="text" id="altField" value="04/19/2017, 04/21/2017" /> | ||
<!-- Dates in the 'value' attribute of the altField are automatically added to the calendar --> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker({ | ||
altField: "#altField", | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker({ | ||
dateFormat: "y-m-d", | ||
defaultDate: "85-2-19", | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker({ | ||
mode: "daysRange", | ||
autoselectRange: [0, 5], | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
var today = new Date(); | ||
var tomorrow = new Date().setDate(today.getDate() + 1); | ||
|
||
$("#mdp-demo").multiDatesPicker({ | ||
disabled: true, | ||
// today and tomorrow are selected just to show how selected dates look | ||
// in a disabled calendar | ||
addDates: [today, tomorrow], | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
var date = new Date(); | ||
$("#mdp-demo").multiDatesPicker({ | ||
// disable the 1st and 3rd of the current month | ||
addDisabledDates: [date.setDate(1), date.setDate(3)], | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<style> | ||
/* | ||
Styles needed just to fit the embedded | ||
version in a smaller space. | ||
*/ | ||
body { | ||
font-size: x-small !important; | ||
height: 600px; | ||
} | ||
</style> | ||
<div id="mdp-demo"></div> | ||
<script> | ||
var today = new Date(); | ||
var y = today.getFullYear(); | ||
$("#mdp-demo").multiDatesPicker({ | ||
addDates: ["10/14/" + y, "02/19/" + y, "01/14/" + y, "11/16/" + y], | ||
numberOfMonths: [3, 4], | ||
defaultDate: "1/1/" + y, | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>MDP demo page</title> | ||
<link | ||
rel="stylesheet" | ||
href="https://code.jquery.com/ui/1.13.2/themes/pepper-grinder/jquery-ui.css" | ||
/> | ||
<link rel="stylesheet" href="../jquery-ui.multidatespicker.css" /> | ||
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script> | ||
<script src="https://code.jquery.com/ui/1.14.0/jquery-ui.min.js"></script> | ||
<script src="../jquery-ui.multidatespicker.js"></script> | ||
<style> | ||
body { | ||
font-family: sans-serif; | ||
} | ||
#code { | ||
font-size: x-small; | ||
white-space: pre; | ||
background: black; | ||
color: #eee; | ||
padding: 0.5em; | ||
} | ||
</style> | ||
<script> | ||
const loadDemo = (name) => { | ||
$.get( | ||
`${name}.html`, | ||
function (demoCode) { | ||
$("#code").text(demoCode); | ||
$("#preview").html(demoCode); | ||
}, | ||
"html", | ||
); | ||
}; | ||
|
||
const loadDemoFromQuery = () => { | ||
const defaultDemo = "simple"; | ||
const params = new URLSearchParams(window.location.search); | ||
const demoName = params.get("demo") || defaultDemo; | ||
loadDemo(demoName); | ||
}; | ||
|
||
const toggleCodeVisibility = (e) => { | ||
e.preventDefault(); | ||
const codeElement = document.getElementById("code"); | ||
const previewElement = document.getElementById("preview"); | ||
const wasVisible = codeElement.style.display === "block"; | ||
codeElement.style.display = wasVisible ? "none" : "block"; | ||
window.scrollTo(0, wasVisible ? 0 : 400); | ||
}; | ||
|
||
$(function () { | ||
loadDemoFromQuery(); | ||
$("#toggle-code-visibility").click(toggleCodeVisibility); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="preview"></div> | ||
<a id="toggle-code-visibility" href="#">Code used</a> | ||
<code id="code" style="display: none"></code> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<input id="mdp-demo" type="text" /> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker({ maxPicks: 2 }); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker({ | ||
minDate: 0, // today | ||
maxDate: 30, // +30 days from today | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
var date = new Date(); | ||
$("#mdp-demo").multiDatesPicker({ | ||
pickableRange: 7, | ||
adjustRangeToDisabled: true, | ||
addDisabledDates: [date.setDate(10), date.setDate(15)], | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
var date = new Date(); | ||
$("#mdp-demo").multiDatesPicker({ | ||
// preselect the 14th and 19th of the current month | ||
addDates: [date.setDate(14), date.setDate(19)], | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div id="mdp-demo"></div> | ||
<script> | ||
$("#mdp-demo").multiDatesPicker({ | ||
beforeShowDay: $.datepicker.noWeekends, | ||
}); | ||
/* | ||
Note: disabling dates using 'beforeShowDay' | ||
may produce undesired results with MDP functionalities | ||
that involve ranges, because MDP will still consider | ||
those dates as available. | ||
*/ | ||
</script> |
Oops, something went wrong.