socialforge/public/javascripts/wechat/alert.js

43 lines
1.2 KiB
JavaScript

$(function(){
window.byAlert = function(info, title){
if(typeof title === 'undefined'){
title = '提示';
}
$('.weui_dialog_alert .weui_dialog_title').text(title);
$('.weui_dialog_alert .weui_dialog_info').text(info);
var $dialog = $('#dialog2');
$dialog.show();
$dialog.find('.weui_btn_dialog').one('click', function () {
$dialog.hide();
});
};
window.byConfirm = function(info, cb){
var title;
if(typeof title === 'undefined'){
title = '提示';
}
$('.weui_dialog_confirm .weui_dialog_title').text(title);
$('.weui_dialog_confirm .weui_dialog_info').text(info);
var $dialog = $('#dialog1');
$dialog.show();
$dialog.find('.weui_btn_dialog.confirm').one('click', function () {
$dialog.hide();
if(typeof cb === 'function'){
cb();
}
});
$dialog.find('.weui_btn_dialog.cancel').one('click', function () {
$dialog.hide();
});
}
window.closeWindow = function(){
WeixinJSBridge.call('closeWindow');
}
});