Source code

Revision control

Other Tools

1
<?xml version="1.0" encoding="UTF-8"?>
2
<!-- This Source Code Form is subject to the terms of the Mozilla Public
3
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
4
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
5
6
<!DOCTYPE html [
7
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
8
%htmlDTD;
9
]>
11
<head>
12
<title>Date Picker</title>
13
<link rel="stylesheet" href="chrome://global/skin/datetimeinputpickers.css"/>
15
<script src="chrome://global/content/bindings/spinner.js"></script>
18
</head>
19
<body>
20
<div id="date-picker">
21
<div class="calendar-container">
22
<div class="nav">
23
<button class="prev"/>
24
<button class="next"/>
25
</div>
26
<div class="week-header"></div>
27
<div class="days-viewport">
28
<div class="days-view"></div>
29
</div>
30
</div>
31
<div class="month-year-container">
32
<button class="month-year"/>
33
</div>
34
<div class="month-year-view"></div>
35
</div>
36
<template id="spinner-template">
37
<div class="spinner-container">
38
<button class="up"/>
39
<div class="spinner"></div>
40
<button class="down"/>
41
</div>
42
</template>
43
<script>
44
/* import-globals-from widgets/datepicker.js */
45
// We need to hide the scroll bar but maintain its scrolling
46
// capability, so using |overflow: hidden| is not an option.
47
// Instead, we are inserting a user agent stylesheet that is
48
// capable of selecting scrollbars, and do |display: none|.
49
var domWinUtls = window.windowUtils;
50
domWinUtls.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbar { display: none; }', domWinUtls.AGENT_SHEET);
51
// Create a DatePicker instance and prepare to be
52
// initialized by the "DatePickerInit" event from datetimepopup.xml
53
const root = document.getElementById("date-picker");
54
new DatePicker({
55
monthYear: root.querySelector(".month-year"),
56
monthYearView: root.querySelector(".month-year-view"),
57
buttonPrev: root.querySelector(".prev"),
58
buttonNext: root.querySelector(".next"),
59
weekHeader: root.querySelector(".week-header"),
60
daysView: root.querySelector(".days-view"),
61
});
62
</script>
63
</body>
64
</html>