使用js获取用户openid
通过自定义菜单打开url,在网页中用js获取用户openid:
一、回复一条图文消息,将用户openid带在链接上
二、认证服务号可以使用高级接口。参考:
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842
http://blog.csdn.net/baronyang/article/details/44489841
http://blog.csdn.net/qq_30632003/article/details/52882592
jQueryUI拖拽排序部件 sortable
DEMO http://jqueryui.com/sortable/
API http://api.jqueryui.com/sortable/
KindEditor编辑器的bug
解决办法:/lang/zh-CN.js 或 kindeditor-all-min.js中把Microsoft Yahei直接替换为中文微软雅黑
2、响应式网站,后台发布新闻等内容时,通常不需要给图片设置宽度和高度,但编辑器图片插件中删除图片宽高中的一项,另一项会变为NaN,
修改kindeditor-all-min.js中的图片插件(或plugins/image/image.js中相应部分):
D.change(function(){J>0&&E.val(Math.round(K/J*parseInt(this.value,10)))}),E.change(function(){K>0&&D.val(Math.round(J/K*parseInt(this.value,10)))})
改为:
D.change(function(){this.value&&J>0&&E.val(Math.round(K/J*parseInt(this.value,10)))}),E.change(function(){this.value&&K>0&&D.val(Math.round(J/K*parseInt(this.value,10)))})
浏览器全屏
function fullscreen(){
elem=document.body;
if(elem.webkitRequestFullScreen){
elem.webkitRequestFullScreen();
}else if(elem.mozRequestFullScreen){
elem.mozRequestFullScreen();
}else if(elem.requestFullScreen){
elem.requestFullscreen();
}else{
//浏览器不支持全屏API或已被禁用
}
}
function exitFullscreen(){
var elem=document;
$("#fullscreen").show();
if(elem.webkitCancelFullScreen){
elem.webkitCancelFullScreen();
}else if(elem.mozCancelFullScreen){
elem.mozCancelFullScreen();
}else if(elem.cancelFullScreen){
elem.cancelFullScreen();
}else if(elem.exitFullscreen){
elem.exitFullscreen();
}else{
//浏览器不支持全屏API或已被禁用
}
}
js基础知识
WINDOW对象的 postMessage() 方法用于安全地实现跨域通信。
otherWindow.postMessage(message, targetOrigin, [transfer]);
参考:
https://www.w3cschool.cn/fetch_api/fetch_api-lx142x8t.html
https://www.runoob.com/js/met-win-postmessage.html
https://www.jianshu.com/p/ae840f7d7f8b
artDialog 网页对话框插件
通过预加载在图片加载前读取图片尺寸
/***************************************************************************************
* 图片头数据加载就绪获取图片尺寸
* @version 2011.05.27
* @author TangBin
* @see http://www.planeart.cn/?p=1121
* @param {String} 图片路径
* @param {Function} 尺寸就绪
* @param {Function} 加载完毕 (可选)
* @param {Function} 加载错误 (可选)
yundanran_imageSize('http://b.zol-img.com.cn/desk/bizhi/image/5/2560x1600/1409624254331.jpg', function ()
{
alert('size ready: width=' + this.width + '; height=' + this.height);
});
*******************************************************************************************/
var yundanran_imageSize = (function ()
{
var list = [], intervalId = null,
// 用来执行队列
tick = function () {
var i = 0;
for (; i < list.length; i++) {
list[i].end ? list.splice(i--, 1) : list[i]();
};
!list.length && stop();
},
// 停止所有定时器队列
stop = function () {
clearInterval(intervalId);
intervalId = null;
};
return function (url, ready, load, error) {
var onready, width, height, newWidth, newHeight,
img = new Image();
img.src = url;
// 如果图片被缓存,则直接返回缓存数据
if (img.complete) {
ready.call(img);
load && load.call(img);
return;
};
width = img.width;
height = img.height;
// 加载错误后的事件
img.onerror = function () {
error && error.call(img);
onready.end = true;
img = img.onload = img.onerror = null;
};
// 图片尺寸就绪
onready = function () {
newWidth = img.width;
newHeight = img.height;
if (newWidth !== width || newHeight !== height ||
// 如果图片已经在其他地方加载可使用面积检测
newWidth * newHeight > 1024
) {
ready.call(img);
onready.end = true;
};
};
onready();
// 完全加载完毕的事件
img.onload = function () {
// onload在定时器时间差范围内可能比onready快
// 这里进行检查并保证onready优先执行
!onready.end && onready();
load && load.call(img);
// IE gif动画会循环执行onload,置空onload即可
img = img.onload = img.onerror = null;
};
// 加入队列中定期执行
if (!onready.end) {
list.push(onready);
// 无论何时只允许出现一个定时器,减少浏览器性能损耗
if (intervalId === null) intervalId = setInterval(tick, 40);
};
};
})();
http://qianduanblog.com/post/js-learning-10-image-reload-size.html
AlloyImage 图像处理引擎
http://alloyteam.github.io/AlloyPhoto/
1.图层功能,提供图层的添加,删除,交换图层顺序等功能,且包含与PS相对应的17种图层混合模式
2.图像的基本调节功能,包括亮度、对比度,色相、饱和度、明度调节
3.多种滤镜功能,去色、反相、高斯模糊、锐化、浮雕效果、查找边缘、马赛克、腐蚀等
4.处理后文件的保存,处理完成之后,可以将文件输出为base64形式间接使用和保存
5.高级组合效果,如素描,lomo,复古,素描等复合效果 如一个素描效果的实现
jQuery Validation Engine 表单验证
中文:http://code.ciaoca.com/jquery/validation_engine/
https://github.com/posabsolute/jQuery-Validation-Engine
http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/
学习这种通用的验证方式,不需要每个表单都那么麻烦地写一次验证
jQuery cxSelect 联动下拉菜单
中文:http://code.ciaoca.com/jquery/cxSelect/
https://github.com/ciaoca/cxSelect
