JS Learning Note 05

Source: Internet
Author: User
Tags call back dateformat

The clientheight of DOM objects include: content+padding,offsetheight include: Content+padding+border


/**
* Prohibit input of Chinese characters
*/
Apputils.bindevent ($ (_pageid+ "#test"), function (e) {
E = Window.event | | E
if (!/[\u4e00-\u9fa5]+/.test (E.data))
{
return false;
}
E.stoppropagation ();
}, "TextInput");


App Store listing process:
To Https://itunesconnect.apple.com, add a new app, select the corresponding app ID, (when packaging the app ID) to fill in the introduction,
Search keywords, upload ip4 (3.5 inch, 640x960) introduction picture, not necessarily, 1-5 Zhang, IP5 (4 inch, 640x1136) picture, 1-5 Zhang,
Fill in contact information, email, phone, select items (finance, education, games, etc.) select content Rating (generally all is no), and finally make
with Xcode or application loader (MAC-specific upload tool), upload the program, the correct upload completed, back to Https://itunesconnect.apple.com,
There is a selection of the Program build option, select the correct file you upload (can pass multiple, build is not the same line, can only select one), the last point to apply for review,
A wait for review appears to enter the approval process
Must give Apple to provide test account, if there is no test account, will be a lot of trouble, Apple auditors will not really help you open an account, they will insist that you give the test account,
If it is not, they will find you a bunch of information, and finally you record to receive text messages, fill in the Verification code of the video, or directly recorded from the phone number to the completion of the account of the video ...
Generally last to record, because they do not really video and then open an account (it seems that they are audit simulator, not video), but there is a test account, the early will be less than a few times to call back


If a JSON object is formatted like this:
{
"0": 1,
"1": 2,
"2": 3,
"Length": 3
}, you can use the slice method of the array to convert the object to an array object, such as:
var test = {
"0": 1,
"1": 2,
"2": 3,
"Length": 3,
"WX": 1
};
Array.prototype.slice.call (test); The results are: [1, 2, 3]
In the above code, the JSON object cannot be missing length otherwise, the converted array length is 0.


JS method to get the data type of a variable: Object.prototype.toString.call (variable). Slice (8,-1), such as:
Object.prototype.toString.call (""). Slice (8,-1)//String
Object.prototype.toString.call (one). Slice (8,-1)//number


When a touch event is bound to a larger element of Z-index, clicking on the element triggers the click event at the bottom level of the element, which is handled by:
When dealing with a series of touch operations, in order to prevent the triggering of mouse events (click), you can call Preventdefault () in Touchstart or the first touchmove, more appropriate practice
is to call Preventdefault () in Touchmove and cannot invoke a method that blocks bubbling in the Touchend event.


<a href= "tel://110" > Call </a>


When a tag is nested with IMG, a solution to the problem with the bottom margin appears:
The so-called bottom margin is the distance between the baseline and the bottom of the western typesetting, setting the Vertical-align:bottom of the IMG, or setting A's line-height:0;


Add CSS3 style-webkit-transform:transition3d (0,0,0) or-webkit-transform:translatez (0) for the animated DOM element, both of which turn on GPU hardware acceleration mode.
So that the browser when rendering animation from the CPU to the GPU, in fact, this is a small trick, it can be considered a hack,-webkit-transform:transition3d and-webkit-transform:translatez
In fact, to render the 3D style, but after we set the value to 0, we didn't really use the 3D effect, but the browser turned on the GPU hardware acceleration mode.
After adding-webkit-transform:transition3d (0,0,0) to all the animated DOM elements to turn on GPU hardware acceleration, there was a bug in Chrome that was weird,
When you have multiple position:absolute, elements add-webkit-transform:transition3d (0,0,0), and when GPU hardware acceleration is turned on, several elements disappear from thin air.


Touch events on your phone to handle the problem:
1, General mobile phone to Touchstart or Touchmove block the default behavior can solve the problem of point penetration
2, Meizu 3 after using method One, the problem continues, because MouseDown than Touchstart first trigger, to handle the MouseDown event to
Solve the problem of point penetrating


