DOM 对象的 clientHeight 包括:content+padding,offsetHeight 包括:content+padding+border
 
 
 /**
  * 禁止输入汉字
  */
 appUtils.bindEvent($(_pageId+" #test"),function(e){
 e = window.event || e;
 if(!/[\u4e00-\u9fa5]+/.test(e.data))
 {
 return false;
 }
 e.stopPropagation();
 }, "textInput");
 
 
 app store 上架流程:
 到https://itunesconnect.apple.com,添加新的app,选择对应的app id,(打包时候对应的app id)填写简介,
 搜素关键字,上传ip4(3.5寸,640x960)的介绍图片,不一定是截图,1-5张,ip5(4寸,640x1136)图片,1-5张,
 填写联系人资料,邮件,电话,选择项目(金融,教育,游戏等等)选择内容分级(一般所有都是no),最后使
 用xcode或者application loader(mac专用的上传工具),上传程序,正确上传完成之后,回到https://itunesconnect.apple.com,
 有个选择程序build的选项,选中你上传的正确文件(可以传多个,build不一样就行,只能选中一个),最后点申请审核,
 出现wait for review表示进入了审核流程
 必须要给苹果提供测试账号,如果没有测试账号,会麻烦很多,苹果审核人员是不会真的帮你开户的,他们会坚持让你给测试账号,
 如果实在没有,他们会找你要一堆的资料,最后要你录制接收短信,填写验证码的视频,或者直接录制从填电话号码到开户完成的视频...
 一般最后还是要录,因为他们也不会真的视频然后开户(貌似他们审核用的是模拟器,不能视频),但是有给测试账号,前期会被少打回几次
 
 
 如果一个 JSON 对象格式类似于:
 {
   "0": 1,
   "1": 2,
   "2": 3,
   "length": 3
 }时,可以用数组的 slice 方法将该对象转换成一个数组对象,如:
 var test = {
   "0": 1,
   "1": 2,
   "2": 3,
   "length": 3,
   "wx": 1
 };
 Array.prototype.slice.call(test); // 结果为:[1, 2, 3]
 上述代码中,JSON 对象不能缺少 length 否则,否则转换后的数组长度为 0。
 
 
 js 获取变量的数据类型的方法:Object.prototype.toString.call(变量).slice(8, -1),如:
 Object.prototype.toString.call("").slice(8, -1) // String
 Object.prototype.toString.call(11).slice(8, -1) // Number
 
 
 当对 z-index 较大的元素绑定了 touch 事件时,点击该元素会触发该元素底下一层的 click 事件,处理方法是:
 当处理一系列触摸操作时,为了阻止鼠标事件(click)的触发,可以在touchstart 或第一个 touchmove中调用preventDefault(),更适合的做法
 是在touchmove中调用preventDefault(),不能在 touchend 事件中调用阻止冒泡的方法。
 
 
 <a href=”tel://110 ”>拨打电话</a>
 
 
 a 标签嵌套 img 时,会出现下边距的问题的解决办法:
 所谓的下边距是西文排版中的基线和底部之间的距离,设置 img 的 vertical-align: bottom;或者设置 a 的 line-height:0;
 
 
 为动画DOM元素添加CSS3样式-webkit-transform:transition3d(0,0,0)或-webkit-transform:translateZ(0);,这两个属性都会开启GPU硬件加速模式,
 从而让浏览器在渲染动画时从CPU转向GPU,其实说白了这是一个小伎俩,也可以算是一个Hack,-webkit-transform:transition3d和-webkit-transform:translateZ
 其实是为了渲染3D样式,但我们设置值为0后,并没有真正使用3D效果,但浏览器却因此开启了GPU硬件加速模式。
 对所有动画DOM元素添加-webkit-transform:transition3d(0,0,0)开启GPU硬件加速之后,又出现了一个chrome诡异的Bug,
 当你有多个position:absolute;元素添加-webkit-transform:transition3d(0,0,0);开启GPU硬件加速之后,会有几个元素凭空消失。
 
 
 touch 事件在手机上点透问题的处理:
 1、一般手机对 touchstart 或者 touchmove 阻止默认行为即可解决点透的问题
 2、魅族3 使用方法一之后,问题仍然继续,原因是 mousedown 比 touchstart 先触发,要处理 mousedown 事件来
 解决点透的问题
 
 
 ant 打包脚本:
 title Android 打包
 set ANT_HOME=D:\software\mywork\apache-ant-1.9.3
 set path=%ANT_HOME%/bin;c:\windows\system32;D:\software\mywork\jdk64\jdk1.6.0_45\bin;
 D:
 cd D:\software\mywork\adt-bundle-windows-x86_64-20130917\sdk\tools 
 rem 进入sdk\tools目录,执行如下命令,将生成  build.xml,local.properties,proguard-project.txt 三个文件
 android update project -p D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat -t android-19 -n com.thinkive.mobile.account_fz --subprojects
 android update project -p D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\app_engine -t android-19 -n com.thinkive.android.app_engine
 android update project -p D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat_MobileAccount3.0 -t android-19 -n com.thinkive.mobile.account
 android update project -p D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\newprice_fz -t android-19 -n com.fund.android.price
 rem invalid resource directory name: F:\workspace\Zlib\bin\res/crunch
 rem 在 build.xml 文件中赋值<property name="aapt.ignore.assets" value="crunch" />
 rem 清理工程
 ant clean -buildfile D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat\build.xml
 rem 打 debug 包
 ant debug -buildfile D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat\build.xml
 rem 打发行版
 ant release -buildfile D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat\build.xml
 配置
 ant com.thinkive.mobile.account_fz -buildfile D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat\build.xml
 
 
 cd D:\software\mywork\jdk64\jdk1.6.0_45\bin
 rem 校验是否已签名
 jarsigner -verify com.thinkive.mobile.account_fz-release.apk
 jarsigner -verify com.thinkive.mobile.account_fz-debug.apk
 pause
 
 
 keytool -importkeystore -srckeystore thinkive.key -destkeystore new.keystore -v
 
 
 jarsigner -keystore thinkive.key -storepass thinkiveQWERT1003 -keypass thinkiveQWERT1003 安卓小方_1.7.6.apk thinkive
 
 
 jarsigner -keystore thinkive.key -storepass thinkiveQWERT1003 -keypass thinkiveQWERT1003 安卓小方_1.7.8_1Z.apk thinkive
 
 
 jarsigner -keystore thinkive.key -storepass thinkiveQWERT1003 -keypass thinkiveQWERT1003 安卓小方_1.7.8_1Z_仅供测试金乐融.apk thinkive
 
 
 jarsigner -keystore thinkive.key -storepass thinkiveQWERT1003 -keypass thinkiveQWERT1003 -sigfile cert -signedjar 啦啦啦.apk 安卓小方_1.7.8_1Z.apk thinkive
 使用 zipalign 工具优化 apk
 zipalign -f -v 4 application_signed.apk application_zip.apk
 使用 zipalign 工具校验是否已优化
 zipalign -c -v 4 application.apk
 Android SDK中包含一个“zipalign”的工具,它能够对打包的应用程序进行优化。在你的应用程序上运行zipalign,
 使得在运行时Android与应用程序间的交互更加有效率。因此,这种方式能够让应用程序和整个系统运行得更快。我们
 强烈推荐在新的和已经发布的程序上使用zipalign工具来得到优化后的版本——即使你的程序是在老版本的Android平台下开发的。
 关于 jarsigner 命令参见博文:http://blog.csdn.net/yangxt/article/details/1796965
 
 
 /**
  * 绘制收益表现图
  * 
@param paintDays 绘制的天数
  * 
@param shChart 沪深 300 的收益数据 
  * 
@param jqyChart 当前投顾组合的收益数据 
  */
 function investIcharts(paintDays, shChart, jqyChart) 
 {
 paintDays = Number(paintDays);
 var chartData = [{
 type: ‘spline‘,
 name: invUser,
 marker: {
 symbol: ‘circle‘
 },
 pointInterval: 24 * 3600 * 1000,
 pointStart: Date.UTC(2015, 0, 1),
 data: []
 }, {
 type: ‘spline‘,
 name: "沪深300",
 marker: {
 symbol: ‘diamond‘
 },
 pointInterval: 24 * 3600 * 1000,
 pointStart: Date.UTC(2015, 0, 1),
 data: []
 }];
 for(var i = 0, len = shChart.length; i < len; i++)
 {
 var oneSHData = shChart[i];
 var oneJQYData = jqyChart[i];
 var incomeJQY = oneJQYData.income; // 当前投顾收益
 var incomeSH = oneSHData.income; // 沪深300 收益
 incomeJQY = parseInt(incomeJQY * 100);
 incomeSH = parseInt(incomeSH * 100);
 //请确保时间格式为2000-01-01或者更改截取时间的索引和长度,js时间计算一月是0,二月是1,依次类推
 chartData[0].data.push(incomeJQY);
 chartData[1].data.push(incomeSH);
 }
 
 
 while(chartData[0].data.length < paintDays)
 {
 chartData[0].data.push(null);
 chartData[1].data.push(null);
 }
 
 var paintParam = {
 chart: {
 type: ‘spline‘, 
 spacingRight: 30,
 height: 250,
 width: $(window).width(),
 showAxes: true
 },
 title: {
 text: "收益曲线", //指定图表标题
 x: 0 // center
 },
 subtitle: {
 text: "", //指定图表副标题
 x: -20
 },
 credits: {
 text: ‘‘, // 去掉右下方版权信息:highchart.com
 },
 xAxis: {
 type: ‘datetime‘,
 maxPadding: 0,
 tickInterval: paintDays == 30 ? 24 * 3600 * 1000 : 30 * 24 * 3600 * 1000,
 labels: {
 step: paintDays == 30 ? 3 : 1,
 staggerLines: 1,
 formatter: function () {
 if(paintDays == 30)
 {
 return Highcharts.dateFormat(‘%e日‘, this.value);
 }
 else
 {
 return Highcharts.dateFormat(‘%b月‘, this.value);
 }
   }
 },
 title: {
 text: null
 },
 showLastLabel: true,
 showEmpty: true
 },
 plotOptions: {
 spline: {
 lineWidth: 1,
 marker: {
 enabled: false
 },
 shadow: false,
 states: {
 hover: {
 lineWidth: 1
 }
 },
 threshold: null
 }
 },
 yAxis: {
 reversed: false,
 title: {
 text: "收益率" //指定y轴的标题
 },
 labels: {
 formatter: function() {
 return this.value + "%"
 }
 },
 gridLineColor: "#DFDEDE",
 showEmpty: true
 },   
 tooltip: {
 formatter: function() {
 return ‘<b>‘+ this.series.name + ‘</b><br>‘ + Highcharts.dateFormat(‘%b月%e日‘, this.x);
 }
 },
 colors:[‘#0E8ECF‘,‘#E21717‘,‘#FF6600‘,‘#FF9C00‘,‘#BFD916‘],
 series: chartData
 };
 $(_pageId + " #invest_canvas").highcharts(paintParam);
 }
 
 
 –Webkit-touch-callout: none; 它将关闭移动端Safari默认的长按事件
 
 
 grunt-contrib-uglify 使用笔记:
 module.exports = function(grunt) {
   grunt.file.defaultEncoding = ‘utf8‘;
   grunt.initConfig({
     pkg: grunt.file.readJSON(‘package.json‘),
     uglify: {
     options: {
     // 此处定义的banner注释将插入到输出文件的顶部
     banner: ‘/*<%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %> */\n‘,
     // 此处定义的banner注释将插入到输出文件的底部
     footer: ‘\n/*最后修改于 <%= grunt.template.today("yyyy-mm-dd HH:MM:ss") %> */‘,
     
     // 除 "require", "exports", "module" 外其他的变量都混淆
 mangle: {
 except: ["require", "exports", "module"]
 },
 // 不删除注释,还可以为 false(删除全部注释),some(保留
@preserve 
@license @cc_on等注释)
 preserveComments: "false",
 // 输出压缩率,可选的值有 false(不输出信息),gzip
 report: "min",
 compress: {
 // 移除所有的 console.* 函数代码
 drop_console: true
 },
 // 美化代码
 beautify: true
     },
     build_project: {
     options: {
     },
     files: [{
     expand: true,
     cwd: "../plat/project/scripts/",
     src: ["**/*.js"],
     dest: "../built/project/scripts/",
     ext: ".js"
     }]
     },
     build_real_configuration: {
     options: {
     },
     files: [{
     expand: true,
     cwd: "../plat/",
     src: ["real-configuration.js"],
     dest: "../built",
     }]
     },
     build_real_test_configuration: {
     options: {
     },
     files: [{
     expand: true,
     cwd: "../plat/",
     src: ["real-test-configuration.js"],
     dest: "../built",
     }]
     },
     build_test_configuration: {
     options: {
     },
     files: [{
     expand: true,
     cwd: "../plat/",
     src: ["test-configuration.js"],
     dest: "../built",
     }]
     },
     concat_script: {
     files: {
     "all_min.js": ["../built/scripts/**/*.js"]
     }
     }
     }
   });
   
   grunt.task.loadNpmTasks(‘grunt-contrib-uglify‘);
   
   grunt.task.registerTask("default", "uglify:build_project");
   grunt.task.registerTask("concat", "uglify:concat_script");
   grunt.task.registerTask("build_real_configuration", "uglify:build_real_configuration");
   grunt.task.registerTask("build_real_test_configuration", "uglify:build_real_test_configuration");
   grunt.task.registerTask("build_test_configuration", "uglify:build_test_configuration");
 };
js 学习笔记 05
原文:http://my.oschina.net/u/1259707/blog/382435