btxui 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo.html +1 -0
- package/index.common.js +93 -0
- package/index.common.js.map +1 -0
- package/index.umd.js +104 -0
- package/index.umd.js.map +1 -0
- package/index.umd.min.js +2 -0
- package/index.umd.min.js.map +1 -0
- package/package.json +12 -23
- package/README.md +0 -42
- package/app.vue +0 -162
- package/assets/css/_main.js +0 -73
- package/assets/css/btx.min.css +0 -1
- package/assets/css/btx.mob.min.css +0 -1
- package/assets/css/btx.pad.min.css +0 -1
- package/assets/css/btx.webapp.min.css +0 -1
- package/assets/css/custom_fonts/iconfont.css +0 -37
- package/assets/css/custom_fonts/iconfont.eot +0 -0
- package/assets/css/custom_fonts/iconfont.svg +0 -47
- package/assets/css/custom_fonts/iconfont.ttf +0 -0
- package/assets/css/custom_fonts/iconfont.woff +0 -0
- package/assets/css/custom_fonts/iconfont.woff2 +0 -0
- package/assets/css/res-l.css +0 -47
- package/assets/css/res-m.css +0 -47
- package/assets/css/res-s.css +0 -61
- package/assets/custom_fonts/iconfont.css +0 -37
- package/assets/custom_fonts/iconfont.eot +0 -0
- package/assets/custom_fonts/iconfont.svg +0 -47
- package/assets/custom_fonts/iconfont.ttf +0 -0
- package/assets/custom_fonts/iconfont.woff +0 -0
- package/assets/custom_fonts/iconfont.woff2 +0 -0
- package/assets/js/Btx.js +0 -196
- package/assets/js/Utils.js +0 -421
- package/assets/js/fastclick.js +0 -802
- package/assets/js/lazy.min.js +0 -2
- package/assets/js/touchwipe.js +0 -111
- package/assets/server.js +0 -8
- package/assets/start_site_code_str.js +0 -119
- package/cdn/css/btx.min.css +0 -1
- package/cdn/css/btx.min.css.map +0 -1
- package/cdn/fonts/iconfont.ttf +0 -0
- package/cdn/fonts/iconfont.woff +0 -0
- package/cdn/fonts/iconfont.woff2 +0 -0
- package/components/BTXUI/app/app-wid.vue +0 -182
- package/components/BTXUI/btn/btn-wid.vue +0 -128
- package/components/BTXUI/carousel/carousel-wid.vue +0 -138
- package/components/BTXUI/checkbox/checkbox-wid.vue +0 -72
- package/components/BTXUI/confirm/confirm-wid.vue +0 -279
- package/components/BTXUI/content/content-checkbox-wid.vue +0 -44
- package/components/BTXUI/content/content-node-wid.vue +0 -114
- package/components/BTXUI/content/content-tag-wid.vue +0 -25
- package/components/BTXUI/content/content-wid.vue +0 -254
- package/components/BTXUI/core/anis/ani-fail.vue +0 -46
- package/components/BTXUI/core/anis/ani-loading.vue +0 -32
- package/components/BTXUI/core/anis/ani-notic.vue +0 -47
- package/components/BTXUI/core/anis/ani-success.vue +0 -48
- package/components/BTXUI/core/b-drag.vue +0 -258
- package/components/BTXUI/core/b-grid.vue +0 -84
- package/components/BTXUI/core/b-hot.vue +0 -171
- package/components/BTXUI/core/b-icon.vue +0 -76
- package/components/BTXUI/core/b-img.vue +0 -84
- package/components/BTXUI/core/b-input.vue +0 -198
- package/components/BTXUI/core/b-list.vue +0 -276
- package/components/BTXUI/core/b-text/doc.ts +0 -9
- package/components/BTXUI/core/b-text/index.vue +0 -16
- package/components/BTXUI/core/b-textarea.vue +0 -58
- package/components/BTXUI/core/b-video.vue +0 -35
- package/components/BTXUI/core/b-view/doc.ts +0 -10
- package/components/BTXUI/core/b-view/index.vue +0 -20
- package/components/BTXUI/core/b-webview.vue +0 -20
- package/components/BTXUI/core/lib/ChapterLink.js +0 -49
- package/components/BTXUI/core/lib/Search.vue +0 -60
- package/components/BTXUI/core/styles/doc.ts +0 -55
- package/components/BTXUI/core/styles/index.vue +0 -98
- package/components/BTXUI/core/styles/prestyles.ts +0 -471
- package/components/BTXUI/core/styles/theme.ts +0 -29
- package/components/BTXUI/drawer/drawer-wid.vue +0 -165
- package/components/BTXUI/drawer/title-tag-wid.vue +0 -114
- package/components/BTXUI/form/form-select-wid.vue +0 -57
- package/components/BTXUI/form/form-wid.vue +0 -324
- package/components/BTXUI/formPannel/form-pannel-wid.vue +0 -133
- package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +0 -149
- package/components/BTXUI/index.js +0 -83
- package/components/BTXUI/pageFlip/page-flip-wid.vue +0 -206
- package/components/BTXUI/pannel/pannel-wid.vue +0 -167
- package/components/BTXUI/range/range-wid.vue +0 -134
- package/components/BTXUI/search/search-wid.vue +0 -80
- package/components/BTXUI/select/select-wid.vue +0 -186
- package/components/BTXUI/slider/slider-wid.vue +0 -444
- package/components/BTXUI/tab/tab-wid.vue +0 -109
- package/components/BTXUI/table/table-wid.vue +0 -324
- package/components/BTXUI/tag/tag-wid.vue +0 -183
- package/components/BTXUI/tags/tags-wid.vue +0 -121
- package/components/BTXUI/tooltip/tooltip-wid.vue +0 -146
- package/components/BTXUI/upload/upload-wid.vue +0 -215
- package/components/BTXUI/waterfall/waterfall-wid.vue +0 -166
- package/components/header-info.vue +0 -167
- package/composables/@types.ts +0 -4
- package/composables/api.ts +0 -18
- package/env.d.ts +0 -5
- package/main.js +0 -16
- package/nuxt.config.ts +0 -51
- package/pages/article.vue +0 -16
- package/pages/download.vue +0 -50
- package/pages/example/app_wid/app/data_demo.vue +0 -9
- package/pages/example/app_wid/app/download_demo.vue +0 -9
- package/pages/example/app_wid/app/list_demo.vue +0 -11
- package/pages/example/app_wid/app/system_demo.vue +0 -9
- package/pages/example/app_wid/app_wid_demo.vue +0 -198
- package/pages/example/app_wid/btn_wid_demo.vue +0 -179
- package/pages/example/app_wid/carousel_wid_demo.vue +0 -152
- package/pages/example/app_wid/checkbox_wid_demo.vue +0 -65
- package/pages/example/app_wid/confirm_wid_demo.vue +0 -197
- package/pages/example/app_wid/content_wid_demo.vue +0 -369
- package/pages/example/app_wid/drawer_wid_demo.vue +0 -155
- package/pages/example/app_wid/form_pannel_wid_demo.vue +0 -338
- package/pages/example/app_wid/form_wid_demo.vue +0 -550
- package/pages/example/app_wid/imgs_upload_wid_demo.vue +0 -159
- package/pages/example/app_wid/index.js +0 -158
- package/pages/example/app_wid/page_flip_wid_demo.vue +0 -99
- package/pages/example/app_wid/pannel_wid_demo.vue +0 -177
- package/pages/example/app_wid/range_wid_demo.vue +0 -101
- package/pages/example/app_wid/search_wid_demo.vue +0 -75
- package/pages/example/app_wid/select_wid_demo.vue +0 -217
- package/pages/example/app_wid/slider_wid_demo.vue +0 -143
- package/pages/example/app_wid/tab_wid_demo.vue +0 -170
- package/pages/example/app_wid/table_wid_demo.vue +0 -377
- package/pages/example/app_wid/tag_wid_demo.vue +0 -133
- package/pages/example/app_wid/tags_wid_demo.vue +0 -143
- package/pages/example/app_wid/tooltip_wid_demo.vue +0 -117
- package/pages/example/app_wid/upload_wid_demo.vue +0 -123
- package/pages/example/base_wid/b_drag_demo.vue +0 -159
- package/pages/example/base_wid/b_grid_demo.vue +0 -225
- package/pages/example/base_wid/b_hot_demo.vue +0 -135
- package/pages/example/base_wid/b_icon_demo.vue +0 -80
- package/pages/example/base_wid/b_img_demo.vue +0 -95
- package/pages/example/base_wid/b_input_demo.vue +0 -171
- package/pages/example/base_wid/b_list_demo.vue +0 -241
- package/pages/example/base_wid/b_style_demo.vue +0 -928
- package/pages/example/base_wid/b_text_demo.vue +0 -36
- package/pages/example/base_wid/b_textarea_demo.vue +0 -64
- package/pages/example/base_wid/b_video_demo.vue +0 -42
- package/pages/example/base_wid/b_view_demo.vue +0 -36
- package/pages/example/base_wid/index.js +0 -76
- package/pages/example/content.js +0 -49
- package/pages/example/global_style/animation.vue +0 -197
- package/pages/example/global_style/color.vue +0 -134
- package/pages/example/global_style/decoration.vue +0 -546
- package/pages/example/global_style/icon.vue +0 -345
- package/pages/example/global_style/index.js +0 -52
- package/pages/example/global_style/layout.vue +0 -846
- package/pages/example/global_style/special.vue +0 -37
- package/pages/example/global_style/table.vue +0 -298
- package/pages/example/global_style/text.vue +0 -159
- package/pages/index.vue +0 -43
- package/pages/level_widget.vue +0 -11
- package/pages/start.vue +0 -200
- package/plugins/index.ts +0 -2
- package/public/favicon.gif +0 -0
- package/public/fonts/iconfont.ttf +0 -0
- package/public/fonts/iconfont.woff +0 -0
- package/public/fonts/iconfont.woff2 +0 -0
- package/public/img/banner.jpg +0 -0
- package/public/img/banner2.jpg +0 -0
- package/public/img/bg_pattern.png +0 -0
- package/public/img/btx.jpg +0 -0
- package/public/img/btx_ui.jpg +0 -0
- package/public/img/dir.png +0 -0
- package/public/img/f.png +0 -0
- package/public/img/head.jpg +0 -0
- package/public/img/head2.jpg +0 -0
- package/public/img/home_ico.png +0 -0
- package/public/img/icons.svg +0 -164
- package/public/img/mechanism/b-style.png +0 -0
- package/public/img/mechanism/slider-wid.png +0 -0
- package/public/img/mechanism/upload-wid.png +0 -0
- package/public/img/transform_origin.png +0 -0
- package/sass/animation.scss +0 -400
- package/sass/btx.mob.scss +0 -10
- package/sass/btx.pad.scss +0 -3
- package/sass/btx.scss +0 -22
- package/sass/btx.webapp.scss +0 -22
- package/sass/colors.scss +0 -65
- package/sass/decoration.scss +0 -220
- package/sass/flex.scss +0 -29
- package/sass/icons.scss +0 -100
- package/sass/layout.scss +0 -88
- package/sass/reset.scss +0 -111
- package/sass/response/flex_mixin.scss +0 -91
- package/sass/response/layout_mixin.scss +0 -227
- package/sass/response/main.scss +0 -59
- package/sass/response/text_mixin.scss +0 -65
- package/sass/scroll.scss +0 -100
- package/sass/special.scss +0 -13
- package/sass/table.scss +0 -103
- package/sass/text.scss +0 -86
- package/sass/webpack.config.js +0 -31
- package/tsconfig.json +0 -4
package/assets/js/Utils.js
DELETED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
//基本常用函数库
|
|
2
|
-
|
|
3
|
-
var BTXUtils = {
|
|
4
|
-
"str":{}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* 默认支持追加前导0,也可以追加其它字符,追加数目依据:limit长度 - 原字符长度;
|
|
9
|
-
* 若追加数目计算为0或负数,则直接返回原字符串str;
|
|
10
|
-
* padchar限制为单个字符,否则同样以0代替;
|
|
11
|
-
*/
|
|
12
|
-
BTXUtils.pad_zero = function(str, limit, padchar){//追加前导零或其它字符
|
|
13
|
-
str = String(str);
|
|
14
|
-
padchar = padchar || 0;
|
|
15
|
-
padchar = String(padchar);
|
|
16
|
-
padchar = padchar.length == 1?padchar:"0";
|
|
17
|
-
var pad_len = limit - str.length, _padchar="";
|
|
18
|
-
if(pad_len <= 0) return str;
|
|
19
|
-
for(var i=0; i<pad_len; i++)
|
|
20
|
-
{
|
|
21
|
-
_padchar += padchar;
|
|
22
|
-
}
|
|
23
|
-
return _padchar + str;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
BTXUtils.hex2rgb = function(colour){//将16进制颜色值转换为rgb颜色值
|
|
27
|
-
var r, g, b;
|
|
28
|
-
if(colour[0] == '#') {
|
|
29
|
-
colour = colour.substr(1);
|
|
30
|
-
}
|
|
31
|
-
if(colour.length == 6) {
|
|
32
|
-
r = colour[0] + colour[1];
|
|
33
|
-
g = colour[2] + colour[3];
|
|
34
|
-
b = colour[4] + colour[5];
|
|
35
|
-
}
|
|
36
|
-
else if (colour.length == 3) {
|
|
37
|
-
r = colour[0] + colour[0];
|
|
38
|
-
g = colour[1] + colour[1];
|
|
39
|
-
b = colour[2] + colour[2];
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
r = parseInt(r, 16);
|
|
45
|
-
g = parseInt(g, 16);
|
|
46
|
-
b = parseInt(b, 16);
|
|
47
|
-
return {'red':r, 'green':g, 'blue':b};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/*----------------------------常用工具函数-----------------------------*/
|
|
51
|
-
|
|
52
|
-
//将两个数组合并为对象,其中一个数组元素作为对象键值,另一个数组元素作为对象键名
|
|
53
|
-
function array_combine(arr1,arr2){
|
|
54
|
-
var obj = {};
|
|
55
|
-
var len;
|
|
56
|
-
if(arr1 instanceof Array && arr2 instanceof Array){//两个数组参数都必须为数组
|
|
57
|
-
len = Math.min(arr1.length,arr2.length);
|
|
58
|
-
for(var i =0;i<len;i++){
|
|
59
|
-
obj[arr1[i]] = arr2[i];
|
|
60
|
-
}
|
|
61
|
-
return obj;
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//判断数组中是否有重复元素
|
|
67
|
-
function array_repeat(arr){
|
|
68
|
-
for(var i=0; i<arr.length; i++){
|
|
69
|
-
for(var j=i+1; j<arr.length; j++){
|
|
70
|
-
if(arr[i] && arr[j] && arr[i] == arr[j]) return true;//元素值需有效
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
//字符串替换
|
|
77
|
-
/*
|
|
78
|
-
* 支持多字符替换,基于替换映射表
|
|
79
|
-
*/
|
|
80
|
-
function str_replace(str, replace_base_table){
|
|
81
|
-
var _return_str = "";
|
|
82
|
-
for(var i= 0, tmp_str_arr = str.split(""); i<tmp_str_arr.length; i++){
|
|
83
|
-
if(tmp_str_arr[i] in replace_base_table){
|
|
84
|
-
_return_str += replace_base_table[tmp_str_arr[i]];
|
|
85
|
-
}else{
|
|
86
|
-
_return_str += tmp_str_arr[i];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return _return_str;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/*----------------------------------------------------------------------------------------------------------------*/
|
|
93
|
-
|
|
94
|
-
/*
|
|
95
|
-
* 数字系列拓展函数
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
//函数有效化执行
|
|
99
|
-
/*
|
|
100
|
-
* [number number]:数值
|
|
101
|
-
* [number len]:小数点保留位数
|
|
102
|
-
* [boolean round]:整数数值是否启用小数部分隐藏
|
|
103
|
-
*/
|
|
104
|
-
function number_fixed(number, len, round){
|
|
105
|
-
if(typeof(number) == "number"){
|
|
106
|
-
number = number.toFixed(len);
|
|
107
|
-
}
|
|
108
|
-
if(round && parseInt(number.split(".")[1])==0){//整数值不显示小数部分
|
|
109
|
-
number = Math.round(number);
|
|
110
|
-
}
|
|
111
|
-
return number;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
//随机生成指定位数数字
|
|
115
|
-
/*
|
|
116
|
-
* [number n]: 位数
|
|
117
|
-
*/
|
|
118
|
-
function rand_number(n){
|
|
119
|
-
var Num="";
|
|
120
|
-
for(var i=0;i<n;i++){
|
|
121
|
-
Num+=Math.floor(Math.random()*10);
|
|
122
|
-
}
|
|
123
|
-
return Num;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
//----------------------------字符串扩展函数-----------------------------
|
|
127
|
-
|
|
128
|
-
//字符串首字母小写
|
|
129
|
-
String.prototype.lower_c = function(){
|
|
130
|
-
return this.replace(this[0], this[0].toLowerCase());
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
//字符串首字母大写
|
|
135
|
-
String.prototype.upper_c = function(){
|
|
136
|
-
return this.replace(this[0], this[0].toUpperCase());
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
//反转字符串
|
|
141
|
-
String.prototype.reverse = function(){
|
|
142
|
-
return this.split("").reverse().join("");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/*
|
|
147
|
-
* 字符串左侧空白截除
|
|
148
|
-
* [string slice]: 截取移除字符串
|
|
149
|
-
*/
|
|
150
|
-
String.prototype.ltrim = function(slice){
|
|
151
|
-
var str = this.replace(/^\s+/, "");
|
|
152
|
-
|
|
153
|
-
if(slice && str.search(slice.replace("[", "\\[").replace("$", "\\$").replace("(", "\\(")) == 0){
|
|
154
|
-
var strlen = slice.length;
|
|
155
|
-
str = str.substr(strlen);
|
|
156
|
-
}
|
|
157
|
-
return str;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
//字符串右侧空白截除
|
|
162
|
-
String.prototype.rtrim = function(slice){
|
|
163
|
-
var str = this.replace(/\s+$/, ""),
|
|
164
|
-
rstr = str.reverse();
|
|
165
|
-
|
|
166
|
-
if(slice && rstr.search(slice.reverse().replace("[", "\\[").replace(")", "\\)")) == 0){
|
|
167
|
-
var strlen = slice.length;
|
|
168
|
-
|
|
169
|
-
str = rstr.substr(strlen).reverse();
|
|
170
|
-
}
|
|
171
|
-
return str;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
//字符串两侧空白截除
|
|
176
|
-
String.prototype.trim = function(slice){
|
|
177
|
-
return (this.ltrim(slice)).rtrim(slice);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
//字符串首字母大写
|
|
182
|
-
String.prototype.capitalize = function(){
|
|
183
|
-
return this[0].toUpperCase() + this.substr(1);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
//----------------------------数组扩展函数-----------------------------
|
|
187
|
-
|
|
188
|
-
//获取数组元素中的最大值
|
|
189
|
-
Array.prototype.max = function(){
|
|
190
|
-
this.sort(function(a, b){
|
|
191
|
-
return b - a
|
|
192
|
-
});
|
|
193
|
-
return this[0];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
//获取数组元素中的最小值
|
|
198
|
-
Array.prototype.min = function(){
|
|
199
|
-
this.sort(function(a, b){
|
|
200
|
-
return a - b
|
|
201
|
-
});
|
|
202
|
-
return this[0];
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
//获取最后一个数组元素值
|
|
207
|
-
Array.prototype.end = function(){
|
|
208
|
-
return this[this.length-1];
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
//判断数组是否包含指定数据
|
|
213
|
-
/*
|
|
214
|
-
* 【使用】:
|
|
215
|
-
* 1. 支持严格比较(数据类型匹配)
|
|
216
|
-
* */
|
|
217
|
-
Array.prototype.in_array = function(d, strict){
|
|
218
|
-
var i;
|
|
219
|
-
|
|
220
|
-
if(i = this.indexOf(d) != -1){
|
|
221
|
-
return strict?( this[i] === d?true:false ):true;
|
|
222
|
-
}else{
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
//----------------------------主执行-----------------------------
|
|
228
|
-
|
|
229
|
-
var e_lib = {//兼容性事件库
|
|
230
|
-
"animation": window.Modernizr.prefixed("animation").lower_c(),
|
|
231
|
-
"transition": window.Modernizr.prefixed("transition").lower_c(),
|
|
232
|
-
"down": ("touchstart" in document? "touchstart": "mousedown"),
|
|
233
|
-
"up": ("ontouchend" in document? "touchend": "mouseup"),
|
|
234
|
-
"click":"click"
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
/*----------------------------工具函数-----------------------------*/
|
|
238
|
-
|
|
239
|
-
//获取视口高度
|
|
240
|
-
function view_height(){
|
|
241
|
-
return document.documentElement.clientHeight || document.body.clientHeight || window.innerHeight;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
//居中视口
|
|
246
|
-
function center($dom){
|
|
247
|
-
var view_h = this.view_height(),
|
|
248
|
-
view_w = document.documentElement.clientWidth || document.body.clientWidth || window.innerWidth,
|
|
249
|
-
dom = $dom[0];
|
|
250
|
-
|
|
251
|
-
$dom.css({"top": (view_h - dom.clientHeight)*.5, "left": (view_w - dom.clientWidth)*.5});
|
|
252
|
-
return $dom;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
//报错抛出
|
|
257
|
-
function error(msg){
|
|
258
|
-
throw new Error(msg);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
//快速console.log
|
|
263
|
-
function c(str){ console.log(str) }
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
//快速console.dir
|
|
267
|
-
function dir(str){ console.dir(str) }
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
//适配h5兼容性事件
|
|
271
|
-
/*
|
|
272
|
-
* String ev:事件名前缀
|
|
273
|
-
* String name:事件名后缀
|
|
274
|
-
*/
|
|
275
|
-
function e(ev, name){
|
|
276
|
-
if(arguments.length == 2){//含前缀判断
|
|
277
|
-
if(!(ev+name in e_lib)) e_lib[ev+name] = e_lib[ev] + (e_lib[ev].search(ev) != 0?name.upper_c:name);
|
|
278
|
-
return e_lib[ev+name];
|
|
279
|
-
}else{//响应式事件判断(基于鼠标交互/触屏交互)
|
|
280
|
-
return e_lib[ev];
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
//字节转换
|
|
286
|
-
function to_bit(v){
|
|
287
|
-
var d = v.match(/[\d\.]+/)[0],
|
|
288
|
-
unit = v.split(d)[1],
|
|
289
|
-
b = 1;
|
|
290
|
-
|
|
291
|
-
switch(unit.toLowerCase()){
|
|
292
|
-
case "kb": b = 1000;
|
|
293
|
-
break;
|
|
294
|
-
case "m": b = 1000000;
|
|
295
|
-
break;
|
|
296
|
-
case "g": b = 1000000000;
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
return d * b;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
//函数有效化执行
|
|
304
|
-
/*
|
|
305
|
-
* function fn: 自定义函数
|
|
306
|
-
* mixed arg: 自定义函数传参,可为任意类型
|
|
307
|
-
* object call: this指针绑定对象
|
|
308
|
-
* int delay: 延迟时间,单位毫秒
|
|
309
|
-
*/
|
|
310
|
-
function exefn(fn, arg, call, delay){
|
|
311
|
-
var exe = function(){ call?fn.call(call, arg || null):fn(arg || null) }
|
|
312
|
-
if(fn instanceof Function){
|
|
313
|
-
if(delay){
|
|
314
|
-
var t = setTimeout(function(){
|
|
315
|
-
clearTimeout(t);
|
|
316
|
-
exe();
|
|
317
|
-
}, delay);
|
|
318
|
-
}else{
|
|
319
|
-
exe();
|
|
320
|
-
}
|
|
321
|
-
}else{
|
|
322
|
-
console.error("fn si not a function!");
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
//判断对象是否为dom对象或jquery封装的dom对象
|
|
327
|
-
function is_dom(ele){
|
|
328
|
-
return ele && ((ele.jquery && ele[0]) || ele.nodeType == 1)?true:false;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
//获取手机屏方向
|
|
332
|
-
function viewport_orientation(){
|
|
333
|
-
return viewport_height() > document.body.clientWidth?"v":"h";
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
//判断手机屏方向
|
|
337
|
-
function viewport_orientation_judge(dir){
|
|
338
|
-
return dir == viewport_orientation()?true:false;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
//获取路径目录
|
|
342
|
-
function basename(url){
|
|
343
|
-
var tmp_arr = url.split("/");
|
|
344
|
-
tmp_arr.pop();
|
|
345
|
-
return tmp_arr.join("/")+"/";
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/*css类处理*/
|
|
349
|
-
|
|
350
|
-
//模糊提取对象指定css类
|
|
351
|
-
/*
|
|
352
|
-
* [mixed ele]: 操作对象或选择器
|
|
353
|
-
* [class_str]: 见:regexp_class()
|
|
354
|
-
* [pos]: 见:regexp_class()
|
|
355
|
-
* [string return]
|
|
356
|
-
*/
|
|
357
|
-
function match_class(ele, class_str, pos){
|
|
358
|
-
ele = _jquery(ele);
|
|
359
|
-
if(ele){
|
|
360
|
-
return (ele.tem_reg = regexp_class(class_str, pos).exec(ele.attr("class")))?ele.tem_reg[0]:"";
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
//获取对象css类匹配正则
|
|
365
|
-
/*
|
|
366
|
-
* [string class_str]: css类名片段
|
|
367
|
-
* [string<"after", "before", null> pos]: 匹配位置
|
|
368
|
-
* [Regexp return]
|
|
369
|
-
*/
|
|
370
|
-
function regexp_class(class_str, pos){
|
|
371
|
-
if(pos == "after"){//尾匹配
|
|
372
|
-
return RegExp("\\b"+class_str+"\\w+\\b");
|
|
373
|
-
}else if(pos == "before"){//头匹配
|
|
374
|
-
return RegExp("\\b\\w+"+class_str+"\\b");
|
|
375
|
-
}else{//身匹配
|
|
376
|
-
return RegExp("\\b\\w+"+class_str+"\\w+\\b");
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
//取消图片缓存
|
|
381
|
-
/*
|
|
382
|
-
* string img: 图片元素
|
|
383
|
-
* string src: 图片src
|
|
384
|
-
*/
|
|
385
|
-
function cancel_img_cache(img, src){
|
|
386
|
-
img = _jquery(img);
|
|
387
|
-
img.attr("src", src+"?random="+Math.random()*1000);
|
|
388
|
-
img.next().before(img);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
//格式化时间
|
|
392
|
-
/*
|
|
393
|
-
* [string format_str]: 时间格式
|
|
394
|
-
* [number timestamp]: 时间戳
|
|
395
|
-
* [string return]
|
|
396
|
-
* 支持: php生成10位时间戳自动转换
|
|
397
|
-
*/
|
|
398
|
-
function date(format_str, timestamp){
|
|
399
|
-
var fTime, fStr = 'ymdhis';
|
|
400
|
-
if(!format_str) format_str = "y-m-d h:i:s";
|
|
401
|
-
fTime = timestamp?new Date(timestamp.length == 10?timestamp*1000:timestamp):new Date();
|
|
402
|
-
var format = function(v){//时间格式统一为2位,以保证格式整洁
|
|
403
|
-
return v.length == 1?"0"+v:v;
|
|
404
|
-
}
|
|
405
|
-
var formatArr = [
|
|
406
|
-
fTime.getFullYear().toString().substr(2),//年份显示后2位
|
|
407
|
-
format((fTime.getMonth()+1).toString()),
|
|
408
|
-
format(fTime.getDate().toString()),
|
|
409
|
-
format(fTime.getHours().toString()),
|
|
410
|
-
format(fTime.getMinutes().toString()),
|
|
411
|
-
format(fTime.getSeconds().toString())
|
|
412
|
-
]
|
|
413
|
-
for(var i=0; i<formatArr.length; i++){
|
|
414
|
-
format_str = format_str.replace(fStr.charAt(i), formatArr[i]);
|
|
415
|
-
}
|
|
416
|
-
return format_str;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|