Ant Packaging Script:
Title Android Pack
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 enters the Sdk\tools directory, executes the following command, generates build.xml,local.properties,proguard-project.txt three files
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 is assigned a value in the Build.xml file <property name= "aapt.ignore.assets" value= "Crunch"/>
REM Cleanup Project
Ant Clean-buildfile D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat\build.xml
REM Hit Debug pack
Ant Debug-buildfile D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat\build.xml
REM Play release version
Ant Release-buildfile D:\software\mywork\adt-bundle-windows-x86_64-20130917\eclipse\workspace\fz_anychat\ Build.xml
Configuration
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
Whether the REM check is signed
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 Andro _1.7.6.apk thinkive


Jarsigner-keystore thinkive.key-storepass thinkiveqwert1003-keypass thinkiveQWERT1003 Andro _1.7.8_1z.apk thinkive


Jarsigner-keystore thinkive.key-storepass thinkiveqwert1003-keypass thinkiveQWERT1003 Andro _1.7.8_1z_ for testing only 金乐融. apk Thinkive


Jarsigner-keystore thinkive.key-storepass thinkiveqwert1003-keypass thinkiveqwert1003-sigfile Cert-signedjar Cheerleader apk Andro _1.7.8_1z.apk thinkive
Using the Zipalign tool to optimize APK
Zipalign-f-V 4 application_signed.apk application_zip.apk
Using the Zipalign tool to verify that it is optimized
Zipalign-c-V 4 application.apk
The Android SDK includes a "zipalign" tool that optimizes packaged applications. Run Zipalign on your application,
Makes the interaction between Android and the application more efficient at run time. As a result, this approach allows applications and the entire system to run faster. We
It is highly recommended to use the Zipalign tool on new and published programs to get an optimized version-even if your program was developed under an older version of Android.
About the Jarsigner command See blog post: http://blog.csdn.net/yangxt/article/details/1796965


/**
* Chart of yield performance
* Number of days @param paintdays drawn
* @param shchart CSI 300 Revenue data
* @param jqychart Current portfolio of revenue data
*/
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: "CSI 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; Current investment revenue
var incomesh = Oneshdata.income; CSI 300 Revenue
incomejqy = parseint (incomejqy * 100);
Incomesh = parseint (Incomesh * 100);
Make sure that the time format is 2000-01-01 or change the index and length of the intercept time, the JS time calculation January is 0, February is 1, and so on
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: "Yield curve",//Specify chart title
x:0//Center
},
Subtitle: {
Text: "",//Specify chart subtitle
X:-20
},
Credits: {
Text: ',//Remove right Bottom copyright information: 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 Day ', this.value);
}
Else
{
Return Highcharts.dateformat ('%b month ', 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: "Yield"//Specify the title of the y-axis
},
Labels: {
Formatter:function () {
return this.value + "%"
}
},
GridlineColor: "#DFDEDE",
Showempty:true
},
ToolTip: {
Formatter:function () {
Return ' <b> ' + this.series.name + ' </b><br> ' + highcharts.dateformat ('%b month%e Day ', this.x);
}
},
colors:[' #0E8ECF ', ' #E21717 ', ' #FF6600 ', ' #FF9C00 ', ' #BFD916 '],
Series:chartdata
};
$ (_pageid + "#invest_canvas"). Highcharts (Paintparam);
}


–webkit-touch-callout:none; It will close the mobile safari default long-press event


Grunt-contrib-uglify Use notes:
Module.exports = function (grunt) {
grunt.file.defaultEncoding = ' UTF8 ';
Grunt.initconfig ({
Pkg:grunt.file.readJSON (' Package.json '),
Uglify: {
Options: {
The banner comment defined here will be inserted at the top of the output file
Banner: '/*<%= pkg.name%> <%= grunt.template.today ("Yyyy-mm-dd HH:MM:ss")%> */\n ',
The banner comment defined here will be inserted at the bottom of the output file
Footer: ' \n/* last modified to <%= grunt.template.today ("Yyyy-mm-dd HH:MM:ss")%> */',

Except for "require", "exports", other variables outside "module" are confused
Mangle: {
Except: ["require", "exports", "module"]
},
Do not delete comments, can also be false (delete all comments), some (keep @preserve @license @cc_on and other comments)
Preservecomments: "false",
Output compression rate, optional value has false (does not output information), gzip
Report: "Min",
Compress: {
Remove all console.* function codes
Drop_console:true
},
Beautify the Code
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 Learning Note 05

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.