MXOXW

Life always finds a way.

微信Android版隐藏功能

| Comments

//triggerWebViewCacheCleanup 来清缓存!

//switchtabpos:让微信 tab 更贴合 Android Design
如果你并不喜欢微信 Android 版和 iOS 端同用一套 UI,现在有一个小方法可以实现 Tab 的转移:在微信任意聊天窗口输入 //switchtabpos 并按发送,Tab 就会从转移到屏幕顶端,Android 范十足。如果想再调整回来,再输入一遍并发送就好了。

//multiwebview:将微信聊天页和文章页拆分为两个任务卡片
在任意聊天窗口输入 //multiwebview 并发送,聊天和文章页面就可以被拆分为两个任务,并能同时出现在多任务切换页面中。如果在看文章过程中来了微信消息,回复消息后再跳转回文章就方便多了。当然,该功能还需系统的支持,目前只适用于 Android 5.0 及以上版本的系统。

//switchnotificationstatus:让微信也支持浮动通知
在微信任意聊天窗口输入 //switchnotificationstatus 并发送,即可让微信也支持浮动通知。不过该功能仅支持 Android 5.x + 和微信 6.2 测试版,如要升级到微信 6.2 测试版,请用微信扫一扫下面最后一张图中的二维码。

//sightinfo:查看小视频参数
//sightinfo 可以让小视频的左上角显示小视频的一些参数,比如帧率、分辨率、时长、大小等。输入 //sightinfo 并发送后,参数不会立即显示,需先退出微信再重新进入。如要取消显示参数,只需重复 输入 //sightinfo 并发送, 退出微信再重新进入就好了。

//traceroute:调出「诊断网络」功能
在微信任意聊天窗口输入 //traceroute 并发送,可以调出「诊断网络」功能。不过,当你真遇上无法连接到服务器的情况,这页面应该会自动弹出来吧。

//opentrace
在微信任意聊天窗口输入 //opentrace 并发送,可以调出一个悬浮的类似音乐播放器中的播放/停止按钮。点击一下是开始,再点击一下是结束。尚不清楚这是什么功能,希望能得到高人指点。

//getfpkey
输入 //getfpkey 并发送,可以看到关于手机的一些信息,包括制造商、型号、ROM 的版本。然而用处不大,这些信息在 设置-关于手机里都可以找到。

//testwaitsms
输入 //testwaitsms 并发送后会要求验证手机号码,在进度条走完之前你可以点返回键取消操作。不知道 验证手机号码为哪般,关键这手机号码还不是我的,所以无法得知下一步要做什么。

//setshakecarddata
输入 //setshakecarddata 并发送后,摇一摇功能中会多出一个「礼券」选项。然而并不能摇出什么礼券,只有一句「活动已结束,多陪陪家人」的温馨提示。该功能的取消方法与前面所述的不大一样,需要输入 //clearshakecarddata 并发送。

//checkcount:查看当前聊天窗口消息数量
输入 //checkcount 并发送,可以查看当前聊天窗口总共有多少条消息。

//pickpoi:定位当前位置
输入 //pickpoi 并发送,可以定位自己当前的位置,这与微信中的「发送位置」的功能是相同的。

//fullexit:退出微信
//fullexit 相当于退出功能,输入并发送后,微信会自动退出。再次进入微信时,需要输入登录密码。

//testsetpageowner
输入 //testsetpageowner 并发送,会跳转到一个 Weixin JS API Demos 页面,不过该页面仅支持公司内网访问,对咱来说没什么用。

Windows下使用openssl生成证书

| Comments

使用git包含的openssl

1
2
3
4
5
6
7
#生成私钥key文件:
openssl genrsa -out privatekey.pem 1024
#通过私钥生成CSR证书签名
openssl req -new -key privatekey.pem -out certrequest.csr -config "D:\Program Files\Git\ssl\openssl.cnf"

# 通过私钥和证书签名生成证书文件
openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem

针对NodeJS下http-server
修改http-server\bin\http-server

1
2
3
4
5
6
if (ssl) {
options.https = {
cert: argv.C || argv.cert || process.env.NODE_PATH + '\\http-server\\cert\\certificate.pem',
key: argv.K || argv.key || process.env.NODE_PATH + '\\http-server\\cert\\privatekey.pem'
};
}

参考:

http://blog.fens.me/nodejs-https-server/
http://blog.csdn.net/longeremmy/article/details/8156384

JavaScript 权威指南-脚本化文档

| Comments

15.2 选取文档元素

  • 用指定的id属性;
  • 用指定的name属性;
  • 用指定的标签名字;
  • 用指定的CSS类;
  • 匹配指定的CSS选择器。

15.3 文档结构和遍历

15.3.1 作为节点树的文档

  • parentNode
  • childNodes
  • firstChild, lastChild
  • nextSibling, previousSibling
  • nodeType
    该节点的类型。9代表Document节点,1代表Element节点,3代表Text节点,4代表CDATA节点,8代表Comment节点,11代表documentFragment节点。
  • nodeValue
  • nodeName

15.4 属性

HTML属性名不区分大小写,但JavaScript属性名则大小写敏感。从HTML属性名转换到JavaScript属性名应该采用小写。但是,如果属性名包含不止一个单词,则将除了第一个单词以外的单词的首字母大写,例如:defaultChecked和tabIndex。

有些HTML属性名在JavaScript中是保留字。对于这些属性,一般的规则是为属性名加前缀”html”。例如,HTML的for属性(<lable/>元素)在JavaScript中变为htm1For属性。”class”在JavaScript中是保留字(但还未使用),它是HTML非常重要的class属性,是上面规则的一个例外:在JavaScript代码中它变为className。

  • getAttribute()
  • setAttribute()

dataset

作为attr节点的属性

1
2
3
document.body.attributes[0] // The first attribute of the <body> elt
document.body.attributes.bgcolor // The bgcolor attribute of the <body> elt
document.body.attributes["ONLOAD"] // The onload attribute of the <body> elt

15.5.1 作为HTML的元素的内容
innerHTML的效率非常高,但是用’+=’重复追加一小段文字通常效率底下,因为它既要序列化又要解析。
outerHTML
insertAdjacentHTML()

15.5.2 作为纯文本的元素的内容
textContent
innerText

15.5.3 作为TEXT的元素的内容
nodeValue

1
2
3
4
5
6
7
8
9
10
11
function textContent(e) {
var child, type, s = ""; // s holds the text of all children
for (child = e.firstChild; child != null; child = child.nextSibling) {
type = child.nodeType;
if (type === 3 || type === 4) // Text and CDATASection nodes
s += child.nodeValue;
else if (type === 1) // Recurse for Element nodes
s += textContent(child);
}
return s;
}

15.6.1 创建节点
createElement()
createTextNode()
createDocumentFragment()
createElementNS()
cloneNode()
importNode()

15.6.2 插入节点
appendChild()
insertBefore()

15.6.3 删除和替换节点
removeChild()
replaceChild()

15.6.4 使用 DocumentFragments

1
2
3
4
5
6
7
8
9
10
11
//Reverse the order of the children of Node n
function reverse(n) {
// Create an empty DocumentFragment as a temporary container
var f = document.createDocumentFragment();
// Now loop backward through the children, moving each one to the fragment.
// The last child of n becomes the first child of f, and vice-versa.
// Note that appending a child to f automatically removes it from n.
while (n.lastChild) f.appendChild(n.lastChild);
// Finally, move the children of f all at once back to n, all at once.
n.appendChild(f);
}

15.10.3 查询选取的文本

1
2
3
4
5
6
function getSelectedText() {
if (window.getSelection) // The HTML5 standard API
return window.getSelection().toString();
else if (document.selection) // This is the IE-specific technique.
return document.selection.createRange().text;
}