博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【Origin】jquery.barddialog.js
阅读量:6247 次
发布时间:2019-06-22

本文共 4737 字,大约阅读时间需要 15 分钟。

/// 
/** * @license jquery.bardDialog 1.0.0 * (c) 1986-infinity China, Shanghai. CalosChen * License: MIT * Description:A responsive dialog box which provides several simple interface methods. Free to use, do whatever you want to it, just customize it. */; (function (clothes, $) { 'use strict'; var female = { bed: function () { return '
'; }, blanket: function () { return '
'; }, costume: function () { return '
'; }, hat: function (name) { return '

' + name + '

' }, body: function (discourse) { return '
' + discourse + '
' }, feet: '
' }; var dialog = function (dummy) { var birthday = new Date().getTime(); var $bed = $(female.bed()); var $blanket = $(female.blanket()); var $costume = $(female.costume()); var $makeup = $costume.addClass(birthday.toString()); var world = { height: $(window).height(), width: $(window).width() }; var treasure = {}; var Calos = { name: 'discourse', discourse: 'discourse', permit: function () { $bed.remove(); }, repel: function () { $bed.remove(); } }; var God = $.extend({}, Calos); dummy = $.extend(God, typeof dummy === 'string' ? { discourse: encodeURIComponent(dummy) } : dummy); var male = { shift: function () { treasure = { bed: $bed, blanket: $blanket, costume: $costume, hat: $makeup.find('.dlghat'), body: $makeup.find('.dlgbody'), promise: $makeup.find('.promise'), deny: $makeup.find('.deny') }; }, birth: function (dummy) { var bone = female.hat(dummy.name) + female.body(decodeURIComponent(dummy.discourse)) + female.feet; $bed.append($blanket).append($costume.html(bone)).appendTo('body'); male.shift(); return this; }, masquerade: function () { treasure.bed.css({ opacity: 1, 'z-index': 1000, height: world.height, width: '100%', position: 'fixed', top: 0, left: 0 }); treasure.blanket.css({ background: '#000', opacity: 0.5, height: world.height, width: '100%', position: 'absolute', top: 0, left: 0 }); treasure.costume.css({ background: 'white', position: 'relative', 'border-radius': '5px', padding: '0.3em', margin: '30px auto', 'min-width': '15%', width: 'string' !== typeof dummy.discourse && $(dummy.discourse).width() ? ($(dummy.discourse).width() + 50) : world.width / 3 }); treasure.costume.find('.dlgbody').css({ 'max-height': world.height - 300, padding: '0.1em', overflow: 'auto' }); var cosmetics = ''; $(cosmetics).appendTo('head'); } }; male.birth(dummy).masquerade(); treasure.promise.on('click', function () { dummy.permit(); Calos.permit(); }); treasure.deny.on('click', function () { dummy.repel(); Calos.repel(); }); return this; }; clothes.dialog = dialog; clothes.info = function (discourse) { dialog({ name: 'Info', discourse: discourse }); }; clothes.question = function (problem, agree) { dialog({ name: 'Prompt', discourse: problem, promise: agree }); }; clothes.warn = function (admonish) { dialog({ name: 'Warning', discourse: admonish }); }; clothes.danger = function (hazard) { dialog({ name: 'Danger', discourse: hazard }); };})(this.bardDialog = this.bardDialog || {}, jQuery);$(function () { bardDialog.dialog({ name: 'Hello', discourse: '
Have fun, bro.
', repel: function () { alert('Oh, you repel it!'); }, permit: function () { alert('Oops, you permit it!'); } });});

转载于:https://www.cnblogs.com/hualiu0/p/5808786.html

你可能感兴趣的文章
[Leetcode] Word Ladder 单词爬梯
查看>>
Java 开源企业信息化建设平台 O2OA 入选码云 GVP 项目
查看>>
阿里云Global Connection亮相MWC 2019,做企业全球化开路先锋 ...
查看>>
当面试官说 “你还有什么问题想问的” ,你该如何回答? ...
查看>>
《RocketMQ技术内幕:RocketMQ架构设计与实现原理》—1.1.1 Eclipse获取RocketMQ源码 ...
查看>>
史上最全 40 道 Dubbo 面试题及答案,看完碾压面试官! ...
查看>>
使用JumpServer管理你的服务器
查看>>
剑指奥迪Q7 凯迪拉克XT6突围“二线豪华”将于7月份上市 | 2019上海车展 ...
查看>>
实现基于最新chrome的动态按需加载组件
查看>>
Hanlp中N最短路径分词详细介绍
查看>>
Oracle集群技术 | OLR与套接字文件(二)
查看>>
Android 打开网络上pdf文件
查看>>
Hibernate主键生成策略及选择
查看>>
MySQL8.0.14 - 新特性 - InnoDB Parallel Read简述
查看>>
洛谷 P2717 寒假作业
查看>>
苏宁低调内测“宁互宝”,网络互助成巨头必争之地
查看>>
了解一下:一款好用的 Maven Library 发布插件
查看>>
spring boot 集成cache时,与shiro的冲突解决
查看>>
连界创新获翊翎资本、连界资本8000万元融资,专注赋能产业升级
查看>>
PostgreSQL 11 新特性解读: psql 新增 \\gdesc 显示查询结果的列名和类型
查看>>