Song.Site/Utility/CoreScripts/MessageBox.js
(开头部分) 10KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*!
* 主 题:《消息窗口》
* 说 明:用于子页面弹出时的窗口。
* 功能描述:
* 1、生成弹出消息,包括确认,提示,警告,预载;
* 2、窗口弹出时,生成背景遮罩;
* 3、窗口最小为宽高100,小于等于100时,宽高值默认为浏览器窗口的百分比;
* 4、可以设定关闭与确定按钮事件
*
* 作 者:宋雷鸣
* 开发时间: 2015年9月19日
*/
(function () {
//弹出窗口的主类
//title:窗口标题
//info:要展示的信息,如果type为内嵌页页
//width:窗口宽度
//height:窗口高度
//type:窗口类型,confirm为确认,msg为消息,alert为警告,loading;默认为msg,如果为'null'则不显示关闭与按钮(白板窗体)
function msgbox(title, info, width, height, type, event, overFunc) {
this.EnterEvent = event;
this.OverEvent = overFunc;
this.Init(title, info, width, height, type);
}
msgbox.prototype.btnText = {
enter: '确定',
close:'关闭'
}
msgbox.prototype.WinBox = null; //窗体Jquery对象
msgbox.prototype.EnterEvent = null; //确认按钮的事件
msgbox.prototype.OverEvent = null; //结束后的事件
msgbox.prototype.ShowCloseBtn = true; //是否显示右上角关闭按钮
//初始化参数
msgbox.prototype.Init = function (title, info, width, height, type) {
this.Title = title != null && title != "" ? title : "";
this.Info = info;
//如果为空,则为浏览器窗口一半宽高
this.Width = !isNaN(Number(width)) ? Number(width) : $(window).width();
this.Height = !isNaN(Number(height)) ? Number(height) : $(window).height();
//如果宽高小于100,则默认为浏览器窗口的百分比
this.Width = this.Width > 100 ? this.Width : $(window).width() * this.Width / 100;
this.Height = this.Height > 100 ? this.Height : $(window).height() * this.Height / 100;
this.WinId = new Date().getTime() + "_" + Math.floor(Math.random() * 1000 + 1);
this.Type = type == null ? "null" : type;
return this;
}
//创建窗口,并打开
msgbox.prototype.Open = function (title, info, width, height, type) {
//生成窗口
this.Mask();
this.BuildFrame();
this.BuildContext();
this.BuildButton();
//如果需要数秒关闭
var msgbox = $(".MsgBox[winid='" + this.WinId + "']");
if (msgbox.find("second").size() > 0) {
window.MsgBoxInterval = setInterval(function () {
var tm = Number($("second").text());
if (tm > 1) {
$("second").text(--tm)
后面还有 209 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
