Commit 1103c7a0 by shz

first commit

parent 768a71cc
<?php
class TCSync {
const user_url = 'http://218.1.67.130:8988/api/NanTongWechat/GetPropertyConsultant?cityId=1';
public static function user_sync(){
$response = wp_remote_post( TCSync::user_url );
$res = array(
'code' => 200,
'msg' => "success"
);
//判断请求是否成功
if( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ){
$res['code'] = 500;
$res['msg'] = "get user info error";
}else{
set_time_limit(0) ;
//获取请求内容
$result = wp_remote_retrieve_body( $response );
$result = json_decode($result,true);
foreach($result['data'] as $item){
if(username_exists($item['WorkNum'])){
$user = get_user_by( "login", $item['WorkNum'] );
$userdata = array(
'ID' => $user->data->ID,
'display_name' => $item['Name']
);
$user_id = wp_update_user( $userdata ) ;
}else{
$userdata = array(
'user_login' => $item['WorkNum'],
'user_pass' => $item['WorkNumAndID'], // When creating an user, `user_pass` is expected.
'role' => 'editor',
'wp_user_level' => 7,
'display_name' => $item['Name']
);
$user_id = wp_insert_user( $userdata ) ;
}
if(is_numeric($user_id) && !is_null($item['ImageUrl'])){
update_user_meta( $user_id, "tc_image", $item['ImageUrl'] );
}
}
}
return $res;
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: UGEN79
* Date: 2015/8/6
* Time: 16:51
*/
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class consultantScoreList extends WP_List_Table
{
function __construct()
{
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'score', //singular name of the listed records
'plural' => 'scores', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
}
function column_default($item, $column_name)
{
switch ($column_name) {
case 'id':
case 'consultant':
case 'user':
case 'score':
return $item[$column_name];
case 'valid':
if ($item[$column_name]) {
return '<button data-valid="0" data-score-id="' . $item['id'] . '">设为无效</button>';
} else {
return '<button data-valid="1" data-score-id="' . $item['id'] . '">设为有效</button>';
}
default:
return print_r($item, true); //Show the whole array for troubleshooting purposes
}
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/
$this->_args['singular'], //Let's simply repurpose the table's singular label ("score")
/*$2%s*/
$item['id'] //The value of the checkbox should be the record's id
);
}
function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
'id' => 'ID',
'consultant' => '置业顾问',
'user' => '用户',
'score' => '评分',
'valid' => '状态'
);
return $columns;
}
function get_sortable_columns()
{
$sortable_columns = array(
'id' => array('id', false),
'consultant' => array('consultant', false),
'user' => array('user', false),
'score' => array('score', false),
'valid' => array('valid', false)
);
return $sortable_columns;
}
function get_bulk_actions()
{
$actions = array(
'invalid' => '设为无效',
'valid' => '设为有效',
);
return $actions;
}
function process_bulk_action()
{
$action = $this->current_action();
if ($action) {
$string = null;
$valid = null;
switch ($action) {
case 'invalid':
$score = $_GET['score'];
if ($score) {
$string = '(' . implode(',', array_map('intval', $score)) . ')';
$valid = 0;
}
break;
case 'valid':
$score = $_GET['score'];
if ($score) {
$valid = 1;
$string = '(' . implode(',', array_map('intval', $score)) . ')';
}
break;
}
global $wpdb;
$result = $wpdb->query('update tospur_consultant_score SET valid=' . $valid . ' where id in ' . $string);
}
}
function prepare_items()
{
global $wpdb;
$per_page = 5;
$columns = $this->get_columns();
$hidden = array();
$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden, $sortable);
$this->process_bulk_action();
//$data = $this->example_data;
$sql = "SELECT s.id,c.user_login as consultant,u.user_login as user,s.score,s.valid FROM tospur_consultant_score s " .
"left join wp_users u on s.user_id = u.ID " .
"left join wp_users c on s.consultant_id = c.ID";
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'consultant' => $value->consultant,
'user' => $value->user,
'score' => $value->score,
'valid' => $value->valid,
);
}
function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'valid'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'desc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function add_consultant_score_menu()
{
add_menu_page('置业顾问评分', '置业顾问评分', 'activate_plugins', 'consultant_score', 'consultant_score_page', 'dashicons-menu', 26);
}
add_action('admin_menu', 'add_consultant_score_menu');
function consultant_score_page()
{
$consultantScoreList = new consultantScoreList();
$consultantScoreList->prepare_items();
?>
<div class="wrap">
<h2>置业顾问评分列表</h2>
<form id="scores-filter" method="get">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>"/>
<!-- Now we can render the completed list table -->
<?php $consultantScoreList->display() ?>
</form>
</div>
<script>
(function ($) {
$('button[data-score-id]').click(function () {
var self = $(this);
var score_id = $(this).data('score-id');
var valid = $(this).data('valid');
$.ajax({
type: 'POST',
url: '<?php echo admin_url()?>admin-ajax.php/',
data: 'action=valid_consultant_score&id=' + score_id + '&valid=' + valid,
success: function (data) {
if (data.code == 2000) {
if (valid == 0) {
self.text('设为有效');
self.data('valid', 1);
} else {
self.text('设为无效');
self.data('valid', 0);
}
alert('设置成功');
} else {
alert('设置失败');
}
}
});
return false;
});
})(jQuery);
</script>
<?php
}
?>
\ No newline at end of file
<?php
$house_id = $_GET['id'];
$house_sql = 'SELECT v.id, h.name, u.user_login as phone, v.date, v.time, v.consultant_id as consultant_id, v.handle, v.handle_date FROM view_house v '
. 'left join tospur_house h on v.house_id = h.id '
. 'left join wp_users u on v.user_id = u.id '
. 'where v.id = ' . $house_id;
$consultant_sql = 'SELECT u.id,u.display_name FROM wp_users u '
. 'left join wp_usermeta m on u.id=m.user_id where meta_key="wp_user_level" and meta_value=7;';
global $wpdb;
$context['house_result'] = $wpdb->get_row($house_sql);
$context['consultant_result'] = $wpdb->get_results($consultant_sql);
$context['url'] = home_url();
$context['id'] = $house_id;
Timber::render('views/handle.html', $context);
?>
\ No newline at end of file
<?php
/*
Plugin Name: tospur
Plugin URI:
Description: tospur
Version: 1.0
Author: Sun
Author URI:
*/
add_action('init', 'tospur_init');
function tospur_init()
{
require_once('consultant_score.php');
require_once('view_house.php');
}
//后台处理 置业顾问
add_action('wp_ajax_update_consultant', 'update_consultant');
function update_consultant()
{
$house_id = $_POST['id'];
$consultant_id = $_POST['consultant_id'];
if (isset($consultant_id) && isset($house_id)) {
$result = dao::update_view_house_consultant($house_id, $consultant_id);
$array = array();
if ($result) {
$array['code'] = 2000;
} else {
$array['code'] = 2001;
}
wp_send_json($array);
}
}
//后台处理 置业顾问评分
add_action('wp_ajax_valid_consultant_score', 'valid_consultant_score');
function valid_consultant_score()
{
$score_id = $_POST['id'];
$valid = $_POST['valid'];
if (isset($score_id) && isset($valid)) {
$result = dao::update_consultant_score($score_id, $valid);
$array = array();
if ($result) {
$array['code'] = 2000;
} else {
$array['code'] = 2001;
}
wp_send_json($array);
}
}
?>
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: UGEN79
* Date: 2015/8/6
* Time: 16:51
*/
if (!class_exists('WP_List_Table')) {
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
}
class viewHouseList extends WP_List_Table
{
function __construct()
{
global $status, $page;
//Set parent defaults
parent::__construct(array(
'singular' => 'house', //singular name of the listed records
'plural' => 'houses', //plural name of the listed records
'ajax' => false //does this table support ajax?
));
}
function column_default($item, $column_name)
{
switch ($column_name) {
case 'name':
$handle = $item['handle'];
if ($handle == 0) {
return '<a href="' . admin_url() . 'admin.php?page=view_house&id=' . $item['id'] . '">' . $item[$column_name] . '</a>';
} else {
return $item[$column_name];
}
case 'handle':
$handle = $item[$column_name];
if ($handle == 1) {
return '已处理';
} else {
return '未处理';
}
case 'handle_date':
$handle = $item['handle'];
if ($handle == 1) {
return $item[$column_name];
} else {
return false;
}
default:
return $item[$column_name];
}
}
function column_title($item)
{
//Build row actions
$actions = array(
'edit' => sprintf('<a href="?page=%s&action=%s&house=%s">Edit</a>', $_REQUEST['page'], 'edit', $item['ID']),
'delete' => sprintf('<a href="?page=%s&action=%s&house=%s">Delete</a>', $_REQUEST['page'], 'delete', $item['ID']),
);
//Return the title contents
return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
/*$1%s*/
$item['title'],
/*$2%s*/
$item['ID'],
/*$3%s*/
$this->row_actions($actions)
);
}
function column_cb($item)
{
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
/*$1%s*/
$this->_args['singular'], //Let's simply repurpose the table's singular label ("house")
/*$2%s*/
$item['ID'] //The value of the checkbox should be the record's id
);
}
function get_columns()
{
$columns = array(
'cb' => '<input type="checkbox">', //Render a checkbox instead of text
'name' => '楼盘名/房源名',
'date' => '时间',
'phone' => '手机号',
'consultant' => '置业顾问',
'handle' => '处理状态',
'handle_date' => '处理时间'
);
return $columns;
}
function get_sortable_columns()
{
$sortable_columns = array(
'name' => array('name', false),
'date' => array('date', false),
'phone' => array('phone', false),
'consultant' => array('consultant', false),
'handle' => array('handle', false),
'handle_date' => array('handle_date', false)
);
return $sortable_columns;
}
function get_bulk_actions()
{
$actions = array(
'delete' => 'Delete'
);
return $actions;
}
function process_bulk_action()
{
if ('delete' === $this->current_action()) {
wp_die('Items deleted (or they would be if we had items to delete)!');
}
}
function prepare_items()
{
global $wpdb;
$per_page = 5;
$columns = $this->get_columns();
$hidden = array();
//$sortable = $this->get_sortable_columns();
$this->_column_headers = array($columns, $hidden);
$this->process_bulk_action();
$sql = 'SELECT v.id, h.name, u.user_login as phone, v.date, v.time, c.display_name as consultant, v.handle, v.handle_date FROM view_house v '
. 'left join tospur_house h on v.house_id = h.id '
. 'left join wp_users u on v.user_id = u.id '
. 'left join wp_users c on v.consultant_id = c.id '
. 'order by handle';
$result = $wpdb->get_results($sql);
$data = array();
foreach ($result as $key => $value) {
$data[$key] = array(
'id' => $value->id,
'name' => $value->name,
'date' => $value->date,
'phone' => $value->phone,
'consultant' => $value->consultant,
'handle' => $value->handle,
'handle_date' => $value->handle_date
);
}
/*function usort_reorder($a, $b)
{
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'handle'; //If no sort, default to title
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
return ($order === 'asc') ? $result : -$result; //Send final sort direction to usort
}
usort($data, 'usort_reorder');*/
$current_page = $this->get_pagenum();
$total_items = count($data);
$data = array_slice($data, (($current_page - 1) * $per_page), $per_page);
$this->items = $data;
$this->set_pagination_args(array(
'total_items' => $total_items, //WE have to calculate the total number of items
'per_page' => $per_page, //WE have to determine how many items to show on a page
'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages
));
}
}
function add_view_house_menu()
{
add_menu_page('预约列表', '预约列表', 'activate_plugins', 'view_house', 'view_house_page', 'dashicons-menu', 27);
}
add_action('admin_menu', 'add_view_house_menu');
function view_house_page()
{
if ($_GET['id']) {
require_once('handle_view_house.php');
} else {
//Create an instance our package class...
$viewHouseList = new viewHouseList();
//Fetch, prepare, sort, and filter our data...
$viewHouseList->prepare_items();
?>
<div class="wrap">
<h2>预约列表</h2>
<form id="houses-filter" method="get">
<!-- For plugins, we also need to ensure that the form posts back to our current page -->
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>"/>
<!-- Now we can render the completed list table -->
<?php $viewHouseList->display() ?>
</form>
</div>
<?php
}
}
?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style></style>
<script>
(function ($) {
$(document).ready(function () {
$('#handle').click(function () {
var consultant_id = $('#consultant option:selected').val();
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=update_consultant&id={{ id }}&consultant_id=' + consultant_id,
success: function (data) {
if (data.code == 2000) {
alert('提交处理成功');
} else {
alert('提交处理失败');
}
}
});
});
});
})(jQuery);
</script>
</head>
<body>
<div>
<ul>
<li>楼盘名/房源名:{{ house_result.name }}</li>
<li>用户:{{ house_result.phone }}</li>
<li>预约时间:{{ house_result.date }} {{ house_result.time }}</li>
</ul>
</div>
<label for="consultant"></label>
<select id="consultant">
{% for consultant in consultant_result %}
<option value="{{ consultant.id }}"
{% if(house_result.consultant_id==consultant.id) %}selected="selected"{% endif %}>{{ consultant.display_name }}</option>
{% endfor %}
</select>
<button id="handle">提交处理</button>
</body>
</html>
\ No newline at end of file
<?php
require_once('const.php');
$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$consultant_id = $_GET['consultant_id'];
$context['consultant_id'] = $consultant_id;
$context['consultant_name'] = get_user_by('id', $consultant_id)->user_nicename;
$context['consultant_score'] = get_consultant_score($consultant_id);
$context['consultant_score_url'] = $const_score_page . '&consultant_id=' . $consultant_id;
}
Timber::render('consultant_info.html', $context);
?>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
@font-face {
font-family: 'iconfont';
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot');
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439179733_4587424.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439179733_4587424.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439179733_4587424.svg#iconfont') format('svg');
/* IE9*/
/* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.modal .modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 280px;
height: 130px;
}
.modal .modal-dialog .modal-content {
color: #000000;
border: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
box-shadow: none;
-webkit-box-shadow: none;
}
.modal .modal-dialog .modal-content h4 {
font-size: 19px;
font-weight: bold;
margin: 0 20px;
padding-top: 15px;
}
.modal .modal-dialog .modal-content p {
font-size: 16px;
margin: 12px 20px 14px;
}
.modal .modal-dialog .modal-content .btn {
border-top-color: #cfd0d0;
background-color: transparent;
font-weight: bold;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.modal .modal-dialog .modal-content .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
background-color: #e9e9e9;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
}
.modal .modal-dialog .modal-content .btn:focus {
outline: 0;
}
html,
body {
width: 100%;
height: 100%;
}
body {
user-select: none;
-webkit-user-select: none;
tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
color: #707070;
background-color: #f9f9f9;
}
body {
height: auto;
padding-bottom: 45px;
}
.collect {
position: fixed;
top: 10px;
right: 0;
z-index: 999;
width: 55px;
height: 35px;
line-height: 35px;
margin-bottom: 0;
padding-left: 10px;
color: #ffffff;
background-color: #008cd7;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
}
.collect .iconfont {
font-size: 26px;
}
.addWrap {
width: 100%;
height: 250px;
position: relative;
}
.addWrap .swipe {
overflow: hidden;
visibility: hidden;
position: relative;
height: 100%;
}
.addWrap .swipe .swipe-wrap {
overflow: hidden;
position: relative;
}
.addWrap .swipe .swipe-wrap div {
float: left;
width: 100%;
position: relative;
}
.addWrap .swipe .swipe-wrap div img {
max-width: 100%;
}
.addWrap ul {
position: absolute;
bottom: -2px;
left: 0;
right: 0;
font-size: 0;
}
.addWrap ul li {
width: 10px;
height: 10px;
border-top-left-radius: 50%;
border-top-right-radius: 50%;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
-webkit-border-top-left-radius: 50%;
-webkit-border-top-right-radius: 50%;
-webkit-border-bottom-left-radius: 50%;
-webkit-border-bottom-right-radius: 50%;
background-color: #000000;
margin-right: 10px;
opacity: 0.7;
}
.addWrap ul li.active {
background-color: #ffffff;
}
.detail_row {
width: 100%;
height: auto;
padding: 10px;
overflow: hidden;
position: relative;
border-bottom: 1px solid #b7b7b7;
}
.detail_row p {
margin-bottom: 0;
}
.detail_row ul {
margin-bottom: 0;
}
.detail_row ul li {
padding: 0;
}
.detail_row .detail_title {
color: #000000;
font-weight: bold;
margin-bottom: 5px;
}
.detail_row.priceCont .detail_title {
font-size: 18px;
}
.detail_row.priceCont ul li {
height: 30px;
line-height: 30px;
}
.detail_row.priceCont ul li.price span {
color: #000000;
}
.detail_row.priceCont ul li.price span em {
font-style: normal;
}
.detail_row.priceCont ul li.price span em:nth-child(1) {
color: #ff0000;
font-size: 22px;
font-weight: bold;
}
.detail_row.priceCont ul li.price span em:nth-child(2) {
font-size: 7px;
vertical-align: top;
}
.detail_row.priceCont ul li .btn {
color: #ff0000;
border-color: #959595;
background-color: transparent;
padding: 3px 12px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
}
.detail_row .single_omit {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail_row #wrapper {
width: 100%;
height: auto;
margin-top: 8px;
overflow: hidden;
}
.detail_row #wrapper #scroller {
height: 100%;
float: left;
padding: 0;
}
.detail_row #wrapper #scroller ul {
float: left;
width: 100%;
height: 100%;
margin: 0;
font-size: 0;
}
.detail_row #wrapper #scroller ul li {
width: 90px;
text-align: center;
vertical-align: top;
margin-right: 5px;
font-size: 14px;
}
.detail_row #wrapper #scroller ul li p img {
width: 100%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
}
.detail_row #wrapper #scroller ul li:last-child {
margin-right: 0;
}
.detail_row .map {
position: absolute;
top: 5px;
right: 5px;
width: 40px;
height: 40px;
text-align: center;
}
.detail_row .map span {
width: 30px;
height: 30px;
background: url("../img/blue_map_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
}
.detail_row .infoCont li span {
color: #000000;
}
.detail_row .recommendCont {
margin-top: 5px;
overflow: hidden;
zoom: 1;
}
.detail_row .recommendCont li {
margin: 5px 0 0 15px;
}
.detail_row .recommendCont li p {
width: 100%;
padding-bottom: 100%;
background-repeat: no-repeat;
background-position: center;
background-size: auto 100%;
-webkit-background-size: auto 100%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
}
.detail_row .peopleCont li {
width: 100%;
height: 60px;
padding: 5px 0;
}
.detail_row .peopleCont li ol {
padding: 0;
}
.detail_row .peopleCont li ol:nth-child(2) {
padding: 0 10px;
}
.detail_row .peopleCont li ol img {
width: 50px;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
-webkit-border-top-left-radius: 3px;
-webkit-border-top-right-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-webkit-border-bottom-right-radius: 3px;
}
.detail_row .peopleCont li ol p {
color: #000000;
font-size: 18px;
font-weight: bold;
}
.detail_row .peopleCont li ol .btn-phone {
width: 48%;
padding: 3px;
color: #ed6d00;
border-color: #ed6d00;
background-color: transparent;
margin-top: 12px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
}
.detail_row .peopleCont li ol .btn-phone span {
width: 16px;
height: 16px;
background: url("../img/orange_phone_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
vertical-align: middle;
}
.detail_row .peopleCont li ol .btn-bespeak {
width: 48%;
padding: 3px;
color: #008cd7;
border-color: #008cd7;
background-color: transparent;
margin-top: 12px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
}
.detail_row .peopleCont li ol .btn-bespeak span {
width: 16px;
height: 16px;
background: url("../img/blue_bespeak_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
display: inline-block;
vertical-align: middle;
}
.footer {
width: 100%;
height: 45px;
background-color: rgba(125, 125, 125, 0.9);
}
.footer .btn {
width: 45%;
margin: 5px 2%;
color: #ffffff;
background-color: #008cd7;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
.footer ul {
height: 100%;
margin-bottom: 0;
font-size: 0;
}
.footer ul li {
width: 60px;
height: 100%;
padding: 0;
color: #ffffff;
font-size: 10px;
}
.footer ul li p {
margin-bottom: 0;
}
.footer ul li.phone {
background-color: #0caae5;
}
.footer ul li.phone p:nth-child(1) {
width: 100%;
height: 30px;
background: url("../img/white_phone_icon.png") no-repeat;
background-size: auto 100%;
-webkit-background-size: auto 100%;
background-position: center;
}
.footer ul li.wechat {
background-color: #00a99d;
}
.footer ul li.wechat p:nth-child(1) {
width: 100%;
height: 30px;
background: url("../img/white_wechat_icon.png") no-repeat;
background-size: auto 100%;
-webkit-background-size: auto 100%;
background-position: center;
}
.modal #carousel_wrapper {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
background-color: #000000;
}
.modal #carousel_wrapper #carousel_scroller {
height: 100%;
float: left;
padding: 0;
}
.modal #carousel_wrapper #carousel_scroller ul {
float: left;
width: 100%;
height: 100%;
margin: 0;
font-size: 0;
}
.modal #carousel_wrapper #carousel_scroller ul li {
height: 100%;
padding: 0;
overflow: hidden;
}
.modal #carousel_wrapper #carousel_scroller ul li p {
margin-bottom: 0;
width: 100%;
height: 100%;
display: table;
}
.modal #carousel_wrapper #carousel_scroller ul li p span {
display: table-cell;
vertical-align: middle;
text-align: center;
}
.modal #carousel_wrapper #carousel_scroller ul li p span img {
max-width: 100%;
}
.modal #carousel_wrapper .indicators {
position: absolute;
bottom: 0;
left: 0;
right: 0;
font-size: 0;
}
.modal #carousel_wrapper .indicators li {
width: 10px;
height: 10px;
border-top-left-radius: 50%;
border-top-right-radius: 50%;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
-webkit-border-top-left-radius: 50%;
-webkit-border-top-right-radius: 50%;
-webkit-border-bottom-left-radius: 50%;
-webkit-border-bottom-right-radius: 50%;
background-color: #ffffff;
margin-right: 10px;
opacity: 0.7;
}
.modal #carousel_wrapper .indicators li.carousel_active {
opacity: 1;
}
@font-face {
font-family: 'iconfont';
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot');
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439179733_4587424.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439179733_4587424.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439179733_4587424.svg#iconfont') format('svg');
/* IE9*/
/* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.modal .modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 280px;
height: 130px;
}
.modal .modal-dialog .modal-content {
color: #000000;
border: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
box-shadow: none;
-webkit-box-shadow: none;
}
.modal .modal-dialog .modal-content h4 {
font-size: 19px;
font-weight: bold;
margin: 0 20px;
padding-top: 15px;
}
.modal .modal-dialog .modal-content p {
font-size: 16px;
margin: 12px 20px 14px;
}
.modal .modal-dialog .modal-content .btn {
border-top-color: #cfd0d0;
background-color: transparent;
font-weight: bold;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.modal .modal-dialog .modal-content .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
background-color: #e9e9e9;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
}
.modal .modal-dialog .modal-content .btn:focus {
outline: 0;
}
html,
body {
width: 100%;
height: 100%;
}
body {
user-select: none;
-webkit-user-select: none;
tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
color: #707070;
background-color: #f9f9f9;
}
.container-fluid {
width: 100%;
height: 100%;
background: url("../img/formBg.jpg") no-repeat;
background-size: 100% 100%;
-webkit-background-size: 100% 100%;
}
.container-fluid form h2 {
margin: 20% 0;
color: #ffffff;
font-weight: bold;
}
.container-fluid form .has-feedback {
margin-bottom: 0;
background-color: #fff;
border: 1px solid #DED6D9;
}
.container-fluid form .has-feedback .form-control {
height: 60px;
color: #7d7d7d;
box-shadow: none;
-webkit-box-shadow: none;
-webkit-appearance: none;
}
.container-fluid form .has-feedback .form-control::-webkit-input-placeholder {
color: #7d7d7d;
}
.container-fluid form .has-feedback:first-of-type {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
margin-bottom: -1px;
}
.container-fluid form .has-feedback:last-of-type {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
margin-top: -1px;
}
.container-fluid form .has-feedback.username .form-control-feedback {
width: 30px;
height: 30px;
background: url("../img/gray_username_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
top: 15px;
right: 15px;
}
.container-fluid form .has-feedback.password .form-control-feedback {
width: 30px;
height: 30px;
background: url("../img/gray_password_icon.png") no-repeat;
background-size: cover;
-webkit-background-size: cover;
top: 15px;
right: 15px;
}
.container-fluid form .has-feedback.code .form-control {
width: 65%;
}
.container-fluid form .has-feedback.code .form-control-feedback {
top: 4px;
right: 4px;
width: 30%;
height: 50px;
line-height: 50px;
color: #ffffff;
background-color: #0bacd3;
box-shadow: 0 2px 0 0 #088aa9;
-webkit-box-shadow: 0 2px 0 0 #088aa9;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
pointer-events: auto;
}
.container-fluid form .btn {
color: #ffffff;
margin: 10% 0 5%;
background-color: #008cd7;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #117bb9;
-webkit-box-shadow: 0 2px 0 0 #117bb9;
}
.container-fluid form a {
display: block;
color: #ffffff;
font-size: 16px;
}
.container-fluid form a span {
width: 30px;
height: 1px;
display: inline-block;
vertical-align: middle;
margin: 0 5px;
background-color: rgba(255, 255, 255, 0.4);
}
.container-fluid form a:active {
color: ;
}
.container-fluid form a:hover {
text-decoration: none;
}
.container-fluid form a.link-register {
margin-top: 100px;
}
@font-face {
font-family: 'iconfont';
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot');
src: url('http://at.alicdn.com/t/font_1439179733_4587424.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('http://at.alicdn.com/t/font_1439179733_4587424.woff') format('woff'), /* chrome、firefox */ url('http://at.alicdn.com/t/font_1439179733_4587424.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('http://at.alicdn.com/t/font_1439179733_4587424.svg#iconfont') format('svg');
/* IE9*/
/* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.modal .modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 280px;
height: 130px;
}
.modal .modal-dialog .modal-content {
color: #000000;
border: 0;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-top-left-radius: 8px;
-webkit-border-top-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
box-shadow: none;
-webkit-box-shadow: none;
}
.modal .modal-dialog .modal-content h4 {
font-size: 19px;
font-weight: bold;
margin: 0 20px;
padding-top: 15px;
}
.modal .modal-dialog .modal-content p {
font-size: 16px;
margin: 12px 20px 14px;
}
.modal .modal-dialog .modal-content .btn {
border-top-color: #cfd0d0;
background-color: transparent;
font-weight: bold;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.modal .modal-dialog .modal-content .btn:active {
box-shadow: none;
-webkit-box-shadow: none;
background-color: #e9e9e9;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
-webkit-border-bottom-left-radius: 8px;
-webkit-border-bottom-right-radius: 8px;
}
.modal .modal-dialog .modal-content .btn:focus {
outline: 0;
}
html,
body {
width: 100%;
height: 100%;
}
body {
user-select: none;
-webkit-user-select: none;
tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
color: #707070;
background-color: #f9f9f9;
}
.search {
width: 100%;
height: 54px;
padding: 10px 10px 10px 5px;
position: relative;
background-color: #008cd7;
}
.search .btn-group {
position: static;
}
.search .btn-group .btn {
color: #ffffff;
font-weight: bold;
}
.search .btn-group .btn .iconfont {
color: #ffffff;
font-size: 12px;
font-weight: normal;
margin-left: 5px;
}
.search .btn-group .btn .iconfont:after {
content: "\e601";
}
.search .btn-group.open .btn .iconfont:after {
content: "\e602";
}
.search .btn-group .dropdown-menu {
left: 0;
width: 100%;
height: 300px;
border: 0;
padding: 0;
margin-top: 1px;
overflow: hidden;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.search .btn-group .dropdown-menu a {
color: #000000;
margin: 0 10px;
padding: 20px;
display: block;
border-bottom: 1px solid;
}
.search .btn-group .dropdown-menu a:hover {
text-decoration: none;
}
.search .btn-group .dropdown-menu a.active {
color: #008cd7;
}
.search .btn-group .dropdown-menu .left-menu {
height: 100%;
overflow: hidden;
padding: 0;
background-color: #f9f9f9;
}
.search .btn-group .dropdown-menu .left-menu a {
margin: 0;
border-bottom-color: transparent;
}
.search .btn-group .dropdown-menu .left-menu a.active-bg {
background-color: #ffffff;
}
.search .btn-group .dropdown-menu .right-menu {
height: 100%;
overflow: hidden;
padding: 0;
}
.search .has-feedback {
width: 75%;
}
.search .has-feedback .form-control {
color: #b7b7b7;
border-color: #117bb9;
-webkit-appearance: none;
}
.search .has-feedback .form-control::-webkit-input-placeholder {
color: #b7b7b7;
}
.search .has-feedback .form-control-feedback {
top: 3px;
right: 3px;
width: 26px;
height: 26px;
line-height: 26px;
color: #ffffff;
background-color: #0bacd3;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
-webkit-border-top-left-radius: 4px;
-webkit-border-top-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-webkit-border-bottom-right-radius: 4px;
box-shadow: 0 2px 0 0 #088aa9;
-webkit-box-shadow: 0 2px 0 0 #088aa9;
pointer-events: auto;
}
.btn-group-justified {
width: 100%;
height: 45px;
position: relative;
box-sizing: content-box;
-webkit-box-sizing: content-box;
border-bottom: 1px solid #b7b7b7;
}
.btn-group-justified .btn-group {
position: static;
}
.btn-group-justified .btn-group .btn {
color: #000000;
font-weight: bold;
}
.btn-group-justified .btn-group .btn .iconfont {
color: #b7b7b7;
font-size: 12px;
font-weight: normal;
margin-left: 5px;
}
.btn-group-justified .btn-group .btn .iconfont:after {
content: "\e601";
}
.btn-group-justified .btn-group.open .btn .iconfont:after {
content: "\e602";
}
.btn-group-justified .btn-group .dropdown-menu {
left: 0;
width: 100%;
height: 300px;
border: 0;
padding: 0;
margin-top: 1px;
overflow: hidden;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
-webkit-border-top-left-radius: 0;
-webkit-border-top-right-radius: 0;
-webkit-border-bottom-left-radius: 0;
-webkit-border-bottom-right-radius: 0;
}
.btn-group-justified .btn-group .dropdown-menu a {
color: #000000;
margin: 0 10px;
padding: 20px;
display: block;
border-bottom: 1px solid;
}
.btn-group-justified .btn-group .dropdown-menu a:hover {
text-decoration: none;
}
.btn-group-justified .btn-group .dropdown-menu a.active {
color: #008cd7;
}
.btn-group-justified .btn-group .dropdown-menu .left-menu {
height: 100%;
overflow: hidden;
padding: 0;
background-color: #f9f9f9;
}
.btn-group-justified .btn-group .dropdown-menu .left-menu a {
margin: 0;
border-bottom-color: transparent;
}
.btn-group-justified .btn-group .dropdown-menu .left-menu a.active-bg {
background-color: #ffffff;
}
.btn-group-justified .btn-group .dropdown-menu .right-menu {
height: 100%;
overflow: hidden;
padding: 0;
}
.btn-group-justified .btn-group .btn {
padding: 2px 12px;
border-right-color: #b7b7b7;
}
.btn-group-justified .btn-group:last-child .btn {
border: 0;
}
#wrapper {
position: absolute;
z-index: 1;
top: 100px;
bottom: 0;
left: 0;
width: 100%;
overflow: hidden;
}
#wrapper #scroller {
padding-bottom: 45px;
}
#wrapper #scroller div {
width: 100%;
height: 121px;
padding: 15px 0;
border-bottom: 1px solid #b7b7b7;
}
#wrapper #scroller div p {
width: 140px;
height: 100%;
float: left;
padding: 0 10px;
margin-bottom: 0;
overflow: hidden;
}
#wrapper #scroller div p img {
height: 100%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
}
#wrapper #scroller div ul {
height: 100%;
padding-right: 10px;
margin-bottom: 0;
overflow: hidden;
zoom: 1;
position: relative;
color: #5a5a5a;
}
#wrapper #scroller div ul li {
line-height: 18px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#wrapper #scroller div ul li.multiLine_omit {
color: #000000;
font-weight: bold;
height: 36px;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
white-space: normal;
}
#wrapper #scroller div ul li .address {
color: #000000;
font-size: 22px;
font-weight: bold;
}
#wrapper #scroller div ul li:last-child {
position: absolute;
left: 0;
right: 10px;
bottom: 0;
}
#wrapper #scroller div ul li:last-child .label {
color: #ff0000;
font-size: 9px;
padding: 0 3px;
border: 1px solid #acacac;
vertical-align: bottom;
}
#wrapper #scroller div ul li:last-child span {
color: #000000;
}
#wrapper #scroller div ul li:last-child span em {
font-style: normal;
}
#wrapper #scroller div ul li:last-child span em:nth-child(1) {
color: #ff0000;
font-size: 22px;
font-weight: bold;
}
#wrapper #scroller div ul li:last-child span em:nth-child(2) {
font-size: 7px;
vertical-align: top;
}
.footer {
width: 100%;
height: 45px;
line-height: 45px;
color: #008cd7;
font-size: 22px;
font-weight: bold;
background-color: rgba(255, 255, 255, 0.9);
}
/*!
* @copyright &copy; Kartik Visweswaran, Krajee.com, 2013 - 2015
* @version 3.5.4
*
* A simple yet powerful JQuery star rating plugin that allows rendering
* fractional star ratings and supports Right to Left (RTL) input.
*
* For more JQuery/Bootstrap plugins and demos visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/.rating-loading{width:25px;height:25px;font-size:0;color:#fff;background:transparent url(../img/loading.gif) top left no-repeat;border:none}.rating-fa{font-family:FontAwesome;padding-left:1px}.rating-fa .rating-stars:before{padding-left:1px}.rating-gly{font-family:'Glyphicons Halflings'}.rating-gly-star{font-family:'Glyphicons Halflings';padding-left:2px}.rating-gly-star .rating-stars:before{padding-left:2px}.rating-lg .rating-gly-star,.rating-lg .rating-gly-star .rating-stars:before{padding-left:4px}.rating-xl .rating-gly-star,.rating-xl .rating-gly-star .rating-stars:before{padding-left:2px}.rating-active{cursor:default}.rating-disabled{cursor:not-allowed}.rating-uni{font-size:1.2em;margin-top:-5px}.rating-container{position:relative;vertical-align:middle;display:inline-block;color:#e3e3e3;overflow:hidden}.rating-container:before{content:attr(data-content)}.rating-container .rating-stars{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden;color:#fde16d;transition:all .25s ease-out;-o-transition:all .25s ease-out;-moz-transition:all .25s ease-out;-webkit-transition:all .25s ease-out}.rating-container .rating-stars:before{content:attr(data-content);text-shadow:0 0 1px rgba(0,0,0,.7)}.rating-container-rtl{position:relative;vertical-align:middle;display:inline-block;overflow:hidden;color:#fde16d}.rating-container-rtl:before{content:attr(data-content);text-shadow:0 0 1px rgba(0,0,0,.7)}.rating-container-rtl .rating-stars{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden;color:#e3e3e3;transition:all .25s ease-out;-o-transition:all .25s ease-out;-moz-transition:all .25s ease-out;-webkit-transition:all .25s ease-out}.rating-container-rtl .rating-stars:before{content:attr(data-content)}.rating-xl{font-size:4.89em}.rating-lg{font-size:3.91em}.rating-md{font-size:3.13em}.rating-sm{font-size:2.5em}.rating-xs{font-size:2em}.star-rating .clear-rating,.star-rating-rtl .clear-rating{color:#aaa;cursor:not-allowed;display:inline-block;vertical-align:middle;font-size:60%}.clear-rating-active{cursor:pointer!important}.clear-rating-active:hover{color:#843534}.star-rating .clear-rating{padding-right:5px}.star-rating .caption,.star-rating-rtl .caption{color:#999;display:inline-block;vertical-align:middle;font-size:55%}.star-rating .caption{padding-left:5px}.star-rating-rtl .caption{padding-right:5px}
\ No newline at end of file
<?php
class dao
{
//insert 预约看房
public static function insert_view_house($house_id, $user_id, $date, $index, $time, $consultant_id)
{
$insert_view_house_array = array(
'house_id' => $house_id,
'user_id' => $user_id,
'date' => $date,
'time_index' => $index,
'time' => $time,
'consultant_id' => $consultant_id,
'handle' => 0
);
global $wpdb;
$result = $wpdb->insert('view_house', $insert_view_house_array);
return $result;
}
public static function update_view_house($id)
{
global $wpdb;
$result = $wpdb->update('view_house', array(
'handle' => 1,
'handle_date' => current_time('Y-m-d H:i:s')
), array(
'id' => $id
));
return $result;
}
public static function update_view_house_consultant($house_id, $consultant_id)
{
global $wpdb;
$result = $wpdb->update('view_house', array(
'consultant_id' => $consultant_id
), array(
'id' => $house_id
));
return $result;
}
//search 预约看房 user_id
public static function search_view_house_by_user_id($user_id)
{
global $wpdb;
$sql = "select v.house_id,v.date,v.time,v.consultant_id,v.handle from view_house v where user_id = " . $user_id . " order by v.date desc";
return $wpdb->get_results($sql);
}
//search 预约看房 consultant_id
public static function search_view_house_by_consultant_id($consultant_id)
{
global $wpdb;
$sql = "select v.id,v.house_id,v.user_id,v.date,v.time,v.handle from view_house v where consultant_id = " . $consultant_id . " order by v.date desc";
return $wpdb->get_results($sql);
}
//insert 置业顾问评分
public static function insert_consultant_score($consultant_id, $user_id, $score, $valid = 1)
{
$insert_consultant_score_array = array(
'consultant_id' => $consultant_id,
'user_id' => $user_id,
'score' => $score,
'valid' => $valid
);
global $wpdb;
$result = $wpdb->insert('tospur_consultant_score', $insert_consultant_score_array);
return $result;
}
//search 置业顾问评分
public static function search_consultant_score($consultant_id)
{
global $wpdb;
$sql = "select sum(score)/count(score) as average_score from tospur_consultant_score where consultant_id = " . $consultant_id . " and valid = 1;";
return $wpdb->get_var($sql);
}
public static function update_consultant_score($score_id, $valid)
{
global $wpdb;
$result = $wpdb->update('tospur_consultant_score', array(
'valid' => $valid
), array(
'id' => $score_id
));
return $result;
}
public static function search_tospur_verify($phone, $code)
{
global $wpdb;
$sql = "select code from tospur_verify where phone = " . $phone . " and status = 0 " .
"and create_time > NOW() - INTERVAL 30 MINUTE " .
"order by create_time desc limit 1";
return $wpdb->get_var($sql);
}
public static function insert_tospur_verify($phone, $code)
{
$insert_tospur_verify_array = array(
'phone' => $phone,
'code' => $code,
'create_time' => current_time('Y-m-d H:i:s'),
'status' => 0
);
global $wpdb;
$result = $wpdb->insert('tospur_verify', $insert_tospur_verify_array);
return $result;
}
public static function update_tospur_verify($phone)
{
global $wpdb;
$wpdb->update('tospur_verify', array(
'status' => 1
), array(
'phone' => $phone
));
}
}
?>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*!
* Bootstrap v3.3.5 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under the MIT license
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.5",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.5",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),a(c.target).is('input[type="radio"]')||a(c.target).is('input[type="checkbox"]')||c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.5",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.5",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.5",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",c).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.5",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in"),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+e).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",a,b)};c.VERSION="3.3.5",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m<o.top?"bottom":"right"==h&&k.right+l>o.width?"left":"left"==h&&k.left-l<o.left?"right":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.5",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.5",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),
d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.5",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.5",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
\ No newline at end of file
function addEventHandler(oTarget, sEventType, fnHandler) {
if (oTarget.addEventListener) {
oTarget.addEventListener(sEventType, fnHandler, false);
} else if (oTarget.attachEvent) {
oTarget.attachEvent("on" + sEventType, fnHandler);
} else {
oTarget["on" + sEventType] = fnHandler;
}
}
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
};
var Extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
};
var DateSelector = Class.create();
DateSelector.prototype = {
initialize: function(oYear, oMonth, oDay, options) {
this.SelYear = document.getElementById(oYear);//年选择对象
this.SelMonth = document.getElementById(oMonth);//月选择对象
this.SelDay = document.getElementById(oDay);//日选择对象
this.SetOptions(options);
var dt = new Date(), iMonth = parseInt(this.options.Month), iDay = parseInt(this.options.Day), iMinYear = parseInt(this.options.MinYear), iMaxYear = parseInt(this.options.MaxYear);
this.Year = parseInt(this.options.Year) || dt.getFullYear();
this.Month = 1 <= iMonth && iMonth <= 12 ? iMonth : dt.getMonth() + 1;
this.Day = iDay > 0 ? iDay : dt.getDate();
this.MinYear = iMinYear && iMinYear < this.Year ? iMinYear : this.Year;
this.MaxYear = iMaxYear && iMaxYear > this.Year ? iMaxYear : this.Year;
this.onChange = this.options.onChange;
//年设置
this.SetSelect(this.SelYear, this.MinYear, this.MaxYear - this.MinYear + 1, this.Year - this.MinYear);
//月设置
this.SetSelect(this.SelMonth, 1, 12, this.Month - 1);
//日设置
this.SetDay();
var oThis = this;
//日期改变事件
addEventHandler(this.SelYear, "change", function(){
oThis.Year = oThis.SelYear.value; oThis.SetDay(); oThis.onChange();
});
addEventHandler(this.SelMonth, "change", function(){
oThis.Month = oThis.SelMonth.value; oThis.SetDay(); oThis.onChange();
});
addEventHandler(this.SelDay, "change", function(){ oThis.Day = oThis.SelDay.value; oThis.onChange(); });
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Year: 0,//年
Month: 0,//月
Day: 0,//日
MinYear: 0,//最小年份
MaxYear: 0,//最大年份
onChange: function(){}//日期改变时执行
};
Extend(this.options, options || {});
},
//日设置
SetDay: function() {
//取得月份天数
var daysInMonth = new Date(this.Year, this.Month, 0).getDate();
if (this.Day > daysInMonth) { this.Day = daysInMonth; }
this.SetSelect(this.SelDay, 1, daysInMonth, this.Day - 1);
},
//select设置
SetSelect: function(oSelect, iStart, iLength, iIndex) {
//添加option
oSelect.options.length = iLength;
for (var i = 0; i < iLength; i++) { oSelect.options[i].text = oSelect.options[i].value = iStart + i; }
//设置选中项
oSelect.selectedIndex = iIndex;
}
};
\ No newline at end of file
/*! iScroll v5.1.3 ~ (c) 2008-2014 Matteo Spinelli ~ http://cubiq.org/license */
(function (window, document, Math) {
var rAF = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) { window.setTimeout(callback, 1000 / 60); };
var utils = (function () {
var me = {};
var _elementStyle = document.createElement('div').style;
var _vendor = (function () {
var vendors = ['t', 'webkitT', 'MozT', 'msT', 'OT'],
transform,
i = 0,
l = vendors.length;
for ( ; i < l; i++ ) {
transform = vendors[i] + 'ransform';
if ( transform in _elementStyle ) return vendors[i].substr(0, vendors[i].length-1);
}
return false;
})();
function _prefixStyle (style) {
if ( _vendor === false ) return false;
if ( _vendor === '' ) return style;
return _vendor + style.charAt(0).toUpperCase() + style.substr(1);
}
me.getTime = Date.now || function getTime () { return new Date().getTime(); };
me.extend = function (target, obj) {
for ( var i in obj ) {
target[i] = obj[i];
}
};
me.addEvent = function (el, type, fn, capture) {
el.addEventListener(type, fn, !!capture);
};
me.removeEvent = function (el, type, fn, capture) {
el.removeEventListener(type, fn, !!capture);
};
me.prefixPointerEvent = function (pointerEvent) {
return window.MSPointerEvent ?
'MSPointer' + pointerEvent.charAt(9).toUpperCase() + pointerEvent.substr(10):
pointerEvent;
};
me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
var distance = current - start,
speed = Math.abs(distance) / time,
destination,
duration;
deceleration = deceleration === undefined ? 0.0006 : deceleration;
destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
duration = speed / deceleration;
if ( destination < lowerMargin ) {
destination = wrapperSize ? lowerMargin - ( wrapperSize / 2.5 * ( speed / 8 ) ) : lowerMargin;
distance = Math.abs(destination - current);
duration = distance / speed;
} else if ( destination > 0 ) {
destination = wrapperSize ? wrapperSize / 2.5 * ( speed / 8 ) : 0;
distance = Math.abs(current) + destination;
duration = distance / speed;
}
return {
destination: Math.round(destination),
duration: duration
};
};
var _transform = _prefixStyle('transform');
me.extend(me, {
hasTransform: _transform !== false,
hasPerspective: _prefixStyle('perspective') in _elementStyle,
hasTouch: 'ontouchstart' in window,
hasPointer: window.PointerEvent || window.MSPointerEvent, // IE10 is prefixed
hasTransition: _prefixStyle('transition') in _elementStyle
});
// This should find all Android browsers lower than build 535.19 (both stock browser and webview)
me.isBadAndroid = /Android /.test(window.navigator.appVersion) && !(/Chrome\/\d/.test(window.navigator.appVersion));
me.extend(me.style = {}, {
transform: _transform,
transitionTimingFunction: _prefixStyle('transitionTimingFunction'),
transitionDuration: _prefixStyle('transitionDuration'),
transitionDelay: _prefixStyle('transitionDelay'),
transformOrigin: _prefixStyle('transformOrigin')
});
me.hasClass = function (e, c) {
var re = new RegExp("(^|\\s)" + c + "(\\s|$)");
return re.test(e.className);
};
me.addClass = function (e, c) {
if ( me.hasClass(e, c) ) {
return;
}
var newclass = e.className.split(' ');
newclass.push(c);
e.className = newclass.join(' ');
};
me.removeClass = function (e, c) {
if ( !me.hasClass(e, c) ) {
return;
}
var re = new RegExp("(^|\\s)" + c + "(\\s|$)", 'g');
e.className = e.className.replace(re, ' ');
};
me.offset = function (el) {
var left = -el.offsetLeft,
top = -el.offsetTop;
// jshint -W084
while (el = el.offsetParent) {
left -= el.offsetLeft;
top -= el.offsetTop;
}
// jshint +W084
return {
left: left,
top: top
};
};
me.preventDefaultException = function (el, exceptions) {
for ( var i in exceptions ) {
if ( exceptions[i].test(el[i]) ) {
return true;
}
}
return false;
};
me.extend(me.eventType = {}, {
touchstart: 1,
touchmove: 1,
touchend: 1,
mousedown: 2,
mousemove: 2,
mouseup: 2,
pointerdown: 3,
pointermove: 3,
pointerup: 3,
MSPointerDown: 3,
MSPointerMove: 3,
MSPointerUp: 3
});
me.extend(me.ease = {}, {
quadratic: {
style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',
fn: function (k) {
return k * ( 2 - k );
}
},
circular: {
style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', // Not properly "circular" but this looks better, it should be (0.075, 0.82, 0.165, 1)
fn: function (k) {
return Math.sqrt( 1 - ( --k * k ) );
}
},
back: {
style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
fn: function (k) {
var b = 4;
return ( k = k - 1 ) * k * ( ( b + 1 ) * k + b ) + 1;
}
},
bounce: {
style: '',
fn: function (k) {
if ( ( k /= 1 ) < ( 1 / 2.75 ) ) {
return 7.5625 * k * k;
} else if ( k < ( 2 / 2.75 ) ) {
return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75;
} else if ( k < ( 2.5 / 2.75 ) ) {
return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375;
} else {
return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375;
}
}
},
elastic: {
style: '',
fn: function (k) {
var f = 0.22,
e = 0.4;
if ( k === 0 ) { return 0; }
if ( k == 1 ) { return 1; }
return ( e * Math.pow( 2, - 10 * k ) * Math.sin( ( k - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 );
}
}
});
me.tap = function (e, eventName) {
var ev = document.createEvent('Event');
ev.initEvent(eventName, true, true);
ev.pageX = e.pageX;
ev.pageY = e.pageY;
e.target.dispatchEvent(ev);
};
me.click = function (e) {
var target = e.target,
ev;
if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(target.tagName) ) {
ev = document.createEvent('MouseEvents');
ev.initMouseEvent('click', true, true, e.view, 1,
target.screenX, target.screenY, target.clientX, target.clientY,
e.ctrlKey, e.altKey, e.shiftKey, e.metaKey,
0, null);
ev._constructed = true;
target.dispatchEvent(ev);
}
};
return me;
})();
function IScroll (el, options) {
this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
this.scroller = this.wrapper.children[0];
this.scrollerStyle = this.scroller.style; // cache style for better performance
this.options = {
resizeScrollbars: true,
mouseWheelSpeed: 20,
snapThreshold: 0.334,
// INSERT POINT: OPTIONS
startX: 0,
startY: 0,
scrollY: true,
directionLockThreshold: 5,
momentum: true,
bounce: true,
bounceTime: 600,
bounceEasing: '',
preventDefault: true,
preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/ },
HWCompositing: true,
useTransition: true,
useTransform: true
};
for ( var i in options ) {
this.options[i] = options[i];
}
// Normalize options
this.translateZ = this.options.HWCompositing && utils.hasPerspective ? ' translateZ(0)' : '';
this.options.useTransition = utils.hasTransition && this.options.useTransition;
this.options.useTransform = utils.hasTransform && this.options.useTransform;
this.options.eventPassthrough = this.options.eventPassthrough === true ? 'vertical' : this.options.eventPassthrough;
this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault;
// If you want eventPassthrough I have to lock one of the axes
this.options.scrollY = this.options.eventPassthrough == 'vertical' ? false : this.options.scrollY;
this.options.scrollX = this.options.eventPassthrough == 'horizontal' ? false : this.options.scrollX;
// With eventPassthrough we also need lockDirection mechanism
this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
this.options.bounceEasing = typeof this.options.bounceEasing == 'string' ? utils.ease[this.options.bounceEasing] || utils.ease.circular : this.options.bounceEasing;
this.options.resizePolling = this.options.resizePolling === undefined ? 60 : this.options.resizePolling;
if ( this.options.tap === true ) {
this.options.tap = 'tap';
}
if ( this.options.shrinkScrollbars == 'scale' ) {
this.options.useTransition = false;
}
this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1;
// INSERT POINT: NORMALIZATION
// Some defaults
this.x = 0;
this.y = 0;
this.directionX = 0;
this.directionY = 0;
this._events = {};
// INSERT POINT: DEFAULTS
this._init();
this.refresh();
this.scrollTo(this.options.startX, this.options.startY);
this.enable();
}
IScroll.prototype = {
version: '5.1.3',
_init: function () {
this._initEvents();
if ( this.options.scrollbars || this.options.indicators ) {
this._initIndicators();
}
if ( this.options.mouseWheel ) {
this._initWheel();
}
if ( this.options.snap ) {
this._initSnap();
}
if ( this.options.keyBindings ) {
this._initKeys();
}
// INSERT POINT: _init
},
destroy: function () {
this._initEvents(true);
this._execEvent('destroy');
},
_transitionEnd: function (e) {
if ( e.target != this.scroller || !this.isInTransition ) {
return;
}
this._transitionTime();
if ( !this.resetPosition(this.options.bounceTime) ) {
this.isInTransition = false;
this._execEvent('scrollEnd');
}
},
_start: function (e) {
// React to left mouse button only
if ( utils.eventType[e.type] != 1 ) {
if ( e.button !== 0 ) {
return;
}
}
if ( !this.enabled || (this.initiated && utils.eventType[e.type] !== this.initiated) ) {
return;
}
if ( this.options.preventDefault && !utils.isBadAndroid && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
var point = e.touches ? e.touches[0] : e,
pos;
this.initiated = utils.eventType[e.type];
this.moved = false;
this.distX = 0;
this.distY = 0;
this.directionX = 0;
this.directionY = 0;
this.directionLocked = 0;
this._transitionTime();
this.startTime = utils.getTime();
if ( this.options.useTransition && this.isInTransition ) {
this.isInTransition = false;
pos = this.getComputedPosition();
this._translate(Math.round(pos.x), Math.round(pos.y));
this._execEvent('scrollEnd');
} else if ( !this.options.useTransition && this.isAnimating ) {
this.isAnimating = false;
this._execEvent('scrollEnd');
}
this.startX = this.x;
this.startY = this.y;
this.absStartX = this.x;
this.absStartY = this.y;
this.pointX = point.pageX;
this.pointY = point.pageY;
this._execEvent('beforeScrollStart');
},
_move: function (e) {
if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
return;
}
if ( this.options.preventDefault ) { // increases performance on Android? TODO: check!
e.preventDefault();
}
var point = e.touches ? e.touches[0] : e,
deltaX = point.pageX - this.pointX,
deltaY = point.pageY - this.pointY,
timestamp = utils.getTime(),
newX, newY,
absDistX, absDistY;
this.pointX = point.pageX;
this.pointY = point.pageY;
this.distX += deltaX;
this.distY += deltaY;
absDistX = Math.abs(this.distX);
absDistY = Math.abs(this.distY);
// We need to move at least 10 pixels for the scrolling to initiate
if ( timestamp - this.endTime > 300 && (absDistX < 10 && absDistY < 10) ) {
return;
}
// If you are scrolling in one direction lock the other
if ( !this.directionLocked && !this.options.freeScroll ) {
if ( absDistX > absDistY + this.options.directionLockThreshold ) {
this.directionLocked = 'h'; // lock horizontally
} else if ( absDistY >= absDistX + this.options.directionLockThreshold ) {
this.directionLocked = 'v'; // lock vertically
} else {
this.directionLocked = 'n'; // no lock
}
}
if ( this.directionLocked == 'h' ) {
if ( this.options.eventPassthrough == 'vertical' ) {
e.preventDefault();
} else if ( this.options.eventPassthrough == 'horizontal' ) {
this.initiated = false;
return;
}
deltaY = 0;
} else if ( this.directionLocked == 'v' ) {
if ( this.options.eventPassthrough == 'horizontal' ) {
e.preventDefault();
} else if ( this.options.eventPassthrough == 'vertical' ) {
this.initiated = false;
return;
}
deltaX = 0;
}
deltaX = this.hasHorizontalScroll ? deltaX : 0;
deltaY = this.hasVerticalScroll ? deltaY : 0;
newX = this.x + deltaX;
newY = this.y + deltaY;
// Slow down if outside of the boundaries
if ( newX > 0 || newX < this.maxScrollX ) {
newX = this.options.bounce ? this.x + deltaX / 3 : newX > 0 ? 0 : this.maxScrollX;
}
if ( newY > 0 || newY < this.maxScrollY ) {
newY = this.options.bounce ? this.y + deltaY / 3 : newY > 0 ? 0 : this.maxScrollY;
}
this.directionX = deltaX > 0 ? -1 : deltaX < 0 ? 1 : 0;
this.directionY = deltaY > 0 ? -1 : deltaY < 0 ? 1 : 0;
if ( !this.moved ) {
this._execEvent('scrollStart');
}
this.moved = true;
this._translate(newX, newY);
/* REPLACE START: _move */
if ( timestamp - this.startTime > 300 ) {
this.startTime = timestamp;
this.startX = this.x;
this.startY = this.y;
}
/* REPLACE END: _move */
},
_end: function (e) {
if ( !this.enabled || utils.eventType[e.type] !== this.initiated ) {
return;
}
if ( this.options.preventDefault && !utils.preventDefaultException(e.target, this.options.preventDefaultException) ) {
e.preventDefault();
}
var point = e.changedTouches ? e.changedTouches[0] : e,
momentumX,
momentumY,
duration = utils.getTime() - this.startTime,
newX = Math.round(this.x),
newY = Math.round(this.y),
distanceX = Math.abs(newX - this.startX),
distanceY = Math.abs(newY - this.startY),
time = 0,
easing = '';
this.isInTransition = 0;
this.initiated = 0;
this.endTime = utils.getTime();
// reset if we are outside of the boundaries
if ( this.resetPosition(this.options.bounceTime) ) {
return;
}
this.scrollTo(newX, newY); // ensures that the last position is rounded
// we scrolled less than 10 pixels
if ( !this.moved ) {
if ( this.options.tap ) {
utils.tap(e, this.options.tap);
}
if ( this.options.click ) {
utils.click(e);
}
this._execEvent('scrollCancel');
return;
}
if ( this._events.flick && duration < 200 && distanceX < 100 && distanceY < 100 ) {
this._execEvent('flick');
return;
}
// start momentum animation if needed
if ( this.options.momentum && duration < 300 ) {
momentumX = this.hasHorizontalScroll ? utils.momentum(this.x, this.startX, duration, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : { destination: newX, duration: 0 };
momentumY = this.hasVerticalScroll ? utils.momentum(this.y, this.startY, duration, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : { destination: newY, duration: 0 };
newX = momentumX.destination;
newY = momentumY.destination;
time = Math.max(momentumX.duration, momentumY.duration);
this.isInTransition = 1;
}
if ( this.options.snap ) {
var snap = this._nearestSnap(newX, newY);
this.currentPage = snap;
time = this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(newX - snap.x), 1000),
Math.min(Math.abs(newY - snap.y), 1000)
), 300);
newX = snap.x;
newY = snap.y;
this.directionX = 0;
this.directionY = 0;
easing = this.options.bounceEasing;
}
// INSERT POINT: _end
if ( newX != this.x || newY != this.y ) {
// change easing function when scroller goes out of the boundaries
if ( newX > 0 || newX < this.maxScrollX || newY > 0 || newY < this.maxScrollY ) {
easing = utils.ease.quadratic;
}
this.scrollTo(newX, newY, time, easing);
return;
}
this._execEvent('scrollEnd');
},
_resize: function () {
var that = this;
clearTimeout(this.resizeTimeout);
this.resizeTimeout = setTimeout(function () {
that.refresh();
}, this.options.resizePolling);
},
resetPosition: function (time) {
var x = this.x,
y = this.y;
time = time || 0;
if ( !this.hasHorizontalScroll || this.x > 0 ) {
x = 0;
} else if ( this.x < this.maxScrollX ) {
x = this.maxScrollX;
}
if ( !this.hasVerticalScroll || this.y > 0 ) {
y = 0;
} else if ( this.y < this.maxScrollY ) {
y = this.maxScrollY;
}
if ( x == this.x && y == this.y ) {
return false;
}
this.scrollTo(x, y, time, this.options.bounceEasing);
return true;
},
disable: function () {
this.enabled = false;
},
enable: function () {
this.enabled = true;
},
refresh: function () {
var rf = this.wrapper.offsetHeight; // Force reflow
this.wrapperWidth = this.wrapper.clientWidth;
this.wrapperHeight = this.wrapper.clientHeight;
/* REPLACE START: refresh */
this.scrollerWidth = this.scroller.offsetWidth;
this.scrollerHeight = this.scroller.offsetHeight;
this.maxScrollX = this.wrapperWidth - this.scrollerWidth;
this.maxScrollY = this.wrapperHeight - this.scrollerHeight;
/* REPLACE END: refresh */
this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0;
this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0;
if ( !this.hasHorizontalScroll ) {
this.maxScrollX = 0;
this.scrollerWidth = this.wrapperWidth;
}
if ( !this.hasVerticalScroll ) {
this.maxScrollY = 0;
this.scrollerHeight = this.wrapperHeight;
}
this.endTime = 0;
this.directionX = 0;
this.directionY = 0;
this.wrapperOffset = utils.offset(this.wrapper);
this._execEvent('refresh');
this.resetPosition();
// INSERT POINT: _refresh
},
on: function (type, fn) {
if ( !this._events[type] ) {
this._events[type] = [];
}
this._events[type].push(fn);
},
off: function (type, fn) {
if ( !this._events[type] ) {
return;
}
var index = this._events[type].indexOf(fn);
if ( index > -1 ) {
this._events[type].splice(index, 1);
}
},
_execEvent: function (type) {
if ( !this._events[type] ) {
return;
}
var i = 0,
l = this._events[type].length;
if ( !l ) {
return;
}
for ( ; i < l; i++ ) {
this._events[type][i].apply(this, [].slice.call(arguments, 1));
}
},
scrollBy: function (x, y, time, easing) {
x = this.x + x;
y = this.y + y;
time = time || 0;
this.scrollTo(x, y, time, easing);
},
scrollTo: function (x, y, time, easing) {
easing = easing || utils.ease.circular;
this.isInTransition = this.options.useTransition && time > 0;
if ( !time || (this.options.useTransition && easing.style) ) {
this._transitionTimingFunction(easing.style);
this._transitionTime(time);
this._translate(x, y);
} else {
this._animate(x, y, time, easing.fn);
}
},
scrollToElement: function (el, time, offsetX, offsetY, easing) {
el = el.nodeType ? el : this.scroller.querySelector(el);
if ( !el ) {
return;
}
var pos = utils.offset(el);
pos.left -= this.wrapperOffset.left;
pos.top -= this.wrapperOffset.top;
// if offsetX/Y are true we center the element to the screen
if ( offsetX === true ) {
offsetX = Math.round(el.offsetWidth / 2 - this.wrapper.offsetWidth / 2);
}
if ( offsetY === true ) {
offsetY = Math.round(el.offsetHeight / 2 - this.wrapper.offsetHeight / 2);
}
pos.left -= offsetX || 0;
pos.top -= offsetY || 0;
pos.left = pos.left > 0 ? 0 : pos.left < this.maxScrollX ? this.maxScrollX : pos.left;
pos.top = pos.top > 0 ? 0 : pos.top < this.maxScrollY ? this.maxScrollY : pos.top;
time = time === undefined || time === null || time === 'auto' ? Math.max(Math.abs(this.x-pos.left), Math.abs(this.y-pos.top)) : time;
this.scrollTo(pos.left, pos.top, time, easing);
},
_transitionTime: function (time) {
time = time || 0;
this.scrollerStyle[utils.style.transitionDuration] = time + 'ms';
if ( !time && utils.isBadAndroid ) {
this.scrollerStyle[utils.style.transitionDuration] = '0.001s';
}
if ( this.indicators ) {
for ( var i = this.indicators.length; i--; ) {
this.indicators[i].transitionTime(time);
}
}
// INSERT POINT: _transitionTime
},
_transitionTimingFunction: function (easing) {
this.scrollerStyle[utils.style.transitionTimingFunction] = easing;
if ( this.indicators ) {
for ( var i = this.indicators.length; i--; ) {
this.indicators[i].transitionTimingFunction(easing);
}
}
// INSERT POINT: _transitionTimingFunction
},
_translate: function (x, y) {
if ( this.options.useTransform ) {
/* REPLACE START: _translate */
this.scrollerStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.translateZ;
/* REPLACE END: _translate */
} else {
x = Math.round(x);
y = Math.round(y);
this.scrollerStyle.left = x + 'px';
this.scrollerStyle.top = y + 'px';
}
this.x = x;
this.y = y;
if ( this.indicators ) {
for ( var i = this.indicators.length; i--; ) {
this.indicators[i].updatePosition();
}
}
// INSERT POINT: _translate
},
_initEvents: function (remove) {
var eventType = remove ? utils.removeEvent : utils.addEvent,
target = this.options.bindToWrapper ? this.wrapper : window;
eventType(window, 'orientationchange', this);
eventType(window, 'resize', this);
if ( this.options.click ) {
eventType(this.wrapper, 'click', this, true);
}
if ( !this.options.disableMouse ) {
eventType(this.wrapper, 'mousedown', this);
eventType(target, 'mousemove', this);
eventType(target, 'mousecancel', this);
eventType(target, 'mouseup', this);
}
if ( utils.hasPointer && !this.options.disablePointer ) {
eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this);
eventType(target, utils.prefixPointerEvent('pointermove'), this);
eventType(target, utils.prefixPointerEvent('pointercancel'), this);
eventType(target, utils.prefixPointerEvent('pointerup'), this);
}
if ( utils.hasTouch && !this.options.disableTouch ) {
eventType(this.wrapper, 'touchstart', this);
eventType(target, 'touchmove', this);
eventType(target, 'touchcancel', this);
eventType(target, 'touchend', this);
}
eventType(this.scroller, 'transitionend', this);
eventType(this.scroller, 'webkitTransitionEnd', this);
eventType(this.scroller, 'oTransitionEnd', this);
eventType(this.scroller, 'MSTransitionEnd', this);
},
getComputedPosition: function () {
var matrix = window.getComputedStyle(this.scroller, null),
x, y;
if ( this.options.useTransform ) {
matrix = matrix[utils.style.transform].split(')')[0].split(', ');
x = +(matrix[12] || matrix[4]);
y = +(matrix[13] || matrix[5]);
} else {
x = +matrix.left.replace(/[^-\d.]/g, '');
y = +matrix.top.replace(/[^-\d.]/g, '');
}
return { x: x, y: y };
},
_initIndicators: function () {
var interactive = this.options.interactiveScrollbars,
customStyle = typeof this.options.scrollbars != 'string',
indicators = [],
indicator;
var that = this;
this.indicators = [];
if ( this.options.scrollbars ) {
// Vertical scrollbar
if ( this.options.scrollY ) {
indicator = {
el: createDefaultScrollbar('v', interactive, this.options.scrollbars),
interactive: interactive,
defaultScrollbars: true,
customStyle: customStyle,
resize: this.options.resizeScrollbars,
shrink: this.options.shrinkScrollbars,
fade: this.options.fadeScrollbars,
listenX: false
};
this.wrapper.appendChild(indicator.el);
indicators.push(indicator);
}
// Horizontal scrollbar
if ( this.options.scrollX ) {
indicator = {
el: createDefaultScrollbar('h', interactive, this.options.scrollbars),
interactive: interactive,
defaultScrollbars: true,
customStyle: customStyle,
resize: this.options.resizeScrollbars,
shrink: this.options.shrinkScrollbars,
fade: this.options.fadeScrollbars,
listenY: false
};
this.wrapper.appendChild(indicator.el);
indicators.push(indicator);
}
}
if ( this.options.indicators ) {
// TODO: check concat compatibility
indicators = indicators.concat(this.options.indicators);
}
for ( var i = indicators.length; i--; ) {
this.indicators.push( new Indicator(this, indicators[i]) );
}
// TODO: check if we can use array.map (wide compatibility and performance issues)
function _indicatorsMap (fn) {
for ( var i = that.indicators.length; i--; ) {
fn.call(that.indicators[i]);
}
}
if ( this.options.fadeScrollbars ) {
this.on('scrollEnd', function () {
_indicatorsMap(function () {
this.fade();
});
});
this.on('scrollCancel', function () {
_indicatorsMap(function () {
this.fade();
});
});
this.on('scrollStart', function () {
_indicatorsMap(function () {
this.fade(1);
});
});
this.on('beforeScrollStart', function () {
_indicatorsMap(function () {
this.fade(1, true);
});
});
}
this.on('refresh', function () {
_indicatorsMap(function () {
this.refresh();
});
});
this.on('destroy', function () {
_indicatorsMap(function () {
this.destroy();
});
delete this.indicators;
});
},
_initWheel: function () {
utils.addEvent(this.wrapper, 'wheel', this);
utils.addEvent(this.wrapper, 'mousewheel', this);
utils.addEvent(this.wrapper, 'DOMMouseScroll', this);
this.on('destroy', function () {
utils.removeEvent(this.wrapper, 'wheel', this);
utils.removeEvent(this.wrapper, 'mousewheel', this);
utils.removeEvent(this.wrapper, 'DOMMouseScroll', this);
});
},
_wheel: function (e) {
if ( !this.enabled ) {
return;
}
e.preventDefault();
e.stopPropagation();
var wheelDeltaX, wheelDeltaY,
newX, newY,
that = this;
if ( this.wheelTimeout === undefined ) {
that._execEvent('scrollStart');
}
// Execute the scrollEnd event after 400ms the wheel stopped scrolling
clearTimeout(this.wheelTimeout);
this.wheelTimeout = setTimeout(function () {
that._execEvent('scrollEnd');
that.wheelTimeout = undefined;
}, 400);
if ( 'deltaX' in e ) {
if (e.deltaMode === 1) {
wheelDeltaX = -e.deltaX * this.options.mouseWheelSpeed;
wheelDeltaY = -e.deltaY * this.options.mouseWheelSpeed;
} else {
wheelDeltaX = -e.deltaX;
wheelDeltaY = -e.deltaY;
}
} else if ( 'wheelDeltaX' in e ) {
wheelDeltaX = e.wheelDeltaX / 120 * this.options.mouseWheelSpeed;
wheelDeltaY = e.wheelDeltaY / 120 * this.options.mouseWheelSpeed;
} else if ( 'wheelDelta' in e ) {
wheelDeltaX = wheelDeltaY = e.wheelDelta / 120 * this.options.mouseWheelSpeed;
} else if ( 'detail' in e ) {
wheelDeltaX = wheelDeltaY = -e.detail / 3 * this.options.mouseWheelSpeed;
} else {
return;
}
wheelDeltaX *= this.options.invertWheelDirection;
wheelDeltaY *= this.options.invertWheelDirection;
if ( !this.hasVerticalScroll ) {
wheelDeltaX = wheelDeltaY;
wheelDeltaY = 0;
}
if ( this.options.snap ) {
newX = this.currentPage.pageX;
newY = this.currentPage.pageY;
if ( wheelDeltaX > 0 ) {
newX--;
} else if ( wheelDeltaX < 0 ) {
newX++;
}
if ( wheelDeltaY > 0 ) {
newY--;
} else if ( wheelDeltaY < 0 ) {
newY++;
}
this.goToPage(newX, newY);
return;
}
newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0);
newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0);
if ( newX > 0 ) {
newX = 0;
} else if ( newX < this.maxScrollX ) {
newX = this.maxScrollX;
}
if ( newY > 0 ) {
newY = 0;
} else if ( newY < this.maxScrollY ) {
newY = this.maxScrollY;
}
this.scrollTo(newX, newY, 0);
// INSERT POINT: _wheel
},
_initSnap: function () {
this.currentPage = {};
if ( typeof this.options.snap == 'string' ) {
this.options.snap = this.scroller.querySelectorAll(this.options.snap);
}
this.on('refresh', function () {
var i = 0, l,
m = 0, n,
cx, cy,
x = 0, y,
stepX = this.options.snapStepX || this.wrapperWidth,
stepY = this.options.snapStepY || this.wrapperHeight,
el;
this.pages = [];
if ( !this.wrapperWidth || !this.wrapperHeight || !this.scrollerWidth || !this.scrollerHeight ) {
return;
}
if ( this.options.snap === true ) {
cx = Math.round( stepX / 2 );
cy = Math.round( stepY / 2 );
while ( x > -this.scrollerWidth ) {
this.pages[i] = [];
l = 0;
y = 0;
while ( y > -this.scrollerHeight ) {
this.pages[i][l] = {
x: Math.max(x, this.maxScrollX),
y: Math.max(y, this.maxScrollY),
width: stepX,
height: stepY,
cx: x - cx,
cy: y - cy
};
y -= stepY;
l++;
}
x -= stepX;
i++;
}
} else {
el = this.options.snap;
l = el.length;
n = -1;
for ( ; i < l; i++ ) {
if ( i === 0 || el[i].offsetLeft <= el[i-1].offsetLeft ) {
m = 0;
n++;
}
if ( !this.pages[m] ) {
this.pages[m] = [];
}
x = Math.max(-el[i].offsetLeft, this.maxScrollX);
y = Math.max(-el[i].offsetTop, this.maxScrollY);
cx = x - Math.round(el[i].offsetWidth / 2);
cy = y - Math.round(el[i].offsetHeight / 2);
this.pages[m][n] = {
x: x,
y: y,
width: el[i].offsetWidth,
height: el[i].offsetHeight,
cx: cx,
cy: cy
};
if ( x > this.maxScrollX ) {
m++;
}
}
}
this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0);
// Update snap threshold if needed
if ( this.options.snapThreshold % 1 === 0 ) {
this.snapThresholdX = this.options.snapThreshold;
this.snapThresholdY = this.options.snapThreshold;
} else {
this.snapThresholdX = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold);
this.snapThresholdY = Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold);
}
});
this.on('flick', function () {
var time = this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(this.x - this.startX), 1000),
Math.min(Math.abs(this.y - this.startY), 1000)
), 300);
this.goToPage(
this.currentPage.pageX + this.directionX,
this.currentPage.pageY + this.directionY,
time
);
});
},
_nearestSnap: function (x, y) {
if ( !this.pages.length ) {
return { x: 0, y: 0, pageX: 0, pageY: 0 };
}
var i = 0,
l = this.pages.length,
m = 0;
// Check if we exceeded the snap threshold
if ( Math.abs(x - this.absStartX) < this.snapThresholdX &&
Math.abs(y - this.absStartY) < this.snapThresholdY ) {
return this.currentPage;
}
if ( x > 0 ) {
x = 0;
} else if ( x < this.maxScrollX ) {
x = this.maxScrollX;
}
if ( y > 0 ) {
y = 0;
} else if ( y < this.maxScrollY ) {
y = this.maxScrollY;
}
for ( ; i < l; i++ ) {
if ( x >= this.pages[i][0].cx ) {
x = this.pages[i][0].x;
break;
}
}
l = this.pages[i].length;
for ( ; m < l; m++ ) {
if ( y >= this.pages[0][m].cy ) {
y = this.pages[0][m].y;
break;
}
}
if ( i == this.currentPage.pageX ) {
i += this.directionX;
if ( i < 0 ) {
i = 0;
} else if ( i >= this.pages.length ) {
i = this.pages.length - 1;
}
x = this.pages[i][0].x;
}
if ( m == this.currentPage.pageY ) {
m += this.directionY;
if ( m < 0 ) {
m = 0;
} else if ( m >= this.pages[0].length ) {
m = this.pages[0].length - 1;
}
y = this.pages[0][m].y;
}
return {
x: x,
y: y,
pageX: i,
pageY: m
};
},
goToPage: function (x, y, time, easing) {
easing = easing || this.options.bounceEasing;
if ( x >= this.pages.length ) {
x = this.pages.length - 1;
} else if ( x < 0 ) {
x = 0;
}
if ( y >= this.pages[x].length ) {
y = this.pages[x].length - 1;
} else if ( y < 0 ) {
y = 0;
}
var posX = this.pages[x][y].x,
posY = this.pages[x][y].y;
time = time === undefined ? this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(posX - this.x), 1000),
Math.min(Math.abs(posY - this.y), 1000)
), 300) : time;
this.currentPage = {
x: posX,
y: posY,
pageX: x,
pageY: y
};
this.scrollTo(posX, posY, time, easing);
},
next: function (time, easing) {
var x = this.currentPage.pageX,
y = this.currentPage.pageY;
x++;
if ( x >= this.pages.length && this.hasVerticalScroll ) {
x = 0;
y++;
}
this.goToPage(x, y, time, easing);
},
prev: function (time, easing) {
var x = this.currentPage.pageX,
y = this.currentPage.pageY;
x--;
if ( x < 0 && this.hasVerticalScroll ) {
x = 0;
y--;
}
this.goToPage(x, y, time, easing);
},
_initKeys: function (e) {
// default key bindings
var keys = {
pageUp: 33,
pageDown: 34,
end: 35,
home: 36,
left: 37,
up: 38,
right: 39,
down: 40
};
var i;
// if you give me characters I give you keycode
if ( typeof this.options.keyBindings == 'object' ) {
for ( i in this.options.keyBindings ) {
if ( typeof this.options.keyBindings[i] == 'string' ) {
this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0);
}
}
} else {
this.options.keyBindings = {};
}
for ( i in keys ) {
this.options.keyBindings[i] = this.options.keyBindings[i] || keys[i];
}
utils.addEvent(window, 'keydown', this);
this.on('destroy', function () {
utils.removeEvent(window, 'keydown', this);
});
},
_key: function (e) {
if ( !this.enabled ) {
return;
}
var snap = this.options.snap, // we are using this alot, better to cache it
newX = snap ? this.currentPage.pageX : this.x,
newY = snap ? this.currentPage.pageY : this.y,
now = utils.getTime(),
prevTime = this.keyTime || 0,
acceleration = 0.250,
pos;
if ( this.options.useTransition && this.isInTransition ) {
pos = this.getComputedPosition();
this._translate(Math.round(pos.x), Math.round(pos.y));
this.isInTransition = false;
}
this.keyAcceleration = now - prevTime < 200 ? Math.min(this.keyAcceleration + acceleration, 50) : 0;
switch ( e.keyCode ) {
case this.options.keyBindings.pageUp:
if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
newX += snap ? 1 : this.wrapperWidth;
} else {
newY += snap ? 1 : this.wrapperHeight;
}
break;
case this.options.keyBindings.pageDown:
if ( this.hasHorizontalScroll && !this.hasVerticalScroll ) {
newX -= snap ? 1 : this.wrapperWidth;
} else {
newY -= snap ? 1 : this.wrapperHeight;
}
break;
case this.options.keyBindings.end:
newX = snap ? this.pages.length-1 : this.maxScrollX;
newY = snap ? this.pages[0].length-1 : this.maxScrollY;
break;
case this.options.keyBindings.home:
newX = 0;
newY = 0;
break;
case this.options.keyBindings.left:
newX += snap ? -1 : 5 + this.keyAcceleration>>0;
break;
case this.options.keyBindings.up:
newY += snap ? 1 : 5 + this.keyAcceleration>>0;
break;
case this.options.keyBindings.right:
newX -= snap ? -1 : 5 + this.keyAcceleration>>0;
break;
case this.options.keyBindings.down:
newY -= snap ? 1 : 5 + this.keyAcceleration>>0;
break;
default:
return;
}
if ( snap ) {
this.goToPage(newX, newY);
return;
}
if ( newX > 0 ) {
newX = 0;
this.keyAcceleration = 0;
} else if ( newX < this.maxScrollX ) {
newX = this.maxScrollX;
this.keyAcceleration = 0;
}
if ( newY > 0 ) {
newY = 0;
this.keyAcceleration = 0;
} else if ( newY < this.maxScrollY ) {
newY = this.maxScrollY;
this.keyAcceleration = 0;
}
this.scrollTo(newX, newY, 0);
this.keyTime = now;
},
_animate: function (destX, destY, duration, easingFn) {
var that = this,
startX = this.x,
startY = this.y,
startTime = utils.getTime(),
destTime = startTime + duration;
function step () {
var now = utils.getTime(),
newX, newY,
easing;
if ( now >= destTime ) {
that.isAnimating = false;
that._translate(destX, destY);
if ( !that.resetPosition(that.options.bounceTime) ) {
that._execEvent('scrollEnd');
}
return;
}
now = ( now - startTime ) / duration;
easing = easingFn(now);
newX = ( destX - startX ) * easing + startX;
newY = ( destY - startY ) * easing + startY;
that._translate(newX, newY);
if ( that.isAnimating ) {
rAF(step);
}
}
this.isAnimating = true;
step();
},
handleEvent: function (e) {
switch ( e.type ) {
case 'touchstart':
case 'pointerdown':
case 'MSPointerDown':
case 'mousedown':
this._start(e);
break;
case 'touchmove':
case 'pointermove':
case 'MSPointerMove':
case 'mousemove':
this._move(e);
break;
case 'touchend':
case 'pointerup':
case 'MSPointerUp':
case 'mouseup':
case 'touchcancel':
case 'pointercancel':
case 'MSPointerCancel':
case 'mousecancel':
this._end(e);
break;
case 'orientationchange':
case 'resize':
this._resize();
break;
case 'transitionend':
case 'webkitTransitionEnd':
case 'oTransitionEnd':
case 'MSTransitionEnd':
this._transitionEnd(e);
break;
case 'wheel':
case 'DOMMouseScroll':
case 'mousewheel':
this._wheel(e);
break;
case 'keydown':
this._key(e);
break;
case 'click':
if ( !e._constructed ) {
e.preventDefault();
e.stopPropagation();
}
break;
}
}
};
function createDefaultScrollbar (direction, interactive, type) {
var scrollbar = document.createElement('div'),
indicator = document.createElement('div');
if ( type === true ) {
scrollbar.style.cssText = 'position:absolute;z-index:9999';
indicator.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px';
}
indicator.className = 'iScrollIndicator';
if ( direction == 'h' ) {
if ( type === true ) {
scrollbar.style.cssText += ';height:7px;left:2px;right:2px;bottom:0';
indicator.style.height = '100%';
}
scrollbar.className = 'iScrollHorizontalScrollbar';
} else {
if ( type === true ) {
scrollbar.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px';
indicator.style.width = '100%';
}
scrollbar.className = 'iScrollVerticalScrollbar';
}
scrollbar.style.cssText += ';overflow:hidden';
if ( !interactive ) {
scrollbar.style.pointerEvents = 'none';
}
scrollbar.appendChild(indicator);
return scrollbar;
}
function Indicator (scroller, options) {
this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el;
this.wrapperStyle = this.wrapper.style;
this.indicator = this.wrapper.children[0];
this.indicatorStyle = this.indicator.style;
this.scroller = scroller;
this.options = {
listenX: true,
listenY: true,
interactive: false,
resize: true,
defaultScrollbars: false,
shrink: false,
fade: false,
speedRatioX: 0,
speedRatioY: 0
};
for ( var i in options ) {
this.options[i] = options[i];
}
this.sizeRatioX = 1;
this.sizeRatioY = 1;
this.maxPosX = 0;
this.maxPosY = 0;
if ( this.options.interactive ) {
if ( !this.options.disableTouch ) {
utils.addEvent(this.indicator, 'touchstart', this);
utils.addEvent(window, 'touchend', this);
}
if ( !this.options.disablePointer ) {
utils.addEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
utils.addEvent(window, utils.prefixPointerEvent('pointerup'), this);
}
if ( !this.options.disableMouse ) {
utils.addEvent(this.indicator, 'mousedown', this);
utils.addEvent(window, 'mouseup', this);
}
}
if ( this.options.fade ) {
this.wrapperStyle[utils.style.transform] = this.scroller.translateZ;
this.wrapperStyle[utils.style.transitionDuration] = utils.isBadAndroid ? '0.001s' : '0ms';
this.wrapperStyle.opacity = '0';
}
}
Indicator.prototype = {
handleEvent: function (e) {
switch ( e.type ) {
case 'touchstart':
case 'pointerdown':
case 'MSPointerDown':
case 'mousedown':
this._start(e);
break;
case 'touchmove':
case 'pointermove':
case 'MSPointerMove':
case 'mousemove':
this._move(e);
break;
case 'touchend':
case 'pointerup':
case 'MSPointerUp':
case 'mouseup':
case 'touchcancel':
case 'pointercancel':
case 'MSPointerCancel':
case 'mousecancel':
this._end(e);
break;
}
},
destroy: function () {
if ( this.options.interactive ) {
utils.removeEvent(this.indicator, 'touchstart', this);
utils.removeEvent(this.indicator, utils.prefixPointerEvent('pointerdown'), this);
utils.removeEvent(this.indicator, 'mousedown', this);
utils.removeEvent(window, 'touchmove', this);
utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
utils.removeEvent(window, 'mousemove', this);
utils.removeEvent(window, 'touchend', this);
utils.removeEvent(window, utils.prefixPointerEvent('pointerup'), this);
utils.removeEvent(window, 'mouseup', this);
}
if ( this.options.defaultScrollbars ) {
this.wrapper.parentNode.removeChild(this.wrapper);
}
},
_start: function (e) {
var point = e.touches ? e.touches[0] : e;
e.preventDefault();
e.stopPropagation();
this.transitionTime();
this.initiated = true;
this.moved = false;
this.lastPointX = point.pageX;
this.lastPointY = point.pageY;
this.startTime = utils.getTime();
if ( !this.options.disableTouch ) {
utils.addEvent(window, 'touchmove', this);
}
if ( !this.options.disablePointer ) {
utils.addEvent(window, utils.prefixPointerEvent('pointermove'), this);
}
if ( !this.options.disableMouse ) {
utils.addEvent(window, 'mousemove', this);
}
this.scroller._execEvent('beforeScrollStart');
},
_move: function (e) {
var point = e.touches ? e.touches[0] : e,
deltaX, deltaY,
newX, newY,
timestamp = utils.getTime();
if ( !this.moved ) {
this.scroller._execEvent('scrollStart');
}
this.moved = true;
deltaX = point.pageX - this.lastPointX;
this.lastPointX = point.pageX;
deltaY = point.pageY - this.lastPointY;
this.lastPointY = point.pageY;
newX = this.x + deltaX;
newY = this.y + deltaY;
this._pos(newX, newY);
// INSERT POINT: indicator._move
e.preventDefault();
e.stopPropagation();
},
_end: function (e) {
if ( !this.initiated ) {
return;
}
this.initiated = false;
e.preventDefault();
e.stopPropagation();
utils.removeEvent(window, 'touchmove', this);
utils.removeEvent(window, utils.prefixPointerEvent('pointermove'), this);
utils.removeEvent(window, 'mousemove', this);
if ( this.scroller.options.snap ) {
var snap = this.scroller._nearestSnap(this.scroller.x, this.scroller.y);
var time = this.options.snapSpeed || Math.max(
Math.max(
Math.min(Math.abs(this.scroller.x - snap.x), 1000),
Math.min(Math.abs(this.scroller.y - snap.y), 1000)
), 300);
if ( this.scroller.x != snap.x || this.scroller.y != snap.y ) {
this.scroller.directionX = 0;
this.scroller.directionY = 0;
this.scroller.currentPage = snap;
this.scroller.scrollTo(snap.x, snap.y, time, this.scroller.options.bounceEasing);
}
}
if ( this.moved ) {
this.scroller._execEvent('scrollEnd');
}
},
transitionTime: function (time) {
time = time || 0;
this.indicatorStyle[utils.style.transitionDuration] = time + 'ms';
if ( !time && utils.isBadAndroid ) {
this.indicatorStyle[utils.style.transitionDuration] = '0.001s';
}
},
transitionTimingFunction: function (easing) {
this.indicatorStyle[utils.style.transitionTimingFunction] = easing;
},
refresh: function () {
this.transitionTime();
if ( this.options.listenX && !this.options.listenY ) {
this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none';
} else if ( this.options.listenY && !this.options.listenX ) {
this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none';
} else {
this.indicatorStyle.display = this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none';
}
if ( this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ) {
utils.addClass(this.wrapper, 'iScrollBothScrollbars');
utils.removeClass(this.wrapper, 'iScrollLoneScrollbar');
if ( this.options.defaultScrollbars && this.options.customStyle ) {
if ( this.options.listenX ) {
this.wrapper.style.right = '8px';
} else {
this.wrapper.style.bottom = '8px';
}
}
} else {
utils.removeClass(this.wrapper, 'iScrollBothScrollbars');
utils.addClass(this.wrapper, 'iScrollLoneScrollbar');
if ( this.options.defaultScrollbars && this.options.customStyle ) {
if ( this.options.listenX ) {
this.wrapper.style.right = '2px';
} else {
this.wrapper.style.bottom = '2px';
}
}
}
var r = this.wrapper.offsetHeight; // force refresh
if ( this.options.listenX ) {
this.wrapperWidth = this.wrapper.clientWidth;
if ( this.options.resize ) {
this.indicatorWidth = Math.max(Math.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8);
this.indicatorStyle.width = this.indicatorWidth + 'px';
} else {
this.indicatorWidth = this.indicator.clientWidth;
}
this.maxPosX = this.wrapperWidth - this.indicatorWidth;
if ( this.options.shrink == 'clip' ) {
this.minBoundaryX = -this.indicatorWidth + 8;
this.maxBoundaryX = this.wrapperWidth - 8;
} else {
this.minBoundaryX = 0;
this.maxBoundaryX = this.maxPosX;
}
this.sizeRatioX = this.options.speedRatioX || (this.scroller.maxScrollX && (this.maxPosX / this.scroller.maxScrollX));
}
if ( this.options.listenY ) {
this.wrapperHeight = this.wrapper.clientHeight;
if ( this.options.resize ) {
this.indicatorHeight = Math.max(Math.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8);
this.indicatorStyle.height = this.indicatorHeight + 'px';
} else {
this.indicatorHeight = this.indicator.clientHeight;
}
this.maxPosY = this.wrapperHeight - this.indicatorHeight;
if ( this.options.shrink == 'clip' ) {
this.minBoundaryY = -this.indicatorHeight + 8;
this.maxBoundaryY = this.wrapperHeight - 8;
} else {
this.minBoundaryY = 0;
this.maxBoundaryY = this.maxPosY;
}
this.maxPosY = this.wrapperHeight - this.indicatorHeight;
this.sizeRatioY = this.options.speedRatioY || (this.scroller.maxScrollY && (this.maxPosY / this.scroller.maxScrollY));
}
this.updatePosition();
},
updatePosition: function () {
var x = this.options.listenX && Math.round(this.sizeRatioX * this.scroller.x) || 0,
y = this.options.listenY && Math.round(this.sizeRatioY * this.scroller.y) || 0;
if ( !this.options.ignoreBoundaries ) {
if ( x < this.minBoundaryX ) {
if ( this.options.shrink == 'scale' ) {
this.width = Math.max(this.indicatorWidth + x, 8);
this.indicatorStyle.width = this.width + 'px';
}
x = this.minBoundaryX;
} else if ( x > this.maxBoundaryX ) {
if ( this.options.shrink == 'scale' ) {
this.width = Math.max(this.indicatorWidth - (x - this.maxPosX), 8);
this.indicatorStyle.width = this.width + 'px';
x = this.maxPosX + this.indicatorWidth - this.width;
} else {
x = this.maxBoundaryX;
}
} else if ( this.options.shrink == 'scale' && this.width != this.indicatorWidth ) {
this.width = this.indicatorWidth;
this.indicatorStyle.width = this.width + 'px';
}
if ( y < this.minBoundaryY ) {
if ( this.options.shrink == 'scale' ) {
this.height = Math.max(this.indicatorHeight + y * 3, 8);
this.indicatorStyle.height = this.height + 'px';
}
y = this.minBoundaryY;
} else if ( y > this.maxBoundaryY ) {
if ( this.options.shrink == 'scale' ) {
this.height = Math.max(this.indicatorHeight - (y - this.maxPosY) * 3, 8);
this.indicatorStyle.height = this.height + 'px';
y = this.maxPosY + this.indicatorHeight - this.height;
} else {
y = this.maxBoundaryY;
}
} else if ( this.options.shrink == 'scale' && this.height != this.indicatorHeight ) {
this.height = this.indicatorHeight;
this.indicatorStyle.height = this.height + 'px';
}
}
this.x = x;
this.y = y;
if ( this.scroller.options.useTransform ) {
this.indicatorStyle[utils.style.transform] = 'translate(' + x + 'px,' + y + 'px)' + this.scroller.translateZ;
} else {
this.indicatorStyle.left = x + 'px';
this.indicatorStyle.top = y + 'px';
}
},
_pos: function (x, y) {
if ( x < 0 ) {
x = 0;
} else if ( x > this.maxPosX ) {
x = this.maxPosX;
}
if ( y < 0 ) {
y = 0;
} else if ( y > this.maxPosY ) {
y = this.maxPosY;
}
x = this.options.listenX ? Math.round(x / this.sizeRatioX) : this.scroller.x;
y = this.options.listenY ? Math.round(y / this.sizeRatioY) : this.scroller.y;
this.scroller.scrollTo(x, y);
},
fade: function (val, hold) {
if ( hold && !this.visible ) {
return;
}
clearTimeout(this.fadeTimeout);
this.fadeTimeout = null;
var time = val ? 250 : 500,
delay = val ? 0 : 300;
val = val ? '1' : '0';
this.wrapperStyle[utils.style.transitionDuration] = time + 'ms';
this.fadeTimeout = setTimeout((function (val) {
this.wrapperStyle.opacity = val;
this.visible = +val;
}).bind(this, val), delay);
}
};
IScroll.utils = utils;
if ( typeof module != 'undefined' && module.exports ) {
module.exports = IScroll;
} else {
window.IScroll = IScroll;
}
})(window, document, Math);
\ No newline at end of file
...@@ -11,7 +11,8 @@ function clickSendCode(event) { ...@@ -11,7 +11,8 @@ function clickSendCode(event) {
self.unbind('click'); self.unbind('click');
ajaxSendCode(ajaxUrl, self, phone, validate); ajaxSendCode(ajaxUrl, self, phone, validate);
} else { } else {
$('#phone-error').text('请输入11位手机号'); $('#notice').html('<span>请输入11位手机号</span>');
$('#myModal').modal('show');
} }
} }
...@@ -30,6 +31,8 @@ function countDown(ajaxUrl, self, validate) { ...@@ -30,6 +31,8 @@ function countDown(ajaxUrl, self, validate) {
} }
function ajaxSendCode(ajaxUrl, self, phone, validate) { function ajaxSendCode(ajaxUrl, self, phone, validate) {
var notice = $('#notice');
var myModal = $('#myModal');
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: ajaxUrl + '/wp-admin/admin-ajax.php/', url: ajaxUrl + '/wp-admin/admin-ajax.php/',
...@@ -41,12 +44,12 @@ function ajaxSendCode(ajaxUrl, self, phone, validate) { ...@@ -41,12 +44,12 @@ function ajaxSendCode(ajaxUrl, self, phone, validate) {
break; break;
case 2001: case 2001:
self.bind('click', {ajaxUrl: ajaxUrl, validate: validate}, clickSendCode); self.bind('click', {ajaxUrl: ajaxUrl, validate: validate}, clickSendCode);
alert('发送验证码失败'); notice.html('<span>发送验证码失败</span>');
myModal.modal('show');
break; break;
case 2002: case 2002:
var phoneError = $('#phone-error'); notice.html('<span>请输入有效的手机号</span>');
phoneError.text('请输入有效的手机号'); myModal.modal('show');
phoneError.removeAttr('style');
self.bind('click', {ajaxUrl: ajaxUrl, validate: validate}, clickSendCode); self.bind('click', {ajaxUrl: ajaxUrl, validate: validate}, clickSendCode);
break; break;
default: default:
......
/*!
* @copyright &copy; Kartik Visweswaran, Krajee.com, 2013 - 2015
* @version 3.5.4
*
* A simple yet powerful JQuery star rating plugin that allows rendering
* fractional star ratings and supports Right to Left (RTL) input.
*
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
(function ($) {
"use strict";
var DEFAULT_MIN = 0, DEFAULT_MAX = 5, DEFAULT_STEP = 0.5,
isEmpty = function (value, trim) {
return value === null || value === undefined || value.length === 0 || (trim && $.trim(value) === '');
},
addCss = function ($el, css) {
$el.removeClass(css).addClass(css);
},
validateAttr = function ($input, vattr, options) {
var chk = isEmpty($input.data(vattr)) ? $input.attr(vattr) : $input.data(vattr);
return chk ? chk : options[vattr];
},
getDecimalPlaces = function (num) {
var match = ('' + num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
return !match ? 0 : Math.max(0, (match[1] ? match[1].length : 0) - (match[2] ? +match[2] : 0));
},
applyPrecision = function (val, precision) {
return parseFloat(val.toFixed(precision));
},
Rating = function (element, options) {
this.$element = $(element);
this.init(options);
};
Rating.prototype = {
constructor: Rating,
_parseAttr: function (vattr, options) {
var self = this, $el = self.$element;
if ($el.attr('type') === 'range' || $el.attr('type') === 'number') {
var val = validateAttr($el, vattr, options), chk, final;
switch (vattr) {
case 'min':
chk = DEFAULT_MIN;
break;
case 'max':
chk = DEFAULT_MAX;
break;
default:
chk = DEFAULT_STEP;
}
final = isEmpty(val) ? chk : val;
return parseFloat(final);
}
return parseFloat(options[vattr]);
},
listenClick: function($el, callback) {
$el.on('click touchstart', function(e) {
e.stopPropagation();
e.preventDefault();
if (e.handled !== true) {
callback(e);
e.handled = true;
} else {
return false;
}
});
},
setDefault: function (key, val) {
var self = this;
if (isEmpty(self[key])) {
self[key] = val;
}
},
getPosition: function (e) {
var pageX = e.pageX || e.originalEvent.touches[0].pageX;
return pageX - this.$rating.offset().left;
},
listen: function () {
var self = this, pos, out;
self.initTouch();
self.listenClick(self.$rating, function(e) {
if (self.inactive) {
return false;
}
pos = self.getPosition(e);
self.setStars(pos);
self.$element.trigger('change').trigger('rating.change', [self.$element.val(), self.$caption.html()]);
self.starClicked = true;
});
self.$rating.on("mousemove", function (e) {
if (!self.hoverEnabled || self.inactive) {
return;
}
self.starClicked = false;
pos = self.getPosition(e);
out = self.calculate(pos);
self.toggleHover(out);
self.$element.trigger('rating.hover', [out.val, out.caption, 'stars']);
});
self.$rating.on("mouseleave", function () {
if (!self.hoverEnabled || self.inactive || self.starClicked) {
return;
}
out = self.cache;
self.toggleHover(out);
self.$element.trigger('rating.hoverleave', ['stars']);
});
self.$clear.on("mousemove", function () {
if (!self.hoverEnabled || self.inactive || !self.hoverOnClear) {
return;
}
self.clearClicked = false;
var caption = '<span class="' + self.clearCaptionClass + '">' + self.clearCaption + '</span>',
val = self.clearValue, width = self.getWidthFromValue(val);
out = {caption: caption, width: width, val: val};
self.toggleHover(out);
self.$element.trigger('rating.hover', [val, caption, 'clear']);
});
self.$clear.on("mouseleave", function () {
if (!self.hoverEnabled || self.inactive || self.clearClicked || !self.hoverOnClear) {
return;
}
out = self.cache;
self.toggleHover(out);
self.$element.trigger('rating.hoverleave', ['clear']);
});
self.listenClick(self.$clear, function () {
if (!self.inactive) {
self.clear();
self.clearClicked = true;
}
});
$(self.$element[0].form).on("reset", function () {
if (!self.inactive) {
self.reset();
}
});
},
destroy: function () {
var self = this, $el = self.$element;
if (!isEmpty(self.$container)) {
self.$container.before($el).remove();
}
$.removeData($el.get(0));
$el.off('rating').removeClass('hide');
},
create: function (options) {
var self = this, $el = self.$element;
options = options || self.options || {};
self.destroy();
$el.rating(options);
},
setTouch: function (e, flag) {
var self = this, isTouchCapable = 'ontouchstart' in window ||
(window.DocumentTouch && document instanceof window.DocumentTouch);
if (!isTouchCapable || self.inactive) {
return;
}
var ev = e.originalEvent, touches = ev.touches || ev.changedTouches, pos = self.getPosition(touches[0]);
if (flag) {
self.setStars(pos);
self.$element.trigger('change').trigger('rating.change', [self.$element.val(), self.$caption.html()]);
self.starClicked = true;
} else {
var out = self.calculate(pos), caption = out.val <= self.clearValue ? self.fetchCaption(self.clearValue) : out.caption,
w = self.getWidthFromValue(self.clearValue),
width = out.val <= self.clearValue ? (self.rtl ? (100 - w) + '%' : w + '%') : out.width;
self.$caption.html(caption);
self.$stars.css('width', width);
}
},
initTouch: function () {
var self = this;
self.$rating.on("touchstart touchmove touchend", function (e) {
var flag = (e.type === "touchend");
self.setTouch(e, flag);
});
},
initSlider: function (options) {
var self = this;
if (isEmpty(self.$element.val())) {
self.$element.val(0);
}
self.initialValue = self.$element.val();
self.setDefault('min', self._parseAttr('min', options));
self.setDefault('max', self._parseAttr('max', options));
self.setDefault('step', self._parseAttr('step', options));
if (isNaN(self.min) || isEmpty(self.min)) {
self.min = DEFAULT_MIN;
}
if (isNaN(self.max) || isEmpty(self.max)) {
self.max = DEFAULT_MAX;
}
if (isNaN(self.step) || isEmpty(self.step) || self.step === 0) {
self.step = DEFAULT_STEP;
}
self.diff = self.max - self.min;
},
init: function (options) {
var self = this, $el = self.$element, defaultStar, starVal, starWidth;
self.options = options;
$.each(options, function (key, value) {
self[key] = value;
});
self.starClicked = false;
self.clearClicked = false;
self.initSlider(options);
self.checkDisabled();
self.setDefault('rtl', $el.attr('dir'));
if (self.rtl) {
$el.attr('dir', 'rtl');
}
defaultStar = (self.glyphicon) ? '\ue006' : '\u2605';
self.setDefault('symbol', defaultStar);
self.setDefault('clearButtonBaseClass', 'clear-rating');
self.setDefault('clearButtonActiveClass', 'clear-rating-active');
self.setDefault('clearValue', self.min);
addCss($el, 'form-control hide');
self.$clearElement = isEmpty(options.clearElement) ? null : $(options.clearElement);
self.$captionElement = isEmpty(options.captionElement) ? null : $(options.captionElement);
if (self.$rating === undefined && self.$container === undefined) {
self.$rating = $(document.createElement("div")).html('<div class="rating-stars"></div>');
self.$container = $(document.createElement("div"));
self.$container.before(self.$rating).append(self.$rating);
$el.before(self.$container).appendTo(self.$rating);
}
self.$stars = self.$rating.find('.rating-stars');
self.generateRating();
self.$clear = !isEmpty(self.$clearElement) ? self.$clearElement : self.$container.find('.' + self.clearButtonBaseClass);
self.$caption = !isEmpty(self.$captionElement) ? self.$captionElement : self.$container.find(".caption");
self.setStars();
self.listen();
if (self.showClear) {
self.$clear.attr({"class": self.getClearClass()});
}
starVal = $el.val();
starWidth = self.getWidthFromValue(starVal);
self.cache = {
caption: self.$caption.html(),
width: (self.rtl ? (100 - starWidth) : starWidth) + '%',
val: starVal
};
$el.removeClass('rating-loading');
},
checkDisabled: function () {
var self = this;
self.disabled = validateAttr(self.$element, 'disabled', self.options);
self.readonly = validateAttr(self.$element, 'readonly', self.options);
self.inactive = (self.disabled || self.readonly);
},
getClearClass: function () {
return this.clearButtonBaseClass + ' ' + ((this.inactive) ? '' : this.clearButtonActiveClass);
},
generateRating: function () {
var self = this, clear = self.renderClear(), caption = self.renderCaption(),
css = (self.rtl) ? 'rating-container-rtl' : 'rating-container',
stars = self.getStars();
if (self.glyphicon) {
css += (self.symbol === '\ue006' ? ' rating-gly-star' : ' rating-gly') + self.ratingClass;
} else {
css += isEmpty(self.ratingClass) ? ' rating-uni' : ' ' + self.ratingClass;
}
self.$rating.attr('class', css);
self.$rating.attr('data-content', stars);
self.$stars.attr('data-content', stars);
css = self.rtl ? 'star-rating-rtl' : 'star-rating';
self.$container.attr('class', css + ' rating-' + self.size);
self.$container.removeClass('rating-active rating-disabled');
if (self.inactive) {
self.$container.addClass('rating-disabled');
}
else {
self.$container.addClass('rating-active');
}
if (isEmpty(self.$caption)) {
if (self.rtl) {
self.$container.prepend(caption);
} else {
self.$container.append(caption);
}
}
if (isEmpty(self.$clear)) {
if (self.rtl) {
self.$container.append(clear);
}
else {
self.$container.prepend(clear);
}
}
if (!isEmpty(self.containerClass)) {
addCss(self.$container, self.containerClass);
}
},
getStars: function () {
var self = this, numStars = self.stars, stars = '', i;
for (i = 1; i <= numStars; i++) {
stars += self.symbol;
}
return stars;
},
renderClear: function () {
var self = this, css;
if (!self.showClear) {
return '';
}
css = self.getClearClass();
if (!isEmpty(self.$clearElement)) {
addCss(self.$clearElement, css);
self.$clearElement.attr({"title": self.clearButtonTitle}).html(self.clearButton);
return '';
}
return '<div class="' + css + '" title="' + self.clearButtonTitle + '">' + self.clearButton + '</div>';
},
renderCaption: function () {
var self = this, val = self.$element.val(), html;
if (!self.showCaption) {
return '';
}
html = self.fetchCaption(val);
if (!isEmpty(self.$captionElement)) {
addCss(self.$captionElement, 'caption');
self.$captionElement.html(html);
return '';
}
return '<div class="caption">' + html + '</div>';
},
fetchCaption: function (rating) {
var self = this, val = parseFloat(rating), css, cap, capVal, cssVal,
vCap = self.starCaptions, vCss = self.starCaptionClasses, caption;
cssVal = typeof vCss === "function" ? vCss(val) : vCss[val];
capVal = typeof vCap === "function" ? vCap(val) : vCap[val];
cap = isEmpty(capVal) ? self.defaultCaption.replace(/\{rating\}/g, val) : capVal;
css = isEmpty(cssVal) ? self.clearCaptionClass : cssVal;
caption = (val === self.clearValue) ? self.clearCaption : cap;
return '<span class="' + css + '">' + caption + '</span>';
},
getWidthFromValue: function (val) {
var self = this, min = self.min, max = self.max;
if (val <= min || min === max) {
return 0;
}
if (val >= max) {
return 100;
}
return (val - min) * 100 / (max - min);
},
getValueFromPosition: function (pos) {
var self = this, precision = getDecimalPlaces(self.step),
val, factor, maxWidth = self.$rating.width();
factor = (self.diff * pos) / (maxWidth * self.step);
factor = self.rtl ? Math.floor(factor) : Math.ceil(factor);
val = applyPrecision(parseFloat(self.min + factor * self.step), precision);
val = Math.max(Math.min(val, self.max), self.min);
return self.rtl ? (self.max - val) : val;
},
toggleHover: function (out) {
var self = this, w, width, caption;
if (self.hoverChangeCaption) {
caption = out.val <= self.clearValue ? self.fetchCaption(self.clearValue) : out.caption;
self.$caption.html(caption);
}
if (self.hoverChangeStars) {
w = self.getWidthFromValue(self.clearValue);
width = out.val <= self.clearValue ? (self.rtl ? (100 - w) + '%' : w + '%') : out.width;
self.$stars.css('width', width);
}
},
calculate: function (pos) {
var self = this, defaultVal = isEmpty(self.$element.val()) ? 0 : self.$element.val(),
val = arguments.length ? self.getValueFromPosition(pos) : defaultVal,
caption = self.fetchCaption(val), width = self.getWidthFromValue(val);
if (self.rtl) {
width = 100 - width;
}
width += '%';
return {caption: caption, width: width, val: val};
},
setStars: function (pos) {
var self = this, out = arguments.length ? self.calculate(pos) : self.calculate();
self.$element.val(out.val);
self.$stars.css('width', out.width);
self.$caption.html(out.caption);
self.cache = out;
},
clear: function () {
var self = this,
title = '<span class="' + self.clearCaptionClass + '">' + self.clearCaption + '</span>';
self.$stars.removeClass('rated');
if (!self.inactive) {
self.$caption.html(title);
}
self.$element.val(self.clearValue);
self.setStars();
self.$element.trigger('rating.clear');
},
reset: function () {
var self = this;
self.$element.val(self.initialValue);
self.setStars();
self.$element.trigger('rating.reset');
},
update: function (val) {
var self = this;
if (!arguments.length) {
return;
}
self.$element.val(val);
self.setStars();
},
refresh: function (options) {
var self = this;
if (!arguments.length) {
return;
}
self.$rating.off('rating');
if (self.$clear !== undefined) {
self.$clear.off();
}
self.init($.extend(self.options, options));
if (self.showClear) {
self.$clear.show();
} else {
self.$clear.hide();
}
if (self.showCaption) {
self.$caption.show();
} else {
self.$caption.hide();
}
self.$element.trigger('rating.refresh');
}
};
$.fn.rating = function (option) {
var args = Array.apply(null, arguments);
args.shift();
return this.each(function () {
var $this = $(this),
data = $this.data('rating'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('rating',
(data = new Rating(this, $.extend({}, $.fn.rating.defaults, options, $(this).data()))));
}
if (typeof option === 'string') {
data[option].apply(data, args);
}
});
};
$.fn.rating.defaults = {
stars: 5,
glyphicon: true,
symbol: null,
ratingClass: '',
disabled: false,
readonly: false,
rtl: false,
size: 'md',
showClear: true,
showCaption: true,
defaultCaption: '{rating} Stars',
starCaptions: {
0.5: 'Half Star',
1: 'One Star',
1.5: 'One & Half Star',
2: 'Two Stars',
2.5: 'Two & Half Stars',
3: 'Three Stars',
3.5: 'Three & Half Stars',
4: 'Four Stars',
4.5: 'Four & Half Stars',
5: 'Five Stars'
},
starCaptionClasses: {
0.5: 'label label-danger',
1: 'label label-danger',
1.5: 'label label-warning',
2: 'label label-warning',
2.5: 'label label-info',
3: 'label label-info',
3.5: 'label label-primary',
4: 'label label-primary',
4.5: 'label label-success',
5: 'label label-success'
},
clearButton: '<i class="glyphicon glyphicon-minus-sign"></i>',
clearButtonTitle: 'Clear',
clearButtonBaseClass: 'clear-rating',
clearButtonActiveClass: 'clear-rating-active',
clearCaption: 'Not Rated',
clearCaptionClass: 'label label-default',
clearValue: null,
captionElement: null,
clearElement: null,
containerClass: null,
hoverEnabled: true,
hoverChangeCaption: true,
hoverChangeStars: true,
hoverOnClear: true
};
$.fn.rating.Constructor = Rating;
/**
* Convert automatically inputs with class 'rating'
* into the star rating control.
*/
$('input.rating').addClass('rating-loading');
$(document).ready(function () {
var $input = $('input.rating'), count = Object.keys($input).length;
if (count > 0) {
$input.rating();
}
});
}(window.jQuery));
\ No newline at end of file
/*!
* @copyright &copy; Kartik Visweswaran, Krajee.com, 2013 - 2015
* @version 3.5.4
*
* A simple yet powerful JQuery star rating plugin that allows rendering
* fractional star ratings and supports Right to Left (RTL) input.
*
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/!function(t){"use strict";var e=0,a=5,n=.5,r=function(e,a){return null===e||void 0===e||0===e.length||a&&""===t.trim(e)},i=function(t,e){t.removeClass(e).addClass(e)},l=function(t,e,a){var n=r(t.data(e))?t.attr(e):t.data(e);return n?n:a[e]},o=function(t){var e=(""+t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0},s=function(t,e){return parseFloat(t.toFixed(e))},c=function(e,a){this.$element=t(e),this.init(a)};c.prototype={constructor:c,_parseAttr:function(t,i){var o=this,s=o.$element;if("range"===s.attr("type")||"number"===s.attr("type")){var c,u,g=l(s,t,i);switch(t){case"min":c=e;break;case"max":c=a;break;default:c=n}return u=r(g)?c:g,parseFloat(u)}return parseFloat(i[t])},listenClick:function(t,e){t.on("click touchstart",function(t){return t.stopPropagation(),t.preventDefault(),t.handled===!0?!1:(e(t),void(t.handled=!0))})},setDefault:function(t,e){var a=this;r(a[t])&&(a[t]=e)},getPosition:function(t){var e=t.pageX||t.originalEvent.touches[0].pageX;return e-this.$rating.offset().left},listen:function(){var e,a,n=this;n.initTouch(),n.listenClick(n.$rating,function(t){return n.inactive?!1:(e=n.getPosition(t),n.setStars(e),n.$element.trigger("change").trigger("rating.change",[n.$element.val(),n.$caption.html()]),void(n.starClicked=!0))}),n.$rating.on("mousemove",function(t){n.hoverEnabled&&!n.inactive&&(n.starClicked=!1,e=n.getPosition(t),a=n.calculate(e),n.toggleHover(a),n.$element.trigger("rating.hover",[a.val,a.caption,"stars"]))}),n.$rating.on("mouseleave",function(){!n.hoverEnabled||n.inactive||n.starClicked||(a=n.cache,n.toggleHover(a),n.$element.trigger("rating.hoverleave",["stars"]))}),n.$clear.on("mousemove",function(){if(n.hoverEnabled&&!n.inactive&&n.hoverOnClear){n.clearClicked=!1;var t='<span class="'+n.clearCaptionClass+'">'+n.clearCaption+"</span>",e=n.clearValue,r=n.getWidthFromValue(e);a={caption:t,width:r,val:e},n.toggleHover(a),n.$element.trigger("rating.hover",[e,t,"clear"])}}),n.$clear.on("mouseleave",function(){n.hoverEnabled&&!n.inactive&&!n.clearClicked&&n.hoverOnClear&&(a=n.cache,n.toggleHover(a),n.$element.trigger("rating.hoverleave",["clear"]))}),n.listenClick(n.$clear,function(){n.inactive||(n.clear(),n.clearClicked=!0)}),t(n.$element[0].form).on("reset",function(){n.inactive||n.reset()})},destroy:function(){var e=this,a=e.$element;r(e.$container)||e.$container.before(a).remove(),t.removeData(a.get(0)),a.off("rating").removeClass("hide")},create:function(t){var e=this,a=e.$element;t=t||e.options||{},e.destroy(),a.rating(t)},setTouch:function(t,e){var a=this,n="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch;if(n&&!a.inactive){var r=t.originalEvent,i=r.touches||r.changedTouches,l=a.getPosition(i[0]);if(e)a.setStars(l),a.$element.trigger("change").trigger("rating.change",[a.$element.val(),a.$caption.html()]),a.starClicked=!0;else{var o=a.calculate(l),s=o.val<=a.clearValue?a.fetchCaption(a.clearValue):o.caption,c=a.getWidthFromValue(a.clearValue),u=o.val<=a.clearValue?a.rtl?100-c+"%":c+"%":o.width;a.$caption.html(s),a.$stars.css("width",u)}}},initTouch:function(){var t=this;t.$rating.on("touchstart touchmove touchend",function(e){var a="touchend"===e.type;t.setTouch(e,a)})},initSlider:function(t){var i=this;r(i.$element.val())&&i.$element.val(0),i.initialValue=i.$element.val(),i.setDefault("min",i._parseAttr("min",t)),i.setDefault("max",i._parseAttr("max",t)),i.setDefault("step",i._parseAttr("step",t)),(isNaN(i.min)||r(i.min))&&(i.min=e),(isNaN(i.max)||r(i.max))&&(i.max=a),(isNaN(i.step)||r(i.step)||0===i.step)&&(i.step=n),i.diff=i.max-i.min},init:function(e){var a,n,l,o=this,s=o.$element;o.options=e,t.each(e,function(t,e){o[t]=e}),o.starClicked=!1,o.clearClicked=!1,o.initSlider(e),o.checkDisabled(),o.setDefault("rtl",s.attr("dir")),o.rtl&&s.attr("dir","rtl"),a=o.glyphicon?"":"★",o.setDefault("symbol",a),o.setDefault("clearButtonBaseClass","clear-rating"),o.setDefault("clearButtonActiveClass","clear-rating-active"),o.setDefault("clearValue",o.min),i(s,"form-control hide"),o.$clearElement=r(e.clearElement)?null:t(e.clearElement),o.$captionElement=r(e.captionElement)?null:t(e.captionElement),void 0===o.$rating&&void 0===o.$container&&(o.$rating=t(document.createElement("div")).html('<div class="rating-stars"></div>'),o.$container=t(document.createElement("div")),o.$container.before(o.$rating).append(o.$rating),s.before(o.$container).appendTo(o.$rating)),o.$stars=o.$rating.find(".rating-stars"),o.generateRating(),o.$clear=r(o.$clearElement)?o.$container.find("."+o.clearButtonBaseClass):o.$clearElement,o.$caption=r(o.$captionElement)?o.$container.find(".caption"):o.$captionElement,o.setStars(),o.listen(),o.showClear&&o.$clear.attr({"class":o.getClearClass()}),n=s.val(),l=o.getWidthFromValue(n),o.cache={caption:o.$caption.html(),width:(o.rtl?100-l:l)+"%",val:n},s.removeClass("rating-loading")},checkDisabled:function(){var t=this;t.disabled=l(t.$element,"disabled",t.options),t.readonly=l(t.$element,"readonly",t.options),t.inactive=t.disabled||t.readonly},getClearClass:function(){return this.clearButtonBaseClass+" "+(this.inactive?"":this.clearButtonActiveClass)},generateRating:function(){var t=this,e=t.renderClear(),a=t.renderCaption(),n=t.rtl?"rating-container-rtl":"rating-container",l=t.getStars();n+=t.glyphicon?(""===t.symbol?" rating-gly-star":" rating-gly")+t.ratingClass:r(t.ratingClass)?" rating-uni":" "+t.ratingClass,t.$rating.attr("class",n),t.$rating.attr("data-content",l),t.$stars.attr("data-content",l),n=t.rtl?"star-rating-rtl":"star-rating",t.$container.attr("class",n+" rating-"+t.size),t.$container.removeClass("rating-active rating-disabled"),t.$container.addClass(t.inactive?"rating-disabled":"rating-active"),r(t.$caption)&&(t.rtl?t.$container.prepend(a):t.$container.append(a)),r(t.$clear)&&(t.rtl?t.$container.append(e):t.$container.prepend(e)),r(t.containerClass)||i(t.$container,t.containerClass)},getStars:function(){var t,e=this,a=e.stars,n="";for(t=1;a>=t;t++)n+=e.symbol;return n},renderClear:function(){var t,e=this;return e.showClear?(t=e.getClearClass(),r(e.$clearElement)?'<div class="'+t+'" title="'+e.clearButtonTitle+'">'+e.clearButton+"</div>":(i(e.$clearElement,t),e.$clearElement.attr({title:e.clearButtonTitle}).html(e.clearButton),"")):""},renderCaption:function(){var t,e=this,a=e.$element.val();return e.showCaption?(t=e.fetchCaption(a),r(e.$captionElement)?'<div class="caption">'+t+"</div>":(i(e.$captionElement,"caption"),e.$captionElement.html(t),"")):""},fetchCaption:function(t){var e,a,n,i,l,o=this,s=parseFloat(t),c=o.starCaptions,u=o.starCaptionClasses;return i="function"==typeof u?u(s):u[s],n="function"==typeof c?c(s):c[s],a=r(n)?o.defaultCaption.replace(/\{rating\}/g,s):n,e=r(i)?o.clearCaptionClass:i,l=s===o.clearValue?o.clearCaption:a,'<span class="'+e+'">'+l+"</span>"},getWidthFromValue:function(t){var e=this,a=e.min,n=e.max;return a>=t||a===n?0:t>=n?100:100*(t-a)/(n-a)},getValueFromPosition:function(t){var e,a,n=this,r=o(n.step),i=n.$rating.width();return a=n.diff*t/(i*n.step),a=n.rtl?Math.floor(a):Math.ceil(a),e=s(parseFloat(n.min+a*n.step),r),e=Math.max(Math.min(e,n.max),n.min),n.rtl?n.max-e:e},toggleHover:function(t){var e,a,n,r=this;r.hoverChangeCaption&&(n=t.val<=r.clearValue?r.fetchCaption(r.clearValue):t.caption,r.$caption.html(n)),r.hoverChangeStars&&(e=r.getWidthFromValue(r.clearValue),a=t.val<=r.clearValue?r.rtl?100-e+"%":e+"%":t.width,r.$stars.css("width",a))},calculate:function(t){var e=this,a=r(e.$element.val())?0:e.$element.val(),n=arguments.length?e.getValueFromPosition(t):a,i=e.fetchCaption(n),l=e.getWidthFromValue(n);return e.rtl&&(l=100-l),l+="%",{caption:i,width:l,val:n}},setStars:function(t){var e=this,a=arguments.length?e.calculate(t):e.calculate();e.$element.val(a.val),e.$stars.css("width",a.width),e.$caption.html(a.caption),e.cache=a},clear:function(){var t=this,e='<span class="'+t.clearCaptionClass+'">'+t.clearCaption+"</span>";t.$stars.removeClass("rated"),t.inactive||t.$caption.html(e),t.$element.val(t.clearValue),t.setStars(),t.$element.trigger("rating.clear")},reset:function(){var t=this;t.$element.val(t.initialValue),t.setStars(),t.$element.trigger("rating.reset")},update:function(t){var e=this;arguments.length&&(e.$element.val(t),e.setStars())},refresh:function(e){var a=this;arguments.length&&(a.$rating.off("rating"),void 0!==a.$clear&&a.$clear.off(),a.init(t.extend(a.options,e)),a.showClear?a.$clear.show():a.$clear.hide(),a.showCaption?a.$caption.show():a.$caption.hide(),a.$element.trigger("rating.refresh"))}},t.fn.rating=function(e){var a=Array.apply(null,arguments);return a.shift(),this.each(function(){var n=t(this),r=n.data("rating"),i="object"==typeof e&&e;r||n.data("rating",r=new c(this,t.extend({},t.fn.rating.defaults,i,t(this).data()))),"string"==typeof e&&r[e].apply(r,a)})},t.fn.rating.defaults={stars:5,glyphicon:!0,symbol:null,ratingClass:"",disabled:!1,readonly:!1,rtl:!1,size:"md",showClear:!0,showCaption:!0,defaultCaption:"{rating} Stars",starCaptions:{.5:"Half Star",1:"One Star",1.5:"One & Half Star",2:"Two Stars",2.5:"Two & Half Stars",3:"Three Stars",3.5:"Three & Half Stars",4:"Four Stars",4.5:"Four & Half Stars",5:"Five Stars"},starCaptionClasses:{.5:"label label-danger",1:"label label-danger",1.5:"label label-warning",2:"label label-warning",2.5:"label label-info",3:"label label-info",3.5:"label label-primary",4:"label label-primary",4.5:"label label-success",5:"label label-success"},clearButton:'<i class="glyphicon glyphicon-minus-sign"></i>',clearButtonTitle:"Clear",clearButtonBaseClass:"clear-rating",clearButtonActiveClass:"clear-rating-active",clearCaption:"Not Rated",clearCaptionClass:"label label-default",clearValue:null,captionElement:null,clearElement:null,containerClass:null,hoverEnabled:!0,hoverChangeCaption:!0,hoverChangeStars:!0,hoverOnClear:!0},t.fn.rating.Constructor=c,t("input.rating").addClass("rating-loading"),t(document).ready(function(){var e=t("input.rating"),a=Object.keys(e).length;a>0&&e.rating()})}(window.jQuery);
\ No newline at end of file
/*
* Swipe 2.0
*
* Brad Birdsall
* Copyright 2013, MIT License
*
*/
function Swipe(container, options) {
"use strict";
// utilities
var noop = function() {}; // simple no operation function
var offloadFn = function(fn) { setTimeout(fn || noop, 0) }; // offload a functions execution
// check browser capabilities
var browser = {
addEventListener: !!window.addEventListener,
touch: ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch,
transitions: (function(temp) {
var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition'];
for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true;
return false;
})(document.createElement('swipe'))
};
// quit if no root element
if (!container) return;
var element = container.children[0];
var slides, slidePos, width, length;
options = options || {};
var index = parseInt(options.startSlide, 10) || 0;
var speed = options.speed || 300;
options.continuous = options.continuous !== undefined ? options.continuous : true;
function setup() {
// cache slides
slides = element.children;
length = slides.length;
// set continuous to false if only one slide
if (slides.length < 2) options.continuous = false;
//special case if two slides
if (browser.transitions && options.continuous && slides.length < 3) {
element.appendChild(slides[0].cloneNode(true));
element.appendChild(element.children[1].cloneNode(true));
slides = element.children;
}
// create an array to store current positions of each slide
slidePos = new Array(slides.length);
// determine width of each slide
width = container.getBoundingClientRect().width || container.offsetWidth;
element.style.width = (slides.length * width) + 'px';
// stack elements
var pos = slides.length;
while(pos--) {
var slide = slides[pos];
slide.style.width = width + 'px';
slide.setAttribute('data-index', pos);
if (browser.transitions) {
slide.style.left = (pos * -width) + 'px';
move(pos, index > pos ? -width : (index < pos ? width : 0), 0);
}
}
// reposition elements before and after index
if (options.continuous && browser.transitions) {
move(circle(index-1), -width, 0);
move(circle(index+1), width, 0);
}
if (!browser.transitions) element.style.left = (index * -width) + 'px';
container.style.visibility = 'visible';
}
function prev() {
if (options.continuous) slide(index-1);
else if (index) slide(index-1);
}
function next() {
if (options.continuous) slide(index+1);
else if (index < slides.length - 1) slide(index+1);
}
function circle(index) {
// a simple positive modulo using slides.length
return (slides.length + (index % slides.length)) % slides.length;
}
function slide(to, slideSpeed) {
// do nothing if already on requested slide
if (index == to) return;
if (browser.transitions) {
var direction = Math.abs(index-to) / (index-to); // 1: backward, -1: forward
// get the actual position of the slide
if (options.continuous) {
var natural_direction = direction;
direction = -slidePos[circle(to)] / width;
// if going forward but to < index, use to = slides.length + to
// if going backward but to > index, use to = -slides.length + to
if (direction !== natural_direction) to = -direction * slides.length + to;
}
var diff = Math.abs(index-to) - 1;
// move all the slides between index and to in the right direction
while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0);
to = circle(to);
move(index, width * direction, slideSpeed || speed);
move(to, 0, slideSpeed || speed);
if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place
} else {
to = circle(to);
animate(index * -width, to * -width, slideSpeed || speed);
//no fallback for a circular continuous if the browser does not accept transitions
}
index = to;
offloadFn(options.callback && options.callback(index, slides[index]));
}
function move(index, dist, speed) {
translate(index, dist, speed);
slidePos[index] = dist;
}
function translate(index, dist, speed) {
var slide = slides[index];
var style = slide && slide.style;
if (!style) return;
style.webkitTransitionDuration =
style.MozTransitionDuration =
style.msTransitionDuration =
style.OTransitionDuration =
style.transitionDuration = speed + 'ms';
style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)';
style.msTransform =
style.MozTransform =
style.OTransform = 'translateX(' + dist + 'px)';
}
function animate(from, to, speed) {
// if not an animation, just reposition
if (!speed) {
element.style.left = to + 'px';
return;
}
var start = +new Date;
var timer = setInterval(function() {
var timeElap = +new Date - start;
if (timeElap > speed) {
element.style.left = to + 'px';
if (delay) begin();
options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);
clearInterval(timer);
return;
}
element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px';
}, 4);
}
// setup auto slideshow
var delay = options.auto || 0;
var interval;
function begin() {
interval = setTimeout(next, delay);
}
function stop() {
//delay = 0;
delay = options.auto > 0 ? options.auto : 0;
clearTimeout(interval);
}
// setup initial vars
var start = {};
var delta = {};
var isScrolling;
// setup event capturing
var events = {
handleEvent: function(event) {
switch (event.type) {
case 'touchstart': this.start(event); break;
case 'touchmove': this.move(event); break;
case 'touchend': offloadFn(this.end(event)); break;
case 'webkitTransitionEnd':
case 'msTransitionEnd':
case 'oTransitionEnd':
case 'otransitionend':
case 'transitionend': offloadFn(this.transitionEnd(event)); break;
case 'resize': offloadFn(setup); break;
}
if (options.stopPropagation) event.stopPropagation();
},
start: function(event) {
var touches = event.touches[0];
// measure start values
start = {
// get initial touch coords
x: touches.pageX,
y: touches.pageY,
// store time to determine touch duration
time: +new Date
};
// used for testing first move event
isScrolling = undefined;
// reset delta and end measurements
delta = {};
// attach touchmove and touchend listeners
element.addEventListener('touchmove', this, false);
element.addEventListener('touchend', this, false);
},
move: function(event) {
// ensure swiping with one touch and not pinching
if ( event.touches.length > 1 || event.scale && event.scale !== 1) return
if (options.disableScroll) event.preventDefault();
var touches = event.touches[0];
// measure change in x and y
delta = {
x: touches.pageX - start.x,
y: touches.pageY - start.y
}
// determine if scrolling test has run - one time test
if ( typeof isScrolling == 'undefined') {
isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );
}
// if user is not trying to scroll vertically
if (!isScrolling) {
// prevent native scrolling
event.preventDefault();
// stop slideshow
stop();
// increase resistance if first or last slide
if (options.continuous) { // we don't add resistance at the end
translate(circle(index-1), delta.x + slidePos[circle(index-1)], 0);
translate(index, delta.x + slidePos[index], 0);
translate(circle(index+1), delta.x + slidePos[circle(index+1)], 0);
} else {
delta.x =
delta.x /
( (!index && delta.x > 0 // if first slide and sliding left
|| index == slides.length - 1 // or if last slide and sliding right
&& delta.x < 0 // and if sliding at all
) ?
( Math.abs(delta.x) / width + 1 ) // determine resistance level
: 1 ); // no resistance if false
// translate 1:1
translate(index-1, delta.x + slidePos[index-1], 0);
translate(index, delta.x + slidePos[index], 0);
translate(index+1, delta.x + slidePos[index+1], 0);
}
}
},
end: function(event) {
// measure duration
var duration = +new Date - start.time;
// determine if slide attempt triggers next/prev slide
var isValidSlide =
Number(duration) < 250 // if slide duration is less than 250ms
&& Math.abs(delta.x) > 20 // and if slide amt is greater than 20px
|| Math.abs(delta.x) > width/2; // or if slide amt is greater than half the width
// determine if slide attempt is past start and end
var isPastBounds =
!index && delta.x > 0 // if first slide and slide amt is greater than 0
|| index == slides.length - 1 && delta.x < 0; // or if last slide and slide amt is less than 0
if (options.continuous) isPastBounds = false;
// determine direction of swipe (true:right, false:left)
var direction = delta.x < 0;
// if not scrolling vertically
if (!isScrolling) {
if (isValidSlide && !isPastBounds) {
if (direction) {
if (options.continuous) { // we need to get the next in this direction in place
move(circle(index-1), -width, 0);
move(circle(index+2), width, 0);
} else {
move(index-1, -width, 0);
}
move(index, slidePos[index]-width, speed);
move(circle(index+1), slidePos[circle(index+1)]-width, speed);
index = circle(index+1);
} else {
if (options.continuous) { // we need to get the next in this direction in place
move(circle(index+1), width, 0);
move(circle(index-2), -width, 0);
} else {
move(index+1, width, 0);
}
move(index, slidePos[index]+width, speed);
move(circle(index-1), slidePos[circle(index-1)]+width, speed);
index = circle(index-1);
}
options.callback && options.callback(index, slides[index]);
} else {
if (options.continuous) {
move(circle(index-1), -width, speed);
move(index, 0, speed);
move(circle(index+1), width, speed);
} else {
move(index-1, -width, speed);
move(index, 0, speed);
move(index+1, width, speed);
}
}
}
// kill touchmove and touchend event listeners until touchstart called again
element.removeEventListener('touchmove', events, false)
element.removeEventListener('touchend', events, false)
},
transitionEnd: function(event) {
if (parseInt(event.target.getAttribute('data-index'), 10) == index) {
if (delay) begin();
options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);
}
}
}
// trigger setup
setup();
// start auto slideshow if applicable
if (delay) begin();
// add event listeners
if (browser.addEventListener) {
// set touchstart event on element
if (browser.touch) element.addEventListener('touchstart', events, false);
if (browser.transitions) {
element.addEventListener('webkitTransitionEnd', events, false);
element.addEventListener('msTransitionEnd', events, false);
element.addEventListener('oTransitionEnd', events, false);
element.addEventListener('otransitionend', events, false);
element.addEventListener('transitionend', events, false);
}
// set resize event on window
window.addEventListener('resize', events, false);
} else {
window.onresize = function () { setup() }; // to play nice with old IE
}
// expose the Swipe API
return {
setup: function() {
setup();
},
slide: function(to, speed) {
// cancel slideshow
stop();
slide(to, speed);
},
prev: function() {
// cancel slideshow
stop();
prev();
},
next: function() {
// cancel slideshow
stop();
next();
},
stop: function() {
// cancel slideshow
stop();
},
getPos: function() {
// return current index position
return index;
},
getNumSlides: function() {
// return total number of slides
return length;
},
kill: function() {
// cancel slideshow
stop();
// reset element
element.style.width = '';
element.style.left = '';
// reset slides
var pos = slides.length;
while(pos--) {
var slide = slides[pos];
slide.style.width = '';
slide.style.left = '';
if (browser.transitions) translate(pos, 0, 0);
}
// removed event listeners
if (browser.addEventListener) {
// remove current event listeners
element.removeEventListener('touchstart', events, false);
element.removeEventListener('webkitTransitionEnd', events, false);
element.removeEventListener('msTransitionEnd', events, false);
element.removeEventListener('oTransitionEnd', events, false);
element.removeEventListener('otransitionend', events, false);
element.removeEventListener('transitionend', events, false);
window.removeEventListener('resize', events, false);
}
else {
window.onresize = null;
}
}
}
}
if ( window.jQuery || window.Zepto ) {
(function($) {
$.fn.Swipe = function(params) {
return this.each(function() {
$(this).data('Swipe', new Swipe($(this)[0], params));
});
}
})( window.jQuery || window.Zepto )
}
<?php
$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
if ($user_id != 0) {
$context['user_id'] = $user_id;
$context['consultant_id'] = $_GET['consultant_id'];
}
Timber::render('score.html', $context);
?>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<style></style>
<link rel="stylesheet" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ theme }}/css/star-rating.min.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/star-rating.min.js"></script>
<script>
$(document).ready(function () {
var score = $('#score');
score.rating({
size: 'xs',
showClear: false,
showCaption: false,
hoverEnabled: false,
readonly: true
});
var consultant_score = {{ consultant_score }};
var decimal = consultant_score % 0.5;
score.rating('update', consultant_score - decimal);
});
</script>
</head>
<body>
<p>{{ consultant_name }}</p>
<label for="score">星级</label>
<input type="hidden" id="score" name="score">
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
<a href="{{ consultant_score_url }}">评分</a>
<br>
</body>
</html>
\ No newline at end of file
...@@ -2,16 +2,22 @@ ...@@ -2,16 +2,22 @@
<html> <html>
<head lang="en"> <head lang="en">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> <meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title> <title>登录</title>
<style></style> <link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/form.css">
<script src="{{ theme }}/js/jquery.min.js"></script> <script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script> <script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('#loginForm').validate({ $('#loginForm').validate({
onkeyup: false,
onfocusout: false,
rules: { rules: {
phone: 'required', phone: 'required',
password: 'required' password: 'required'
...@@ -19,32 +25,59 @@ ...@@ -19,32 +25,59 @@
messages: { messages: {
phone: '请输入用户名', phone: '请输入用户名',
password: '请输入密码' password: '请输入密码'
},
errorLabelContainer: "#notice",
errorElement: 'span',
invalidHandler: function () {
myModal.modal('show');
},
submitHandler: function (form) {
form.submit();
} }
}); });
notice.bind('DOMNodeInserted',function(){
$(this).children(':not(:first)').remove();
});
myModal.on('hide.bs.modal',function(){
notice.children().remove();
});
}); });
</script> </script>
</head> </head>
<body> <body>
<form id="loginForm" method="post">
<p>
<label for="phone">用户名<br>
<input type="tel" name="phone" id="phone">
<label id="phone-error" class="error" for="phone">{{ phoneError }}</label>
</label>
</p>
<p> <div class="container-fluid text-center">
<label for="password">密码<br> <form id="loginForm" method="post">
<input type="password" name="password" id="password"> <h2>登录</h2>
<label id="password-error" class="error" for="password">{{ passwordError }}</label>
</label> <p class="has-feedback username">
</p> <label for="phone" class="sr-only">用户名</label>
<input type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="手机号码/账号">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback password">
<label for="password" class="sr-only">密码</label>
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<span class="form-control-feedback"></span>
</p>
<input type="submit" id="login_submit" value="登录" class="btn btn-lg btn-block">
<a href="{{ forget }}" class="link-fgtpwd">忘记密码?</a>
<a href="{{ register }}" class="link-register">
<span></span>新用户注册<span></span>
</a>
</form>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p id="notice"></p>
<button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
</div>
</div>
</div>
<p class="submit">
<input type="submit" id="login_submit" value="登录">
</p>
</form>
<a href="{{ register }}">注册</a>
<a href="{{ forget }}">忘记密码</a>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -2,16 +2,23 @@ ...@@ -2,16 +2,23 @@
<html> <html>
<head lang="en"> <head lang="en">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/> <meta name="viewport" content="width=360, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/> <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title> <title>注册</title>
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="{{ theme }}/css/form.css">
<script src="{{ theme }}/js/jquery.min.js"></script> <script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/jquery.validate.js"></script> <script src="{{ theme }}/js/jquery.validate.js"></script>
<script src="{{ theme }}/js/bootstrap.min.js"></script>
<script src="{{ theme }}/js/public.js"></script> <script src="{{ theme }}/js/public.js"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
var notice = $('#notice');
var myModal = $('#myModal');
$('#registerForm').validate({ $('#registerForm').validate({
onkeyup: false,
onfocusout: false,
rules: { rules: {
phone: { phone: {
required: true, required: true,
...@@ -23,42 +30,66 @@ ...@@ -23,42 +30,66 @@
password: 'required' password: 'required'
}, },
messages: { messages: {
phone: '请输入11位手机号', phone: '请输入11位手机号',
code: '请输入验证码', code: '请输入验证码',
password: '请输入密码' password: '请输入密码'
},
errorLabelContainer: "#notice",
errorElement: 'span',
invalidHandler: function () {
myModal.modal('show');
},
submitHandler: function (form) {
form.submit();
} }
}); });
notice.bind('DOMNodeInserted', function () {
$(this).children(':not(:first)').remove();
});
myModal.on('hide.bs.modal', function () {
notice.children().remove();
});
sendCodeBindClick("{{ url }}", 0); sendCodeBindClick("{{ url }}", 0);
}); });
</script> </script>
</head> </head>
<body> <body>
<form id="registerForm" method="post">
<p>
<label for="phone">用户名<br>
<input type="tel" name="phone" id="phone">
<label id="phone-error" class="error" for="phone">{{ phoneError }}</label>
</label>
</p>
<p> <div class="container-fluid text-center">
<label for="code">验证码<br> <form id="registerForm" method="post">
<input type="text" name="code" id="code"> <h2>注册</h2>
<label id="code-error" class="error" for="code">{{ codeError }}</label>
</label> <p class="has-feedback username">
<span id="send">发送验证码</span> <label for="phone" class="sr-only">用户名</label>
</p> <input type="tel" name="phone" id="phone" class="form-control input-lg" placeholder="手机号码">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback password">
<label for="password" class="sr-only">密码</label>
<input type="password" name="password" id="password" class="form-control input-lg" placeholder="密码">
<span class="form-control-feedback"></span>
</p>
<p class="has-feedback code">
<label for="code" class="sr-only">验证码</label>
<input type="text" name="code" id="code" class="form-control input-lg" placeholder="验证码">
<span id="send" class="form-control-feedback">发送验证码</span>
</p>
<input type="submit" id="register_submit" value="注册" class="btn btn-lg btn-block">
</form>
</div>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content text-center">
<h4>提示</h4>
<p> <p id="notice"></p>
<label for="password">密码<br> <button type="button" class="btn btn-lg btn-block" data-dismiss="modal">确认</button>
<input type="password" name="password" id="password"> </div>
<label id="password-error" class="error" for="password">{{ passwordError }}</label> </div>
</label> </div>
</p>
<p class="submit">
<input type="submit" id="register_submit" value="注册">
</p>
</form>
</body> </body>
</html> </html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<title></title>
<style></style>
<link rel="stylesheet" href="{{ theme }}/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ theme }}/css/star-rating.min.css">
<script src="{{ theme }}/js/jquery.min.js"></script>
<script src="{{ theme }}/js/star-rating.min.js"></script>
<script>
$(document).ready(function () {
var score = 0;
$('#score').rating({
min: 0,
max: 5,
step: 0.5,
size: 'xs',
showClear: false,
showCaption: false,
hoverEnabled: false,
starCaptions: function (data) {
console.log(data);
score = data;
$(this).val(score);
}
});
var scoreForm = $('#scoreForm');
scoreForm.submit(function () {
if (score > 0) {
$.ajax({
type: 'POST',
url: '{{ url }}/wp-admin/admin-ajax.php/',
data: 'action=add_score&' + scoreForm.serialize(),
success: function (data) {
if (data.code == 2000) {
alert('评分成功');
}else{
alert('不能重复评分');
}
}
});
} else {
alert('请选择评分');
}
return false;
});
});
</script>
</head>
<body>
<form id="scoreForm" method="post">
<br>
<label for="score">评分</label>
<input type="hidden" id="score" name="score" value="0">
<input type="hidden" name="user_id" value="{{ user_id }}">
<input type="hidden" name="consultant_id" value="{{ consultant_id }}">
<br>
<p class="submit">
<input type="submit" id="score_submit" value="提交">
</p>
</form>
</body>
</html>
\ No newline at end of file
...@@ -22,19 +22,6 @@ ...@@ -22,19 +22,6 @@
ds.onChange(); ds.onChange();
var viewForm = $('#viewForm'); var viewForm = $('#viewForm');
viewForm.validate({
rules: {
time: 'required'
},
messages: {
time: '请选择时间'
},
errorPlacement: function (error, element) {
console.log(error);
console.log(element);
alert('请选择时间');
}
});
viewForm.submit(function () { viewForm.submit(function () {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment