Commit 45e059db756261adb25e4dbc643f9d6185e943bf
1 parent
971505b0
1.模板设置优化
2.添加学校设置,其他设置
Showing
10 changed files
with
4806 additions
and
113 deletions
WebRoot/WEB-INF/jsp/sunvote/admin/admin_main.jsp
... | ... | @@ -157,20 +157,17 @@ |
157 | 157 | |
158 | 158 | <ul class="menu_1"> |
159 | 159 | <li > |
160 | - <p>学校设置</p> | |
160 | + <p onclick="event.stopPropagation();school('${SCHOOL_ID}')">学校设置</p> | |
161 | 161 | |
162 | 162 | </li> |
163 | 163 | <li> |
164 | - <p onclick="event.stopPropagation();grade('${var.SCHOOL_ID}')">年级设置</p> | |
164 | + <p onclick="event.stopPropagation();grade('${SCHOOL_ID}')">年级设置</p> | |
165 | 165 | </li> |
166 | 166 | <li> |
167 | - <p>年级升级</p> | |
167 | + <p onclick="event.stopPropagation();pagetemplate('${SCHOOL_ID}')">模板设置</p> | |
168 | 168 | </li> |
169 | 169 | <li> |
170 | - <p onclick="event.stopPropagation();pagetemplate('${var.SCHOOL_ID}')">模板设置</p> | |
171 | - </li> | |
172 | - <li> | |
173 | - <p>其他配置</p> | |
170 | + <p onclick="event.stopPropagation();other('${SCHOOL_ID}')">其他配置</p> | |
174 | 171 | </li> |
175 | 172 | </ul> |
176 | 173 | </div> |
... | ... | @@ -263,6 +260,16 @@ |
263 | 260 | //} |
264 | 261 | } |
265 | 262 | |
263 | + function school(schoolId){ | |
264 | + var path = "../school/goEdit2.do?ID=" + schoolId ; | |
265 | + $("#mainFrame").attr('src',path); | |
266 | + window.top.loading.show(); | |
267 | + } | |
268 | + function other(schoolId){ | |
269 | + var path = "../school/other.do?ID=" + schoolId ; | |
270 | + $("#mainFrame").attr('src',path); | |
271 | + window.top.loading.show(); | |
272 | + } | |
266 | 273 | function grade(school_id){ |
267 | 274 | var path = "../grade/listcs.do?school_id=" + school_id ; |
268 | 275 | $("#mainFrame").attr('src',path); | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/school/other_edit.jsp
0 → 100644
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | |
2 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | |
3 | +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | |
4 | +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | |
5 | +<% | |
6 | + String path = request.getContextPath(); | |
7 | + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; | |
8 | +%> | |
9 | +<!DOCTYPE html> | |
10 | +<html lang="en"> | |
11 | +<head> | |
12 | +<base href="<%=basePath%>"> | |
13 | +<!-- 下拉框 --> | |
14 | +<link rel="stylesheet" href="static/ace/css/chosen.css" /> | |
15 | +<link | |
16 | + href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" | |
17 | + rel="stylesheet"> | |
18 | +<link href="static/css/teach.css" rel="stylesheet"> | |
19 | +<!-- 日期框 --> | |
20 | +<link rel="stylesheet" href="static/ace/css/datepicker.css" /> | |
21 | +<link rel="stylesheet" type="text/css" href="static/css/jquery.datetimepicker.css"/> | |
22 | +<style> | |
23 | + .col-sm-4{ | |
24 | + width:100px; | |
25 | + padding-right:0; | |
26 | + line-height:34px; | |
27 | + font-size:16px; | |
28 | + } | |
29 | + .edit_btn{ | |
30 | + width:20%; | |
31 | + margin:0 auto; | |
32 | + } | |
33 | + .form-group{margin-top:15px;margin-bottom:0;} | |
34 | + .edit_btn .btn_sty{ | |
35 | + outline-style: none; | |
36 | + color: rgb(255, 255, 255); | |
37 | + margin-right: 20px; | |
38 | + margin-top:10%; | |
39 | + font-size: 16px; | |
40 | + background: rgb(59, 194, 214); | |
41 | + text-decoration: none; | |
42 | + border-width: initial; | |
43 | + border-style: none; | |
44 | + border-color: initial; | |
45 | + border-image: initial; | |
46 | + padding: 5px 10px; | |
47 | + width:100%; | |
48 | + } | |
49 | + .section{border:1px solid #ccc;padding:20px;position:relative;margin-top:40px;} | |
50 | + .section h2{margin:0;position:absolute;top:-11px;background:#fff;display:inline-block;padding:0 10px;font-size:20px;font-weight:bold;} | |
51 | +</style> | |
52 | +</head> | |
53 | +<body class="no-skin"> | |
54 | +<!-- /section:basics/navbar.layout --> | |
55 | + <div class="head_box" style="position:relative;"> | |
56 | + <div class="box_header"> | |
57 | + <div class="head_box_l"> | |
58 | + <p> | |
59 | + <span class="right_b"></span>其他设置 | |
60 | + </p> | |
61 | + </div> | |
62 | + <div class="head_box_r"> | |
63 | + | |
64 | + </div> | |
65 | + <div class="clear"></div> | |
66 | + </div> | |
67 | + </div> | |
68 | + | |
69 | + <div class="col-md-6" style="margin-left:25%;margin-top:5%;"> | |
70 | + <!-- <div class="form-group"> | |
71 | + <label for="enter_title" class="col-sm-4 control-label">备份地址:</label> | |
72 | + <div class="col-sm-8"> | |
73 | + <input type="text" class="form-control" id="enter_title" placeholder="输入学校名称" maxlength="100" minlength="1" value="${pd.NAME}"> | |
74 | + </div> | |
75 | + <div class="clearfix"></div> | |
76 | + </div> --> | |
77 | + <div class="section section1"> | |
78 | + <h2>数据备份</h2> | |
79 | + <div class="form-group"> | |
80 | + <label for="enter_title" class="col-sm-4 control-label">备份地址:</label> | |
81 | + <div class="col-sm-8"> | |
82 | + <input type="text" class="form-control" id="enter_title" placeholder="输入备份地址" maxlength="100" minlength="1" value="${pd.NAME}"> | |
83 | + </div> | |
84 | + <div class="clearfix"></div> | |
85 | + </div> | |
86 | + <div class="edit_btn"> | |
87 | + <input type="button" class="btn_sty" id="btn" value="备份" /> | |
88 | + </div> | |
89 | + </div> | |
90 | + <div class="section section2"> | |
91 | + <h2>数据还原</h2> | |
92 | + <div class="form-group"> | |
93 | + <label for="enter_title" class="col-sm-4 control-label">还原地址:</label> | |
94 | + <div class="col-sm-8"> | |
95 | + <input type="text" class="form-control" id="enter_title" placeholder="输入还原地址" maxlength="100" minlength="1" value="${pd.NAME}"> | |
96 | + </div> | |
97 | + <div class="clearfix"></div> | |
98 | + </div> | |
99 | + <div class="edit_btn"> | |
100 | + <input type="button" class="btn_sty" id="btn" value="还原" /> | |
101 | + </div> | |
102 | + </div> | |
103 | + <div class="section section3"> | |
104 | + <h2>定时备份设置</h2> | |
105 | + <div class="form-group"> | |
106 | + <label for="enter_title" class="col-sm-4 control-label">周期:</label> | |
107 | + <div class="col-sm-8"> | |
108 | + <select class="chosen-select form-control" name="grade_id" id="grade_id" data-placeholder="这里输入所属学校"> | |
109 | + <option value="1">每年</option> | |
110 | + <option value="2">每月</option> | |
111 | + <option value="3">每周</option> | |
112 | + <option value="4">每日</option> | |
113 | + </select> | |
114 | + </div> | |
115 | + <div class="clearfix"></div> | |
116 | + </div> | |
117 | + <div class="form-group"> | |
118 | + <label for="enter_title" class="col-sm-4 control-label">时间</label> | |
119 | + <div class="col-sm-8"> | |
120 | + <input type="text" class="form-control" id="datetimepicker" placeholder="输入时间" maxlength="100" minlength="1" value=""/> | |
121 | + </div> | |
122 | + <div class="clearfix"></div> | |
123 | + </div> | |
124 | + <div class="edit_btn"> | |
125 | + <input type="button" class="btn_sty" id="btn" value="保存" /> | |
126 | + </div> | |
127 | + </div> | |
128 | + | |
129 | + </div> | |
130 | + | |
131 | + | |
132 | + | |
133 | + | |
134 | + | |
135 | + <!-- 页面底部js¨ --> | |
136 | + <%@ include file="../../system/index/foot.jsp"%> | |
137 | + <!-- 下拉框 --> | |
138 | + <script src="static/ace/js/chosen.jquery.js"></script> | |
139 | + <!-- 日期框 --> | |
140 | + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script> | |
141 | + <!--提示框--> | |
142 | + <script type="text/javascript" src="static/js/jquery.tips.js"></script> | |
143 | + <!-- 时间选择 --> | |
144 | + <script src="static/js/jquery.datetimepicker.full.js"></script> | |
145 | + <script type="text/javascript"> | |
146 | + $(document).ready(function(){ | |
147 | + window.top.loading.remove(); | |
148 | + }); | |
149 | + | |
150 | + $("#btn").click(function(){ | |
151 | + var state=$(this).attr("data-state"); | |
152 | + if(state=="edit"){ | |
153 | + $(".form-control").removeAttr("disabled"); | |
154 | + $("#btn").val("保存"); | |
155 | + $(this).attr({"class":"save_btn_sty","data-state":"save"}); | |
156 | + }else if(state=="save"){ | |
157 | + $(".form-control").attr("disabled","disabled"); | |
158 | + $("#btn").val("修改"); | |
159 | + $(this).attr({"class":"edit_btn_sty","data-state":"edit"}); | |
160 | + } | |
161 | + }) | |
162 | + | |
163 | + //时间选择 | |
164 | + $.datetimepicker.setLocale('ch'); | |
165 | + $('#datetimepicker').datetimepicker({ | |
166 | + dayOfWeekStart : 1, | |
167 | + lang:'ch', | |
168 | + disabledDates:['1986/01/08','1986/01/09','1986/01/10'], | |
169 | + startDate: '1986/01/05' | |
170 | + }); | |
171 | + | |
172 | + $('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10}); | |
173 | + </script> | |
174 | +</body> | |
175 | +</html> | |
0 | 176 | \ No newline at end of file | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/school/school_edit2.jsp
0 → 100644
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | |
2 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | |
3 | +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | |
4 | +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> | |
5 | +<% | |
6 | + String path = request.getContextPath(); | |
7 | + String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; | |
8 | +%> | |
9 | +<!DOCTYPE html> | |
10 | +<html lang="en"> | |
11 | +<head> | |
12 | +<base href="<%=basePath%>"> | |
13 | +<!-- 下拉框 --> | |
14 | +<link rel="stylesheet" href="static/ace/css/chosen.css" /> | |
15 | +<link | |
16 | + href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" | |
17 | + rel="stylesheet"> | |
18 | +<link href="static/css/teach.css" rel="stylesheet"> | |
19 | +<!-- 日期框 --> | |
20 | +<link rel="stylesheet" href="static/ace/css/datepicker.css" /> | |
21 | +<style> | |
22 | + .edit_btn{ | |
23 | + width:20%; | |
24 | + margin:0 auto; | |
25 | + } | |
26 | + .edit_btn .edit_btn_sty{ | |
27 | + outline-style: none; | |
28 | + color: rgb(255, 255, 255); | |
29 | + margin-right: 20px; | |
30 | + margin-top:10%; | |
31 | + font-size: 16px; | |
32 | + background: #f29c9f; | |
33 | + text-decoration: none; | |
34 | + border-width: initial; | |
35 | + border-style: none; | |
36 | + border-color: initial; | |
37 | + border-image: initial; | |
38 | + padding: 10px 15px; | |
39 | + width:100%; | |
40 | + } | |
41 | + .edit_btn .save_btn_sty{ | |
42 | + outline-style: none; | |
43 | + color: rgb(255, 255, 255); | |
44 | + margin-right: 20px; | |
45 | + margin-top:10%; | |
46 | + font-size: 16px; | |
47 | + background: rgb(59, 194, 214); | |
48 | + text-decoration: none; | |
49 | + border-width: initial; | |
50 | + border-style: none; | |
51 | + border-color: initial; | |
52 | + border-image: initial; | |
53 | + padding: 10px 15px; | |
54 | + width:100%; | |
55 | + } | |
56 | + .school_info .col-sm-4{ | |
57 | + width:100px; | |
58 | + padding-right:0; | |
59 | + line-height:34px; | |
60 | + font-size:16px; | |
61 | + } | |
62 | +</style> | |
63 | +</head> | |
64 | +<body class="no-skin"> | |
65 | +<!-- /section:basics/navbar.layout --> | |
66 | + <div class="head_box" style="position:relative;"> | |
67 | + <div class="box_header"> | |
68 | + <div class="head_box_l"> | |
69 | + <p> | |
70 | + <span class="right_b"></span>学校管理 | |
71 | + </p> | |
72 | + </div> | |
73 | + <div class="head_box_r"> | |
74 | + | |
75 | + </div> | |
76 | + <div class="clear"></div> | |
77 | + </div> | |
78 | + </div> | |
79 | + | |
80 | + <div class="col-md-6 school_info" style="margin-left:25%;margin-top:5%;"> | |
81 | + <div class="form-group"> | |
82 | + <label for="enter_title" class="col-sm-4 control-label">学校名称:</label> | |
83 | + <div class="col-sm-8"> | |
84 | + <input type="text" class="form-control" id="enter_title" disabled placeholder="输入学校名称" maxlength="100" minlength="1" value="${pd.NAME}"> | |
85 | + </div> | |
86 | + <div class="clearfix"></div> | |
87 | + </div> | |
88 | + | |
89 | + <div class="form-group"> | |
90 | + <label for="enter_time" class="col-sm-4 control-label">学校地址:</label> | |
91 | + <div class="col-sm-8"> | |
92 | + <input type="text" class="form-control" id="enter_time" disabled placeholder="输入学校地址" value="${pd.ADDRESS}" maxlength="255" > | |
93 | + </div> | |
94 | + <div class="clearfix"></div> | |
95 | + </div> | |
96 | + <div class="form-group"> | |
97 | + <label for="enter_time" class="col-sm-4 control-label">校长:</label> | |
98 | + <div class="col-sm-8"> | |
99 | + <input type="text" class="form-control" id="enter_time" disabled placeholder="输入校长名称" value="${pd.PRESIDENT}" maxlength="255" > | |
100 | + </div> | |
101 | + <div class="clearfix"></div> | |
102 | + </div> | |
103 | + <div class="form-group"> | |
104 | + <label for="enter_time" class="col-sm-4 control-label">联系电话:</label> | |
105 | + <div class="col-sm-8"> | |
106 | + <input type="text" class="form-control" id="enter_time" disabled placeholder="输入联系电话" value="${pd.PHONE}" maxlength="255" > | |
107 | + </div> | |
108 | + <div class="clearfix"></div> | |
109 | + </div> | |
110 | + <div class="form-group"> | |
111 | + <label for="enter_time" class="col-sm-4 control-label">备注:</label> | |
112 | + <div class="col-sm-8"> | |
113 | + <input type="text" class="form-control" id="enter_time" disabled placeholder="输入备注" value="${pd.REMARK}" maxlength="255" > | |
114 | + </div> | |
115 | + <div class="clearfix"></div> | |
116 | + </div> | |
117 | + | |
118 | + </div> | |
119 | + <div class="clearfix"></div> | |
120 | + | |
121 | + <div class="edit_btn"> | |
122 | + <input type="button" class="edit_btn_sty" data-state="edit" id="btn" value="修改" /> | |
123 | + </div> | |
124 | + | |
125 | + | |
126 | + | |
127 | + | |
128 | + <!-- 页面底部js¨ --> | |
129 | + <%@ include file="../../system/index/foot.jsp"%> | |
130 | + <!-- 下拉框 --> | |
131 | + <script src="static/ace/js/chosen.jquery.js"></script> | |
132 | + <!-- 日期框 --> | |
133 | + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script> | |
134 | + <!--提示框--> | |
135 | + <script type="text/javascript" src="static/js/jquery.tips.js"></script> | |
136 | + <script type="text/javascript"> | |
137 | + $(document).ready(function(){ | |
138 | + window.top.loading.remove(); | |
139 | + }); | |
140 | + | |
141 | + $("#btn").click(function(){ | |
142 | + var state=$(this).attr("data-state"); | |
143 | + if(state=="edit"){ | |
144 | + $(".form-control").removeAttr("disabled"); | |
145 | + $("#btn").val("保存"); | |
146 | + $(this).attr({"class":"save_btn_sty","data-state":"save"}); | |
147 | + }else if(state=="save"){ | |
148 | + $(".form-control").attr("disabled","disabled"); | |
149 | + $("#btn").val("修改"); | |
150 | + $(this).attr({"class":"edit_btn_sty","data-state":"edit"}); | |
151 | + } | |
152 | + }) | |
153 | + | |
154 | + | |
155 | + </script> | |
156 | +</body> | |
157 | +</html> | |
0 | 158 | \ No newline at end of file | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/school/school_list2.jsp
0 → 100644
1 | +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> | |
2 | +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | |
3 | +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> | |
4 | +<% | |
5 | + String path = request.getContextPath(); | |
6 | + String basePath = request.getScheme() + "://" | |
7 | + + request.getServerName() + ":" + request.getServerPort() | |
8 | + + path + "/"; | |
9 | +%> | |
10 | +<!DOCTYPE html> | |
11 | +<html lang="en"> | |
12 | +<head> | |
13 | +<base href="<%=basePath%>"> | |
14 | +<!-- 下拉框 --> | |
15 | +<link rel="stylesheet" href="static/ace/css/chosen.css" /> | |
16 | +<link | |
17 | + href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" | |
18 | + rel="stylesheet"> | |
19 | +<link href="static/css/teach.css" rel="stylesheet"> | |
20 | +<!-- 日期框 --> | |
21 | +<link rel="stylesheet" href="static/ace/css/datepicker.css" /> | |
22 | +</head> | |
23 | +<body class="no-skin"> | |
24 | +<!-- 检索 --> | |
25 | + <form action="school/listcs.do" method="post" name="Form" | |
26 | + id="Form" style="background:#fff;"> | |
27 | + <input type="hidden" name="SCHOOL_ID" id="PAPER_ID" value="${pd.SCHOOL_ID}"/> | |
28 | + <div class="head_box"> | |
29 | + <div class="box_header"> | |
30 | + <div class="head_box_l"> | |
31 | + <p> | |
32 | + <span class="right_b"></span>学校管理 | |
33 | + </p> | |
34 | + </div> | |
35 | + <div class="head_box_r"> | |
36 | + | |
37 | + </div> | |
38 | + <div class="clear"></div> | |
39 | + </div> | |
40 | + <div style="padding:0 5%;background:#fff;"> | |
41 | + <table class="table table-striped"> | |
42 | + <col style="width: 10%" /> | |
43 | + <col style="width: 15%" /> | |
44 | + <col style="width: 15%" /> | |
45 | + <col style="width: 15%" /> | |
46 | + <col style="width: 15%" /> | |
47 | + <col style="width: 15%" /> | |
48 | + <col style="width: 15%" /> | |
49 | + <thead> | |
50 | + <tr> | |
51 | + <th><input type="checkbox" name='ids' id="ids" />序号</th> | |
52 | + <th class="center">学校名称</th> | |
53 | + <th class="center">学校地址</th> | |
54 | + <th class="center">校长</th> | |
55 | + <th class="center">联系电话</th> | |
56 | + <th class="center">备注</th> | |
57 | + <th class="center">操作</th> | |
58 | + </tr> | |
59 | + </thead> | |
60 | + </table> | |
61 | + </div> | |
62 | + </div> | |
63 | + <div class="table_box" > | |
64 | + <table class="table table-striped"> | |
65 | + <col style="width: 10%" /> | |
66 | + <col style="width: 15%" /> | |
67 | + <col style="width: 15%" /> | |
68 | + <col style="width: 15%" /> | |
69 | + <col style="width: 15%" /> | |
70 | + <col style="width: 15%" /> | |
71 | + <col style="width: 15%" /> | |
72 | + <tbody> | |
73 | + <c:choose> | |
74 | + <c:when test="${not empty varList}"> | |
75 | + <c:forEach items="${varList}" var="var" varStatus="vs"> | |
76 | + <tr> | |
77 | + <td><input type="checkbox" name='ids' id="ids" value="${var.PAPER_ID}"/>${vs.index+1}</td> | |
78 | + <td class='center'>${var.NAME}</td> | |
79 | + <td class='center'>${var.ADDRESS}</td> | |
80 | + <td class='center'>${var.PRESIDENT}</td> | |
81 | + <td class='center'>${var.PHONE}</td> | |
82 | + <td class='center'>${var.REMARK}</td> | |
83 | + <td><a onclick="edit('${var.ID}');" style="margin-right:10px;"><img src="static/images/eidtor.png" /></a></td> | |
84 | + </tr> | |
85 | + | |
86 | + </c:forEach> | |
87 | + </c:when> | |
88 | + <c:otherwise> | |
89 | + <tr class="main_info"> | |
90 | + <td colspan="100" class="center" >没有相关数据</td> | |
91 | + </tr> | |
92 | + </c:otherwise> | |
93 | + </c:choose> | |
94 | + </tbody> | |
95 | + </table> | |
96 | + <div class="footer"> | |
97 | + | |
98 | + <div class="page_box"> | |
99 | + | |
100 | + <div class="pagination" | |
101 | + style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div> | |
102 | + </div> | |
103 | + </div> | |
104 | + </div> | |
105 | + </form> | |
106 | + | |
107 | + | |
108 | + <!-- basic scripts --> | |
109 | + <!-- 页面底部js¨ --> | |
110 | + <%@ include file="../../system/index/foot.jsp"%> | |
111 | + <!-- 删除时确认窗口 --> | |
112 | + <script src="static/ace/js/bootbox.js"></script> | |
113 | + <!-- ace scripts --> | |
114 | + <script src="static/ace/js/ace/ace.js"></script> | |
115 | + <!-- 下拉框 --> | |
116 | + <script src="static/ace/js/chosen.jquery.js"></script> | |
117 | + <!-- 日期框 --> | |
118 | + <script src="static/ace/js/date-time/bootstrap-datepicker.js"></script> | |
119 | + <!--提示框--> | |
120 | + <script type="text/javascript" src="static/js/jquery.tips.js"></script> | |
121 | + <script type="text/javascript"> | |
122 | + | |
123 | + $(document).ready(function(){ | |
124 | + window.top.loading.remove(); | |
125 | + }); | |
126 | + | |
127 | + //编辑 | |
128 | + function edit(Id){ | |
129 | + window.top.modal.init({ | |
130 | + 'title':'修改信息', | |
131 | + 'url':'<%=basePath%>school/goEdit2.do?ID='+Id, | |
132 | + func:function() { | |
133 | + tosearch(); | |
134 | + } | |
135 | + }); | |
136 | + window.top.modal.show(); | |
137 | + } | |
138 | + | |
139 | + </script> | |
140 | + | |
141 | + | |
142 | +</body> | |
143 | +</html> | |
0 | 144 | \ No newline at end of file | ... | ... |
WebRoot/WEB-INF/jsp/sunvote/sclass/sclass_list2.jsp
WebRoot/WEB-INF/jsp/sunvote/teacher/creat_template.jsp
... | ... | @@ -22,17 +22,18 @@ |
22 | 22 | </head> |
23 | 23 | <body> |
24 | 24 | <div class="page-header"> |
25 | - <div class="header_box container"> | |
26 | - <h1 class="text-center"></h1> | |
25 | + <div class="header_box container" style="display:block;"> | |
26 | + <h1 class="text-center"> </h1> | |
27 | 27 | <div class="btn_group"> |
28 | 28 | <div class="pull-left"><h3>总分:<span id='score_all'>0</span> 分</h3></div> |
29 | 29 | <div class="btn_box pull-right"> |
30 | - <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".fast" id="fast">添加</button> | |
30 | + <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".addQuestion" id="fast">添加</button> | |
31 | 31 | <input type="button" class="btn btn-success btn-lg" name="save" value="保存" id="save"/> |
32 | 32 | <!-- <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".fast" id="fast">单选出题</button> |
33 | 33 | <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target=".addQuestion" id="addQuestion">多选出题</button> --> |
34 | 34 | <div class="clearfix"></div> |
35 | 35 | </div> |
36 | + <div class="clearfix"></div> | |
36 | 37 | </div> |
37 | 38 | </div> |
38 | 39 | </div> |
... | ... | @@ -41,20 +42,23 @@ |
41 | 42 | |
42 | 43 | </div> |
43 | 44 | |
44 | -<!-- 快速出题 --> | |
45 | 45 | |
46 | -<div class="modal fade fast" tabindex="-1" role="dialog"> | |
46 | + | |
47 | +<!--添加试题--> | |
48 | +<div class="modal fade addQuestion" tabindex="-1" role="dialog"> | |
47 | 49 | <div class="modal-dialog" role="document"> |
48 | 50 | <div class="modal-content"> |
49 | 51 | <div class="modal-header"> |
50 | 52 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
51 | - <h4 class="modal-title">快速出题</h4> | |
53 | + <h4 class="modal-title">添加试题</h4> | |
52 | 54 | </div> |
55 | + | |
56 | + | |
53 | 57 | <div class="modal-body"> |
54 | 58 | <div class="form-group"> |
55 | - <label for="inputEmail3" class="col-sm-2 control-label">题型</label> | |
59 | + <label for="type" class="col-sm-2 control-label">题型</label> | |
56 | 60 | <div class="col-sm-10"> |
57 | - <select class="form-control" id="num_ans"> | |
61 | + <select class="form-control" id="type"> | |
58 | 62 | <option value="1">单选题</option> |
59 | 63 | <option value="2">多选题</option> |
60 | 64 | </select> |
... | ... | @@ -62,9 +66,9 @@ |
62 | 66 | <div class="clearfix"></div> |
63 | 67 | </div> |
64 | 68 | <div class="form-group"> |
65 | - <label for="inputEmail3" class="col-sm-2 control-label">选项个数</label> | |
69 | + <label for="num_ans_2" class="col-sm-2 control-label">选项个数</label> | |
66 | 70 | <div class="col-sm-10"> |
67 | - <select class="form-control" id="num_ans"> | |
71 | + <select class="form-control" id="num_ans_2"> | |
68 | 72 | <option value="2">2</option> |
69 | 73 | <option value="3">3</option> |
70 | 74 | <option value="4" selected>4</option> |
... | ... | @@ -79,88 +83,24 @@ |
79 | 83 | <div class="clearfix"></div> |
80 | 84 | </div> |
81 | 85 | <div class="form-group"> |
82 | - <label for="inputEmail3" class="col-sm-2 control-label">题目数</label> | |
86 | + <label for="index_s_2" class="col-sm-2 control-label">题目数</label> | |
83 | 87 | <div class="col-sm-10"> |
84 | - <input type="number" class="form-control" id="number" placeholder="输入题目数量" maxlength="119"> | |
88 | + <input type="number" class="form-control" id="index_s_2" placeholder="输入题目数量" maxlength="119"> | |
85 | 89 | |
86 | 90 | <div class="tips" style="color:#f00"></div> |
87 | 91 | </div> |
88 | 92 | <div class="clearfix"></div> |
89 | 93 | </div> |
90 | 94 | <div class="form-group"> |
91 | - <label for="inputEmail3" class="col-sm-2 control-label">单题分数</label> | |
92 | - <div class="col-sm-10"> | |
93 | - <input type="number" class="form-control" id="fraction" placeholder="" value="1"> | |
94 | - </div> | |
95 | - <div class="clearfix"></div> | |
96 | - </div> | |
97 | - </div> | |
98 | - <div class="modal-footer"> | |
99 | - <button type="button" class="btn btn-default" id="fast_submit">确定</button> | |
100 | - <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button> | |
101 | - </div> | |
102 | - </div><!-- /.modal-content --> | |
103 | - </div><!-- /.modal-dialog --> | |
104 | -</div><!-- /.modal --> | |
105 | - | |
106 | -<!--添加试题--> | |
107 | -<div class="modal fade addQuestion" tabindex="-1" role="dialog"> | |
108 | - <div class="modal-dialog" role="document"> | |
109 | - <div class="modal-content"> | |
110 | - <div class="modal-header"> | |
111 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
112 | - <h4 class="modal-title">添加试题</h4> | |
113 | - </div> | |
114 | - <div class="modal-body"> | |
115 | - <!--<div class="form-group"> | |
116 | - <label for="type" class="col-sm-2 control-label">题目名称</label> | |
117 | - <div class="col-sm-10"> | |
118 | - <select class="form-control" id="type"> | |
119 | - <option value="1" selected>单选题</option> | |
120 | - <option value="2">完形填空</option> | |
121 | - <option value="3">阅读理解</option> | |
122 | - <option value="4">判断题</option> | |
123 | - <option value="5">多选题</option> | |
124 | - </select> | |
125 | - </div> | |
126 | - <div class="clearfix"></div> | |
127 | - </div>--> | |
128 | - <div class="form-group"> | |
129 | - <label for="index_s_2" class="col-sm-2 control-label">题数</label> | |
130 | - <div class="col-sm-10"> | |
131 | - <input type="number" class="form-control" id="index_s_2" placeholder="请输入题目数量(1-100)" oninput="if(value.length>3) value=value.slice(0,3)"> | |
132 | - </div> | |
133 | - <!-- <div class="col-sm-1"><span style="line-height:34px;">——</span></div> | |
134 | - <div class="col-sm-4"> | |
135 | - <input type="number" class="form-control" id="index_e_2" placeholder=""> | |
136 | - </div>--> | |
137 | - <div class="clearfix"></div> | |
138 | - </div> | |
139 | - <div class="form-group"> | |
140 | - <label for="num_ans_2" class="col-sm-2 control-label">选项个数</label> | |
141 | - <div class="col-sm-10"> | |
142 | - <select class="form-control" id="num_ans_2"> | |
143 | - <option value="2">2</option> | |
144 | - <option value="3">3</option> | |
145 | - <option value="4" selected>4</option> | |
146 | - <option value="5">5</option> | |
147 | - <option value="6">6</option> | |
148 | - <option value="7">7</option> | |
149 | - <option value="8">8</option> | |
150 | - <option value="9">9</option> | |
151 | - <option value="10">10</option> | |
152 | - </select> | |
153 | - </div> | |
154 | - <div class="clearfix"></div> | |
155 | - </div> | |
156 | - <div class="form-group"> | |
157 | 95 | <label for="fraction2" class="col-sm-2 control-label">单题分数</label> |
158 | 96 | <div class="col-sm-10"> |
159 | - <input type="number" class="form-control" id="fraction2" value="1" placeholder="请输入单题分数"> | |
97 | + <input type="number" class="form-control" id="fraction2" placeholder="" value="1"> | |
160 | 98 | </div> |
161 | 99 | <div class="clearfix"></div> |
162 | 100 | </div> |
163 | 101 | </div> |
102 | + | |
103 | + | |
164 | 104 | <div class="modal-footer"> |
165 | 105 | <button type="button" class="btn btn-default" id="addQuestion_submit">确定</button> |
166 | 106 | <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button> |
... | ... | @@ -169,32 +109,7 @@ |
169 | 109 | </div><!-- /.modal-dialog --> |
170 | 110 | </div><!-- /.modal --> |
171 | 111 | |
172 | -<!-- 考试时间 --> | |
173 | 112 | |
174 | -<div class="modal fade test_time" tabindex="-1" role="dialog"> | |
175 | - <div class="modal-dialog" role="document"> | |
176 | - <div class="modal-content"> | |
177 | - <div class="modal-header"> | |
178 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
179 | - <h4 class="modal-title">考试时间</h4> | |
180 | - </div> | |
181 | - <div class="modal-body"> | |
182 | - <div class="form-group"> | |
183 | - <label for="enter_time" class="col-sm-4 control-label">考试时间(分钟)</label> | |
184 | - <div class="col-sm-6"> | |
185 | - <input type="number" class="form-control" id="enter_time" placeholder="输入考试时间"> | |
186 | - </div> | |
187 | - <div class="clearfix"></div> | |
188 | - </div> | |
189 | - | |
190 | - </div> | |
191 | - <div class="modal-footer"> | |
192 | - <button type="button" class="btn btn-default" id="time_submit">确定</button> | |
193 | - <button type="button" class="btn btn-primary" data-dismiss="modal">取消</button> | |
194 | - </div> | |
195 | - </div><!-- /.modal-content --> | |
196 | - </div><!-- /.modal-dialog --> | |
197 | -</div><!-- /.modal --> | |
198 | 113 | <div class="loading" style="background:rgba(0,0,0,0.5);width:100%;height:100%;position:fixed;top:0;display:none;"> |
199 | 114 | <img src="../static/images/loading.gif" width="200px" style="position:absolute;top:0;bottom:0;left:0;right:0;margin:auto;"/> |
200 | 115 | </div> |
... | ... | @@ -221,7 +136,7 @@ |
221 | 136 | //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"单选","option_num":"","option_content":"","answer":"","difficulty":"","analysis":"","question_from":"","score":1,"part_score":"","remark":"","rank":"1","no_name":"一、","questions":[{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.1"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"B","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.2"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"C","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.3"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"D","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.4"},{"chapter_id":"0","problem_type_id":"0","knowledge_id":"0","content":"","option_num":4,"option_content":"","answer":"A","difficulty":"0","analysis":"","question_from":"1","score":1,"part_score":"0","remark":"","rank":"2","no_name":"1.5"}]}]}; |
222 | 137 | //var testData={"title":"TEST1","exam_time":46,"paper_type":"1","subject_id":"1","grade_id":"1","user_id":"1","score":5,"questions":[]}; |
223 | 138 | </script> |
224 | -<script type="text/javascript" src="../static/js/control-604.js?a=3"></script> | |
139 | +<script type="text/javascript" src="../static/js/control_template.js?a=3"></script> | |
225 | 140 | |
226 | 141 | |
227 | 142 | </body> | ... | ... |
WebRoot/static/css/jquery.datetimepicker.css
0 → 100644
1 | +.xdsoft_datetimepicker { | |
2 | + box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506); | |
3 | + background: #fff; | |
4 | + border-bottom: 1px solid #bbb; | |
5 | + border-left: 1px solid #ccc; | |
6 | + border-right: 1px solid #ccc; | |
7 | + border-top: 1px solid #ccc; | |
8 | + color: #333; | |
9 | + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
10 | + padding: 8px; | |
11 | + padding-left: 0; | |
12 | + padding-top: 2px; | |
13 | + position: absolute; | |
14 | + z-index: 9999; | |
15 | + -moz-box-sizing: border-box; | |
16 | + box-sizing: border-box; | |
17 | + display: none; | |
18 | +} | |
19 | +.xdsoft_datetimepicker.xdsoft_rtl { | |
20 | + padding: 8px 0 8px 8px; | |
21 | +} | |
22 | + | |
23 | +.xdsoft_datetimepicker iframe { | |
24 | + position: absolute; | |
25 | + left: 0; | |
26 | + top: 0; | |
27 | + width: 75px; | |
28 | + height: 210px; | |
29 | + background: transparent; | |
30 | + border: none; | |
31 | +} | |
32 | + | |
33 | +/*For IE8 or lower*/ | |
34 | +.xdsoft_datetimepicker button { | |
35 | + border: none !important; | |
36 | +} | |
37 | + | |
38 | +.xdsoft_noselect { | |
39 | + -webkit-touch-callout: none; | |
40 | + -webkit-user-select: none; | |
41 | + -khtml-user-select: none; | |
42 | + -moz-user-select: none; | |
43 | + -ms-user-select: none; | |
44 | + -o-user-select: none; | |
45 | + user-select: none; | |
46 | +} | |
47 | + | |
48 | +.xdsoft_noselect::selection { background: transparent } | |
49 | +.xdsoft_noselect::-moz-selection { background: transparent } | |
50 | + | |
51 | +.xdsoft_datetimepicker.xdsoft_inline { | |
52 | + display: inline-block; | |
53 | + position: static; | |
54 | + box-shadow: none; | |
55 | +} | |
56 | + | |
57 | +.xdsoft_datetimepicker * { | |
58 | + -moz-box-sizing: border-box; | |
59 | + box-sizing: border-box; | |
60 | + padding: 0; | |
61 | + margin: 0; | |
62 | +} | |
63 | + | |
64 | +.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker { | |
65 | + display: none; | |
66 | +} | |
67 | + | |
68 | +.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active { | |
69 | + display: block; | |
70 | +} | |
71 | + | |
72 | +.xdsoft_datetimepicker .xdsoft_datepicker { | |
73 | + width: 224px; | |
74 | + float: left; | |
75 | + margin-left: 8px; | |
76 | +} | |
77 | +.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_datepicker { | |
78 | + float: right; | |
79 | + margin-right: 8px; | |
80 | + margin-left: 0; | |
81 | +} | |
82 | + | |
83 | +.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker { | |
84 | + width: 256px; | |
85 | +} | |
86 | + | |
87 | +.xdsoft_datetimepicker .xdsoft_timepicker { | |
88 | + width: 58px; | |
89 | + float: left; | |
90 | + text-align: center; | |
91 | + margin-left: 8px; | |
92 | + margin-top: 0; | |
93 | +} | |
94 | +.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker { | |
95 | + float: right; | |
96 | + margin-right: 8px; | |
97 | + margin-left: 0; | |
98 | +} | |
99 | + | |
100 | +.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker { | |
101 | + margin-top: 8px; | |
102 | + margin-bottom: 3px | |
103 | +} | |
104 | + | |
105 | +.xdsoft_datetimepicker .xdsoft_mounthpicker { | |
106 | + position: relative; | |
107 | + text-align: center; | |
108 | +} | |
109 | + | |
110 | +.xdsoft_datetimepicker .xdsoft_label i, | |
111 | +.xdsoft_datetimepicker .xdsoft_prev, | |
112 | +.xdsoft_datetimepicker .xdsoft_next, | |
113 | +.xdsoft_datetimepicker .xdsoft_today_button { | |
114 | + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC); | |
115 | +} | |
116 | + | |
117 | +.xdsoft_datetimepicker .xdsoft_label i { | |
118 | + opacity: 0.5; | |
119 | + background-position: -92px -19px; | |
120 | + display: inline-block; | |
121 | + width: 9px; | |
122 | + height: 20px; | |
123 | + vertical-align: middle; | |
124 | +} | |
125 | + | |
126 | +.xdsoft_datetimepicker .xdsoft_prev { | |
127 | + float: left; | |
128 | + background-position: -20px 0; | |
129 | +} | |
130 | +.xdsoft_datetimepicker .xdsoft_today_button { | |
131 | + float: left; | |
132 | + background-position: -70px 0; | |
133 | + margin-left: 5px; | |
134 | +} | |
135 | + | |
136 | +.xdsoft_datetimepicker .xdsoft_next { | |
137 | + float: right; | |
138 | + background-position: 0 0; | |
139 | +} | |
140 | + | |
141 | +.xdsoft_datetimepicker .xdsoft_next, | |
142 | +.xdsoft_datetimepicker .xdsoft_prev , | |
143 | +.xdsoft_datetimepicker .xdsoft_today_button { | |
144 | + background-color: transparent; | |
145 | + background-repeat: no-repeat; | |
146 | + border: 0 none; | |
147 | + cursor: pointer; | |
148 | + display: block; | |
149 | + height: 30px; | |
150 | + opacity: 0.5; | |
151 | + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; | |
152 | + outline: medium none; | |
153 | + overflow: hidden; | |
154 | + padding: 0; | |
155 | + position: relative; | |
156 | + text-indent: 100%; | |
157 | + white-space: nowrap; | |
158 | + width: 20px; | |
159 | + min-width: 0; | |
160 | +} | |
161 | + | |
162 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev, | |
163 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next { | |
164 | + float: none; | |
165 | + background-position: -40px -15px; | |
166 | + height: 15px; | |
167 | + width: 30px; | |
168 | + display: block; | |
169 | + margin-left: 14px; | |
170 | + margin-top: 7px; | |
171 | +} | |
172 | +.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_prev, | |
173 | +.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_timepicker .xdsoft_next { | |
174 | + float: none; | |
175 | + margin-left: 0; | |
176 | + margin-right: 14px; | |
177 | +} | |
178 | + | |
179 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev { | |
180 | + background-position: -40px 0; | |
181 | + margin-bottom: 7px; | |
182 | + margin-top: 0; | |
183 | +} | |
184 | + | |
185 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box { | |
186 | + height: 151px; | |
187 | + overflow: hidden; | |
188 | + border-bottom: 1px solid #ddd; | |
189 | +} | |
190 | + | |
191 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div { | |
192 | + background: #f5f5f5; | |
193 | + border-top: 1px solid #ddd; | |
194 | + color: #666; | |
195 | + font-size: 12px; | |
196 | + text-align: center; | |
197 | + border-collapse: collapse; | |
198 | + cursor: pointer; | |
199 | + border-bottom-width: 0; | |
200 | + height: 25px; | |
201 | + line-height: 25px; | |
202 | +} | |
203 | + | |
204 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child { | |
205 | + border-top-width: 0; | |
206 | +} | |
207 | + | |
208 | +.xdsoft_datetimepicker .xdsoft_today_button:hover, | |
209 | +.xdsoft_datetimepicker .xdsoft_next:hover, | |
210 | +.xdsoft_datetimepicker .xdsoft_prev:hover { | |
211 | + opacity: 1; | |
212 | + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
213 | +} | |
214 | + | |
215 | +.xdsoft_datetimepicker .xdsoft_label { | |
216 | + display: inline; | |
217 | + position: relative; | |
218 | + z-index: 9999; | |
219 | + margin: 0; | |
220 | + padding: 5px 3px; | |
221 | + font-size: 14px; | |
222 | + line-height: 20px; | |
223 | + font-weight: bold; | |
224 | + background-color: #fff; | |
225 | + float: left; | |
226 | + width: 182px; | |
227 | + text-align: center; | |
228 | + cursor: pointer; | |
229 | +} | |
230 | + | |
231 | +.xdsoft_datetimepicker .xdsoft_label:hover>span { | |
232 | + text-decoration: underline; | |
233 | +} | |
234 | + | |
235 | +.xdsoft_datetimepicker .xdsoft_label:hover i { | |
236 | + opacity: 1.0; | |
237 | +} | |
238 | + | |
239 | +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select { | |
240 | + border: 1px solid #ccc; | |
241 | + position: absolute; | |
242 | + right: 0; | |
243 | + top: 30px; | |
244 | + z-index: 101; | |
245 | + display: none; | |
246 | + background: #fff; | |
247 | + max-height: 160px; | |
248 | + overflow-y: hidden; | |
249 | +} | |
250 | + | |
251 | +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{ right: -7px } | |
252 | +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{ right: 2px } | |
253 | +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover { | |
254 | + color: #fff; | |
255 | + background: #ff8000; | |
256 | +} | |
257 | + | |
258 | +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option { | |
259 | + padding: 2px 10px 2px 5px; | |
260 | + text-decoration: none !important; | |
261 | +} | |
262 | + | |
263 | +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current { | |
264 | + background: #33aaff; | |
265 | + box-shadow: #178fe5 0 1px 3px 0 inset; | |
266 | + color: #fff; | |
267 | + font-weight: 700; | |
268 | +} | |
269 | + | |
270 | +.xdsoft_datetimepicker .xdsoft_month { | |
271 | + width: 100px; | |
272 | + text-align: right; | |
273 | +} | |
274 | + | |
275 | +.xdsoft_datetimepicker .xdsoft_calendar { | |
276 | + clear: both; | |
277 | +} | |
278 | + | |
279 | +.xdsoft_datetimepicker .xdsoft_year{ | |
280 | + width: 48px; | |
281 | + margin-left: 5px; | |
282 | +} | |
283 | + | |
284 | +.xdsoft_datetimepicker .xdsoft_calendar table { | |
285 | + border-collapse: collapse; | |
286 | + width: 100%; | |
287 | + | |
288 | +} | |
289 | + | |
290 | +.xdsoft_datetimepicker .xdsoft_calendar td > div { | |
291 | + padding-right: 5px; | |
292 | +} | |
293 | + | |
294 | +.xdsoft_datetimepicker .xdsoft_calendar th { | |
295 | + height: 25px; | |
296 | +} | |
297 | + | |
298 | +.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th { | |
299 | + width: 14.2857142%; | |
300 | + background: #f5f5f5; | |
301 | + border: 1px solid #ddd; | |
302 | + color: #666; | |
303 | + font-size: 12px; | |
304 | + text-align: right; | |
305 | + vertical-align: middle; | |
306 | + padding: 0; | |
307 | + border-collapse: collapse; | |
308 | + cursor: pointer; | |
309 | + height: 25px; | |
310 | +} | |
311 | +.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th { | |
312 | + width: 12.5%; | |
313 | +} | |
314 | + | |
315 | +.xdsoft_datetimepicker .xdsoft_calendar th { | |
316 | + background: #f1f1f1; | |
317 | +} | |
318 | + | |
319 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today { | |
320 | + color: #33aaff; | |
321 | +} | |
322 | + | |
323 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_default { | |
324 | + background: #ffe9d2; | |
325 | + box-shadow: #ffb871 0 1px 4px 0 inset; | |
326 | + color: #000; | |
327 | +} | |
328 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_mint { | |
329 | + background: #c1ffc9; | |
330 | + box-shadow: #00dd1c 0 1px 4px 0 inset; | |
331 | + color: #000; | |
332 | +} | |
333 | + | |
334 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default, | |
335 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current, | |
336 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current { | |
337 | + background: #33aaff; | |
338 | + box-shadow: #178fe5 0 1px 3px 0 inset; | |
339 | + color: #fff; | |
340 | + font-weight: 700; | |
341 | +} | |
342 | + | |
343 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month, | |
344 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled, | |
345 | +.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled { | |
346 | + opacity: 0.5; | |
347 | + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; | |
348 | + cursor: default; | |
349 | +} | |
350 | + | |
351 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled { | |
352 | + opacity: 0.2; | |
353 | + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; | |
354 | +} | |
355 | + | |
356 | +.xdsoft_datetimepicker .xdsoft_calendar td:hover, | |
357 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover { | |
358 | + color: #fff !important; | |
359 | + background: #ff8000 !important; | |
360 | + box-shadow: none !important; | |
361 | +} | |
362 | + | |
363 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover, | |
364 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current.xdsoft_disabled:hover { | |
365 | + background: #33aaff !important; | |
366 | + box-shadow: #178fe5 0 1px 3px 0 inset !important; | |
367 | + color: #fff !important; | |
368 | +} | |
369 | + | |
370 | +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover, | |
371 | +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover { | |
372 | + color: inherit !important; | |
373 | + background: inherit !important; | |
374 | + box-shadow: inherit !important; | |
375 | +} | |
376 | + | |
377 | +.xdsoft_datetimepicker .xdsoft_calendar th { | |
378 | + font-weight: 700; | |
379 | + text-align: center; | |
380 | + color: #999; | |
381 | + cursor: default; | |
382 | +} | |
383 | + | |
384 | +.xdsoft_datetimepicker .xdsoft_copyright { | |
385 | + color: #ccc !important; | |
386 | + font-size: 10px; | |
387 | + clear: both; | |
388 | + float: none; | |
389 | + margin-left: 8px; | |
390 | +} | |
391 | + | |
392 | +.xdsoft_datetimepicker .xdsoft_copyright a { color: #eee !important } | |
393 | +.xdsoft_datetimepicker .xdsoft_copyright a:hover { color: #aaa !important } | |
394 | + | |
395 | +.xdsoft_time_box { | |
396 | + position: relative; | |
397 | + border: 1px solid #ccc; | |
398 | +} | |
399 | +.xdsoft_scrollbar >.xdsoft_scroller { | |
400 | + background: #ccc !important; | |
401 | + height: 20px; | |
402 | + border-radius: 3px; | |
403 | +} | |
404 | +.xdsoft_scrollbar { | |
405 | + position: absolute; | |
406 | + width: 7px; | |
407 | + right: 0; | |
408 | + top: 0; | |
409 | + bottom: 0; | |
410 | + cursor: pointer; | |
411 | +} | |
412 | +.xdsoft_datetimepicker.xdsoft_rtl .xdsoft_scrollbar { | |
413 | + left: 0; | |
414 | + right: auto; | |
415 | +} | |
416 | +.xdsoft_scroller_box { | |
417 | + position: relative; | |
418 | +} | |
419 | + | |
420 | +.xdsoft_datetimepicker.xdsoft_dark { | |
421 | + box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506); | |
422 | + background: #000; | |
423 | + border-bottom: 1px solid #444; | |
424 | + border-left: 1px solid #333; | |
425 | + border-right: 1px solid #333; | |
426 | + border-top: 1px solid #333; | |
427 | + color: #ccc; | |
428 | +} | |
429 | + | |
430 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box { | |
431 | + border-bottom: 1px solid #222; | |
432 | +} | |
433 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div { | |
434 | + background: #0a0a0a; | |
435 | + border-top: 1px solid #222; | |
436 | + color: #999; | |
437 | +} | |
438 | + | |
439 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label { | |
440 | + background-color: #000; | |
441 | +} | |
442 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select { | |
443 | + border: 1px solid #333; | |
444 | + background: #000; | |
445 | +} | |
446 | + | |
447 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover { | |
448 | + color: #000; | |
449 | + background: #007fff; | |
450 | +} | |
451 | + | |
452 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current { | |
453 | + background: #cc5500; | |
454 | + box-shadow: #b03e00 0 1px 3px 0 inset; | |
455 | + color: #000; | |
456 | +} | |
457 | + | |
458 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i, | |
459 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev, | |
460 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_next, | |
461 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button { | |
462 | + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==); | |
463 | +} | |
464 | + | |
465 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td, | |
466 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { | |
467 | + background: #0a0a0a; | |
468 | + border: 1px solid #222; | |
469 | + color: #999; | |
470 | +} | |
471 | + | |
472 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { | |
473 | + background: #0e0e0e; | |
474 | +} | |
475 | + | |
476 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today { | |
477 | + color: #cc5500; | |
478 | +} | |
479 | + | |
480 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_default { | |
481 | + background: #ffe9d2; | |
482 | + box-shadow: #ffb871 0 1px 4px 0 inset; | |
483 | + color:#000; | |
484 | +} | |
485 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_mint { | |
486 | + background: #c1ffc9; | |
487 | + box-shadow: #00dd1c 0 1px 4px 0 inset; | |
488 | + color:#000; | |
489 | +} | |
490 | + | |
491 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default, | |
492 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current, | |
493 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current { | |
494 | + background: #cc5500; | |
495 | + box-shadow: #b03e00 0 1px 3px 0 inset; | |
496 | + color: #000; | |
497 | +} | |
498 | + | |
499 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover, | |
500 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover { | |
501 | + color: #000 !important; | |
502 | + background: #007fff !important; | |
503 | +} | |
504 | + | |
505 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { | |
506 | + color: #666; | |
507 | +} | |
508 | + | |
509 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright { color: #333 !important } | |
510 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a { color: #111 !important } | |
511 | +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover { color: #555 !important } | |
512 | + | |
513 | +.xdsoft_dark .xdsoft_time_box { | |
514 | + border: 1px solid #333; | |
515 | +} | |
516 | + | |
517 | +.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller { | |
518 | + background: #333 !important; | |
519 | +} | |
520 | +.xdsoft_datetimepicker .xdsoft_save_selected { | |
521 | + display: block; | |
522 | + border: 1px solid #dddddd !important; | |
523 | + margin-top: 5px; | |
524 | + width: 100%; | |
525 | + color: #454551; | |
526 | + font-size: 13px; | |
527 | +} | |
528 | +.xdsoft_datetimepicker .blue-gradient-button { | |
529 | + font-family: "museo-sans", "Book Antiqua", sans-serif; | |
530 | + font-size: 12px; | |
531 | + font-weight: 300; | |
532 | + color: #82878c; | |
533 | + height: 28px; | |
534 | + position: relative; | |
535 | + padding: 4px 17px 4px 33px; | |
536 | + border: 1px solid #d7d8da; | |
537 | + background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%); | |
538 | + /* FF3.6+ */ | |
539 | + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa)); | |
540 | + /* Chrome,Safari4+ */ | |
541 | + background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%); | |
542 | + /* Chrome10+,Safari5.1+ */ | |
543 | + background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%); | |
544 | + /* Opera 11.10+ */ | |
545 | + background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%); | |
546 | + /* IE10+ */ | |
547 | + background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%); | |
548 | + /* W3C */ | |
549 | + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 ); | |
550 | +/* IE6-9 */ | |
551 | +} | |
552 | +.xdsoft_datetimepicker .blue-gradient-button:hover, .xdsoft_datetimepicker .blue-gradient-button:focus, .xdsoft_datetimepicker .blue-gradient-button:hover span, .xdsoft_datetimepicker .blue-gradient-button:focus span { | |
553 | + color: #454551; | |
554 | + background: -moz-linear-gradient(top, #f4f8fa 0%, #FFF 73%); | |
555 | + /* FF3.6+ */ | |
556 | + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f8fa), color-stop(73%, #FFF)); | |
557 | + /* Chrome,Safari4+ */ | |
558 | + background: -webkit-linear-gradient(top, #f4f8fa 0%, #FFF 73%); | |
559 | + /* Chrome10+,Safari5.1+ */ | |
560 | + background: -o-linear-gradient(top, #f4f8fa 0%, #FFF 73%); | |
561 | + /* Opera 11.10+ */ | |
562 | + background: -ms-linear-gradient(top, #f4f8fa 0%, #FFF 73%); | |
563 | + /* IE10+ */ | |
564 | + background: linear-gradient(to bottom, #f4f8fa 0%, #FFF 73%); | |
565 | + /* W3C */ | |
566 | + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f8fa', endColorstr='#FFF',GradientType=0 ); | |
567 | + /* IE6-9 */ | |
568 | +} | ... | ... |
WebRoot/static/js/control_template.js
0 → 100644
1 | +var questionNUm = 0; | |
2 | +/*数字转汉字数字*/ | |
3 | +var chnNumChar = [ "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" ]; | |
4 | +var chnUnitSection = [ "", "万", "亿", "万亿", "亿亿" ]; | |
5 | +var chnUnitChar = [ "", "十", "百", "千" ]; | |
6 | +/* 快速创建答案列表 */ | |
7 | +var score = 0; | |
8 | +var total_score = 0; | |
9 | +var answerLen = 0; | |
10 | + | |
11 | + | |
12 | +$(function() { | |
13 | + | |
14 | + | |
15 | + function creat(q_num, a_num, fraction) { | |
16 | + // $(".section").remove(); | |
17 | + answer_index_b = $(".section").length + 1; | |
18 | + | |
19 | + $(".content").append('<div class="section section-' + answer_index_b+ ' single" data-fraction="'+ fraction+ '" data-score="' | |
20 | + + (q_num * fraction) + '" style="margin-top:80px;"><div class="title"><h3>第' + answer_index_b+ '大题(单选)总分: ' | |
21 | + + q_num + ' X ' + fraction + ' = ' + (q_num * fraction) | |
22 | + + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span> --></h3> </div><div class="question_list"></div></div>'); | |
23 | + for (var i = 0; i < q_num; i++) { | |
24 | + str_temp = str[i]; | |
25 | + str_temp = str_temp.toUpperCase() | |
26 | + code = str_temp.charCodeAt(); | |
27 | + on_index = code - 65; | |
28 | + questionNUm++; | |
29 | + if (code < (65 + a_num)) { | |
30 | + console.log(str_temp); | |
31 | + $(".section-" + answer_index_b + " .question_list").append( | |
32 | + '<div class="question question' + (questionNUm) | |
33 | + + '"><span>' + (questionNUm) | |
34 | + + '、</span><ul></ul></div>'); | |
35 | + for (var j = 0; j < a_num; j++) { | |
36 | + option = String.fromCharCode(0x41 + j); | |
37 | + if (on_index == j) { | |
38 | + console.log(on_index + "---" + j); | |
39 | + $(".question" + (questionNUm) + ' ul').append( | |
40 | + '<li class="btn btn-default on">' + option | |
41 | + + '</li>'); | |
42 | + } else | |
43 | + $(".question" + (questionNUm) + ' ul').append( | |
44 | + '<li class="btn btn-default">' + option | |
45 | + + '</li>'); | |
46 | + } | |
47 | + } else { | |
48 | + alert("题目" + (i + 1) + ":" + String.fromCharCode(code) | |
49 | + + "答案错误,超出选项数"); | |
50 | + // return; | |
51 | + } | |
52 | + } | |
53 | + $(".section-" + answer_index_b).attr("data-score", | |
54 | + q_num * fraction); | |
55 | + total_score += q_num * fraction; | |
56 | + $("#score_all").text(total_score); | |
57 | + } | |
58 | + | |
59 | + /*************************************************************************** | |
60 | + * 1、单选题 2、完形填空 3、阅读理解 4、判断题 5、多选题 | |
61 | + **************************************************************************/ | |
62 | + | |
63 | + function addQuestion(type, a_num, index_s_2, fraction2) { | |
64 | + console.log(type); | |
65 | + fraction2=parseInt(fraction2); | |
66 | + console.log(fraction2); | |
67 | + answer_index_b = $(".section").length + 1; | |
68 | + var question_num = SectionToChinese($(".section").length + 1); | |
69 | + switch (type) { | |
70 | + case 1: // 单选题 | |
71 | + // alert(typeof(index_s_2)); | |
72 | + $(".content") | |
73 | + .append( | |
74 | + '<div class="section section-' | |
75 | + + answer_index_b | |
76 | + + ' " ' | |
77 | + +'data-type="1" ' | |
78 | + +'data-questionNum="' | |
79 | + +index_s_2 | |
80 | + +'" data-optionNum="' | |
81 | + +a_num | |
82 | + +'" ' | |
83 | + +'data-fraction="' | |
84 | + + fraction2 | |
85 | + + '" data-score="' | |
86 | + + (index_s_2 * fraction2) | |
87 | + + '"> <div class="title"><h3>第' | |
88 | + + answer_index_b | |
89 | + + '大题(单选)总分: ' | |
90 | + + index_s_2 | |
91 | + + ' X ' | |
92 | + + fraction2 | |
93 | + + ' = ' | |
94 | + + index_s_2 * fraction2 | |
95 | + + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
96 | + for (i = 1; i <= index_s_2; i++) { | |
97 | + $(".section-" + answer_index_b + " .question_list").append( | |
98 | + '<div class="question question' + i + '"><span>' + i | |
99 | + + '、</span><ul></ul></div>'); | |
100 | + for (var j = 0; j < a_num; j++) { | |
101 | + option = String.fromCharCode(0x41 + j); | |
102 | + $(".section-" + answer_index_b + " .question" + i + ' ul') | |
103 | + .append( | |
104 | + '<li class="btn btn-default">' + option | |
105 | + + '</li>'); | |
106 | + } | |
107 | + } | |
108 | + total_score += index_s_2 * fraction2; | |
109 | + $("#score_all").text(total_score); | |
110 | + break; | |
111 | + case 2: // 多选题 | |
112 | + // $(".content").html(""); | |
113 | + $(".content") | |
114 | + .append( | |
115 | + '<div class="section section-' | |
116 | + + answer_index_b | |
117 | + + ' " ' | |
118 | + +'data-type="2" ' | |
119 | + +'data-questionNum="' | |
120 | + +index_s_2 | |
121 | + +'" data-optionNum="' | |
122 | + +a_num | |
123 | + +'" ' | |
124 | + + ' " data-fraction="' | |
125 | + + fraction2 | |
126 | + + '" data-score="' | |
127 | + + (index_s_2 * fraction2) | |
128 | + + '"> <div class="title"><h3>第' | |
129 | + + answer_index_b | |
130 | + + '大题(多选)总分: ' | |
131 | + + index_s_2 | |
132 | + + ' X ' | |
133 | + + fraction2 | |
134 | + + ' = ' | |
135 | + + index_s_2 * fraction2 | |
136 | + + ' 分<!--<span>请在试题选项上点击,亮色为该试题的正确答案 </span>--></h3> </div> <div class="question_list"></div></div>'); | |
137 | + for (var i = 1; i <= index_s_2; i++) { | |
138 | + questionNUm++; | |
139 | + $(".section-" + answer_index_b + " .question_list").append( | |
140 | + '<div class="question question' + questionNUm | |
141 | + + '"><span>' + questionNUm | |
142 | + + '、</span><ul></ul></div>'); | |
143 | + for (var j = 0; j < a_num; j++) { | |
144 | + option = String.fromCharCode(0x41 + j); | |
145 | + $( | |
146 | + ".section-" + answer_index_b + " .question" | |
147 | + + questionNUm + ' ul').append( | |
148 | + '<li class="btn btn-default">' + option + '</li>'); | |
149 | + } | |
150 | + } | |
151 | + total_score += index_s_2 * fraction2; | |
152 | + $("#score_all").text(total_score); | |
153 | + break; | |
154 | + } | |
155 | + $(".section0").attr("data-score", | |
156 | + $(".section0").find(".question").length * fraction2); | |
157 | + } | |
158 | + | |
159 | + | |
160 | + | |
161 | + /* 添加试题的确定按钮 */ | |
162 | + $("#addQuestion_submit").click(function() { | |
163 | + // $("#fast").attr("disabled","disabled"); | |
164 | + var type_2 = parseInt($("#type").val()); | |
165 | + var index_s_2 =parseInt($("#index_s_2").val()); | |
166 | + //var index_e_2 = parseInt($("#index_s_2").val()); | |
167 | + | |
168 | + | |
169 | + // var answer_2=$("#answer_2").val(); | |
170 | + var num_ans_2 = $("#num_ans_2").val(); | |
171 | + var fraction2 = parseFloat($("#fraction2").val()); | |
172 | + if (isNaN(index_s_2)) { | |
173 | + alert("请输入题目个数"); | |
174 | + return; | |
175 | + } else if (isNaN(fraction2)) { | |
176 | + alert("请输入题目分数"); | |
177 | + return; | |
178 | + } | |
179 | + | |
180 | + // console.log(typeof(type_2)); | |
181 | + console.log(type_2+'-'+ num_ans_2+"-"+ index_s_2+"-"+ fraction2); | |
182 | + | |
183 | + addQuestion(type_2, num_ans_2, index_s_2, fraction2); | |
184 | + $('.addQuestion').modal('hide'); | |
185 | + }) | |
186 | + | |
187 | + | |
188 | + | |
189 | + | |
190 | + /* 提交保存数据 */ | |
191 | + $("#save").click(function() { | |
192 | + var url = URL; | |
193 | + | |
194 | + var data = { | |
195 | + title : $(".header_box h1").text(), | |
196 | + //exam_time : parseInt($("#time").text()), | |
197 | + //paper_type : testData.paper_type, | |
198 | + subject_id : testData.subject_id, | |
199 | + grade_id : testData.grade_id, | |
200 | + user_id : testData.user_id, | |
201 | + school_id : testData.school_id, | |
202 | + score : total_score, | |
203 | + questions : [] | |
204 | + }; | |
205 | + | |
206 | + if ($(".section").length > 0) { | |
207 | + var rank = 0; | |
208 | + for (i = 0; i < $(".section").length; i++) { | |
209 | + data.questions[i] = { | |
210 | + index: i+1, | |
211 | + type: $(".section").eq(i).attr("data-type"), | |
212 | + questionNum: $(".section").eq(i).attr("data-questionNum"), | |
213 | + optionNum: $(".section").eq(i).attr("data-optionNum"), | |
214 | + score: $(".section").eq(i).attr("data-fraction") | |
215 | + }; | |
216 | + } | |
217 | + } | |
218 | + | |
219 | + if (data.questions.length > 0) { | |
220 | + data = JSON.stringify(data); | |
221 | + dataJson = { | |
222 | + "json" : data | |
223 | + }; | |
224 | + ajax_submit(url, dataJson); | |
225 | + } else | |
226 | + alert("请添加试题"); | |
227 | + }); | |
228 | + | |
229 | + /* ajax封装函数 */ | |
230 | + function ajax_submit(url, data) { | |
231 | + $(".loading").css("display", "block"); | |
232 | + console.log(data); | |
233 | + $.ajax({ | |
234 | + url : url, | |
235 | + type : "POST", | |
236 | + data : data, | |
237 | + dataType : "json", | |
238 | + contentType : "application/x-www-form-urlencoded; charset=utf-8", | |
239 | + success : function(data) { | |
240 | + $(".loading").css("display", "none"); | |
241 | + if(testData.paper_type == '1'){ | |
242 | + window.location.href = JUMP_URL + "?a=1&defaulturl=../paper/list2.do"; | |
243 | + }else{ | |
244 | + window.location.href = JUMP_URL + "?a=1&defaulturl=../paper/list4.do?school_id=" + testData.school_id ; | |
245 | + } | |
246 | + } | |
247 | + }) | |
248 | + } | |
249 | + function fastSort(array, head, tail) { | |
250 | + // 考虑到给每个分区操作的时候都是在原有的数组中进行操作的,所以这里head,tail来确定分片的位置 | |
251 | + /* 生成随机项 */ | |
252 | + var randomnum = parseInt((head + tail) / 2); | |
253 | + var random = array[randomnum]; | |
254 | + /* 将小于random的项放置在其左边 策略就是通过一个临时的数组来储存分好区的结果,再到原数组中替换 */ | |
255 | + var arrayTemp = []; | |
256 | + var unshiftHead = 0; | |
257 | + for (var i = head; i <= tail; i++) { | |
258 | + if (parseInt(array[i].rank) < parseInt(random.rank)) { | |
259 | + arrayTemp.unshift(array[i]); | |
260 | + unshiftHead++; | |
261 | + } else if (parseInt(array[i].rank) > parseInt(random.rank)) { | |
262 | + arrayTemp.push(array[i]); | |
263 | + } | |
264 | + /* 当它等于的时候放哪,这里我想选择放到队列的前面,也就是从unshift后的第一个位置放置 */ | |
265 | + if (parseInt(array[i].rank) === parseInt(random.rank)) { | |
266 | + arrayTemp.splice(unshiftHead, 0, array[i]); | |
267 | + } | |
268 | + } | |
269 | + /* 将对应项覆盖原来的记录 */ | |
270 | + for (var j = head, u = 0; j <= tail; j++, u++) { | |
271 | + array.splice(j, 1, arrayTemp[u]); | |
272 | + } | |
273 | + /* 寻找中间项所在的index */ | |
274 | + var nowIndex = array.indexOf(random); | |
275 | + | |
276 | + /* 设置出口,当要放进去的片段只有2项的时候就可以收工了 */ | |
277 | + if (arrayTemp.length <= 2) { | |
278 | + return; | |
279 | + } | |
280 | + /* 递归,同时应用其左右两个区域 */ | |
281 | + fastSort(array, head, nowIndex); | |
282 | + fastSort(array, nowIndex + 1, tail); | |
283 | + } | |
284 | + function creatHtml(data) { | |
285 | + console.log(data); | |
286 | + $(".header_box h1").html(data.title); | |
287 | + $("#time").html(data.exam_time); | |
288 | + if(data.score != null && data.score > 0 && data.score != ''){ | |
289 | + $("#score_all").html(data.score); | |
290 | + } | |
291 | + | |
292 | + if (data.questions.length > 0) { | |
293 | + $(".time").removeAttr("data-target"); | |
294 | + $(".remove").remove(); | |
295 | + $(".btn_box").remove(); | |
296 | + } | |
297 | + | |
298 | + for (var i = 0; i < data.questions.length; i++) { | |
299 | + if (data.questions[i].questions) { | |
300 | + $(".content") | |
301 | + .append( | |
302 | + '<div class="section section-' | |
303 | + + i | |
304 | + + '" data-fraction="' | |
305 | + + data.questions[i].score | |
306 | + + '" style="margin-top:80px;"> <h3><span class="que_num">' | |
307 | + + '第' | |
308 | + + (i + 1) | |
309 | + + '大题总分:' | |
310 | + + data.questions[i].questions.length | |
311 | + + " X " | |
312 | + + (parseFloat(data.questions[i].sug_score) / data.questions[i].questions.length) | |
313 | + + " = " | |
314 | + + data.questions[i].sug_score | |
315 | + + '</span>' | |
316 | + + '<span class="que_name">' | |
317 | + + data.questions[i].content | |
318 | + + '</span></h3><!-- <input type="button" class="btn btn-danger pull-right remove" name="remove" value="删除" /> --> <div class="question_list"></div></div>'); | |
319 | + } else { | |
320 | + if (i == 0) { | |
321 | + $(".content") | |
322 | + .append( | |
323 | + '<div class="section section0"> <div class="question_list" style="margin-top:80px"></div></div>'); | |
324 | + } | |
325 | + $(".section0").find(".question_list").append( | |
326 | + '<div class="question question' + (i + 1) + '"><span>' | |
327 | + + (++questionNUm) + '、</span><ul></ul></div>'); | |
328 | + for (var k = 0; k < parseInt(data.questions[i].option_num); k++) { | |
329 | + str_temp = data.questions[i].answer; | |
330 | + $(".section0").find(".question" + (i + 1) + ' ul').append( | |
331 | + '<li class="btn btn-default">' | |
332 | + + String.fromCharCode(0x41 + k) + '</li>'); | |
333 | + for (var l = 0; l < str_temp.length; l++) { | |
334 | + str_temp_arry = str_temp.split(''); | |
335 | + code = str_temp_arry[l].charCodeAt(); | |
336 | + on_index = code - 65; | |
337 | + if (on_index == k) { | |
338 | + $(".section0").find( | |
339 | + ".question" + (i + 1) + ' ul li').eq( | |
340 | + on_index).attr("class", | |
341 | + "btn btn-default on"); | |
342 | + } | |
343 | + } | |
344 | + } | |
345 | + } | |
346 | + | |
347 | + if (data.questions[i].questions) { | |
348 | + for (var j = 0; j < data.questions[i].questions.length; j++) { | |
349 | + $(".section-" + i).find(".question_list").append( | |
350 | + '<div class="question question' + (j + 1) | |
351 | + + '"><span>' + (++questionNUm) | |
352 | + + '、</span><ul></ul></div>'); | |
353 | + if ($(".section-" + i).find(".que_name").text() == "判断题") { | |
354 | + for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { | |
355 | + str_temp = data.questions[i].questions[j].answer; | |
356 | + if (k % 2 == 0) { | |
357 | + $(".section-" + i).find( | |
358 | + ".question" + (j + 1) + ' ul').append( | |
359 | + '<li class="btn btn-default">√</li>'); | |
360 | + } else if (k % 2 == 1) { | |
361 | + $(".section-" + i).find( | |
362 | + ".question" + (j + 1) + ' ul').append( | |
363 | + '<li class="btn btn-default">×</li>'); | |
364 | + } | |
365 | + | |
366 | + if (str_temp == "√") | |
367 | + $(".section-" + i).find( | |
368 | + ".question" + (j + 1) + ' ul li').eq(0) | |
369 | + .attr("class", "btn btn-default on"); | |
370 | + else | |
371 | + $(".section-" + i).find( | |
372 | + ".question" + (j + 1) + ' ul li').eq(1) | |
373 | + .attr("class", "btn btn-default on"); | |
374 | + } | |
375 | + } else { | |
376 | + for (var k = 0; k < parseInt(data.questions[i].questions[j].option_num); k++) { | |
377 | + str_temp = data.questions[i].questions[j].answer; | |
378 | + $(".section-" + i).find( | |
379 | + ".question" + (j + 1) + ' ul').append( | |
380 | + '<li class="btn btn-default">' | |
381 | + + String.fromCharCode(0x41 + k) | |
382 | + + '</li>'); | |
383 | + for (var l = 0; l < str_temp.length; l++) { | |
384 | + str_temp_arry = str_temp.split(''); | |
385 | + code = str_temp_arry[l].charCodeAt(); | |
386 | + on_index = code - 65; | |
387 | + if (on_index == k) { | |
388 | + $(".section-" + i).find( | |
389 | + ".question" + (j + 1) + ' ul li') | |
390 | + .eq(on_index).attr("class", | |
391 | + "btn btn-default on"); | |
392 | + } | |
393 | + } | |
394 | + } | |
395 | + } | |
396 | + } | |
397 | + } | |
398 | + } | |
399 | + } | |
400 | + | |
401 | + | |
402 | + /*快速建题中,每输入五个答案就加一个空格*/ | |
403 | + $("#answer").on("input propertychange", function(event) { | |
404 | + var answerStr = ""; | |
405 | + answerStr = $("#answer").val(); | |
406 | + var result = ""; | |
407 | + if (answerStr.length > 5) { | |
408 | + answerStr = answerStr.replace(new RegExp(" ", "gm"), ""); | |
409 | + for (var i = 0; i < answerStr.length; i++) { | |
410 | + result += answerStr[i]; | |
411 | + if (i % 5 == 4 && i != answerStr.length - 1) { | |
412 | + result += " "; | |
413 | + } | |
414 | + } | |
415 | + } else { | |
416 | + result = answerStr; | |
417 | + } | |
418 | + $("#answer").val(result); | |
419 | + if (answerStr.length > 0) { | |
420 | + $(".tips").text("共" + answerStr.length + "题"); | |
421 | + } else { | |
422 | + $(".tips").text(""); | |
423 | + } | |
424 | + }) | |
425 | + | |
426 | + | |
427 | + | |
428 | + function SectionToChinese(section) { | |
429 | + var strIns = '', chnStr = ''; | |
430 | + var unitPos = 0; | |
431 | + var zero = true; | |
432 | + while (section > 0) { | |
433 | + var v = section % 10; | |
434 | + if (v === 0) { | |
435 | + if (!zero) { | |
436 | + zero = true; | |
437 | + chnStr = chnNumChar[v] + chnStr; | |
438 | + } | |
439 | + } else { | |
440 | + zero = false; | |
441 | + strIns = chnNumChar[v]; | |
442 | + strIns += chnUnitChar[unitPos]; | |
443 | + chnStr = strIns + chnStr; | |
444 | + } | |
445 | + unitPos++; | |
446 | + section = Math.floor(section / 10); | |
447 | + } | |
448 | + return chnStr; | |
449 | + } | |
450 | + | |
451 | + | |
452 | + if (template != null && template.length > 0) { | |
453 | + | |
454 | + $("#addQuestion").attr("disabled", "disabled"); | |
455 | + $("#fast").attr("disabled", "disabled"); | |
456 | + for (var i = 0; i < template.length; i++) { | |
457 | + if (template[i].type == 1) { | |
458 | + var answer = ""; | |
459 | + for (var j = 0; j < template[i].questionNum; j++) { | |
460 | + answer += "1"; | |
461 | + } | |
462 | + creat(answer, template[i].optionNum, template[i].score); | |
463 | + } | |
464 | + if (template[i].type == 2) { | |
465 | + addQuestion(5, template[i].optionNum, 1, | |
466 | + template[i].questionNum, template[i].score); | |
467 | + } | |
468 | + } | |
469 | + if(testData != null){ | |
470 | + $(".header_box h1").html(testData.title); | |
471 | + $("#time").html(testData.exam_time); | |
472 | + if(testData.score != null && testData.score > 0 && testData.score != ''){ | |
473 | + $("#score_all").html(testData.score); | |
474 | + } | |
475 | + } | |
476 | + | |
477 | + }else if (testData != null && testData.questions != null | |
478 | + && testData.questions.length > 0) { | |
479 | + fastSort(testData.questions, 0, testData.questions.length - 1); | |
480 | + for (var i = 0; i < testData.questions.length; i++) { | |
481 | + | |
482 | + if (testData.questions[0].questions | |
483 | + && testData.questions[0].questions.length > 1) { | |
484 | + fastSort(testData.questions[i].questions, 0, | |
485 | + testData.questions[i].questions.length - 1); | |
486 | + } | |
487 | + } | |
488 | + creatHtml(testData); | |
489 | + }else{ | |
490 | + if(testData != null){ | |
491 | + $(".header_box h1").html(testData.title); | |
492 | + $("#time").html(testData.exam_time); | |
493 | + if(testData.score != null && testData.score > 0 && testData.score != ''){ | |
494 | + $("#score_all").html(testData.score); | |
495 | + } | |
496 | + } | |
497 | + } | |
498 | +}) | ... | ... |
WebRoot/static/js/jquery.datetimepicker.full.js
0 → 100644
1 | +/*! | |
2 | + * @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2015 | |
3 | + * @version 1.3.3 | |
4 | + * | |
5 | + * Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format. | |
6 | + * @see http://php.net/manual/en/function.date.php | |
7 | + * | |
8 | + * For more JQuery plugins visit http://plugins.krajee.com | |
9 | + * For more Yii related demos visit http://demos.krajee.com | |
10 | + */ | |
11 | +var DateFormatter; | |
12 | +(function () { | |
13 | + "use strict"; | |
14 | + | |
15 | + var _compare, _lpad, _extend, defaultSettings, DAY, HOUR; | |
16 | + DAY = 1000 * 60 * 60 * 24; | |
17 | + HOUR = 3600; | |
18 | + | |
19 | + _compare = function (str1, str2) { | |
20 | + return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase(); | |
21 | + }; | |
22 | + _lpad = function (value, length, char) { | |
23 | + var chr = char || '0', val = value.toString(); | |
24 | + return val.length < length ? _lpad(chr + val, length) : val; | |
25 | + }; | |
26 | + _extend = function (out) { | |
27 | + var i, obj; | |
28 | + out = out || {}; | |
29 | + for (i = 1; i < arguments.length; i++) { | |
30 | + obj = arguments[i]; | |
31 | + if (!obj) { | |
32 | + continue; | |
33 | + } | |
34 | + for (var key in obj) { | |
35 | + if (obj.hasOwnProperty(key)) { | |
36 | + if (typeof obj[key] === 'object') { | |
37 | + _extend(out[key], obj[key]); | |
38 | + } else { | |
39 | + out[key] = obj[key]; | |
40 | + } | |
41 | + } | |
42 | + } | |
43 | + } | |
44 | + return out; | |
45 | + }; | |
46 | + defaultSettings = { | |
47 | + dateSettings: { | |
48 | + days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], | |
49 | + daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | |
50 | + months: [ | |
51 | + 'January', 'February', 'March', 'April', 'May', 'June', 'July', | |
52 | + 'August', 'September', 'October', 'November', 'December' | |
53 | + ], | |
54 | + monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | |
55 | + meridiem: ['AM', 'PM'], | |
56 | + ordinal: function (number) { | |
57 | + var n = number % 10, suffixes = {1: 'st', 2: 'nd', 3: 'rd'}; | |
58 | + return Math.floor(number % 100 / 10) === 1 || !suffixes[n] ? 'th' : suffixes[n]; | |
59 | + } | |
60 | + }, | |
61 | + separators: /[ \-+\/\.T:@]/g, | |
62 | + validParts: /[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g, | |
63 | + intParts: /[djwNzmnyYhHgGis]/g, | |
64 | + tzParts: /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, | |
65 | + tzClip: /[^-+\dA-Z]/g | |
66 | + }; | |
67 | + | |
68 | + DateFormatter = function (options) { | |
69 | + var self = this, config = _extend(defaultSettings, options); | |
70 | + self.dateSettings = config.dateSettings; | |
71 | + self.separators = config.separators; | |
72 | + self.validParts = config.validParts; | |
73 | + self.intParts = config.intParts; | |
74 | + self.tzParts = config.tzParts; | |
75 | + self.tzClip = config.tzClip; | |
76 | + }; | |
77 | + | |
78 | + DateFormatter.prototype = { | |
79 | + constructor: DateFormatter, | |
80 | + parseDate: function (vDate, vFormat) { | |
81 | + var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart, | |
82 | + vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer, | |
83 | + out = {date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0}; | |
84 | + if (!vDate) { | |
85 | + return undefined; | |
86 | + } | |
87 | + if (vDate instanceof Date) { | |
88 | + return vDate; | |
89 | + } | |
90 | + if (typeof vDate === 'number') { | |
91 | + return new Date(vDate); | |
92 | + } | |
93 | + if (vFormat === 'U') { | |
94 | + i = parseInt(vDate); | |
95 | + return i ? new Date(i * 1000) : vDate; | |
96 | + } | |
97 | + if (typeof vDate !== 'string') { | |
98 | + return ''; | |
99 | + } | |
100 | + vFormatParts = vFormat.match(self.validParts); | |
101 | + if (!vFormatParts || vFormatParts.length === 0) { | |
102 | + throw new Error("Invalid date format definition."); | |
103 | + } | |
104 | + vDateParts = vDate.replace(self.separators, '\0').split('\0'); | |
105 | + for (i = 0; i < vDateParts.length; i++) { | |
106 | + vDatePart = vDateParts[i]; | |
107 | + iDatePart = parseInt(vDatePart); | |
108 | + switch (vFormatParts[i]) { | |
109 | + case 'y': | |
110 | + case 'Y': | |
111 | + len = vDatePart.length; | |
112 | + if (len === 2) { | |
113 | + out.year = parseInt((iDatePart < 70 ? '20' : '19') + vDatePart); | |
114 | + } else if (len === 4) { | |
115 | + out.year = iDatePart; | |
116 | + } | |
117 | + vDateFlag = true; | |
118 | + break; | |
119 | + case 'm': | |
120 | + case 'n': | |
121 | + case 'M': | |
122 | + case 'F': | |
123 | + if (isNaN(vDatePart)) { | |
124 | + vMonth = vSettings.monthsShort.indexOf(vDatePart); | |
125 | + if (vMonth > -1) { | |
126 | + out.month = vMonth + 1; | |
127 | + } | |
128 | + vMonth = vSettings.months.indexOf(vDatePart); | |
129 | + if (vMonth > -1) { | |
130 | + out.month = vMonth + 1; | |
131 | + } | |
132 | + } else { | |
133 | + if (iDatePart >= 1 && iDatePart <= 12) { | |
134 | + out.month = iDatePart; | |
135 | + } | |
136 | + } | |
137 | + vDateFlag = true; | |
138 | + break; | |
139 | + case 'd': | |
140 | + case 'j': | |
141 | + if (iDatePart >= 1 && iDatePart <= 31) { | |
142 | + out.day = iDatePart; | |
143 | + } | |
144 | + vDateFlag = true; | |
145 | + break; | |
146 | + case 'g': | |
147 | + case 'h': | |
148 | + vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') : | |
149 | + (vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1; | |
150 | + mer = vDateParts[vMeriIndex]; | |
151 | + if (vMeriIndex > -1) { | |
152 | + vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 : | |
153 | + (_compare(mer, vSettings.meridiem[1]) ? 12 : -1); | |
154 | + if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset > -1) { | |
155 | + out.hour = iDatePart + vMeriOffset - 1; | |
156 | + } else if (iDatePart >= 0 && iDatePart <= 23) { | |
157 | + out.hour = iDatePart; | |
158 | + } | |
159 | + } else if (iDatePart >= 0 && iDatePart <= 23) { | |
160 | + out.hour = iDatePart; | |
161 | + } | |
162 | + vTimeFlag = true; | |
163 | + break; | |
164 | + case 'G': | |
165 | + case 'H': | |
166 | + if (iDatePart >= 0 && iDatePart <= 23) { | |
167 | + out.hour = iDatePart; | |
168 | + } | |
169 | + vTimeFlag = true; | |
170 | + break; | |
171 | + case 'i': | |
172 | + if (iDatePart >= 0 && iDatePart <= 59) { | |
173 | + out.min = iDatePart; | |
174 | + } | |
175 | + vTimeFlag = true; | |
176 | + break; | |
177 | + case 's': | |
178 | + if (iDatePart >= 0 && iDatePart <= 59) { | |
179 | + out.sec = iDatePart; | |
180 | + } | |
181 | + vTimeFlag = true; | |
182 | + break; | |
183 | + } | |
184 | + } | |
185 | + if (vDateFlag === true && out.year && out.month && out.day) { | |
186 | + out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0); | |
187 | + } else { | |
188 | + if (vTimeFlag !== true) { | |
189 | + return false; | |
190 | + } | |
191 | + out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0); | |
192 | + } | |
193 | + return out.date; | |
194 | + }, | |
195 | + guessDate: function (vDateStr, vFormat) { | |
196 | + if (typeof vDateStr !== 'string') { | |
197 | + return vDateStr; | |
198 | + } | |
199 | + var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g, | |
200 | + vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, iPart, iSec; | |
201 | + | |
202 | + if (!vPattern.test(vFormatParts[0])) { | |
203 | + return vDateStr; | |
204 | + } | |
205 | + | |
206 | + for (i = 0; i < vParts.length; i++) { | |
207 | + vDigit = 2; | |
208 | + iPart = vParts[i]; | |
209 | + iSec = parseInt(iPart.substr(0, 2)); | |
210 | + switch (i) { | |
211 | + case 0: | |
212 | + if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') { | |
213 | + vDate.setMonth(iSec - 1); | |
214 | + } else { | |
215 | + vDate.setDate(iSec); | |
216 | + } | |
217 | + break; | |
218 | + case 1: | |
219 | + if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') { | |
220 | + vDate.setDate(iSec); | |
221 | + } else { | |
222 | + vDate.setMonth(iSec - 1); | |
223 | + } | |
224 | + break; | |
225 | + case 2: | |
226 | + vYear = vDate.getFullYear(); | |
227 | + if (iPart.length < 4) { | |
228 | + vDate.setFullYear(parseInt(vYear.toString().substr(0, 4 - iPart.length) + iPart)); | |
229 | + vDigit = iPart.length; | |
230 | + } else { | |
231 | + vDate.setFullYear = parseInt(iPart.substr(0, 4)); | |
232 | + vDigit = 4; | |
233 | + } | |
234 | + break; | |
235 | + case 3: | |
236 | + vDate.setHours(iSec); | |
237 | + break; | |
238 | + case 4: | |
239 | + vDate.setMinutes(iSec); | |
240 | + break; | |
241 | + case 5: | |
242 | + vDate.setSeconds(iSec); | |
243 | + break; | |
244 | + } | |
245 | + if (iPart.substr(vDigit).length > 0) { | |
246 | + vParts.splice(i + 1, 0, iPart.substr(vDigit)); | |
247 | + } | |
248 | + } | |
249 | + return vDate; | |
250 | + }, | |
251 | + parseFormat: function (vChar, vDate) { | |
252 | + var self = this, vSettings = self.dateSettings, fmt, backspace = /\\?(.?)/gi, doFormat = function (t, s) { | |
253 | + return fmt[t] ? fmt[t]() : s; | |
254 | + }; | |
255 | + fmt = { | |
256 | + ///////// | |
257 | + // DAY // | |
258 | + ///////// | |
259 | + /** | |
260 | + * Day of month with leading 0: `01..31` | |
261 | + * @return {string} | |
262 | + */ | |
263 | + d: function () { | |
264 | + return _lpad(fmt.j(), 2); | |
265 | + }, | |
266 | + /** | |
267 | + * Shorthand day name: `Mon...Sun` | |
268 | + * @return {string} | |
269 | + */ | |
270 | + D: function () { | |
271 | + return vSettings.daysShort[fmt.w()]; | |
272 | + }, | |
273 | + /** | |
274 | + * Day of month: `1..31` | |
275 | + * @return {number} | |
276 | + */ | |
277 | + j: function () { | |
278 | + return vDate.getDate(); | |
279 | + }, | |
280 | + /** | |
281 | + * Full day name: `Monday...Sunday` | |
282 | + * @return {number} | |
283 | + */ | |
284 | + l: function () { | |
285 | + return vSettings.days[fmt.w()]; | |
286 | + }, | |
287 | + /** | |
288 | + * ISO-8601 day of week: `1[Mon]..7[Sun]` | |
289 | + * @return {number} | |
290 | + */ | |
291 | + N: function () { | |
292 | + return fmt.w() || 7; | |
293 | + }, | |
294 | + /** | |
295 | + * Day of week: `0[Sun]..6[Sat]` | |
296 | + * @return {number} | |
297 | + */ | |
298 | + w: function () { | |
299 | + return vDate.getDay(); | |
300 | + }, | |
301 | + /** | |
302 | + * Day of year: `0..365` | |
303 | + * @return {number} | |
304 | + */ | |
305 | + z: function () { | |
306 | + var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j()), b = new Date(fmt.Y(), 0, 1); | |
307 | + return Math.round((a - b) / DAY); | |
308 | + }, | |
309 | + | |
310 | + ////////// | |
311 | + // WEEK // | |
312 | + ////////// | |
313 | + /** | |
314 | + * ISO-8601 week number | |
315 | + * @return {number} | |
316 | + */ | |
317 | + W: function () { | |
318 | + var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j() - fmt.N() + 3), b = new Date(a.getFullYear(), 0, 4); | |
319 | + return _lpad(1 + Math.round((a - b) / DAY / 7), 2); | |
320 | + }, | |
321 | + | |
322 | + /////////// | |
323 | + // MONTH // | |
324 | + /////////// | |
325 | + /** | |
326 | + * Full month name: `January...December` | |
327 | + * @return {string} | |
328 | + */ | |
329 | + F: function () { | |
330 | + return vSettings.months[vDate.getMonth()]; | |
331 | + }, | |
332 | + /** | |
333 | + * Month w/leading 0: `01..12` | |
334 | + * @return {string} | |
335 | + */ | |
336 | + m: function () { | |
337 | + return _lpad(fmt.n(), 2); | |
338 | + }, | |
339 | + /** | |
340 | + * Shorthand month name; `Jan...Dec` | |
341 | + * @return {string} | |
342 | + */ | |
343 | + M: function () { | |
344 | + return vSettings.monthsShort[vDate.getMonth()]; | |
345 | + }, | |
346 | + /** | |
347 | + * Month: `1...12` | |
348 | + * @return {number} | |
349 | + */ | |
350 | + n: function () { | |
351 | + return vDate.getMonth() + 1; | |
352 | + }, | |
353 | + /** | |
354 | + * Days in month: `28...31` | |
355 | + * @return {number} | |
356 | + */ | |
357 | + t: function () { | |
358 | + return (new Date(fmt.Y(), fmt.n(), 0)).getDate(); | |
359 | + }, | |
360 | + | |
361 | + ////////// | |
362 | + // YEAR // | |
363 | + ////////// | |
364 | + /** | |
365 | + * Is leap year? `0 or 1` | |
366 | + * @return {number} | |
367 | + */ | |
368 | + L: function () { | |
369 | + var Y = fmt.Y(); | |
370 | + return (Y % 4 === 0 && Y % 100 !== 0 || Y % 400 === 0) ? 1 : 0; | |
371 | + }, | |
372 | + /** | |
373 | + * ISO-8601 year | |
374 | + * @return {number} | |
375 | + */ | |
376 | + o: function () { | |
377 | + var n = fmt.n(), W = fmt.W(), Y = fmt.Y(); | |
378 | + return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0); | |
379 | + }, | |
380 | + /** | |
381 | + * Full year: `e.g. 1980...2010` | |
382 | + * @return {number} | |
383 | + */ | |
384 | + Y: function () { | |
385 | + return vDate.getFullYear(); | |
386 | + }, | |
387 | + /** | |
388 | + * Last two digits of year: `00...99` | |
389 | + * @return {string} | |
390 | + */ | |
391 | + y: function () { | |
392 | + return fmt.Y().toString().slice(-2); | |
393 | + }, | |
394 | + | |
395 | + ////////// | |
396 | + // TIME // | |
397 | + ////////// | |
398 | + /** | |
399 | + * Meridian lower: `am or pm` | |
400 | + * @return {string} | |
401 | + */ | |
402 | + a: function () { | |
403 | + return fmt.A().toLowerCase(); | |
404 | + }, | |
405 | + /** | |
406 | + * Meridian upper: `AM or PM` | |
407 | + * @return {string} | |
408 | + */ | |
409 | + A: function () { | |
410 | + var n = fmt.G() < 12 ? 0 : 1; | |
411 | + return vSettings.meridiem[n]; | |
412 | + }, | |
413 | + /** | |
414 | + * Swatch Internet time: `000..999` | |
415 | + * @return {string} | |
416 | + */ | |
417 | + B: function () { | |
418 | + var H = vDate.getUTCHours() * HOUR, i = vDate.getUTCMinutes() * 60, s = vDate.getUTCSeconds(); | |
419 | + return _lpad(Math.floor((H + i + s + HOUR) / 86.4) % 1000, 3); | |
420 | + }, | |
421 | + /** | |
422 | + * 12-Hours: `1..12` | |
423 | + * @return {number} | |
424 | + */ | |
425 | + g: function () { | |
426 | + return fmt.G() % 12 || 12; | |
427 | + }, | |
428 | + /** | |
429 | + * 24-Hours: `0..23` | |
430 | + * @return {number} | |
431 | + */ | |
432 | + G: function () { | |
433 | + return vDate.getHours(); | |
434 | + }, | |
435 | + /** | |
436 | + * 12-Hours with leading 0: `01..12` | |
437 | + * @return {string} | |
438 | + */ | |
439 | + h: function () { | |
440 | + return _lpad(fmt.g(), 2); | |
441 | + }, | |
442 | + /** | |
443 | + * 24-Hours w/leading 0: `00..23` | |
444 | + * @return {string} | |
445 | + */ | |
446 | + H: function () { | |
447 | + return _lpad(fmt.G(), 2); | |
448 | + }, | |
449 | + /** | |
450 | + * Minutes w/leading 0: `00..59` | |
451 | + * @return {string} | |
452 | + */ | |
453 | + i: function () { | |
454 | + return _lpad(vDate.getMinutes(), 2); | |
455 | + }, | |
456 | + /** | |
457 | + * Seconds w/leading 0: `00..59` | |
458 | + * @return {string} | |
459 | + */ | |
460 | + s: function () { | |
461 | + return _lpad(vDate.getSeconds(), 2); | |
462 | + }, | |
463 | + /** | |
464 | + * Microseconds: `000000-999000` | |
465 | + * @return {string} | |
466 | + */ | |
467 | + u: function () { | |
468 | + return _lpad(vDate.getMilliseconds() * 1000, 6); | |
469 | + }, | |
470 | + | |
471 | + ////////////// | |
472 | + // TIMEZONE // | |
473 | + ////////////// | |
474 | + /** | |
475 | + * Timezone identifier: `e.g. Atlantic/Azores, ...` | |
476 | + * @return {string} | |
477 | + */ | |
478 | + e: function () { | |
479 | + var str = /\((.*)\)/.exec(String(vDate))[1]; | |
480 | + return str || 'Coordinated Universal Time'; | |
481 | + }, | |
482 | + /** | |
483 | + * Timezone abbreviation: `e.g. EST, MDT, ...` | |
484 | + * @return {string} | |
485 | + */ | |
486 | + T: function () { | |
487 | + var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, ""); | |
488 | + return str || 'UTC'; | |
489 | + }, | |
490 | + /** | |
491 | + * DST observed? `0 or 1` | |
492 | + * @return {number} | |
493 | + */ | |
494 | + I: function () { | |
495 | + var a = new Date(fmt.Y(), 0), c = Date.UTC(fmt.Y(), 0), | |
496 | + b = new Date(fmt.Y(), 6), d = Date.UTC(fmt.Y(), 6); | |
497 | + return ((a - c) !== (b - d)) ? 1 : 0; | |
498 | + }, | |
499 | + /** | |
500 | + * Difference to GMT in hour format: `e.g. +0200` | |
501 | + * @return {string} | |
502 | + */ | |
503 | + O: function () { | |
504 | + var tzo = vDate.getTimezoneOffset(), a = Math.abs(tzo); | |
505 | + return (tzo > 0 ? '-' : '+') + _lpad(Math.floor(a / 60) * 100 + a % 60, 4); | |
506 | + }, | |
507 | + /** | |
508 | + * Difference to GMT with colon: `e.g. +02:00` | |
509 | + * @return {string} | |
510 | + */ | |
511 | + P: function () { | |
512 | + var O = fmt.O(); | |
513 | + return (O.substr(0, 3) + ':' + O.substr(3, 2)); | |
514 | + }, | |
515 | + /** | |
516 | + * Timezone offset in seconds: `-43200...50400` | |
517 | + * @return {number} | |
518 | + */ | |
519 | + Z: function () { | |
520 | + return -vDate.getTimezoneOffset() * 60; | |
521 | + }, | |
522 | + | |
523 | + //////////////////// | |
524 | + // FULL DATE TIME // | |
525 | + //////////////////// | |
526 | + /** | |
527 | + * ISO-8601 date | |
528 | + * @return {string} | |
529 | + */ | |
530 | + c: function () { | |
531 | + return 'Y-m-d\\TH:i:sP'.replace(backspace, doFormat); | |
532 | + }, | |
533 | + /** | |
534 | + * RFC 2822 date | |
535 | + * @return {string} | |
536 | + */ | |
537 | + r: function () { | |
538 | + return 'D, d M Y H:i:s O'.replace(backspace, doFormat); | |
539 | + }, | |
540 | + /** | |
541 | + * Seconds since UNIX epoch | |
542 | + * @return {number} | |
543 | + */ | |
544 | + U: function () { | |
545 | + return vDate.getTime() / 1000 || 0; | |
546 | + } | |
547 | + }; | |
548 | + return doFormat(vChar, vChar); | |
549 | + }, | |
550 | + formatDate: function (vDate, vFormat) { | |
551 | + var self = this, i, n, len, str, vChar, vDateStr = ''; | |
552 | + if (typeof vDate === 'string') { | |
553 | + vDate = self.parseDate(vDate, vFormat); | |
554 | + if (vDate === false) { | |
555 | + return false; | |
556 | + } | |
557 | + } | |
558 | + if (vDate instanceof Date) { | |
559 | + len = vFormat.length; | |
560 | + for (i = 0; i < len; i++) { | |
561 | + vChar = vFormat.charAt(i); | |
562 | + if (vChar === 'S') { | |
563 | + continue; | |
564 | + } | |
565 | + str = self.parseFormat(vChar, vDate); | |
566 | + if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') { | |
567 | + n = parseInt(str); | |
568 | + str += self.dateSettings.ordinal(n); | |
569 | + } | |
570 | + vDateStr += str; | |
571 | + } | |
572 | + return vDateStr; | |
573 | + } | |
574 | + return ''; | |
575 | + } | |
576 | + }; | |
577 | +})();/** | |
578 | + * @preserve jQuery DateTimePicker plugin v2.5.3 | |
579 | + * @homepage http://xdsoft.net/jqplugins/datetimepicker/ | |
580 | + * @author Chupurnov Valeriy (<chupurnov@gmail.com>) | |
581 | + */ | |
582 | +/*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/ | |
583 | +;(function (factory) { | |
584 | + if ( typeof define === 'function' && define.amd ) { | |
585 | + // AMD. Register as an anonymous module. | |
586 | + define(['jquery', 'jquery-mousewheel'], factory); | |
587 | + } else if (typeof exports === 'object') { | |
588 | + // Node/CommonJS style for Browserify | |
589 | + module.exports = factory; | |
590 | + } else { | |
591 | + // Browser globals | |
592 | + factory(jQuery); | |
593 | + } | |
594 | +}(function ($) { | |
595 | + 'use strict'; | |
596 | + var default_options = { | |
597 | + i18n: { | |
598 | + ar: { // Arabic | |
599 | + months: [ | |
600 | + "كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول" | |
601 | + ], | |
602 | + dayOfWeekShort: [ | |
603 | + "ن", "ث", "ع", "خ", "ج", "س", "ح" | |
604 | + ], | |
605 | + dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"] | |
606 | + }, | |
607 | + ro: { // Romanian | |
608 | + months: [ | |
609 | + "Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie" | |
610 | + ], | |
611 | + dayOfWeekShort: [ | |
612 | + "Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ" | |
613 | + ], | |
614 | + dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"] | |
615 | + }, | |
616 | + id: { // Indonesian | |
617 | + months: [ | |
618 | + "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" | |
619 | + ], | |
620 | + dayOfWeekShort: [ | |
621 | + "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" | |
622 | + ], | |
623 | + dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"] | |
624 | + }, | |
625 | + is: { // Icelandic | |
626 | + months: [ | |
627 | + "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember" | |
628 | + ], | |
629 | + dayOfWeekShort: [ | |
630 | + "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau" | |
631 | + ], | |
632 | + dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"] | |
633 | + }, | |
634 | + bg: { // Bulgarian | |
635 | + months: [ | |
636 | + "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември" | |
637 | + ], | |
638 | + dayOfWeekShort: [ | |
639 | + "Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" | |
640 | + ], | |
641 | + dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"] | |
642 | + }, | |
643 | + fa: { // Persian/Farsi | |
644 | + months: [ | |
645 | + 'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند' | |
646 | + ], | |
647 | + dayOfWeekShort: [ | |
648 | + 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه' | |
649 | + ], | |
650 | + dayOfWeek: ["یکشنبه", "دوشنبه", "سهشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه", "یکشنبه"] | |
651 | + }, | |
652 | + ru: { // Russian | |
653 | + months: [ | |
654 | + 'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь' | |
655 | + ], | |
656 | + dayOfWeekShort: [ | |
657 | + "Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб" | |
658 | + ], | |
659 | + dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"] | |
660 | + }, | |
661 | + uk: { // Ukrainian | |
662 | + months: [ | |
663 | + 'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень' | |
664 | + ], | |
665 | + dayOfWeekShort: [ | |
666 | + "Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт" | |
667 | + ], | |
668 | + dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"] | |
669 | + }, | |
670 | + en: { // English | |
671 | + months: [ | |
672 | + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" | |
673 | + ], | |
674 | + dayOfWeekShort: [ | |
675 | + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" | |
676 | + ], | |
677 | + dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] | |
678 | + }, | |
679 | + el: { // Ελληνικά | |
680 | + months: [ | |
681 | + "Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος" | |
682 | + ], | |
683 | + dayOfWeekShort: [ | |
684 | + "Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ" | |
685 | + ], | |
686 | + dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"] | |
687 | + }, | |
688 | + de: { // German | |
689 | + months: [ | |
690 | + 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember' | |
691 | + ], | |
692 | + dayOfWeekShort: [ | |
693 | + "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" | |
694 | + ], | |
695 | + dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] | |
696 | + }, | |
697 | + nl: { // Dutch | |
698 | + months: [ | |
699 | + "januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december" | |
700 | + ], | |
701 | + dayOfWeekShort: [ | |
702 | + "zo", "ma", "di", "wo", "do", "vr", "za" | |
703 | + ], | |
704 | + dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] | |
705 | + }, | |
706 | + tr: { // Turkish | |
707 | + months: [ | |
708 | + "Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık" | |
709 | + ], | |
710 | + dayOfWeekShort: [ | |
711 | + "Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts" | |
712 | + ], | |
713 | + dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"] | |
714 | + }, | |
715 | + fr: { //French | |
716 | + months: [ | |
717 | + "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" | |
718 | + ], | |
719 | + dayOfWeekShort: [ | |
720 | + "Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam" | |
721 | + ], | |
722 | + dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] | |
723 | + }, | |
724 | + es: { // Spanish | |
725 | + months: [ | |
726 | + "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" | |
727 | + ], | |
728 | + dayOfWeekShort: [ | |
729 | + "Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb" | |
730 | + ], | |
731 | + dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"] | |
732 | + }, | |
733 | + th: { // Thai | |
734 | + months: [ | |
735 | + 'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม' | |
736 | + ], | |
737 | + dayOfWeekShort: [ | |
738 | + 'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.' | |
739 | + ], | |
740 | + dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"] | |
741 | + }, | |
742 | + pl: { // Polish | |
743 | + months: [ | |
744 | + "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień" | |
745 | + ], | |
746 | + dayOfWeekShort: [ | |
747 | + "nd", "pn", "wt", "śr", "cz", "pt", "sb" | |
748 | + ], | |
749 | + dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"] | |
750 | + }, | |
751 | + pt: { // Portuguese | |
752 | + months: [ | |
753 | + "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" | |
754 | + ], | |
755 | + dayOfWeekShort: [ | |
756 | + "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab" | |
757 | + ], | |
758 | + dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] | |
759 | + }, | |
760 | + ch: { // Simplified Chinese | |
761 | + months: [ | |
762 | + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" | |
763 | + ], | |
764 | + dayOfWeekShort: [ | |
765 | + "日", "一", "二", "三", "四", "五", "六" | |
766 | + ] | |
767 | + }, | |
768 | + se: { // Swedish | |
769 | + months: [ | |
770 | + "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" | |
771 | + ], | |
772 | + dayOfWeekShort: [ | |
773 | + "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" | |
774 | + ] | |
775 | + }, | |
776 | + kr: { // Korean | |
777 | + months: [ | |
778 | + "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" | |
779 | + ], | |
780 | + dayOfWeekShort: [ | |
781 | + "일", "월", "화", "수", "목", "금", "토" | |
782 | + ], | |
783 | + dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"] | |
784 | + }, | |
785 | + it: { // Italian | |
786 | + months: [ | |
787 | + "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre" | |
788 | + ], | |
789 | + dayOfWeekShort: [ | |
790 | + "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" | |
791 | + ], | |
792 | + dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] | |
793 | + }, | |
794 | + da: { // Dansk | |
795 | + months: [ | |
796 | + "January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December" | |
797 | + ], | |
798 | + dayOfWeekShort: [ | |
799 | + "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" | |
800 | + ], | |
801 | + dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"] | |
802 | + }, | |
803 | + no: { // Norwegian | |
804 | + months: [ | |
805 | + "Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember" | |
806 | + ], | |
807 | + dayOfWeekShort: [ | |
808 | + "Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør" | |
809 | + ], | |
810 | + dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag'] | |
811 | + }, | |
812 | + ja: { // Japanese | |
813 | + months: [ | |
814 | + "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" | |
815 | + ], | |
816 | + dayOfWeekShort: [ | |
817 | + "日", "月", "火", "水", "木", "金", "土" | |
818 | + ], | |
819 | + dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"] | |
820 | + }, | |
821 | + vi: { // Vietnamese | |
822 | + months: [ | |
823 | + "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" | |
824 | + ], | |
825 | + dayOfWeekShort: [ | |
826 | + "CN", "T2", "T3", "T4", "T5", "T6", "T7" | |
827 | + ], | |
828 | + dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"] | |
829 | + }, | |
830 | + sl: { // Slovenščina | |
831 | + months: [ | |
832 | + "Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December" | |
833 | + ], | |
834 | + dayOfWeekShort: [ | |
835 | + "Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob" | |
836 | + ], | |
837 | + dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"] | |
838 | + }, | |
839 | + cs: { // Čeština | |
840 | + months: [ | |
841 | + "Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec" | |
842 | + ], | |
843 | + dayOfWeekShort: [ | |
844 | + "Ne", "Po", "Út", "St", "Čt", "Pá", "So" | |
845 | + ] | |
846 | + }, | |
847 | + hu: { // Hungarian | |
848 | + months: [ | |
849 | + "Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December" | |
850 | + ], | |
851 | + dayOfWeekShort: [ | |
852 | + "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" | |
853 | + ], | |
854 | + dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"] | |
855 | + }, | |
856 | + az: { //Azerbaijanian (Azeri) | |
857 | + months: [ | |
858 | + "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr" | |
859 | + ], | |
860 | + dayOfWeekShort: [ | |
861 | + "B", "Be", "Ça", "Ç", "Ca", "C", "Ş" | |
862 | + ], | |
863 | + dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"] | |
864 | + }, | |
865 | + bs: { //Bosanski | |
866 | + months: [ | |
867 | + "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" | |
868 | + ], | |
869 | + dayOfWeekShort: [ | |
870 | + "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" | |
871 | + ], | |
872 | + dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"] | |
873 | + }, | |
874 | + ca: { //Català | |
875 | + months: [ | |
876 | + "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" | |
877 | + ], | |
878 | + dayOfWeekShort: [ | |
879 | + "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds" | |
880 | + ], | |
881 | + dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"] | |
882 | + }, | |
883 | + 'en-GB': { //English (British) | |
884 | + months: [ | |
885 | + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" | |
886 | + ], | |
887 | + dayOfWeekShort: [ | |
888 | + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" | |
889 | + ], | |
890 | + dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] | |
891 | + }, | |
892 | + et: { //"Eesti" | |
893 | + months: [ | |
894 | + "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember" | |
895 | + ], | |
896 | + dayOfWeekShort: [ | |
897 | + "P", "E", "T", "K", "N", "R", "L" | |
898 | + ], | |
899 | + dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"] | |
900 | + }, | |
901 | + eu: { //Euskara | |
902 | + months: [ | |
903 | + "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua" | |
904 | + ], | |
905 | + dayOfWeekShort: [ | |
906 | + "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La." | |
907 | + ], | |
908 | + dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata'] | |
909 | + }, | |
910 | + fi: { //Finnish (Suomi) | |
911 | + months: [ | |
912 | + "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" | |
913 | + ], | |
914 | + dayOfWeekShort: [ | |
915 | + "Su", "Ma", "Ti", "Ke", "To", "Pe", "La" | |
916 | + ], | |
917 | + dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"] | |
918 | + }, | |
919 | + gl: { //Galego | |
920 | + months: [ | |
921 | + "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec" | |
922 | + ], | |
923 | + dayOfWeekShort: [ | |
924 | + "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab" | |
925 | + ], | |
926 | + dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"] | |
927 | + }, | |
928 | + hr: { //Hrvatski | |
929 | + months: [ | |
930 | + "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" | |
931 | + ], | |
932 | + dayOfWeekShort: [ | |
933 | + "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" | |
934 | + ], | |
935 | + dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"] | |
936 | + }, | |
937 | + ko: { //Korean (한국어) | |
938 | + months: [ | |
939 | + "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" | |
940 | + ], | |
941 | + dayOfWeekShort: [ | |
942 | + "일", "월", "화", "수", "목", "금", "토" | |
943 | + ], | |
944 | + dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"] | |
945 | + }, | |
946 | + lt: { //Lithuanian (lietuvių) | |
947 | + months: [ | |
948 | + "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio" | |
949 | + ], | |
950 | + dayOfWeekShort: [ | |
951 | + "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš" | |
952 | + ], | |
953 | + dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"] | |
954 | + }, | |
955 | + lv: { //Latvian (Latviešu) | |
956 | + months: [ | |
957 | + "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris" | |
958 | + ], | |
959 | + dayOfWeekShort: [ | |
960 | + "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St" | |
961 | + ], | |
962 | + dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"] | |
963 | + }, | |
964 | + mk: { //Macedonian (Македонски) | |
965 | + months: [ | |
966 | + "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември" | |
967 | + ], | |
968 | + dayOfWeekShort: [ | |
969 | + "нед", "пон", "вто", "сре", "чет", "пет", "саб" | |
970 | + ], | |
971 | + dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"] | |
972 | + }, | |
973 | + mn: { //Mongolian (Монгол) | |
974 | + months: [ | |
975 | + "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар" | |
976 | + ], | |
977 | + dayOfWeekShort: [ | |
978 | + "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням" | |
979 | + ], | |
980 | + dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"] | |
981 | + }, | |
982 | + 'pt-BR': { //Português(Brasil) | |
983 | + months: [ | |
984 | + "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" | |
985 | + ], | |
986 | + dayOfWeekShort: [ | |
987 | + "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" | |
988 | + ], | |
989 | + dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"] | |
990 | + }, | |
991 | + sk: { //Slovenčina | |
992 | + months: [ | |
993 | + "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" | |
994 | + ], | |
995 | + dayOfWeekShort: [ | |
996 | + "Ne", "Po", "Ut", "St", "Št", "Pi", "So" | |
997 | + ], | |
998 | + dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"] | |
999 | + }, | |
1000 | + sq: { //Albanian (Shqip) | |
1001 | + months: [ | |
1002 | + "Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor" | |
1003 | + ], | |
1004 | + dayOfWeekShort: [ | |
1005 | + "Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu" | |
1006 | + ], | |
1007 | + dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"] | |
1008 | + }, | |
1009 | + 'sr-YU': { //Serbian (Srpski) | |
1010 | + months: [ | |
1011 | + "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" | |
1012 | + ], | |
1013 | + dayOfWeekShort: [ | |
1014 | + "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub" | |
1015 | + ], | |
1016 | + dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"] | |
1017 | + }, | |
1018 | + sr: { //Serbian Cyrillic (Српски) | |
1019 | + months: [ | |
1020 | + "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар" | |
1021 | + ], | |
1022 | + dayOfWeekShort: [ | |
1023 | + "нед", "пон", "уто", "сре", "чет", "пет", "суб" | |
1024 | + ], | |
1025 | + dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"] | |
1026 | + }, | |
1027 | + sv: { //Svenska | |
1028 | + months: [ | |
1029 | + "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" | |
1030 | + ], | |
1031 | + dayOfWeekShort: [ | |
1032 | + "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" | |
1033 | + ], | |
1034 | + dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"] | |
1035 | + }, | |
1036 | + 'zh-TW': { //Traditional Chinese (繁體中文) | |
1037 | + months: [ | |
1038 | + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" | |
1039 | + ], | |
1040 | + dayOfWeekShort: [ | |
1041 | + "日", "一", "二", "三", "四", "五", "六" | |
1042 | + ], | |
1043 | + dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] | |
1044 | + }, | |
1045 | + zh: { //Simplified Chinese (简体中文) | |
1046 | + months: [ | |
1047 | + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" | |
1048 | + ], | |
1049 | + dayOfWeekShort: [ | |
1050 | + "日", "一", "二", "三", "四", "五", "六" | |
1051 | + ], | |
1052 | + dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"] | |
1053 | + }, | |
1054 | + he: { //Hebrew (עברית) | |
1055 | + months: [ | |
1056 | + 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר' | |
1057 | + ], | |
1058 | + dayOfWeekShort: [ | |
1059 | + 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת' | |
1060 | + ], | |
1061 | + dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"] | |
1062 | + }, | |
1063 | + hy: { // Armenian | |
1064 | + months: [ | |
1065 | + "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր" | |
1066 | + ], | |
1067 | + dayOfWeekShort: [ | |
1068 | + "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ" | |
1069 | + ], | |
1070 | + dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"] | |
1071 | + }, | |
1072 | + kg: { // Kyrgyz | |
1073 | + months: [ | |
1074 | + 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы' | |
1075 | + ], | |
1076 | + dayOfWeekShort: [ | |
1077 | + "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише" | |
1078 | + ], | |
1079 | + dayOfWeek: [ | |
1080 | + "Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб" | |
1081 | + ] | |
1082 | + }, | |
1083 | + rm: { // Romansh | |
1084 | + months: [ | |
1085 | + "Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December" | |
1086 | + ], | |
1087 | + dayOfWeekShort: [ | |
1088 | + "Du", "Gli", "Ma", "Me", "Gie", "Ve", "So" | |
1089 | + ], | |
1090 | + dayOfWeek: [ | |
1091 | + "Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda" | |
1092 | + ] | |
1093 | + }, | |
1094 | + ka: { // Georgian | |
1095 | + months: [ | |
1096 | + 'იანვარი', 'თებერვალი', 'მარტი', 'აპრილი', 'მაისი', 'ივნისი', 'ივლისი', 'აგვისტო', 'სექტემბერი', 'ოქტომბერი', 'ნოემბერი', 'დეკემბერი' | |
1097 | + ], | |
1098 | + dayOfWeekShort: [ | |
1099 | + "კვ", "ორშ", "სამშ", "ოთხ", "ხუთ", "პარ", "შაბ" | |
1100 | + ], | |
1101 | + dayOfWeek: ["კვირა", "ორშაბათი", "სამშაბათი", "ოთხშაბათი", "ხუთშაბათი", "პარასკევი", "შაბათი"] | |
1102 | + }, | |
1103 | + }, | |
1104 | + value: '', | |
1105 | + rtl: false, | |
1106 | + | |
1107 | + format: 'Y/m/d H:i', | |
1108 | + formatTime: 'H:i', | |
1109 | + formatDate: 'Y/m/d', | |
1110 | + | |
1111 | + startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05', | |
1112 | + step: 60, | |
1113 | + monthChangeSpinner: true, | |
1114 | + | |
1115 | + closeOnDateSelect: false, | |
1116 | + closeOnTimeSelect: true, | |
1117 | + closeOnWithoutClick: true, | |
1118 | + closeOnInputClick: true, | |
1119 | + | |
1120 | + timepicker: true, | |
1121 | + datepicker: true, | |
1122 | + weeks: false, | |
1123 | + | |
1124 | + defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i') | |
1125 | + defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05') | |
1126 | + | |
1127 | + minDate: false, | |
1128 | + maxDate: false, | |
1129 | + minTime: false, | |
1130 | + maxTime: false, | |
1131 | + disabledMinTime: false, | |
1132 | + disabledMaxTime: false, | |
1133 | + | |
1134 | + allowTimes: [], | |
1135 | + opened: false, | |
1136 | + initTime: true, | |
1137 | + inline: false, | |
1138 | + theme: '', | |
1139 | + | |
1140 | + onSelectDate: function () {}, | |
1141 | + onSelectTime: function () {}, | |
1142 | + onChangeMonth: function () {}, | |
1143 | + onGetWeekOfYear: function () {}, | |
1144 | + onChangeYear: function () {}, | |
1145 | + onChangeDateTime: function () {}, | |
1146 | + onShow: function () {}, | |
1147 | + onClose: function () {}, | |
1148 | + onGenerate: function () {}, | |
1149 | + | |
1150 | + withoutCopyright: true, | |
1151 | + inverseButton: false, | |
1152 | + hours12: false, | |
1153 | + next: 'xdsoft_next', | |
1154 | + prev : 'xdsoft_prev', | |
1155 | + dayOfWeekStart: 0, | |
1156 | + parentID: 'body', | |
1157 | + timeHeightInTimePicker: 25, | |
1158 | + timepickerScrollbar: true, | |
1159 | + todayButton: true, | |
1160 | + prevButton: true, | |
1161 | + nextButton: true, | |
1162 | + defaultSelect: true, | |
1163 | + | |
1164 | + scrollMonth: true, | |
1165 | + scrollTime: true, | |
1166 | + scrollInput: true, | |
1167 | + | |
1168 | + lazyInit: false, | |
1169 | + mask: false, | |
1170 | + validateOnBlur: true, | |
1171 | + allowBlank: true, | |
1172 | + yearStart: 1950, | |
1173 | + yearEnd: 2050, | |
1174 | + monthStart: 0, | |
1175 | + monthEnd: 11, | |
1176 | + style: '', | |
1177 | + id: '', | |
1178 | + fixed: false, | |
1179 | + roundTime: 'round', // ceil, floor | |
1180 | + className: '', | |
1181 | + weekends: [], | |
1182 | + highlightedDates: [], | |
1183 | + highlightedPeriods: [], | |
1184 | + allowDates : [], | |
1185 | + allowDateRe : null, | |
1186 | + disabledDates : [], | |
1187 | + disabledWeekDays: [], | |
1188 | + yearOffset: 0, | |
1189 | + beforeShowDay: null, | |
1190 | + | |
1191 | + enterLikeTab: true, | |
1192 | + showApplyButton: false | |
1193 | + }; | |
1194 | + | |
1195 | + var dateHelper = null, | |
1196 | + globalLocaleDefault = 'en', | |
1197 | + globalLocale = 'en'; | |
1198 | + | |
1199 | + var dateFormatterOptionsDefault = { | |
1200 | + meridiem: ['AM', 'PM'] | |
1201 | + }; | |
1202 | + | |
1203 | + var initDateFormatter = function(){ | |
1204 | + var locale = default_options.i18n[globalLocale], | |
1205 | + opts = { | |
1206 | + days: locale.dayOfWeek, | |
1207 | + daysShort: locale.dayOfWeekShort, | |
1208 | + months: locale.months, | |
1209 | + monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }), | |
1210 | + }; | |
1211 | + | |
1212 | + dateHelper = new DateFormatter({ | |
1213 | + dateSettings: $.extend({}, dateFormatterOptionsDefault, opts) | |
1214 | + }); | |
1215 | + }; | |
1216 | + | |
1217 | + // for locale settings | |
1218 | + $.datetimepicker = { | |
1219 | + setLocale: function(locale){ | |
1220 | + var newLocale = default_options.i18n[locale]?locale:globalLocaleDefault; | |
1221 | + if(globalLocale != newLocale){ | |
1222 | + globalLocale = newLocale; | |
1223 | + // reinit date formatter | |
1224 | + initDateFormatter(); | |
1225 | + } | |
1226 | + }, | |
1227 | + setDateFormatter: function(dateFormatter) { | |
1228 | + dateHelper = dateFormatter; | |
1229 | + }, | |
1230 | + RFC_2822: 'D, d M Y H:i:s O', | |
1231 | + ATOM: 'Y-m-d\TH:i:sP', | |
1232 | + ISO_8601: 'Y-m-d\TH:i:sO', | |
1233 | + RFC_822: 'D, d M y H:i:s O', | |
1234 | + RFC_850: 'l, d-M-y H:i:s T', | |
1235 | + RFC_1036: 'D, d M y H:i:s O', | |
1236 | + RFC_1123: 'D, d M Y H:i:s O', | |
1237 | + RSS: 'D, d M Y H:i:s O', | |
1238 | + W3C: 'Y-m-d\TH:i:sP' | |
1239 | + }; | |
1240 | + | |
1241 | + // first init date formatter | |
1242 | + initDateFormatter(); | |
1243 | + | |
1244 | + // fix for ie8 | |
1245 | + if (!window.getComputedStyle) { | |
1246 | + window.getComputedStyle = function (el, pseudo) { | |
1247 | + this.el = el; | |
1248 | + this.getPropertyValue = function (prop) { | |
1249 | + var re = /(\-([a-z]){1})/g; | |
1250 | + if (prop === 'float') { | |
1251 | + prop = 'styleFloat'; | |
1252 | + } | |
1253 | + if (re.test(prop)) { | |
1254 | + prop = prop.replace(re, function (a, b, c) { | |
1255 | + return c.toUpperCase(); | |
1256 | + }); | |
1257 | + } | |
1258 | + return el.currentStyle[prop] || null; | |
1259 | + }; | |
1260 | + return this; | |
1261 | + }; | |
1262 | + } | |
1263 | + if (!Array.prototype.indexOf) { | |
1264 | + Array.prototype.indexOf = function (obj, start) { | |
1265 | + var i, j; | |
1266 | + for (i = (start || 0), j = this.length; i < j; i += 1) { | |
1267 | + if (this[i] === obj) { return i; } | |
1268 | + } | |
1269 | + return -1; | |
1270 | + }; | |
1271 | + } | |
1272 | + Date.prototype.countDaysInMonth = function () { | |
1273 | + return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate(); | |
1274 | + }; | |
1275 | + $.fn.xdsoftScroller = function (percent) { | |
1276 | + return this.each(function () { | |
1277 | + var timeboxparent = $(this), | |
1278 | + pointerEventToXY = function (e) { | |
1279 | + var out = {x: 0, y: 0}, | |
1280 | + touch; | |
1281 | + if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') { | |
1282 | + touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0]; | |
1283 | + out.x = touch.clientX; | |
1284 | + out.y = touch.clientY; | |
1285 | + } else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') { | |
1286 | + out.x = e.clientX; | |
1287 | + out.y = e.clientY; | |
1288 | + } | |
1289 | + return out; | |
1290 | + }, | |
1291 | + timebox, | |
1292 | + parentHeight, | |
1293 | + height, | |
1294 | + scrollbar, | |
1295 | + scroller, | |
1296 | + maximumOffset = 100, | |
1297 | + start = false, | |
1298 | + startY = 0, | |
1299 | + startTop = 0, | |
1300 | + h1 = 0, | |
1301 | + touchStart = false, | |
1302 | + startTopScroll = 0, | |
1303 | + calcOffset = function () {}; | |
1304 | + if (percent === 'hide') { | |
1305 | + timeboxparent.find('.xdsoft_scrollbar').hide(); | |
1306 | + return; | |
1307 | + } | |
1308 | + if (!$(this).hasClass('xdsoft_scroller_box')) { | |
1309 | + timebox = timeboxparent.children().eq(0); | |
1310 | + parentHeight = timeboxparent[0].clientHeight; | |
1311 | + height = timebox[0].offsetHeight; | |
1312 | + scrollbar = $('<div class="xdsoft_scrollbar"></div>'); | |
1313 | + scroller = $('<div class="xdsoft_scroller"></div>'); | |
1314 | + scrollbar.append(scroller); | |
1315 | + | |
1316 | + timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar); | |
1317 | + calcOffset = function calcOffset(event) { | |
1318 | + var offset = pointerEventToXY(event).y - startY + startTopScroll; | |
1319 | + if (offset < 0) { | |
1320 | + offset = 0; | |
1321 | + } | |
1322 | + if (offset + scroller[0].offsetHeight > h1) { | |
1323 | + offset = h1 - scroller[0].offsetHeight; | |
1324 | + } | |
1325 | + timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]); | |
1326 | + }; | |
1327 | + | |
1328 | + scroller | |
1329 | + .on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) { | |
1330 | + if (!parentHeight) { | |
1331 | + timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); | |
1332 | + } | |
1333 | + | |
1334 | + startY = pointerEventToXY(event).y; | |
1335 | + startTopScroll = parseInt(scroller.css('margin-top'), 10); | |
1336 | + h1 = scrollbar[0].offsetHeight; | |
1337 | + | |
1338 | + if (event.type === 'mousedown' || event.type === 'touchstart') { | |
1339 | + if (document) { | |
1340 | + $(document.body).addClass('xdsoft_noselect'); | |
1341 | + } | |
1342 | + $([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() { | |
1343 | + $([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee) | |
1344 | + .off('mousemove.xdsoft_scroller', calcOffset) | |
1345 | + .removeClass('xdsoft_noselect'); | |
1346 | + }); | |
1347 | + $(document.body).on('mousemove.xdsoft_scroller', calcOffset); | |
1348 | + } else { | |
1349 | + touchStart = true; | |
1350 | + event.stopPropagation(); | |
1351 | + event.preventDefault(); | |
1352 | + } | |
1353 | + }) | |
1354 | + .on('touchmove', function (event) { | |
1355 | + if (touchStart) { | |
1356 | + event.preventDefault(); | |
1357 | + calcOffset(event); | |
1358 | + } | |
1359 | + }) | |
1360 | + .on('touchend touchcancel', function () { | |
1361 | + touchStart = false; | |
1362 | + startTopScroll = 0; | |
1363 | + }); | |
1364 | + | |
1365 | + timeboxparent | |
1366 | + .on('scroll_element.xdsoft_scroller', function (event, percentage) { | |
1367 | + if (!parentHeight) { | |
1368 | + timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]); | |
1369 | + } | |
1370 | + percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage; | |
1371 | + | |
1372 | + scroller.css('margin-top', maximumOffset * percentage); | |
1373 | + | |
1374 | + setTimeout(function () { | |
1375 | + timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10)); | |
1376 | + }, 10); | |
1377 | + }) | |
1378 | + .on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) { | |
1379 | + var percent, sh; | |
1380 | + parentHeight = timeboxparent[0].clientHeight; | |
1381 | + height = timebox[0].offsetHeight; | |
1382 | + percent = parentHeight / height; | |
1383 | + sh = percent * scrollbar[0].offsetHeight; | |
1384 | + if (percent > 1) { | |
1385 | + scroller.hide(); | |
1386 | + } else { | |
1387 | + scroller.show(); | |
1388 | + scroller.css('height', parseInt(sh > 10 ? sh : 10, 10)); | |
1389 | + maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight; | |
1390 | + if (noTriggerScroll !== true) { | |
1391 | + timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]); | |
1392 | + } | |
1393 | + } | |
1394 | + }); | |
1395 | + | |
1396 | + timeboxparent.on('mousewheel', function (event) { | |
1397 | + var top = Math.abs(parseInt(timebox.css('marginTop'), 10)); | |
1398 | + | |
1399 | + top = top - (event.deltaY * 20); | |
1400 | + if (top < 0) { | |
1401 | + top = 0; | |
1402 | + } | |
1403 | + | |
1404 | + timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]); | |
1405 | + event.stopPropagation(); | |
1406 | + return false; | |
1407 | + }); | |
1408 | + | |
1409 | + timeboxparent.on('touchstart', function (event) { | |
1410 | + start = pointerEventToXY(event); | |
1411 | + startTop = Math.abs(parseInt(timebox.css('marginTop'), 10)); | |
1412 | + }); | |
1413 | + | |
1414 | + timeboxparent.on('touchmove', function (event) { | |
1415 | + if (start) { | |
1416 | + event.preventDefault(); | |
1417 | + var coord = pointerEventToXY(event); | |
1418 | + timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]); | |
1419 | + } | |
1420 | + }); | |
1421 | + | |
1422 | + timeboxparent.on('touchend touchcancel', function () { | |
1423 | + start = false; | |
1424 | + startTop = 0; | |
1425 | + }); | |
1426 | + } | |
1427 | + timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]); | |
1428 | + }); | |
1429 | + }; | |
1430 | + | |
1431 | + $.fn.datetimepicker = function (opt, opt2) { | |
1432 | + var result = this, | |
1433 | + KEY0 = 48, | |
1434 | + KEY9 = 57, | |
1435 | + _KEY0 = 96, | |
1436 | + _KEY9 = 105, | |
1437 | + CTRLKEY = 17, | |
1438 | + DEL = 46, | |
1439 | + ENTER = 13, | |
1440 | + ESC = 27, | |
1441 | + BACKSPACE = 8, | |
1442 | + ARROWLEFT = 37, | |
1443 | + ARROWUP = 38, | |
1444 | + ARROWRIGHT = 39, | |
1445 | + ARROWDOWN = 40, | |
1446 | + TAB = 9, | |
1447 | + F5 = 116, | |
1448 | + AKEY = 65, | |
1449 | + CKEY = 67, | |
1450 | + VKEY = 86, | |
1451 | + ZKEY = 90, | |
1452 | + YKEY = 89, | |
1453 | + ctrlDown = false, | |
1454 | + options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options), | |
1455 | + | |
1456 | + lazyInitTimer = 0, | |
1457 | + createDateTimePicker, | |
1458 | + destroyDateTimePicker, | |
1459 | + | |
1460 | + lazyInit = function (input) { | |
1461 | + input | |
1462 | + .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback() { | |
1463 | + if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { | |
1464 | + return; | |
1465 | + } | |
1466 | + clearTimeout(lazyInitTimer); | |
1467 | + lazyInitTimer = setTimeout(function () { | |
1468 | + | |
1469 | + if (!input.data('xdsoft_datetimepicker')) { | |
1470 | + createDateTimePicker(input); | |
1471 | + } | |
1472 | + input | |
1473 | + .off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback) | |
1474 | + .trigger('open.xdsoft'); | |
1475 | + }, 100); | |
1476 | + }); | |
1477 | + }; | |
1478 | + | |
1479 | + createDateTimePicker = function (input) { | |
1480 | + var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'), | |
1481 | + xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'), | |
1482 | + datepicker = $('<div class="xdsoft_datepicker active"></div>'), | |
1483 | + mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' + | |
1484 | + '<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' + | |
1485 | + '<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' + | |
1486 | + '<button type="button" class="xdsoft_next"></button></div>'), | |
1487 | + calendar = $('<div class="xdsoft_calendar"></div>'), | |
1488 | + timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'), | |
1489 | + timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), | |
1490 | + timebox = $('<div class="xdsoft_time_variant"></div>'), | |
1491 | + applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'), | |
1492 | + | |
1493 | + monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'), | |
1494 | + yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'), | |
1495 | + triggerAfterOpen = false, | |
1496 | + XDSoft_datetime, | |
1497 | + | |
1498 | + xchangeTimer, | |
1499 | + timerclick, | |
1500 | + current_time_index, | |
1501 | + setPos, | |
1502 | + timer = 0, | |
1503 | + _xdsoft_datetime, | |
1504 | + forEachAncestorOf; | |
1505 | + | |
1506 | + if (options.id) { | |
1507 | + datetimepicker.attr('id', options.id); | |
1508 | + } | |
1509 | + if (options.style) { | |
1510 | + datetimepicker.attr('style', options.style); | |
1511 | + } | |
1512 | + if (options.weeks) { | |
1513 | + datetimepicker.addClass('xdsoft_showweeks'); | |
1514 | + } | |
1515 | + if (options.rtl) { | |
1516 | + datetimepicker.addClass('xdsoft_rtl'); | |
1517 | + } | |
1518 | + | |
1519 | + datetimepicker.addClass('xdsoft_' + options.theme); | |
1520 | + datetimepicker.addClass(options.className); | |
1521 | + | |
1522 | + mounth_picker | |
1523 | + .find('.xdsoft_month span') | |
1524 | + .after(monthselect); | |
1525 | + mounth_picker | |
1526 | + .find('.xdsoft_year span') | |
1527 | + .after(yearselect); | |
1528 | + | |
1529 | + mounth_picker | |
1530 | + .find('.xdsoft_month,.xdsoft_year') | |
1531 | + .on('touchstart mousedown.xdsoft', function (event) { | |
1532 | + var select = $(this).find('.xdsoft_select').eq(0), | |
1533 | + val = 0, | |
1534 | + top = 0, | |
1535 | + visible = select.is(':visible'), | |
1536 | + items, | |
1537 | + i; | |
1538 | + | |
1539 | + mounth_picker | |
1540 | + .find('.xdsoft_select') | |
1541 | + .hide(); | |
1542 | + if (_xdsoft_datetime.currentTime) { | |
1543 | + val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear'](); | |
1544 | + } | |
1545 | + | |
1546 | + select[visible ? 'hide' : 'show'](); | |
1547 | + for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) { | |
1548 | + if (items.eq(i).data('value') === val) { | |
1549 | + break; | |
1550 | + } else { | |
1551 | + top += items[0].offsetHeight; | |
1552 | + } | |
1553 | + } | |
1554 | + | |
1555 | + select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight))); | |
1556 | + event.stopPropagation(); | |
1557 | + return false; | |
1558 | + }); | |
1559 | + | |
1560 | + mounth_picker | |
1561 | + .find('.xdsoft_select') | |
1562 | + .xdsoftScroller() | |
1563 | + .on('touchstart mousedown.xdsoft', function (event) { | |
1564 | + event.stopPropagation(); | |
1565 | + event.preventDefault(); | |
1566 | + }) | |
1567 | + .on('touchstart mousedown.xdsoft', '.xdsoft_option', function () { | |
1568 | + if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { | |
1569 | + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); | |
1570 | + } | |
1571 | + | |
1572 | + var year = _xdsoft_datetime.currentTime.getFullYear(); | |
1573 | + if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { | |
1574 | + _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); | |
1575 | + } | |
1576 | + | |
1577 | + $(this).parent().parent().hide(); | |
1578 | + | |
1579 | + datetimepicker.trigger('xchange.xdsoft'); | |
1580 | + if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { | |
1581 | + options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); | |
1582 | + } | |
1583 | + | |
1584 | + if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { | |
1585 | + options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); | |
1586 | + } | |
1587 | + }); | |
1588 | + | |
1589 | + datetimepicker.getValue = function () { | |
1590 | + return _xdsoft_datetime.getCurrentTime(); | |
1591 | + }; | |
1592 | + | |
1593 | + datetimepicker.setOptions = function (_options) { | |
1594 | + var highlightedDates = {}; | |
1595 | + | |
1596 | + options = $.extend(true, {}, options, _options); | |
1597 | + | |
1598 | + if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) { | |
1599 | + options.allowTimes = $.extend(true, [], _options.allowTimes); | |
1600 | + } | |
1601 | + | |
1602 | + if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) { | |
1603 | + options.weekends = $.extend(true, [], _options.weekends); | |
1604 | + } | |
1605 | + | |
1606 | + if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) { | |
1607 | + options.allowDates = $.extend(true, [], _options.allowDates); | |
1608 | + } | |
1609 | + | |
1610 | + if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") { | |
1611 | + options.allowDateRe = new RegExp(_options.allowDateRe); | |
1612 | + } | |
1613 | + | |
1614 | + if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { | |
1615 | + $.each(_options.highlightedDates, function (index, value) { | |
1616 | + var splitData = $.map(value.split(','), $.trim), | |
1617 | + exDesc, | |
1618 | + hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style | |
1619 | + keyDate = dateHelper.formatDate(hDate.date, options.formatDate); | |
1620 | + if (highlightedDates[keyDate] !== undefined) { | |
1621 | + exDesc = highlightedDates[keyDate].desc; | |
1622 | + if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { | |
1623 | + highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; | |
1624 | + } | |
1625 | + } else { | |
1626 | + highlightedDates[keyDate] = hDate; | |
1627 | + } | |
1628 | + }); | |
1629 | + | |
1630 | + options.highlightedDates = $.extend(true, [], highlightedDates); | |
1631 | + } | |
1632 | + | |
1633 | + if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { | |
1634 | + highlightedDates = $.extend(true, [], options.highlightedDates); | |
1635 | + $.each(_options.highlightedPeriods, function (index, value) { | |
1636 | + var dateTest, // start date | |
1637 | + dateEnd, | |
1638 | + desc, | |
1639 | + hDate, | |
1640 | + keyDate, | |
1641 | + exDesc, | |
1642 | + style; | |
1643 | + if ($.isArray(value)) { | |
1644 | + dateTest = value[0]; | |
1645 | + dateEnd = value[1]; | |
1646 | + desc = value[2]; | |
1647 | + style = value[3]; | |
1648 | + } | |
1649 | + else { | |
1650 | + var splitData = $.map(value.split(','), $.trim); | |
1651 | + dateTest = dateHelper.parseDate(splitData[0], options.formatDate); | |
1652 | + dateEnd = dateHelper.parseDate(splitData[1], options.formatDate); | |
1653 | + desc = splitData[2]; | |
1654 | + style = splitData[3]; | |
1655 | + } | |
1656 | + | |
1657 | + while (dateTest <= dateEnd) { | |
1658 | + hDate = new HighlightedDate(dateTest, desc, style); | |
1659 | + keyDate = dateHelper.formatDate(dateTest, options.formatDate); | |
1660 | + dateTest.setDate(dateTest.getDate() + 1); | |
1661 | + if (highlightedDates[keyDate] !== undefined) { | |
1662 | + exDesc = highlightedDates[keyDate].desc; | |
1663 | + if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { | |
1664 | + highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; | |
1665 | + } | |
1666 | + } else { | |
1667 | + highlightedDates[keyDate] = hDate; | |
1668 | + } | |
1669 | + } | |
1670 | + }); | |
1671 | + | |
1672 | + options.highlightedDates = $.extend(true, [], highlightedDates); | |
1673 | + } | |
1674 | + | |
1675 | + if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) { | |
1676 | + options.disabledDates = $.extend(true, [], _options.disabledDates); | |
1677 | + } | |
1678 | + | |
1679 | + if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { | |
1680 | + options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); | |
1681 | + } | |
1682 | + | |
1683 | + if ((options.open || options.opened) && (!options.inline)) { | |
1684 | + input.trigger('open.xdsoft'); | |
1685 | + } | |
1686 | + | |
1687 | + if (options.inline) { | |
1688 | + triggerAfterOpen = true; | |
1689 | + datetimepicker.addClass('xdsoft_inline'); | |
1690 | + input.after(datetimepicker).hide(); | |
1691 | + } | |
1692 | + | |
1693 | + if (options.inverseButton) { | |
1694 | + options.next = 'xdsoft_prev'; | |
1695 | + options.prev = 'xdsoft_next'; | |
1696 | + } | |
1697 | + | |
1698 | + if (options.datepicker) { | |
1699 | + datepicker.addClass('active'); | |
1700 | + } else { | |
1701 | + datepicker.removeClass('active'); | |
1702 | + } | |
1703 | + | |
1704 | + if (options.timepicker) { | |
1705 | + timepicker.addClass('active'); | |
1706 | + } else { | |
1707 | + timepicker.removeClass('active'); | |
1708 | + } | |
1709 | + | |
1710 | + if (options.value) { | |
1711 | + _xdsoft_datetime.setCurrentTime(options.value); | |
1712 | + if (input && input.val) { | |
1713 | + input.val(_xdsoft_datetime.str); | |
1714 | + } | |
1715 | + } | |
1716 | + | |
1717 | + if (isNaN(options.dayOfWeekStart)) { | |
1718 | + options.dayOfWeekStart = 0; | |
1719 | + } else { | |
1720 | + options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7; | |
1721 | + } | |
1722 | + | |
1723 | + if (!options.timepickerScrollbar) { | |
1724 | + timeboxparent.xdsoftScroller('hide'); | |
1725 | + } | |
1726 | + | |
1727 | + if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) { | |
1728 | + options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate); | |
1729 | + } | |
1730 | + | |
1731 | + if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) { | |
1732 | + options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate); | |
1733 | + } | |
1734 | + | |
1735 | + applyButton.toggle(options.showApplyButton); | |
1736 | + | |
1737 | + mounth_picker | |
1738 | + .find('.xdsoft_today_button') | |
1739 | + .css('visibility', !options.todayButton ? 'hidden' : 'visible'); | |
1740 | + | |
1741 | + mounth_picker | |
1742 | + .find('.' + options.prev) | |
1743 | + .css('visibility', !options.prevButton ? 'hidden' : 'visible'); | |
1744 | + | |
1745 | + mounth_picker | |
1746 | + .find('.' + options.next) | |
1747 | + .css('visibility', !options.nextButton ? 'hidden' : 'visible'); | |
1748 | + | |
1749 | + setMask(options); | |
1750 | + | |
1751 | + if (options.validateOnBlur) { | |
1752 | + input | |
1753 | + .off('blur.xdsoft') | |
1754 | + .on('blur.xdsoft', function () { | |
1755 | + if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) { | |
1756 | + $(this).val(null); | |
1757 | + datetimepicker.data('xdsoft_datetime').empty(); | |
1758 | + } else { | |
1759 | + var d = dateHelper.parseDate($(this).val(), options.format); | |
1760 | + if (d) { // parseDate() may skip some invalid parts like date or time, so make it clear for user: show parsed date/time | |
1761 | + $(this).val(dateHelper.formatDate(d, options.format)); | |
1762 | + } else { | |
1763 | + var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), | |
1764 | + splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); | |
1765 | + | |
1766 | + // parse the numbers as 0312 => 03:12 | |
1767 | + if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { | |
1768 | + $(this).val([splittedHours, splittedMinutes].map(function (item) { | |
1769 | + return item > 9 ? item : '0' + item; | |
1770 | + }).join(':')); | |
1771 | + } else { | |
1772 | + $(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format)); | |
1773 | + } | |
1774 | + } | |
1775 | + datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); | |
1776 | + } | |
1777 | + | |
1778 | + datetimepicker.trigger('changedatetime.xdsoft'); | |
1779 | + datetimepicker.trigger('close.xdsoft'); | |
1780 | + }); | |
1781 | + } | |
1782 | + options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1; | |
1783 | + | |
1784 | + datetimepicker | |
1785 | + .trigger('xchange.xdsoft') | |
1786 | + .trigger('afterOpen.xdsoft'); | |
1787 | + }; | |
1788 | + | |
1789 | + datetimepicker | |
1790 | + .data('options', options) | |
1791 | + .on('touchstart mousedown.xdsoft', function (event) { | |
1792 | + event.stopPropagation(); | |
1793 | + event.preventDefault(); | |
1794 | + yearselect.hide(); | |
1795 | + monthselect.hide(); | |
1796 | + return false; | |
1797 | + }); | |
1798 | + | |
1799 | + //scroll_element = timepicker.find('.xdsoft_time_box'); | |
1800 | + timeboxparent.append(timebox); | |
1801 | + timeboxparent.xdsoftScroller(); | |
1802 | + | |
1803 | + datetimepicker.on('afterOpen.xdsoft', function () { | |
1804 | + timeboxparent.xdsoftScroller(); | |
1805 | + }); | |
1806 | + | |
1807 | + datetimepicker | |
1808 | + .append(datepicker) | |
1809 | + .append(timepicker); | |
1810 | + | |
1811 | + if (options.withoutCopyright !== true) { | |
1812 | + datetimepicker | |
1813 | + .append(xdsoft_copyright); | |
1814 | + } | |
1815 | + | |
1816 | + datepicker | |
1817 | + .append(mounth_picker) | |
1818 | + .append(calendar) | |
1819 | + .append(applyButton); | |
1820 | + | |
1821 | + $(options.parentID) | |
1822 | + .append(datetimepicker); | |
1823 | + | |
1824 | + XDSoft_datetime = function () { | |
1825 | + var _this = this; | |
1826 | + _this.now = function (norecursion) { | |
1827 | + var d = new Date(), | |
1828 | + date, | |
1829 | + time; | |
1830 | + | |
1831 | + if (!norecursion && options.defaultDate) { | |
1832 | + date = _this.strToDateTime(options.defaultDate); | |
1833 | + d.setFullYear(date.getFullYear()); | |
1834 | + d.setMonth(date.getMonth()); | |
1835 | + d.setDate(date.getDate()); | |
1836 | + } | |
1837 | + | |
1838 | + if (options.yearOffset) { | |
1839 | + d.setFullYear(d.getFullYear() + options.yearOffset); | |
1840 | + } | |
1841 | + | |
1842 | + if (!norecursion && options.defaultTime) { | |
1843 | + time = _this.strtotime(options.defaultTime); | |
1844 | + d.setHours(time.getHours()); | |
1845 | + d.setMinutes(time.getMinutes()); | |
1846 | + } | |
1847 | + return d; | |
1848 | + }; | |
1849 | + | |
1850 | + _this.isValidDate = function (d) { | |
1851 | + if (Object.prototype.toString.call(d) !== "[object Date]") { | |
1852 | + return false; | |
1853 | + } | |
1854 | + return !isNaN(d.getTime()); | |
1855 | + }; | |
1856 | + | |
1857 | + _this.setCurrentTime = function (dTime) { | |
1858 | + _this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now(); | |
1859 | + datetimepicker.trigger('xchange.xdsoft'); | |
1860 | + }; | |
1861 | + | |
1862 | + _this.empty = function () { | |
1863 | + _this.currentTime = null; | |
1864 | + }; | |
1865 | + | |
1866 | + _this.getCurrentTime = function (dTime) { | |
1867 | + return _this.currentTime; | |
1868 | + }; | |
1869 | + | |
1870 | + _this.nextMonth = function () { | |
1871 | + | |
1872 | + if (_this.currentTime === undefined || _this.currentTime === null) { | |
1873 | + _this.currentTime = _this.now(); | |
1874 | + } | |
1875 | + | |
1876 | + var month = _this.currentTime.getMonth() + 1, | |
1877 | + year; | |
1878 | + if (month === 12) { | |
1879 | + _this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1); | |
1880 | + month = 0; | |
1881 | + } | |
1882 | + | |
1883 | + year = _this.currentTime.getFullYear(); | |
1884 | + | |
1885 | + _this.currentTime.setDate( | |
1886 | + Math.min( | |
1887 | + new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), | |
1888 | + _this.currentTime.getDate() | |
1889 | + ) | |
1890 | + ); | |
1891 | + _this.currentTime.setMonth(month); | |
1892 | + | |
1893 | + if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { | |
1894 | + options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); | |
1895 | + } | |
1896 | + | |
1897 | + if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) { | |
1898 | + options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); | |
1899 | + } | |
1900 | + | |
1901 | + datetimepicker.trigger('xchange.xdsoft'); | |
1902 | + return month; | |
1903 | + }; | |
1904 | + | |
1905 | + _this.prevMonth = function () { | |
1906 | + | |
1907 | + if (_this.currentTime === undefined || _this.currentTime === null) { | |
1908 | + _this.currentTime = _this.now(); | |
1909 | + } | |
1910 | + | |
1911 | + var month = _this.currentTime.getMonth() - 1; | |
1912 | + if (month === -1) { | |
1913 | + _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); | |
1914 | + month = 11; | |
1915 | + } | |
1916 | + _this.currentTime.setDate( | |
1917 | + Math.min( | |
1918 | + new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(), | |
1919 | + _this.currentTime.getDate() | |
1920 | + ) | |
1921 | + ); | |
1922 | + _this.currentTime.setMonth(month); | |
1923 | + if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) { | |
1924 | + options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); | |
1925 | + } | |
1926 | + datetimepicker.trigger('xchange.xdsoft'); | |
1927 | + return month; | |
1928 | + }; | |
1929 | + | |
1930 | + _this.getWeekOfYear = function (datetime) { | |
1931 | + if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) { | |
1932 | + var week = options.onGetWeekOfYear.call(datetimepicker, datetime); | |
1933 | + if (typeof week !== 'undefined') { | |
1934 | + return week; | |
1935 | + } | |
1936 | + } | |
1937 | + var onejan = new Date(datetime.getFullYear(), 0, 1); | |
1938 | + //First week of the year is th one with the first Thursday according to ISO8601 | |
1939 | + if(onejan.getDay()!=4) | |
1940 | + onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7)); | |
1941 | + return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7); | |
1942 | + }; | |
1943 | + | |
1944 | + _this.strToDateTime = function (sDateTime) { | |
1945 | + var tmpDate = [], timeOffset, currentTime; | |
1946 | + | |
1947 | + if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) { | |
1948 | + return sDateTime; | |
1949 | + } | |
1950 | + | |
1951 | + tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime); | |
1952 | + if (tmpDate) { | |
1953 | + tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate); | |
1954 | + } | |
1955 | + if (tmpDate && tmpDate[2]) { | |
1956 | + timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; | |
1957 | + currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); | |
1958 | + } else { | |
1959 | + currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now(); | |
1960 | + } | |
1961 | + | |
1962 | + if (!_this.isValidDate(currentTime)) { | |
1963 | + currentTime = _this.now(); | |
1964 | + } | |
1965 | + | |
1966 | + return currentTime; | |
1967 | + }; | |
1968 | + | |
1969 | + _this.strToDate = function (sDate) { | |
1970 | + if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) { | |
1971 | + return sDate; | |
1972 | + } | |
1973 | + | |
1974 | + var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true); | |
1975 | + if (!_this.isValidDate(currentTime)) { | |
1976 | + currentTime = _this.now(true); | |
1977 | + } | |
1978 | + return currentTime; | |
1979 | + }; | |
1980 | + | |
1981 | + _this.strtotime = function (sTime) { | |
1982 | + if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) { | |
1983 | + return sTime; | |
1984 | + } | |
1985 | + var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true); | |
1986 | + if (!_this.isValidDate(currentTime)) { | |
1987 | + currentTime = _this.now(true); | |
1988 | + } | |
1989 | + return currentTime; | |
1990 | + }; | |
1991 | + | |
1992 | + _this.str = function () { | |
1993 | + return dateHelper.formatDate(_this.currentTime, options.format); | |
1994 | + }; | |
1995 | + _this.currentTime = this.now(); | |
1996 | + }; | |
1997 | + | |
1998 | + _xdsoft_datetime = new XDSoft_datetime(); | |
1999 | + | |
2000 | + applyButton.on('touchend click', function (e) {//pathbrite | |
2001 | + e.preventDefault(); | |
2002 | + datetimepicker.data('changed', true); | |
2003 | + _xdsoft_datetime.setCurrentTime(getCurrentValue()); | |
2004 | + input.val(_xdsoft_datetime.str()); | |
2005 | + datetimepicker.trigger('close.xdsoft'); | |
2006 | + }); | |
2007 | + mounth_picker | |
2008 | + .find('.xdsoft_today_button') | |
2009 | + .on('touchend mousedown.xdsoft', function () { | |
2010 | + datetimepicker.data('changed', true); | |
2011 | + _xdsoft_datetime.setCurrentTime(0); | |
2012 | + datetimepicker.trigger('afterOpen.xdsoft'); | |
2013 | + }).on('dblclick.xdsoft', function () { | |
2014 | + var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; | |
2015 | + currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); | |
2016 | + minDate = _xdsoft_datetime.strToDate(options.minDate); | |
2017 | + minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); | |
2018 | + if (currentDate < minDate) { | |
2019 | + return; | |
2020 | + } | |
2021 | + maxDate = _xdsoft_datetime.strToDate(options.maxDate); | |
2022 | + maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); | |
2023 | + if (currentDate > maxDate) { | |
2024 | + return; | |
2025 | + } | |
2026 | + input.val(_xdsoft_datetime.str()); | |
2027 | + input.trigger('change'); | |
2028 | + datetimepicker.trigger('close.xdsoft'); | |
2029 | + }); | |
2030 | + mounth_picker | |
2031 | + .find('.xdsoft_prev,.xdsoft_next') | |
2032 | + .on('touchend mousedown.xdsoft', function () { | |
2033 | + var $this = $(this), | |
2034 | + timer = 0, | |
2035 | + stop = false; | |
2036 | + | |
2037 | + (function arguments_callee1(v) { | |
2038 | + if ($this.hasClass(options.next)) { | |
2039 | + _xdsoft_datetime.nextMonth(); | |
2040 | + } else if ($this.hasClass(options.prev)) { | |
2041 | + _xdsoft_datetime.prevMonth(); | |
2042 | + } | |
2043 | + if (options.monthChangeSpinner) { | |
2044 | + if (!stop) { | |
2045 | + timer = setTimeout(arguments_callee1, v || 100); | |
2046 | + } | |
2047 | + } | |
2048 | + }(500)); | |
2049 | + | |
2050 | + $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() { | |
2051 | + clearTimeout(timer); | |
2052 | + stop = true; | |
2053 | + $([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2); | |
2054 | + }); | |
2055 | + }); | |
2056 | + | |
2057 | + timepicker | |
2058 | + .find('.xdsoft_prev,.xdsoft_next') | |
2059 | + .on('touchend mousedown.xdsoft', function () { | |
2060 | + var $this = $(this), | |
2061 | + timer = 0, | |
2062 | + stop = false, | |
2063 | + period = 110; | |
2064 | + (function arguments_callee4(v) { | |
2065 | + var pheight = timeboxparent[0].clientHeight, | |
2066 | + height = timebox[0].offsetHeight, | |
2067 | + top = Math.abs(parseInt(timebox.css('marginTop'), 10)); | |
2068 | + if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) { | |
2069 | + timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px'); | |
2070 | + } else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) { | |
2071 | + timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px'); | |
2072 | + } | |
2073 | + /** | |
2074 | + * Fixed bug: | |
2075 | + * When using css3 transition, it will cause a bug that you cannot scroll the timepicker list. | |
2076 | + * The reason is that the transition-duration time, if you set it to 0, all things fine, otherwise, this | |
2077 | + * would cause a bug when you use jquery.css method. | |
2078 | + * Let's say: * { transition: all .5s ease; } | |
2079 | + * jquery timebox.css('marginTop') will return the original value which is before you clicking the next/prev button, | |
2080 | + * meanwhile the timebox[0].style.marginTop will return the right value which is after you clicking the | |
2081 | + * next/prev button. | |
2082 | + * | |
2083 | + * What we should do: | |
2084 | + * Replace timebox.css('marginTop') with timebox[0].style.marginTop. | |
2085 | + */ | |
2086 | + timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox[0].style.marginTop, 10) / (height - pheight))]); | |
2087 | + period = (period > 10) ? 10 : period - 10; | |
2088 | + if (!stop) { | |
2089 | + timer = setTimeout(arguments_callee4, v || period); | |
2090 | + } | |
2091 | + }(500)); | |
2092 | + $([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() { | |
2093 | + clearTimeout(timer); | |
2094 | + stop = true; | |
2095 | + $([document.body, window]) | |
2096 | + .off('touchend mouseup.xdsoft', arguments_callee5); | |
2097 | + }); | |
2098 | + }); | |
2099 | + | |
2100 | + xchangeTimer = 0; | |
2101 | + // base handler - generating a calendar and timepicker | |
2102 | + datetimepicker | |
2103 | + .on('xchange.xdsoft', function (event) { | |
2104 | + clearTimeout(xchangeTimer); | |
2105 | + xchangeTimer = setTimeout(function () { | |
2106 | + | |
2107 | + if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { | |
2108 | + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); | |
2109 | + } | |
2110 | + | |
2111 | + var table = '', | |
2112 | + start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), | |
2113 | + i = 0, | |
2114 | + j, | |
2115 | + today = _xdsoft_datetime.now(), | |
2116 | + maxDate = false, | |
2117 | + minDate = false, | |
2118 | + hDate, | |
2119 | + day, | |
2120 | + d, | |
2121 | + y, | |
2122 | + m, | |
2123 | + w, | |
2124 | + classes = [], | |
2125 | + customDateSettings, | |
2126 | + newRow = true, | |
2127 | + time = '', | |
2128 | + h = '', | |
2129 | + line_time, | |
2130 | + description; | |
2131 | + | |
2132 | + while (start.getDay() !== options.dayOfWeekStart) { | |
2133 | + start.setDate(start.getDate() - 1); | |
2134 | + } | |
2135 | + | |
2136 | + table += '<table><thead><tr>'; | |
2137 | + | |
2138 | + if (options.weeks) { | |
2139 | + table += '<th></th>'; | |
2140 | + } | |
2141 | + | |
2142 | + for (j = 0; j < 7; j += 1) { | |
2143 | + table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>'; | |
2144 | + } | |
2145 | + | |
2146 | + table += '</tr></thead>'; | |
2147 | + table += '<tbody>'; | |
2148 | + | |
2149 | + if (options.maxDate !== false) { | |
2150 | + maxDate = _xdsoft_datetime.strToDate(options.maxDate); | |
2151 | + maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999); | |
2152 | + } | |
2153 | + | |
2154 | + if (options.minDate !== false) { | |
2155 | + minDate = _xdsoft_datetime.strToDate(options.minDate); | |
2156 | + minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); | |
2157 | + } | |
2158 | + | |
2159 | + while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) { | |
2160 | + classes = []; | |
2161 | + i += 1; | |
2162 | + | |
2163 | + day = start.getDay(); | |
2164 | + d = start.getDate(); | |
2165 | + y = start.getFullYear(); | |
2166 | + m = start.getMonth(); | |
2167 | + w = _xdsoft_datetime.getWeekOfYear(start); | |
2168 | + description = ''; | |
2169 | + | |
2170 | + classes.push('xdsoft_date'); | |
2171 | + | |
2172 | + if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) { | |
2173 | + customDateSettings = options.beforeShowDay.call(datetimepicker, start); | |
2174 | + } else { | |
2175 | + customDateSettings = null; | |
2176 | + } | |
2177 | + | |
2178 | + if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){ | |
2179 | + if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){ | |
2180 | + classes.push('xdsoft_disabled'); | |
2181 | + } | |
2182 | + } else if(options.allowDates && options.allowDates.length>0){ | |
2183 | + if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){ | |
2184 | + classes.push('xdsoft_disabled'); | |
2185 | + } | |
2186 | + } else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) { | |
2187 | + classes.push('xdsoft_disabled'); | |
2188 | + } else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { | |
2189 | + classes.push('xdsoft_disabled'); | |
2190 | + } else if (options.disabledWeekDays.indexOf(day) !== -1) { | |
2191 | + classes.push('xdsoft_disabled'); | |
2192 | + }else if (input.is('[readonly]')) { | |
2193 | + classes.push('xdsoft_disabled'); | |
2194 | + } | |
2195 | + | |
2196 | + if (customDateSettings && customDateSettings[1] !== "") { | |
2197 | + classes.push(customDateSettings[1]); | |
2198 | + } | |
2199 | + | |
2200 | + if (_xdsoft_datetime.currentTime.getMonth() !== m) { | |
2201 | + classes.push('xdsoft_other_month'); | |
2202 | + } | |
2203 | + | |
2204 | + if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { | |
2205 | + classes.push('xdsoft_current'); | |
2206 | + } | |
2207 | + | |
2208 | + if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) { | |
2209 | + classes.push('xdsoft_today'); | |
2210 | + } | |
2211 | + | |
2212 | + if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) { | |
2213 | + classes.push('xdsoft_weekend'); | |
2214 | + } | |
2215 | + | |
2216 | + if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) { | |
2217 | + hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)]; | |
2218 | + classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); | |
2219 | + description = hDate.desc === undefined ? '' : hDate.desc; | |
2220 | + } | |
2221 | + | |
2222 | + if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) { | |
2223 | + classes.push(options.beforeShowDay(start)); | |
2224 | + } | |
2225 | + | |
2226 | + if (newRow) { | |
2227 | + table += '<tr>'; | |
2228 | + newRow = false; | |
2229 | + if (options.weeks) { | |
2230 | + table += '<th>' + w + '</th>'; | |
2231 | + } | |
2232 | + } | |
2233 | + | |
2234 | + table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' + | |
2235 | + '<div>' + d + '</div>' + | |
2236 | + '</td>'; | |
2237 | + | |
2238 | + if (start.getDay() === options.dayOfWeekStartPrev) { | |
2239 | + table += '</tr>'; | |
2240 | + newRow = true; | |
2241 | + } | |
2242 | + | |
2243 | + start.setDate(d + 1); | |
2244 | + } | |
2245 | + table += '</tbody></table>'; | |
2246 | + | |
2247 | + calendar.html(table); | |
2248 | + | |
2249 | + mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]); | |
2250 | + mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear()); | |
2251 | + | |
2252 | + // generate timebox | |
2253 | + time = ''; | |
2254 | + h = ''; | |
2255 | + m = ''; | |
2256 | + | |
2257 | + line_time = function line_time(h, m) { | |
2258 | + var now = _xdsoft_datetime.now(), optionDateTime, current_time, | |
2259 | + isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length; | |
2260 | + now.setHours(h); | |
2261 | + h = parseInt(now.getHours(), 10); | |
2262 | + now.setMinutes(m); | |
2263 | + m = parseInt(now.getMinutes(), 10); | |
2264 | + optionDateTime = new Date(_xdsoft_datetime.currentTime); | |
2265 | + optionDateTime.setHours(h); | |
2266 | + optionDateTime.setMinutes(m); | |
2267 | + classes = []; | |
2268 | + if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { | |
2269 | + classes.push('xdsoft_disabled'); | |
2270 | + } else if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) { | |
2271 | + classes.push('xdsoft_disabled'); | |
2272 | + } else if (input.is('[readonly]')) { | |
2273 | + classes.push('xdsoft_disabled'); | |
2274 | + } | |
2275 | + | |
2276 | + current_time = new Date(_xdsoft_datetime.currentTime); | |
2277 | + current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); | |
2278 | + | |
2279 | + if (!isALlowTimesInit) { | |
2280 | + current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); | |
2281 | + } | |
2282 | + | |
2283 | + if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) { | |
2284 | + if (options.defaultSelect || datetimepicker.data('changed')) { | |
2285 | + classes.push('xdsoft_current'); | |
2286 | + } else if (options.initTime) { | |
2287 | + classes.push('xdsoft_init_time'); | |
2288 | + } | |
2289 | + } | |
2290 | + if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) { | |
2291 | + classes.push('xdsoft_today'); | |
2292 | + } | |
2293 | + time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>'; | |
2294 | + }; | |
2295 | + | |
2296 | + if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) { | |
2297 | + for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) { | |
2298 | + for (j = 0; j < 60; j += options.step) { | |
2299 | + h = (i < 10 ? '0' : '') + i; | |
2300 | + m = (j < 10 ? '0' : '') + j; | |
2301 | + line_time(h, m); | |
2302 | + } | |
2303 | + } | |
2304 | + } else { | |
2305 | + for (i = 0; i < options.allowTimes.length; i += 1) { | |
2306 | + h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours(); | |
2307 | + m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes(); | |
2308 | + line_time(h, m); | |
2309 | + } | |
2310 | + } | |
2311 | + | |
2312 | + timebox.html(time); | |
2313 | + | |
2314 | + opt = ''; | |
2315 | + i = 0; | |
2316 | + | |
2317 | + for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) { | |
2318 | + opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>'; | |
2319 | + } | |
2320 | + yearselect.children().eq(0) | |
2321 | + .html(opt); | |
2322 | + | |
2323 | + for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { | |
2324 | + opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>'; | |
2325 | + } | |
2326 | + monthselect.children().eq(0).html(opt); | |
2327 | + $(datetimepicker) | |
2328 | + .trigger('generate.xdsoft'); | |
2329 | + }, 10); | |
2330 | + event.stopPropagation(); | |
2331 | + }) | |
2332 | + .on('afterOpen.xdsoft', function () { | |
2333 | + if (options.timepicker) { | |
2334 | + var classType, pheight, height, top; | |
2335 | + if (timebox.find('.xdsoft_current').length) { | |
2336 | + classType = '.xdsoft_current'; | |
2337 | + } else if (timebox.find('.xdsoft_init_time').length) { | |
2338 | + classType = '.xdsoft_init_time'; | |
2339 | + } | |
2340 | + if (classType) { | |
2341 | + pheight = timeboxparent[0].clientHeight; | |
2342 | + height = timebox[0].offsetHeight; | |
2343 | + top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1; | |
2344 | + if ((height - pheight) < top) { | |
2345 | + top = height - pheight; | |
2346 | + } | |
2347 | + timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]); | |
2348 | + } else { | |
2349 | + timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]); | |
2350 | + } | |
2351 | + } | |
2352 | + }); | |
2353 | + | |
2354 | + timerclick = 0; | |
2355 | + calendar | |
2356 | + .on('touchend click.xdsoft', 'td', function (xdevent) { | |
2357 | + xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap | |
2358 | + timerclick += 1; | |
2359 | + var $this = $(this), | |
2360 | + currentTime = _xdsoft_datetime.currentTime; | |
2361 | + | |
2362 | + if (currentTime === undefined || currentTime === null) { | |
2363 | + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); | |
2364 | + currentTime = _xdsoft_datetime.currentTime; | |
2365 | + } | |
2366 | + | |
2367 | + if ($this.hasClass('xdsoft_disabled')) { | |
2368 | + return false; | |
2369 | + } | |
2370 | + | |
2371 | + currentTime.setDate(1); | |
2372 | + currentTime.setFullYear($this.data('year')); | |
2373 | + currentTime.setMonth($this.data('month')); | |
2374 | + currentTime.setDate($this.data('date')); | |
2375 | + | |
2376 | + datetimepicker.trigger('select.xdsoft', [currentTime]); | |
2377 | + | |
2378 | + input.val(_xdsoft_datetime.str()); | |
2379 | + | |
2380 | + if (options.onSelectDate && $.isFunction(options.onSelectDate)) { | |
2381 | + options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); | |
2382 | + } | |
2383 | + | |
2384 | + datetimepicker.data('changed', true); | |
2385 | + datetimepicker.trigger('xchange.xdsoft'); | |
2386 | + datetimepicker.trigger('changedatetime.xdsoft'); | |
2387 | + if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) { | |
2388 | + datetimepicker.trigger('close.xdsoft'); | |
2389 | + } | |
2390 | + setTimeout(function () { | |
2391 | + timerclick = 0; | |
2392 | + }, 200); | |
2393 | + }); | |
2394 | + | |
2395 | + timebox | |
2396 | + .on('touchend click.xdsoft', 'div', function (xdevent) { | |
2397 | + xdevent.stopPropagation(); | |
2398 | + var $this = $(this), | |
2399 | + currentTime = _xdsoft_datetime.currentTime; | |
2400 | + | |
2401 | + if (currentTime === undefined || currentTime === null) { | |
2402 | + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); | |
2403 | + currentTime = _xdsoft_datetime.currentTime; | |
2404 | + } | |
2405 | + | |
2406 | + if ($this.hasClass('xdsoft_disabled')) { | |
2407 | + return false; | |
2408 | + } | |
2409 | + currentTime.setHours($this.data('hour')); | |
2410 | + currentTime.setMinutes($this.data('minute')); | |
2411 | + datetimepicker.trigger('select.xdsoft', [currentTime]); | |
2412 | + | |
2413 | + datetimepicker.data('input').val(_xdsoft_datetime.str()); | |
2414 | + | |
2415 | + if (options.onSelectTime && $.isFunction(options.onSelectTime)) { | |
2416 | + options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); | |
2417 | + } | |
2418 | + datetimepicker.data('changed', true); | |
2419 | + datetimepicker.trigger('xchange.xdsoft'); | |
2420 | + datetimepicker.trigger('changedatetime.xdsoft'); | |
2421 | + if (options.inline !== true && options.closeOnTimeSelect === true) { | |
2422 | + datetimepicker.trigger('close.xdsoft'); | |
2423 | + } | |
2424 | + }); | |
2425 | + | |
2426 | + datepicker | |
2427 | + .on('mousewheel.xdsoft', function (event) { | |
2428 | + if (!options.scrollMonth) { | |
2429 | + return true; | |
2430 | + } | |
2431 | + if (event.deltaY < 0) { | |
2432 | + _xdsoft_datetime.nextMonth(); | |
2433 | + } else { | |
2434 | + _xdsoft_datetime.prevMonth(); | |
2435 | + } | |
2436 | + return false; | |
2437 | + }); | |
2438 | + | |
2439 | + input | |
2440 | + .on('mousewheel.xdsoft', function (event) { | |
2441 | + if (!options.scrollInput) { | |
2442 | + return true; | |
2443 | + } | |
2444 | + if (!options.datepicker && options.timepicker) { | |
2445 | + current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0; | |
2446 | + if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) { | |
2447 | + current_time_index += event.deltaY; | |
2448 | + } | |
2449 | + if (timebox.children().eq(current_time_index).length) { | |
2450 | + timebox.children().eq(current_time_index).trigger('mousedown'); | |
2451 | + } | |
2452 | + return false; | |
2453 | + } | |
2454 | + if (options.datepicker && !options.timepicker) { | |
2455 | + datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]); | |
2456 | + if (input.val) { | |
2457 | + input.val(_xdsoft_datetime.str()); | |
2458 | + } | |
2459 | + datetimepicker.trigger('changedatetime.xdsoft'); | |
2460 | + return false; | |
2461 | + } | |
2462 | + }); | |
2463 | + | |
2464 | + datetimepicker | |
2465 | + .on('changedatetime.xdsoft', function (event) { | |
2466 | + if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) { | |
2467 | + var $input = datetimepicker.data('input'); | |
2468 | + options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event); | |
2469 | + delete options.value; | |
2470 | + $input.trigger('change'); | |
2471 | + } | |
2472 | + }) | |
2473 | + .on('generate.xdsoft', function () { | |
2474 | + if (options.onGenerate && $.isFunction(options.onGenerate)) { | |
2475 | + options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input')); | |
2476 | + } | |
2477 | + if (triggerAfterOpen) { | |
2478 | + datetimepicker.trigger('afterOpen.xdsoft'); | |
2479 | + triggerAfterOpen = false; | |
2480 | + } | |
2481 | + }) | |
2482 | + .on('click.xdsoft', function (xdevent) { | |
2483 | + xdevent.stopPropagation(); | |
2484 | + }); | |
2485 | + | |
2486 | + current_time_index = 0; | |
2487 | + | |
2488 | + /** | |
2489 | + * Runs the callback for each of the specified node's ancestors. | |
2490 | + * | |
2491 | + * Return FALSE from the callback to stop ascending. | |
2492 | + * | |
2493 | + * @param {DOMNode} node | |
2494 | + * @param {Function} callback | |
2495 | + * @returns {undefined} | |
2496 | + */ | |
2497 | + forEachAncestorOf = function (node, callback) { | |
2498 | + do { | |
2499 | + node = node.parentNode; | |
2500 | + | |
2501 | + if (callback(node) === false) { | |
2502 | + break; | |
2503 | + } | |
2504 | + } while (node.nodeName !== 'HTML'); | |
2505 | + }; | |
2506 | + | |
2507 | + /** | |
2508 | + * Sets the position of the picker. | |
2509 | + * | |
2510 | + * @returns {undefined} | |
2511 | + */ | |
2512 | + setPos = function () { | |
2513 | + var dateInputOffset, | |
2514 | + dateInputElem, | |
2515 | + verticalPosition, | |
2516 | + left, | |
2517 | + position, | |
2518 | + datetimepickerElem, | |
2519 | + dateInputHasFixedAncestor, | |
2520 | + $dateInput, | |
2521 | + windowWidth, | |
2522 | + verticalAnchorEdge, | |
2523 | + datetimepickerCss, | |
2524 | + windowHeight, | |
2525 | + windowScrollTop; | |
2526 | + | |
2527 | + $dateInput = datetimepicker.data('input'); | |
2528 | + dateInputOffset = $dateInput.offset(); | |
2529 | + dateInputElem = $dateInput[0]; | |
2530 | + | |
2531 | + verticalAnchorEdge = 'top'; | |
2532 | + verticalPosition = (dateInputOffset.top + dateInputElem.offsetHeight) - 1; | |
2533 | + left = dateInputOffset.left; | |
2534 | + position = "absolute"; | |
2535 | + | |
2536 | + windowWidth = $(window).width(); | |
2537 | + windowHeight = $(window).height(); | |
2538 | + windowScrollTop = $(window).scrollTop(); | |
2539 | + | |
2540 | + if ((document.documentElement.clientWidth - dateInputOffset.left) < datepicker.parent().outerWidth(true)) { | |
2541 | + var diff = datepicker.parent().outerWidth(true) - dateInputElem.offsetWidth; | |
2542 | + left = left - diff; | |
2543 | + } | |
2544 | + | |
2545 | + if ($dateInput.parent().css('direction') === 'rtl') { | |
2546 | + left -= (datetimepicker.outerWidth() - $dateInput.outerWidth()); | |
2547 | + } | |
2548 | + | |
2549 | + if (options.fixed) { | |
2550 | + verticalPosition -= windowScrollTop; | |
2551 | + left -= $(window).scrollLeft(); | |
2552 | + position = "fixed"; | |
2553 | + } else { | |
2554 | + dateInputHasFixedAncestor = false; | |
2555 | + | |
2556 | + forEachAncestorOf(dateInputElem, function (ancestorNode) { | |
2557 | + if (window.getComputedStyle(ancestorNode).getPropertyValue('position') === 'fixed') { | |
2558 | + dateInputHasFixedAncestor = true; | |
2559 | + return false; | |
2560 | + } | |
2561 | + }); | |
2562 | + | |
2563 | + if (dateInputHasFixedAncestor) { | |
2564 | + position = 'fixed'; | |
2565 | + | |
2566 | + //If the picker won't fit entirely within the viewport then display it above the date input. | |
2567 | + if (verticalPosition + datetimepicker.outerHeight() > windowHeight + windowScrollTop) { | |
2568 | + verticalAnchorEdge = 'bottom'; | |
2569 | + verticalPosition = (windowHeight + windowScrollTop) - dateInputOffset.top; | |
2570 | + } else { | |
2571 | + verticalPosition -= windowScrollTop; | |
2572 | + } | |
2573 | + } else { | |
2574 | + if (verticalPosition + dateInputElem.offsetHeight > windowHeight + windowScrollTop) { | |
2575 | + verticalPosition = dateInputOffset.top - dateInputElem.offsetHeight + 1; | |
2576 | + } | |
2577 | + } | |
2578 | + | |
2579 | + if (verticalPosition < 0) { | |
2580 | + verticalPosition = 0; | |
2581 | + } | |
2582 | + | |
2583 | + if (left + dateInputElem.offsetWidth > windowWidth) { | |
2584 | + left = windowWidth - dateInputElem.offsetWidth; | |
2585 | + } | |
2586 | + } | |
2587 | + | |
2588 | + datetimepickerElem = datetimepicker[0]; | |
2589 | + | |
2590 | + forEachAncestorOf(datetimepickerElem, function (ancestorNode) { | |
2591 | + var ancestorNodePosition; | |
2592 | + | |
2593 | + ancestorNodePosition = window.getComputedStyle(ancestorNode).getPropertyValue('position'); | |
2594 | + | |
2595 | + if (ancestorNodePosition === 'relative' && windowWidth >= ancestorNode.offsetWidth) { | |
2596 | + left = left - ((windowWidth - ancestorNode.offsetWidth) / 2); | |
2597 | + return false; | |
2598 | + } | |
2599 | + }); | |
2600 | + | |
2601 | + datetimepickerCss = { | |
2602 | + position: position, | |
2603 | + left: left, | |
2604 | + top: '', //Initialize to prevent previous values interfering with new ones. | |
2605 | + bottom: '' //Initialize to prevent previous values interfering with new ones. | |
2606 | + }; | |
2607 | + | |
2608 | + datetimepickerCss[verticalAnchorEdge] = verticalPosition; | |
2609 | + | |
2610 | + datetimepicker.css(datetimepickerCss); | |
2611 | + }; | |
2612 | + | |
2613 | + datetimepicker | |
2614 | + .on('open.xdsoft', function (event) { | |
2615 | + var onShow = true; | |
2616 | + if (options.onShow && $.isFunction(options.onShow)) { | |
2617 | + onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); | |
2618 | + } | |
2619 | + if (onShow !== false) { | |
2620 | + datetimepicker.show(); | |
2621 | + setPos(); | |
2622 | + $(window) | |
2623 | + .off('resize.xdsoft', setPos) | |
2624 | + .on('resize.xdsoft', setPos); | |
2625 | + | |
2626 | + if (options.closeOnWithoutClick) { | |
2627 | + $([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() { | |
2628 | + datetimepicker.trigger('close.xdsoft'); | |
2629 | + $([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6); | |
2630 | + }); | |
2631 | + } | |
2632 | + } | |
2633 | + }) | |
2634 | + .on('close.xdsoft', function (event) { | |
2635 | + var onClose = true; | |
2636 | + mounth_picker | |
2637 | + .find('.xdsoft_month,.xdsoft_year') | |
2638 | + .find('.xdsoft_select') | |
2639 | + .hide(); | |
2640 | + if (options.onClose && $.isFunction(options.onClose)) { | |
2641 | + onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event); | |
2642 | + } | |
2643 | + if (onClose !== false && !options.opened && !options.inline) { | |
2644 | + datetimepicker.hide(); | |
2645 | + } | |
2646 | + event.stopPropagation(); | |
2647 | + }) | |
2648 | + .on('toggle.xdsoft', function () { | |
2649 | + if (datetimepicker.is(':visible')) { | |
2650 | + datetimepicker.trigger('close.xdsoft'); | |
2651 | + } else { | |
2652 | + datetimepicker.trigger('open.xdsoft'); | |
2653 | + } | |
2654 | + }) | |
2655 | + .data('input', input); | |
2656 | + | |
2657 | + timer = 0; | |
2658 | + | |
2659 | + datetimepicker.data('xdsoft_datetime', _xdsoft_datetime); | |
2660 | + datetimepicker.setOptions(options); | |
2661 | + | |
2662 | + function getCurrentValue() { | |
2663 | + var ct = false, time; | |
2664 | + | |
2665 | + if (options.startDate) { | |
2666 | + ct = _xdsoft_datetime.strToDate(options.startDate); | |
2667 | + } else { | |
2668 | + ct = options.value || ((input && input.val && input.val()) ? input.val() : ''); | |
2669 | + if (ct) { | |
2670 | + ct = _xdsoft_datetime.strToDateTime(ct); | |
2671 | + } else if (options.defaultDate) { | |
2672 | + ct = _xdsoft_datetime.strToDateTime(options.defaultDate); | |
2673 | + if (options.defaultTime) { | |
2674 | + time = _xdsoft_datetime.strtotime(options.defaultTime); | |
2675 | + ct.setHours(time.getHours()); | |
2676 | + ct.setMinutes(time.getMinutes()); | |
2677 | + } | |
2678 | + } | |
2679 | + } | |
2680 | + | |
2681 | + if (ct && _xdsoft_datetime.isValidDate(ct)) { | |
2682 | + datetimepicker.data('changed', true); | |
2683 | + } else { | |
2684 | + ct = ''; | |
2685 | + } | |
2686 | + | |
2687 | + return ct || 0; | |
2688 | + } | |
2689 | + | |
2690 | + function setMask(options) { | |
2691 | + | |
2692 | + var isValidValue = function (mask, value) { | |
2693 | + var reg = mask | |
2694 | + .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') | |
2695 | + .replace(/_/g, '{digit+}') | |
2696 | + .replace(/([0-9]{1})/g, '{digit$1}') | |
2697 | + .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') | |
2698 | + .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); | |
2699 | + return (new RegExp(reg)).test(value); | |
2700 | + }, | |
2701 | + getCaretPos = function (input) { | |
2702 | + try { | |
2703 | + if (document.selection && document.selection.createRange) { | |
2704 | + var range = document.selection.createRange(); | |
2705 | + return range.getBookmark().charCodeAt(2) - 2; | |
2706 | + } | |
2707 | + if (input.setSelectionRange) { | |
2708 | + return input.selectionStart; | |
2709 | + } | |
2710 | + } catch (e) { | |
2711 | + return 0; | |
2712 | + } | |
2713 | + }, | |
2714 | + setCaretPos = function (node, pos) { | |
2715 | + node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; | |
2716 | + if (!node) { | |
2717 | + return false; | |
2718 | + } | |
2719 | + if (node.createTextRange) { | |
2720 | + var textRange = node.createTextRange(); | |
2721 | + textRange.collapse(true); | |
2722 | + textRange.moveEnd('character', pos); | |
2723 | + textRange.moveStart('character', pos); | |
2724 | + textRange.select(); | |
2725 | + return true; | |
2726 | + } | |
2727 | + if (node.setSelectionRange) { | |
2728 | + node.setSelectionRange(pos, pos); | |
2729 | + return true; | |
2730 | + } | |
2731 | + return false; | |
2732 | + }; | |
2733 | + if(options.mask) { | |
2734 | + input.off('keydown.xdsoft'); | |
2735 | + } | |
2736 | + if (options.mask === true) { | |
2737 | + if (typeof moment != 'undefined') { | |
2738 | + options.mask = options.format | |
2739 | + .replace(/Y{4}/g, '9999') | |
2740 | + .replace(/Y{2}/g, '99') | |
2741 | + .replace(/M{2}/g, '19') | |
2742 | + .replace(/D{2}/g, '39') | |
2743 | + .replace(/H{2}/g, '29') | |
2744 | + .replace(/m{2}/g, '59') | |
2745 | + .replace(/s{2}/g, '59'); | |
2746 | + } else { | |
2747 | + options.mask = options.format | |
2748 | + .replace(/Y/g, '9999') | |
2749 | + .replace(/F/g, '9999') | |
2750 | + .replace(/m/g, '19') | |
2751 | + .replace(/d/g, '39') | |
2752 | + .replace(/H/g, '29') | |
2753 | + .replace(/i/g, '59') | |
2754 | + .replace(/s/g, '59'); | |
2755 | + } | |
2756 | + } | |
2757 | + | |
2758 | + if ($.type(options.mask) === 'string') { | |
2759 | + if (!isValidValue(options.mask, input.val())) { | |
2760 | + input.val(options.mask.replace(/[0-9]/g, '_')); | |
2761 | + setCaretPos(input[0], 0); | |
2762 | + } | |
2763 | + | |
2764 | + input.on('keydown.xdsoft', function (event) { | |
2765 | + var val = this.value, | |
2766 | + key = event.which, | |
2767 | + pos, | |
2768 | + digit; | |
2769 | + | |
2770 | + if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) { | |
2771 | + pos = getCaretPos(this); | |
2772 | + digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_'; | |
2773 | + | |
2774 | + if ((key === BACKSPACE || key === DEL) && pos) { | |
2775 | + pos -= 1; | |
2776 | + digit = '_'; | |
2777 | + } | |
2778 | + | |
2779 | + while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { | |
2780 | + pos += (key === BACKSPACE || key === DEL) ? -1 : 1; | |
2781 | + } | |
2782 | + | |
2783 | + val = val.substr(0, pos) + digit + val.substr(pos + 1); | |
2784 | + if ($.trim(val) === '') { | |
2785 | + val = options.mask.replace(/[0-9]/g, '_'); | |
2786 | + } else { | |
2787 | + if (pos === options.mask.length) { | |
2788 | + event.preventDefault(); | |
2789 | + return false; | |
2790 | + } | |
2791 | + } | |
2792 | + | |
2793 | + pos += (key === BACKSPACE || key === DEL) ? 0 : 1; | |
2794 | + while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) { | |
2795 | + pos += (key === BACKSPACE || key === DEL) ? -1 : 1; | |
2796 | + } | |
2797 | + | |
2798 | + if (isValidValue(options.mask, val)) { | |
2799 | + this.value = val; | |
2800 | + setCaretPos(this, pos); | |
2801 | + } else if ($.trim(val) === '') { | |
2802 | + this.value = options.mask.replace(/[0-9]/g, '_'); | |
2803 | + } else { | |
2804 | + input.trigger('error_input.xdsoft'); | |
2805 | + } | |
2806 | + } else { | |
2807 | + if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) { | |
2808 | + return true; | |
2809 | + } | |
2810 | + } | |
2811 | + | |
2812 | + event.preventDefault(); | |
2813 | + return false; | |
2814 | + }); | |
2815 | + } | |
2816 | + } | |
2817 | + | |
2818 | + _xdsoft_datetime.setCurrentTime(getCurrentValue()); | |
2819 | + | |
2820 | + input | |
2821 | + .data('xdsoft_datetimepicker', datetimepicker) | |
2822 | + .on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function () { | |
2823 | + if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { | |
2824 | + return; | |
2825 | + } | |
2826 | + clearTimeout(timer); | |
2827 | + timer = setTimeout(function () { | |
2828 | + if (input.is(':disabled')) { | |
2829 | + return; | |
2830 | + } | |
2831 | + | |
2832 | + triggerAfterOpen = true; | |
2833 | + _xdsoft_datetime.setCurrentTime(getCurrentValue()); | |
2834 | + if(options.mask) { | |
2835 | + setMask(options); | |
2836 | + } | |
2837 | + datetimepicker.trigger('open.xdsoft'); | |
2838 | + }, 100); | |
2839 | + }) | |
2840 | + .on('keydown.xdsoft', function (event) { | |
2841 | + var elementSelector, | |
2842 | + key = event.which; | |
2843 | + if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) { | |
2844 | + elementSelector = $("input:visible,textarea:visible,button:visible,a:visible"); | |
2845 | + datetimepicker.trigger('close.xdsoft'); | |
2846 | + elementSelector.eq(elementSelector.index(this) + 1).focus(); | |
2847 | + return false; | |
2848 | + } | |
2849 | + if ([TAB].indexOf(key) !== -1) { | |
2850 | + datetimepicker.trigger('close.xdsoft'); | |
2851 | + return true; | |
2852 | + } | |
2853 | + }) | |
2854 | + .on('blur.xdsoft', function () { | |
2855 | + datetimepicker.trigger('close.xdsoft'); | |
2856 | + }); | |
2857 | + }; | |
2858 | + destroyDateTimePicker = function (input) { | |
2859 | + var datetimepicker = input.data('xdsoft_datetimepicker'); | |
2860 | + if (datetimepicker) { | |
2861 | + datetimepicker.data('xdsoft_datetime', null); | |
2862 | + datetimepicker.remove(); | |
2863 | + input | |
2864 | + .data('xdsoft_datetimepicker', null) | |
2865 | + .off('.xdsoft'); | |
2866 | + $(window).off('resize.xdsoft'); | |
2867 | + $([window, document.body]).off('mousedown.xdsoft touchstart'); | |
2868 | + if (input.unmousewheel) { | |
2869 | + input.unmousewheel(); | |
2870 | + } | |
2871 | + } | |
2872 | + }; | |
2873 | + $(document) | |
2874 | + .off('keydown.xdsoftctrl keyup.xdsoftctrl') | |
2875 | + .on('keydown.xdsoftctrl', function (e) { | |
2876 | + if (e.keyCode === CTRLKEY) { | |
2877 | + ctrlDown = true; | |
2878 | + } | |
2879 | + }) | |
2880 | + .on('keyup.xdsoftctrl', function (e) { | |
2881 | + if (e.keyCode === CTRLKEY) { | |
2882 | + ctrlDown = false; | |
2883 | + } | |
2884 | + }); | |
2885 | + | |
2886 | + this.each(function () { | |
2887 | + var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; | |
2888 | + if (datetimepicker) { | |
2889 | + if ($.type(opt) === 'string') { | |
2890 | + switch (opt) { | |
2891 | + case 'show': | |
2892 | + $(this).select().focus(); | |
2893 | + datetimepicker.trigger('open.xdsoft'); | |
2894 | + break; | |
2895 | + case 'hide': | |
2896 | + datetimepicker.trigger('close.xdsoft'); | |
2897 | + break; | |
2898 | + case 'toggle': | |
2899 | + datetimepicker.trigger('toggle.xdsoft'); | |
2900 | + break; | |
2901 | + case 'destroy': | |
2902 | + destroyDateTimePicker($(this)); | |
2903 | + break; | |
2904 | + case 'reset': | |
2905 | + this.value = this.defaultValue; | |
2906 | + if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) { | |
2907 | + datetimepicker.data('changed', false); | |
2908 | + } | |
2909 | + datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); | |
2910 | + break; | |
2911 | + case 'validate': | |
2912 | + $input = datetimepicker.data('input'); | |
2913 | + $input.trigger('blur.xdsoft'); | |
2914 | + break; | |
2915 | + default: | |
2916 | + if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) { | |
2917 | + result = datetimepicker[opt](opt2); | |
2918 | + } | |
2919 | + } | |
2920 | + } else { | |
2921 | + datetimepicker | |
2922 | + .setOptions(opt); | |
2923 | + } | |
2924 | + return 0; | |
2925 | + } | |
2926 | + if ($.type(opt) !== 'string') { | |
2927 | + if (!options.lazyInit || options.open || options.inline) { | |
2928 | + createDateTimePicker($(this)); | |
2929 | + } else { | |
2930 | + lazyInit($(this)); | |
2931 | + } | |
2932 | + } | |
2933 | + }); | |
2934 | + | |
2935 | + return result; | |
2936 | + }; | |
2937 | + | |
2938 | + $.fn.datetimepicker.defaults = default_options; | |
2939 | + | |
2940 | + function HighlightedDate(date, desc, style) { | |
2941 | + "use strict"; | |
2942 | + this.date = date; | |
2943 | + this.desc = desc; | |
2944 | + this.style = style; | |
2945 | + } | |
2946 | +})); | |
2947 | +/*! | |
2948 | + * jQuery Mousewheel 3.1.13 | |
2949 | + * | |
2950 | + * Copyright jQuery Foundation and other contributors | |
2951 | + * Released under the MIT license | |
2952 | + * http://jquery.org/license | |
2953 | + */ | |
2954 | + | |
2955 | +(function (factory) { | |
2956 | + if ( typeof define === 'function' && define.amd ) { | |
2957 | + // AMD. Register as an anonymous module. | |
2958 | + define(['jquery'], factory); | |
2959 | + } else if (typeof exports === 'object') { | |
2960 | + // Node/CommonJS style for Browserify | |
2961 | + module.exports = factory; | |
2962 | + } else { | |
2963 | + // Browser globals | |
2964 | + factory(jQuery); | |
2965 | + } | |
2966 | +}(function ($) { | |
2967 | + | |
2968 | + var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], | |
2969 | + toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? | |
2970 | + ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], | |
2971 | + slice = Array.prototype.slice, | |
2972 | + nullLowestDeltaTimeout, lowestDelta; | |
2973 | + | |
2974 | + if ( $.event.fixHooks ) { | |
2975 | + for ( var i = toFix.length; i; ) { | |
2976 | + $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; | |
2977 | + } | |
2978 | + } | |
2979 | + | |
2980 | + var special = $.event.special.mousewheel = { | |
2981 | + version: '3.1.12', | |
2982 | + | |
2983 | + setup: function() { | |
2984 | + if ( this.addEventListener ) { | |
2985 | + for ( var i = toBind.length; i; ) { | |
2986 | + this.addEventListener( toBind[--i], handler, false ); | |
2987 | + } | |
2988 | + } else { | |
2989 | + this.onmousewheel = handler; | |
2990 | + } | |
2991 | + // Store the line height and page height for this particular element | |
2992 | + $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); | |
2993 | + $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); | |
2994 | + }, | |
2995 | + | |
2996 | + teardown: function() { | |
2997 | + if ( this.removeEventListener ) { | |
2998 | + for ( var i = toBind.length; i; ) { | |
2999 | + this.removeEventListener( toBind[--i], handler, false ); | |
3000 | + } | |
3001 | + } else { | |
3002 | + this.onmousewheel = null; | |
3003 | + } | |
3004 | + // Clean up the data we added to the element | |
3005 | + $.removeData(this, 'mousewheel-line-height'); | |
3006 | + $.removeData(this, 'mousewheel-page-height'); | |
3007 | + }, | |
3008 | + | |
3009 | + getLineHeight: function(elem) { | |
3010 | + var $elem = $(elem), | |
3011 | + $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); | |
3012 | + if (!$parent.length) { | |
3013 | + $parent = $('body'); | |
3014 | + } | |
3015 | + return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; | |
3016 | + }, | |
3017 | + | |
3018 | + getPageHeight: function(elem) { | |
3019 | + return $(elem).height(); | |
3020 | + }, | |
3021 | + | |
3022 | + settings: { | |
3023 | + adjustOldDeltas: true, // see shouldAdjustOldDeltas() below | |
3024 | + normalizeOffset: true // calls getBoundingClientRect for each event | |
3025 | + } | |
3026 | + }; | |
3027 | + | |
3028 | + $.fn.extend({ | |
3029 | + mousewheel: function(fn) { | |
3030 | + return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); | |
3031 | + }, | |
3032 | + | |
3033 | + unmousewheel: function(fn) { | |
3034 | + return this.unbind('mousewheel', fn); | |
3035 | + } | |
3036 | + }); | |
3037 | + | |
3038 | + | |
3039 | + function handler(event) { | |
3040 | + var orgEvent = event || window.event, | |
3041 | + args = slice.call(arguments, 1), | |
3042 | + delta = 0, | |
3043 | + deltaX = 0, | |
3044 | + deltaY = 0, | |
3045 | + absDelta = 0, | |
3046 | + offsetX = 0, | |
3047 | + offsetY = 0; | |
3048 | + event = $.event.fix(orgEvent); | |
3049 | + event.type = 'mousewheel'; | |
3050 | + | |
3051 | + // Old school scrollwheel delta | |
3052 | + if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } | |
3053 | + if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } | |
3054 | + if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } | |
3055 | + if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } | |
3056 | + | |
3057 | + // Firefox < 17 horizontal scrolling related to DOMMouseScroll event | |
3058 | + if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { | |
3059 | + deltaX = deltaY * -1; | |
3060 | + deltaY = 0; | |
3061 | + } | |
3062 | + | |
3063 | + // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy | |
3064 | + delta = deltaY === 0 ? deltaX : deltaY; | |
3065 | + | |
3066 | + // New school wheel delta (wheel event) | |
3067 | + if ( 'deltaY' in orgEvent ) { | |
3068 | + deltaY = orgEvent.deltaY * -1; | |
3069 | + delta = deltaY; | |
3070 | + } | |
3071 | + if ( 'deltaX' in orgEvent ) { | |
3072 | + deltaX = orgEvent.deltaX; | |
3073 | + if ( deltaY === 0 ) { delta = deltaX * -1; } | |
3074 | + } | |
3075 | + | |
3076 | + // No change actually happened, no reason to go any further | |
3077 | + if ( deltaY === 0 && deltaX === 0 ) { return; } | |
3078 | + | |
3079 | + // Need to convert lines and pages to pixels if we aren't already in pixels | |
3080 | + // There are three delta modes: | |
3081 | + // * deltaMode 0 is by pixels, nothing to do | |
3082 | + // * deltaMode 1 is by lines | |
3083 | + // * deltaMode 2 is by pages | |
3084 | + if ( orgEvent.deltaMode === 1 ) { | |
3085 | + var lineHeight = $.data(this, 'mousewheel-line-height'); | |
3086 | + delta *= lineHeight; | |
3087 | + deltaY *= lineHeight; | |
3088 | + deltaX *= lineHeight; | |
3089 | + } else if ( orgEvent.deltaMode === 2 ) { | |
3090 | + var pageHeight = $.data(this, 'mousewheel-page-height'); | |
3091 | + delta *= pageHeight; | |
3092 | + deltaY *= pageHeight; | |
3093 | + deltaX *= pageHeight; | |
3094 | + } | |
3095 | + | |
3096 | + // Store lowest absolute delta to normalize the delta values | |
3097 | + absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); | |
3098 | + | |
3099 | + if ( !lowestDelta || absDelta < lowestDelta ) { | |
3100 | + lowestDelta = absDelta; | |
3101 | + | |
3102 | + // Adjust older deltas if necessary | |
3103 | + if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { | |
3104 | + lowestDelta /= 40; | |
3105 | + } | |
3106 | + } | |
3107 | + | |
3108 | + // Adjust older deltas if necessary | |
3109 | + if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { | |
3110 | + // Divide all the things by 40! | |
3111 | + delta /= 40; | |
3112 | + deltaX /= 40; | |
3113 | + deltaY /= 40; | |
3114 | + } | |
3115 | + | |
3116 | + // Get a whole, normalized value for the deltas | |
3117 | + delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); | |
3118 | + deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); | |
3119 | + deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); | |
3120 | + | |
3121 | + // Normalise offsetX and offsetY properties | |
3122 | + if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { | |
3123 | + var boundingRect = this.getBoundingClientRect(); | |
3124 | + offsetX = event.clientX - boundingRect.left; | |
3125 | + offsetY = event.clientY - boundingRect.top; | |
3126 | + } | |
3127 | + | |
3128 | + // Add information to the event object | |
3129 | + event.deltaX = deltaX; | |
3130 | + event.deltaY = deltaY; | |
3131 | + event.deltaFactor = lowestDelta; | |
3132 | + event.offsetX = offsetX; | |
3133 | + event.offsetY = offsetY; | |
3134 | + // Go ahead and set deltaMode to 0 since we converted to pixels | |
3135 | + // Although this is a little odd since we overwrite the deltaX/Y | |
3136 | + // properties with normalized deltas. | |
3137 | + event.deltaMode = 0; | |
3138 | + | |
3139 | + // Add event and delta to the front of the arguments | |
3140 | + args.unshift(event, delta, deltaX, deltaY); | |
3141 | + | |
3142 | + // Clearout lowestDelta after sometime to better | |
3143 | + // handle multiple device types that give different | |
3144 | + // a different lowestDelta | |
3145 | + // Ex: trackpad = 3 and mouse wheel = 120 | |
3146 | + if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } | |
3147 | + nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); | |
3148 | + | |
3149 | + return ($.event.dispatch || $.event.handle).apply(this, args); | |
3150 | + } | |
3151 | + | |
3152 | + function nullLowestDelta() { | |
3153 | + lowestDelta = null; | |
3154 | + } | |
3155 | + | |
3156 | + function shouldAdjustOldDeltas(orgEvent, absDelta) { | |
3157 | + // If this is an older event and the delta is divisable by 120, | |
3158 | + // then we are assuming that the browser is treating this as an | |
3159 | + // older mouse wheel event and that we should divide the deltas | |
3160 | + // by 40 to try and get a more usable deltaFactor. | |
3161 | + // Side note, this actually impacts the reported scroll distance | |
3162 | + // in older browsers and can cause scrolling to be slower than native. | |
3163 | + // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. | |
3164 | + return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; | |
3165 | + } | |
3166 | + | |
3167 | +})); | ... | ... |
src/com/fh/controller/sunvote/school/SchoolController.java
... | ... | @@ -98,6 +98,7 @@ public class SchoolController extends BaseController { |
98 | 98 | return mv; |
99 | 99 | } |
100 | 100 | |
101 | + | |
101 | 102 | /**列表 |
102 | 103 | * @param page |
103 | 104 | * @throws Exception |
... | ... | @@ -121,6 +122,53 @@ public class SchoolController extends BaseController { |
121 | 122 | mv.addObject("QX",Jurisdiction.getHC()); //按钮权限 |
122 | 123 | return mv; |
123 | 124 | } |
125 | + /**列表 | |
126 | + * @param page | |
127 | + * @throws Exception | |
128 | + */ | |
129 | + @RequestMapping(value="/listcs") | |
130 | + public ModelAndView listcs(Page page) throws Exception{ | |
131 | + logBefore(logger, Jurisdiction.getUsername()+"列表学校"); | |
132 | + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码) | |
133 | + ModelAndView mv = this.getModelAndView(); | |
134 | + PageData pd = new PageData(); | |
135 | + pd = this.getPageData(); | |
136 | + String keywords = pd.getString("keywords"); //关键词检索条件 | |
137 | + if(null != keywords && !"".equals(keywords)){ | |
138 | + pd.put("keywords", keywords.trim()); | |
139 | + } | |
140 | + page.setPd(pd); | |
141 | + List<PageData> varList = schoolService.list(page); //列出School列表 | |
142 | + mv.setViewName("sunvote/school/school_list2"); | |
143 | + mv.addObject("varList", varList); | |
144 | + mv.addObject("pd", pd); | |
145 | + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限 | |
146 | + return mv; | |
147 | + } | |
148 | + | |
149 | + /**列表 | |
150 | + * @param page | |
151 | + * @throws Exception | |
152 | + */ | |
153 | + @RequestMapping(value="/other") | |
154 | + public ModelAndView other(Page page) throws Exception{ | |
155 | + logBefore(logger, Jurisdiction.getUsername()+"列表学校"); | |
156 | + //if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码) | |
157 | + ModelAndView mv = this.getModelAndView(); | |
158 | + PageData pd = new PageData(); | |
159 | + pd = this.getPageData(); | |
160 | + String keywords = pd.getString("keywords"); //关键词检索条件 | |
161 | + if(null != keywords && !"".equals(keywords)){ | |
162 | + pd.put("keywords", keywords.trim()); | |
163 | + } | |
164 | + page.setPd(pd); | |
165 | + List<PageData> varList = schoolService.list(page); //列出School列表 | |
166 | + mv.setViewName("sunvote/school/other_edit"); | |
167 | + mv.addObject("varList", varList); | |
168 | + mv.addObject("pd", pd); | |
169 | + mv.addObject("QX",Jurisdiction.getHC()); //按钮权限 | |
170 | + return mv; | |
171 | + } | |
124 | 172 | |
125 | 173 | /**去新增页面 |
126 | 174 | * @param |
... | ... | @@ -152,6 +200,21 @@ public class SchoolController extends BaseController { |
152 | 200 | mv.addObject("pd", pd); |
153 | 201 | return mv; |
154 | 202 | } |
203 | + /**去修改页面 | |
204 | + * @param | |
205 | + * @throws Exception | |
206 | + */ | |
207 | + @RequestMapping(value="/goEdit2") | |
208 | + public ModelAndView goEdit2()throws Exception{ | |
209 | + ModelAndView mv = this.getModelAndView(); | |
210 | + PageData pd = new PageData(); | |
211 | + pd = this.getPageData(); | |
212 | + pd = schoolService.findById(pd); //根据ID读取 | |
213 | + mv.setViewName("sunvote/school/school_edit2"); | |
214 | + mv.addObject("msg", "edit"); | |
215 | + mv.addObject("pd", pd); | |
216 | + return mv; | |
217 | + } | |
155 | 218 | |
156 | 219 | /**批量删除 |
157 | 220 | * @param | ... | ... |