@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<div class="r-form-item">
|
||||
<label class="r-form-item__label">数据日期</label>
|
||||
<div class="r-form-item__content">
|
||||
<div class="r-input-frequency-date-group">
|
||||
<div class="r-frequency-type">
|
||||
<select class="r-select__inner" name="frequency" id="frequency"></select>
|
||||
</div>
|
||||
<input type="text" class="r-input__inner r-frequency-date" readonly id="reportdate" name="reportdate" autocomplete="off" />
|
||||
<div class="r-frequency-suffix" style="display: none">
|
||||
<select class="r-select__inner" name="range" id="range"></select>
|
||||
</div>
|
||||
<p id="tipsSelectedDate" style="display: none" class="tips"></p>
|
||||
<input type="hidden" name="paramDate" id="paramDate" value="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="tsx">
|
||||
// import { onMounted } from "vue";
|
||||
// import "@/views/DataCheck/static/utils/frequency-date-no-line.js";
|
||||
// import '@/views/DataCheck/static/common/bootstrap-datapicker/dayjs.min.js';
|
||||
// import '@/views/DataCheck/static/utils/spreadsheetProxy.js';
|
||||
// import '@/views/DataCheck/static/utils/dateUtils.js?v=20230420'
|
||||
// import { initFrequency } from "@/views/DataCheck/static/utils/frequency-date-no-line.js";
|
||||
// onMounted(() => {
|
||||
// initFrequency();
|
||||
// })
|
||||
</script>
|
||||
|
||||
<!-- <style scoped src="../../views/DataCheck/static/platform/css/report.base.min.css"></style>
|
||||
<style scoped src="../../views/DataCheck/static/platform/css/report.library.min.css"></style>
|
||||
<style scoped src="../../views/DataCheck/static/platform/css/report.style.min.css"></style>
|
||||
<style scoped src="../../views/DataCheck/static/platform/css/report.theme.min.css"></style> -->
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@ -0,0 +1,380 @@
|
||||
/*!
|
||||
* Datepicker for Bootstrap
|
||||
*
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Improvements by Andrew Rowls
|
||||
* Licensed under the Apache License v2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*/
|
||||
|
||||
.datepicker {
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
direction: ltr;
|
||||
/*.dow {
|
||||
border-top: 1px solid #ddd !important;
|
||||
}*/
|
||||
}
|
||||
|
||||
.datepicker-inline {
|
||||
width: 220px;
|
||||
}
|
||||
|
||||
.datepicker.datepicker-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.datepicker.datepicker-rtl table tr td span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.datepicker-dropdown {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.datepicker-dropdown:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-top: 0;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.datepicker-dropdown:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #fff;
|
||||
border-top: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-left:before {
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-left:after {
|
||||
left: 7px;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-right:before {
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-right:after {
|
||||
right: 7px;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-top:before {
|
||||
top: -7px;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-top:after {
|
||||
top: -6px;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-bottom:before {
|
||||
bottom: -7px;
|
||||
border-bottom: 0;
|
||||
border-top: 7px solid #999;
|
||||
}
|
||||
|
||||
.datepicker-dropdown.datepicker-orient-bottom:after {
|
||||
bottom: -6px;
|
||||
border-bottom: 0;
|
||||
border-top: 6px solid #fff;
|
||||
}
|
||||
|
||||
.datepicker>div {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.datepicker.days div.datepicker-days {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datepicker.months div.datepicker-months {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datepicker.years div.datepicker-years {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.datepicker table {
|
||||
margin: 0;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.datepicker table tr td, .datepicker table tr th {
|
||||
text-align: center;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.table-striped .datepicker table tr td, .table-striped .datepicker table tr th {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.datepicker table tr td.day:hover, .datepicker table tr td.day.focused {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.datepicker table tr td.old, .datepicker table tr td.new {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.datepicker table tr td.disabled, .datepicker table tr td.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today, .datepicker table tr td.today:hover, .datepicker table tr td.today.disabled, .datepicker table tr td.today.disabled:hover {
|
||||
color: #000000;
|
||||
background-color: #ffdb99;
|
||||
border-color: #ffb733;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today:hover, .datepicker table tr td.today:hover:hover, .datepicker table tr td.today.disabled:hover, .datepicker table tr td.today.disabled:hover:hover, .datepicker table tr td.today:focus, .datepicker table tr td.today:hover:focus, .datepicker table tr td.today.disabled:focus, .datepicker table tr td.today.disabled:hover:focus, .datepicker table tr td.today:active, .datepicker table tr td.today:hover:active, .datepicker table tr td.today.disabled:active, .datepicker table tr td.today.disabled:hover:active, .datepicker table tr td.today.active, .datepicker table tr td.today:hover.active, .datepicker table tr td.today.disabled.active, .datepicker table tr td.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.today, .open .dropdown-toggle.datepicker table tr td.today:hover, .open .dropdown-toggle.datepicker table tr td.today.disabled, .open .dropdown-toggle.datepicker table tr td.today.disabled:hover {
|
||||
color: #000000;
|
||||
background-color: #ffcd70;
|
||||
border-color: #f59e00;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today:active, .datepicker table tr td.today:hover:active, .datepicker table tr td.today.disabled:active, .datepicker table tr td.today.disabled:hover:active, .datepicker table tr td.today.active, .datepicker table tr td.today:hover.active, .datepicker table tr td.today.disabled.active, .datepicker table tr td.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.today, .open .dropdown-toggle.datepicker table tr td.today:hover, .open .dropdown-toggle.datepicker table tr td.today.disabled, .open .dropdown-toggle.datepicker table tr td.today.disabled:hover {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today.disabled, .datepicker table tr td.today:hover.disabled, .datepicker table tr td.today.disabled.disabled, .datepicker table tr td.today.disabled:hover.disabled, .datepicker table tr td.today[disabled], .datepicker table tr td.today:hover[disabled], .datepicker table tr td.today.disabled[disabled], .datepicker table tr td.today.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.today, fieldset[disabled] .datepicker table tr td.today:hover, fieldset[disabled] .datepicker table tr td.today.disabled, fieldset[disabled] .datepicker table tr td.today.disabled:hover, .datepicker table tr td.today.disabled:hover, .datepicker table tr td.today:hover.disabled:hover, .datepicker table tr td.today.disabled.disabled:hover, .datepicker table tr td.today.disabled:hover.disabled:hover, .datepicker table tr td.today[disabled]:hover, .datepicker table tr td.today:hover[disabled]:hover, .datepicker table tr td.today.disabled[disabled]:hover, .datepicker table tr td.today.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.today:hover, fieldset[disabled] .datepicker table tr td.today:hover:hover, fieldset[disabled] .datepicker table tr td.today.disabled:hover, fieldset[disabled] .datepicker table tr td.today.disabled:hover:hover, .datepicker table tr td.today.disabled:focus, .datepicker table tr td.today:hover.disabled:focus, .datepicker table tr td.today.disabled.disabled:focus, .datepicker table tr td.today.disabled:hover.disabled:focus, .datepicker table tr td.today[disabled]:focus, .datepicker table tr td.today:hover[disabled]:focus, .datepicker table tr td.today.disabled[disabled]:focus, .datepicker table tr td.today.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.today:focus, fieldset[disabled] .datepicker table tr td.today:hover:focus, fieldset[disabled] .datepicker table tr td.today.disabled:focus, fieldset[disabled] .datepicker table tr td.today.disabled:hover:focus, .datepicker table tr td.today.disabled:active, .datepicker table tr td.today:hover.disabled:active, .datepicker table tr td.today.disabled.disabled:active, .datepicker table tr td.today.disabled:hover.disabled:active, .datepicker table tr td.today[disabled]:active, .datepicker table tr td.today:hover[disabled]:active, .datepicker table tr td.today.disabled[disabled]:active, .datepicker table tr td.today.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.today:active, fieldset[disabled] .datepicker table tr td.today:hover:active, fieldset[disabled] .datepicker table tr td.today.disabled:active, fieldset[disabled] .datepicker table tr td.today.disabled:hover:active, .datepicker table tr td.today.disabled.active, .datepicker table tr td.today:hover.disabled.active, .datepicker table tr td.today.disabled.disabled.active, .datepicker table tr td.today.disabled:hover.disabled.active, .datepicker table tr td.today[disabled].active, .datepicker table tr td.today:hover[disabled].active, .datepicker table tr td.today.disabled[disabled].active, .datepicker table tr td.today.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.today.active, fieldset[disabled] .datepicker table tr td.today:hover.active, fieldset[disabled] .datepicker table tr td.today.disabled.active, fieldset[disabled] .datepicker table tr td.today.disabled:hover.active {
|
||||
background-color: #ffdb99;
|
||||
border-color: #ffb733;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today:hover:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.datepicker table tr td.today.active:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range, .datepicker table tr td.range:hover, .datepicker table tr td.range.disabled, .datepicker table tr td.range.disabled:hover {
|
||||
background: #eeeeee;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today, .datepicker table tr td.range.today:hover, .datepicker table tr td.range.today.disabled, .datepicker table tr td.range.today.disabled:hover {
|
||||
color: #000000;
|
||||
background-color: #f7ca77;
|
||||
border-color: #f1a417;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today:hover, .datepicker table tr td.range.today:hover:hover, .datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today.disabled:hover:hover, .datepicker table tr td.range.today:focus, .datepicker table tr td.range.today:hover:focus, .datepicker table tr td.range.today.disabled:focus, .datepicker table tr td.range.today.disabled:hover:focus, .datepicker table tr td.range.today:active, .datepicker table tr td.range.today:hover:active, .datepicker table tr td.range.today.disabled:active, .datepicker table tr td.range.today.disabled:hover:active, .datepicker table tr td.range.today.active, .datepicker table tr td.range.today:hover.active, .datepicker table tr td.range.today.disabled.active, .datepicker table tr td.range.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.range.today, .open .dropdown-toggle.datepicker table tr td.range.today:hover, .open .dropdown-toggle.datepicker table tr td.range.today.disabled, .open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover {
|
||||
color: #000000;
|
||||
background-color: #f4bb51;
|
||||
border-color: #bf800c;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today:active, .datepicker table tr td.range.today:hover:active, .datepicker table tr td.range.today.disabled:active, .datepicker table tr td.range.today.disabled:hover:active, .datepicker table tr td.range.today.active, .datepicker table tr td.range.today:hover.active, .datepicker table tr td.range.today.disabled.active, .datepicker table tr td.range.today.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.range.today, .open .dropdown-toggle.datepicker table tr td.range.today:hover, .open .dropdown-toggle.datepicker table tr td.range.today.disabled, .open .dropdown-toggle.datepicker table tr td.range.today.disabled:hover {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.datepicker table tr td.range.today.disabled, .datepicker table tr td.range.today:hover.disabled, .datepicker table tr td.range.today.disabled.disabled, .datepicker table tr td.range.today.disabled:hover.disabled, .datepicker table tr td.range.today[disabled], .datepicker table tr td.range.today:hover[disabled], .datepicker table tr td.range.today.disabled[disabled], .datepicker table tr td.range.today.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.range.today, fieldset[disabled] .datepicker table tr td.range.today:hover, fieldset[disabled] .datepicker table tr td.range.today.disabled, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today.disabled:hover, .datepicker table tr td.range.today:hover.disabled:hover, .datepicker table tr td.range.today.disabled.disabled:hover, .datepicker table tr td.range.today.disabled:hover.disabled:hover, .datepicker table tr td.range.today[disabled]:hover, .datepicker table tr td.range.today:hover[disabled]:hover, .datepicker table tr td.range.today.disabled[disabled]:hover, .datepicker table tr td.range.today.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.range.today:hover, fieldset[disabled] .datepicker table tr td.range.today:hover:hover, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:hover, .datepicker table tr td.range.today.disabled:focus, .datepicker table tr td.range.today:hover.disabled:focus, .datepicker table tr td.range.today.disabled.disabled:focus, .datepicker table tr td.range.today.disabled:hover.disabled:focus, .datepicker table tr td.range.today[disabled]:focus, .datepicker table tr td.range.today:hover[disabled]:focus, .datepicker table tr td.range.today.disabled[disabled]:focus, .datepicker table tr td.range.today.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.range.today:focus, fieldset[disabled] .datepicker table tr td.range.today:hover:focus, fieldset[disabled] .datepicker table tr td.range.today.disabled:focus, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:focus, .datepicker table tr td.range.today.disabled:active, .datepicker table tr td.range.today:hover.disabled:active, .datepicker table tr td.range.today.disabled.disabled:active, .datepicker table tr td.range.today.disabled:hover.disabled:active, .datepicker table tr td.range.today[disabled]:active, .datepicker table tr td.range.today:hover[disabled]:active, .datepicker table tr td.range.today.disabled[disabled]:active, .datepicker table tr td.range.today.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.range.today:active, fieldset[disabled] .datepicker table tr td.range.today:hover:active, fieldset[disabled] .datepicker table tr td.range.today.disabled:active, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover:active, .datepicker table tr td.range.today.disabled.active, .datepicker table tr td.range.today:hover.disabled.active, .datepicker table tr td.range.today.disabled.disabled.active, .datepicker table tr td.range.today.disabled:hover.disabled.active, .datepicker table tr td.range.today[disabled].active, .datepicker table tr td.range.today:hover[disabled].active, .datepicker table tr td.range.today.disabled[disabled].active, .datepicker table tr td.range.today.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.range.today.active, fieldset[disabled] .datepicker table tr td.range.today:hover.active, fieldset[disabled] .datepicker table tr td.range.today.disabled.active, fieldset[disabled] .datepicker table tr td.range.today.disabled:hover.active {
|
||||
background-color: #f7ca77;
|
||||
border-color: #f1a417;
|
||||
}
|
||||
|
||||
.datepicker table tr td.selected, .datepicker table tr td.selected:hover, .datepicker table tr td.selected.disabled, .datepicker table tr td.selected.disabled:hover {
|
||||
color: #ffffff;
|
||||
background-color: #999999;
|
||||
border-color: #555555;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.datepicker table tr td.selected:hover, .datepicker table tr td.selected:hover:hover, .datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected.disabled:hover:hover, .datepicker table tr td.selected:focus, .datepicker table tr td.selected:hover:focus, .datepicker table tr td.selected.disabled:focus, .datepicker table tr td.selected.disabled:hover:focus, .datepicker table tr td.selected:active, .datepicker table tr td.selected:hover:active, .datepicker table tr td.selected.disabled:active, .datepicker table tr td.selected.disabled:hover:active, .datepicker table tr td.selected.active, .datepicker table tr td.selected:hover.active, .datepicker table tr td.selected.disabled.active, .datepicker table tr td.selected.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.selected, .open .dropdown-toggle.datepicker table tr td.selected:hover, .open .dropdown-toggle.datepicker table tr td.selected.disabled, .open .dropdown-toggle.datepicker table tr td.selected.disabled:hover {
|
||||
color: #ffffff;
|
||||
background-color: #858585;
|
||||
border-color: #373737;
|
||||
}
|
||||
|
||||
.datepicker table tr td.selected:active, .datepicker table tr td.selected:hover:active, .datepicker table tr td.selected.disabled:active, .datepicker table tr td.selected.disabled:hover:active, .datepicker table tr td.selected.active, .datepicker table tr td.selected:hover.active, .datepicker table tr td.selected.disabled.active, .datepicker table tr td.selected.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.selected, .open .dropdown-toggle.datepicker table tr td.selected:hover, .open .dropdown-toggle.datepicker table tr td.selected.disabled, .open .dropdown-toggle.datepicker table tr td.selected.disabled:hover {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.datepicker table tr td.selected.disabled, .datepicker table tr td.selected:hover.disabled, .datepicker table tr td.selected.disabled.disabled, .datepicker table tr td.selected.disabled:hover.disabled, .datepicker table tr td.selected[disabled], .datepicker table tr td.selected:hover[disabled], .datepicker table tr td.selected.disabled[disabled], .datepicker table tr td.selected.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.selected, fieldset[disabled] .datepicker table tr td.selected:hover, fieldset[disabled] .datepicker table tr td.selected.disabled, fieldset[disabled] .datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected.disabled:hover, .datepicker table tr td.selected:hover.disabled:hover, .datepicker table tr td.selected.disabled.disabled:hover, .datepicker table tr td.selected.disabled:hover.disabled:hover, .datepicker table tr td.selected[disabled]:hover, .datepicker table tr td.selected:hover[disabled]:hover, .datepicker table tr td.selected.disabled[disabled]:hover, .datepicker table tr td.selected.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.selected:hover, fieldset[disabled] .datepicker table tr td.selected:hover:hover, fieldset[disabled] .datepicker table tr td.selected.disabled:hover, fieldset[disabled] .datepicker table tr td.selected.disabled:hover:hover, .datepicker table tr td.selected.disabled:focus, .datepicker table tr td.selected:hover.disabled:focus, .datepicker table tr td.selected.disabled.disabled:focus, .datepicker table tr td.selected.disabled:hover.disabled:focus, .datepicker table tr td.selected[disabled]:focus, .datepicker table tr td.selected:hover[disabled]:focus, .datepicker table tr td.selected.disabled[disabled]:focus, .datepicker table tr td.selected.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.selected:focus, fieldset[disabled] .datepicker table tr td.selected:hover:focus, fieldset[disabled] .datepicker table tr td.selected.disabled:focus, fieldset[disabled] .datepicker table tr td.selected.disabled:hover:focus, .datepicker table tr td.selected.disabled:active, .datepicker table tr td.selected:hover.disabled:active, .datepicker table tr td.selected.disabled.disabled:active, .datepicker table tr td.selected.disabled:hover.disabled:active, .datepicker table tr td.selected[disabled]:active, .datepicker table tr td.selected:hover[disabled]:active, .datepicker table tr td.selected.disabled[disabled]:active, .datepicker table tr td.selected.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.selected:active, fieldset[disabled] .datepicker table tr td.selected:hover:active, fieldset[disabled] .datepicker table tr td.selected.disabled:active, fieldset[disabled] .datepicker table tr td.selected.disabled:hover:active, .datepicker table tr td.selected.disabled.active, .datepicker table tr td.selected:hover.disabled.active, .datepicker table tr td.selected.disabled.disabled.active, .datepicker table tr td.selected.disabled:hover.disabled.active, .datepicker table tr td.selected[disabled].active, .datepicker table tr td.selected:hover[disabled].active, .datepicker table tr td.selected.disabled[disabled].active, .datepicker table tr td.selected.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.selected.active, fieldset[disabled] .datepicker table tr td.selected:hover.active, fieldset[disabled] .datepicker table tr td.selected.disabled.active, fieldset[disabled] .datepicker table tr td.selected.disabled:hover.active {
|
||||
background-color: #999999;
|
||||
border-color: #555555;
|
||||
}
|
||||
|
||||
.datepicker table tr td.active, .datepicker table tr td.active:hover, .datepicker table tr td.active.disabled, .datepicker table tr td.active.disabled:hover {
|
||||
color: #ffffff;
|
||||
background-color: #428bca;
|
||||
border-color: #357ebd;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.datepicker table tr td.active:hover, .datepicker table tr td.active:hover:hover, .datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:hover:hover, .datepicker table tr td.active:focus, .datepicker table tr td.active:hover:focus, .datepicker table tr td.active.disabled:focus, .datepicker table tr td.active.disabled:hover:focus, .datepicker table tr td.active:active, .datepicker table tr td.active:hover:active, .datepicker table tr td.active.disabled:active, .datepicker table tr td.active.disabled:hover:active, .datepicker table tr td.active.active, .datepicker table tr td.active:hover.active, .datepicker table tr td.active.disabled.active, .datepicker table tr td.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.active, .open .dropdown-toggle.datepicker table tr td.active:hover, .open .dropdown-toggle.datepicker table tr td.active.disabled, .open .dropdown-toggle.datepicker table tr td.active.disabled:hover {
|
||||
color: #ffffff;
|
||||
background-color: #3276b1;
|
||||
border-color: #285e8e;
|
||||
}
|
||||
|
||||
.datepicker table tr td.active:active, .datepicker table tr td.active:hover:active, .datepicker table tr td.active.disabled:active, .datepicker table tr td.active.disabled:hover:active, .datepicker table tr td.active.active, .datepicker table tr td.active:hover.active, .datepicker table tr td.active.disabled.active, .datepicker table tr td.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td.active, .open .dropdown-toggle.datepicker table tr td.active:hover, .open .dropdown-toggle.datepicker table tr td.active.disabled, .open .dropdown-toggle.datepicker table tr td.active.disabled:hover {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.datepicker table tr td.active.disabled, .datepicker table tr td.active:hover.disabled, .datepicker table tr td.active.disabled.disabled, .datepicker table tr td.active.disabled:hover.disabled, .datepicker table tr td.active[disabled], .datepicker table tr td.active:hover[disabled], .datepicker table tr td.active.disabled[disabled], .datepicker table tr td.active.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td.active, fieldset[disabled] .datepicker table tr td.active:hover, fieldset[disabled] .datepicker table tr td.active.disabled, fieldset[disabled] .datepicker table tr td.active.disabled:hover, .datepicker table tr td.active.disabled:hover, .datepicker table tr td.active:hover.disabled:hover, .datepicker table tr td.active.disabled.disabled:hover, .datepicker table tr td.active.disabled:hover.disabled:hover, .datepicker table tr td.active[disabled]:hover, .datepicker table tr td.active:hover[disabled]:hover, .datepicker table tr td.active.disabled[disabled]:hover, .datepicker table tr td.active.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td.active:hover, fieldset[disabled] .datepicker table tr td.active:hover:hover, fieldset[disabled] .datepicker table tr td.active.disabled:hover, fieldset[disabled] .datepicker table tr td.active.disabled:hover:hover, .datepicker table tr td.active.disabled:focus, .datepicker table tr td.active:hover.disabled:focus, .datepicker table tr td.active.disabled.disabled:focus, .datepicker table tr td.active.disabled:hover.disabled:focus, .datepicker table tr td.active[disabled]:focus, .datepicker table tr td.active:hover[disabled]:focus, .datepicker table tr td.active.disabled[disabled]:focus, .datepicker table tr td.active.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td.active:focus, fieldset[disabled] .datepicker table tr td.active:hover:focus, fieldset[disabled] .datepicker table tr td.active.disabled:focus, fieldset[disabled] .datepicker table tr td.active.disabled:hover:focus, .datepicker table tr td.active.disabled:active, .datepicker table tr td.active:hover.disabled:active, .datepicker table tr td.active.disabled.disabled:active, .datepicker table tr td.active.disabled:hover.disabled:active, .datepicker table tr td.active[disabled]:active, .datepicker table tr td.active:hover[disabled]:active, .datepicker table tr td.active.disabled[disabled]:active, .datepicker table tr td.active.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td.active:active, fieldset[disabled] .datepicker table tr td.active:hover:active, fieldset[disabled] .datepicker table tr td.active.disabled:active, fieldset[disabled] .datepicker table tr td.active.disabled:hover:active, .datepicker table tr td.active.disabled.active, .datepicker table tr td.active:hover.disabled.active, .datepicker table tr td.active.disabled.disabled.active, .datepicker table tr td.active.disabled:hover.disabled.active, .datepicker table tr td.active[disabled].active, .datepicker table tr td.active:hover[disabled].active, .datepicker table tr td.active.disabled[disabled].active, .datepicker table tr td.active.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td.active.active, fieldset[disabled] .datepicker table tr td.active:hover.active, fieldset[disabled] .datepicker table tr td.active.disabled.active, fieldset[disabled] .datepicker table tr td.active.disabled:hover.active {
|
||||
background-color: #428bca;
|
||||
border-color: #357ebd;
|
||||
}
|
||||
|
||||
.datepicker table tr td span {
|
||||
display: block;
|
||||
width: 23%;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
float: left;
|
||||
margin: 1%;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.datepicker table tr td span:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.disabled, .datepicker table tr td span.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active, .datepicker table tr td span.active:hover, .datepicker table tr td span.active.disabled, .datepicker table tr td span.active.disabled:hover {
|
||||
color: #ffffff;
|
||||
background-color: #428bca;
|
||||
border-color: #357ebd;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active:hover, .datepicker table tr td span.active:hover:hover, .datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:hover:hover, .datepicker table tr td span.active:focus, .datepicker table tr td span.active:hover:focus, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active:active, .datepicker table tr td span.active:hover:active, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.active, .datepicker table tr td span.active:hover.active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td span.active, .open .dropdown-toggle.datepicker table tr td span.active:hover, .open .dropdown-toggle.datepicker table tr td span.active.disabled, .open .dropdown-toggle.datepicker table tr td span.active.disabled:hover {
|
||||
color: #ffffff;
|
||||
background-color: #3276b1;
|
||||
border-color: #285e8e;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active:active, .datepicker table tr td span.active:hover:active, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.active, .datepicker table tr td span.active:hover.active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active.disabled:hover.active, .open .dropdown-toggle.datepicker table tr td span.active, .open .dropdown-toggle.datepicker table tr td span.active:hover, .open .dropdown-toggle.datepicker table tr td span.active.disabled, .open .dropdown-toggle.datepicker table tr td span.active.disabled:hover {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.active.disabled, .datepicker table tr td span.active:hover.disabled, .datepicker table tr td span.active.disabled.disabled, .datepicker table tr td span.active.disabled:hover.disabled, .datepicker table tr td span.active[disabled], .datepicker table tr td span.active:hover[disabled], .datepicker table tr td span.active.disabled[disabled], .datepicker table tr td span.active.disabled:hover[disabled], fieldset[disabled] .datepicker table tr td span.active, fieldset[disabled] .datepicker table tr td span.active:hover, fieldset[disabled] .datepicker table tr td span.active.disabled, fieldset[disabled] .datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active.disabled:hover, .datepicker table tr td span.active:hover.disabled:hover, .datepicker table tr td span.active.disabled.disabled:hover, .datepicker table tr td span.active.disabled:hover.disabled:hover, .datepicker table tr td span.active[disabled]:hover, .datepicker table tr td span.active:hover[disabled]:hover, .datepicker table tr td span.active.disabled[disabled]:hover, .datepicker table tr td span.active.disabled:hover[disabled]:hover, fieldset[disabled] .datepicker table tr td span.active:hover, fieldset[disabled] .datepicker table tr td span.active:hover:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:hover, .datepicker table tr td span.active.disabled:focus, .datepicker table tr td span.active:hover.disabled:focus, .datepicker table tr td span.active.disabled.disabled:focus, .datepicker table tr td span.active.disabled:hover.disabled:focus, .datepicker table tr td span.active[disabled]:focus, .datepicker table tr td span.active:hover[disabled]:focus, .datepicker table tr td span.active.disabled[disabled]:focus, .datepicker table tr td span.active.disabled:hover[disabled]:focus, fieldset[disabled] .datepicker table tr td span.active:focus, fieldset[disabled] .datepicker table tr td span.active:hover:focus, fieldset[disabled] .datepicker table tr td span.active.disabled:focus, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:focus, .datepicker table tr td span.active.disabled:active, .datepicker table tr td span.active:hover.disabled:active, .datepicker table tr td span.active.disabled.disabled:active, .datepicker table tr td span.active.disabled:hover.disabled:active, .datepicker table tr td span.active[disabled]:active, .datepicker table tr td span.active:hover[disabled]:active, .datepicker table tr td span.active.disabled[disabled]:active, .datepicker table tr td span.active.disabled:hover[disabled]:active, fieldset[disabled] .datepicker table tr td span.active:active, fieldset[disabled] .datepicker table tr td span.active:hover:active, fieldset[disabled] .datepicker table tr td span.active.disabled:active, fieldset[disabled] .datepicker table tr td span.active.disabled:hover:active, .datepicker table tr td span.active.disabled.active, .datepicker table tr td span.active:hover.disabled.active, .datepicker table tr td span.active.disabled.disabled.active, .datepicker table tr td span.active.disabled:hover.disabled.active, .datepicker table tr td span.active[disabled].active, .datepicker table tr td span.active:hover[disabled].active, .datepicker table tr td span.active.disabled[disabled].active, .datepicker table tr td span.active.disabled:hover[disabled].active, fieldset[disabled] .datepicker table tr td span.active.active, fieldset[disabled] .datepicker table tr td span.active:hover.active, fieldset[disabled] .datepicker table tr td span.active.disabled.active, fieldset[disabled] .datepicker table tr td span.active.disabled:hover.active {
|
||||
background-color: #428bca;
|
||||
border-color: #357ebd;
|
||||
}
|
||||
|
||||
.datepicker table tr td span.old, .datepicker table tr td span.new {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.datepicker th.datepicker-switch {
|
||||
width: 145px;
|
||||
}
|
||||
|
||||
.datepicker thead tr:first-child th, .datepicker tfoot tr th {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.datepicker thead tr:first-child th:hover, .datepicker tfoot tr th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
|
||||
.datepicker .cw {
|
||||
font-size: 10px;
|
||||
width: 12px;
|
||||
padding: 0 2px 0 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.datepicker thead tr:first-child th.cw {
|
||||
cursor: default;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.input-group.date .input-group-addon i {
|
||||
cursor: pointer;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.input-daterange input {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.input-daterange input:first-child {
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
|
||||
.input-daterange input:last-child {
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
|
||||
.input-daterange .input-group-addon {
|
||||
width: auto;
|
||||
min-width: 16px;
|
||||
padding: 4px 5px;
|
||||
font-weight: normal;
|
||||
line-height: 1.428571429;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
vertical-align: middle;
|
||||
background-color: #eeeeee;
|
||||
border-width: 1px 0;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
||||
|
||||
.datepicker.dropdown-menu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
float: left;
|
||||
display: none;
|
||||
min-width: 160px;
|
||||
list-style: none;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||
border-radius: 5px;
|
||||
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
||||
-webkit-background-clip: padding-box;
|
||||
-moz-background-clip: padding;
|
||||
background-clip: padding-box;
|
||||
*border-right-width: 2px;
|
||||
*border-bottom-width: 2px;
|
||||
color: #333333;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 1.428571429;
|
||||
}
|
||||
|
||||
.datepicker.dropdown-menu th, .datepicker.dropdown-menu td {
|
||||
padding: 4px 5px;
|
||||
}
|
@ -0,0 +1,247 @@
|
||||
!(function (t, e) {
|
||||
'object' == typeof exports && 'undefined' != typeof module
|
||||
? (module.exports = e())
|
||||
: 'function' == typeof define && define.amd
|
||||
? define(e)
|
||||
: ((t = 'undefined' != typeof globalThis ? globalThis : t || self).dayjs_plugin_customParseFormat = e());
|
||||
})(this, function () {
|
||||
'use strict';
|
||||
var t = { LTS: 'h:mm:ss A', LT: 'h:mm A', L: 'MM/DD/YYYY', LL: 'MMMM D, YYYY', LLL: 'MMMM D, YYYY h:mm A', LLLL: 'dddd, MMMM D, YYYY h:mm A' },
|
||||
e = /(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,
|
||||
n = /\d\d/,
|
||||
r = /\d\d?/,
|
||||
i = /\d*[^\s\d-_:/()]+/,
|
||||
o = {},
|
||||
s = function (t) {
|
||||
return (t = +t) + (t > 68 ? 1900 : 2e3);
|
||||
};
|
||||
var a = function (t) {
|
||||
return function (e) {
|
||||
this[t] = +e;
|
||||
};
|
||||
},
|
||||
f = [
|
||||
/[+-]\d\d:?(\d\d)?|Z/,
|
||||
function (t) {
|
||||
(this.zone || (this.zone = {})).offset = (function (t) {
|
||||
if (!t) return 0;
|
||||
if ('Z' === t) return 0;
|
||||
var e = t.match(/([+-]|\d\d)/g),
|
||||
n = 60 * e[1] + (+e[2] || 0);
|
||||
return 0 === n ? 0 : '+' === e[0] ? -n : n;
|
||||
})(t);
|
||||
}
|
||||
],
|
||||
u = function (t) {
|
||||
var e = o[t];
|
||||
return e && (e.indexOf ? e : e.s.concat(e.f));
|
||||
},
|
||||
h = function (t, e) {
|
||||
var n,
|
||||
r = o.meridiem;
|
||||
if (r) {
|
||||
for (var i = 1; i <= 24; i += 1)
|
||||
if (t.indexOf(r(i, 0, e)) > -1) {
|
||||
n = i > 12;
|
||||
break;
|
||||
}
|
||||
} else n = t === (e ? 'pm' : 'PM');
|
||||
return n;
|
||||
},
|
||||
d = {
|
||||
A: [
|
||||
i,
|
||||
function (t) {
|
||||
this.afternoon = h(t, !1);
|
||||
}
|
||||
],
|
||||
a: [
|
||||
i,
|
||||
function (t) {
|
||||
this.afternoon = h(t, !0);
|
||||
}
|
||||
],
|
||||
S: [
|
||||
/\d/,
|
||||
function (t) {
|
||||
this.milliseconds = 100 * +t;
|
||||
}
|
||||
],
|
||||
SS: [
|
||||
n,
|
||||
function (t) {
|
||||
this.milliseconds = 10 * +t;
|
||||
}
|
||||
],
|
||||
SSS: [
|
||||
/\d{3}/,
|
||||
function (t) {
|
||||
this.milliseconds = +t;
|
||||
}
|
||||
],
|
||||
s: [r, a('seconds')],
|
||||
ss: [r, a('seconds')],
|
||||
m: [r, a('minutes')],
|
||||
mm: [r, a('minutes')],
|
||||
H: [r, a('hours')],
|
||||
h: [r, a('hours')],
|
||||
HH: [r, a('hours')],
|
||||
hh: [r, a('hours')],
|
||||
D: [r, a('day')],
|
||||
DD: [n, a('day')],
|
||||
Do: [
|
||||
i,
|
||||
function (t) {
|
||||
var e = o.ordinal,
|
||||
n = t.match(/\d+/);
|
||||
if (((this.day = n[0]), e)) for (var r = 1; r <= 31; r += 1) e(r).replace(/\[|\]/g, '') === t && (this.day = r);
|
||||
}
|
||||
],
|
||||
M: [r, a('month')],
|
||||
MM: [n, a('month')],
|
||||
MMM: [
|
||||
i,
|
||||
function (t) {
|
||||
var e = u('months'),
|
||||
n =
|
||||
(
|
||||
u('monthsShort') ||
|
||||
e.map(function (t) {
|
||||
return t.substr(0, 3);
|
||||
})
|
||||
).indexOf(t) + 1;
|
||||
if (n < 1) throw new Error();
|
||||
this.month = n % 12 || n;
|
||||
}
|
||||
],
|
||||
MMMM: [
|
||||
i,
|
||||
function (t) {
|
||||
var e = u('months').indexOf(t) + 1;
|
||||
if (e < 1) throw new Error();
|
||||
this.month = e % 12 || e;
|
||||
}
|
||||
],
|
||||
Y: [/[+-]?\d+/, a('year')],
|
||||
YY: [
|
||||
n,
|
||||
function (t) {
|
||||
this.year = s(t);
|
||||
}
|
||||
],
|
||||
YYYY: [/\d{4}/, a('year')],
|
||||
Z: f,
|
||||
ZZ: f
|
||||
};
|
||||
function c(n) {
|
||||
var r, i;
|
||||
(r = n), (i = o && o.formats);
|
||||
for (
|
||||
var s = (n = r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function (e, n, r) {
|
||||
var o = r && r.toUpperCase();
|
||||
return (
|
||||
n ||
|
||||
i[r] ||
|
||||
t[r] ||
|
||||
i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function (t, e, n) {
|
||||
return e || n.slice(1);
|
||||
})
|
||||
);
|
||||
})).match(e),
|
||||
a = s.length,
|
||||
f = 0;
|
||||
f < a;
|
||||
f += 1
|
||||
) {
|
||||
var u = s[f],
|
||||
h = d[u],
|
||||
c = h && h[0],
|
||||
l = h && h[1];
|
||||
s[f] = l ? { regex: c, parser: l } : u.replace(/^\[|\]$/g, '');
|
||||
}
|
||||
return function (t) {
|
||||
for (var e = {}, n = 0, r = 0; n < a; n += 1) {
|
||||
var i = s[n];
|
||||
if ('string' == typeof i) r += i.length;
|
||||
else {
|
||||
var o = i.regex,
|
||||
f = i.parser,
|
||||
u = t.substr(r),
|
||||
h = o.exec(u)[0];
|
||||
f.call(e, h), (t = t.replace(h, ''));
|
||||
}
|
||||
}
|
||||
return (
|
||||
(function (t) {
|
||||
var e = t.afternoon;
|
||||
if (void 0 !== e) {
|
||||
var n = t.hours;
|
||||
e ? n < 12 && (t.hours += 12) : 12 === n && (t.hours = 0), delete t.afternoon;
|
||||
}
|
||||
})(e),
|
||||
e
|
||||
);
|
||||
};
|
||||
}
|
||||
return function (t, e, n) {
|
||||
(n.p.customParseFormat = !0), t && t.parseTwoDigitYear && (s = t.parseTwoDigitYear);
|
||||
var r = e.prototype,
|
||||
i = r.parse;
|
||||
r.parse = function (t) {
|
||||
var e = t.date,
|
||||
r = t.utc,
|
||||
s = t.args;
|
||||
this.$u = r;
|
||||
var a = s[1];
|
||||
if ('string' == typeof a) {
|
||||
var f = !0 === s[2],
|
||||
u = !0 === s[3],
|
||||
h = f || u,
|
||||
d = s[2];
|
||||
u && (d = s[2]),
|
||||
(o = this.$locale()),
|
||||
!f && d && (o = n.Ls[d]),
|
||||
(this.$d = (function (t, e, n) {
|
||||
try {
|
||||
if (['x', 'X'].indexOf(e) > -1) return new Date(('X' === e ? 1e3 : 1) * t);
|
||||
var r = c(e)(t),
|
||||
i = r.year,
|
||||
o = r.month,
|
||||
s = r.day,
|
||||
a = r.hours,
|
||||
f = r.minutes,
|
||||
u = r.seconds,
|
||||
h = r.milliseconds,
|
||||
d = r.zone,
|
||||
l = new Date(),
|
||||
m = s || (i || o ? 1 : l.getDate()),
|
||||
M = i || l.getFullYear(),
|
||||
Y = 0;
|
||||
(i && !o) || (Y = o > 0 ? o - 1 : l.getMonth());
|
||||
var p = a || 0,
|
||||
v = f || 0,
|
||||
D = u || 0,
|
||||
g = h || 0;
|
||||
return d ? new Date(Date.UTC(M, Y, m, p, v, D, g + 60 * d.offset * 1e3)) : n ? new Date(Date.UTC(M, Y, m, p, v, D, g)) : new Date(M, Y, m, p, v, D, g);
|
||||
} catch (t) {
|
||||
return new Date('');
|
||||
}
|
||||
})(e, a, r)),
|
||||
this.init(),
|
||||
d && !0 !== d && (this.$L = this.locale(d).$L),
|
||||
h && e != this.format(a) && (this.$d = new Date('')),
|
||||
(o = {});
|
||||
} else if (a instanceof Array)
|
||||
for (var l = a.length, m = 1; m <= l; m += 1) {
|
||||
s[1] = a[m - 1];
|
||||
var M = n.apply(this, s);
|
||||
if (M.isValid()) {
|
||||
(this.$d = M.$d), (this.$L = M.$L), this.init();
|
||||
break;
|
||||
}
|
||||
m === l && (this.$d = new Date(''));
|
||||
}
|
||||
else i.call(this, t);
|
||||
};
|
||||
};
|
||||
});
|
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* bootstrap-table - v1.9.0 - 2015-09-30
|
||||
* https://github.com/wenzhixin/bootstrap-table
|
||||
* Copyright (c) 2015 zhixin wen
|
||||
* Licensed MIT License
|
||||
*/
|
||||
!function(a){"use strict";var b=function(b,c){b.options.columnsHidden.length>0&&a.each(b.columns,function(d,e){-1!==b.options.columnsHidden.indexOf(e.field)&&e.visible!==c&&b.toggleColumn(a.fn.bootstrapTable.utils.getFieldIndex(b.columns,e.field),c,!0)})},c=function(a){(a.options.height||a.options.showFooter)&&setTimeout(a.resetView,1)},d=function(a,b,d){a.options.minHeight?b<=a.options.minWidth&&d<=a.options.minHeight?e(a):b>a.options.minWidth&&d>a.options.minHeight&&f(a):b<=a.options.minWidth?e(a):b>a.options.minWidth&&f(a),c(a)},e=function(a){g(a,!1),b(a,!1)},f=function(a){g(a,!0),b(a,!0)},g=function(a,b){a.options.cardView=b,a.toggleView()},h=function(a,b){var c;return function(){var d=this,e=arguments,f=function(){c=null,a.apply(d,e)};clearTimeout(c),c=setTimeout(f,b)}};a.extend(a.fn.bootstrapTable.defaults,{mobileResponsive:!1,minWidth:562,minHeight:void 0,heightThreshold:100,checkOnInit:!0,columnsHidden:[]});var i=a.fn.bootstrapTable.Constructor,j=i.prototype.init;i.prototype.init=function(){if(j.apply(this,Array.prototype.slice.apply(arguments)),this.options.mobileResponsive&&this.options.minWidth){var b=this,c={width:a(window).width(),height:a(window).height()};if(a(window).on("resize orientationchange",h(function(){var e=a(this).height(),f=a(this).width();(Math.abs(c.height-e)>b.options.heightThreshold||c.width!=f)&&(d(b,f,e),c={width:f,height:e})},200)),this.options.checkOnInit){var e=a(window).height(),f=a(window).width();d(this,f,e),c={width:f,height:e}}}}}(jQuery);
|
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* bootstrap-table - v1.8.1 - 2015-05-29
|
||||
* https://github.com/wenzhixin/bootstrap-table
|
||||
* Copyright (c) 2015 zhixin wen
|
||||
* Licensed MIT License
|
||||
*/
|
||||
!function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery);
|
@ -0,0 +1 @@
|
||||
.bootstrap-table .table{margin-bottom:0!important;border-bottom:1px solid #e4eaec;border-collapse:collapse!important}.bootstrap-table .table,.bootstrap-table .table>tbody>tr>td,.bootstrap-table .table>tbody>tr>th,.bootstrap-table .table>tfoot>tr>td,.bootstrap-table .table>tfoot>tr>th,.bootstrap-table .table>thead>tr>td{padding:8px!important}.bootstrap-table .table.table-no-bordered>tbody>tr>td,.bootstrap-table .table.table-no-bordered>thead>tr>th{border-right:2px solid transparent}.fixed-table-container{position:relative;clear:both;border:1px solid #e4eaec}.fixed-table-container.table-no-bordered{border:1px solid transparent}.fixed-table-footer,.fixed-table-header{height:37px;overflow:hidden}.fixed-table-header{border-bottom:1px solid #e4eaec}.fixed-table-footer{border-top:1px solid #e4eaec}.fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.fixed-table-container table{width:100%}.fixed-table-container thead th{height:0;padding:0;margin:0;border-left:1px solid #e4eaec}.fixed-table-container thead th:first-child{border-left:none}.fixed-table-container tbody td .th-inner,.fixed-table-container thead th .th-inner{padding:8px;line-height:20px;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fixed-table-container thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px}.fixed-table-container th.detail{width:30px}.fixed-table-container tbody td{border-left:1px solid #e4eaec}.fixed-table-container tbody tr:first-child td{border-top:none}.fixed-table-container tbody td:first-child{border-left:none}.fixed-table-container .table .icon,.fixed-table-container table .icon{top:auto;margin:0 5px}.fixed-table-container tbody .selected td{background-color:#f3f7f9}.fixed-table-container .bs-checkbox{text-align:center}.fixed-table-container .bs-checkbox .th-inner{padding:8px 0}.fixed-table-container input[type=radio],.fixed-table-container input[type=checkbox]{margin:0 auto!important}.fixed-table-container .no-records-found{text-align:center}.fixed-table-pagination .pagination-detail,.fixed-table-pagination div.pagination{margin-top:10px;margin-bottom:10px}.fixed-table-pagination div.pagination .pagination{margin:0}.fixed-table-pagination .pagination a{padding:6px 12px;line-height:1.428571429}.fixed-table-pagination .pagination-info{line-height:34px;margin-right:5px}.fixed-table-pagination .btn-group{position:relative;display:inline-block;vertical-align:middle}.fixed-table-pagination .dropup .dropdown-menu{margin-bottom:0}.fixed-table-pagination .page-list{display:inline-block}.fixed-table-toolbar .columns-left{margin-right:5px}.fixed-table-toolbar .columns-right{margin-left:5px}.fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:300;line-height:1.428571429}.fixed-table-toolbar .bars,.fixed-table-toolbar .columns,.fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px;line-height:34px}.fixed-table-pagination li.disabled a{pointer-events:none;cursor:default}.fixed-table-loading{display:none;position:absolute;top:42px;right:0;bottom:0;left:0;z-index:6;background-color:#fff;text-align:center}.fixed-table-body .card-view .title{font-weight:400;display:inline-block;min-width:30%;text-align:left!important}.fixed-table-body thead th .th-inner{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.table td,.table th{vertical-align:middle;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.fixed-table-toolbar .dropdown-menu{text-align:left;max-height:300px;overflow:auto}.fixed-table-toolbar .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.fixed-table-toolbar .btn-group>.btn-group>.btn{border-radius:0}.fixed-table-toolbar .btn-group>.btn-group:first-child>.btn{border-top-left-radius:3px;border-bottom-left-radius:3px}.fixed-table-toolbar .btn-group>.btn-group:last-child>.btn{border-top-right-radius:3px;border-bottom-right-radius:3px}.bootstrap-table .table>thead>tr>th{vertical-align:bottom;border-bottom:1px solid #e4eaec}.bootstrap-table .table thead>tr>th{padding:0;margin:0}.bootstrap-table .fixed-table-footer tbody>tr>td{padding:0!important}.bootstrap-table .fixed-table-footer .table{border-bottom:none;border-radius:0}.pull-right .dropdown-menu{right:0;left:auto}p.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden}
|
@ -0,0 +1,655 @@
|
||||
/*! X-editable - v1.5.0
|
||||
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
|
||||
* http://github.com/vitalets/x-editable
|
||||
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
|
||||
.editableform {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
}
|
||||
|
||||
.editableform .control-group {
|
||||
margin-bottom: 0; /* overwrites bootstrap margin */
|
||||
white-space: nowrap; /* prevent wrapping buttons on new line */
|
||||
line-height: 20px; /* overwriting bootstrap line-height. See #133 */
|
||||
}
|
||||
|
||||
.editable-buttons {
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
vertical-align: top;
|
||||
margin-left: 7px;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons.editable-buttons-bottom {
|
||||
display: block;
|
||||
margin-top: 7px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.editable-input {
|
||||
vertical-align: top;
|
||||
display: inline-block; /* should be inline to take effect of parent's white-space: nowrap */
|
||||
width: auto; /* bootstrap-responsive has width: 100% that breakes layout */
|
||||
white-space: normal; /* reset white-space decalred in parent*/
|
||||
/* display-inline emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-buttons .editable-cancel {
|
||||
margin-left: 7px;
|
||||
}
|
||||
|
||||
/*for jquery-ui buttons need set height to look more pretty*/
|
||||
.editable-buttons button.ui-button-icon-only {
|
||||
height: 24px;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
.editableform-loading {
|
||||
background: url('../img/loading.gif') center center no-repeat;
|
||||
height: 25px;
|
||||
width: auto;
|
||||
min-width: 25px;
|
||||
}
|
||||
|
||||
.editable-inline .editableform-loading {
|
||||
background-position: left 5px;
|
||||
}
|
||||
|
||||
.editable-error-block {
|
||||
max-width: 300px;
|
||||
margin: 5px 0 0 0;
|
||||
width: auto;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/*add padding for jquery ui*/
|
||||
.editable-error-block.ui-state-error {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.editable-error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* ---- For specific types ---- */
|
||||
|
||||
.editableform .editable-date {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* move datepicker icon to center of add-on button. See https://github.com/vitalets/x-editable/issues/183 */
|
||||
.editable-inline .add-on .icon-th {
|
||||
margin-top: 3px;
|
||||
margin-left: 1px;
|
||||
}
|
||||
|
||||
|
||||
/* checklist vertical alignment */
|
||||
.editable-checklist label input[type="checkbox"],
|
||||
.editable-checklist label span {
|
||||
vertical-align: middle;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.editable-checklist label {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* set exact width of textarea to fit buttons toolbar */
|
||||
.editable-wysihtml5 {
|
||||
width: 566px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
/* clear button shown as link in date inputs */
|
||||
.editable-clear {
|
||||
clear: both;
|
||||
font-size: 0.9em;
|
||||
text-decoration: none;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* IOS-style clear button for text inputs */
|
||||
.editable-clear-x {
|
||||
background: url('../img/clear.png') center center no-repeat;
|
||||
display: block;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
position: absolute;
|
||||
opacity: 0.6;
|
||||
z-index: 100;
|
||||
|
||||
top: 50%;
|
||||
right: 6px;
|
||||
margin-top: -6px;
|
||||
|
||||
}
|
||||
|
||||
.editable-clear-x:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.editable-pre-wrapped {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.editable-container.editable-popup {
|
||||
max-width: none !important; /* without this rule poshytip/tooltip does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.popover {
|
||||
width: auto; /* without this rule popover does not stretch */
|
||||
}
|
||||
|
||||
.editable-container.editable-inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: auto;
|
||||
/* inline-block emulation for IE7*/
|
||||
zoom: 1;
|
||||
*display: inline;
|
||||
}
|
||||
|
||||
.editable-container.ui-widget {
|
||||
font-size: inherit; /* jqueryui widget font 1.1em too big, overwrite it */
|
||||
z-index: 9990; /* should be less than select2 dropdown z-index to close dropdown first when click */
|
||||
}
|
||||
.editable-click,
|
||||
a.editable-click,
|
||||
a.editable-click:hover {
|
||||
text-decoration: none;
|
||||
border-bottom: dashed 1px #0088cc;
|
||||
}
|
||||
|
||||
.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled,
|
||||
a.editable-click.editable-disabled:hover {
|
||||
color: #585858;
|
||||
cursor: default;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.editable-empty, .editable-empty:hover, .editable-empty:focus{
|
||||
font-style: italic;
|
||||
color: #DD1144;
|
||||
/* border-bottom: none; */
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.editable-unsaved {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.editable-unsaved:after {
|
||||
/* content: '*'*/
|
||||
}
|
||||
|
||||
.editable-bg-transition {
|
||||
-webkit-transition: background-color 1400ms ease-out;
|
||||
-moz-transition: background-color 1400ms ease-out;
|
||||
-o-transition: background-color 1400ms ease-out;
|
||||
-ms-transition: background-color 1400ms ease-out;
|
||||
transition: background-color 1400ms ease-out;
|
||||
}
|
||||
|
||||
/*see https://github.com/vitalets/x-editable/issues/139 */
|
||||
.form-horizontal .editable
|
||||
{
|
||||
padding-top: 5px;
|
||||
display:inline-block;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Datepicker for Bootstrap
|
||||
*
|
||||
* Copyright 2012 Stefan Petre
|
||||
* Improvements by Andrew Rowls
|
||||
* Licensed under the Apache License v2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*/
|
||||
.datepicker {
|
||||
padding: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
direction: ltr;
|
||||
/*.dow {
|
||||
border-top: 1px solid #ddd !important;
|
||||
}*/
|
||||
|
||||
}
|
||||
.datepicker-inline {
|
||||
width: 220px;
|
||||
}
|
||||
.datepicker.datepicker-rtl {
|
||||
direction: rtl;
|
||||
}
|
||||
.datepicker.datepicker-rtl table tr td span {
|
||||
float: right;
|
||||
}
|
||||
.datepicker-dropdown {
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
.datepicker-dropdown:before {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 7px solid transparent;
|
||||
border-right: 7px solid transparent;
|
||||
border-bottom: 7px solid #ccc;
|
||||
border-bottom-color: rgba(0, 0, 0, 0.2);
|
||||
position: absolute;
|
||||
top: -7px;
|
||||
left: 6px;
|
||||
}
|
||||
.datepicker-dropdown:after {
|
||||
content: '';
|
||||
display: inline-block;
|
||||
border-left: 6px solid transparent;
|
||||
border-right: 6px solid transparent;
|
||||
border-bottom: 6px solid #ffffff;
|
||||
position: absolute;
|
||||
top: -6px;
|
||||
left: 7px;
|
||||
}
|
||||
.datepicker > div {
|
||||
display: none;
|
||||
}
|
||||
.datepicker.days div.datepicker-days {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.months div.datepicker-months {
|
||||
display: block;
|
||||
}
|
||||
.datepicker.years div.datepicker-years {
|
||||
display: block;
|
||||
}
|
||||
.datepicker table {
|
||||
margin: 0;
|
||||
}
|
||||
.datepicker td,
|
||||
.datepicker th {
|
||||
text-align: center;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
border: none;
|
||||
}
|
||||
.table-striped .datepicker table tr td,
|
||||
.table-striped .datepicker table tr th {
|
||||
background-color: transparent;
|
||||
}
|
||||
.datepicker table tr td.day:hover {
|
||||
background: #eeeeee;
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker table tr td.old,
|
||||
.datepicker table tr td.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker table tr td.disabled,
|
||||
.datepicker table tr td.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td.today,
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today.disabled:hover {
|
||||
background-color: #fde19a;
|
||||
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
|
||||
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-image: linear-gradient(top, #fdd49a, #fdf59a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
|
||||
border-color: #fdf59a #fdf59a #fbed50;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today:hover,
|
||||
.datepicker table tr td.today:hover:hover,
|
||||
.datepicker table tr td.today.disabled:hover,
|
||||
.datepicker table tr td.today.disabled:hover:hover,
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active,
|
||||
.datepicker table tr td.today.disabled,
|
||||
.datepicker table tr td.today:hover.disabled,
|
||||
.datepicker table tr td.today.disabled.disabled,
|
||||
.datepicker table tr td.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.today[disabled],
|
||||
.datepicker table tr td.today:hover[disabled],
|
||||
.datepicker table tr td.today.disabled[disabled],
|
||||
.datepicker table tr td.today.disabled:hover[disabled] {
|
||||
background-color: #fdf59a;
|
||||
}
|
||||
.datepicker table tr td.today:active,
|
||||
.datepicker table tr td.today:hover:active,
|
||||
.datepicker table tr td.today.disabled:active,
|
||||
.datepicker table tr td.today.disabled:hover:active,
|
||||
.datepicker table tr td.today.active,
|
||||
.datepicker table tr td.today:hover.active,
|
||||
.datepicker table tr td.today.disabled.active,
|
||||
.datepicker table tr td.today.disabled:hover.active {
|
||||
background-color: #fbf069 \9;
|
||||
}
|
||||
.datepicker table tr td.today:hover:hover {
|
||||
color: #000;
|
||||
}
|
||||
.datepicker table tr td.today.active:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.datepicker table tr td.range,
|
||||
.datepicker table tr td.range:hover,
|
||||
.datepicker table tr td.range.disabled,
|
||||
.datepicker table tr td.range.disabled:hover {
|
||||
background: #eeeeee;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today,
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover {
|
||||
background-color: #f3d17a;
|
||||
background-image: -moz-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -ms-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f3c17a), to(#f3e97a));
|
||||
background-image: -webkit-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: -o-linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-image: linear-gradient(top, #f3c17a, #f3e97a);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f3c17a', endColorstr='#f3e97a', GradientType=0);
|
||||
border-color: #f3e97a #f3e97a #edde34;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.datepicker table tr td.range.today:hover,
|
||||
.datepicker table tr td.range.today:hover:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover,
|
||||
.datepicker table tr td.range.today.disabled:hover:hover,
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active,
|
||||
.datepicker table tr td.range.today.disabled,
|
||||
.datepicker table tr td.range.today:hover.disabled,
|
||||
.datepicker table tr td.range.today.disabled.disabled,
|
||||
.datepicker table tr td.range.today.disabled:hover.disabled,
|
||||
.datepicker table tr td.range.today[disabled],
|
||||
.datepicker table tr td.range.today:hover[disabled],
|
||||
.datepicker table tr td.range.today.disabled[disabled],
|
||||
.datepicker table tr td.range.today.disabled:hover[disabled] {
|
||||
background-color: #f3e97a;
|
||||
}
|
||||
.datepicker table tr td.range.today:active,
|
||||
.datepicker table tr td.range.today:hover:active,
|
||||
.datepicker table tr td.range.today.disabled:active,
|
||||
.datepicker table tr td.range.today.disabled:hover:active,
|
||||
.datepicker table tr td.range.today.active,
|
||||
.datepicker table tr td.range.today:hover.active,
|
||||
.datepicker table tr td.range.today.disabled.active,
|
||||
.datepicker table tr td.range.today.disabled:hover.active {
|
||||
background-color: #efe24b \9;
|
||||
}
|
||||
.datepicker table tr td.selected,
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover {
|
||||
background-color: #9e9e9e;
|
||||
background-image: -moz-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -ms-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b3b3b3), to(#808080));
|
||||
background-image: -webkit-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: -o-linear-gradient(top, #b3b3b3, #808080);
|
||||
background-image: linear-gradient(top, #b3b3b3, #808080);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b3b3b3', endColorstr='#808080', GradientType=0);
|
||||
border-color: #808080 #808080 #595959;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.selected:hover,
|
||||
.datepicker table tr td.selected:hover:hover,
|
||||
.datepicker table tr td.selected.disabled:hover,
|
||||
.datepicker table tr td.selected.disabled:hover:hover,
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active,
|
||||
.datepicker table tr td.selected.disabled,
|
||||
.datepicker table tr td.selected:hover.disabled,
|
||||
.datepicker table tr td.selected.disabled.disabled,
|
||||
.datepicker table tr td.selected.disabled:hover.disabled,
|
||||
.datepicker table tr td.selected[disabled],
|
||||
.datepicker table tr td.selected:hover[disabled],
|
||||
.datepicker table tr td.selected.disabled[disabled],
|
||||
.datepicker table tr td.selected.disabled:hover[disabled] {
|
||||
background-color: #808080;
|
||||
}
|
||||
.datepicker table tr td.selected:active,
|
||||
.datepicker table tr td.selected:hover:active,
|
||||
.datepicker table tr td.selected.disabled:active,
|
||||
.datepicker table tr td.selected.disabled:hover:active,
|
||||
.datepicker table tr td.selected.active,
|
||||
.datepicker table tr td.selected:hover.active,
|
||||
.datepicker table tr td.selected.disabled.active,
|
||||
.datepicker table tr td.selected.disabled:hover.active {
|
||||
background-color: #666666 \9;
|
||||
}
|
||||
.datepicker table tr td.active,
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td.active:hover,
|
||||
.datepicker table tr td.active:hover:hover,
|
||||
.datepicker table tr td.active.disabled:hover,
|
||||
.datepicker table tr td.active.disabled:hover:hover,
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active,
|
||||
.datepicker table tr td.active.disabled,
|
||||
.datepicker table tr td.active:hover.disabled,
|
||||
.datepicker table tr td.active.disabled.disabled,
|
||||
.datepicker table tr td.active.disabled:hover.disabled,
|
||||
.datepicker table tr td.active[disabled],
|
||||
.datepicker table tr td.active:hover[disabled],
|
||||
.datepicker table tr td.active.disabled[disabled],
|
||||
.datepicker table tr td.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td.active:active,
|
||||
.datepicker table tr td.active:hover:active,
|
||||
.datepicker table tr td.active.disabled:active,
|
||||
.datepicker table tr td.active.disabled:hover:active,
|
||||
.datepicker table tr td.active.active,
|
||||
.datepicker table tr td.active:hover.active,
|
||||
.datepicker table tr td.active.disabled.active,
|
||||
.datepicker table tr td.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span {
|
||||
display: block;
|
||||
width: 23%;
|
||||
height: 54px;
|
||||
line-height: 54px;
|
||||
float: left;
|
||||
margin: 1%;
|
||||
cursor: pointer;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.datepicker table tr td span:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker table tr td span.disabled,
|
||||
.datepicker table tr td span.disabled:hover {
|
||||
background: none;
|
||||
color: #999999;
|
||||
cursor: default;
|
||||
}
|
||||
.datepicker table tr td span.active,
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover {
|
||||
background-color: #006dcc;
|
||||
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
|
||||
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
|
||||
background-image: linear-gradient(top, #0088cc, #0044cc);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
|
||||
border-color: #0044cc #0044cc #002a80;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.datepicker table tr td span.active:hover,
|
||||
.datepicker table tr td span.active:hover:hover,
|
||||
.datepicker table tr td span.active.disabled:hover,
|
||||
.datepicker table tr td span.active.disabled:hover:hover,
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active,
|
||||
.datepicker table tr td span.active.disabled,
|
||||
.datepicker table tr td span.active:hover.disabled,
|
||||
.datepicker table tr td span.active.disabled.disabled,
|
||||
.datepicker table tr td span.active.disabled:hover.disabled,
|
||||
.datepicker table tr td span.active[disabled],
|
||||
.datepicker table tr td span.active:hover[disabled],
|
||||
.datepicker table tr td span.active.disabled[disabled],
|
||||
.datepicker table tr td span.active.disabled:hover[disabled] {
|
||||
background-color: #0044cc;
|
||||
}
|
||||
.datepicker table tr td span.active:active,
|
||||
.datepicker table tr td span.active:hover:active,
|
||||
.datepicker table tr td span.active.disabled:active,
|
||||
.datepicker table tr td span.active.disabled:hover:active,
|
||||
.datepicker table tr td span.active.active,
|
||||
.datepicker table tr td span.active:hover.active,
|
||||
.datepicker table tr td span.active.disabled.active,
|
||||
.datepicker table tr td span.active.disabled:hover.active {
|
||||
background-color: #003399 \9;
|
||||
}
|
||||
.datepicker table tr td span.old,
|
||||
.datepicker table tr td span.new {
|
||||
color: #999999;
|
||||
}
|
||||
.datepicker th.datepicker-switch {
|
||||
width: 145px;
|
||||
}
|
||||
.datepicker thead tr:first-child th,
|
||||
.datepicker tfoot tr th {
|
||||
cursor: pointer;
|
||||
}
|
||||
.datepicker thead tr:first-child th:hover,
|
||||
.datepicker tfoot tr th:hover {
|
||||
background: #eeeeee;
|
||||
}
|
||||
.datepicker .cw {
|
||||
font-size: 10px;
|
||||
width: 12px;
|
||||
padding: 0 2px 0 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.datepicker thead tr:first-child th.cw {
|
||||
cursor: default;
|
||||
background-color: transparent;
|
||||
}
|
||||
.input-append.date .add-on i,
|
||||
.input-prepend.date .add-on i {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.input-daterange input {
|
||||
text-align: center;
|
||||
}
|
||||
.input-daterange input:first-child {
|
||||
-webkit-border-radius: 3px 0 0 3px;
|
||||
-moz-border-radius: 3px 0 0 3px;
|
||||
border-radius: 3px 0 0 3px;
|
||||
}
|
||||
.input-daterange input:last-child {
|
||||
-webkit-border-radius: 0 3px 3px 0;
|
||||
-moz-border-radius: 0 3px 3px 0;
|
||||
border-radius: 0 3px 3px 0;
|
||||
}
|
||||
.input-daterange .add-on {
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
min-width: 16px;
|
||||
height: 18px;
|
||||
padding: 4px 5px;
|
||||
font-weight: normal;
|
||||
line-height: 18px;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 0 #ffffff;
|
||||
vertical-align: middle;
|
||||
background-color: #eeeeee;
|
||||
border: 1px solid #ccc;
|
||||
margin-left: -5px;
|
||||
margin-right: -5px;
|
||||
}
|
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||
* extensions: https://github.com/vitalets/x-editable
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
editable: true,
|
||||
onEditableInit: function() {
|
||||
return false;
|
||||
},
|
||||
onEditableSave: function(field, row, oldValue, $el) {
|
||||
return false;
|
||||
},
|
||||
onEditableShown: function(field, row, $el, editable) {
|
||||
return false;
|
||||
},
|
||||
onEditableHidden: function(field, row, $el, reason) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||
'editable-init.bs.table': 'onEditableInit',
|
||||
'editable-save.bs.table': 'onEditableSave',
|
||||
'editable-shown.bs.table': 'onEditableShown',
|
||||
'editable-hidden.bs.table': 'onEditableHidden'
|
||||
});
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_initTable = BootstrapTable.prototype.initTable,
|
||||
_initBody = BootstrapTable.prototype.initBody;
|
||||
|
||||
BootstrapTable.prototype.initTable = function() {
|
||||
var that = this;
|
||||
_initTable.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(this.columns, function(i, column) {
|
||||
if (!column.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
var editableOptions = {},
|
||||
editableDataMarkup = [],
|
||||
editableDataPrefix = 'editable-';
|
||||
|
||||
var processDataOptions = function(key, value) {
|
||||
// Replace camel case with dashes.
|
||||
var dashKey = key.replace(/([A-Z])/g, function($1) {
|
||||
return "-" + $1.toLowerCase();
|
||||
});
|
||||
if (dashKey.slice(0, editableDataPrefix.length) == editableDataPrefix) {
|
||||
var dataKey = dashKey.replace(editableDataPrefix, 'data-');
|
||||
editableOptions[dataKey] = value;
|
||||
}
|
||||
};
|
||||
|
||||
$.each(that.options, processDataOptions);
|
||||
|
||||
column.formatter = column.formatter || function(value, row, index) {
|
||||
return value;
|
||||
};
|
||||
column._formatter = column._formatter ? column._formatter : column.formatter;
|
||||
column.formatter = function(value, row, index) {
|
||||
var result = column._formatter ? column._formatter(value, row, index) : value;
|
||||
|
||||
$.each(column, processDataOptions);
|
||||
|
||||
$.each(editableOptions, function(key, value) {
|
||||
editableDataMarkup.push(' ' + key + '="' + value + '"');
|
||||
});
|
||||
|
||||
var _dont_edit_formatter = false;
|
||||
if (column.editable.hasOwnProperty('noeditFormatter')) {
|
||||
_dont_edit_formatter = column.editable.noeditFormatter(value, row, index);
|
||||
}
|
||||
|
||||
if (_dont_edit_formatter === false) {
|
||||
return ['<a href="javascript:void(0)"',
|
||||
' data-name="' + column.field + '"',
|
||||
' data-pk="' + row[that.options.idField] + '"',
|
||||
' data-value="' + result + '"',
|
||||
editableDataMarkup.join(''),
|
||||
'>' + '</a>'
|
||||
].join('');
|
||||
} else {
|
||||
return _dont_edit_formatter;
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.initBody = function() {
|
||||
var that = this;
|
||||
_initBody.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(this.columns, function(i, column) {
|
||||
if (!column.editable) {
|
||||
return;
|
||||
}
|
||||
|
||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||
.off('save').on('save', function(e, params) {
|
||||
var data = that.getData(),
|
||||
index = $(this).parents('tr[data-index]').data('index'),
|
||||
row = data[index],
|
||||
oldValue = row[column.field];
|
||||
|
||||
$(this).data('value', params.submitValue);
|
||||
row[column.field] = params.submitValue;
|
||||
that.trigger('editable-save', column.field, row, oldValue, $(this));
|
||||
that.resetFooter();
|
||||
});
|
||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||
.off('shown').on('shown', function(e, editable) {
|
||||
var data = that.getData(),
|
||||
index = $(this).parents('tr[data-index]').data('index'),
|
||||
row = data[index];
|
||||
|
||||
that.trigger('editable-shown', column.field, row, $(this), editable);
|
||||
});
|
||||
that.$body.find('a[data-name="' + column.field + '"]').editable(column.editable)
|
||||
.off('hidden').on('hidden', function(e, reason) {
|
||||
var data = that.getData(),
|
||||
index = $(this).parents('tr[data-index]').data('index'),
|
||||
row = data[index];
|
||||
|
||||
that.trigger('editable-hidden', column.field, row, $(this), reason);
|
||||
});
|
||||
});
|
||||
this.trigger('editable-init');
|
||||
};
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1,118 @@
|
||||
/**
|
||||
* @author: Dennis Hern¨¢ndez
|
||||
* @webSite: http://djhvscf.github.io/Blog
|
||||
* @version: v1.0.1
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var isSearch = false;
|
||||
|
||||
var rowAttr = function (row, index) {
|
||||
return {
|
||||
id: 'customId_' + index
|
||||
};
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
reorderableRows: false,
|
||||
onDragStyle: null,
|
||||
onDropStyle: null,
|
||||
onDragClass: "reorder_rows_onDragClass",
|
||||
dragHandle: null,
|
||||
useRowAttrFunc: false,
|
||||
onReorderRowsDrag: function (table, row) {
|
||||
return false;
|
||||
},
|
||||
onReorderRowsDrop: function (table, row) {
|
||||
return false;
|
||||
},
|
||||
onReorderRow: function (newData) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
|
||||
'reorder-row.bs.table': 'onReorderRow'
|
||||
});
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_init = BootstrapTable.prototype.init,
|
||||
_initSearch = BootstrapTable.prototype.initSearch;
|
||||
|
||||
BootstrapTable.prototype.init = function () {
|
||||
|
||||
if (!this.options.reorderableRows) {
|
||||
_init.apply(this, Array.prototype.slice.apply(arguments));
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
if (this.options.useRowAttrFunc) {
|
||||
this.options.rowAttributes = rowAttr;
|
||||
}
|
||||
|
||||
var onPostBody = this.options.onPostBody;
|
||||
this.options.onPostBody = function () {
|
||||
setTimeout(function () {
|
||||
that.makeRowsReorderable();
|
||||
onPostBody.apply();
|
||||
}, 1);
|
||||
};
|
||||
|
||||
_init.apply(this, Array.prototype.slice.apply(arguments));
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.initSearch = function () {
|
||||
_initSearch.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.reorderableRows) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Known issue after search if you reorder the rows the data is not display properly
|
||||
//isSearch = true;
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.makeRowsReorderable = function () {
|
||||
if (this.options.cardView) {
|
||||
return;
|
||||
}
|
||||
|
||||
var that = this;
|
||||
this.$el.tableDnD({
|
||||
onDragStyle: that.options.onDragStyle,
|
||||
onDropStyle: that.options.onDropStyle,
|
||||
onDragClass: that.options.onDragClass,
|
||||
onDrop: that.onDrop,
|
||||
onDragStart: that.options.onReorderRowsDrag,
|
||||
dragHandle: that.options.dragHandle
|
||||
});
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.onDrop = function (table, droppedRow) {
|
||||
var tableBs = $(table),
|
||||
tableBsData = tableBs.data('bootstrap.table'),
|
||||
tableBsOptions = tableBs.data('bootstrap.table').options,
|
||||
row = null,
|
||||
newData = [];
|
||||
|
||||
for (var i = 0; i < table.tBodies[0].rows.length; i++) {
|
||||
row = $(table.tBodies[0].rows[i]);
|
||||
newData.push(tableBsOptions.data[row.data('index')]);
|
||||
row.data('index', i).attr('data-index', i);
|
||||
}
|
||||
|
||||
tableBsOptions.data = tableBsOptions.data.slice(0, tableBsData.pageFrom - 1)
|
||||
.concat(newData)
|
||||
.concat(tableBsOptions.data.slice(tableBsData.pageTo));
|
||||
|
||||
//Call the user defined function
|
||||
tableBsOptions.onReorderRowsDrop.apply(table, [table, droppedRow]);
|
||||
|
||||
//Call the event reorder-row
|
||||
tableBsData.trigger('reorder-row', newData);
|
||||
};
|
||||
})(jQuery);
|
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* @author: Dennis Hernández
|
||||
* @webSite: http://djhvscf.github.io/Blog
|
||||
* @version: v1.0.0
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var initResizable = function (that) {
|
||||
//Deletes the plugin to re-create it
|
||||
that.$el.colResizable({disable: true});
|
||||
|
||||
//Creates the plugin
|
||||
that.$el.colResizable({
|
||||
liveDrag: that.options.liveDrag,
|
||||
fixed: that.options.fixed,
|
||||
headerOnly: that.options.headerOnly,
|
||||
minWidth: that.options.minWidth,
|
||||
hoverCursor: that.options.hoverCursor,
|
||||
dragCursor: that.options.dragCursor,
|
||||
onResize: that.onResize,
|
||||
onDrag: that.options.onResizableDrag,
|
||||
resizeMode: that.options.resizeMode
|
||||
});
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
resizable: false,
|
||||
liveDrag: true,
|
||||
fixed: false,
|
||||
headerOnly: false,
|
||||
minWidth: 15,
|
||||
hoverCursor: 'e-resize',
|
||||
dragCursor: 'e-resize',
|
||||
resizeMode: 'overflow',
|
||||
onResizableResize: function (e) {
|
||||
return false;
|
||||
},
|
||||
onResizableDrag: function (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_toggleView = BootstrapTable.prototype.toggleView,
|
||||
_resetView = BootstrapTable.prototype.resetView;
|
||||
|
||||
BootstrapTable.prototype.toggleView = function () {
|
||||
_toggleView.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (this.options.resizable && this.options.cardView) {
|
||||
//Deletes the plugin
|
||||
$(this.$el).colResizable({disable: true});
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.resetView = function () {
|
||||
var that = this;
|
||||
|
||||
_resetView.apply(this, Array.prototype.slice.apply(arguments));
|
||||
if (this.options.resizable) {
|
||||
// because in fitHeader function, we use setTimeout(func, 100);
|
||||
initResizable(that);
|
||||
setTimeout(function () {
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
BootstrapTable.prototype.onResize = function (e) {
|
||||
var that = $(e.currentTarget);
|
||||
that.bootstrapTable('resetView');
|
||||
that.data('bootstrap.table').options.onResizableResize.apply(e);
|
||||
}
|
||||
})(jQuery);
|
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @author vincent loh <vincent.ml@gmail.com>
|
||||
* @version: v1.0.0
|
||||
* https://github.com/vinzloh/bootstrap-table/
|
||||
* Sticky header for bootstrap-table
|
||||
*/
|
||||
|
||||
.fix-sticky {
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
}
|
||||
.fix-sticky thead {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.fix-sticky thead th,
|
||||
.fix-sticky thead th:first-child {
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
border-radius: 0;
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
/**
|
||||
* @author vincent loh <vincent.ml@gmail.com>
|
||||
* @version: v1.1.0
|
||||
* https://github.com/vinzloh/bootstrap-table/
|
||||
* Sticky header for bootstrap-table
|
||||
* @update J Manuel Corona <jmcg92@gmail.com>
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
||||
/*$.extend($.fn.bootstrapTable.defaults, {
|
||||
stickyHeader: false
|
||||
});*/
|
||||
|
||||
var bootstrapVersion = 3;
|
||||
try {
|
||||
bootstrapVersion = parseInt($.fn.dropdown.Constructor.VERSION, 10);
|
||||
} catch (e) { }
|
||||
var hidden_class = bootstrapVersion > 3 ? 'd-none' : 'hidden';
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_initHeader = BootstrapTable.prototype.initHeader;
|
||||
|
||||
BootstrapTable.prototype.initHeader = function () {
|
||||
var that = this;
|
||||
_initHeader.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (!this.options.stickyHeader) {
|
||||
return;
|
||||
}
|
||||
|
||||
var table = this.$tableBody.find('table'),
|
||||
table_id = table.attr('id'),
|
||||
header_id = table.attr('id') + '-sticky-header',
|
||||
sticky_header_container_id = header_id + '-sticky-header-container',
|
||||
anchor_begin_id = header_id + '_sticky_anchor_begin',
|
||||
anchor_end_id = header_id + '_sticky_anchor_end';
|
||||
// add begin and end anchors to track table position
|
||||
|
||||
table.before(sprintf('<div id="%s" class="%s"></div>', sticky_header_container_id, hidden_class));
|
||||
table.before(sprintf('<div id="%s"></div>', anchor_begin_id));
|
||||
table.after(sprintf('<div id="%s"></div>', anchor_end_id));
|
||||
|
||||
table.find('thead').attr('id', header_id);
|
||||
|
||||
// clone header just once, to be used as sticky header
|
||||
// deep clone header. using source header affects tbody>td width
|
||||
this.$stickyHeader = $($('#' + header_id).clone(true, true));
|
||||
// avoid id conflict
|
||||
this.$stickyHeader.removeAttr('id');
|
||||
|
||||
// render sticky on window scroll or resize
|
||||
$(window).on('resize.' + table_id, table, render_sticky_header);
|
||||
$(window).on('scroll.' + table_id, table, render_sticky_header);
|
||||
// render sticky when table scroll left-right
|
||||
table.closest('.fixed-table-container').find('.fixed-table-body').on('scroll.' + table_id, table, match_position_x);
|
||||
|
||||
this.$el.on('all.bs.table', function (e) {
|
||||
that.$stickyHeader = $($('#' + header_id).clone(true, true));
|
||||
that.$stickyHeader.removeAttr('id');
|
||||
});
|
||||
|
||||
function render_sticky_header(event) {
|
||||
var table = event.data;
|
||||
var table_header_id = table.find('thead').attr('id');
|
||||
// console.log('render_sticky_header for > '+table_header_id);
|
||||
if (table.length < 1 || $('#' + table_id).length < 1) {
|
||||
// turn off window listeners
|
||||
$(window).off('resize.' + table_id);
|
||||
$(window).off('scroll.' + table_id);
|
||||
table.closest('.fixed-table-container').find('.fixed-table-body').off('scroll.' + table_id);
|
||||
return;
|
||||
}
|
||||
// get header height
|
||||
var header_height = '0';
|
||||
if (that.options.stickyHeaderOffsetY) header_height = that.options.stickyHeaderOffsetY.replace('px', '');
|
||||
// window scroll top
|
||||
var t = $(window).scrollTop();
|
||||
// top anchor scroll position, minus header height
|
||||
var e = $("#" + anchor_begin_id)[0] ? $("#" + anchor_begin_id).offset().top - header_height : 0;
|
||||
// bottom anchor scroll position, minus header height, minus sticky height
|
||||
var e_end = $("#" + anchor_end_id).offset().top - header_height - $('#' + table_header_id).css('height').replace('px', '');
|
||||
// show sticky when top anchor touches header, and when bottom anchor not exceeded
|
||||
if (t > e && t <= e_end) {
|
||||
// ensure clone and source column widths are the same
|
||||
$.each(that.$stickyHeader.find('tr').eq(0).find('th'), function (index, item) {
|
||||
$(item).css('min-width', $('#' + table_header_id + ' tr').eq(0).find('th').eq(index).css('width'));
|
||||
});
|
||||
// match bootstrap table style
|
||||
$("#" + sticky_header_container_id).removeClass(hidden_class).addClass("fix-sticky fixed-table-container");
|
||||
// stick it in position
|
||||
$("#" + sticky_header_container_id).css('top', header_height + 'px').css('display', 'none');
|
||||
// create scrollable container for header
|
||||
var scrollable_div = $('<div style="position:absolute;width:100%;overflow-x:hidden;" />');
|
||||
// append cloned header to dom
|
||||
$("#" + sticky_header_container_id).html(scrollable_div.append(that.$stickyHeader));
|
||||
// match clone and source header positions when left-right scroll
|
||||
match_position_x(event);
|
||||
} else {
|
||||
// hide sticky
|
||||
$("#" + sticky_header_container_id).removeClass("fix-sticky").addClass(hidden_class);
|
||||
}
|
||||
|
||||
}
|
||||
function match_position_x(event) {
|
||||
var table = event.data;
|
||||
var table_header_id = table.find('thead').attr('id');
|
||||
// match clone and source header positions when left-right scroll
|
||||
$("#" + sticky_header_container_id).css(
|
||||
'width', +table.closest('.fixed-table-body').css('width').replace('px', '') + 1
|
||||
);
|
||||
$("#" + sticky_header_container_id + " thead").parent().scrollLeft(Math.abs($('#' + table_header_id).position().left));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BootstrapTable.prototype.fitHeader = function () {
|
||||
var that = this,
|
||||
fixedBody,
|
||||
scrollWidth,
|
||||
focused,
|
||||
focusedTemp;
|
||||
|
||||
if (that.$el.is(':hidden')) {
|
||||
that.timeoutId_ = setTimeout($.proxy(that.fitHeader, that), 100);
|
||||
return;
|
||||
}
|
||||
fixedBody = this.$tableBody.get(0);
|
||||
//解决固定表头时表格高度溢出
|
||||
if (this.options.stickyHeader) {
|
||||
$(fixedBody).css('height', '90%');
|
||||
}
|
||||
scrollWidth = $(fixedBody).prop("scrollWidth") > fixedBody.clientWidth &&
|
||||
$(fixedBody).prop("scrollHeight") > fixedBody.clientHeight + this.$header.outerHeight() ?
|
||||
getScrollBarWidth() : 0;
|
||||
//将原有的表头展现出来
|
||||
if (this.options.stickyHeader) {
|
||||
this.$el.css('margin-top', -this.$header.outerHeight());
|
||||
}
|
||||
|
||||
focused = $(':focus');
|
||||
if (focused.length > 0) {
|
||||
var $th = focused.parents('th');
|
||||
if ($th.length > 0) {
|
||||
var dataField = $th.attr('data-field');
|
||||
if (dataField !== undefined) {
|
||||
var $headerTh = this.$header.find("[data-field='" + dataField + "']");
|
||||
if ($headerTh.length > 0) {
|
||||
$headerTh.find(":input").addClass("focus-temp");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$header_ = this.$header.clone(true, true);
|
||||
this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
|
||||
//删除多余的表头
|
||||
if (this.options.stickyHeader) {
|
||||
this.$tableHeader.css({
|
||||
'margin-right': scrollWidth
|
||||
}).find('table').css('width', this.$el.outerWidth())
|
||||
.html('').attr('class', this.$el.attr('class'))
|
||||
.append(this.$header_);
|
||||
}
|
||||
|
||||
|
||||
focusedTemp = $('.focus-temp:visible:eq(0)');
|
||||
if (focusedTemp.length > 0) {
|
||||
focusedTemp.focus();
|
||||
this.$header.find('.focus-temp').removeClass('focus-temp');
|
||||
}
|
||||
|
||||
// fix bug: $.data() is not working as expected after $.append()
|
||||
this.$header.find('th[data-field]').each(function (i) {
|
||||
that.$header_.find(sprintf('th[data-field="%s"]', $(this).data('field'))).data($(this).data());
|
||||
});
|
||||
|
||||
var visibleFields = this.getVisibleFields(),
|
||||
$ths = this.$header_.find('th');
|
||||
|
||||
this.$body.find('>tr:first-child:not(.no-records-found) > *').each(function (i) {
|
||||
var $this = $(this),
|
||||
index = i;
|
||||
|
||||
if (that.options.detailView && !that.options.cardView) {
|
||||
if (i === 0) {
|
||||
that.$header_.find('th.detail').find('.fht-cell').width($this.innerWidth());
|
||||
}
|
||||
index = i - 1;
|
||||
}
|
||||
|
||||
var $th = that.$header_.find(sprintf('th[data-field="%s"]', visibleFields[index]));
|
||||
if ($th.length > 1) {
|
||||
$th = $($ths[$this[0].cellIndex]);
|
||||
}
|
||||
|
||||
$th.find('.fht-cell').width($this.innerWidth());
|
||||
});
|
||||
// horizontal scroll event
|
||||
// TODO: it's probably better improving the layout than binding to scroll event
|
||||
this.$tableBody.off('scroll').on('scroll', function () {
|
||||
that.$tableHeader.scrollLeft($(this).scrollLeft());
|
||||
|
||||
if (that.options.showFooter && !that.options.cardView) {
|
||||
that.$tableFooter.scrollLeft($(this).scrollLeft());
|
||||
}
|
||||
});
|
||||
that.trigger('post-header');
|
||||
};
|
||||
|
||||
var cachedWidth = null;
|
||||
var getScrollBarWidth = function () {
|
||||
if (cachedWidth === null) {
|
||||
var inner = $('<p/>').addClass('fixed-table-scroll-inner'),
|
||||
outer = $('<div/>').addClass('fixed-table-scroll-outer'),
|
||||
w1, w2;
|
||||
|
||||
outer.append(inner);
|
||||
$('body').append(outer);
|
||||
|
||||
w1 = inner[0].offsetWidth;
|
||||
outer.css('overflow', 'scroll');
|
||||
w2 = inner[0].offsetWidth;
|
||||
|
||||
if (w1 === w2) {
|
||||
w2 = outer[0].clientWidth;
|
||||
}
|
||||
|
||||
outer.remove();
|
||||
cachedWidth = w1 - w2;
|
||||
}
|
||||
return cachedWidth;
|
||||
};
|
||||
})(jQuery);
|
@ -0,0 +1,434 @@
|
||||
/**
|
||||
_ _____ _ _ _
|
||||
| | __ \ (_) | | | |
|
||||
___ ___ | | |__) |___ ___ _ ______ _| |__ | | ___
|
||||
/ __/ _ \| | _ // _ \/ __| |_ / _` | '_ \| |/ _ \
|
||||
| (_| (_) | | | \ \ __/\__ \ |/ / (_| | |_) | | __/
|
||||
\___\___/|_|_| \_\___||___/_/___\__,_|_.__/|_|\___|
|
||||
|
||||
v1.6 - jQuery plugin created by Alvaro Prieto Lauroba
|
||||
|
||||
Licences: MIT & GPL
|
||||
Feel free to use or modify this plugin as far as my full name is kept
|
||||
|
||||
If you are going to use this plug-in in production environments it is
|
||||
strongly recommended to use its minified version: colResizable.min.js
|
||||
|
||||
*/
|
||||
|
||||
(function($){
|
||||
|
||||
var d = $(document); //window object
|
||||
var h = $("head"); //head object
|
||||
var drag = null; //reference to the current grip that is being dragged
|
||||
var tables = {}; //object of the already processed tables (table.id as key)
|
||||
var count = 0; //internal count to create unique IDs when needed.
|
||||
var widths = [];
|
||||
|
||||
//common strings for packing
|
||||
var ID = "id";
|
||||
var PX = "px";
|
||||
var SIGNATURE ="JColResizer";
|
||||
var FLEX = "JCLRFlex";
|
||||
|
||||
//short-cuts
|
||||
var I = parseInt;
|
||||
var M = Math;
|
||||
var ie = navigator.userAgent.indexOf('Trident/4.0')>0;
|
||||
var S;
|
||||
try{S = sessionStorage;}catch(e){} //Firefox crashes when executed as local file system
|
||||
|
||||
//append required CSS rules
|
||||
h.append("<style type='text/css'> .JColResizer{table-layout:fixed;} .JColResizer > tbody > tr > td, .JColResizer > tbody > tr > th{overflow:hidden;/*padding-left:0!important; padding-right:0!important;*/} .JCLRgrips{ height:0px; position:relative;} .JCLRgrip{margin-left:-5px; position:absolute; z-index:5; } .JCLRgrip .JColResizer{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;cursor: e-resize;top:0px} .JCLRLastGrip{position:absolute; width:1px; } .JCLRgripDrag{ border-left:1px dotted black; } .JCLRFlex{width:auto!important;} .JCLRgrip.JCLRdisabledGrip .JColResizer{cursor:default; display:none;}</style>");
|
||||
|
||||
|
||||
/**
|
||||
* Function to allow column resizing for table objects. It is the starting point to apply the plugin.
|
||||
* @param {DOM node} tb - reference to the DOM table object to be enhanced
|
||||
* @param {Object} options - some customization values
|
||||
*/
|
||||
var init = function( tb, options){
|
||||
var t = $(tb); //the table object is wrapped
|
||||
t.opt = options; //each table has its own options available at anytime
|
||||
t.mode = options.resizeMode; //shortcuts
|
||||
t.dc = t.opt.disabledColumns;
|
||||
if(t.opt.disable) return destroy(t); //the user is asking to destroy a previously colResized table
|
||||
var id = t.id = t.attr(ID) || SIGNATURE+count++; //its id is obtained, if null new one is generated
|
||||
t.p = t.opt.postbackSafe; //short-cut to detect postback safe
|
||||
if(!t.is("table") || tables[id] && !t.opt.partialRefresh) return; //if the object is not a table or if it was already processed then it is ignored.
|
||||
if (t.opt.hoverCursor !== 'e-resize') h.append("<style type='text/css'>.JCLRgrip .JColResizer:hover{cursor:"+ t.opt.hoverCursor +"!important}</style>"); //if hoverCursor has been set, append the style
|
||||
|
||||
var oriWidth = t.width() + 50;
|
||||
var th = t.find(">thead>tr:first>th,>thead>tr:first>td"); //table headers are obtained
|
||||
if(!th.length) th = t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td"); //but headers can also be included in different ways
|
||||
th = th.filter(":visible"); //filter invisible columns
|
||||
widths = [];
|
||||
th.each(function(i){ //iterate through the table column headers
|
||||
var c = $(this); //jquery wrap for the current column
|
||||
widths.push(I(c.width())/I(t.width()));
|
||||
});
|
||||
|
||||
t.addClass(SIGNATURE).attr(ID, id).before('<div class="JCLRgrips"/>'); //the grips container object is added. Signature class forces table rendering in fixed-layout mode to prevent column's min-width
|
||||
t.g = []; t.c = []; t.w = t.width(); t.gc = t.prev(); t.f=t.opt.fixed; //t.c and t.g are arrays of columns and grips respectively
|
||||
if(options.marginLeft) t.gc.css("marginLeft", options.marginLeft); //if the table contains margins, it must be specified
|
||||
if(options.marginRight) t.gc.css("marginRight", options.marginRight); //since there is no (direct) way to obtain margin values in its original units (%, em, ...)
|
||||
t.cs = I(ie? tb.cellSpacing || tb.currentStyle.borderSpacing :t.css('border-spacing'))||2; //table cellspacing (not even jQuery is fully cross-browser)
|
||||
t.b = I(ie? tb.border || tb.currentStyle.borderLeftWidth :t.css('border-left-width'))||1; //outer border width (again cross-browser issues)
|
||||
// if(!(tb.style.width || tb.width)) t.width(t.width()); //I am not an IE fan at all, but it is a pity that only IE has the currentStyle attribute working as expected. For this reason I can not check easily if the table has an explicit width or if it is rendered as "auto"
|
||||
tables[id] = t; //the table object is stored using its id as key
|
||||
createGrips(t); //grips are created
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This function allows to remove any enhancements performed by this plugin on a previously processed table.
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var destroy = function(t){
|
||||
var id=t.attr(ID), t=tables[id]; //its table object is found
|
||||
if(!t||!t.is("table")) return; //if none, then it wasn't processed
|
||||
t.removeClass(SIGNATURE+" "+FLEX).gc.remove(); //class and grips are removed
|
||||
delete tables[id]; //clean up data
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function to create all the grips associated with the table given by parameters
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var createGrips = function(t){
|
||||
|
||||
var th = t.find(">thead>tr:first>th,>thead>tr:first>td"); //table headers are obtained
|
||||
if(!th.length) th = t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td"); //but headers can also be included in different ways
|
||||
th = th.filter(":visible"); //filter invisible columns
|
||||
t.cg = t.find("col"); //a table can also contain a colgroup with col elements
|
||||
t.ln = th.length; //table length is stored
|
||||
if(t.p && S && S[t.id])memento(t,th); //if 'postbackSafe' is enabled and there is data for the current table, its coloumn layout is restored
|
||||
th.each(function(i){ //iterate through the table column headers
|
||||
var c = $(this); //jquery wrap for the current column
|
||||
var dc = t.dc.indexOf(i)!=-1; //is this a disabled column?
|
||||
var g = $(t.gc.append('<div class="JCLRgrip"></div>')[0].lastChild); //add the visual node to be used as grip
|
||||
g.append(dc ? "": t.opt.gripInnerHtml).append('<div class="'+SIGNATURE+'"></div>');
|
||||
if(i == t.ln-1){ //if the current grip is the las one
|
||||
g.addClass("JCLRLastGrip"); //add a different css class to stlye it in a different way if needed
|
||||
// if(t.f) g.html(""); //if the table resizing mode is set to fixed, the last grip is removed since table with can not change
|
||||
}
|
||||
g.bind('touchstart mousedown', onGripMouseDown); //bind the mousedown event to start dragging
|
||||
|
||||
if (!dc){
|
||||
//if normal column bind the mousedown event to start dragging, if disabled then apply its css class
|
||||
g.removeClass('JCLRdisabledGrip').bind('touchstart mousedown', onGripMouseDown);
|
||||
}else{
|
||||
g.addClass('JCLRdisabledGrip');
|
||||
}
|
||||
|
||||
g.t = t; g.i = i; g.c = c; c.w =c.width(); /*c.w =widths[i]*t.width();*/ //some values are stored in the grip's node data as shortcut
|
||||
t.g.push(g); t.c.push(c); //the current grip and column are added to its table object
|
||||
c.width(c.w).removeAttr("width"); //the width of the column is converted into pixel-based measurements
|
||||
g.data(SIGNATURE, {i:i, t:t.attr(ID), last: i == t.ln-1}); //grip index and its table name are stored in the HTML
|
||||
});
|
||||
t.cg.removeAttr("width"); //remove the width attribute from elements in the colgroup
|
||||
|
||||
t.find('td, th').not(th).not('table th, table td').each(function(){
|
||||
$(this).removeAttr('width'); //the width attribute is removed from all table cells which are not nested in other tables and dont belong to the header
|
||||
});
|
||||
if(!t.f){
|
||||
// t.removeAttr('width').addClass(FLEX); //if not fixed, let the table grow as needed
|
||||
}
|
||||
syncGrips(t); //the grips are positioned according to the current table layout
|
||||
//there is a small problem, some cells in the table could contain dimension values interfering with the
|
||||
//width value set by this plugin. Those values are removed
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function to allow the persistence of columns dimensions after a browser postback. It is based in
|
||||
* the HTML5 sessionStorage object, which can be emulated for older browsers using sessionstorage.js
|
||||
* @param {jQuery ref} t - table object
|
||||
* @param {jQuery ref} th - reference to the first row elements (only set in deserialization)
|
||||
*/
|
||||
var memento = function(t, th){
|
||||
var w,m=0,i=0,aux =[],tw;
|
||||
if(th){ //in deserialization mode (after a postback)
|
||||
t.cg.removeAttr("width");
|
||||
if(t.opt.flush){ S[t.id] =""; return;} //if flush is activated, stored data is removed
|
||||
w = S[t.id].split(";"); //column widths is obtained
|
||||
tw = w[t.ln+1];
|
||||
if(!t.f && tw){ //if not fixed and table width data available its size is restored
|
||||
t.width(tw*=1);
|
||||
if(t.opt.overflow) { //if overfolw flag is set, restore table width also as table min-width
|
||||
t.css('min-width', tw + PX);
|
||||
t.w = tw;
|
||||
}
|
||||
}
|
||||
for(;i<t.ln;i++){ //for each column
|
||||
aux.push(100*w[i]/w[t.ln]+"%"); //width is stored in an array since it will be required again a couple of lines ahead
|
||||
th.eq(i).css("width", aux[i] ); //each column width in % is restored
|
||||
}
|
||||
for(i=0;i<t.ln;i++)
|
||||
t.cg.eq(i).css("width", aux[i]); //this code is required in order to create an inline CSS rule with higher precedence than an existing CSS class in the "col" elements
|
||||
}else{ //in serialization mode (after resizing a column)
|
||||
S[t.id] =""; //clean up previous data
|
||||
for(;i < t.c.length; i++){ //iterate through columns
|
||||
w = t.c[i].width(); //width is obtained
|
||||
S[t.id] += w+";"; //width is appended to the sessionStorage object using ID as key
|
||||
m+=w; //carriage is updated to obtain the full size used by columns
|
||||
}
|
||||
S[t.id]+=m; //the last item of the serialized string is the table's active area (width),
|
||||
//to be able to obtain % width value of each columns while deserializing
|
||||
if(!t.f) S[t.id] += ";"+t.width(); //if not fixed, table width is stored
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function that places each grip in the correct position according to the current table layout
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var syncGrips = function (t){
|
||||
t.gc.width(t.w); //the grip's container width is updated
|
||||
for(var i=0; i<t.ln; i++){ //for each column
|
||||
var c = t.c[i];
|
||||
console.log("c.offset().left----"+c.offset().left)
|
||||
console.log("t.offset().left-----"+t.offset().left)
|
||||
console.log("c.outerWidth(false)-----"+c.outerWidth(false))
|
||||
console.log("t.cs-----"+t.cs)
|
||||
console.log(c.offset().left - t.offset().left + c.outerWidth(false) + t.cs / 2 + PX)
|
||||
t.g[i].css({ //height and position of the grip is updated according to the table layout
|
||||
left: c.offset().left - t.offset().left + c.outerWidth(false) + t.cs / 2 + PX,
|
||||
height: t.opt.headerOnly? t.c[0].outerHeight(false) : t.outerHeight(false)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This function updates column's width according to the horizontal position increment of the grip being
|
||||
* dragged. The function can be called while dragging if liveDragging is enabled and also from the onGripDragOver
|
||||
* event handler to synchronize grip's position with their related columns.
|
||||
* @param {jQuery ref} t - table object
|
||||
* @param {number} i - index of the grip being dragged
|
||||
* @param {bool} isOver - to identify when the function is being called from the onGripDragOver event
|
||||
*/
|
||||
var syncCols = function(t,i,isOver){
|
||||
var inc = drag.x-drag.l, c = t.c[i], c2 = t.c[i+1];
|
||||
var w = c.w + inc; var w2= c2.w- inc; //their new width is obtained
|
||||
c.width( w + PX);
|
||||
t.cg.eq(i).width( w + PX);
|
||||
if(t.f){ //if fixed mode
|
||||
c2.width(w2 + PX);
|
||||
t.cg.eq(i+1).width( w2 + PX);
|
||||
}else if(t.opt.overflow) { //if overflow is set, incriment min-width to force overflow
|
||||
c2.width(w2 + PX);
|
||||
t.cg.eq(i+1).width( w2 + PX);
|
||||
// t.css('min-width', t.w + inc);
|
||||
}
|
||||
if(isOver){
|
||||
c.w=w;
|
||||
c2.w= t.f ? w2 : c2.w;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This function updates all columns width according to its real width. It must be taken into account that the
|
||||
* sum of all columns can exceed the table width in some cases (if fixed is set to false and table has some kind
|
||||
* of max-width).
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var applyBounds = function(t){
|
||||
var w = $.map(t.c, function(c){ //obtain real widths
|
||||
return c.width();
|
||||
});
|
||||
// t.width(t.w = t.width()).removeClass(FLEX); //prevent table width changes
|
||||
$.each(t.c, function(i,c){
|
||||
c.width(w[i]).w = w[i]; //set column widths applying bounds (table's max-width)
|
||||
});
|
||||
// t.addClass(FLEX); //allow table width changes
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler used while dragging a grip. It checks if the next grip's position is valid and updates it.
|
||||
* @param {event} e - mousemove event binded to the window object
|
||||
*/
|
||||
var onGripDrag = function(e){
|
||||
if(!drag) return;
|
||||
var t = drag.t; //table object reference
|
||||
var oe = e.originalEvent.touches;
|
||||
var ox = oe ? oe[0].pageX : e.pageX; //original position (touch or mouse)
|
||||
var x = ox - drag.ox + drag.l; //next position according to horizontal mouse position increment
|
||||
var mw = t.opt.minWidth, i = drag.i ; //cell's min width
|
||||
var l = t.cs*1.5 + mw + t.b;
|
||||
var last = i == t.ln-1; //check if it is the last column's grip (usually hidden)
|
||||
var min = i? t.g[i-1].position().left+t.cs+mw: l; //min position according to the contiguous cells
|
||||
var max = t.f ? //fixed mode?
|
||||
i == t.ln-1?
|
||||
t.w-l:
|
||||
t.g[i+1].position().left-t.cs-mw:
|
||||
Infinity; //max position according to the contiguous cells
|
||||
x = M.max(min, M.min(max, x)); //apply bounding
|
||||
drag.x = x; drag.css("left", x + PX); //apply position increment
|
||||
if(last){ //if it is the last grip
|
||||
var c = t.c[drag.i]; //width of the last column is obtained
|
||||
drag.w = c.w + x- drag.l;
|
||||
}
|
||||
if(t.opt.liveDrag){ //if liveDrag is enabled
|
||||
if(last){
|
||||
c.width(drag.w);
|
||||
if(!t.f && t.opt.overflow){ //if overflow is set, incriment min-width to force overflow
|
||||
t.css('min-width', t.w + x - drag.l);
|
||||
}else {
|
||||
t.w = t.width();
|
||||
}
|
||||
}else{
|
||||
syncCols(t,i); //columns are synchronized
|
||||
}
|
||||
syncGrips(t);
|
||||
var cb = t.opt.onDrag; //check if there is an onDrag callback
|
||||
if (cb) { e.currentTarget = t[0]; cb(e); } //if any, it is fired
|
||||
}
|
||||
return false; //prevent text selection while dragging
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler fired when the dragging is over, updating table layout
|
||||
* @param {event} e - grip's drag over event
|
||||
*/
|
||||
var onGripDragOver = function(e){
|
||||
|
||||
d.unbind('touchend.'+SIGNATURE+' mouseup.'+SIGNATURE).unbind('touchmove.'+SIGNATURE+' mousemove.'+SIGNATURE);
|
||||
$("head :last-child").remove(); //remove the dragging cursor style
|
||||
if(!drag) return;
|
||||
drag.removeClass(drag.t.opt.draggingClass); //remove the grip's dragging css-class
|
||||
if (!(drag.x - drag.l == 0)) {
|
||||
var t = drag.t;
|
||||
var cb = t.opt.onResize; //get some values
|
||||
var i = drag.i; //column index
|
||||
var last = i == t.ln-1; //check if it is the last column's grip (usually hidden)
|
||||
var c = t.g[i].c; //the column being dragged
|
||||
if(last){
|
||||
c.width(drag.w);
|
||||
c.w = drag.w;
|
||||
}else{
|
||||
syncCols(t, i, true); //the columns are updated
|
||||
}
|
||||
// if(!t.f) applyBounds(t); //if not fixed mode, then apply bounds to obtain real width values
|
||||
syncGrips(t); //the grips are updated
|
||||
if (cb) { e.currentTarget = t[0]; cb(e); } //if there is a callback function, it is fired
|
||||
if(t.p && S) memento(t); //if postbackSafe is enabled and there is sessionStorage support, the new layout is serialized and stored
|
||||
}
|
||||
drag = null; //since the grip's dragging is over
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler fired when the grip's dragging is about to start. Its main goal is to set up events
|
||||
* and store some values used while dragging.
|
||||
* @param {event} e - grip's mousedown event
|
||||
*/
|
||||
var onGripMouseDown = function(e){
|
||||
var o = $(this).data(SIGNATURE); //retrieve grip's data
|
||||
var t = tables[o.t], g = t.g[o.i]; //shortcuts for the table and grip objects
|
||||
var oe = e.originalEvent.touches; //touch or mouse event?
|
||||
g.ox = oe? oe[0].pageX: e.pageX; //the initial position is kept
|
||||
g.l = g.position().left;
|
||||
g.x = g.l;
|
||||
|
||||
d.bind('touchmove.'+SIGNATURE+' mousemove.'+SIGNATURE, onGripDrag ).bind('touchend.'+SIGNATURE+' mouseup.'+SIGNATURE, onGripDragOver); //mousemove and mouseup events are bound
|
||||
h.append("<style type='text/css'>*{cursor:"+ t.opt.dragCursor +"!important}</style>"); //change the mouse cursor
|
||||
g.addClass(t.opt.draggingClass); //add the dragging class (to allow some visual feedback)
|
||||
drag = g; //the current grip is stored as the current dragging object
|
||||
if(t.c[o.i].l) for(var i=0,c; i<t.ln; i++){ c=t.c[i]; c.l = false; c.w= c.width(); } //if the colum is locked (after browser resize), then c.w must be updated
|
||||
return false; //prevent text selection
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler fired when the browser is resized. The main purpose of this function is to update
|
||||
* table layout according to the browser's size synchronizing related grips
|
||||
*/
|
||||
var onResize = function(){
|
||||
for(var t in tables){
|
||||
if( tables.hasOwnProperty( t ) ) {
|
||||
t = tables[t];
|
||||
var i, mw=0;
|
||||
t.removeClass(SIGNATURE); //firefox doesn't like layout-fixed in some cases
|
||||
if (t.f) { //in fixed mode
|
||||
t.w = t.width(); //its new width is kept
|
||||
for(i=0; i<t.ln; i++) mw+= t.c[i].w;
|
||||
//cell rendering is not as trivial as it might seem, and it is slightly different for
|
||||
//each browser. In the beginning i had a big switch for each browser, but since the code
|
||||
//was extremely ugly now I use a different approach with several re-flows. This works
|
||||
//pretty well but it's a bit slower. For now, lets keep things simple...
|
||||
for(i=0; i<t.ln; i++) t.c[i].css("width", M.round(1000*t.c[i].w/mw)/10 + "%").l=true;
|
||||
//c.l locks the column, telling us that its c.w is outdated
|
||||
}else{ //in non fixed-sized tables
|
||||
applyBounds(t); //apply the new bounds
|
||||
if(t.mode == 'flex' && t.p && S){ //if postbackSafe is enabled and there is sessionStorage support,
|
||||
memento(t); //the new layout is serialized and stored for 'flex' tables
|
||||
}
|
||||
}
|
||||
syncGrips(t.addClass(SIGNATURE));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//bind resize event, to update grips position
|
||||
$(window).bind('resize.'+SIGNATURE, onResize);
|
||||
|
||||
|
||||
/**
|
||||
* The plugin is added to the jQuery library
|
||||
* @param {Object} options - an object that holds some basic customization values
|
||||
*/
|
||||
$.fn.extend({
|
||||
colResizable: function(options) {
|
||||
var defaults = {
|
||||
|
||||
//attributes:
|
||||
|
||||
resizeMode: 'fit', //mode can be 'fit', 'flex' or 'overflow'
|
||||
draggingClass: 'JCLRgripDrag', //css-class used when a grip is being dragged (for visual feedback purposes)
|
||||
gripInnerHtml: '', //if it is required to use a custom grip it can be done using some custom HTML
|
||||
liveDrag: false, //enables table-layout updating while dragging
|
||||
minWidth: 15, //minimum width value in pixels allowed for a column
|
||||
headerOnly: false, //specifies that the size of the the column resizing anchors will be bounded to the size of the first row
|
||||
hoverCursor: "e-resize", //cursor to be used on grip hover
|
||||
dragCursor: "e-resize", //cursor to be used while dragging
|
||||
postbackSafe: false, //when it is enabled, table layout can persist after postback or page refresh. It requires browsers with sessionStorage support (it can be emulated with sessionStorage.js).
|
||||
flush: false, //when postbakSafe is enabled, and it is required to prevent layout restoration after postback, 'flush' will remove its associated layout data
|
||||
marginLeft: null, //in case the table contains any margins, colResizable needs to know the values used, e.g. "10%", "15em", "5px" ...
|
||||
marginRight: null, //in case the table contains any margins, colResizable needs to know the values used, e.g. "10%", "15em", "5px" ...
|
||||
disable: false, //disables all the enhancements performed in a previously colResized table
|
||||
partialRefresh: false, //can be used in combination with postbackSafe when the table is inside of an updatePanel,
|
||||
disabledColumns: [], //column indexes to be excluded
|
||||
|
||||
//events:
|
||||
onDrag: null, //callback function to be fired during the column resizing process if liveDrag is enabled
|
||||
onResize: null //callback function fired when the dragging process is over
|
||||
}
|
||||
var options = $.extend(defaults, options);
|
||||
|
||||
//since now there are 3 different ways of resizing columns, I changed the external interface to make it clear
|
||||
//calling it 'resizeMode' but also to remove the "fixed" attribute which was confusing for many people
|
||||
options.fixed = true;
|
||||
options.overflow = false;
|
||||
switch(options.resizeMode){
|
||||
case 'flex': options.fixed = false; break;
|
||||
case 'overflow': options.fixed = false; options.overflow = true; break;
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
init( this, options);
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
@ -0,0 +1,430 @@
|
||||
/**
|
||||
_ _____ _ _ _
|
||||
| | __ \ (_) | | | |
|
||||
___ ___ | | |__) |___ ___ _ ______ _| |__ | | ___
|
||||
/ __/ _ \| | _ // _ \/ __| |_ / _` | '_ \| |/ _ \
|
||||
| (_| (_) | | | \ \ __/\__ \ |/ / (_| | |_) | | __/
|
||||
\___\___/|_|_| \_\___||___/_/___\__,_|_.__/|_|\___|
|
||||
|
||||
v1.6 - jQuery plugin created by Alvaro Prieto Lauroba
|
||||
|
||||
Licences: MIT & GPL
|
||||
Feel free to use or modify this plugin as far as my full name is kept
|
||||
|
||||
If you are going to use this plug-in in production environments it is
|
||||
strongly recommended to use its minified version: colResizable.min.js
|
||||
|
||||
*/
|
||||
|
||||
(function($){
|
||||
|
||||
var d = $(document); //window object
|
||||
var h = $("head"); //head object
|
||||
var drag = null; //reference to the current grip that is being dragged
|
||||
var tables = {}; //object of the already processed tables (table.id as key)
|
||||
var widths = [];
|
||||
var count = 0; //internal count to create unique IDs when needed.
|
||||
|
||||
//common strings for packing
|
||||
var ID = "id";
|
||||
var PX = "px";
|
||||
var SIGNATURE ="JColResizer";
|
||||
var FLEX = "JCLRFlex";
|
||||
|
||||
//short-cuts
|
||||
var I = parseInt;
|
||||
var M = Math;
|
||||
var ie = navigator.userAgent.indexOf('Trident/4.0')>0;
|
||||
var S;
|
||||
try{S = sessionStorage;}catch(e){} //Firefox crashes when executed as local file system
|
||||
|
||||
//append required CSS rules
|
||||
h.append("<style type='text/css'> .JColResizer{table-layout:fixed;} .JColResizer > tbody > tr > td, .JColResizer > tbody > tr > th{overflow:hidden;/*padding-left:0!important; padding-right:0!important;*/} .JCLRgrips{ height:0px; position:relative;} .JCLRgrip{margin-left:-5px; position:absolute; z-index:5; } .JCLRgrip .JColResizer{position:absolute;background-color:red;filter:alpha(opacity=1);opacity:0;width:10px;height:100%;cursor: e-resize;top:0px} .JCLRLastGrip{position:absolute; width:1px; } .JCLRgripDrag{ border-left:1px dotted black; } .JCLRFlex{width:auto!important;} .JCLRgrip.JCLRdisabledGrip .JColResizer{cursor:default; display:none;}</style>");
|
||||
|
||||
|
||||
/**
|
||||
* Function to allow column resizing for table objects. It is the starting point to apply the plugin.
|
||||
* @param {DOM node} tb - reference to the DOM table object to be enhanced
|
||||
* @param {Object} options - some customization values
|
||||
*/
|
||||
var init = function( tb, options){
|
||||
var t = $(tb); //the table object is wrapped
|
||||
t.opt = options; //each table has its own options available at anytime
|
||||
t.mode = options.resizeMode; //shortcuts
|
||||
t.dc = t.opt.disabledColumns;
|
||||
if(t.opt.disable) return destroy(t); //the user is asking to destroy a previously colResized table
|
||||
var id = t.id = t.attr(ID) || SIGNATURE+count++; //its id is obtained, if null new one is generated
|
||||
t.p = t.opt.postbackSafe; //short-cut to detect postback safe
|
||||
if(!t.is("table") || tables[id] && !t.opt.partialRefresh) return; //if the object is not a table or if it was already processed then it is ignored.
|
||||
if (t.opt.hoverCursor !== 'e-resize') h.append("<style type='text/css'>.JCLRgrip .JColResizer:hover{cursor:"+ t.opt.hoverCursor +"!important}</style>"); //if hoverCursor has been set, append the style
|
||||
console.log(t.width())
|
||||
var oriWidth = t.width() + 50;
|
||||
var th = t.find(">thead>tr:first>th,>thead>tr:first>td"); //table headers are obtained
|
||||
if(!th.length) th = t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td"); //but headers can also be included in different ways
|
||||
th = th.filter(":visible"); //filter invisible columns
|
||||
widths = [];
|
||||
th.each(function(i){ //iterate through the table column headers
|
||||
var c = $(this); //jquery wrap for the current column
|
||||
widths.push(I(c.width())/I(t.width()));
|
||||
});
|
||||
console.log(widths)
|
||||
|
||||
|
||||
t.addClass(SIGNATURE).attr(ID, id).before('<div class="JCLRgrips"/>'); //the grips container object is added. Signature class forces table rendering in fixed-layout mode to prevent column's min-width
|
||||
t.g = []; t.c = []; t.w = oriWidth; t.width(oriWidth); t.gc = t.prev(); t.f=t.opt.fixed; //t.c and t.g are arrays of columns and grips respectively
|
||||
if(options.marginLeft) t.gc.css("marginLeft", options.marginLeft); //if the table contains margins, it must be specified
|
||||
if(options.marginRight) t.gc.css("marginRight", options.marginRight); //since there is no (direct) way to obtain margin values in its original units (%, em, ...)
|
||||
t.cs = I(ie? tb.cellSpacing || tb.currentStyle.borderSpacing :t.css('border-spacing'))||2; //table cellspacing (not even jQuery is fully cross-browser)
|
||||
t.b = I(ie? tb.border || tb.currentStyle.borderLeftWidth :t.css('border-left-width'))||1; //outer border width (again cross-browser issues)
|
||||
// if(!(tb.style.width || tb.width)) t.width(t.width()); //I am not an IE fan at all, but it is a pity that only IE has the currentStyle attribute working as expected. For this reason I can not check easily if the table has an explicit width or if it is rendered as "auto"
|
||||
tables[id] = t; //the table object is stored using its id as key
|
||||
createGrips(t); //grips are created
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This function allows to remove any enhancements performed by this plugin on a previously processed table.
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var destroy = function(t){
|
||||
var id=t.attr(ID), t=tables[id]; //its table object is found
|
||||
if(!t||!t.is("table")) return; //if none, then it wasn't processed
|
||||
t.removeClass(SIGNATURE+" "+FLEX).gc.remove(); //class and grips are removed
|
||||
delete tables[id]; //clean up data
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function to create all the grips associated with the table given by parameters
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var createGrips = function(t){
|
||||
|
||||
var th = t.find(">thead>tr:first>th,>thead>tr:first>td"); //table headers are obtained
|
||||
if(!th.length) th = t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td"); //but headers can also be included in different ways
|
||||
th = th.filter(":visible"); //filter invisible columns
|
||||
t.cg = t.find("col"); //a table can also contain a colgroup with col elements
|
||||
t.ln = th.length; //table length is stored
|
||||
if(t.p && S && S[t.id])memento(t,th); //if 'postbackSafe' is enabled and there is data for the current table, its coloumn layout is restored
|
||||
|
||||
console.log(t.width())
|
||||
th.each(function(i){ //iterate through the table column headers
|
||||
var c = $(this); //jquery wrap for the current column
|
||||
var dc = t.dc.indexOf(i)!=-1; //is this a disabled column?
|
||||
var g = $(t.gc.append('<div class="JCLRgrip"></div>')[0].lastChild); //add the visual node to be used as grip
|
||||
g.append(dc ? "": t.opt.gripInnerHtml).append('<div class="'+SIGNATURE+'"></div>');
|
||||
if(i == t.ln-1){ //if the current grip is the las one
|
||||
g.addClass("JCLRLastGrip"); //add a different css class to stlye it in a different way if needed
|
||||
if(t.f) g.html(""); //if the table resizing mode is set to fixed, the last grip is removed since table with can not change
|
||||
}
|
||||
g.bind('touchstart mousedown', onGripMouseDown); //bind the mousedown event to start dragging
|
||||
|
||||
if (!dc){
|
||||
//if normal column bind the mousedown event to start dragging, if disabled then apply its css class
|
||||
g.removeClass('JCLRdisabledGrip').bind('touchstart mousedown', onGripMouseDown);
|
||||
}else{
|
||||
g.addClass('JCLRdisabledGrip');
|
||||
}
|
||||
|
||||
g.t = t; g.i = i; g.c = c; c.w =c.width(); c.w =widths[i]*t.width(); //some values are stored in the grip's node data as shortcut
|
||||
t.g.push(g); t.c.push(c); //the current grip and column are added to its table object
|
||||
c.width(c.w).removeAttr("width"); //the width of the column is converted into pixel-based measurements
|
||||
g.data(SIGNATURE, {i:i, t:t.attr(ID), last: i == t.ln-1}); //grip index and its table name are stored in the HTML
|
||||
});
|
||||
t.cg.removeAttr("width"); //remove the width attribute from elements in the colgroup
|
||||
|
||||
t.find('td, th').not(th).not('table th, table td').each(function(){
|
||||
$(this).removeAttr('width'); //the width attribute is removed from all table cells which are not nested in other tables and dont belong to the header
|
||||
});
|
||||
/*if(!t.f){
|
||||
t.removeAttr('width').addClass(FLEX); //if not fixed, let the table grow as needed
|
||||
}*/
|
||||
syncGrips(t); //the grips are positioned according to the current table layout
|
||||
//there is a small problem, some cells in the table could contain dimension values interfering with the
|
||||
//width value set by this plugin. Those values are removed
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function to allow the persistence of columns dimensions after a browser postback. It is based in
|
||||
* the HTML5 sessionStorage object, which can be emulated for older browsers using sessionstorage.js
|
||||
* @param {jQuery ref} t - table object
|
||||
* @param {jQuery ref} th - reference to the first row elements (only set in deserialization)
|
||||
*/
|
||||
var memento = function(t, th){
|
||||
var w,m=0,i=0,aux =[],tw;
|
||||
if(th){ //in deserialization mode (after a postback)
|
||||
t.cg.removeAttr("width");
|
||||
if(t.opt.flush){ S[t.id] =""; return;} //if flush is activated, stored data is removed
|
||||
w = S[t.id].split(";"); //column widths is obtained
|
||||
tw = w[t.ln+1];
|
||||
if(!t.f && tw){ //if not fixed and table width data available its size is restored
|
||||
t.width(tw*=1);
|
||||
if(t.opt.overflow) { //if overfolw flag is set, restore table width also as table min-width
|
||||
t.css('min-width', tw + PX);
|
||||
t.w = tw;
|
||||
}
|
||||
}
|
||||
for(;i<t.ln;i++){ //for each column
|
||||
aux.push(100*w[i]/w[t.ln]+"%"); //width is stored in an array since it will be required again a couple of lines ahead
|
||||
th.eq(i).css("width", aux[i] ); //each column width in % is restored
|
||||
}
|
||||
for(i=0;i<t.ln;i++)
|
||||
t.cg.eq(i).css("width", aux[i]); //this code is required in order to create an inline CSS rule with higher precedence than an existing CSS class in the "col" elements
|
||||
}else{ //in serialization mode (after resizing a column)
|
||||
S[t.id] =""; //clean up previous data
|
||||
for(;i < t.c.length; i++){ //iterate through columns
|
||||
w = t.c[i].width(); //width is obtained
|
||||
S[t.id] += w+";"; //width is appended to the sessionStorage object using ID as key
|
||||
m+=w; //carriage is updated to obtain the full size used by columns
|
||||
}
|
||||
S[t.id]+=m; //the last item of the serialized string is the table's active area (width),
|
||||
//to be able to obtain % width value of each columns while deserializing
|
||||
if(!t.f) S[t.id] += ";"+t.width(); //if not fixed, table width is stored
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Function that places each grip in the correct position according to the current table layout
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var syncGrips = function (t){
|
||||
t.gc.width(t.w); //the grip's container width is updated
|
||||
for(var i=0; i<t.ln; i++){ //for each column
|
||||
var c = t.c[i];
|
||||
t.g[i].css({ //height and position of the grip is updated according to the table layout
|
||||
left: c.offset().left - t.offset().left + c.outerWidth(false) + t.cs / 2 + PX,
|
||||
height: t.opt.headerOnly? t.c[0].outerHeight(false) : t.outerHeight(false)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This function updates column's width according to the horizontal position increment of the grip being
|
||||
* dragged. The function can be called while dragging if liveDragging is enabled and also from the onGripDragOver
|
||||
* event handler to synchronize grip's position with their related columns.
|
||||
* @param {jQuery ref} t - table object
|
||||
* @param {number} i - index of the grip being dragged
|
||||
* @param {bool} isOver - to identify when the function is being called from the onGripDragOver event
|
||||
*/
|
||||
var syncCols = function(t,i,isOver){
|
||||
var inc = drag.x-drag.l, c = t.c[i], c2 = t.c[i+1];
|
||||
var w = c.w + inc; var w2= c2.w- inc; //their new width is obtained
|
||||
c.width( w + PX);
|
||||
t.cg.eq(i).width( w + PX);
|
||||
if(t.f){ //if fixed mode
|
||||
c2.width(w2 + PX);
|
||||
t.cg.eq(i+1).width( w2 + PX);
|
||||
}else if(t.opt.overflow) { //if overflow is set, incriment min-width to force overflow
|
||||
t.css('min-width', t.w + inc);
|
||||
}
|
||||
if(isOver){
|
||||
c.w=w;
|
||||
c2.w= t.f ? w2 : c2.w;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This function updates all columns width according to its real width. It must be taken into account that the
|
||||
* sum of all columns can exceed the table width in some cases (if fixed is set to false and table has some kind
|
||||
* of max-width).
|
||||
* @param {jQuery ref} t - table object
|
||||
*/
|
||||
var applyBounds = function(t){
|
||||
var w = $.map(t.c, function(c){ //obtain real widths
|
||||
return c.width();
|
||||
});
|
||||
// t.width(t.w = t.width()).removeClass(FLEX); //prevent table width changes
|
||||
$.each(t.c, function(i,c){
|
||||
c.width(w[i]).w = w[i]; //set column widths applying bounds (table's max-width)
|
||||
});
|
||||
// t.addClass(FLEX); //allow table width changes
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler used while dragging a grip. It checks if the next grip's position is valid and updates it.
|
||||
* @param {event} e - mousemove event binded to the window object
|
||||
*/
|
||||
var onGripDrag = function(e){
|
||||
if(!drag) return;
|
||||
var t = drag.t; //table object reference
|
||||
var oe = e.originalEvent.touches;
|
||||
var ox = oe ? oe[0].pageX : e.pageX; //original position (touch or mouse)
|
||||
var x = ox - drag.ox + drag.l; //next position according to horizontal mouse position increment
|
||||
var mw = t.opt.minWidth, i = drag.i ; //cell's min width
|
||||
var l = t.cs*1.5 + mw + t.b;
|
||||
var last = i == t.ln-1; //check if it is the last column's grip (usually hidden)
|
||||
var min = i? t.g[i-1].position().left+t.cs+mw: l; //min position according to the contiguous cells
|
||||
var max = t.f ? //fixed mode?
|
||||
i == t.ln-1?
|
||||
t.w-l:
|
||||
t.g[i+1].position().left-t.cs-mw:
|
||||
Infinity; //max position according to the contiguous cells
|
||||
x = M.max(min, M.min(max, x)); //apply bounding
|
||||
drag.x = x; drag.css("left", x + PX); //apply position increment
|
||||
if(last){ //if it is the last grip
|
||||
var c = t.c[drag.i]; //width of the last column is obtained
|
||||
drag.w = c.w + x- drag.l;
|
||||
}
|
||||
if(t.opt.liveDrag){ //if liveDrag is enabled
|
||||
if(last){
|
||||
c.width(drag.w);
|
||||
if(!t.f && t.opt.overflow){ //if overflow is set, incriment min-width to force overflow
|
||||
t.css('min-width', t.w + x - drag.l);
|
||||
}else {
|
||||
t.w = t.width();
|
||||
}
|
||||
}else{
|
||||
syncCols(t,i); //columns are synchronized
|
||||
}
|
||||
syncGrips(t);
|
||||
var cb = t.opt.onDrag; //check if there is an onDrag callback
|
||||
if (cb) { e.currentTarget = t[0]; cb(e); } //if any, it is fired
|
||||
}
|
||||
return false; //prevent text selection while dragging
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler fired when the dragging is over, updating table layout
|
||||
* @param {event} e - grip's drag over event
|
||||
*/
|
||||
var onGripDragOver = function(e){
|
||||
|
||||
d.unbind('touchend.'+SIGNATURE+' mouseup.'+SIGNATURE).unbind('touchmove.'+SIGNATURE+' mousemove.'+SIGNATURE);
|
||||
$("head :last-child").remove(); //remove the dragging cursor style
|
||||
if(!drag) return;
|
||||
drag.removeClass(drag.t.opt.draggingClass); //remove the grip's dragging css-class
|
||||
if (!(drag.x - drag.l == 0)) {
|
||||
var t = drag.t;
|
||||
var cb = t.opt.onResize; //get some values
|
||||
var i = drag.i; //column index
|
||||
var last = i == t.ln-1; //check if it is the last column's grip (usually hidden)
|
||||
var c = t.g[i].c; //the column being dragged
|
||||
if(last){
|
||||
c.width(drag.w);
|
||||
c.w = drag.w;
|
||||
}else{
|
||||
syncCols(t, i, true); //the columns are updated
|
||||
}
|
||||
if(!t.f) applyBounds(t); //if not fixed mode, then apply bounds to obtain real width values
|
||||
syncGrips(t); //the grips are updated
|
||||
if (cb) { e.currentTarget = t[0]; cb(e); } //if there is a callback function, it is fired
|
||||
if(t.p && S) memento(t); //if postbackSafe is enabled and there is sessionStorage support, the new layout is serialized and stored
|
||||
}
|
||||
drag = null; //since the grip's dragging is over
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler fired when the grip's dragging is about to start. Its main goal is to set up events
|
||||
* and store some values used while dragging.
|
||||
* @param {event} e - grip's mousedown event
|
||||
*/
|
||||
var onGripMouseDown = function(e){
|
||||
var o = $(this).data(SIGNATURE); //retrieve grip's data
|
||||
var t = tables[o.t], g = t.g[o.i]; //shortcuts for the table and grip objects
|
||||
var oe = e.originalEvent.touches; //touch or mouse event?
|
||||
g.ox = oe? oe[0].pageX: e.pageX; //the initial position is kept
|
||||
g.l = g.position().left;
|
||||
g.x = g.l;
|
||||
|
||||
d.bind('touchmove.'+SIGNATURE+' mousemove.'+SIGNATURE, onGripDrag ).bind('touchend.'+SIGNATURE+' mouseup.'+SIGNATURE, onGripDragOver); //mousemove and mouseup events are bound
|
||||
h.append("<style type='text/css'>*{cursor:"+ t.opt.dragCursor +"!important}</style>"); //change the mouse cursor
|
||||
g.addClass(t.opt.draggingClass); //add the dragging class (to allow some visual feedback)
|
||||
drag = g; //the current grip is stored as the current dragging object
|
||||
if(t.c[o.i].l) for(var i=0,c; i<t.ln; i++){ c=t.c[i]; c.l = false; c.w= c.width(); } //if the colum is locked (after browser resize), then c.w must be updated
|
||||
return false; //prevent text selection
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event handler fired when the browser is resized. The main purpose of this function is to update
|
||||
* table layout according to the browser's size synchronizing related grips
|
||||
*/
|
||||
var onResize = function(){
|
||||
for(var t in tables){
|
||||
if( tables.hasOwnProperty( t ) ) {
|
||||
t = tables[t];
|
||||
var i, mw=0;
|
||||
t.removeClass(SIGNATURE); //firefox doesn't like layout-fixed in some cases
|
||||
if (t.f) { //in fixed mode
|
||||
t.w = t.width(); //its new width is kept
|
||||
for(i=0; i<t.ln; i++) mw+= t.c[i].w;
|
||||
//cell rendering is not as trivial as it might seem, and it is slightly different for
|
||||
//each browser. In the beginning i had a big switch for each browser, but since the code
|
||||
//was extremely ugly now I use a different approach with several re-flows. This works
|
||||
//pretty well but it's a bit slower. For now, lets keep things simple...
|
||||
for(i=0; i<t.ln; i++) t.c[i].css("width", M.round(1000*t.c[i].w/mw)/10 + "%").l=true;
|
||||
//c.l locks the column, telling us that its c.w is outdated
|
||||
}else{ //in non fixed-sized tables
|
||||
applyBounds(t); //apply the new bounds
|
||||
if(t.mode == 'flex' && t.p && S){ //if postbackSafe is enabled and there is sessionStorage support,
|
||||
memento(t); //the new layout is serialized and stored for 'flex' tables
|
||||
}
|
||||
}
|
||||
syncGrips(t.addClass(SIGNATURE));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
//bind resize event, to update grips position
|
||||
$(window).bind('resize.'+SIGNATURE, onResize);
|
||||
|
||||
|
||||
/**
|
||||
* The plugin is added to the jQuery library
|
||||
* @param {Object} options - an object that holds some basic customization values
|
||||
*/
|
||||
$.fn.extend({
|
||||
colResizable: function(options) {
|
||||
var defaults = {
|
||||
|
||||
//attributes:
|
||||
|
||||
resizeMode: 'fit', //mode can be 'fit', 'flex' or 'overflow'
|
||||
draggingClass: 'JCLRgripDrag', //css-class used when a grip is being dragged (for visual feedback purposes)
|
||||
gripInnerHtml: '', //if it is required to use a custom grip it can be done using some custom HTML
|
||||
liveDrag: false, //enables table-layout updating while dragging
|
||||
minWidth: 15, //minimum width value in pixels allowed for a column
|
||||
headerOnly: false, //specifies that the size of the the column resizing anchors will be bounded to the size of the first row
|
||||
hoverCursor: "e-resize", //cursor to be used on grip hover
|
||||
dragCursor: "e-resize", //cursor to be used while dragging
|
||||
postbackSafe: false, //when it is enabled, table layout can persist after postback or page refresh. It requires browsers with sessionStorage support (it can be emulated with sessionStorage.js).
|
||||
flush: false, //when postbakSafe is enabled, and it is required to prevent layout restoration after postback, 'flush' will remove its associated layout data
|
||||
marginLeft: null, //in case the table contains any margins, colResizable needs to know the values used, e.g. "10%", "15em", "5px" ...
|
||||
marginRight: null, //in case the table contains any margins, colResizable needs to know the values used, e.g. "10%", "15em", "5px" ...
|
||||
disable: false, //disables all the enhancements performed in a previously colResized table
|
||||
partialRefresh: false, //can be used in combination with postbackSafe when the table is inside of an updatePanel,
|
||||
disabledColumns: [], //column indexes to be excluded
|
||||
|
||||
//events:
|
||||
onDrag: null, //callback function to be fired during the column resizing process if liveDrag is enabled
|
||||
onResize: null //callback function fired when the dragging process is over
|
||||
}
|
||||
var options = $.extend(defaults, options);
|
||||
|
||||
//since now there are 3 different ways of resizing columns, I changed the external interface to make it clear
|
||||
//calling it 'resizeMode' but also to remove the "fixed" attribute which was confusing for many people
|
||||
options.fixed = true;
|
||||
options.overflow = false;
|
||||
switch(options.resizeMode){
|
||||
case 'flex': options.fixed = false; break;
|
||||
case 'overflow': options.fixed = false; options.overflow = true; break;
|
||||
}
|
||||
|
||||
return this.each(function() {
|
||||
init( this, options);
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
@ -0,0 +1,383 @@
|
||||
/**
|
||||
* TableDnD plug-in for JQuery, allows you to drag and drop table rows
|
||||
* You can set up various options to control how the system will work
|
||||
* Copyright (c) Denis Howlett <denish@isocra.com>
|
||||
* Licensed like jQuery, see http://docs.jquery.com/License.
|
||||
* Download by http://www.codefans.net
|
||||
* Configuration options:
|
||||
*
|
||||
* onDragStyle
|
||||
* This is the style that is assigned to the row during drag. There are limitations to the styles that can be
|
||||
* associated with a row (such as you can't assign a border--well you can, but it won't be
|
||||
* displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as
|
||||
* a map (as used in the jQuery css(...) function).
|
||||
* onDropStyle
|
||||
* This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations
|
||||
* to what you can do. Also this replaces the original style, so again consider using onDragClass which
|
||||
* is simply added and then removed on drop.
|
||||
* onDragClass
|
||||
* This class is added for the duration of the drag and then removed when the row is dropped. It is more
|
||||
* flexible than using onDragStyle since it can be inherited by the row cells and other content. The default
|
||||
* is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your
|
||||
* stylesheet.
|
||||
* onDrop
|
||||
* Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table
|
||||
* and the row that was dropped. You can work out the new order of the rows by using
|
||||
* table.rows.
|
||||
* onDragStart
|
||||
* Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
|
||||
* table and the row which the user has started to drag.
|
||||
* onAllowDrop
|
||||
* Pass a function that will be called as a row is over another row. If the function returns true, allow
|
||||
* dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
|
||||
* the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
|
||||
* scrollAmount
|
||||
* This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the
|
||||
* window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2,
|
||||
* FF3 beta
|
||||
* dragHandle
|
||||
* This is the name of a class that you assign to one or more cells in each row that is draggable. If you
|
||||
* specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
|
||||
* will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
|
||||
* the whole row is draggable.
|
||||
*
|
||||
* Other ways to control behaviour:
|
||||
*
|
||||
* Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
|
||||
* that you don't want to be draggable.
|
||||
*
|
||||
* Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form
|
||||
* <tableID>[]=<rowID1>&<tableID>[]=<rowID2> so that you can send this back to the server. The table must have
|
||||
* an ID as must all the rows.
|
||||
*
|
||||
* Other methods:
|
||||
*
|
||||
* $("...").tableDnDUpdate()
|
||||
* Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
|
||||
* This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
|
||||
* The table maintains the original configuration (so you don't have to specify it again).
|
||||
*
|
||||
* $("...").tableDnDSerialize()
|
||||
* Will serialize and return the serialized string as above, but for each of the matching tables--so it can be
|
||||
* called from anywhere and isn't dependent on the currentTable being set up correctly before calling
|
||||
*
|
||||
* Known problems:
|
||||
* - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
|
||||
*
|
||||
* Version 0.2: 2008-02-20 First public version
|
||||
* Version 0.3: 2008-02-07 Added onDragStart option
|
||||
* Made the scroll amount configurable (default is 5 as before)
|
||||
* Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes
|
||||
* Added onAllowDrop to control dropping
|
||||
* Fixed a bug which meant that you couldn't set the scroll amount in both directions
|
||||
* Added serialize method
|
||||
* Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row
|
||||
* draggable
|
||||
* Improved the serialize method to use a default (and settable) regular expression.
|
||||
* Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table
|
||||
*/
|
||||
jQuery.tableDnD = {
|
||||
/** Keep hold of the current table being dragged */
|
||||
currentTable : null,
|
||||
/** Keep hold of the current drag object if any */
|
||||
dragObject: null,
|
||||
/** The current mouse offset */
|
||||
mouseOffset: null,
|
||||
/** Remember the old value of Y so that we don't do too much processing */
|
||||
oldY: 0,
|
||||
|
||||
/** Actually build the structure */
|
||||
build: function(options) {
|
||||
// Set up the defaults if any
|
||||
|
||||
this.each(function() {
|
||||
// This is bound to each matching table, set up the defaults and override with user options
|
||||
this.tableDnDConfig = jQuery.extend({
|
||||
onDragStyle: null,
|
||||
onDropStyle: null,
|
||||
// Add in the default class for whileDragging
|
||||
onDragClass: "tDnD_whileDrag",
|
||||
onDrop: null,
|
||||
onDragStart: null,
|
||||
scrollAmount: 5,
|
||||
serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs
|
||||
serializeParamName: null, // If you want to specify another parameter name instead of the table ID
|
||||
dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable
|
||||
}, options || {});
|
||||
// Now make the rows draggable
|
||||
jQuery.tableDnD.makeDraggable(this);
|
||||
});
|
||||
|
||||
// Now we need to capture the mouse up and mouse move event
|
||||
// We can use bind so that we don't interfere with other event handlers
|
||||
jQuery(document)
|
||||
.bind('mousemove', jQuery.tableDnD.mousemove)
|
||||
.bind('mouseup', jQuery.tableDnD.mouseup);
|
||||
|
||||
// Don't break the chain
|
||||
return this;
|
||||
},
|
||||
|
||||
/** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
|
||||
makeDraggable: function(table) {
|
||||
var config = table.tableDnDConfig;
|
||||
if (table.tableDnDConfig.dragHandle) {
|
||||
// We only need to add the event to the specified cells
|
||||
var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
|
||||
cells.each(function() {
|
||||
// The cell is bound to "this"
|
||||
jQuery(this).mousedown(function(ev) {
|
||||
jQuery.tableDnD.dragObject = this.parentNode;
|
||||
jQuery.tableDnD.currentTable = table;
|
||||
jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
|
||||
if (config.onDragStart) {
|
||||
// Call the onDrop method if there is one
|
||||
config.onDragStart(table, this);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
})
|
||||
} else {
|
||||
// For backwards compatibility, we add the event to the whole row
|
||||
var rows = jQuery("tr", table); // get all the rows as a wrapped set
|
||||
rows.each(function() {
|
||||
// Iterate through each row, the row is bound to "this"
|
||||
var row = jQuery(this);
|
||||
if (! row.hasClass("nodrag")) {
|
||||
row.mousedown(function(ev) {
|
||||
if (ev.target.tagName == "TD") {
|
||||
jQuery.tableDnD.dragObject = this;
|
||||
jQuery.tableDnD.currentTable = table;
|
||||
jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
|
||||
if (config.onDragStart) {
|
||||
// Call the onDrop method if there is one
|
||||
config.onDragStart(table, this);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}).css("cursor", "move"); // Store the tableDnD object
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
updateTables: function() {
|
||||
this.each(function() {
|
||||
// this is now bound to each matching table
|
||||
if (this.tableDnDConfig) {
|
||||
jQuery.tableDnD.makeDraggable(this);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** Get the mouse coordinates from the event (allowing for browser differences) */
|
||||
mouseCoords: function(ev){
|
||||
if(ev.pageX || ev.pageY){
|
||||
return {x:ev.pageX, y:ev.pageY};
|
||||
}
|
||||
return {
|
||||
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
|
||||
y:ev.clientY + document.body.scrollTop - document.body.clientTop
|
||||
};
|
||||
},
|
||||
|
||||
/** Given a target element and a mouse event, get the mouse offset from that element.
|
||||
To do this we need the element's position and the mouse position */
|
||||
getMouseOffset: function(target, ev) {
|
||||
ev = ev || window.event;
|
||||
|
||||
var docPos = this.getPosition(target);
|
||||
var mousePos = this.mouseCoords(ev);
|
||||
return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
|
||||
},
|
||||
|
||||
/** Get the position of an element by going up the DOM tree and adding up all the offsets */
|
||||
getPosition: function(e){
|
||||
var left = 0;
|
||||
var top = 0;
|
||||
/** Safari fix -- thanks to Luis Chato for this! */
|
||||
if (e.offsetHeight == 0) {
|
||||
/** Safari 2 doesn't correctly grab the offsetTop of a table row
|
||||
this is detailed here:
|
||||
http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
|
||||
the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
|
||||
note that firefox will return a text node as a first child, so designing a more thorough
|
||||
solution may need to take that into account, for now this seems to work in firefox, safari, ie */
|
||||
e = e.firstChild; // a table cell
|
||||
}
|
||||
if (e && e.offsetParent) {
|
||||
while (e.offsetParent){
|
||||
left += e.offsetLeft;
|
||||
top += e.offsetTop;
|
||||
e = e.offsetParent;
|
||||
}
|
||||
|
||||
left += e.offsetLeft;
|
||||
top += e.offsetTop;
|
||||
}
|
||||
|
||||
return {x:left, y:top};
|
||||
},
|
||||
|
||||
mousemove: function(ev) {
|
||||
if (jQuery.tableDnD.dragObject == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var dragObj = jQuery(jQuery.tableDnD.dragObject);
|
||||
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
|
||||
var mousePos = jQuery.tableDnD.mouseCoords(ev);
|
||||
var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
|
||||
//auto scroll the window
|
||||
var yOffset = window.pageYOffset;
|
||||
if (document.all) {
|
||||
// Windows version
|
||||
//yOffset=document.body.scrollTop;
|
||||
if (typeof document.compatMode != 'undefined' &&
|
||||
document.compatMode != 'BackCompat') {
|
||||
yOffset = document.documentElement.scrollTop;
|
||||
}
|
||||
else if (typeof document.body != 'undefined') {
|
||||
yOffset=document.body.scrollTop;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mousePos.y-yOffset < config.scrollAmount) {
|
||||
window.scrollBy(0, -config.scrollAmount);
|
||||
} else {
|
||||
var windowHeight = window.innerHeight ? window.innerHeight
|
||||
: document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
|
||||
if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
|
||||
window.scrollBy(0, config.scrollAmount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (y != jQuery.tableDnD.oldY) {
|
||||
// work out if we're going up or down...
|
||||
var movingDown = y > jQuery.tableDnD.oldY;
|
||||
// update the old value
|
||||
jQuery.tableDnD.oldY = y;
|
||||
// update the style to show we're dragging
|
||||
if (config.onDragClass) {
|
||||
dragObj.addClass(config.onDragClass);
|
||||
} else {
|
||||
dragObj.css(config.onDragStyle);
|
||||
}
|
||||
// If we're over a row then move the dragged row to there so that the user sees the
|
||||
// effect dynamically
|
||||
var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
|
||||
if (currentRow) {
|
||||
// TODO worry about what happens when there are multiple TBODIES
|
||||
if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
|
||||
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
|
||||
} else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
|
||||
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
/** We're only worried about the y position really, because we can only move rows up and down */
|
||||
findDropTargetRow: function(draggedRow, y) {
|
||||
var rows = jQuery.tableDnD.currentTable.rows;
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
var row = rows[i];
|
||||
var rowY = this.getPosition(row).y;
|
||||
var rowHeight = parseInt(row.offsetHeight)/2;
|
||||
if (row.offsetHeight == 0) {
|
||||
rowY = this.getPosition(row.firstChild).y;
|
||||
rowHeight = parseInt(row.firstChild.offsetHeight)/2;
|
||||
}
|
||||
// Because we always have to insert before, we need to offset the height a bit
|
||||
if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) {
|
||||
// that's the row we're over
|
||||
// If it's the same as the current row, ignore it
|
||||
if (row == draggedRow) {return null;}
|
||||
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
|
||||
if (config.onAllowDrop) {
|
||||
if (config.onAllowDrop(draggedRow, row)) {
|
||||
return row;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
// If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
|
||||
var nodrop = jQuery(row).hasClass("nodrop");
|
||||
if (! nodrop) {
|
||||
return row;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
mouseup: function(e) {
|
||||
if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
|
||||
var droppedRow = jQuery.tableDnD.dragObject;
|
||||
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
|
||||
// If we have a dragObject, then we need to release it,
|
||||
// The row will already have been moved to the right place so we just reset stuff
|
||||
if (config.onDragClass) {
|
||||
jQuery(droppedRow).removeClass(config.onDragClass);
|
||||
} else {
|
||||
jQuery(droppedRow).css(config.onDropStyle);
|
||||
}
|
||||
jQuery.tableDnD.dragObject = null;
|
||||
if (config.onDrop) {
|
||||
// Call the onDrop method if there is one
|
||||
config.onDrop(jQuery.tableDnD.currentTable, droppedRow);
|
||||
}
|
||||
jQuery.tableDnD.currentTable = null; // let go of the table too
|
||||
}
|
||||
},
|
||||
|
||||
serialize: function() {
|
||||
if (jQuery.tableDnD.currentTable) {
|
||||
return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable);
|
||||
} else {
|
||||
return "Error: No Table id set, you need to set an id on your table and every row";
|
||||
}
|
||||
},
|
||||
|
||||
serializeTable: function(table) {
|
||||
var result = "";
|
||||
var tableId = table.id;
|
||||
var rows = table.rows;
|
||||
for (var i=0; i<rows.length; i++) {
|
||||
if (result.length > 0) result += "&";
|
||||
var rowId = rows[i].id;
|
||||
if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
|
||||
rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
|
||||
}
|
||||
|
||||
result += tableId + '[]=' + rowId;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
serializeTables: function() {
|
||||
var result = "";
|
||||
this.each(function() {
|
||||
// this is now bound to each matching table
|
||||
result += jQuery.tableDnD.serializeTable(this);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
jQuery.fn.extend(
|
||||
{
|
||||
tableDnD : jQuery.tableDnD.build,
|
||||
tableDnDUpdate : jQuery.tableDnD.updateTables,
|
||||
tableDnDSerialize: jQuery.tableDnD.serializeTables
|
||||
}
|
||||
);
|
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);
|
@ -0,0 +1,5 @@
|
||||
/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
|
||||
* Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
|
||||
* */
|
||||
|
||||
!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeChild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substring(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("//"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
|
@ -0,0 +1,706 @@
|
||||
/* Chosen v1.2.0 | (c) 2011-2014 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
||||
!function () {
|
||||
var a,
|
||||
AbstractChosen,
|
||||
Chosen,
|
||||
SelectParser,
|
||||
b,
|
||||
c = {}
|
||||
.hasOwnProperty,
|
||||
d = function (a, b) {
|
||||
function d() {
|
||||
this.constructor = a
|
||||
}
|
||||
for (var e in b)
|
||||
c.call(b, e) && (a[e] = b[e]);
|
||||
return d.prototype = b.prototype,
|
||||
a.prototype = new d,
|
||||
a.__super__ = b.prototype,
|
||||
a
|
||||
};
|
||||
SelectParser = function () {
|
||||
function SelectParser() {
|
||||
this.options_index = 0,
|
||||
this.parsed = []
|
||||
}
|
||||
return SelectParser.prototype.add_node = function (a) {
|
||||
return "OPTGROUP" === a.nodeName.toUpperCase() ? this.add_group(a) : this.add_option(a)
|
||||
},
|
||||
SelectParser.prototype.add_group = function (a) {
|
||||
var b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
g;
|
||||
for (b = this.parsed.length, this.parsed.push({
|
||||
array_index: b,
|
||||
group: !0,
|
||||
label: this.escapeExpression(a.label),
|
||||
children: 0,
|
||||
disabled: a.disabled
|
||||
}), f = a.childNodes, g = [], d = 0, e = f.length; e > d; d++)
|
||||
c = f[d], g.push(this.add_option(c, b, a.disabled));
|
||||
return g
|
||||
},
|
||||
SelectParser.prototype.add_option = function (a, b, c) {
|
||||
return "OPTION" === a.nodeName.toUpperCase() ? ("" !== a.text ? (null != b && (this.parsed[b].children += 1), this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
value: a.value,
|
||||
text: a.text,
|
||||
html: a.innerHTML,
|
||||
selected: a.selected,
|
||||
disabled: c === !0 ? c : a.disabled,
|
||||
group_array_index: b,
|
||||
classes: a.className,
|
||||
style: a.style.cssText
|
||||
})) : this.parsed.push({
|
||||
array_index: this.parsed.length,
|
||||
options_index: this.options_index,
|
||||
empty: !0
|
||||
}), this.options_index += 1) : void 0
|
||||
},
|
||||
SelectParser.prototype.escapeExpression = function (a) {
|
||||
var b,
|
||||
c;
|
||||
return null == a || a === !1 ? "" : /[\&\<\>\"\'\`]/.test(a) ? (b = {
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """,
|
||||
"'": "'",
|
||||
"`": "`"
|
||||
}, c = /&(?!\w+;)|[\<\>\"\'\`]/g, a.replace(c, function (a) {
|
||||
return b[a] || "&"
|
||||
})) : a
|
||||
},
|
||||
SelectParser
|
||||
}
|
||||
(),
|
||||
SelectParser.select_to_array = function (a) {
|
||||
var b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f;
|
||||
for (c = new SelectParser, f = a.childNodes, d = 0, e = f.length; e > d; d++)
|
||||
b = f[d], c.add_node(b);
|
||||
return c.parsed
|
||||
},
|
||||
AbstractChosen = function () {
|
||||
function AbstractChosen(a, b) {
|
||||
this.form_field = a,
|
||||
this.options = null != b ? b : {},
|
||||
AbstractChosen.browser_is_supported() && (this.is_multiple = this.form_field.multiple, this.set_default_text(), this.set_default_values(), this.setup(), this.set_up_html(), this.register_observers())
|
||||
}
|
||||
return AbstractChosen.prototype.set_default_values = function () {
|
||||
var a = this;
|
||||
return this.click_test_action = function (b) {
|
||||
return a.test_active_click(b)
|
||||
},
|
||||
this.activate_action = function (b) {
|
||||
return a.activate_field(b)
|
||||
},
|
||||
this.active_field = !1,
|
||||
this.mouse_on_container = !1,
|
||||
this.results_showing = !1,
|
||||
this.result_highlighted = null,
|
||||
this.allow_single_deselect = null != this.options.allow_single_deselect && null != this.form_field.options[0] && "" === this.form_field.options[0].text ? this.options.allow_single_deselect : !1,
|
||||
this.disable_search_threshold = this.options.disable_search_threshold || 0,
|
||||
this.disable_search = this.options.disable_search || !1,
|
||||
this.enable_split_word_search = null != this.options.enable_split_word_search ? this.options.enable_split_word_search : !0,
|
||||
this.group_search = null != this.options.group_search ? this.options.group_search : !0,
|
||||
this.search_contains = this.options.search_contains || !1,
|
||||
this.single_backstroke_delete = null != this.options.single_backstroke_delete ? this.options.single_backstroke_delete : !0,
|
||||
this.max_selected_options = this.options.max_selected_options || 1 / 0,
|
||||
this.inherit_select_classes = this.options.inherit_select_classes || !1,
|
||||
this.display_selected_options = null != this.options.display_selected_options ? this.options.display_selected_options : !0,
|
||||
this.display_disabled_options = null != this.options.display_disabled_options ? this.options.display_disabled_options : !0
|
||||
},
|
||||
AbstractChosen.prototype.set_default_text = function () {
|
||||
return this.default_text = this.form_field.getAttribute("data-placeholder") ? this.form_field.getAttribute("data-placeholder") : this.is_multiple ? this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text : this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text,
|
||||
this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text
|
||||
},
|
||||
AbstractChosen.prototype.mouse_enter = function () {
|
||||
return this.mouse_on_container = !0
|
||||
},
|
||||
AbstractChosen.prototype.mouse_leave = function () {
|
||||
return this.mouse_on_container = !1
|
||||
},
|
||||
AbstractChosen.prototype.input_focus = function () {
|
||||
var a = this;
|
||||
if (this.is_multiple) {
|
||||
if (!this.active_field)
|
||||
return setTimeout(function () {
|
||||
return a.container_mousedown()
|
||||
}, 50)
|
||||
} else if (!this.active_field)
|
||||
return this.activate_field()
|
||||
},
|
||||
AbstractChosen.prototype.input_blur = function () {
|
||||
var a = this;
|
||||
return this.mouse_on_container ? void 0 : (this.active_field = !1, setTimeout(function () {
|
||||
return a.blur_test()
|
||||
}, 100))
|
||||
},
|
||||
AbstractChosen.prototype.results_option_build = function (a) {
|
||||
var b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f;
|
||||
for (b = "", f = this.results_data, d = 0, e = f.length; e > d; d++)
|
||||
c = f[d], b += c.group ? this.result_add_group(c) : this.result_add_option(c), (null != a ? a.first : void 0) && (c.selected && this.is_multiple ? this.choice_build(c) : c.selected && !this.is_multiple && this.single_set_selected_text(c.text));
|
||||
return b
|
||||
},
|
||||
AbstractChosen.prototype.result_add_option = function (a) {
|
||||
var b,
|
||||
c;
|
||||
return a.search_match ? this.include_option_in_results(a) ? (b = [], a.disabled || a.selected && this.is_multiple || b.push("active-result"), !a.disabled || a.selected && this.is_multiple || b.push("disabled-result"), a.selected && b.push("result-selected"), null != a.group_array_index && b.push("group-option"), "" !== a.classes && b.push(a.classes), c = document.createElement("li"), c.className = b.join(" "), c.style.cssText = a.style, c.setAttribute("data-option-array-index", a.array_index), c.innerHTML = a.search_text, this.outerHTML(c)) : "" : ""
|
||||
},
|
||||
AbstractChosen.prototype.result_add_group = function (a) {
|
||||
var b;
|
||||
return a.search_match || a.group_match ? a.active_options > 0 ? (b = document.createElement("li"), b.className = "group-result", b.innerHTML = a.search_text, this.outerHTML(b)) : "" : ""
|
||||
},
|
||||
AbstractChosen.prototype.results_update_field = function () {
|
||||
return this.set_default_text(),
|
||||
this.is_multiple || this.results_reset_cleanup(),
|
||||
this.result_clear_highlight(),
|
||||
this.results_build(),
|
||||
this.results_showing ? this.winnow_results() : void 0
|
||||
},
|
||||
AbstractChosen.prototype.reset_single_select_options = function () {
|
||||
var a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
e;
|
||||
for (d = this.results_data, e = [], b = 0, c = d.length; c > b; b++)
|
||||
a = d[b], a.selected ? e.push(a.selected = !1) : e.push(void 0);
|
||||
return e
|
||||
},
|
||||
AbstractChosen.prototype.results_toggle = function () {
|
||||
return this.results_showing ? this.results_hide() : this.results_show()
|
||||
},
|
||||
AbstractChosen.prototype.results_search = function () {
|
||||
return this.results_showing ? this.winnow_results() : this.results_show()
|
||||
},
|
||||
AbstractChosen.prototype.winnow_results = function () {
|
||||
var a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
g,
|
||||
h,
|
||||
i,
|
||||
j,
|
||||
k,
|
||||
l;
|
||||
for (this.no_results_clear(), d = 0, f = this.get_search_text(), a = f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), i = new RegExp(a, "i"), c = this.get_search_regex(a), l = this.results_data, j = 0, k = l.length; k > j; j++)
|
||||
b = l[j], b.search_match = !1, e = null, this.include_option_in_results(b) && (b.group && (b.group_match = !1, b.active_options = 0), null != b.group_array_index && this.results_data[b.group_array_index] && (e = this.results_data[b.group_array_index], 0 === e.active_options && e.search_match && (d += 1), e.active_options += 1), (!b.group || this.group_search) && (b.search_text = b.group ? b.label : b.text, b.search_match = this.search_string_match(b.search_text, c), b.search_match && !b.group && (d += 1), b.search_match ? (f.length && (g = b.search_text.search(i), h = b.search_text.substr(0, g + f.length) + "</em>" + b.search_text.substr(g + f.length), b.search_text = h.substr(0, g) + "<em>" + h.substr(g)), null != e && (e.group_match = !0)) : null != b.group_array_index && this.results_data[b.group_array_index].search_match && (b.search_match = !0)));
|
||||
return this.result_clear_highlight(),
|
||||
1 > d && f.length ? (this.update_results_content(""), this.no_results(f)) : (this.update_results_content(this.results_option_build()), this.winnow_results_set_highlight())
|
||||
},
|
||||
AbstractChosen.prototype.get_search_regex = function (a) {
|
||||
var b;
|
||||
return b = this.search_contains ? "" : "^",
|
||||
new RegExp(b + a, "i")
|
||||
},
|
||||
AbstractChosen.prototype.search_string_match = function (a, b) {
|
||||
var c,
|
||||
d,
|
||||
e,
|
||||
f;
|
||||
if (b.test(a))
|
||||
return !0;
|
||||
if (this.enable_split_word_search && (a.indexOf(" ") >= 0 || 0 === a.indexOf("[")) && (d = a.replace(/\[|\]/g, "").split(" "), d.length))
|
||||
for (e = 0, f = d.length; f > e; e++)
|
||||
if (c = d[e], b.test(c))
|
||||
return !0
|
||||
},
|
||||
AbstractChosen.prototype.choices_count = function () {
|
||||
var a,
|
||||
b,
|
||||
c,
|
||||
d;
|
||||
if (null != this.selected_option_count)
|
||||
return this.selected_option_count;
|
||||
for (this.selected_option_count = 0, d = this.form_field.options, b = 0, c = d.length; c > b; b++)
|
||||
a = d[b], a.selected && (this.selected_option_count += 1);
|
||||
return this.selected_option_count
|
||||
},
|
||||
AbstractChosen.prototype.choices_click = function (a) {
|
||||
return a.preventDefault(),
|
||||
this.results_showing || this.is_disabled ? void 0 : this.results_show()
|
||||
},
|
||||
AbstractChosen.prototype.keyup_checker = function (a) {
|
||||
var b,
|
||||
c;
|
||||
switch (b = null != (c = a.which) ? c : a.keyCode, this.search_field_scale(), b) {
|
||||
case 8:
|
||||
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0)
|
||||
return this.keydown_backstroke();
|
||||
if (!this.pending_backstroke)
|
||||
return this.result_clear_highlight(), this.results_search();
|
||||
break;
|
||||
case 13:
|
||||
if (a.preventDefault(), this.results_showing)
|
||||
return this.result_select(a);
|
||||
break;
|
||||
case 27:
|
||||
return this.results_showing && this.results_hide(),
|
||||
!0;
|
||||
case 9:
|
||||
case 38:
|
||||
case 40:
|
||||
case 16:
|
||||
case 91:
|
||||
case 17:
|
||||
break;
|
||||
default:
|
||||
return this.results_search()
|
||||
}
|
||||
},
|
||||
AbstractChosen.prototype.clipboard_event_checker = function () {
|
||||
var a = this;
|
||||
return setTimeout(function () {
|
||||
return a.results_search()
|
||||
}, 50)
|
||||
},
|
||||
AbstractChosen.prototype.container_width = function () {
|
||||
return null != this.options.width ? this.options.width : "" + this.form_field.offsetWidth + "px"
|
||||
},
|
||||
AbstractChosen.prototype.include_option_in_results = function (a) {
|
||||
return this.is_multiple && !this.display_selected_options && a.selected ? !1 : !this.display_disabled_options && a.disabled ? !1 : a.empty ? !1 : !0
|
||||
},
|
||||
AbstractChosen.prototype.search_results_touchstart = function (a) {
|
||||
return this.touch_started = !0,
|
||||
this.search_results_mouseover(a)
|
||||
},
|
||||
AbstractChosen.prototype.search_results_touchmove = function (a) {
|
||||
return this.touch_started = !1,
|
||||
this.search_results_mouseout(a)
|
||||
},
|
||||
AbstractChosen.prototype.search_results_touchend = function (a) {
|
||||
return this.touch_started ? this.search_results_mouseup(a) : void 0
|
||||
},
|
||||
AbstractChosen.prototype.outerHTML = function (a) {
|
||||
var b;
|
||||
return a.outerHTML ? a.outerHTML : (b = document.createElement("div"), b.appendChild(a), b.innerHTML)
|
||||
},
|
||||
AbstractChosen.browser_is_supported = function () {
|
||||
return "Microsoft Internet Explorer" === window.navigator.appName ? document.documentMode >= 8 : /iP(od|hone)/i.test(window.navigator.userAgent) ? !1 : /Android/i.test(window.navigator.userAgent) && /Mobile/i.test(window.navigator.userAgent) ? !1 : !0
|
||||
},
|
||||
AbstractChosen.default_multiple_text = "Select Some Options",
|
||||
AbstractChosen.default_single_text = "Select an Option",
|
||||
AbstractChosen.default_no_result_text = "未找到",
|
||||
AbstractChosen
|
||||
}
|
||||
(),
|
||||
a = jQuery,
|
||||
a.fn.extend({
|
||||
chosen: function (b) {
|
||||
return AbstractChosen.browser_is_supported() ? this.each(function () {
|
||||
var c,
|
||||
d;
|
||||
c = a(this),
|
||||
d = c.data("chosen"),
|
||||
"destroy" === b && d instanceof Chosen ? d.destroy() : d instanceof Chosen || c.data("chosen", new Chosen(this, b))
|
||||
}) : this
|
||||
}
|
||||
}),
|
||||
|
||||
Chosen = function (c) {
|
||||
function Chosen() {
|
||||
return b = Chosen.__super__.constructor.apply(this, arguments)
|
||||
}
|
||||
return d(Chosen, c),
|
||||
Chosen.prototype.setup = function () {
|
||||
return this.form_field_jq = a(this.form_field),
|
||||
this.current_selectedIndex = this.form_field.selectedIndex,
|
||||
this.is_rtl = this.form_field_jq.hasClass("chosen-rtl")
|
||||
},
|
||||
Chosen.prototype.set_up_html = function () {
|
||||
var b,
|
||||
c;
|
||||
return b = ["chosen-container"],
|
||||
b.push("chosen-container-" + (this.is_multiple ? "multi" : "single")),
|
||||
this.inherit_select_classes && this.form_field.className && b.push(this.form_field.className),
|
||||
this.is_rtl && b.push("chosen-rtl"),
|
||||
c = {
|
||||
"class": b.join(" "),
|
||||
style: "width: " + this.container_width() + ";",
|
||||
title: this.form_field.title
|
||||
},
|
||||
|
||||
this.form_field.id.length && (c.id = this.form_field.id.replace(/[^\w]/g, "_") + "_chosen"),
|
||||
this.container = a("<div />", c),
|
||||
this.is_multiple ? this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>') : this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),
|
||||
this.form_field_jq.hide().after(this.container),
|
||||
this.dropdown = this.container.find("div.chosen-drop").first(),
|
||||
this.search_field = this.container.find("input").first(),
|
||||
this.search_results = this.container.find("ul.chosen-results").first(),
|
||||
this.search_field_scale(),
|
||||
this.search_no_results = this.container.find("li.no-results").first(),
|
||||
this.is_multiple ? (this.search_choices = this.container.find("ul.chosen-choices").first(), this.search_container = this.container.find("li.search-field").first()) : (this.search_container = this.container.find("div.chosen-search").first(), this.selected_item = this.container.find(".chosen-single").first()),
|
||||
this.results_build(),
|
||||
this.set_tab_index(),
|
||||
this.set_label_behavior(),
|
||||
this.form_field_jq.trigger("chosen:ready", {
|
||||
chosen: this
|
||||
})
|
||||
},
|
||||
Chosen.prototype.register_observers = function () {
|
||||
var a = this;
|
||||
return this.container.bind("touchstart.chosen", function (b) {
|
||||
a.container_mousedown(b)
|
||||
}),
|
||||
this.container.bind("touchend.chosen", function (b) {
|
||||
a.container_mouseup(b)
|
||||
}),
|
||||
this.container.bind("mousedown.chosen", function (b) {
|
||||
a.container_mousedown(b)
|
||||
}),
|
||||
this.container.bind("mouseup.chosen", function (b) {
|
||||
a.container_mouseup(b)
|
||||
}),
|
||||
this.container.bind("mouseenter.chosen", function (b) {
|
||||
a.mouse_enter(b)
|
||||
}),
|
||||
this.container.bind("mouseleave.chosen", function (b) {
|
||||
a.mouse_leave(b)
|
||||
}),
|
||||
this.search_results.bind("mouseup.chosen", function (b) {
|
||||
a.search_results_mouseup(b)
|
||||
}),
|
||||
this.search_results.bind("mouseover.chosen", function (b) {
|
||||
a.search_results_mouseover(b)
|
||||
}),
|
||||
this.search_results.bind("mouseout.chosen", function (b) {
|
||||
a.search_results_mouseout(b)
|
||||
}),
|
||||
this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen", function (b) {
|
||||
a.search_results_mousewheel(b)
|
||||
}),
|
||||
this.search_results.bind("touchstart.chosen", function (b) {
|
||||
a.search_results_touchstart(b)
|
||||
}),
|
||||
this.search_results.bind("touchmove.chosen", function (b) {
|
||||
a.search_results_touchmove(b)
|
||||
}),
|
||||
this.search_results.bind("touchend.chosen", function (b) {
|
||||
a.search_results_touchend(b)
|
||||
}),
|
||||
this.form_field_jq.bind("chosen:updated.chosen", function (b) {
|
||||
a.results_update_field(b)
|
||||
}),
|
||||
this.form_field_jq.bind("chosen:activate.chosen", function (b) {
|
||||
a.activate_field(b)
|
||||
}),
|
||||
this.form_field_jq.bind("chosen:open.chosen", function (b) {
|
||||
a.container_mousedown(b)
|
||||
}),
|
||||
this.form_field_jq.bind("chosen:close.chosen", function (b) {
|
||||
a.input_blur(b)
|
||||
}),
|
||||
this.search_field.bind("blur.chosen", function (b) {
|
||||
a.input_blur(b)
|
||||
}),
|
||||
this.search_field.bind("keyup.chosen", function (b) {
|
||||
a.keyup_checker(b)
|
||||
}),
|
||||
this.search_field.bind("keydown.chosen", function (b) {
|
||||
a.keydown_checker(b)
|
||||
}),
|
||||
this.search_field.bind("focus.chosen", function (b) {
|
||||
a.input_focus(b)
|
||||
}),
|
||||
this.search_field.bind("cut.chosen", function (b) {
|
||||
a.clipboard_event_checker(b)
|
||||
}),
|
||||
this.search_field.bind("paste.chosen", function (b) {
|
||||
a.clipboard_event_checker(b)
|
||||
}),
|
||||
this.is_multiple ? this.search_choices.bind("click.chosen", function (b) {
|
||||
a.choices_click(b)
|
||||
}) : this.container.bind("click.chosen", function (a) {
|
||||
a.preventDefault()
|
||||
})
|
||||
},
|
||||
Chosen.prototype.destroy = function () {
|
||||
return a(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action),
|
||||
this.search_field[0].tabIndex && (this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex),
|
||||
this.container.remove(),
|
||||
this.form_field_jq.removeData("chosen"),
|
||||
this.form_field_jq.show()
|
||||
},
|
||||
Chosen.prototype.search_field_disabled = function () {
|
||||
return this.is_disabled = this.form_field_jq[0].disabled,
|
||||
this.is_disabled ? (this.container.addClass("chosen-disabled"), this.search_field[0].disabled = !0, this.is_multiple || this.selected_item.unbind("focus.chosen", this.activate_action), this.close_field()) : (this.container.removeClass("chosen-disabled"), this.search_field[0].disabled = !1, this.is_multiple ? void 0 : this.selected_item.bind("focus.chosen", this.activate_action))
|
||||
},
|
||||
Chosen.prototype.container_mousedown = function (b) {
|
||||
return this.is_disabled || (b && "mousedown" === b.type && !this.results_showing && b.preventDefault(), null != b && a(b.target).hasClass("search-choice-close")) ? void 0 : (this.active_field ? this.is_multiple || !b || a(b.target)[0] !== this.selected_item[0] && !a(b.target).parents("a.chosen-single").length || (b.preventDefault(), this.results_toggle()) : (this.is_multiple && this.search_field.val(""), a(this.container[0].ownerDocument).bind("click.chosen", this.click_test_action), this.results_show()), this.activate_field())
|
||||
},
|
||||
Chosen.prototype.container_mouseup = function (a) {
|
||||
return "ABBR" !== a.target.nodeName || this.is_disabled ? void 0 : this.results_reset(a)
|
||||
},
|
||||
Chosen.prototype.search_results_mousewheel = function (a) {
|
||||
var b;
|
||||
return a.originalEvent && (b = a.originalEvent.deltaY || -a.originalEvent.wheelDelta || a.originalEvent.detail),
|
||||
null != b ? (a.preventDefault(), "DOMMouseScroll" === a.type && (b = 40 * b), this.search_results.scrollTop(b + this.search_results.scrollTop())) : void 0
|
||||
},
|
||||
Chosen.prototype.blur_test = function () {
|
||||
return !this.active_field && this.container.hasClass("chosen-container-active") ? this.close_field() : void 0
|
||||
},
|
||||
Chosen.prototype.close_field = function () {
|
||||
return a(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action),
|
||||
this.active_field = !1,
|
||||
this.results_hide(),
|
||||
this.container.removeClass("chosen-container-active"),
|
||||
this.clear_backstroke(),
|
||||
this.show_search_field_default(),
|
||||
this.search_field_scale()
|
||||
},
|
||||
Chosen.prototype.activate_field = function () {
|
||||
return this.container.addClass("chosen-container-active"),
|
||||
this.active_field = !0,
|
||||
this.search_field.val(this.search_field.val()),
|
||||
this.search_field.focus()
|
||||
},
|
||||
Chosen.prototype.test_active_click = function (b) {
|
||||
var c;
|
||||
return c = a(b.target).closest(".chosen-container"),
|
||||
c.length && this.container[0] === c[0] ? this.active_field = !0 : this.close_field()
|
||||
},
|
||||
Chosen.prototype.results_build = function () {
|
||||
return this.parsing = !0,
|
||||
this.selected_option_count = null,
|
||||
this.results_data = SelectParser.select_to_array(this.form_field),
|
||||
this.is_multiple ? this.search_choices.find("li.search-choice").remove() : this.is_multiple || (this.single_set_selected_text(), this.disable_search || this.form_field.options.length <= this.disable_search_threshold ? (this.search_field[0].readOnly = !0, this.container.addClass("chosen-container-single-nosearch")) : (this.search_field[0].readOnly = !1, this.container.removeClass("chosen-container-single-nosearch"))),
|
||||
this.update_results_content(this.results_option_build({
|
||||
first: !0
|
||||
})),
|
||||
this.search_field_disabled(),
|
||||
this.show_search_field_default(),
|
||||
this.search_field_scale(),
|
||||
this.parsing = !1
|
||||
},
|
||||
Chosen.prototype.result_do_highlight = function (a) {
|
||||
var b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f;
|
||||
if (a.length) {
|
||||
if (this.result_clear_highlight(), this.result_highlight = a, this.result_highlight.addClass("highlighted"), d = parseInt(this.search_results.css("maxHeight"), 10), f = this.search_results.scrollTop(), e = d + f, c = this.result_highlight.position().top + this.search_results.scrollTop(), b = c + this.result_highlight.outerHeight(), b >= e)
|
||||
return this.search_results.scrollTop(b - d > 0 ? b - d : 0);
|
||||
if (f > c)
|
||||
return this.search_results.scrollTop(c)
|
||||
}
|
||||
},
|
||||
Chosen.prototype.result_clear_highlight = function () {
|
||||
return this.result_highlight && this.result_highlight.removeClass("highlighted"),
|
||||
this.result_highlight = null
|
||||
},
|
||||
Chosen.prototype.results_show = function () {
|
||||
return this.is_multiple && this.max_selected_options <= this.choices_count() ? (this.form_field_jq.trigger("chosen:maxselected", {
|
||||
chosen: this
|
||||
}), !1) : (this.container.addClass("chosen-with-drop"), this.results_showing = !0, this.search_field.focus(), this.search_field.val(this.search_field.val()), this.winnow_results(), this.form_field_jq.trigger("chosen:showing_dropdown", {
|
||||
chosen: this
|
||||
}))
|
||||
},
|
||||
Chosen.prototype.update_results_content = function (a) {
|
||||
return this.search_results.html(a)
|
||||
},
|
||||
Chosen.prototype.results_hide = function () {
|
||||
return this.results_showing && (this.result_clear_highlight(), this.container.removeClass("chosen-with-drop"), this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
||||
chosen: this
|
||||
})),
|
||||
this.results_showing = !1
|
||||
},
|
||||
Chosen.prototype.set_tab_index = function () {
|
||||
var a;
|
||||
return this.form_field.tabIndex ? (a = this.form_field.tabIndex, this.form_field.tabIndex = -1, this.search_field[0].tabIndex = a) : void 0
|
||||
},
|
||||
Chosen.prototype.set_label_behavior = function () {
|
||||
var b = this;
|
||||
return this.form_field_label = this.form_field_jq.parents("label"),
|
||||
!this.form_field_label.length && this.form_field.id.length && (this.form_field_label = a("label[for='" + this.form_field.id + "']")),
|
||||
this.form_field_label.length > 0 ? this.form_field_label.bind("click.chosen", function (a) {
|
||||
return b.is_multiple ? b.container_mousedown(a) : b.activate_field()
|
||||
}) : void 0
|
||||
},
|
||||
Chosen.prototype.show_search_field_default = function () {
|
||||
return this.is_multiple && this.choices_count() < 1 && !this.active_field ? (this.search_field.val(this.default_text), this.search_field.addClass("default")) : (this.search_field.val(""), this.search_field.removeClass("default"))
|
||||
},
|
||||
Chosen.prototype.search_results_mouseup = function (b) {
|
||||
var c;
|
||||
return c = a(b.target).hasClass("active-result") ? a(b.target) : a(b.target).parents(".active-result").first(),
|
||||
c.length ? (this.result_highlight = c, this.result_select(b), this.search_field.focus()) : void 0
|
||||
},
|
||||
Chosen.prototype.search_results_mouseover = function (b) {
|
||||
var c;
|
||||
return c = a(b.target).hasClass("active-result") ? a(b.target) : a(b.target).parents(".active-result").first(),
|
||||
c ? this.result_do_highlight(c) : void 0
|
||||
},
|
||||
Chosen.prototype.search_results_mouseout = function (b) {
|
||||
return a(b.target).hasClass("active-result") ? this.result_clear_highlight() : void 0
|
||||
},
|
||||
Chosen.prototype.choice_build = function (b) {
|
||||
var c,
|
||||
d,
|
||||
e = this;
|
||||
return c = a("<li />", {
|
||||
"class": "search-choice"
|
||||
}).html("<span>" + b.html + "</span>"),
|
||||
b.disabled ? c.addClass("search-choice-disabled") : (d = a("<a />", {
|
||||
"class": "search-choice-close",
|
||||
"data-option-array-index": b.array_index
|
||||
}), d.bind("click.chosen", function (a) {
|
||||
return e.choice_destroy_link_click(a)
|
||||
}), c.append(d)),
|
||||
this.search_container.before(c)
|
||||
},
|
||||
Chosen.prototype.choice_destroy_link_click = function (b) {
|
||||
return b.preventDefault(),
|
||||
b.stopPropagation(),
|
||||
this.is_disabled ? void 0 : this.choice_destroy(a(b.target))
|
||||
},
|
||||
Chosen.prototype.choice_destroy = function (a) {
|
||||
return this.result_deselect(a[0].getAttribute("data-option-array-index")) ? (this.show_search_field_default(), this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1 && this.results_hide(), a.parents("li").first().remove(), this.search_field_scale()) : void 0
|
||||
},
|
||||
Chosen.prototype.results_reset = function () {
|
||||
return this.reset_single_select_options(),
|
||||
this.form_field.options[0].selected = !0,
|
||||
this.single_set_selected_text(),
|
||||
this.show_search_field_default(),
|
||||
this.results_reset_cleanup(),
|
||||
this.form_field_jq.trigger("change"),
|
||||
this.active_field ? this.results_hide() : void 0
|
||||
},
|
||||
Chosen.prototype.results_reset_cleanup = function () {
|
||||
return this.current_selectedIndex = this.form_field.selectedIndex,
|
||||
this.selected_item.find("abbr").remove()
|
||||
},
|
||||
Chosen.prototype.result_select = function (a) {
|
||||
var b,
|
||||
c;
|
||||
return this.result_highlight ? (b = this.result_highlight, this.result_clear_highlight(), this.is_multiple && this.max_selected_options <= this.choices_count() ? (this.form_field_jq.trigger("chosen:maxselected", {
|
||||
chosen: this
|
||||
}), !1) : (this.is_multiple ? b.removeClass("active-result") : this.reset_single_select_options(), c = this.results_data[b[0].getAttribute("data-option-array-index")], c.selected = !0, this.form_field.options[c.options_index].selected = !0, this.selected_option_count = null, this.is_multiple ? this.choice_build(c) : this.single_set_selected_text(c.text), (a.metaKey || a.ctrlKey) && this.is_multiple || this.results_hide(), this.search_field.val(""), (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) && this.form_field_jq.trigger("change", {
|
||||
selected: this.form_field.options[c.options_index].value
|
||||
}), this.current_selectedIndex = this.form_field.selectedIndex, this.search_field_scale())) : void 0
|
||||
},
|
||||
Chosen.prototype.single_set_selected_text = function (a) {
|
||||
return null == a && (a = this.default_text),
|
||||
a === this.default_text ? this.selected_item.addClass("chosen-default") : (this.single_deselect_control_build(), this.selected_item.removeClass("chosen-default")),
|
||||
this.selected_item.find("span").text(a)
|
||||
},
|
||||
Chosen.prototype.result_deselect = function (a) {
|
||||
var b;
|
||||
return b = this.results_data[a],
|
||||
this.form_field.options[b.options_index].disabled ? !1 : (b.selected = !1, this.form_field.options[b.options_index].selected = !1, this.selected_option_count = null, this.result_clear_highlight(), this.results_showing && this.winnow_results(), this.form_field_jq.trigger("change", {
|
||||
deselected: this.form_field.options[b.options_index].value
|
||||
}), this.search_field_scale(), !0)
|
||||
},
|
||||
Chosen.prototype.single_deselect_control_build = function () {
|
||||
return this.allow_single_deselect ? (this.selected_item.find("abbr").length || this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'), this.selected_item.addClass("chosen-single-with-deselect")) : void 0
|
||||
},
|
||||
Chosen.prototype.get_search_text = function () {
|
||||
return this.search_field.val() === this.default_text ? "" : a("<div/>").text(a.trim(this.search_field.val())).html()
|
||||
},
|
||||
Chosen.prototype.winnow_results_set_highlight = function () {
|
||||
var a,
|
||||
b;
|
||||
return b = this.is_multiple ? [] : this.search_results.find(".result-selected.active-result"),
|
||||
a = b.length ? b.first() : this.search_results.find(".active-result").first(),
|
||||
null != a ? this.result_do_highlight(a) : void 0
|
||||
},
|
||||
Chosen.prototype.no_results = function (b) {
|
||||
var c;
|
||||
return c = a('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>'),
|
||||
c.find("span").first().html(b),
|
||||
this.search_results.append(c),
|
||||
this.form_field_jq.trigger("chosen:no_results", {
|
||||
chosen: this
|
||||
})
|
||||
},
|
||||
Chosen.prototype.no_results_clear = function () {
|
||||
return this.search_results.find(".no-results").remove()
|
||||
},
|
||||
Chosen.prototype.keydown_arrow = function () {
|
||||
var a;
|
||||
return this.results_showing && this.result_highlight ? (a = this.result_highlight.nextAll("li.active-result").first()) ? this.result_do_highlight(a) : void 0 : this.results_show()
|
||||
},
|
||||
Chosen.prototype.keyup_arrow = function () {
|
||||
var a;
|
||||
return this.results_showing || this.is_multiple ? this.result_highlight ? (a = this.result_highlight.prevAll("li.active-result"), a.length ? this.result_do_highlight(a.first()) : (this.choices_count() > 0 && this.results_hide(), this.result_clear_highlight())) : void 0 : this.results_show()
|
||||
},
|
||||
Chosen.prototype.keydown_backstroke = function () {
|
||||
var a;
|
||||
return this.pending_backstroke ? (this.choice_destroy(this.pending_backstroke.find("a").first()), this.clear_backstroke()) : (a = this.search_container.siblings("li.search-choice").last(), a.length && !a.hasClass("search-choice-disabled") ? (this.pending_backstroke = a, this.single_backstroke_delete ? this.keydown_backstroke() : this.pending_backstroke.addClass("search-choice-focus")) : void 0)
|
||||
},
|
||||
Chosen.prototype.clear_backstroke = function () {
|
||||
return this.pending_backstroke && this.pending_backstroke.removeClass("search-choice-focus"),
|
||||
this.pending_backstroke = null
|
||||
},
|
||||
Chosen.prototype.keydown_checker = function (a) {
|
||||
var b,
|
||||
c;
|
||||
switch (b = null != (c = a.which) ? c : a.keyCode, this.search_field_scale(), 8 !== b && this.pending_backstroke && this.clear_backstroke(), b) {
|
||||
case 8:
|
||||
this.backstroke_length = this.search_field.val().length;
|
||||
break;
|
||||
case 9:
|
||||
this.results_showing && !this.is_multiple && this.result_select(a),
|
||||
this.mouse_on_container = !1;
|
||||
break;
|
||||
case 13:
|
||||
this.results_showing && a.preventDefault();
|
||||
break;
|
||||
case 32:
|
||||
this.disable_search && a.preventDefault();
|
||||
break;
|
||||
case 38:
|
||||
a.preventDefault(),
|
||||
this.keyup_arrow();
|
||||
break;
|
||||
case 40:
|
||||
a.preventDefault(),
|
||||
this.keydown_arrow()
|
||||
}
|
||||
},
|
||||
Chosen.prototype.search_field_scale = function () {
|
||||
var b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
g,
|
||||
h,
|
||||
i,
|
||||
j;
|
||||
if (this.is_multiple) {
|
||||
for (d = 0, h = 0, f = "position:absolute; left: -1000px; top: -1000px; display:none;", g = ["font-size", "font-style", "font-weight", "font-family", "line-height", "text-transform", "letter-spacing"], i = 0, j = g.length; j > i; i++)
|
||||
e = g[i], f += e + ":" + this.search_field.css(e) + ";";
|
||||
return b = a("<div />", {
|
||||
style: f
|
||||
}),
|
||||
b.text(this.search_field.val()),
|
||||
a("body").append(b),
|
||||
h = b.width() + 25,
|
||||
b.remove(),
|
||||
c = this.container.outerWidth(),
|
||||
h > c - 10 && (h = c - 10),
|
||||
this.search_field.css({
|
||||
width: h + "px"
|
||||
})
|
||||
}
|
||||
},
|
||||
Chosen
|
||||
}
|
||||
(AbstractChosen)
|
||||
}
|
||||
.call(this);
|
After Width: | Height: | Size: 538 B |
After Width: | Height: | Size: 738 B |
@ -0,0 +1,496 @@
|
||||
/*!
|
||||
Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||
by Patrick Filler for Harvest, http://getharvest.com
|
||||
|
||||
Version 1.8.7
|
||||
Full source at https://github.com/harvesthq/chosen
|
||||
Copyright (c) 2011-2018 Harvest http://getharvest.com
|
||||
|
||||
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||
This file is generated by `grunt build`, do not edit it by hand.
|
||||
*/
|
||||
|
||||
/* @group Base */
|
||||
.chosen-container {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
font-size: 13px;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.chosen-container * {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-drop {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
z-index: 1010;
|
||||
width: 100%;
|
||||
border: 1px solid #aaa;
|
||||
border-top: 0;
|
||||
background: #fff;
|
||||
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||
clip: rect(0, 0, 0, 0);
|
||||
-webkit-clip-path: inset(100% 100%);
|
||||
clip-path: inset(100% 100%);
|
||||
}
|
||||
|
||||
.chosen-container.chosen-with-drop .chosen-drop {
|
||||
clip: auto;
|
||||
-webkit-clip-path: none;
|
||||
clip-path: none;
|
||||
}
|
||||
|
||||
.chosen-container a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
|
||||
margin-right: 4px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: normal;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
|
||||
content: ":";
|
||||
padding-left: 2px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Single Chosen */
|
||||
.chosen-container-single .chosen-single {
|
||||
position: relative;
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
padding: 0 0 0 8px;
|
||||
height: 25px;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 5px;
|
||||
background-color: #fff;
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #fff), color-stop(50%, #f6f6f6), color-stop(52%, #eee), to(#f4f4f4));
|
||||
background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);
|
||||
background-clip: padding-box;
|
||||
-webkit-box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
||||
color: #444;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-default {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin-right: 26px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single-with-deselect span {
|
||||
margin-right: 38px;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single abbr {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 26px;
|
||||
display: block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: url("chosen-sprite.png") -42px 1px no-repeat;
|
||||
font-size: 1px;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single abbr:hover {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
|
||||
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single div {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: block;
|
||||
width: 18px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-single div b {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: url("chosen-sprite.png") no-repeat 0px 2px;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-search {
|
||||
position: relative;
|
||||
z-index: 1010;
|
||||
margin: 0;
|
||||
padding: 3px 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-search input[type="text"] {
|
||||
margin: 1px 0;
|
||||
padding: 4px 20px 4px 5px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
outline: 0;
|
||||
border: 1px solid #aaa;
|
||||
background: url("chosen-sprite.png") no-repeat 100% -20px;
|
||||
font-size: 1em;
|
||||
font-family: sans-serif;
|
||||
line-height: normal;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.chosen-container-single .chosen-drop {
|
||||
margin-top: -1px;
|
||||
border-radius: 0 0 4px 4px;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
-webkit-clip-path: inset(100% 100%);
|
||||
clip-path: inset(100% 100%);
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Results */
|
||||
.chosen-container .chosen-results {
|
||||
color: #444;
|
||||
position: relative;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
margin: 0 4px 4px 0;
|
||||
padding: 0 0 0 4px;
|
||||
max-height: 240px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li {
|
||||
display: none;
|
||||
margin: 0;
|
||||
padding: 5px 6px;
|
||||
list-style: none;
|
||||
line-height: 15px;
|
||||
word-wrap: break-word;
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.active-result {
|
||||
display: list-item;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.disabled-result {
|
||||
display: list-item;
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.highlighted {
|
||||
background-color: #3875d7;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
|
||||
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.no-results {
|
||||
color: #777;
|
||||
display: list-item;
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.group-result {
|
||||
display: list-item;
|
||||
font-weight: bold;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li.group-option {
|
||||
padding-left: 15px;
|
||||
}
|
||||
|
||||
.chosen-container .chosen-results li em {
|
||||
font-style: normal;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Multi Chosen */
|
||||
.chosen-container-multi .chosen-choices {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border: 1px solid #aaa;
|
||||
background-color: #fff;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(1%, #eee), color-stop(15%, #fff));
|
||||
background-image: linear-gradient(#eee 1%, #fff 15%);
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li {
|
||||
float: left;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-field {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
||||
margin: 1px 0;
|
||||
padding: 0;
|
||||
height: 25px;
|
||||
outline: 0;
|
||||
border: 0 !important;
|
||||
background: transparent !important;
|
||||
-webkit-box-shadow: none;
|
||||
box-shadow: none;
|
||||
color: #999;
|
||||
font-size: 100%;
|
||||
font-family: sans-serif;
|
||||
line-height: normal;
|
||||
border-radius: 0;
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice {
|
||||
position: relative;
|
||||
margin: 3px 5px 3px 0;
|
||||
padding: 3px 20px 3px 5px;
|
||||
border: 1px solid #aaa;
|
||||
max-width: 100%;
|
||||
border-radius: 3px;
|
||||
background-color: #eeeeee;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), to(#eee));
|
||||
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
||||
background-size: 100% 19px;
|
||||
background-repeat: repeat-x;
|
||||
background-clip: padding-box;
|
||||
-webkit-box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
||||
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
||||
color: #333;
|
||||
line-height: 13px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice span {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 3px;
|
||||
display: block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
background: url("chosen-sprite.png") -42px 1px no-repeat;
|
||||
font-size: 1px;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
||||
padding-right: 5px;
|
||||
border: 1px solid #ccc;
|
||||
background-color: #e4e4e4;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), to(#eee));
|
||||
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
||||
background: #d4d4d4;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
||||
background-position: -42px -10px;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-results {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.chosen-container-multi .chosen-drop .result-selected {
|
||||
display: list-item;
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Active */
|
||||
.chosen-container-active .chosen-single {
|
||||
border: 1px solid #5897fb;
|
||||
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.chosen-container-active.chosen-with-drop .chosen-single {
|
||||
border: 1px solid #aaa;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(20%, #eee), color-stop(80%, #fff));
|
||||
background-image: linear-gradient(#eee 20%, #fff 80%);
|
||||
-webkit-box-shadow: 0 1px 0 #fff inset;
|
||||
box-shadow: 0 1px 0 #fff inset;
|
||||
}
|
||||
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-left: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
||||
background-position: -18px 2px;
|
||||
}
|
||||
|
||||
.chosen-container-active .chosen-choices {
|
||||
border: 1px solid #5897fb;
|
||||
-webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
||||
color: #222 !important;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Disabled Support */
|
||||
.chosen-disabled {
|
||||
opacity: 0.5 !important;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.chosen-disabled .chosen-single {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Right to Left */
|
||||
.chosen-rtl {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single {
|
||||
overflow: visible;
|
||||
padding: 0 8px 0 0;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single span {
|
||||
margin-right: 0;
|
||||
margin-left: 26px;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single-with-deselect span {
|
||||
margin-left: 38px;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single div {
|
||||
right: auto;
|
||||
left: 3px;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-single abbr {
|
||||
right: auto;
|
||||
left: 26px;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li.search-choice {
|
||||
margin: 3px 5px 3px 0;
|
||||
padding: 3px 5px 3px 19px;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
||||
right: auto;
|
||||
left: 4px;
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-single .chosen-results {
|
||||
margin: 0 0 4px 4px;
|
||||
padding: 0 4px 0 0;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-results li.group-option {
|
||||
padding-right: 15px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.chosen-rtl .chosen-search input[type="text"] {
|
||||
padding: 4px 5px 4px 20px;
|
||||
background: url("chosen-sprite.png") no-repeat -30px -20px;
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-single .chosen-single div b {
|
||||
background-position: 6px 2px;
|
||||
}
|
||||
|
||||
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
||||
background-position: -12px 2px;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
/* @group Retina compatibility */
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
|
||||
.chosen-rtl .chosen-search input[type="text"],
|
||||
.chosen-container-single .chosen-single abbr,
|
||||
.chosen-container-single .chosen-single div b,
|
||||
.chosen-container-single .chosen-search input[type="text"],
|
||||
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
||||
.chosen-container .chosen-results-scroll-down span,
|
||||
.chosen-container .chosen-results-scroll-up span {
|
||||
background-image: url("chosen-sprite@2x.png") !important;
|
||||
background-size: 52px 37px !important;
|
||||
background-repeat: no-repeat !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* @end */
|
@ -0,0 +1,41 @@
|
||||
[jQuery Validation Plugin](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) - Form validation made easy
|
||||
================================
|
||||
|
||||
[](http://travis-ci.org/jzaefferer/jquery-validation)
|
||||
|
||||
The jQuery Validation Plugin provides drop-in validation for your existing forms, while making all kinds of customizations to fit your application really easy.
|
||||
|
||||
## [Help the project](http://pledgie.com/campaigns/18159)
|
||||
|
||||
[](http://pledgie.com/campaigns/18159)
|
||||
|
||||
This project is looking for help! [You can donate to the ongoing pledgie campaign](http://pledgie.com/campaigns/18159)
|
||||
and help spread the word. If you've used the plugin, or plan to use, consider a donation - any amount will help.
|
||||
|
||||
You can find the plan for how to spend the money on the [pledgie page](http://pledgie.com/campaigns/18159).
|
||||
|
||||
## Getting Started
|
||||
|
||||
Include jQuery and the plugin on a page. Then select a form to validate and call the `validate` method.
|
||||
|
||||
```html
|
||||
<form>
|
||||
<input required>
|
||||
</form>
|
||||
<script src="jquery.js"></script>
|
||||
<script src="jquery.validation.js"></script>
|
||||
<script>
|
||||
$("form").validate();
|
||||
</script>
|
||||
```
|
||||
|
||||
For more information on how to setup a rules and customizations, [check the documentation](http://docs.jquery.com/Plugins/Validation).
|
||||
|
||||
## Contributing
|
||||
Follow the [jQuery style guide](http://contribute.jquery.com/style-guides/js), even if existing code doesn't. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt/).
|
||||
|
||||
If you've wrote custom methods that you'd like to contribute to additional-methods.js, create a branch, add the method there and send a pull request for that branch.
|
||||
|
||||
## License
|
||||
Copyright (c) 2013 Jörn Zaefferer
|
||||
Licensed under the MIT license.
|
@ -0,0 +1,617 @@
|
||||
/*!
|
||||
* jQuery Validation Plugin 1.11.1
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
||||
* http://docs.jquery.com/Plugins/Validation
|
||||
*
|
||||
* Copyright 2013 Jörn Zaefferer
|
||||
* Released under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
function stripHtml(value) {
|
||||
// remove html tags and space chars
|
||||
return value.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' ')
|
||||
// remove punctuation
|
||||
.replace(/[.(),;:!?%#$'"_+=\/\-]*/g,'');
|
||||
}
|
||||
jQuery.validator.addMethod("maxWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length <= params;
|
||||
}, jQuery.validator.format("Please enter {0} words or less."));
|
||||
|
||||
jQuery.validator.addMethod("minWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
|
||||
}, jQuery.validator.format("Please enter at least {0} words."));
|
||||
|
||||
jQuery.validator.addMethod("rangeWords", function(value, element, params) {
|
||||
var valueStripped = stripHtml(value);
|
||||
var regex = /\b\w+\b/g;
|
||||
return this.optional(element) || valueStripped.match(regex).length >= params[0] && valueStripped.match(regex).length <= params[1];
|
||||
}, jQuery.validator.format("Please enter between {0} and {1} words."));
|
||||
|
||||
}());
|
||||
|
||||
jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
|
||||
return this.optional(element) || /^[a-z\-.,()'"\s]+$/i.test(value);
|
||||
}, "Letters or punctuation only please");
|
||||
|
||||
jQuery.validator.addMethod("alphanumeric", function(value, element) {
|
||||
return this.optional(element) || /^\w+$/i.test(value);
|
||||
}, "Letters, numbers, and underscores only please");
|
||||
|
||||
jQuery.validator.addMethod("lettersonly", function(value, element) {
|
||||
return this.optional(element) || /^[a-z]+$/i.test(value);
|
||||
}, "Letters only please");
|
||||
|
||||
jQuery.validator.addMethod("nowhitespace", function(value, element) {
|
||||
return this.optional(element) || /^\S+$/i.test(value);
|
||||
}, "No white space please");
|
||||
|
||||
jQuery.validator.addMethod("ziprange", function(value, element) {
|
||||
return this.optional(element) || /^90[2-5]\d\{2\}-\d{4}$/.test(value);
|
||||
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
|
||||
|
||||
jQuery.validator.addMethod("zipcodeUS", function(value, element) {
|
||||
return this.optional(element) || /\d{5}-\d{4}$|^\d{5}$/.test(value);
|
||||
}, "The specified US ZIP Code is invalid");
|
||||
|
||||
jQuery.validator.addMethod("integer", function(value, element) {
|
||||
return this.optional(element) || /^-?\d+$/.test(value);
|
||||
}, "A positive or negative non-decimal number please");
|
||||
|
||||
/**
|
||||
* Return true, if the value is a valid vehicle identification number (VIN).
|
||||
*
|
||||
* Works with all kind of text inputs.
|
||||
*
|
||||
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
|
||||
* @desc Declares a required input element whose value must be a valid vehicle identification number.
|
||||
*
|
||||
* @name jQuery.validator.methods.vinUS
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("vinUS", function(v) {
|
||||
if (v.length !== 17) {
|
||||
return false;
|
||||
}
|
||||
var i, n, d, f, cd, cdv;
|
||||
var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
|
||||
var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
|
||||
var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
|
||||
var rs = 0;
|
||||
for(i = 0; i < 17; i++){
|
||||
f = FL[i];
|
||||
d = v.slice(i,i+1);
|
||||
if (i === 8) {
|
||||
cdv = d;
|
||||
}
|
||||
if (!isNaN(d)) {
|
||||
d *= f;
|
||||
} else {
|
||||
for (n = 0; n < LL.length; n++) {
|
||||
if (d.toUpperCase() === LL[n]) {
|
||||
d = VL[n];
|
||||
d *= f;
|
||||
if (isNaN(cdv) && n === 8) {
|
||||
cdv = LL[n];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rs += d;
|
||||
}
|
||||
cd = rs % 11;
|
||||
if (cd === 10) {
|
||||
cd = "X";
|
||||
}
|
||||
if (cd === cdv) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "The specified vehicle identification number (VIN) is invalid.");
|
||||
|
||||
/**
|
||||
* Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01/01/1900")
|
||||
* @result true
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01/13/1990")
|
||||
* @result false
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01.01.1900")
|
||||
* @result false
|
||||
*
|
||||
* @example <input name="pippo" class="{dateITA:true}" />
|
||||
* @desc Declares an optional input element whose value must be a valid date.
|
||||
*
|
||||
* @name jQuery.validator.methods.dateITA
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("dateITA", function(value, element) {
|
||||
var check = false;
|
||||
var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
|
||||
if( re.test(value)) {
|
||||
var adata = value.split('/');
|
||||
var gg = parseInt(adata[0],10);
|
||||
var mm = parseInt(adata[1],10);
|
||||
var aaaa = parseInt(adata[2],10);
|
||||
var xdata = new Date(aaaa,mm-1,gg);
|
||||
if ( ( xdata.getFullYear() === aaaa ) && ( xdata.getMonth() === mm - 1 ) && ( xdata.getDate() === gg ) ){
|
||||
check = true;
|
||||
} else {
|
||||
check = false;
|
||||
}
|
||||
} else {
|
||||
check = false;
|
||||
}
|
||||
return this.optional(element) || check;
|
||||
}, "Please enter a correct date");
|
||||
|
||||
/**
|
||||
* IBAN is the international bank account number.
|
||||
* It has a country - specific format, that is checked here too
|
||||
*/
|
||||
jQuery.validator.addMethod("iban", function(value, element) {
|
||||
// some quick simple tests to prevent needless work
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (!(/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(value))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the country code and find the country specific format
|
||||
var iban = value.replace(/ /g,'').toUpperCase(); // remove spaces and to upper case
|
||||
var countrycode = iban.substring(0,2);
|
||||
var bbancountrypatterns = {
|
||||
'AL': "\\d{8}[\\dA-Z]{16}",
|
||||
'AD': "\\d{8}[\\dA-Z]{12}",
|
||||
'AT': "\\d{16}",
|
||||
'AZ': "[\\dA-Z]{4}\\d{20}",
|
||||
'BE': "\\d{12}",
|
||||
'BH': "[A-Z]{4}[\\dA-Z]{14}",
|
||||
'BA': "\\d{16}",
|
||||
'BR': "\\d{23}[A-Z][\\dA-Z]",
|
||||
'BG': "[A-Z]{4}\\d{6}[\\dA-Z]{8}",
|
||||
'CR': "\\d{17}",
|
||||
'HR': "\\d{17}",
|
||||
'CY': "\\d{8}[\\dA-Z]{16}",
|
||||
'CZ': "\\d{20}",
|
||||
'DK': "\\d{14}",
|
||||
'DO': "[A-Z]{4}\\d{20}",
|
||||
'EE': "\\d{16}",
|
||||
'FO': "\\d{14}",
|
||||
'FI': "\\d{14}",
|
||||
'FR': "\\d{10}[\\dA-Z]{11}\\d{2}",
|
||||
'GE': "[\\dA-Z]{2}\\d{16}",
|
||||
'DE': "\\d{18}",
|
||||
'GI': "[A-Z]{4}[\\dA-Z]{15}",
|
||||
'GR': "\\d{7}[\\dA-Z]{16}",
|
||||
'GL': "\\d{14}",
|
||||
'GT': "[\\dA-Z]{4}[\\dA-Z]{20}",
|
||||
'HU': "\\d{24}",
|
||||
'IS': "\\d{22}",
|
||||
'IE': "[\\dA-Z]{4}\\d{14}",
|
||||
'IL': "\\d{19}",
|
||||
'IT': "[A-Z]\\d{10}[\\dA-Z]{12}",
|
||||
'KZ': "\\d{3}[\\dA-Z]{13}",
|
||||
'KW': "[A-Z]{4}[\\dA-Z]{22}",
|
||||
'LV': "[A-Z]{4}[\\dA-Z]{13}",
|
||||
'LB': "\\d{4}[\\dA-Z]{20}",
|
||||
'LI': "\\d{5}[\\dA-Z]{12}",
|
||||
'LT': "\\d{16}",
|
||||
'LU': "\\d{3}[\\dA-Z]{13}",
|
||||
'MK': "\\d{3}[\\dA-Z]{10}\\d{2}",
|
||||
'MT': "[A-Z]{4}\\d{5}[\\dA-Z]{18}",
|
||||
'MR': "\\d{23}",
|
||||
'MU': "[A-Z]{4}\\d{19}[A-Z]{3}",
|
||||
'MC': "\\d{10}[\\dA-Z]{11}\\d{2}",
|
||||
'MD': "[\\dA-Z]{2}\\d{18}",
|
||||
'ME': "\\d{18}",
|
||||
'NL': "[A-Z]{4}\\d{10}",
|
||||
'NO': "\\d{11}",
|
||||
'PK': "[\\dA-Z]{4}\\d{16}",
|
||||
'PS': "[\\dA-Z]{4}\\d{21}",
|
||||
'PL': "\\d{24}",
|
||||
'PT': "\\d{21}",
|
||||
'RO': "[A-Z]{4}[\\dA-Z]{16}",
|
||||
'SM': "[A-Z]\\d{10}[\\dA-Z]{12}",
|
||||
'SA': "\\d{2}[\\dA-Z]{18}",
|
||||
'RS': "\\d{18}",
|
||||
'SK': "\\d{20}",
|
||||
'SI': "\\d{15}",
|
||||
'ES': "\\d{20}",
|
||||
'SE': "\\d{20}",
|
||||
'CH': "\\d{5}[\\dA-Z]{12}",
|
||||
'TN': "\\d{20}",
|
||||
'TR': "\\d{5}[\\dA-Z]{17}",
|
||||
'AE': "\\d{3}\\d{16}",
|
||||
'GB': "[A-Z]{4}\\d{14}",
|
||||
'VG': "[\\dA-Z]{4}\\d{16}"
|
||||
};
|
||||
var bbanpattern = bbancountrypatterns[countrycode];
|
||||
// As new countries will start using IBAN in the
|
||||
// future, we only check if the countrycode is known.
|
||||
// This prevents false negatives, while almost all
|
||||
// false positives introduced by this, will be caught
|
||||
// by the checksum validation below anyway.
|
||||
// Strict checking should return FALSE for unknown
|
||||
// countries.
|
||||
if (typeof bbanpattern !== 'undefined') {
|
||||
var ibanregexp = new RegExp("^[A-Z]{2}\\d{2}" + bbanpattern + "$", "");
|
||||
if (!(ibanregexp.test(iban))) {
|
||||
return false; // invalid country specific format
|
||||
}
|
||||
}
|
||||
|
||||
// now check the checksum, first convert to digits
|
||||
var ibancheck = iban.substring(4,iban.length) + iban.substring(0,4);
|
||||
var ibancheckdigits = "";
|
||||
var leadingZeroes = true;
|
||||
var charAt;
|
||||
for (var i =0; i<ibancheck.length; i++) {
|
||||
charAt = ibancheck.charAt(i);
|
||||
if (charAt !== "0") {
|
||||
leadingZeroes = false;
|
||||
}
|
||||
if (!leadingZeroes) {
|
||||
ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(charAt);
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the result of: ibancheckdigits % 97
|
||||
var cRest = '';
|
||||
var cOperator = '';
|
||||
for (var p=0; p<ibancheckdigits.length; p++) {
|
||||
var cChar = ibancheckdigits.charAt(p);
|
||||
cOperator = '' + cRest + '' + cChar;
|
||||
cRest = cOperator % 97;
|
||||
}
|
||||
return cRest === 1;
|
||||
}, "Please specify a valid IBAN");
|
||||
|
||||
jQuery.validator.addMethod("dateNL", function(value, element) {
|
||||
return this.optional(element) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(value);
|
||||
}, "Please enter a correct date");
|
||||
|
||||
/**
|
||||
* Dutch phone numbers have 10 digits (or 11 and start with +31).
|
||||
*/
|
||||
jQuery.validator.addMethod("phoneNL", function(value, element) {
|
||||
return this.optional(element) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(value);
|
||||
}, "Please specify a valid phone number.");
|
||||
|
||||
jQuery.validator.addMethod("mobileNL", function(value, element) {
|
||||
return this.optional(element) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(value);
|
||||
}, "Please specify a valid mobile number");
|
||||
|
||||
jQuery.validator.addMethod("postalcodeNL", function(value, element) {
|
||||
return this.optional(element) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(value);
|
||||
}, "Please specify a valid postal code");
|
||||
|
||||
/*
|
||||
* Dutch bank account numbers (not 'giro' numbers) have 9 digits
|
||||
* and pass the '11 check'.
|
||||
* We accept the notation with spaces, as that is common.
|
||||
* acceptable: 123456789 or 12 34 56 789
|
||||
*/
|
||||
jQuery.validator.addMethod("bankaccountNL", function(value, element) {
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (!(/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(value))) {
|
||||
return false;
|
||||
}
|
||||
// now '11 check'
|
||||
var account = value.replace(/ /g,''); // remove spaces
|
||||
var sum = 0;
|
||||
var len = account.length;
|
||||
for (var pos=0; pos<len; pos++) {
|
||||
var factor = len - pos;
|
||||
var digit = account.substring(pos, pos+1);
|
||||
sum = sum + factor * digit;
|
||||
}
|
||||
return sum % 11 === 0;
|
||||
}, "Please specify a valid bank account number");
|
||||
|
||||
/**
|
||||
* Dutch giro account numbers (not bank numbers) have max 7 digits
|
||||
*/
|
||||
jQuery.validator.addMethod("giroaccountNL", function(value, element) {
|
||||
return this.optional(element) || /^[0-9]{1,7}$/.test(value);
|
||||
}, "Please specify a valid giro account number");
|
||||
|
||||
jQuery.validator.addMethod("bankorgiroaccountNL", function(value, element) {
|
||||
return this.optional(element) ||
|
||||
($.validator.methods["bankaccountNL"].call(this, value, element)) ||
|
||||
($.validator.methods["giroaccountNL"].call(this, value, element));
|
||||
}, "Please specify a valid bank or giro account number");
|
||||
|
||||
|
||||
jQuery.validator.addMethod("time", function(value, element) {
|
||||
return this.optional(element) || /^([01]\d|2[0-3])(:[0-5]\d){1,2}$/.test(value);
|
||||
}, "Please enter a valid time, between 00:00 and 23:59");
|
||||
jQuery.validator.addMethod("time12h", function(value, element) {
|
||||
return this.optional(element) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(value);
|
||||
}, "Please enter a valid time in 12-hour am/pm format");
|
||||
|
||||
/**
|
||||
* matches US phone number format
|
||||
*
|
||||
* where the area code may not start with 1 and the prefix may not start with 1
|
||||
* allows '-' or ' ' as a separator and allows parens around area code
|
||||
* some people may want to put a '1' in front of their number
|
||||
*
|
||||
* 1(212)-999-2345 or
|
||||
* 212 999 2344 or
|
||||
* 212-999-0983
|
||||
*
|
||||
* but not
|
||||
* 111-123-5434
|
||||
* and not
|
||||
* 212 123 4567
|
||||
*/
|
||||
jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
|
||||
phone_number = phone_number.replace(/\s+/g, "");
|
||||
return this.optional(element) || phone_number.length > 9 &&
|
||||
phone_number.match(/^(\+?1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
|
||||
}, "Please specify a valid phone number");
|
||||
|
||||
jQuery.validator.addMethod('phoneUK', function(phone_number, element) {
|
||||
phone_number = phone_number.replace(/\(|\)|\s+|-/g,'');
|
||||
return this.optional(element) || phone_number.length > 9 &&
|
||||
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/);
|
||||
}, 'Please specify a valid phone number');
|
||||
|
||||
jQuery.validator.addMethod('mobileUK', function(phone_number, element) {
|
||||
phone_number = phone_number.replace(/\(|\)|\s+|-/g,'');
|
||||
return this.optional(element) || phone_number.length > 9 &&
|
||||
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[45789]\d{2}|624)\s?\d{3}\s?\d{3})$/);
|
||||
}, 'Please specify a valid mobile number');
|
||||
|
||||
//Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
|
||||
jQuery.validator.addMethod('phonesUK', function(phone_number, element) {
|
||||
phone_number = phone_number.replace(/\(|\)|\s+|-/g,'');
|
||||
return this.optional(element) || phone_number.length > 9 &&
|
||||
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[45789]\d{8}|624\d{6})))$/);
|
||||
}, 'Please specify a valid uk phone number');
|
||||
// On the above three UK functions, do the following server side processing:
|
||||
// Compare original input with this RegEx pattern:
|
||||
// ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
|
||||
// Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
|
||||
// Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
|
||||
// A number of very detailed GB telephone number RegEx patterns can also be found at:
|
||||
// http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
|
||||
|
||||
// Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK)
|
||||
jQuery.validator.addMethod('postcodeUK', function(value, element) {
|
||||
return this.optional(element) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(value);
|
||||
}, 'Please specify a valid UK postcode');
|
||||
|
||||
// TODO check if value starts with <, otherwise don't try stripping anything
|
||||
jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
|
||||
return jQuery(value).text().length >= param;
|
||||
}, jQuery.validator.format("Please enter at least {0} characters"));
|
||||
|
||||
// same as email, but TLD is optional
|
||||
jQuery.validator.addMethod("email2", function(value, element, param) {
|
||||
return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
|
||||
}, jQuery.validator.messages.email);
|
||||
|
||||
// same as url, but TLD is optional
|
||||
jQuery.validator.addMethod("url2", function(value, element, param) {
|
||||
return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
|
||||
}, jQuery.validator.messages.url);
|
||||
|
||||
// NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
|
||||
// Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
|
||||
// Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
|
||||
jQuery.validator.addMethod("creditcardtypes", function(value, element, param) {
|
||||
if (/[^0-9\-]+/.test(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = value.replace(/\D/g, "");
|
||||
|
||||
var validTypes = 0x0000;
|
||||
|
||||
if (param.mastercard) {
|
||||
validTypes |= 0x0001;
|
||||
}
|
||||
if (param.visa) {
|
||||
validTypes |= 0x0002;
|
||||
}
|
||||
if (param.amex) {
|
||||
validTypes |= 0x0004;
|
||||
}
|
||||
if (param.dinersclub) {
|
||||
validTypes |= 0x0008;
|
||||
}
|
||||
if (param.enroute) {
|
||||
validTypes |= 0x0010;
|
||||
}
|
||||
if (param.discover) {
|
||||
validTypes |= 0x0020;
|
||||
}
|
||||
if (param.jcb) {
|
||||
validTypes |= 0x0040;
|
||||
}
|
||||
if (param.unknown) {
|
||||
validTypes |= 0x0080;
|
||||
}
|
||||
if (param.all) {
|
||||
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
|
||||
}
|
||||
if (validTypes & 0x0001 && /^(5[12345])/.test(value)) { //mastercard
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0004 && /^(3[47])/.test(value)) { //amex
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test(value)) { //dinersclub
|
||||
return value.length === 14;
|
||||
}
|
||||
if (validTypes & 0x0010 && /^(2(014|149))/.test(value)) { //enroute
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0080) { //unknown
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "Please enter a valid credit card number.");
|
||||
|
||||
jQuery.validator.addMethod("ipv4", function(value, element, param) {
|
||||
return this.optional(element) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(value);
|
||||
}, "Please enter a valid IP v4 address.");
|
||||
|
||||
jQuery.validator.addMethod("ipv6", function(value, element, param) {
|
||||
return this.optional(element) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(value);
|
||||
}, "Please enter a valid IP v6 address.");
|
||||
|
||||
/**
|
||||
* Return true if the field value matches the given format RegExp
|
||||
*
|
||||
* @example jQuery.validator.methods.pattern("AR1004",element,/^AR\d{4}$/)
|
||||
* @result true
|
||||
*
|
||||
* @example jQuery.validator.methods.pattern("BR1004",element,/^AR\d{4}$/)
|
||||
* @result false
|
||||
*
|
||||
* @name jQuery.validator.methods.pattern
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("pattern", function(value, element, param) {
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (typeof param === 'string') {
|
||||
param = new RegExp('^(?:' + param + ')$');
|
||||
}
|
||||
return param.test(value);
|
||||
}, "Invalid format.");
|
||||
|
||||
|
||||
/*
|
||||
* Lets you say "at least X inputs that match selector Y must be filled."
|
||||
*
|
||||
* The end result is that neither of these inputs:
|
||||
*
|
||||
* <input class="productinfo" name="partnumber">
|
||||
* <input class="productinfo" name="description">
|
||||
*
|
||||
* ...will validate unless at least one of them is filled.
|
||||
*
|
||||
* partnumber: {require_from_group: [1,".productinfo"]},
|
||||
* description: {require_from_group: [1,".productinfo"]}
|
||||
*
|
||||
*/
|
||||
jQuery.validator.addMethod("require_from_group", function(value, element, options) {
|
||||
var validator = this;
|
||||
var selector = options[1];
|
||||
var validOrNot = $(selector, element.form).filter(function() {
|
||||
return validator.elementValue(this);
|
||||
}).length >= options[0];
|
||||
|
||||
if(!$(element).data('being_validated')) {
|
||||
var fields = $(selector, element.form);
|
||||
fields.data('being_validated', true);
|
||||
fields.valid();
|
||||
fields.data('being_validated', false);
|
||||
}
|
||||
return validOrNot;
|
||||
}, jQuery.format("Please fill at least {0} of these fields."));
|
||||
|
||||
/*
|
||||
* Lets you say "either at least X inputs that match selector Y must be filled,
|
||||
* OR they must all be skipped (left blank)."
|
||||
*
|
||||
* The end result, is that none of these inputs:
|
||||
*
|
||||
* <input class="productinfo" name="partnumber">
|
||||
* <input class="productinfo" name="description">
|
||||
* <input class="productinfo" name="color">
|
||||
*
|
||||
* ...will validate unless either at least two of them are filled,
|
||||
* OR none of them are.
|
||||
*
|
||||
* partnumber: {skip_or_fill_minimum: [2,".productinfo"]},
|
||||
* description: {skip_or_fill_minimum: [2,".productinfo"]},
|
||||
* color: {skip_or_fill_minimum: [2,".productinfo"]}
|
||||
*
|
||||
*/
|
||||
jQuery.validator.addMethod("skip_or_fill_minimum", function(value, element, options) {
|
||||
var validator = this,
|
||||
numberRequired = options[0],
|
||||
selector = options[1];
|
||||
var numberFilled = $(selector, element.form).filter(function() {
|
||||
return validator.elementValue(this);
|
||||
}).length;
|
||||
var valid = numberFilled >= numberRequired || numberFilled === 0;
|
||||
|
||||
if(!$(element).data('being_validated')) {
|
||||
var fields = $(selector, element.form);
|
||||
fields.data('being_validated', true);
|
||||
fields.valid();
|
||||
fields.data('being_validated', false);
|
||||
}
|
||||
return valid;
|
||||
}, jQuery.format("Please either skip these fields or fill at least {0} of them."));
|
||||
|
||||
// Accept a value from a file input based on a required mimetype
|
||||
jQuery.validator.addMethod("accept", function(value, element, param) {
|
||||
// Split mime on commas in case we have multiple types we can accept
|
||||
var typeParam = typeof param === "string" ? param.replace(/\s/g, '').replace(/,/g, '|') : "image/*",
|
||||
optionalValue = this.optional(element),
|
||||
i, file;
|
||||
|
||||
// Element is optional
|
||||
if (optionalValue) {
|
||||
return optionalValue;
|
||||
}
|
||||
|
||||
if ($(element).attr("type") === "file") {
|
||||
// If we are using a wildcard, make it regex friendly
|
||||
typeParam = typeParam.replace(/\*/g, ".*");
|
||||
|
||||
// Check if the element has a FileList before checking each file
|
||||
if (element.files && element.files.length) {
|
||||
for (i = 0; i < element.files.length; i++) {
|
||||
file = element.files[i];
|
||||
|
||||
// Grab the mimetype from the loaded file, verify it matches
|
||||
if (!file.type.match(new RegExp( ".?(" + typeParam + ")$", "i"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Either return true because we've validated each file, or because the
|
||||
// browser does not support element.files and the FileList feature
|
||||
return true;
|
||||
}, jQuery.format("Please enter a value with a valid mimetype."));
|
||||
|
||||
// Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept
|
||||
jQuery.validator.addMethod("extension", function(value, element, param) {
|
||||
param = typeof param === "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
|
||||
return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
|
||||
}, jQuery.format("Please enter a value with a valid extension."));
|
@ -0,0 +1,121 @@
|
||||
/*global config:true, task:true*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: '<json:package.json>',
|
||||
meta: {
|
||||
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
|
||||
'<%= grunt.template.today("m/d/yyyy") %>\n' +
|
||||
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
|
||||
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
|
||||
},
|
||||
concat: {
|
||||
'dist/jquery.validate.js': ['<banner>', '<file_strip_banner:jquery.validate.js>'],
|
||||
'dist/additional-methods.js': ['<banner>', '<file_strip_banner:additional-methods.js>']
|
||||
},
|
||||
min: {
|
||||
'dist/jquery.validate.min.js': ['<banner>', 'dist/jquery.validate.js'],
|
||||
'dist/additional-methods.min.js': ['<banner>', 'dist/additional-methods.js']
|
||||
},
|
||||
zip: {
|
||||
dist: {
|
||||
src: [
|
||||
'dist/additional-methods.js',
|
||||
'dist/additional-methods.min.js',
|
||||
'dist/jquery.validate.js',
|
||||
'dist/jquery.validate.min.js',
|
||||
'README.md',
|
||||
'changelog.txt',
|
||||
'grunt.js',
|
||||
'package.json',
|
||||
'demo/**/*.*',
|
||||
'lib/**/*.*',
|
||||
'localization/**/*.*',
|
||||
'test/**/*.*'
|
||||
],
|
||||
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip'
|
||||
}
|
||||
},
|
||||
qunit: {
|
||||
files: ['test/index.html']
|
||||
},
|
||||
lint: {
|
||||
files: [
|
||||
'jquery.validate.js',
|
||||
'additional-methods.js',
|
||||
'localization/*.js'
|
||||
],
|
||||
test: [
|
||||
'test/test.js',
|
||||
'test/rules.js',
|
||||
'test/messages.js',
|
||||
'test/methods.js'
|
||||
]
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
curly: true,
|
||||
eqeqeq: true,
|
||||
immed: true,
|
||||
latedef: true,
|
||||
newcap: true,
|
||||
noarg: true,
|
||||
sub: true,
|
||||
undef: true,
|
||||
eqnull: true,
|
||||
browser: true
|
||||
},
|
||||
globals: {
|
||||
jQuery: true,
|
||||
$: true,
|
||||
console: true,
|
||||
/* TODO only allows these for tests (grunt 0.4) */
|
||||
QUnit: true,
|
||||
module: true,
|
||||
test: true,
|
||||
start: true,
|
||||
stop: true,
|
||||
expect: true,
|
||||
ok: true,
|
||||
equal: true,
|
||||
deepEqual: true,
|
||||
strictEqual: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('zip', 'Create a zip file for release', function() {
|
||||
var files = grunt.file.expand(this.file.src);
|
||||
// grunt.log.writeln(require('util').inspect(files));
|
||||
grunt.log.writeln("Creating zip file " + this.file.dest);
|
||||
|
||||
var done = this.async();
|
||||
|
||||
var zipstream = require('zipstream');
|
||||
var fs = require('fs');
|
||||
|
||||
var out = fs.createWriteStream(this.file.dest);
|
||||
var zip = zipstream.createZip({ level: 1 });
|
||||
|
||||
zip.pipe(out);
|
||||
|
||||
function addFile() {
|
||||
if (!files.length) {
|
||||
zip.finalize(function(written) {
|
||||
grunt.log.writeln(written + ' total bytes written');
|
||||
done();
|
||||
});
|
||||
return;
|
||||
}
|
||||
var file = files.shift();
|
||||
grunt.log.verbose.writeln('Zipping ' + file);
|
||||
zip.addFile(fs.createReadStream(file), { name: file }, addFile);
|
||||
}
|
||||
addFile();
|
||||
});
|
||||
|
||||
grunt.registerTask('default', 'lint qunit');
|
||||
grunt.registerTask('release', 'default concat min zip');
|
||||
|
||||
};
|
After Width: | Height: | Size: 223 B |
@ -0,0 +1,8 @@
|
||||
label.error {
|
||||
background:url("images/unchecked.gif") no-repeat 0px 0px;
|
||||
padding-left: 18px;
|
||||
padding-bottom: 2px;
|
||||
font-weight: bold;
|
||||
color: #EA5200;
|
||||
margin-left: 10px;
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
label.error{
|
||||
font-weight: bold;
|
||||
color: #ea5200;
|
||||
margin-left: 10px;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
/*! jQuery Validation Plugin - v1.11.0 - 2/4/2013
|
||||
* https://github.com/jzaefferer/jquery-validation
|
||||
* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */
|
||||
(function(a){a.extend(a.fn,{validate:function(b){if(!this.length){if(b&&b.debug&&window.console){console.warn("Nothing selected, can't validate, returning nothing.")}return}var c=a.data(this[0],"validator");if(c){return c}this.attr("novalidate","novalidate");c=new a.validator(b,this[0]);a.data(this[0],"validator",c);if(c.settings.onsubmit){this.validateDelegate(":submit","click",function(d){if(c.settings.submitHandler){c.submitButton=d.target}if(a(d.target).hasClass("cancel")){c.cancelSubmit=true}});this.submit(function(d){if(c.settings.debug){d.preventDefault()}function e(){var f;if(c.settings.submitHandler){if(c.submitButton){f=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(c.submitButton.value).appendTo(c.currentForm)}c.settings.submitHandler.call(c,c.currentForm,d);if(c.submitButton){f.remove()}return false}return true}if(c.cancelSubmit){c.cancelSubmit=false;return e()}if(c.form()){if(c.pendingRequest){c.formSubmitted=true;return false}return e()}else{c.focusInvalid();return false}})}return c},valid:function(){if(a(this[0]).is("form")){return this.validate().form()}else{var c=true;var b=a(this[0].form).validate();this.each(function(){c&=b.element(this)});return c}},removeAttrs:function(d){var b={},c=this;a.each(d.split(/\s/),function(e,f){b[f]=c.attr(f);c.removeAttr(f)});return b},rules:function(e,b){var g=this[0];if(e){var d=a.data(g.form,"validator").settings;var i=d.rules;var j=a.validator.staticRules(g);switch(e){case"add":a.extend(j,a.validator.normalizeRule(b));i[g.name]=j;if(b.messages){d.messages[g.name]=a.extend(d.messages[g.name],b.messages)}break;case"remove":if(!b){delete i[g.name];return j}var h={};a.each(b.split(/\s/),function(k,l){h[l]=j[l];delete j[l]});return h}}var f=a.validator.normalizeRules(a.extend({},a.validator.classRules(g),a.validator.attributeRules(g),a.validator.dataRules(g),a.validator.staticRules(g)),g);if(f.required){var c=f.required;
|
||||
delete f.required;f=a.extend({required:c},f)}return f}});a.extend(a.expr[":"],{blank:function(b){return !a.trim(""+b.value)},filled:function(b){return !!a.trim(""+b.value)},unchecked:function(b){return !b.checked}});a.validator=function(b,c){this.settings=a.extend(true,{},a.validator.defaults,b);this.currentForm=c;this.init()};a.validator.format=function(b,c){if(arguments.length===1){return function(){var d=a.makeArray(arguments);d.unshift(b);return a.validator.format.apply(this,d)}}if(arguments.length>2&&c.constructor!==Array){c=a.makeArray(arguments).slice(1)}if(c.constructor!==Array){c=[c]}a.each(c,function(d,e){b=b.replace(new RegExp("\\{"+d+"\\}","g"),function(){return e})});return b};a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:true,ignore:":hidden",ignoreTitle:false,onfocusin:function(b,c){this.lastActive=b;if(this.settings.focusCleanup&&!this.blockFocusCleanup){if(this.settings.unhighlight){this.settings.unhighlight.call(this,b,this.settings.errorClass,this.settings.validClass)}this.addWrapper(this.errorsFor(b)).hide()}},onfocusout:function(b,c){if(!this.checkable(b)&&(b.name in this.submitted||!this.optional(b))){this.element(b)}},onkeyup:function(b,c){if(c.which===9&&this.elementValue(b)===""){return}else{if(b.name in this.submitted||b===this.lastElement){this.element(b)}}},onclick:function(b,c){if(b.name in this.submitted){this.element(b)}else{if(b.parentNode.name in this.submitted){this.element(b.parentNode)}}},highlight:function(d,b,c){if(d.type==="radio"){this.findByName(d.name).addClass(b).removeClass(c)}else{a(d).addClass(b).removeClass(c)}},unhighlight:function(d,b,c){if(d.type==="radio"){this.findByName(d.name).removeClass(b).addClass(c)}else{a(d).removeClass(b).addClass(c)}}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),equallength:a.validator.format("Please enter equal to {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=a(this.settings.errorLabelContainer);
|
||||
this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm);this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=(this.groups={});a.each(this.settings.groups,function(e,f){if(typeof f==="string"){f=f.split(/\s/)}a.each(f,function(h,g){b[g]=e})});var d=this.settings.rules;a.each(d,function(e,f){d[e]=a.validator.normalizeRule(f)});function c(g){var f=a.data(this[0].form,"validator"),e="on"+g.type.replace(/^validate/,"");if(f.settings[e]){f.settings[e].call(f,this[0],g)}}a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",c).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",c);if(this.settings.invalidHandler){a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)}},form:function(){this.checkForm();a.extend(this.submitted,this.errorMap);this.invalid=a.extend({},this.errorMap);if(!this.valid()){a(this.currentForm).triggerHandler("invalid-form",[this])}this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var b=0,c=(this.currentElements=this.elements());c[b];b++){this.check(c[b])}return this.valid()},element:function(c){c=this.validationTargetFor(this.clean(c));this.lastElement=c;this.prepareElement(c);this.currentElements=a(c);var b=this.check(c)!==false;if(b){delete this.invalid[c.name]}else{this.invalid[c.name]=true}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers)}this.showErrors();return b},showErrors:function(c){if(c){a.extend(this.errorMap,c);this.errorList=[];for(var b in c){this.errorList.push({message:c[b],element:this.findByName(b)[0]})}this.successList=a.grep(this.successList,function(d){return !(d.name in c)
|
||||
})}if(this.settings.showErrors){this.settings.showErrors.call(this,this.errorMap,this.errorList)}else{this.defaultShowErrors()}},resetForm:function(){if(a.fn.resetForm){a(this.currentForm).resetForm()}this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(d){var c=0;for(var b in d){c++}return c},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid){try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}}},findLastActive:function(){var b=this.lastActive;return b&&a.grep(this.errorList,function(c){return c.element.name===b.name}).length===1&&b},elements:function(){var c=this,b={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){if(!this.name&&c.settings.debug&&window.console){console.error("%o has no name assigned",this)}if(this.name in b||!c.objectLength(a(this).rules())){return false}b[this.name]=true;return true})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.replace(" ",".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=a([]);this.toHide=a([]);this.currentElements=a([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(b){this.reset();this.toHide=this.errorsFor(b)},elementValue:function(b){var c=a(b).attr("type"),d=a(b).val();if(c==="radio"||c==="checkbox"){return a("input[name='"+a(b).attr("name")+"']:checked").val()}if(typeof d==="string"){return d.replace(/\r/g,"")}return d},check:function(c){c=this.validationTargetFor(this.clean(c));
|
||||
var i=a(c).rules();var d=false;var h=this.elementValue(c);var b;for(var j in i){var g={method:j,parameters:i[j]};try{b=a.validator.methods[j].call(this,h,c,g.parameters);if(b==="dependency-mismatch"){d=true;continue}d=false;if(b==="pending"){this.toHide=this.toHide.not(this.errorsFor(c));return}if(!b){this.formatAndAdd(c,g);return false}}catch(f){if(this.settings.debug&&window.console){console.log("Exception occured when checking element "+c.id+", check the '"+g.method+"' method.",f)}throw f}}if(d){return}if(this.objectLength(i)){this.successList.push(c)}return true},customDataMessage:function(b,c){return a(b).data("msg-"+c.toLowerCase())||(b.attributes&&a(b).attr("data-msg-"+c.toLowerCase()))},customMessage:function(c,d){var b=this.settings.messages[c];return b&&(b.constructor===String?b:b[d])},findDefined:function(){for(var b=0;b<arguments.length;b++){if(arguments[b]!==undefined){return arguments[b]}}return undefined},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||undefined,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(c,e){var d=this.defaultMessage(c,e.method),b=/\$?\{(\d+)\}/g;if(typeof d==="function"){d=d.call(this,e.parameters,c)}else{if(b.test(d)){d=a.validator.format(d.replace(b,"{$1}"),e.parameters)}}this.errorList.push({message:d,element:c});this.errorMap[c.name]=d;this.submitted[c.name]=d},addWrapper:function(b){if(this.settings.wrapper){b=b.add(b.parent(this.settings.wrapper))}return b},defaultShowErrors:function(){var c,d;for(c=0;this.errorList[c];c++){var b=this.errorList[c];if(this.settings.highlight){this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass)}this.showLabel(b.element,b.message)}if(this.errorList.length){this.toShow=this.toShow.add(this.containers)}if(this.settings.success){for(c=0;this.successList[c];c++){this.showLabel(this.successList[c])}}if(this.settings.unhighlight){for(c=0,d=this.validElements();
|
||||
d[c];c++){this.settings.unhighlight.call(this,d[c],this.settings.errorClass,this.settings.validClass)}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(c,d){var b=this.errorsFor(c);if(b.length){b.removeClass(this.settings.validClass).addClass(this.settings.errorClass);b.html(d)}else{b=a("<"+this.settings.errorElement+">").attr("for",this.idOrName(c)).addClass(this.settings.errorClass).html(d||"");if(this.settings.wrapper){b=b.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()}if(!this.labelContainer.append(b).length){if(this.settings.errorPlacement){this.settings.errorPlacement(b,a(c))}else{b.insertAfter(c)}}}if(!d&&this.settings.success){b.text("");if(typeof this.settings.success==="string"){b.addClass(this.settings.success)}else{this.settings.success(b,c)}}this.toShow=this.toShow.add(b)},errorsFor:function(c){var b=this.idOrName(c);return this.errors().filter(function(){return a(this).attr("for")===b})},idOrName:function(b){return this.groups[b.name]||(this.checkable(b)?b.name:b.id||b.name)},validationTargetFor:function(b){if(this.checkable(b)){b=this.findByName(b.name).not(this.settings.ignore)[0]}return b},checkable:function(b){return(/radio|checkbox/i).test(b.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(c,b){switch(b.nodeName.toLowerCase()){case"select":return a("option:selected",b).length;case"input":if(this.checkable(b)){return this.findByName(b.name).filter(":checked").length}}return c.length},depend:function(c,b){return this.dependTypes[typeof c]?this.dependTypes[typeof c](c,b):true},dependTypes:{"boolean":function(c,b){return c},string:function(c,b){return !!a(c,b.form).length},"function":function(c,b){return c(b)}},optional:function(b){var c=this.elementValue(b);return !a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"
|
||||
},startRequest:function(b){if(!this.pending[b.name]){this.pendingRequest++;this.pending[b.name]=true}},stopRequest:function(b,c){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0}delete this.pending[b.name];if(c&&this.pendingRequest===0&&this.formSubmitted&&this.form()){a(this.currentForm).submit();this.formSubmitted=false}else{if(!c&&this.pendingRequest===0&&this.formSubmitted){a(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false}}},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:true,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},number:{number:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(b,c){if(b.constructor===String){this.classRuleSettings[b]=c}else{a.extend(this.classRuleSettings,b)}},classRules:function(c){var d={};var b=a(c).attr("class");if(b){a.each(b.split(" "),function(){if(this in a.validator.classRuleSettings){a.extend(d,a.validator.classRuleSettings[this])}})}return d},attributeRules:function(c){var e={};var b=a(c);for(var f in a.validator.methods){var d;if(f==="required"){d=b.get(0).getAttribute(f);if(d===""){d=true}d=!!d}else{d=b.attr(f)}if(d){e[f]=d}else{if(b[0].getAttribute("type")===f){e[f]=true}}}if(e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)){delete e.maxlength}return e},dataRules:function(c){var f,d,e={},b=a(c);for(f in a.validator.methods){d=b.data("rule-"+f.toLowerCase());if(d!==undefined){e[f]=d}}return e},staticRules:function(c){var d={};var b=a.data(c.form,"validator");if(b.settings.rules){d=a.validator.normalizeRule(b.settings.rules[c.name])||{}}return d},normalizeRules:function(c,b){a.each(c,function(f,e){if(e===false){delete c[f];return}if(e.param||e.depends){var d=true;switch(typeof e.depends){case"string":d=!!a(e.depends,b.form).length;break;case"function":d=e.depends.call(b,b);break}if(d){c[f]=e.param!==undefined?e.param:true
|
||||
}else{delete c[f]}}});a.each(c,function(d,e){c[d]=a.isFunction(e)?e(b):e});a.each(["minlength","maxlength"],function(){if(c[this]){c[this]=Number(c[this])}});a.each(["rangelength"],function(){var d;if(c[this]){if(a.isArray(c[this])){c[this]=[Number(c[this][0]),Number(c[this][1])]}else{if(typeof c[this]==="string"){d=c[this].split(/[\s,]+/);c[this]=[Number(d[0]),Number(d[1])]}}}});if(a.validator.autoCreateRanges){if(c.min&&c.max){c.range=[c.min,c.max];delete c.min;delete c.max}if(c.minlength&&c.maxlength){c.rangelength=[c.minlength,c.maxlength];delete c.minlength;delete c.maxlength}}return c},normalizeRule:function(c){if(typeof c==="string"){var b={};a.each(c.split(/\s/),function(){b[this]=true});c=b}return c},addMethod:function(b,d,c){a.validator.methods[b]=d;a.validator.messages[b]=c!==undefined?c:a.validator.messages[b];if(d.length<3){a.validator.addClassRules(b,a.validator.normalizeRule(b))}},methods:{required:function(c,b,e){if(!this.depend(e,b)){return"dependency-mismatch"}if(b.nodeName.toLowerCase()==="select"){var d=a(b).val();return d&&d.length>0}if(this.checkable(b)){return this.getLength(c,b)>0}return a.trim(c).length>0},remote:function(f,c,g){if(this.optional(c)){return"dependency-mismatch"}var d=this.previousValue(c);if(!this.settings.messages[c.name]){this.settings.messages[c.name]={}}d.originalMessage=this.settings.messages[c.name].remote;this.settings.messages[c.name].remote=d.message;g=typeof g==="string"&&{url:g}||g;if(d.old===f){return d.valid}d.old=f;var b=this;this.startRequest(c);var e={};e[c.name]=f;a.ajax(a.extend(true,{url:g,mode:"abort",port:"validate"+c.name,dataType:"json",data:e,success:function(i){b.settings.messages[c.name].remote=d.originalMessage;var k=i===true||i==="true";if(k){var h=b.formSubmitted;b.prepareElement(c);b.formSubmitted=h;b.successList.push(c);delete b.invalid[c.name];b.showErrors()}else{var l={};var j=i||b.defaultMessage(c,"remote");l[c.name]=d.message=a.isFunction(j)?j(f):j;b.invalid[c.name]=true;b.showErrors(l)}d.valid=k;b.stopRequest(c,k)}},g));return"pending"},minlength:function(d,b,e){var c=a.isArray(d)?d.length:this.getLength(a.trim(d),b);
|
||||
return this.optional(b)||c>=e},maxlength:function(d,b,e){var c=a.isArray(d)?d.length:this.getLength(a.trim(d),b);return this.optional(b)||c<=e},equallength:function(d,b,e){var c=a.isArray(d)?d.length:this.getLength(a.trim(d),b);return this.optional(b)||c==e},rangelength:function(d,b,e){var c=a.isArray(d)?d.length:this.getLength(a.trim(d),b);return this.optional(b)||(c>=e[0]&&c<=e[1])},min:function(c,b,d){return this.optional(b)||c>=d},max:function(c,b,d){return this.optional(b)||c<=d},range:function(c,b,d){return this.optional(b)||(c>=d[0]&&c<=d[1])},email:function(c,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(c)},url:function(c,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(c)
|
||||
},date:function(c,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(c).toString())},dateISO:function(c,b){return this.optional(b)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(c)},number:function(c,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(c)},digits:function(c,b){return this.optional(b)||/^\d+$/.test(c)},creditcard:function(f,c){if(this.optional(c)){return"dependency-mismatch"}if(/[^0-9 \-]+/.test(f)){return false}var g=0,e=0,b=false;f=f.replace(/\D/g,"");for(var h=f.length-1;h>=0;h--){var d=f.charAt(h);e=parseInt(d,10);if(b){if((e*=2)>9){e-=9}}g+=e;b=!b}return(g%10)===0},equalTo:function(c,b,e){var d=a(e);if(this.settings.onfocusout){d.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(b).valid()})}return c===d.val()}}});a.format=a.validator.format}(jQuery));(function(c){var a={};if(c.ajaxPrefilter){c.ajaxPrefilter(function(f,e,g){var d=f.port;if(f.mode==="abort"){if(a[d]){a[d].abort()}a[d]=g}})}else{var b=c.ajax;c.ajax=function(e){var f=("mode" in e?e:c.ajaxSettings).mode,d=("port" in e?e:c.ajaxSettings).port;if(f==="abort"){if(a[d]){a[d].abort()}return(a[d]=b.apply(this,arguments))}return b.apply(this,arguments)}}}(jQuery));(function(a){a.extend(a.fn,{validateDelegate:function(d,c,b){return this.bind(c,function(e){var f=a(e.target);if(f.is(d)){return b.apply(f,arguments)}})}})}(jQuery));
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "必选字段",
|
||||
remote: "请修正该字段",
|
||||
email: "请输入正确格式的电子邮件",
|
||||
url: "请输入合法的网址",
|
||||
date: "请输入合法的日期",
|
||||
dateISO: "请输入合法的日期 (ISO).",
|
||||
number: "请输入合法的数字",
|
||||
digits: "只能输入整数",
|
||||
creditcard: "请输入合法的信用卡号",
|
||||
equalTo: "请再次输入相同的值",
|
||||
accept: "请输入拥有合法后缀名的字符串",
|
||||
maxlength: $.validator.format("请输入一个长度最多是 {0} 的字符串"),
|
||||
minlength: $.validator.format("请输入一个长度最少是 {0} 的字符串"),
|
||||
rangelength: $.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"),
|
||||
range: $.validator.format("请输入一个介于 {0} 和 {1} 之间的值"),
|
||||
max: $.validator.format("请输入一个最大为 {0} 的值"),
|
||||
min: $.validator.format("请输入一个最小为 {0} 的值")
|
||||
});
|
||||
}(jQuery));
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ZH (Chinese; 中文 (Zhōngwén), 汉语, 漢語)
|
||||
* Region: TW (Taiwan)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "必填",
|
||||
remote: "請修正此欄位",
|
||||
email: "請輸入正確的電子信箱",
|
||||
url: "請輸入合法的URL",
|
||||
date: "請輸入合法的日期",
|
||||
dateISO: "請輸入合法的日期 (ISO).",
|
||||
number: "請輸入數字",
|
||||
digits: "請輸入整數",
|
||||
creditcard: "請輸入合法的信用卡號碼",
|
||||
equalTo: "請重複輸入一次",
|
||||
accept: "請輸入有效的後缀字串",
|
||||
maxlength: $.validator.format("請輸入長度不大於{0} 的字串"),
|
||||
minlength: $.validator.format("請輸入長度不小於 {0} 的字串"),
|
||||
rangelength: $.validator.format("請輸入長度介於 {0} 和 {1} 之間的字串"),
|
||||
range: $.validator.format("請輸入介於 {0} 和 {1} 之間的數值"),
|
||||
max: $.validator.format("請輸入不大於 {0} 的數值"),
|
||||
min: $.validator.format("請輸入不小於 {0} 的數值")
|
||||
});
|
||||
}(jQuery));
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "jquery-validation",
|
||||
"title": "jQuery Validation Plugin",
|
||||
"description": "Form validation made easy",
|
||||
"version": "1.11.0",
|
||||
"homepage": "https://github.com/jzaefferer/jquery-validation",
|
||||
"author": {
|
||||
"name": "Jörn Zaefferer",
|
||||
"email": "joern.zaefferer@gmail.com",
|
||||
"url": "http://bassistance.de"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jzaefferer/jquery-validation.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jzaefferer/jquery-validation/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://www.opensource.org/licenses/MIT"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "grunt lint qunit"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "0.3.x",
|
||||
"zipstream": "0.2.x"
|
||||
},
|
||||
"keywords": [
|
||||
"forms",
|
||||
"validation",
|
||||
"validate"
|
||||
]
|
||||
}
|
@ -0,0 +1,965 @@
|
||||
/*! layer-v3.5.1 Web 通用弹出层组件 MIT License */
|
||||
!(function (e, t) {
|
||||
'use strict';
|
||||
var i,
|
||||
n,
|
||||
a = e.layui && layui.define,
|
||||
o = {
|
||||
getPath: (function () {
|
||||
var t = document.currentScript
|
||||
? document.currentScript.src
|
||||
: (function () {
|
||||
for (var e, t = document.scripts, i = t.length - 1, n = i; n > 0; n--)
|
||||
if ('interactive' === t[n].readyState) {
|
||||
e = t[n].src;
|
||||
break;
|
||||
}
|
||||
return e || t[i].src;
|
||||
})(),
|
||||
i = e.LAYUI_GLOBAL || {};
|
||||
return i.layer_dir || t.substring(0, t.lastIndexOf('/') + 1);
|
||||
})(),
|
||||
config: {},
|
||||
end: {},
|
||||
minIndex: 0,
|
||||
minLeft: [],
|
||||
btn: ['确定', '取消'],
|
||||
type: ['dialog', 'page', 'iframe', 'loading', 'tips'],
|
||||
getStyle: function (t, i) {
|
||||
var n = t.currentStyle ? t.currentStyle : e.getComputedStyle(t, null);
|
||||
return n[n.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](i);
|
||||
},
|
||||
link: function (t, i, n) {
|
||||
if (r.path) {
|
||||
var a = document.getElementsByTagName('head')[0],
|
||||
s = document.createElement('link');
|
||||
'string' == typeof i && (n = i);
|
||||
var l = (n || t).replace(/\.|\//g, ''),
|
||||
f = 'layuicss-' + l,
|
||||
c = 'creating',
|
||||
u = 0;
|
||||
(s.rel = 'stylesheet'),
|
||||
(s.href = r.path + t),
|
||||
(s.id = f),
|
||||
document.getElementById(f) || a.appendChild(s),
|
||||
'function' == typeof i &&
|
||||
!(function d(t) {
|
||||
var n = 100,
|
||||
a = document.getElementById(f);
|
||||
return ++u > 1e4 / n
|
||||
? e.console && console.error(l + '.css: Invalid')
|
||||
: void (1989 === parseInt(o.getStyle(a, 'width'))
|
||||
? (t === c && a.removeAttribute('lay-status'), a.getAttribute('lay-status') === c ? setTimeout(d, n) : i())
|
||||
: (a.setAttribute('lay-status', c),
|
||||
setTimeout(function () {
|
||||
d(c);
|
||||
}, n)));
|
||||
})();
|
||||
}
|
||||
}
|
||||
},
|
||||
r = {
|
||||
v: '3.5.1',
|
||||
ie: (function () {
|
||||
var t = navigator.userAgent.toLowerCase();
|
||||
return !!(e.ActiveXObject || 'ActiveXObject' in e) && ((t.match(/msie\s(\d+)/) || [])[1] || '11');
|
||||
})(),
|
||||
index: e.layer && e.layer.v ? 1e5 : 0,
|
||||
path: o.getPath,
|
||||
config: function (e, t) {
|
||||
return (
|
||||
(e = e || {}),
|
||||
(r.cache = o.config = i.extend({}, o.config, e)),
|
||||
(r.path = o.config.path || r.path),
|
||||
'string' == typeof e.extend && (e.extend = [e.extend]),
|
||||
o.config.path && r.ready(),
|
||||
e.extend ? (a ? layui.addcss('modules/layer/' + e.extend) : o.link('theme/' + e.extend), this) : this
|
||||
);
|
||||
},
|
||||
ready: function (e) {
|
||||
var t = 'layer',
|
||||
i = '',
|
||||
n = (a ? 'modules/layer/' : 'theme/') + 'default/layer.css?v=' + r.v + i;
|
||||
return a ? layui.addcss(n, e, t) : o.link(n, e, t), this;
|
||||
},
|
||||
alert: function (e, t, n) {
|
||||
var a = 'function' == typeof t;
|
||||
return a && (n = t), r.open(i.extend({ content: e, yes: n }, a ? {} : t));
|
||||
},
|
||||
confirm: function (e, t, n, a) {
|
||||
var s = 'function' == typeof t;
|
||||
return s && ((a = n), (n = t)), r.open(i.extend({ content: e, btn: o.btn, yes: n, btn2: a }, s ? {} : t));
|
||||
},
|
||||
msg: function (e, n, a) {
|
||||
var s = 'function' == typeof n,
|
||||
f = o.config.skin,
|
||||
c = (f ? f + ' ' + f + '-msg' : '') || 'layui-layer-msg',
|
||||
u = l.anim.length - 1;
|
||||
return (
|
||||
s && (a = n),
|
||||
r.open(
|
||||
i.extend(
|
||||
{ content: e, time: 3e3, shade: !1, skin: c, title: !1, closeBtn: !1, btn: !1, resize: !1, end: a },
|
||||
s && !o.config.skin
|
||||
? { skin: c + ' layui-layer-hui', anim: u }
|
||||
: (function () {
|
||||
return (n = n || {}), (n.icon === -1 || (n.icon === t && !o.config.skin)) && (n.skin = c + ' ' + (n.skin || 'layui-layer-hui')), n;
|
||||
})()
|
||||
)
|
||||
)
|
||||
);
|
||||
},
|
||||
load: function (e, t) {
|
||||
return r.open(i.extend({ type: 3, icon: e || 0, resize: !1, shade: 0.01 }, t));
|
||||
},
|
||||
tips: function (e, t, n) {
|
||||
return r.open(i.extend({ type: 4, content: [e, t], closeBtn: !1, time: 3e3, shade: !1, resize: !1, fixed: !1, maxWidth: 260 }, n));
|
||||
}
|
||||
},
|
||||
s = function (e) {
|
||||
var t = this,
|
||||
a = function () {
|
||||
t.creat();
|
||||
};
|
||||
(t.index = ++r.index),
|
||||
(t.config.maxWidth = i(n).width() - 30),
|
||||
(t.config = i.extend({}, t.config, o.config, e)),
|
||||
document.body
|
||||
? a()
|
||||
: setTimeout(function () {
|
||||
a();
|
||||
}, 30);
|
||||
};
|
||||
s.pt = s.prototype;
|
||||
var l = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
|
||||
(l.anim = ['layer-anim-00', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06']),
|
||||
(l.SHADE = 'layui-layer-shade'),
|
||||
(l.MOVE = 'layui-layer-move'),
|
||||
(s.pt.config = {
|
||||
type: 0,
|
||||
shade: 0.3,
|
||||
fixed: !0,
|
||||
move: l[1],
|
||||
title: '信息',
|
||||
offset: 'auto',
|
||||
area: 'auto',
|
||||
closeBtn: 1,
|
||||
time: 0,
|
||||
zIndex: 19891014,
|
||||
maxWidth: 360,
|
||||
anim: 0,
|
||||
isOutAnim: !0,
|
||||
minStack: !0,
|
||||
icon: -1,
|
||||
moveType: 1,
|
||||
resize: !0,
|
||||
scrollbar: !0,
|
||||
tips: 2
|
||||
}),
|
||||
(s.pt.vessel = function (e, t) {
|
||||
var n = this,
|
||||
a = n.index,
|
||||
r = n.config,
|
||||
s = r.zIndex + a,
|
||||
f = 'object' == typeof r.title,
|
||||
c = r.maxmin && (1 === r.type || 2 === r.type),
|
||||
u = r.title ? '<div class="layui-layer-title" style="' + (f ? r.title[1] : '') + '">' + (f ? r.title[0] : r.title) + '</div>' : '';
|
||||
return (
|
||||
(r.zIndex = s),
|
||||
t(
|
||||
[
|
||||
r.shade ? '<div class="' + l.SHADE + '" id="' + l.SHADE + a + '" times="' + a + '" style="' + ('z-index:' + (s - 1) + '; ') + '"></div>' : '',
|
||||
'<div class="' +
|
||||
l[0] +
|
||||
(' layui-layer-' + o.type[r.type]) +
|
||||
((0 != r.type && 2 != r.type) || r.shade ? '' : ' layui-layer-border') +
|
||||
' ' +
|
||||
(r.skin || '') +
|
||||
'" id="' +
|
||||
l[0] +
|
||||
a +
|
||||
'" type="' +
|
||||
o.type[r.type] +
|
||||
'" times="' +
|
||||
a +
|
||||
'" showtime="' +
|
||||
r.time +
|
||||
'" conType="' +
|
||||
(e ? 'object' : 'string') +
|
||||
'" style="z-index: ' +
|
||||
s +
|
||||
'; width:' +
|
||||
r.area[0] +
|
||||
';height:' +
|
||||
r.area[1] +
|
||||
';position:' +
|
||||
(r.fixed ? 'fixed;' : 'absolute;') +
|
||||
'">' +
|
||||
(e && 2 != r.type ? '' : u) +
|
||||
'<div id="' +
|
||||
(r.id || '') +
|
||||
'" class="layui-layer-content' +
|
||||
(0 == r.type && r.icon !== -1 ? ' layui-layer-padding' : '') +
|
||||
(3 == r.type ? ' layui-layer-loading' + r.icon : '') +
|
||||
'">' +
|
||||
(0 == r.type && r.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico' + r.icon + '"></i>' : '') +
|
||||
(1 == r.type && e ? '' : r.content || '') +
|
||||
'</div><span class="layui-layer-setwin">' +
|
||||
(function () {
|
||||
var e = c
|
||||
? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>'
|
||||
: '';
|
||||
return (
|
||||
r.closeBtn &&
|
||||
(e += '<a class="layui-layer-ico ' + l[7] + ' ' + l[7] + (r.title ? r.closeBtn : 4 == r.type ? '1' : '2') + '" href="javascript:;"></a>'),
|
||||
e
|
||||
);
|
||||
})() +
|
||||
'</span>' +
|
||||
(r.btn
|
||||
? (function () {
|
||||
var e = '';
|
||||
'string' == typeof r.btn && (r.btn = [r.btn]);
|
||||
for (var t = 0, i = r.btn.length; t < i; t++) e += '<a class="' + l[6] + t + '">' + r.btn[t] + '</a>';
|
||||
return '<div class="' + l[6] + ' layui-layer-btn-' + (r.btnAlign || '') + '">' + e + '</div>';
|
||||
})()
|
||||
: '') +
|
||||
(r.resize ? '<span class="layui-layer-resize"></span>' : '') +
|
||||
'</div>'
|
||||
],
|
||||
u,
|
||||
i('<div class="' + l.MOVE + '" id="' + l.MOVE + '"></div>')
|
||||
),
|
||||
n
|
||||
);
|
||||
}),
|
||||
(s.pt.creat = function () {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
a = e.index,
|
||||
s = t.content,
|
||||
f = 'object' == typeof s,
|
||||
c = i('body');
|
||||
if (!t.id || !i('#' + t.id)[0]) {
|
||||
switch (('string' == typeof t.area && (t.area = 'auto' === t.area ? ['', ''] : [t.area, '']), t.shift && (t.anim = t.shift), 6 == r.ie && (t.fixed = !1), t.type)) {
|
||||
case 0:
|
||||
(t.btn = 'btn' in t ? t.btn : o.btn[0]), r.closeAll('dialog');
|
||||
break;
|
||||
case 2:
|
||||
var s = (t.content = f ? t.content : [t.content || '', 'auto']);
|
||||
t.content =
|
||||
'<iframe scrolling="' +
|
||||
(t.content[1] || 'auto') +
|
||||
'" allowtransparency="true" id="' +
|
||||
l[4] +
|
||||
a +
|
||||
'" name="' +
|
||||
l[4] +
|
||||
a +
|
||||
'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' +
|
||||
t.content[0] +
|
||||
'"></iframe>';
|
||||
break;
|
||||
case 3:
|
||||
delete t.title, delete t.closeBtn, t.icon === -1 && 0 === t.icon, r.closeAll('loading');
|
||||
break;
|
||||
case 4:
|
||||
f || (t.content = [t.content, 'body']),
|
||||
(t.follow = t.content[1]),
|
||||
(t.content = t.content[0] + '<i class="layui-layer-TipsG"></i>'),
|
||||
delete t.title,
|
||||
(t.tips = 'object' == typeof t.tips ? t.tips : [t.tips, !0]),
|
||||
t.tipsMore || r.closeAll('tips');
|
||||
}
|
||||
if (
|
||||
(e
|
||||
.vessel(f, function (n, r, u) {
|
||||
c.append(n[0]),
|
||||
f
|
||||
? (function () {
|
||||
2 == t.type || 4 == t.type
|
||||
? (function () {
|
||||
i('body').append(n[1]);
|
||||
})()
|
||||
: (function () {
|
||||
s.parents('.' + l[0])[0] ||
|
||||
(s.data('display', s.css('display')).show().addClass('layui-layer-wrap').wrap(n[1]),
|
||||
i('#' + l[0] + a)
|
||||
.find('.' + l[5])
|
||||
.before(r));
|
||||
})();
|
||||
})()
|
||||
: c.append(n[1]),
|
||||
i('#' + l.MOVE)[0] || c.append((o.moveElem = u)),
|
||||
(e.layero = i('#' + l[0] + a)),
|
||||
(e.shadeo = i('#' + l.SHADE + a)),
|
||||
t.scrollbar || l.html.css('overflow', 'hidden').attr('layer-full', a);
|
||||
})
|
||||
.auto(a),
|
||||
e.shadeo.css({ 'background-color': t.shade[1] || '#000', opacity: t.shade[0] || t.shade }),
|
||||
2 == t.type && 6 == r.ie && e.layero.find('iframe').attr('src', s[0]),
|
||||
4 == t.type
|
||||
? e.tips()
|
||||
: (function () {
|
||||
e.offset(),
|
||||
parseInt(o.getStyle(document.getElementById(l.MOVE), 'z-index')) ||
|
||||
(function () {
|
||||
e.layero.css('visibility', 'hidden'),
|
||||
r.ready(function () {
|
||||
e.offset(), e.layero.css('visibility', 'visible');
|
||||
});
|
||||
})();
|
||||
})(),
|
||||
t.fixed &&
|
||||
n.on('resize', function () {
|
||||
e.offset(), (/\d+%/.test(t.area[0]) || /\d+%/.test(t.area[1])) && e.auto(a), 4 == t.type && e.tips();
|
||||
}),
|
||||
t.time <= 0 ||
|
||||
setTimeout(function () {
|
||||
r.close(e.index);
|
||||
}, t.time),
|
||||
e.move().callback(),
|
||||
l.anim[t.anim])
|
||||
) {
|
||||
var u = 'layer-anim ' + l.anim[t.anim];
|
||||
e.layero.addClass(u).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
|
||||
i(this).removeClass(u);
|
||||
});
|
||||
}
|
||||
t.isOutAnim && e.layero.data('isOutAnim', !0);
|
||||
}
|
||||
}),
|
||||
(s.pt.auto = function (e) {
|
||||
var t = this,
|
||||
a = t.config,
|
||||
o = i('#' + l[0] + e);
|
||||
'' === a.area[0] && a.maxWidth > 0 && (r.ie && r.ie < 8 && a.btn && o.width(o.innerWidth()), o.outerWidth() > a.maxWidth && o.width(a.maxWidth));
|
||||
var s = [o.innerWidth(), o.innerHeight()],
|
||||
f = o.find(l[1]).outerHeight() || 0,
|
||||
c = o.find('.' + l[6]).outerHeight() || 0,
|
||||
u = function (e) {
|
||||
(e = o.find(e)), e.height(s[1] - f - c - 2 * (0 | parseFloat(e.css('padding-top'))));
|
||||
};
|
||||
switch (a.type) {
|
||||
case 2:
|
||||
u('iframe');
|
||||
break;
|
||||
default:
|
||||
'' === a.area[1]
|
||||
? a.maxHeight > 0 && o.outerHeight() > a.maxHeight
|
||||
? ((s[1] = a.maxHeight), u('.' + l[5]))
|
||||
: a.fixed && s[1] >= n.height() && ((s[1] = n.height()), u('.' + l[5]))
|
||||
: u('.' + l[5]);
|
||||
}
|
||||
return t;
|
||||
}),
|
||||
(s.pt.offset = function () {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
i = e.layero,
|
||||
a = [i.outerWidth(), i.outerHeight()],
|
||||
o = 'object' == typeof t.offset;
|
||||
(e.offsetTop = (n.height() - a[1]) / 2),
|
||||
(e.offsetLeft = (n.width() - a[0]) / 2),
|
||||
o
|
||||
? ((e.offsetTop = t.offset[0]), (e.offsetLeft = t.offset[1] || e.offsetLeft))
|
||||
: 'auto' !== t.offset &&
|
||||
('t' === t.offset
|
||||
? (e.offsetTop = 0)
|
||||
: 'r' === t.offset
|
||||
? (e.offsetLeft = n.width() - a[0])
|
||||
: 'b' === t.offset
|
||||
? (e.offsetTop = n.height() - a[1])
|
||||
: 'l' === t.offset
|
||||
? (e.offsetLeft = 0)
|
||||
: 'lt' === t.offset
|
||||
? ((e.offsetTop = 0), (e.offsetLeft = 0))
|
||||
: 'lb' === t.offset
|
||||
? ((e.offsetTop = n.height() - a[1]), (e.offsetLeft = 0))
|
||||
: 'rt' === t.offset
|
||||
? ((e.offsetTop = 0), (e.offsetLeft = n.width() - a[0]))
|
||||
: 'rb' === t.offset
|
||||
? ((e.offsetTop = n.height() - a[1]), (e.offsetLeft = n.width() - a[0]))
|
||||
: (e.offsetTop = t.offset)),
|
||||
t.fixed ||
|
||||
((e.offsetTop = /%$/.test(e.offsetTop) ? (n.height() * parseFloat(e.offsetTop)) / 100 : parseFloat(e.offsetTop)),
|
||||
(e.offsetLeft = /%$/.test(e.offsetLeft) ? (n.width() * parseFloat(e.offsetLeft)) / 100 : parseFloat(e.offsetLeft)),
|
||||
(e.offsetTop += n.scrollTop()),
|
||||
(e.offsetLeft += n.scrollLeft())),
|
||||
i.attr('minLeft') && ((e.offsetTop = n.height() - (i.find(l[1]).outerHeight() || 0)), (e.offsetLeft = i.css('left'))),
|
||||
i.css({ top: e.offsetTop, left: e.offsetLeft });
|
||||
}),
|
||||
(s.pt.tips = function () {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
a = e.layero,
|
||||
o = [a.outerWidth(), a.outerHeight()],
|
||||
r = i(t.follow);
|
||||
r[0] || (r = i('body'));
|
||||
var s = { width: r.outerWidth(), height: r.outerHeight(), top: r.offset().top, left: r.offset().left },
|
||||
f = a.find('.layui-layer-TipsG'),
|
||||
c = t.tips[0];
|
||||
t.tips[1] || f.remove(),
|
||||
(s.autoLeft = function () {
|
||||
s.left + o[0] - n.width() > 0 ? ((s.tipLeft = s.left + s.width - o[0]), f.css({ right: 12, left: 'auto' })) : (s.tipLeft = s.left);
|
||||
}),
|
||||
(s.where = [
|
||||
function () {
|
||||
s.autoLeft(), (s.tipTop = s.top - o[1] - 10), f.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', t.tips[1]);
|
||||
},
|
||||
function () {
|
||||
(s.tipLeft = s.left + s.width + 10),
|
||||
(s.tipTop = s.top),
|
||||
f.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', t.tips[1]);
|
||||
},
|
||||
function () {
|
||||
s.autoLeft(), (s.tipTop = s.top + s.height + 10), f.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', t.tips[1]);
|
||||
},
|
||||
function () {
|
||||
(s.tipLeft = s.left - o[0] - 10),
|
||||
(s.tipTop = s.top),
|
||||
f.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', t.tips[1]);
|
||||
}
|
||||
]),
|
||||
s.where[c - 1](),
|
||||
1 === c
|
||||
? s.top - (n.scrollTop() + o[1] + 16) < 0 && s.where[2]()
|
||||
: 2 === c
|
||||
? n.width() - (s.left + s.width + o[0] + 16) > 0 || s.where[3]()
|
||||
: 3 === c
|
||||
? s.top - n.scrollTop() + s.height + o[1] + 16 - n.height() > 0 && s.where[0]()
|
||||
: 4 === c && o[0] + 16 - s.left > 0 && s.where[1](),
|
||||
a.find('.' + l[5]).css({ 'background-color': t.tips[1], 'padding-right': t.closeBtn ? '30px' : '' }),
|
||||
a.css({ left: s.tipLeft - (t.fixed ? n.scrollLeft() : 0), top: s.tipTop - (t.fixed ? n.scrollTop() : 0) });
|
||||
}),
|
||||
(s.pt.move = function () {
|
||||
var e = this,
|
||||
t = e.config,
|
||||
a = i(document),
|
||||
s = e.layero,
|
||||
l = s.find(t.move),
|
||||
f = s.find('.layui-layer-resize'),
|
||||
c = {};
|
||||
return (
|
||||
t.move && l.css('cursor', 'move'),
|
||||
l.on('mousedown', function (e) {
|
||||
e.preventDefault(),
|
||||
t.move &&
|
||||
((c.moveStart = !0),
|
||||
(c.offset = [e.clientX - parseFloat(s.css('left')), e.clientY - parseFloat(s.css('top'))]),
|
||||
o.moveElem.css('cursor', 'move').show());
|
||||
}),
|
||||
f.on('mousedown', function (e) {
|
||||
e.preventDefault(),
|
||||
(c.resizeStart = !0),
|
||||
(c.offset = [e.clientX, e.clientY]),
|
||||
(c.area = [s.outerWidth(), s.outerHeight()]),
|
||||
o.moveElem.css('cursor', 'se-resize').show();
|
||||
}),
|
||||
a
|
||||
.on('mousemove', function (i) {
|
||||
if (c.moveStart) {
|
||||
var a = i.clientX - c.offset[0],
|
||||
o = i.clientY - c.offset[1],
|
||||
l = 'fixed' === s.css('position');
|
||||
if ((i.preventDefault(), (c.stX = l ? 0 : n.scrollLeft()), (c.stY = l ? 0 : n.scrollTop()), !t.moveOut)) {
|
||||
var f = n.width() - s.outerWidth() + c.stX,
|
||||
u = n.height() - s.outerHeight() + c.stY;
|
||||
a < c.stX && (a = c.stX), a > f && (a = f), o < c.stY && (o = c.stY), o > u && (o = u);
|
||||
}
|
||||
s.css({ left: a, top: o });
|
||||
}
|
||||
if (t.resize && c.resizeStart) {
|
||||
var a = i.clientX - c.offset[0],
|
||||
o = i.clientY - c.offset[1];
|
||||
i.preventDefault(), r.style(e.index, { width: c.area[0] + a, height: c.area[1] + o }), (c.isResize = !0), t.resizing && t.resizing(s);
|
||||
}
|
||||
})
|
||||
.on('mouseup', function (e) {
|
||||
c.moveStart && (delete c.moveStart, o.moveElem.hide(), t.moveEnd && t.moveEnd(s)), c.resizeStart && (delete c.resizeStart, o.moveElem.hide());
|
||||
}),
|
||||
e
|
||||
);
|
||||
}),
|
||||
(s.pt.callback = function () {
|
||||
function e() {
|
||||
var e = a.cancel && a.cancel(t.index, n);
|
||||
e === !1 || r.close(t.index);
|
||||
}
|
||||
var t = this,
|
||||
n = t.layero,
|
||||
a = t.config;
|
||||
t.openLayer(),
|
||||
a.success &&
|
||||
(2 == a.type
|
||||
? n.find('iframe').on('load', function () {
|
||||
a.success(n, t.index);
|
||||
})
|
||||
: a.success(n, t.index)),
|
||||
6 == r.ie && t.IE6(n),
|
||||
n
|
||||
.find('.' + l[6])
|
||||
.children('a')
|
||||
.on('click', function () {
|
||||
var e = i(this).index();
|
||||
if (0 === e) a.yes ? a.yes(t.index, n) : a.btn1 ? a.btn1(t.index, n) : r.close(t.index);
|
||||
else {
|
||||
var o = a['btn' + (e + 1)] && a['btn' + (e + 1)](t.index, n);
|
||||
o === !1 || r.close(t.index);
|
||||
}
|
||||
}),
|
||||
n.find('.' + l[7]).on('click', e),
|
||||
a.shadeClose &&
|
||||
t.shadeo.on('click', function () {
|
||||
r.close(t.index);
|
||||
}),
|
||||
n.find('.layui-layer-min').on('click', function () {
|
||||
var e = a.min && a.min(n, t.index);
|
||||
e === !1 || r.min(t.index, a);
|
||||
}),
|
||||
n.find('.layui-layer-max').on('click', function () {
|
||||
i(this).hasClass('layui-layer-maxmin')
|
||||
? (r.restore(t.index), a.restore && a.restore(n, t.index))
|
||||
: (r.full(t.index, a),
|
||||
setTimeout(function () {
|
||||
a.full && a.full(n, t.index);
|
||||
}, 100));
|
||||
}),
|
||||
a.end && (o.end[t.index] = a.end);
|
||||
}),
|
||||
(o.reselect = function () {
|
||||
i.each(i('select'), function (e, t) {
|
||||
var n = i(this);
|
||||
n.parents('.' + l[0])[0] || (1 == n.attr('layer') && i('.' + l[0]).length < 1 && n.removeAttr('layer').show()), (n = null);
|
||||
});
|
||||
}),
|
||||
(s.pt.IE6 = function (e) {
|
||||
i('select').each(function (e, t) {
|
||||
var n = i(this);
|
||||
n.parents('.' + l[0])[0] || 'none' === n.css('display') || n.attr({ layer: '1' }).hide(), (n = null);
|
||||
});
|
||||
}),
|
||||
(s.pt.openLayer = function () {
|
||||
var e = this;
|
||||
(r.zIndex = e.config.zIndex),
|
||||
(r.setTop = function (e) {
|
||||
var t = function () {
|
||||
r.zIndex++, e.css('z-index', r.zIndex + 1);
|
||||
};
|
||||
return (r.zIndex = parseInt(e[0].style.zIndex)), e.on('mousedown', t), r.zIndex;
|
||||
});
|
||||
}),
|
||||
(o.record = function (e) {
|
||||
var t = [e.width(), e.height(), e.position().top, e.position().left + parseFloat(e.css('margin-left'))];
|
||||
e.find('.layui-layer-max').addClass('layui-layer-maxmin'), e.attr({ area: t });
|
||||
}),
|
||||
(o.rescollbar = function (e) {
|
||||
l.html.attr('layer-full') == e &&
|
||||
(l.html[0].style.removeProperty ? l.html[0].style.removeProperty('overflow') : l.html[0].style.removeAttribute('overflow'), l.html.removeAttr('layer-full'));
|
||||
}),
|
||||
(e.layer = r),
|
||||
(r.getChildFrame = function (e, t) {
|
||||
return (
|
||||
(t = t || i('.' + l[4]).attr('times')),
|
||||
i('#' + l[0] + t)
|
||||
.find('iframe')
|
||||
.contents()
|
||||
.find(e)
|
||||
);
|
||||
}),
|
||||
(r.getFrameIndex = function (e) {
|
||||
return i('#' + e)
|
||||
.parents('.' + l[4])
|
||||
.attr('times');
|
||||
}),
|
||||
(r.iframeAuto = function (e) {
|
||||
if (e) {
|
||||
var t = r.getChildFrame('html', e).outerHeight(),
|
||||
n = i('#' + l[0] + e),
|
||||
a = n.find(l[1]).outerHeight() || 0,
|
||||
o = n.find('.' + l[6]).outerHeight() || 0;
|
||||
n.css({ height: t + a + o }), n.find('iframe').css({ height: t });
|
||||
}
|
||||
}),
|
||||
(r.iframeSrc = function (e, t) {
|
||||
i('#' + l[0] + e)
|
||||
.find('iframe')
|
||||
.attr('src', t);
|
||||
}),
|
||||
(r.style = function (e, t, n) {
|
||||
var a = i('#' + l[0] + e),
|
||||
r = a.find('.layui-layer-content'),
|
||||
s = a.attr('type'),
|
||||
f = a.find(l[1]).outerHeight() || 0,
|
||||
c = a.find('.' + l[6]).outerHeight() || 0;
|
||||
a.attr('minLeft');
|
||||
s !== o.type[3] &&
|
||||
s !== o.type[4] &&
|
||||
(n || (parseFloat(t.width) <= 260 && (t.width = 260), parseFloat(t.height) - f - c <= 64 && (t.height = 64 + f + c)),
|
||||
a.css(t),
|
||||
(c = a.find('.' + l[6]).outerHeight()),
|
||||
s === o.type[2]
|
||||
? a.find('iframe').css({ height: parseFloat(t.height) - f - c })
|
||||
: r.css({ height: parseFloat(t.height) - f - c - parseFloat(r.css('padding-top')) - parseFloat(r.css('padding-bottom')) }));
|
||||
}),
|
||||
(r.min = function (e, t) {
|
||||
t = t || {};
|
||||
var a = i('#' + l[0] + e),
|
||||
s = i('#' + l.SHADE + e),
|
||||
f = a.find(l[1]).outerHeight() || 0,
|
||||
c = a.attr('minLeft') || 181 * o.minIndex + 'px',
|
||||
u = a.css('position'),
|
||||
d = { width: 180, height: f, position: 'fixed', overflow: 'hidden' };
|
||||
o.record(a),
|
||||
o.minLeft[0] && ((c = o.minLeft[0]), o.minLeft.shift()),
|
||||
t.minStack && ((d.left = c), (d.top = n.height() - f), a.attr('minLeft') || o.minIndex++, a.attr('minLeft', c)),
|
||||
a.attr('position', u),
|
||||
r.style(e, d, !0),
|
||||
a.find('.layui-layer-min').hide(),
|
||||
'page' === a.attr('type') && a.find(l[4]).hide(),
|
||||
o.rescollbar(e),
|
||||
s.hide();
|
||||
}),
|
||||
(r.restore = function (e) {
|
||||
var t = i('#' + l[0] + e),
|
||||
n = i('#' + l.SHADE + e),
|
||||
a = t.attr('area').split(',');
|
||||
t.attr('type');
|
||||
r.style(e, { width: parseFloat(a[0]), height: parseFloat(a[1]), top: parseFloat(a[2]), left: parseFloat(a[3]), position: t.attr('position'), overflow: 'visible' }, !0),
|
||||
t.find('.layui-layer-max').removeClass('layui-layer-maxmin'),
|
||||
t.find('.layui-layer-min').show(),
|
||||
'page' === t.attr('type') && t.find(l[4]).show(),
|
||||
o.rescollbar(e),
|
||||
n.show();
|
||||
}),
|
||||
(r.full = function (e) {
|
||||
var t,
|
||||
a = i('#' + l[0] + e);
|
||||
o.record(a),
|
||||
l.html.attr('layer-full') || l.html.css('overflow', 'hidden').attr('layer-full', e),
|
||||
clearTimeout(t),
|
||||
(t = setTimeout(function () {
|
||||
var t = 'fixed' === a.css('position');
|
||||
r.style(e, { top: t ? 0 : n.scrollTop(), left: t ? 0 : n.scrollLeft(), width: n.width(), height: n.height() }, !0), a.find('.layui-layer-min').hide();
|
||||
}, 100));
|
||||
}),
|
||||
(r.title = function (e, t) {
|
||||
var n = i('#' + l[0] + (t || r.index)).find(l[1]);
|
||||
n.html(e);
|
||||
}),
|
||||
(r.close = function (e, t) {
|
||||
var n = i('#' + l[0] + e),
|
||||
a = n.attr('type'),
|
||||
s = 'layer-anim-close';
|
||||
if (n[0]) {
|
||||
var f = 'layui-layer-wrap',
|
||||
c = function () {
|
||||
if (a === o.type[1] && 'object' === n.attr('conType')) {
|
||||
n.children(':not(.' + l[5] + ')').remove();
|
||||
for (var r = n.find('.' + f), s = 0; s < 2; s++) r.unwrap();
|
||||
r.css('display', r.data('display')).removeClass(f);
|
||||
} else {
|
||||
if (a === o.type[2])
|
||||
try {
|
||||
var c = i('#' + l[4] + e)[0];
|
||||
c.contentWindow.document.write(''), c.contentWindow.close(), n.find('.' + l[5])[0].removeChild(c);
|
||||
} catch (u) {}
|
||||
(n[0].innerHTML = ''), n.remove();
|
||||
}
|
||||
'function' == typeof o.end[e] && o.end[e](), delete o.end[e], 'function' == typeof t && t();
|
||||
};
|
||||
n.data('isOutAnim') && n.addClass('layer-anim ' + s),
|
||||
i('#layui-layer-moves, #' + l.SHADE + e).remove(),
|
||||
6 == r.ie && o.reselect(),
|
||||
o.rescollbar(e),
|
||||
n.attr('minLeft') && (o.minIndex--, o.minLeft.push(n.attr('minLeft'))),
|
||||
(r.ie && r.ie < 10) || !n.data('isOutAnim')
|
||||
? c()
|
||||
: setTimeout(function () {
|
||||
c();
|
||||
}, 200);
|
||||
}
|
||||
}),
|
||||
(r.closeAll = function (e, t) {
|
||||
'function' == typeof e && ((t = e), (e = null));
|
||||
var n = i('.' + l[0]);
|
||||
i.each(n, function (a) {
|
||||
var o = i(this),
|
||||
s = e ? o.attr('type') === e : 1;
|
||||
s && r.close(o.attr('times'), a === n.length - 1 ? t : null), (s = null);
|
||||
}),
|
||||
0 === n.length && 'function' == typeof t && t();
|
||||
});
|
||||
var f = r.cache || {},
|
||||
c = function (e) {
|
||||
return f.skin ? ' ' + f.skin + ' ' + f.skin + '-' + e : '';
|
||||
};
|
||||
(r.prompt = function (e, t) {
|
||||
var a = '';
|
||||
if (((e = e || {}), 'function' == typeof e && (t = e), e.area)) {
|
||||
var o = e.area;
|
||||
(a = 'style="width: ' + o[0] + '; height: ' + o[1] + ';"'), delete e.area;
|
||||
}
|
||||
var s,
|
||||
l =
|
||||
2 == e.formType
|
||||
? '<textarea class="layui-layer-input"' + a + '></textarea>'
|
||||
: (function () {
|
||||
return '<input type="' + (1 == e.formType ? 'password' : 'text') + '" class="layui-layer-input">';
|
||||
})(),
|
||||
f = e.success;
|
||||
return (
|
||||
delete e.success,
|
||||
r.open(
|
||||
i.extend(
|
||||
{
|
||||
type: 1,
|
||||
btn: ['确定', '取消'],
|
||||
content: l,
|
||||
skin: 'layui-layer-prompt' + c('prompt'),
|
||||
maxWidth: n.width(),
|
||||
success: function (t) {
|
||||
(s = t.find('.layui-layer-input')), s.val(e.value || '').focus(), 'function' == typeof f && f(t);
|
||||
},
|
||||
resize: !1,
|
||||
yes: function (i) {
|
||||
var n = s.val();
|
||||
'' === n
|
||||
? s.focus()
|
||||
: n.length > (e.maxlength || 500)
|
||||
? r.tips('最多输入' + (e.maxlength || 500) + '个字数', s, { tips: 1 })
|
||||
: t && t(n, i, s);
|
||||
}
|
||||
},
|
||||
e
|
||||
)
|
||||
)
|
||||
);
|
||||
}),
|
||||
(r.tab = function (e) {
|
||||
e = e || {};
|
||||
var t = e.tab || {},
|
||||
n = 'layui-this',
|
||||
a = e.success;
|
||||
return (
|
||||
delete e.success,
|
||||
r.open(
|
||||
i.extend(
|
||||
{
|
||||
type: 1,
|
||||
skin: 'layui-layer-tab' + c('tab'),
|
||||
resize: !1,
|
||||
title: (function () {
|
||||
var e = t.length,
|
||||
i = 1,
|
||||
a = '';
|
||||
if (e > 0) for (a = '<span class="' + n + '">' + t[0].title + '</span>'; i < e; i++) a += '<span>' + t[i].title + '</span>';
|
||||
return a;
|
||||
})(),
|
||||
content:
|
||||
'<ul class="layui-layer-tabmain">' +
|
||||
(function () {
|
||||
var e = t.length,
|
||||
i = 1,
|
||||
a = '';
|
||||
if (e > 0)
|
||||
for (a = '<li class="layui-layer-tabli ' + n + '">' + (t[0].content || 'no content') + '</li>'; i < e; i++)
|
||||
a += '<li class="layui-layer-tabli">' + (t[i].content || 'no content') + '</li>';
|
||||
return a;
|
||||
})() +
|
||||
'</ul>',
|
||||
success: function (t) {
|
||||
var o = t.find('.layui-layer-title').children(),
|
||||
r = t.find('.layui-layer-tabmain').children();
|
||||
o.on('mousedown', function (t) {
|
||||
t.stopPropagation ? t.stopPropagation() : (t.cancelBubble = !0);
|
||||
var a = i(this),
|
||||
o = a.index();
|
||||
a.addClass(n).siblings().removeClass(n), r.eq(o).show().siblings().hide(), 'function' == typeof e.change && e.change(o);
|
||||
}),
|
||||
'function' == typeof a && a(t);
|
||||
}
|
||||
},
|
||||
e
|
||||
)
|
||||
)
|
||||
);
|
||||
}),
|
||||
(r.photos = function (t, n, a) {
|
||||
function o(e, t, i) {
|
||||
var n = new Image();
|
||||
return (
|
||||
(n.src = e),
|
||||
n.complete
|
||||
? t(n)
|
||||
: ((n.onload = function () {
|
||||
(n.onload = null), t(n);
|
||||
}),
|
||||
void (n.onerror = function (e) {
|
||||
(n.onerror = null), i(e);
|
||||
}))
|
||||
);
|
||||
}
|
||||
var s = {};
|
||||
if (((t = t || {}), t.photos)) {
|
||||
var l = !('string' == typeof t.photos || t.photos instanceof i),
|
||||
f = l ? t.photos : {},
|
||||
u = f.data || [],
|
||||
d = f.start || 0;
|
||||
(s.imgIndex = (0 | d) + 1), (t.img = t.img || 'img');
|
||||
var y = t.success;
|
||||
if ((delete t.success, l)) {
|
||||
if (0 === u.length) return r.msg('没有图片');
|
||||
} else {
|
||||
var p = i(t.photos),
|
||||
h = function () {
|
||||
(u = []),
|
||||
p.find(t.img).each(function (e) {
|
||||
var t = i(this);
|
||||
t.attr('layer-index', e),
|
||||
u.push({ alt: t.attr('alt'), pid: t.attr('layer-pid'), src: t.attr('layer-src') || t.attr('src'), thumb: t.attr('src') });
|
||||
});
|
||||
};
|
||||
if ((h(), 0 === u.length)) return;
|
||||
if (
|
||||
(n ||
|
||||
p.on('click', t.img, function () {
|
||||
h();
|
||||
var e = i(this),
|
||||
n = e.attr('layer-index');
|
||||
r.photos(i.extend(t, { photos: { start: n, data: u, tab: t.tab }, full: t.full }), !0);
|
||||
}),
|
||||
!n)
|
||||
)
|
||||
return;
|
||||
}
|
||||
(s.imgprev = function (e) {
|
||||
s.imgIndex--, s.imgIndex < 1 && (s.imgIndex = u.length), s.tabimg(e);
|
||||
}),
|
||||
(s.imgnext = function (e, t) {
|
||||
s.imgIndex++, (s.imgIndex > u.length && ((s.imgIndex = 1), t)) || s.tabimg(e);
|
||||
}),
|
||||
(s.keyup = function (e) {
|
||||
if (!s.end) {
|
||||
var t = e.keyCode;
|
||||
e.preventDefault(), 37 === t ? s.imgprev(!0) : 39 === t ? s.imgnext(!0) : 27 === t && r.close(s.index);
|
||||
}
|
||||
}),
|
||||
(s.tabimg = function (e) {
|
||||
if (!(u.length <= 1)) return (f.start = s.imgIndex - 1), r.close(s.index), r.photos(t, !0, e);
|
||||
}),
|
||||
(s.event = function () {
|
||||
s.bigimg.find('.layui-layer-imgprev').on('click', function (e) {
|
||||
e.preventDefault(), s.imgprev(!0);
|
||||
}),
|
||||
s.bigimg.find('.layui-layer-imgnext').on('click', function (e) {
|
||||
e.preventDefault(), s.imgnext(!0);
|
||||
}),
|
||||
i(document).on('keyup', s.keyup);
|
||||
}),
|
||||
(s.loadi = r.load(1, { shade: !('shade' in t) && 0.9, scrollbar: !1 })),
|
||||
o(
|
||||
u[d].src,
|
||||
function (n) {
|
||||
r.close(s.loadi),
|
||||
a && (t.anim = -1),
|
||||
(s.index = r.open(
|
||||
i.extend(
|
||||
{
|
||||
type: 1,
|
||||
id: 'layui-layer-photos',
|
||||
area: (function () {
|
||||
var a = [n.width, n.height],
|
||||
o = [i(e).width() - 100, i(e).height() - 100];
|
||||
if (!t.full && (a[0] > o[0] || a[1] > o[1])) {
|
||||
var r = [a[0] / o[0], a[1] / o[1]];
|
||||
r[0] > r[1] ? ((a[0] = a[0] / r[0]), (a[1] = a[1] / r[0])) : r[0] < r[1] && ((a[0] = a[0] / r[1]), (a[1] = a[1] / r[1]));
|
||||
}
|
||||
return [a[0] + 'px', a[1] + 'px'];
|
||||
})(),
|
||||
title: !1,
|
||||
shade: 0.9,
|
||||
shadeClose: !0,
|
||||
closeBtn: !1,
|
||||
move: '.layui-layer-phimg img',
|
||||
moveType: 1,
|
||||
scrollbar: !1,
|
||||
moveOut: !0,
|
||||
anim: 5,
|
||||
isOutAnim: !1,
|
||||
skin: 'layui-layer-photos' + c('photos'),
|
||||
content:
|
||||
'<div class="layui-layer-phimg"><img src="' +
|
||||
u[d].src +
|
||||
'" alt="' +
|
||||
(u[d].alt || '') +
|
||||
'" layer-pid="' +
|
||||
u[d].pid +
|
||||
'">' +
|
||||
(function () {
|
||||
return u.length > 1
|
||||
? '<div class="layui-layer-imgsee"><span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span><div class="layui-layer-imgbar" style="display:' +
|
||||
(a ? 'block' : '') +
|
||||
'"><span class="layui-layer-imgtit"><a href="javascript:;">' +
|
||||
(u[d].alt || '') +
|
||||
'</a><em>' +
|
||||
s.imgIndex +
|
||||
' / ' +
|
||||
u.length +
|
||||
'</em></span></div></div>'
|
||||
: '';
|
||||
})() +
|
||||
'</div>',
|
||||
success: function (e, i) {
|
||||
(s.bigimg = e.find('.layui-layer-phimg')),
|
||||
(s.imgsee = e.find('.layui-layer-imgbar')),
|
||||
s.event(e),
|
||||
t.tab && t.tab(u[d], e),
|
||||
'function' == typeof y && y(e);
|
||||
},
|
||||
end: function () {
|
||||
(s.end = !0), i(document).off('keyup', s.keyup);
|
||||
}
|
||||
},
|
||||
t
|
||||
)
|
||||
));
|
||||
},
|
||||
function () {
|
||||
r.close(s.loadi),
|
||||
r.msg(
|
||||
'当前图片地址异常<br>是否继续查看下一张?',
|
||||
{
|
||||
time: 3e4,
|
||||
btn: ['下一张', '不看了'],
|
||||
yes: function () {
|
||||
u.length > 1 && s.imgnext(!0, !0);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}),
|
||||
(o.run = function (t) {
|
||||
(i = t),
|
||||
(n = i(e)),
|
||||
(l.html = i('html')),
|
||||
(r.open = function (e) {
|
||||
var t = new s(e);
|
||||
return t.index;
|
||||
});
|
||||
}),
|
||||
e.layui && layui.define
|
||||
? (r.ready(),
|
||||
layui.define('jquery', function (t) {
|
||||
(r.path = layui.cache.dir), o.run(layui.$), (e.layer = r), t('layer', r);
|
||||
}))
|
||||
: 'function' == typeof define && define.amd
|
||||
? define(['jquery'], function () {
|
||||
return o.run(e.jQuery), r;
|
||||
})
|
||||
: (function () {
|
||||
r.ready(), o.run(e.jQuery);
|
||||
})();
|
||||
})(window);
|
@ -0,0 +1,2 @@
|
||||
/*! layer mobile-v2.0.0 Web 通用弹出层组件 MIT License */
|
||||
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);
|
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1,129 @@
|
||||
/*
|
||||
* email: bigablecat@hotmail.com
|
||||
* Date: 2018-04-14
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param zTreeId the ztree id used to get the ztree object
|
||||
* @param searchField selector of your input for fuzzy search
|
||||
* @param isHighLight whether highlight the match words, default true
|
||||
* @param isExpand whether to expand the node, default false
|
||||
*
|
||||
* @returns
|
||||
*/
|
||||
function fuzzySearch(zTreeId, searchField, isHighLight, isExpand){
|
||||
var zTreeObj = $.fn.zTree.getZTreeObj(zTreeId);//get the ztree object by ztree id
|
||||
if(!zTreeObj){
|
||||
alert("fail to get ztree object");
|
||||
}
|
||||
var nameKey = zTreeObj.setting.data.key.name; //get the key of the node name
|
||||
isHighLight = isHighLight===false?false:true;//default true, only use false to disable highlight
|
||||
isExpand = isExpand?true:false; // not to expand in default
|
||||
zTreeObj.setting.view.nameIsHTML = isHighLight; //allow use html in node name for highlight use
|
||||
|
||||
var metaChar = '[\\[\\]\\\\\^\\$\\.\\|\\?\\*\\+\\(\\)]'; //js meta characters
|
||||
var rexMeta = new RegExp(metaChar, 'gi');//regular expression to match meta characters
|
||||
|
||||
// keywords filter function
|
||||
function ztreeFilter(zTreeObj,_keywords,callBackFunc) {
|
||||
if(!_keywords){
|
||||
_keywords =''; //default blank for _keywords
|
||||
}
|
||||
|
||||
// function to find the matching node
|
||||
function filterFunc(node) {
|
||||
if(node && node.oldname && node.oldname.length>0){
|
||||
node[nameKey] = node.oldname; //recover oldname of the node if exist
|
||||
}
|
||||
zTreeObj.updateNode(node); //update node to for modifications take effect
|
||||
if (_keywords.length == 0) {
|
||||
//return true to show all nodes if the keyword is blank
|
||||
zTreeObj.showNode(node);
|
||||
zTreeObj.expandNode(node,isExpand);
|
||||
return true;
|
||||
}
|
||||
//transform node name and keywords to lowercase
|
||||
if (node[nameKey] && node[nameKey].toLowerCase().indexOf(_keywords.toLowerCase())!=-1) {
|
||||
if(isHighLight){ //highlight process
|
||||
//a new variable 'newKeywords' created to store the keywords information
|
||||
//keep the parameter '_keywords' as initial and it will be used in next node
|
||||
//process the meta characters in _keywords thus the RegExp can be correctly used in str.replace
|
||||
var newKeywords = _keywords.replace(rexMeta,function(matchStr){
|
||||
//add escape character before meta characters
|
||||
return '\\' + matchStr;
|
||||
});
|
||||
node.oldname = node[nameKey]; //store the old name
|
||||
var rexGlobal = new RegExp(newKeywords, 'gi');//'g' for global,'i' for ignore case
|
||||
//use replace(RegExp,replacement) since replace(/substr/g,replacement) cannot be used here
|
||||
node[nameKey] = node.oldname.replace(rexGlobal, function(originalText){
|
||||
//highlight the matching words in node name
|
||||
var highLightText =
|
||||
'<span style="color: whitesmoke;background-color: darkred;">'
|
||||
+ originalText
|
||||
+'</span>';
|
||||
return highLightText;
|
||||
});
|
||||
zTreeObj.updateNode(node); //update node for modifications take effect
|
||||
}
|
||||
zTreeObj.showNode(node);//show node with matching keywords
|
||||
return true; //return true and show this node
|
||||
}
|
||||
|
||||
zTreeObj.hideNode(node); // hide node that not matched
|
||||
return false; //return false for node not matched
|
||||
}
|
||||
|
||||
var nodesShow = zTreeObj.getNodesByFilter(filterFunc); //get all nodes that would be shown
|
||||
processShowNodes(nodesShow, _keywords);//nodes should be reprocessed to show correctly
|
||||
}
|
||||
|
||||
/**
|
||||
* reprocess of nodes before showing
|
||||
*/
|
||||
function processShowNodes(nodesShow,_keywords){
|
||||
if(nodesShow && nodesShow.length>0){
|
||||
//process the ancient nodes if _keywords is not blank
|
||||
if(_keywords.length>0){
|
||||
$.each(nodesShow, function(n,obj){
|
||||
var pathOfOne = obj.getPath();//get all the ancient nodes including current node
|
||||
if(pathOfOne && pathOfOne.length>0){
|
||||
//i < pathOfOne.length-1 process every node in path except self
|
||||
for(var i=0;i<pathOfOne.length-1;i++){
|
||||
zTreeObj.showNode(pathOfOne[i]); //show node
|
||||
zTreeObj.expandNode(pathOfOne[i],true); //expand node
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{ //show all nodes when _keywords is blank and expand the root nodes
|
||||
var rootNodes = zTreeObj.getNodesByParam('level','0');//get all root nodes
|
||||
$.each(rootNodes,function(n,obj){
|
||||
zTreeObj.expandNode(obj,true); //expand all root nodes
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//listen to change in input element
|
||||
$(searchField).bind('input propertychange', function() {
|
||||
var _keywords = $(this).val();
|
||||
searchNodeLazy(_keywords); //call lazy load
|
||||
});
|
||||
|
||||
var timeoutId = null;
|
||||
var lastKeyword = '';
|
||||
// excute lazy load once after input change, the last pending task will be cancled
|
||||
function searchNodeLazy(_keywords) {
|
||||
if (timeoutId) {
|
||||
//clear pending task
|
||||
clearTimeout(timeoutId);
|
||||
}
|
||||
timeoutId = setTimeout(function() {
|
||||
if (lastKeyword === _keywords) {
|
||||
return;
|
||||
}
|
||||
ztreeFilter(zTreeObj,_keywords); //lazy load ztreeFilter function
|
||||
// $(searchField).focus();//focus input field again after filtering
|
||||
lastKeyword = _keywords;
|
||||
}, 500);
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 601 B |
After Width: | Height: | Size: 580 B |
After Width: | Height: | Size: 570 B |
After Width: | Height: | Size: 762 B |
After Width: | Height: | Size: 399 B |
After Width: | Height: | Size: 710 B |
After Width: | Height: | Size: 432 B |
After Width: | Height: | Size: 534 B |
After Width: | Height: | Size: 529 B |
After Width: | Height: | Size: 467 B |
After Width: | Height: | Size: 45 B |
After Width: | Height: | Size: 933 B |
After Width: | Height: | Size: 381 B |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 7.8 KiB |