.window Class
Item Index
Methods
- add_url_params static
- cloneDate static
- del_url_param static
- easyEffect static
- formatISODate static
- get_url_param static
- has_url_param static
- httpRequire static
- isSameDay static
- isSameMonth static
- maxDayOfMonth static
- pad_char_f static
- parse_finance_num static
- parseBool
- parseISODate static
- printf static
- reload_page static
- removeUrlSharp static
- script_path_f static
Methods
add_url_params
(
static
-
_url
-
$params
添加URL参数
require: del_url_param
Example:
var url = add_url_params( location.href, {'key1': 'key1value', 'key2': 'key2value' } );
del_url_param
(
static
-
$url
-
$key
删除URL参数
Example:
var url = del_url_param( location.href, 'tag' );
easyEffect
(
static
-
_cb
-
_maxVal
-
_startVal
-
_duration
-
_stepMs
缓动函数, 动画效果为按时间缓动
这个函数只考虑递增, 你如果需要递减的话, 在回调里用 _maxVal - _stepval
Parameters:
Returns:
interval
Example:
$(document).ready(function(){
window.js_output = $('span.js_output');
window.ls = [];
window.EFF_INTERVAL = easyEffect( effectcallback, 100);
});
function effectcallback( _stepval, _done ){
js_output.html( _stepval );
ls.push( _stepval );
!_done && js_output.html( _stepval );
_done && js_output.html( _stepval + '<br />' + ls.join() );
}
formatISODate
(
static
-
_date
-
_split
格式化日期为 YYYY-mm-dd 格式
require: pad_char_f
Returns:
string
get_url_param
(
static
-
$url
-
$key
取URL参数的值
require: del_url_param
Example:
var defaultTag = get_url_param(location.href, 'tag');
has_url_param
(
static
-
_url
-
_key
判断URL中是否有某个get参数
Example:
var bool = has_url_param( 'getkey' );
httpRequire
(
static
-
_msg
提示需要 HTTP 环境
Parameters:
-
_msg
String要提示的文字, 默认 "本示例需要HTTP环境'
Returns:
bool 如果是HTTP环境返回true, 否则返回false
isSameDay
(
Bool
static
-
_d1
-
_d2
判断两个日期是否为同一天
Returns:
Bool:
isSameMonth
(
Bool
static
-
_d1
-
_d2
判断两个日期是否为同一月份
Returns:
Bool:
pad_char_f
(
static
-
_str
-
_len
-
_char
js 附加字串函数 padcharf
Returns:
string
parse_finance_num
(
static
-
$i
-
$dot
取小数点的N位,
JS 解析 浮点数的时候,经常出现各种不可预知情况,这个函数就是为了解决这个问题
Parameters:
-
$i
Number -
$dot
Int
Returns:
number
parseBool
(
-
_input
把输入值转换为布尔值
Parameters:
-
_input
Returns:
bool
printf
(
static
-
_str
按格式输出字符串
Parameters:
-
_str
String
Example:
printf( 'asdfasdf{0}sdfasdf{1}', '000', 1111 );
//return asdfasdf000sdfasdf1111
reload_page
(
static
-
$url
-
$nornd
-
$delayms
重载页面
require: removeUrlSharp
require: add_url_params
Parameters:
-
$url
String -
$nornd
Bool -
$delayms
Int
removeUrlSharp
(
static
-
$url
-
$nornd
删除 URL 的锚点
require: add_url_params
Parameters:
-
$url
String -
$nornd
Bool是否不添加随机参数
Returns:
string