Permalink
Browse files

update to v0.4.3

  • Loading branch information...
1 parent 0124a5c commit 73a5f4604d2d2ce9dd75ab093c5b783cdf4ca872 @lihongxun945 committed Mar 24, 2016
Showing with 1,684 additions and 612 deletions.
  1. +1 −1 Gruntfile.js
  2. +1 −1 _config.yml
  3. +1 −1 docs/assets/js/docs.min.js
  4. +9 −0 docs/changelog.html
  5. +1 −1 docs/demos/city-picker.html
  6. +1 −1 docs/demos/swiper.html
  7. +87 −85 js/city-picker.js
  8. +90 −89 js/datetime-picker.js
  9. +1 −1 js/router.js
  10. +1,491 −431 js/swiper.js
  11. +1 −1 package.json
View
@@ -31,7 +31,7 @@ module.exports = function(grunt) {
banner: '/*!\n' +
' * =====================================================\n' +
- ' * light7 - http://light7.org/\n' +
+ ' * light7 V<%= pkg.version %> - http://light7.org/\n' +
' *\n' +
' * =====================================================\n' +
' */\n',
View
@@ -3,7 +3,7 @@ name: light7
authors: 任行
description: Build mobile apps with simple HTML, CSS, and JS components.
favicon: http://gtms04.alicdn.com/tps/i4/TB17MaDGpXXXXb7apXXAz6UFXXX-16-16.png
-version: 0.4.2
+version: 0.4.3
# Dependencies
highlighter: rouge
@@ -1,6 +1,6 @@
/*!
* =====================================================
- * light7 - http://light7.org/
+ * light7 0.4.3 - http://light7.org/
*
* =====================================================
*/
View
@@ -22,6 +22,15 @@ <h2 class="page-title">Changelog</h2>
<h2>Changelog</h2>
+ <h3>v0.4.3 - 2016-03-24</h3>
+ <ul>
+ <li>Fix bug: city picker bug with inital value.</li>
+ <li>There can be more than one city picker and datetime in the same page.</li>
+ <li>The router will ignore links with <code>href="javascript:;"</code></li>
+ <li>Swiper update to V3.3.1</li>
+ <li>Add Version Number in JS file</li>
+ </ul>
+
<h3>v0.4.2 - 2016-03-14</h3>
<p>This version focus on bug fix.</p>
<ul>
@@ -21,7 +21,7 @@ <h1 class='title'>City Picker</h1>
<div class="item-inner">
<div class="item-title label">省市区</div>
<div class="item-input">
- <input type="text" placeholder="" id='city-picker' />
+ <input type="text" value="广东 深圳 福田区" id='city-picker' />
</div>
</div>
</div>
@@ -11,7 +11,7 @@
<h1 class="title">Swiper</h1>
</header>
<div class="content" id=''>
- <div class="swiper-container" data-space-between='10' data-pagination=".swiper-pagination">
+ <div class="swiper-container" data-space-between='10' data-pagination=".swiper-pagination" data-loop="true">
<div class="swiper-wrapper">
<div class="swiper-slide"><img src="http://gqianniu.alicdn.com/bao/uploaded/i4//tfscom/i1/TB1n3rZHFXXXXX9XFXXXXXXXXXX_!!0-item_pic.jpg_640x640q60.jpg" alt="" style='width: 100%'></div>
<div class="swiper-slide"><img src="http://gqianniu.alicdn.com/bao/uploaded/i4//tfscom/i4/TB10rkPGVXXXXXGapXXXXXXXXXX_!!0-item_pic.jpg_640x640q60.jpg" alt="" style='width: 100%'></div>
View
@@ -3,112 +3,114 @@
+ function($) {
"use strict";
+
+ $.fn.cityPicker = function(params) {
+ return this.each(function() {
+ if(!this) return;
+ var format = function(data) {
+ var result = [];
+ for(var i=0;i<data.length;i++) {
+ var d = data[i];
+ if(d.name === "请选择") continue;
+ result.push(d.name);
+ }
+ if(result.length) return result;
+ return [""];
+ };
+ var sub = function(data) {
+ if(!data.sub) return [""];
+ return format(data.sub);
+ };
- var format = function(data) {
- var result = [];
- for(var i=0;i<data.length;i++) {
- var d = data[i];
- if(d.name === "请选择") continue;
- result.push(d.name);
- }
- if(result.length) return result;
- return [""];
- };
-
- var sub = function(data) {
- if(!data.sub) return [""];
- return format(data.sub);
- };
-
- var getCities = function(d) {
- for(var i=0;i< raw.length;i++) {
- if(raw[i].name === d) return sub(raw[i]);
- }
- return [""];
- };
+ var getCities = function(d) {
+ for(var i=0;i< raw.length;i++) {
+ if(raw[i].name === d) return sub(raw[i]);
+ }
+ return [""];
+ };
- var getDistricts = function(p, c) {
- for(var i=0;i< raw.length;i++) {
- if(raw[i].name === p) {
- for(var j=0;j< raw[i].sub.length;j++) {
- if(raw[i].sub[j].name === c) {
- return sub(raw[i].sub[j]);
+ var getDistricts = function(p, c) {
+ for(var i=0;i< raw.length;i++) {
+ if(raw[i].name === p) {
+ for(var j=0;j< raw[i].sub.length;j++) {
+ if(raw[i].sub[j].name === c) {
+ return sub(raw[i].sub[j]);
+ }
+ }
}
}
- }
- }
- return [""];
- };
+ return [""];
+ };
- var raw = $.smConfig.rawCitiesData;
- var provinces = raw.map(function(d) {
- return d.name;
- });
- var initCities = sub(raw[0]);
- var initDistricts = [""];
+ var raw = $.smConfig.rawCitiesData;
+ var provinces = raw.map(function(d) {
+ return d.name;
+ });
+ var initCities = sub(raw[0]);
+ var initDistricts = [""];
- var currentProvince = provinces[0];
- var currentCity = initCities[0];
- var currentDistrict = initDistricts[0];
-
- var defaults = {
+ var currentProvince = provinces[0];
+ var currentCity = initCities[0];
+ var currentDistrict = initDistricts[0];
- cssClass: "city-picker",
- rotateEffect: false, //为了性能
+ var defaults = {
- onChange: function (picker, values, displayValues) {
- var newProvince = picker.cols[0].value;
- var newCity;
- if(newProvince !== currentProvince) {
- var newCities = getCities(newProvince);
- newCity = newCities[0];
- var newDistricts = getDistricts(newProvince, newCity);
- picker.cols[1].replaceValues(newCities);
- picker.cols[2].replaceValues(newDistricts);
- currentProvince = newProvince;
- currentCity = newCity;
- picker.updateValue();
- return;
- }
- newCity = picker.cols[1].value;
- if(newCity !== currentCity) {
- picker.cols[2].replaceValues(getDistricts(newProvince, newCity));
- currentCity = newCity;
- picker.updateValue();
- }
- },
+ cssClass: "city-picker",
+ rotateEffect: false, //为了性能
+
+ onChange: function (picker, values, displayValues) {
+ var newProvince = values[0];
+ var newCity;
+ if(newProvince !== currentProvince) {
+ var newCities = getCities(newProvince);
+ newCity = newCities[0];
+ var newDistricts = getDistricts(newProvince, newCity);
+ picker.cols[1].replaceValues(newCities);
+ picker.cols[2].replaceValues(newDistricts);
+ currentProvince = newProvince;
+ currentCity = newCity;
+ picker.updateValue();
+ return;
+ }
+ newCity = picker.cols[1].value;
+ if(newCity !== currentCity) {
+ picker.cols[2].replaceValues(getDistricts(newProvince, newCity));
+ currentCity = newCity;
+ picker.updateValue();
+ }
+ },
+
+ cols: [
+ {
+ values: provinces,
+ cssClass: "col-province"
+ },
+ {
+ values: initCities,
+ cssClass: "col-city"
+ },
+ {
+ values: initDistricts,
+ cssClass: "col-district"
+ }
+ ]
+ };
- cols: [
- {
- values: provinces,
- cssClass: "col-province"
- },
- {
- values: initCities,
- cssClass: "col-city"
- },
- {
- values: initDistricts,
- cssClass: "col-district"
- }
- ]
- };
-
- $.fn.cityPicker = function(params) {
- return this.each(function() {
- if(!this) return;
var p = $.extend(defaults, params);
//计算value
var val = $(this).val();
if(val) {
p.value = val.split(" ");
if(p.value[0]) {
+ currentProvince = p.value[0];
p.cols[1].values = getCities(p.value[0]);
}
if(p.value[1]) {
+ currentCity = p.value[1];
p.cols[2].values = getDistricts(p.value[0], p.value[1]);
} else {
+ currentDistrict = p.value[2];
p.cols[2].values = getDistricts(p.value[0], p.cols[1].values[0]);
}
}
Oops, something went wrong.

0 comments on commit 73a5f46

Please sign in to comment.