ant是一个build工具,提高干活效率的好工具。
ant需要java运行环境。
在继续往下看之前的前提是你已经有安装好java环境了。
首先:需要下载Ant,解压到一个目录。(http://www.apache.org/dist/ant/binaries)
比如我解压到x:worklibant
准备工作完成。
接下来在你的工作目录创建一个build.bat文件。
SET PATH=X:worklibantbin;%PATH% SET ANT_HOME=X:worklibant ant -version ant pause
完成!,你可以在这个目录下创建你需要的build.xml文件。需要运行的时候双击build.bat。
最后说一下:build.bat是windows下的批处理文件,可以做很多事情(包括ant会的文件删除、创建、修改、合并等等)。
但是这次我们只是简单的利用批处理文件的修改文件查找路径(PATH变量),这样修改的只会在当前的cmd窗口中生效,
当关闭这个窗口之后所有的又回梦了。
这样做的好处是:
1、可以携带我们的ant在其他任意电脑上干活(只要把libant,还有你的项目目录随时携带,当然最好的方式是通过同步工具同步)。
2、还有个没有验证的好处是可以保持电脑的清洁,不太确定环境变量多了会不会影响电脑速度。
如果你看完这个方法之后觉得jdk也是个累赘的话也可以试试这样做。
在KISSY1.2中有16中中缓动函数。
先解释什么叫缓动函数。这个的从物理的角度描述了。
我们都知道自由落体运动,理想情况下,自由落体就是一个速度不断加快的运动。
用函数表示就Y=kX2
所有感觉很舒服的动画总会或多或少的使用各种缓动效果
Robert Penner 博士的缓动函数介绍
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
WIDTH="640" HEIGHT="480" id="easing_demo" ALIGN="">
使用缓动之后的动画会让人感觉很自然.
KISSY中的缓动函数定义在srcanimeasing.js
/**
* Uniform speed between points.
*/
easeNone: function (t) {
return t;
},
/**
* Begins slowly and accelerates towards end. (quadratic)
*/
easeIn: function (t) {
return t * t;
},
/**
* Begins quickly and decelerates towards end. (quadratic)
*/
easeOut: function (t) {
return ( 2 - t) * t;
},
/**
* Begins slowly and decelerates towards end. (quadratic)
*/
easeBoth: function (t) {
return (t *= 2) < 1 ?
.5 * t * t :
.5 * (1 - (--t) * (t - 2));
},
/**
* Begins slowly and accelerates towards end. (quartic)
*/
easeInStrong: function (t) {
return t * t * t * t;
},
/**
* Begins quickly and decelerates towards end. (quartic)
*/
easeOutStrong: function (t) {
return 1 - (--t) * t * t * t;
},
/**
* Begins slowly and decelerates towards end. (quartic)
*/
easeBothStrong: function (t) {
return (t *= 2) < 1 ?
.5 * t * t * t * t :
.5 * (2 - (t -= 2) * t * t * t);
},
/**
* Snap in elastic effect.
*/
elasticIn: function (t) {
var p = .3, s = p / 4;
if (t === 0 || t === 1) return t;
return -(pow(2, 10 * (t -= 1)) * sin((t - s) * (2 * PI) / p));
},
/**
* Snap out elastic effect.
*/
elasticOut: function (t) {
var p = .3, s = p / 4;
if (t === 0 || t === 1) return t;
return pow(2, -10 * t) * sin((t - s) * (2 * PI) / p) + 1;
},
/**
* Snap both elastic effect.
*/
elasticBoth: function (t) {
var p = .45, s = p / 4;
if (t === 0 || (t *= 2) === 2) return t;
if (t < 1) {
return -.5 * (pow(2, 10 * (t -= 1)) *
sin((t - s) * (2 * PI) / p));
}
return pow(2, -10 * (t -= 1)) *
sin((t - s) * (2 * PI) / p) * .5 + 1;
},
/**
* Backtracks slightly, then reverses direction and moves to end.
*/
backIn: function (t) {
if (t === 1) t -= .001;
return t * t * ((BACK_CONST + 1) * t - BACK_CONST);
},
/**
* Overshoots end, then reverses and comes back to end.
*/
backOut: function (t) {
return (t -= 1) * t * ((BACK_CONST + 1) * t + BACK_CONST) + 1;
},
/**
* Backtracks slightly, then reverses direction, overshoots end,
* then reverses and comes back to end.
*/
backBoth: function (t) {
if ((t *= 2 ) < 1) {
return .5 * (t * t * (((BACK_CONST *= (1.525)) + 1) * t - BACK_CONST));
}
return .5 * ((t -= 2) * t * (((BACK_CONST *= (1.525)) + 1) * t + BACK_CONST) + 2);
},
/**
* Bounce off of start.
*/
bounceIn: function (t) {
return 1 - Easing.bounceOut(1 - t);
},
/**
* Bounces off end.
*/
bounceOut: function (t) {
var s = 7.5625, r;
if (t < (1 / 2.75)) {
r = s * t * t;
}
else if (t < (2 / 2.75)) {
r = s * (t -= (1.5 / 2.75)) * t + .75;
}
else if (t < (2.5 / 2.75)) {
r = s * (t -= (2.25 / 2.75)) * t + .9375;
}
else {
r = s * (t -= (2.625 / 2.75)) * t + .984375;
}
return r;
},
/**
* Bounces off start and end.
*/
bounceBoth: function (t) {
if (t < .5) {
return Easing.bounceIn(t * 2) * .5;
}
return Easing.bounceOut(t * 2 - 1) * .5 + .5;
}
基本上KISSY已经把所有我们可能用的到的缓动函数都已经写好了.
由于各种已知的原因,论坛是需要审核发帖的,但是discuz的自带提醒需要一个个的添加:
后台——站长——后台管理团队——管理提醒
中可以设置
本次修改可以实现的功能:
1、自动获取相应版块的版主列表
2、当有需要的审核帖发布时发送提醒给版主
截图:
需要修改的地方:
1、增加一个提醒模板:
sourcelanguagelang_notification.php
在最后一行增加代码:
'system_thread_validating' => '有需要您审核的帖子呢!,点开这里看看吧,现在进行审核{actor}在{area}发表{subject}',
2、增加发帖判断:
sourceincludepostpost_newthread.php
在大概378行后面增加代码:
/*检查是否是需要审核贴,发送到相应版主 start*/
if($displayorder == -2){
//获取该区的版主列表
$query = DB::query("SELECT uid FROM ".DB::table('forum_moderator')." WHERE fid=".$_G[fid]);
while($moderator=DB::fetch($query)) {
notification_add($moderator['uid'], 'system', 'system_thread_validating', array('fid'=>$fid,'uid'=>$_G['uid'],'actor'=>$_G['username'],'area'=>$_G['forum']['name'],'subject'=>$subject), 1);
}
}
/*检查是否是需要审核贴,发送到相应版主 end*/
作用:设置一个命名空间,返回创建的对象
参数:
{String} 命名空间名字
{Boolean} 是否全局变量
举例:
KISSY.namespace('KISSY.app'); // returns KISSY.appKISSY.namespace('app.Shop'); // returns KISSY.app.ShopKISSY.namespace('TB.app.Shop', true); // returns TB.app.Shop
作用:方法,返回一个新的对象,这个对象基于app,有基本的一些KISSY方法,比如use、add、getScript、namespace
参数:
{String} 名称
{Object} 需要添加的静态方法
举例:
KISSY.app('xyz');KISSY.app('ttt',{a:1,b:2});
作用:输出东西到控制台,主要用于调试,一得要开启ks-debug才会有效 善用error可以比较好的调试,error会输出当前调用的堆栈
参数:
{String} msg 要输出的内容
{String} cat 日志类型(”info”, “warn”, “error”, “time”等等)(可选)
{String} src 来源,会在输出的日志前面加上一个前缀
举例:
KISSY.log('test');//test
KISSY.log('test','warn');//多一个红色的图标test
KISSY.log('test','error','form xx');//from xx:test
作用:抛出一个异常,throw的封装,同样需要开启ks-debug
参数:
{String} msg 要输出的内容
举例: 就不举例了
kissy的seed/kissy.js方法就分析完毕,后续会有更多的高级方法介绍。