Emlog给主题添加复制粘贴弹窗代码 - 黑毒资源网

Emlog给主题添加复制粘贴弹窗代码

作者: 黑毒网络

全网最全的网络资源分享网站

手机扫码查看

标签:

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!

首先看一下Emlog给主题添加复制粘贴弹窗代码之后的截图

效果截图.png

    在header.php文件前调用以下代码:

  1. <link rel="stylesheet" href="<?php echo TEMPLATE_URL; ?>sweetalert.css" type='text/css' />
  2. <script src="<?php echo TEMPLATE_URL; ?>sweetalert.min.js"></script>

 其次同在header.php文件底部也就是最下方添加以下代码:

  1. <script>document.body.oncopy = function() {swal("复制成功!", "若要转载请务必保留原文链接,申明来源,谢谢合作!","success");};</script>

创建一个css文件命名为:sweetalert.css,放在你当前主题的根目录下

  1. body.stop-scrolling {
  2. height: 100%;
  3. overflow: hidden; }
  4.  
  5. .sweet-overlay {
  6. background-color: black;
  7. /* IE8 */
  8. -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
  9. /* IE8 */
  10. background-color: rgba(0, 0, 0, 0.4);
  11. position: fixed;
  12. left: 0;
  13. right: 0;
  14. top: 0;
  15. bottom: 0;
  16. display: none;
  17. z-index: 10000; }
  18.  
  19. .sweet-alert {
  20. background-color: white;
  21. font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  22. width: 478px;
  23. padding: 17px;
  24. border-radius: 5px;
  25. text-align: center;
  26. position: fixed;
  27. left: 50%;
  28. top: 50%;
  29. margin-left: -256px;
  30. margin-top: -200px;
  31. overflow: hidden;
  32. display: none;
  33. z-index: 99999; }
  34. @media all and (max-width: 540px) {
  35. .sweet-alert {
  36. width: auto;
  37. margin-left: 0;
  38. margin-right: 0;
  39. left: 15px;
  40. right: 15px; } }
  41. .sweet-alert h2 {
  42. color: #575757;
  43. font-size: 30px;
  44. text-align: center;
  45. font-weight: 600;
  46. text-transform: none;
  47. position: relative;
  48. margin: 25px 0;
  49. padding: 0;
  50. line-height: 40px;
  51. display: block; }
  52. .sweet-alert p {
  53. color: #797979;
  54. font-size: 16px;
  55. text-align: center;
  56. font-weight: 300;
  57. position: relative;
  58. text-align: inherit;
  59. float: none;
  60. margin: 0;
  61. padding: 0;
  62. line-height: normal; }
  63. .sweet-alert fieldset {
  64. border: none;
  65. position: relative; }
  66. .sweet-alert .sa-error-container {
  67. background-color: #f1f1f1;
  68. margin-left: -17px;
  69. margin-right: -17px;
  70. overflow: hidden;
  71. padding: 0 10px;
  72. max-height: 0;
  73. webkit-transition: padding 0.15s, max-height 0.15s;
  74. transition: padding 0.15s, max-height 0.15s; }
  75. .sweet-alert .sa-error-container.show {
  76. padding: 10px 0;
  77. max-height: 100px;
  78. webkit-transition: padding 0.2s, max-height 0.2s;
  79. transition: padding 0.25s, max-height 0.25s; }
  80. .sweet-alert .sa-error-container .icon {
  81. display: inline-block;
  82. width: 24px;
  83. height: 24px;
  84. border-radius: 50%;
  85. background-color: #ea7d7d;
  86. color: white;
  87. line-height: 24px;
  88. text-align: center;
  89. margin-right: 3px; }
  90. .sweet-alert .sa-error-container p {
  91. display: inline-block; }
  92. .sweet-alert .sa-input-error {
  93. position: absolute;
  94. top: 29px;
  95. right: 26px;
  96. width: 20px;
  97. height: 20px;
  98. opacity: 0;
  99. -webkit-transform: scale(0.5);
  100. transform: scale(0.5);
  101. -webkit-transform-origin: 50% 50%;
  102. transform-origin: 50% 50%;
  103. -webkit-transition: all 0.1s;
  104. transition: all 0.1s; }
  105. .sweet-alert .sa-input-error::before, .sweet-alert .sa-input-error::after {
  106. content: "";
  107. width: 20px;
  108. height: 6px;
  109. background-color: #f06e57;
  110. border-radius: 3px;
  111. position: absolute;
  112. top: 50%;
  113. margin-top: -4px;
  114. left: 50%;
  115. margin-left: -9px; }
  116. .sweet-alert .sa-input-error::before {
  117. -webkit-transform: rotate(-45deg);
  118. transform: rotate(-45deg); }
  119. .sweet-alert .sa-input-error::after {
  120. -webkit-transform: rotate(45deg);
  121. transform: rotate(45deg); }
  122. .sweet-alert .sa-input-error.show {
  123. opacity: 1;
  124. -webkit-transform: scale(1);
  125. transform: scale(1); }
  126. .sweet-alert input {
  127. width: 100%;
  128. box-sizing: border-box;
  129. border-radius: 3px;
  130. border: 1px solid #d7d7d7;
  131. height: 43px;
  132. margin-top: 10px;
  133. margin-bottom: 17px;
  134. font-size: 18px;
  135. box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.06);
  136. padding: 0 12px;
  137. display: none;
  138. -webkit-transition: all 0.3s;
  139. transition: all 0.3s; }
  140. .sweet-alert input:focus {
  141. outline: none;
  142. box-shadow: 0px 0px 3px #c4e6f5;
  143. border: 1px solid #b4dbed; }
  144. .sweet-alert input:focus::-moz-placeholder {
  145. transition: opacity 0.3s 0.03s ease;
  146. opacity: 0.5; }
  147. .sweet-alert input:focus:-ms-input-placeholder {
  148. transition: opacity 0.3s 0.03s ease;
  149. opacity: 0.5; }
  150. .sweet-alert input:focus::-webkit-input-placeholder {
  151. transition: opacity 0.3s 0.03s ease;
  152. opacity: 0.5; }
  153. .sweet-alert input::-moz-placeholder {
  154. color: #bdbdbd; }
  155. .sweet-alert input::-ms-clear {
  156. display: none; }
  157. .sweet-alert input:-ms-input-placeholder {
  158. color: #bdbdbd; }
  159. .sweet-alert input::-webkit-input-placeholder {
  160. color: #bdbdbd; }
  161. .sweet-alert.show-input input {
  162. display: block; }
  163. .sweet-alert .sa-confirm-button-container {
  164. display: inline-block;
  165. position: relative; }
  166. .sweet-alert .la-ball-fall {
  167. position: absolute;
  168. left: 50%;
  169. top: 50%;
  170. margin-left: -27px;
  171. margin-top: 4px;
  172. opacity: 0;
  173. visibility: hidden; }
  174. .sweet-alert button {
  175. background-color: #8CD4F5;
  176. color: white;
  177. border: none;
  178. box-shadow: none;
  179. font-size: 17px;
  180. font-weight: 500;
  181. -webkit-border-radius: 4px;
  182. border-radius: 5px;
  183. padding: 10px 32px;
  184. margin: 26px 5px 0 5px;
  185. cursor: pointer; }
  186. .sweet-alert button:focus {
  187. outline: none;
  188. box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
  189. .sweet-alert button:hover {
  190. background-color: #7ecff4; }
  191. .sweet-alert button:active {
  192. background-color: #5dc2f1; }
  193. .sweet-alert button.cancel {
  194. background-color: #C1C1C1; }
  195. .sweet-alert button.cancel:hover {
  196. background-color: #b9b9b9; }
  197. .sweet-alert button.cancel:active {
  198. background-color: #a8a8a8; }
  199. .sweet-alert button.cancel:focus {
  200. box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important; }
  201. .sweet-alert button[disabled] {
  202. opacity: .6;
  203. cursor: default; }
  204. .sweet-alert button.confirm[disabled] {
  205. color: transparent; }
  206. .sweet-alert button.confirm[disabled] ~ .la-ball-fall {
  207. opacity: 1;
  208. visibility: visible;
  209. transition-delay: 0s; }
  210. .sweet-alert button::-moz-focus-inner {
  211. border: 0; }
  212. .sweet-alert[data-has-cancel-button=false] button {
  213. box-shadow: none !important; }
  214. .sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false] {
  215. padding-bottom: 40px; }
  216. .sweet-alert .sa-icon {
  217. width: 80px;
  218. height: 80px;
  219. border: 4px solid gray;
  220. -webkit-border-radius: 40px;
  221. border-radius: 40px;
  222. border-radius: 50%;
  223. margin: 20px auto;
  224. padding: 0;
  225. position: relative;
  226. box-sizing: content-box; }
  227. .sweet-alert .sa-icon.sa-error {
  228. border-color: #F27474; }
  229. .sweet-alert .sa-icon.sa-error .sa-x-mark {
  230. position: relative;
  231. display: block; }
  232. .sweet-alert .sa-icon.sa-error .sa-line {
  233. position: absolute;
  234. height: 5px;
  235. width: 47px;
  236. background-color: #F27474;
  237. display: block;
  238. top: 37px;
  239. border-radius: 2px; }
  240. .sweet-alert .sa-icon.sa-error .sa-line.sa-left {
  241. -webkit-transform: rotate(45deg);
  242. transform: rotate(45deg);
  243. left: 17px; }
  244. .sweet-alert .sa-icon.sa-error .sa-line.sa-right {
  245. -webkit-transform: rotate(-45deg);
  246. transform: rotate(-45deg);
  247. right: 16px; }
  248. .sweet-alert .sa-icon.sa-warning {
  249. border-color: #F8BB86; }
  250. .sweet-alert .sa-icon.sa-warning .sa-body {
  251. position: absolute;
  252. width: 5px;
  253. height: 47px;
  254. left: 50%;
  255. top: 10px;
  256. -webkit-border-radius: 2px;
  257. border-radius: 2px;
  258. margin-left: -2px;
  259. background-color: #F8BB86; }
  260. .sweet-alert .sa-icon.sa-warning .sa-dot {
  261. position: absolute;
  262. width: 7px;
  263. height: 7px;
  264. -webkit-border-radius: 50%;
  265. border-radius: 50%;
  266. margin-left: -3px;
  267. left: 50%;
  268. bottom: 10px;
  269. background-color: #F8BB86; }
  270. .sweet-alert .sa-icon.sa-info {
  271. border-color: #C9DAE1; }
  272. .sweet-alert .sa-icon.sa-info::before {
  273. content: "";
  274. position: absolute;
  275. width: 5px;
  276. height: 29px;
  277. left: 50%;
  278. bottom: 17px;
  279. border-radius: 2px;
  280. margin-left: -2px;
  281. background-color: #C9DAE1; }
  282. .sweet-alert .sa-icon.sa-info::after {
  283. content: "";
  284. position: absolute;
  285. width: 7px;
  286. height: 7px;
  287. border-radius: 50%;
  288. margin-left: -3px;
  289. top: 19px;
  290. background-color: #C9DAE1;
  291. left: 50%; }
  292. .sweet-alert .sa-icon.sa-success {
  293. border-color: #A5DC86; }
  294. .sweet-alert .sa-icon.sa-success::before, .sweet-alert .sa-icon.sa-success::after {
  295. content: '';
  296. -webkit-border-radius: 40px;
  297. border-radius: 40px;
  298. border-radius: 50%;
  299. position: absolute;
  300. width: 60px;
  301. height: 120px;
  302. background: white;
  303. -webkit-transform: rotate(45deg);
  304. transform: rotate(45deg); }
  305. .sweet-alert .sa-icon.sa-success::before {
  306. -webkit-border-radius: 120px 0 0 120px;
  307. border-radius: 120px 0 0 120px;
  308. top: -7px;
  309. left: -33px;
  310. -webkit-transform: rotate(-45deg);
  311. transform: rotate(-45deg);
  312. -webkit-transform-origin: 60px 60px;
  313. transform-origin: 60px 60px; }
  314. .sweet-alert .sa-icon.sa-success::after {
  315. -webkit-border-radius: 0 120px 120px 0;
  316. border-radius: 0 120px 120px 0;
  317. top: -11px;
  318. left: 30px;
  319. -webkit-transform: rotate(-45deg);
  320. transform: rotate(-45deg);
  321. -webkit-transform-origin: 0px 60px;
  322. transform-origin: 0px 60px; }
  323. .sweet-alert .sa-icon.sa-success .sa-placeholder {
  324. width: 80px;
  325. height: 80px;
  326. border: 4px solid rgba(165, 220, 134, 0.2);
  327. -webkit-border-radius: 40px;
  328. border-radius: 40px;
  329. border-radius: 50%;
  330. box-sizing: content-box;
  331. position: absolute;
  332. left: -4px;
  333. top: -4px;
  334. z-index: 2; }
  335. .sweet-alert .sa-icon.sa-success .sa-fix {
  336. width: 5px;
  337. height: 90px;
  338. background-color: white;
  339. position: absolute;
  340. left: 28px;
  341. top: 8px;
  342. z-index: 1;
  343. -webkit-transform: rotate(-45deg);
  344. transform: rotate(-45deg); }
  345. .sweet-alert .sa-icon.sa-success .sa-line {
  346. height: 5px;
  347. background-color: #A5DC86;
  348. display: block;
  349. border-radius: 2px;
  350. position: absolute;
  351. z-index: 2; }
  352. .sweet-alert .sa-icon.sa-success .sa-line.sa-tip {
  353. width: 25px;
  354. left: 14px;
  355. top: 46px;
  356. -webkit-transform: rotate(45deg);
  357. transform: rotate(45deg); }
  358. .sweet-alert .sa-icon.sa-success .sa-line.sa-long {
  359. width: 47px;
  360. right: 8px;
  361. top: 38px;
  362. -webkit-transform: rotate(-45deg);
  363. transform: rotate(-45deg); }
  364. .sweet-alert .sa-icon.sa-custom {
  365. background-size: contain;
  366. border-radius: 0;
  367. border: none;
  368. background-position: center center;
  369. background-repeat: no-repeat; }
  370.  
  371. /*
  372. * Animations
  373. */
  374. @-webkit-keyframes showSweetAlert {
  375. 0% {
  376. transform: scale(0.7);
  377. -webkit-transform: scale(0.7); }
  378. 45% {
  379. transform: scale(1.05);
  380. -webkit-transform: scale(1.05); }
  381. 80% {
  382. transform: scale(0.95);
  383. -webkit-transform: scale(0.95); }
  384. 100% {
  385. transform: scale(1);
  386. -webkit-transform: scale(1); } }
  387.  
  388. @keyframes showSweetAlert {
  389. 0% {
  390. transform: scale(0.7);
  391. -webkit-transform: scale(0.7); }
  392. 45% {
  393. transform: scale(1.05);
  394. -webkit-transform: scale(1.05); }
  395. 80% {
  396. transform: scale(0.95);
  397. -webkit-transform: scale(0.95); }
  398. 100% {
  399. transform: scale(1);
  400. -webkit-transform: scale(1); } }
  401.  
  402. @-webkit-keyframes hideSweetAlert {
  403. 0% {
  404. transform: scale(1);
  405. -webkit-transform: scale(1); }
  406. 100% {
  407. transform: scale(0.5);
  408. -webkit-transform: scale(0.5); } }
  409.  
  410. @keyframes hideSweetAlert {
  411. 0% {
  412. transform: scale(1);
  413. -webkit-transform: scale(1); }
  414. 100% {
  415. transform: scale(0.5);
  416. -webkit-transform: scale(0.5); } }
  417.  
  418. @-webkit-keyframes slideFromTop {
  419. 0% {
  420. top: 0%; }
  421. 100% {
  422. top: 50%; } }
  423.  
  424. @keyframes slideFromTop {
  425. 0% {
  426. top: 0%; }
  427. 100% {
  428. top: 50%; } }
  429.  
  430. @-webkit-keyframes slideToTop {
  431. 0% {
  432. top: 50%; }
  433. 100% {
  434. top: 0%; } }
  435.  
  436. @keyframes slideToTop {
  437. 0% {
  438. top: 50%; }
  439. 100% {
  440. top: 0%; } }
  441.  
  442. @-webkit-keyframes slideFromBottom {
  443. 0% {
  444. top: 70%; }
  445. 100% {
  446. top: 50%; } }
  447.  
  448. @keyframes slideFromBottom {
  449. 0% {
  450. top: 70%; }
  451. 100% {
  452. top: 50%; } }
  453.  
  454. @-webkit-keyframes slideToBottom {
  455. 0% {
  456. top: 50%; }
  457. 100% {
  458. top: 70%; } }
  459.  
  460. @keyframes slideToBottom {
  461. 0% {
  462. top: 50%; }
  463. 100% {
  464. top: 70%; } }
  465.  
  466. .showSweetAlert[data-animation=pop] {
  467. -webkit-animation: showSweetAlert 0.3s;
  468. animation: showSweetAlert 0.3s; }
  469.  
  470. .showSweetAlert[data-animation=none] {
  471. -webkit-animation: none;
  472. animation: none; }
  473.  
  474. .showSweetAlert[data-animation=slide-from-top] {
  475. -webkit-animation: slideFromTop 0.3s;
  476. animation: slideFromTop 0.3s; }
  477.  
  478. .showSweetAlert[data-animation=slide-from-bottom] {
  479. -webkit-animation: slideFromBottom 0.3s;
  480. animation: slideFromBottom 0.3s; }
  481.  
  482. .hideSweetAlert[data-animation=pop] {
  483. -webkit-animation: hideSweetAlert 0.2s;
  484. animation: hideSweetAlert 0.2s; }
  485.  
  486. .hideSweetAlert[data-animation=none] {
  487. -webkit-animation: none;
  488. animation: none; }
  489.  
  490. .hideSweetAlert[data-animation=slide-from-top] {
  491. -webkit-animation: slideToTop 0.4s;
  492. animation: slideToTop 0.4s; }
  493.  
  494. .hideSweetAlert[data-animation=slide-from-bottom] {
  495. -webkit-animation: slideToBottom 0.3s;
  496. animation: slideToBottom 0.3s; }
  497.  
  498. @-webkit-keyframes animateSuccessTip {
  499. 0% {
  500. width: 0;
  501. left: 1px;
  502. top: 19px; }
  503. 54% {
  504. width: 0;
  505. left: 1px;
  506. top: 19px; }
  507. 70% {
  508. width: 50px;
  509. left: -8px;
  510. top: 37px; }
  511. 84% {
  512. width: 17px;
  513. left: 21px;
  514. top: 48px; }
  515. 100% {
  516. width: 25px;
  517. left: 14px;
  518. top: 45px; } }
  519.  
  520. @keyframes animateSuccessTip {
  521. 0% {
  522. width: 0;
  523. left: 1px;
  524. top: 19px; }
  525. 54% {
  526. width: 0;
  527. left: 1px;
  528. top: 19px; }
  529. 70% {
  530. width: 50px;
  531. left: -8px;
  532. top: 37px; }
  533. 84% {
  534. width: 17px;
  535. left: 21px;
  536. top: 48px; }
  537. 100% {
  538. width: 25px;
  539. left: 14px;
  540. top: 45px; } }
  541.  
  542. @-webkit-keyframes animateSuccessLong {
  543. 0% {
  544. width: 0;
  545. right: 46px;
  546. top: 54px; }
  547. 65% {
  548. width: 0;
  549. right: 46px;
  550. top: 54px; }
  551. 84% {
  552. width: 55px;
  553. right: 0px;
  554. top: 35px; }
  555. 100% {
  556. width: 47px;
  557. right: 8px;
  558. top: 38px; } }
  559.  
  560. @keyframes animateSuccessLong {
  561. 0% {
  562. width: 0;
  563. right: 46px;
  564. top: 54px; }
  565. 65% {
  566. width: 0;
  567. right: 46px;
  568. top: 54px; }
  569. 84% {
  570. width: 55px;
  571. right: 0px;
  572. top: 35px; }
  573. 100% {
  574. width: 47px;
  575. right: 8px;
  576. top: 38px; } }
  577.  
  578. @-webkit-keyframes rotatePlaceholder {
  579. 0% {
  580. transform: rotate(-45deg);
  581. -webkit-transform: rotate(-45deg); }
  582. 5% {
  583. transform: rotate(-45deg);
  584. -webkit-transform: rotate(-45deg); }
  585. 12% {
  586. transform: rotate(-405deg);
  587. -webkit-transform: rotate(-405deg); }
  588. 100% {
  589. transform: rotate(-405deg);
  590. -webkit-transform: rotate(-405deg); } }
  591.  
  592. @keyframes rotatePlaceholder {
  593. 0% {
  594. transform: rotate(-45deg);
  595. -webkit-transform: rotate(-45deg); }
  596. 5% {
  597. transform: rotate(-45deg);
  598. -webkit-transform: rotate(-45deg); }
  599. 12% {
  600. transform: rotate(-405deg);
  601. -webkit-transform: rotate(-405deg); }
  602. 100% {
  603. transform: rotate(-405deg);
  604. -webkit-transform: rotate(-405deg); } }
  605.  
  606. .animateSuccessTip {
  607. -webkit-animation: animateSuccessTip 0.75s;
  608. animation: animateSuccessTip 0.75s; }
  609.  
  610. .animateSuccessLong {
  611. -webkit-animation: animateSuccessLong 0.75s;
  612. animation: animateSuccessLong 0.75s; }
  613.  
  614. .sa-icon.sa-success.animate::after {
  615. -webkit-animation: rotatePlaceholder 4.25s ease-in;
  616. animation: rotatePlaceholder 4.25s ease-in; }
  617.  
  618. @-webkit-keyframes animateErrorIcon {
  619. 0% {
  620. transform: rotateX(100deg);
  621. -webkit-transform: rotateX(100deg);
  622. opacity: 0; }
  623. 100% {
  624. transform: rotateX(0deg);
  625. -webkit-transform: rotateX(0deg);
  626. opacity: 1; } }
  627.  
  628. @keyframes animateErrorIcon {
  629. 0% {
  630. transform: rotateX(100deg);
  631. -webkit-transform: rotateX(100deg);
  632. opacity: 0; }
  633. 100% {
  634. transform: rotateX(0deg);
  635. -webkit-transform: rotateX(0deg);
  636. opacity: 1; } }
  637.  
  638. .animateErrorIcon {
  639. -webkit-animation: animateErrorIcon 0.5s;
  640. animation: animateErrorIcon 0.5s; }
  641.  
  642. @-webkit-keyframes animateXMark {
  643. 0% {
  644. transform: scale(0.4);
  645. -webkit-transform: scale(0.4);
  646. margin-top: 26px;
  647. opacity: 0; }
  648. 50% {
  649. transform: scale(0.4);
  650. -webkit-transform: scale(0.4);
  651. margin-top: 26px;
  652. opacity: 0; }
  653. 80% {
  654. transform: scale(1.15);
  655. -webkit-transform: scale(1.15);
  656. margin-top: -6px; }
  657. 100% {
  658. transform: scale(1);
  659. -webkit-transform: scale(1);
  660. margin-top: 0;
  661. opacity: 1; } }
  662.  
  663. @keyframes animateXMark {
  664. 0% {
  665. transform: scale(0.4);
  666. -webkit-transform: scale(0.4);
  667. margin-top: 26px;
  668. opacity: 0; }
  669. 50% {
  670. transform: scale(0.4);
  671. -webkit-transform: scale(0.4);
  672. margin-top: 26px;
  673. opacity: 0; }
  674. 80% {
  675. transform: scale(1.15);
  676. -webkit-transform: scale(1.15);
  677. margin-top: -6px; }
  678. 100% {
  679. transform: scale(1);
  680. -webkit-transform: scale(1);
  681. margin-top: 0;
  682. opacity: 1; } }
  683.  
  684. .animateXMark {
  685. -webkit-animation: animateXMark 0.5s;
  686. animation: animateXMark 0.5s; }
  687.  
  688. @-webkit-keyframes pulseWarning {
  689. 0% {
  690. border-color: #F8D486; }
  691. 100% {
  692. border-color: #F8BB86; } }
  693.  
  694. @keyframes pulseWarning {
  695. 0% {
  696. border-color: #F8D486; }
  697. 100% {
  698. border-color: #F8BB86; } }
  699.  
  700. .pulseWarning {
  701. -webkit-animation: pulseWarning 0.75s infinite alternate;
  702. animation: pulseWarning 0.75s infinite alternate; }
  703.  
  704. @-webkit-keyframes pulseWarningIns {
  705. 0% {
  706. background-color: #F8D486; }
  707. 100% {
  708. background-color: #F8BB86; } }
  709.  
  710. @keyframes pulseWarningIns {
  711. 0% {
  712. background-color: #F8D486; }
  713. 100% {
  714. background-color: #F8BB86; } }
  715.  
  716. .pulseWarningIns {
  717. -webkit-animation: pulseWarningIns 0.75s infinite alternate;
  718. animation: pulseWarningIns 0.75s infinite alternate; }
  719.  
  720. @-webkit-keyframes rotate-loading {
  721. 0% {
  722. transform: rotate(0deg); }
  723. 100% {
  724. transform: rotate(360deg); } }
  725.  
  726. @keyframes rotate-loading {
  727. 0% {
  728. transform: rotate(0deg); }
  729. 100% {
  730. transform: rotate(360deg); } }
  731.  
  732. /* Internet Explorer 9 has some special quirks that are fixed here */
  733. /* The icons are not animated. */
  734. /* This file is automatically merged into sweet-alert.min.js through Gulp */
  735. /* Error icon */
  736. .sweet-alert .sa-icon.sa-error .sa-line.sa-left {
  737. -ms-transform: rotate(45deg) \9; }
  738.  
  739. .sweet-alert .sa-icon.sa-error .sa-line.sa-right {
  740. -ms-transform: rotate(-45deg) \9; }
  741.  
  742. /* Success icon */
  743. .sweet-alert .sa-icon.sa-success {
  744. border-color: transparent\9; }
  745.  
  746. .sweet-alert .sa-icon.sa-success .sa-line.sa-tip {
  747. -ms-transform: rotate(45deg) \9; }
  748.  
  749. .sweet-alert .sa-icon.sa-success .sa-line.sa-long {
  750. -ms-transform: rotate(-45deg) \9; }
  751.  
  752. /*!
  753. * Load Awesome v1.1.0 (http://github.danielcardoso.net/load-awesome/)
  754. * Copyright 2015 Daniel Cardoso <@DanielCardoso>
  755. * Licensed under MIT
  756. */
  757. .la-ball-fall,
  758. .la-ball-fall > div {
  759. position: relative;
  760. -webkit-box-sizing: border-box;
  761. -moz-box-sizing: border-box;
  762. box-sizing: border-box; }
  763.  
  764. .la-ball-fall {
  765. display: block;
  766. font-size: 0;
  767. color: #fff; }
  768.  
  769. .la-ball-fall.la-dark {
  770. color: #333; }
  771.  
  772. .la-ball-fall > div {
  773. display: inline-block;
  774. float: none;
  775. background-color: currentColor;
  776. border: 0 solid currentColor; }
  777.  
  778. .la-ball-fall {
  779. width: 54px;
  780. height: 18px; }
  781.  
  782. .la-ball-fall > div {
  783. width: 10px;
  784. height: 10px;
  785. margin: 4px;
  786. border-radius: 100%;
  787. opacity: 0;
  788. -webkit-animation: ball-fall 1s ease-in-out infinite;
  789. -moz-animation: ball-fall 1s ease-in-out infinite;
  790. -o-animation: ball-fall 1s ease-in-out infinite;
  791. animation: ball-fall 1s ease-in-out infinite; }
  792.  
  793. .la-ball-fall > div:nth-child(1) {
  794. -webkit-animation-delay: -200ms;
  795. -moz-animation-delay: -200ms;
  796. -o-animation-delay: -200ms;
  797. animation-delay: -200ms; }
  798.  
  799. .la-ball-fall > div:nth-child(2) {
  800. -webkit-animation-delay: -100ms;
  801. -moz-animation-delay: -100ms;
  802. -o-animation-delay: -100ms;
  803. animation-delay: -100ms; }
  804.  
  805. .la-ball-fall > div:nth-child(3) {
  806. -webkit-animation-delay: 0ms;
  807. -moz-animation-delay: 0ms;
  808. -o-animation-delay: 0ms;
  809. animation-delay: 0ms; }
  810.  
  811. .la-ball-fall.la-sm {
  812. width: 26px;
  813. height: 8px; }
  814.  
  815. .la-ball-fall.la-sm > div {
  816. width: 4px;
  817. height: 4px;
  818. margin: 2px; }
  819.  
  820. .la-ball-fall.la-2x {
  821. width: 108px;
  822. height: 36px; }
  823.  
  824. .la-ball-fall.la-2x > div {
  825. width: 20px;
  826. height: 20px;
  827. margin: 8px; }
  828.  
  829. .la-ball-fall.la-3x {
  830. width: 162px;
  831. height: 54px; }
  832.  
  833. .la-ball-fall.la-3x > div {
  834. width: 30px;
  835. height: 30px;
  836. margin: 12px; }
  837.  
  838. /*
  839. * Animation
  840. */
  841. @-webkit-keyframes ball-fall {
  842. 0% {
  843. opacity: 0;
  844. -webkit-transform: translateY(-145%);
  845. transform: translateY(-145%); }
  846. 10% {
  847. opacity: .5; }
  848. 20% {
  849. opacity: 1;
  850. -webkit-transform: translateY(0);
  851. transform: translateY(0); }
  852. 80% {
  853. opacity: 1;
  854. -webkit-transform: translateY(0);
  855. transform: translateY(0); }
  856. 90% {
  857. opacity: .5; }
  858. 100% {
  859. opacity: 0;
  860. -webkit-transform: translateY(145%);
  861. transform: translateY(145%); } }
  862.  
  863. @-moz-keyframes ball-fall {
  864. 0% {
  865. opacity: 0;
  866. -moz-transform: translateY(-145%);
  867. transform: translateY(-145%); }
  868. 10% {
  869. opacity: .5; }
  870. 20% {
  871. opacity: 1;
  872. -moz-transform: translateY(0);
  873. transform: translateY(0); }
  874. 80% {
  875. opacity: 1;
  876. -moz-transform: translateY(0);
  877. transform: translateY(0); }
  878. 90% {
  879. opacity: .5; }
  880. 100% {
  881. opacity: 0;
  882. -moz-transform: translateY(145%);
  883. transform: translateY(145%); } }
  884.  
  885. @-o-keyframes ball-fall {
  886. 0% {
  887. opacity: 0;
  888. -o-transform: translateY(-145%);
  889. transform: translateY(-145%); }
  890. 10% {
  891. opacity: .5; }
  892. 20% {
  893. opacity: 1;
  894. -o-transform: translateY(0);
  895. transform: translateY(0); }
  896. 80% {
  897. opacity: 1;
  898. -o-transform: translateY(0);
  899. transform: translateY(0); }
  900. 90% {
  901. opacity: .5; }
  902. 100% {
  903. opacity: 0;
  904. -o-transform: translateY(145%);
  905. transform: translateY(145%); } }
  906.  
  907. @keyframes ball-fall {
  908. 0% {
  909. opacity: 0;
  910. -webkit-transform: translateY(-145%);
  911. -moz-transform: translateY(-145%);
  912. -o-transform: translateY(-145%);
  913. transform: translateY(-145%); }
  914. 10% {
  915. opacity: .5; }
  916. 20% {
  917. opacity: 1;
  918. -webkit-transform: translateY(0);
  919. -moz-transform: translateY(0);
  920. -o-transform: translateY(0);
  921. transform: translateY(0); }
  922. 80% {
  923. opacity: 1;
  924. -webkit-transform: translateY(0);
  925. -moz-transform: translateY(0);
  926. -o-transform: translateY(0);
  927. transform: translateY(0); }
  928. 90% {
  929. opacity: .5; }
  930. 100% {
  931. opacity: 0;
  932. -webkit-transform: translateY(145%);
  933. -moz-transform: translateY(145%);
  934. -o-transform: translateY(145%);
  935. transform: translateY(145%); } }

    创建一个js文件命名为:sweetalert.min.js,放在你当前主题的根目录下

 

  1. !function(e,t,n){"use strict";!function o(e,t,n){function a(s,l){if(!t[s]){if(!e[s]){var i="function"==typeof require&&require;if(!l&&i)return i(s,!0);if(r)return r(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return a(n?n:t)},c,c.exports,o,e,t,n)}return t[s].exports}for(var r="function"==typeof require&&require,s=0;s<n.length;s++)a(n[s]);return a}({1:[function(o,a,r){function s(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var l,i,u,c,d=o("./modules/handle-dom"),f=o("./modules/utils"),p=o("./modules/handle-swal-dom"),m=o("./modules/handle-click"),v=o("./modules/handle-key"),y=s(v),b=o("./modules/default-params"),h=s(b),g=o("./modules/set-params"),w=s(g);r["default"]=u=c=function(){function o(e){var t=a;return t[e]===n?h["default"][e]:t[e]}var a=arguments[0];if((0,d.addClass)(t.body,"stop-scrolling"),(0,p.resetInput)(),a===n)return(0,f.logStr)("SweetAlert expects at least 1 attribute!"),!1;var r=(0,f.extend)({},h["default"]);switch(typeof a){case"string":r.title=a,r.text=arguments[1]||"",r.type=arguments[2]||"";break;case"object":if(a.title===n)return(0,f.logStr)('Missing "title" argument!'),!1;r.title=a.title;for(var s in h["default"])r[s]=o(s);r.confirmButtonText=r.showCancelButton?"Confirm":h["default"].confirmButtonText,r.confirmButtonText=o("confirmButtonText"),r.doneFunction=arguments[1]||null;break;default:return(0,f.logStr)('Unexpected type of argument! Expected "string" or "object", got '+typeof a),!1}(0,w["default"])(r),(0,p.fixVerticalPosition)(),(0,p.openModal)(arguments[1]);for(var u=(0,p.getModal)(),v=u.querySelectorAll("button"),b=["onclick","onmouseover","onmouseout","onmousedown","onmouseup","onfocus"],g=function(e){return(0,m.handleButton)(e,r,u)},C=0;C<v.length;C++)for(var S=0;S<b.length;S++){var x=b[S];v[C][x]=g}(0,p.getOverlay)().onclick=g,l=e.onkeydown;var k=function(e){return(0,y["default"])(e,r,u)};e.onkeydown=k,e.onfocus=function(){setTimeout(function(){i!==n&&(i.focus(),i=n)},0)},c.enableButtons()},u.setDefaults=c.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");(0,f.extend)(h["default"],e)},u.close=c.close=function(){var o=(0,p.getModal)();(0,d.fadeOut)((0,p.getOverlay)(),5),(0,d.fadeOut)(o,5),(0,d.removeClass)(o,"showSweetAlert"),(0,d.addClass)(o,"hideSweetAlert"),(0,d.removeClass)(o,"visible");var a=o.querySelector(".sa-icon.sa-success");(0,d.removeClass)(a,"animate"),(0,d.removeClass)(a.querySelector(".sa-tip"),"animateSuccessTip"),(0,d.removeClass)(a.querySelector(".sa-long"),"animateSuccessLong");var r=o.querySelector(".sa-icon.sa-error");(0,d.removeClass)(r,"animateErrorIcon"),(0,d.removeClass)(r.querySelector(".sa-x-mark"),"animateXMark");var s=o.querySelector(".sa-icon.sa-warning");return(0,d.removeClass)(s,"pulseWarning"),(0,d.removeClass)(s.querySelector(".sa-body"),"pulseWarningIns"),(0,d.removeClass)(s.querySelector(".sa-dot"),"pulseWarningIns"),setTimeout(function(){var e=o.getAttribute("data-custom-class");(0,d.removeClass)(o,e)},300),(0,d.removeClass)(t.body,"stop-scrolling"),e.onkeydown=l,e.previousActiveElement&&e.previousActiveElement.focus(),i=n,clearTimeout(o.timeout),!0},u.showInputError=c.showInputError=function(e){var t=(0,p.getModal)(),n=t.querySelector(".sa-input-error");(0,d.addClass)(n,"show");var o=t.querySelector(".sa-error-container");(0,d.addClass)(o,"show"),o.querySelector("p").innerHTML=e,setTimeout(function(){u.enableButtons()},1),t.querySelector("input").focus()},u.resetInputError=c.resetInputError=function(e){if(e&&13===e.keyCode)return!1;var t=(0,p.getModal)(),n=t.querySelector(".sa-input-error");(0,d.removeClass)(n,"show");var o=t.querySelector(".sa-error-container");(0,d.removeClass)(o,"show")},u.disableButtons=c.disableButtons=function(e){var t=(0,p.getModal)(),n=t.querySelector("button.confirm"),o=t.querySelector("button.cancel");n.disabled=!0,o.disabled=!0},u.enableButtons=c.enableButtons=function(e){var t=(0,p.getModal)(),n=t.querySelector("button.confirm"),o=t.querySelector("button.cancel");n.disabled=!1,o.disabled=!1},"undefined"!=typeof e?e.sweetAlert=e.swal=u:(0,f.logStr)("SweetAlert is a frontend module!"),a.exports=r["default"]},{"./modules/default-params":2,"./modules/handle-click":3,"./modules/handle-dom":4,"./modules/handle-key":5,"./modules/handle-swal-dom":6,"./modules/set-params":8,"./modules/utils":9}],2:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var o={title:"",text:"",type:null,allowOutsideClick:!1,showConfirmButton:!0,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#8CD4F5",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null,customClass:"",html:!1,animation:!0,allowEscapeKey:!0,inputType:"text",inputPlaceholder:"",inputValue:"",showLoaderOnConfirm:!1};n["default"]=o,t.exports=n["default"]},{}],3:[function(t,n,o){Object.defineProperty(o,"__esModule",{value:!0});var a=t("./utils"),r=(t("./handle-swal-dom"),t("./handle-dom")),s=function(t,n,o){function s(e){m&&n.confirmButtonColor&&(p.style.backgroundColor=e)}var u,c,d,f=t||e.event,p=f.target||f.srcElement,m=-1!==p.className.indexOf("confirm"),v=-1!==p.className.indexOf("sweet-overlay"),y=(0,r.hasClass)(o,"visible"),b=n.doneFunction&&"true"===o.getAttribute("data-has-done-function");switch(m&&n.confirmButtonColor&&(u=n.confirmButtonColor,c=(0,a.colorLuminance)(u,-.04),d=(0,a.colorLuminance)(u,-.14)),f.type){case"mouseover":s(c);break;case"mouseout":s(u);break;case"mousedown":s(d);break;case"mouseup":s(c);break;case"focus":var h=o.querySelector("button.confirm"),g=o.querySelector("button.cancel");m?g.style.boxShadow="none":h.style.boxShadow="none";break;case"click":var w=o===p,C=(0,r.isDescendant)(o,p);if(!w&&!C&&y&&!n.allowOutsideClick)break;m&&b&&y?l(o,n):b&&y||v?i(o,n):(0,r.isDescendant)(o,p)&&"BUTTON"===p.tagName&&sweetAlert.close()}},l=function(e,t){var n=!0;(0,r.hasClass)(e,"show-input")&&(n=e.querySelector("input").value,n||(n="")),t.doneFunction(n),t.closeOnConfirm&&sweetAlert.close(),t.showLoaderOnConfirm&&sweetAlert.disableButtons()},i=function(e,t){var n=String(t.doneFunction).replace(/\s/g,""),o="function("===n.substring(0,9)&&")"!==n.substring(9,10);o&&t.doneFunction(!1),t.closeOnCancel&&sweetAlert.close()};o["default"]={handleButton:s,handleConfirm:l,handleCancel:i},n.exports=o["default"]},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],4:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});var r=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},s=function(e,t){r(e,t)||(e.className+=" "+t)},l=function(e,t){var n=" "+e.className.replace(/[\t\r\n]/g," ")+" ";if(r(e,t)){for(;n.indexOf(" "+t+" ")>=0;)n=n.replace(" "+t+" "," ");e.className=n.replace(/^\s+|\s+$/g,"")}},i=function(e){var n=t.createElement("div");return n.appendChild(t.createTextNode(e)),n.innerHTML},u=function(e){e.style.opacity="",e.style.display="block"},c=function(e){if(e&&!e.length)return u(e);for(var t=0;t<e.length;++t)u(e[t])},d=function(e){e.style.opacity="",e.style.display="none"},f=function(e){if(e&&!e.length)return d(e);for(var t=0;t<e.length;++t)d(e[t])},p=function(e,t){for(var n=t.parentNode;null!==n;){if(n===e)return!0;n=n.parentNode}return!1},m=function(e){e.style.left="-9999px",e.style.display="block";var t,n=e.clientHeight;return t="undefined"!=typeof getComputedStyle?parseInt(getComputedStyle(e).getPropertyValue("padding-top"),10):parseInt(e.currentStyle.padding),e.style.left="",e.style.display="none","-"+parseInt((n+t)/2)+"px"},v=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var n=+new Date,o=function a(){e.style.opacity=+e.style.opacity+(new Date-n)/100,n=+new Date,+e.style.opacity<1&&setTimeout(a,t)};o()}e.style.display="block"},y=function(e,t){t=t||16,e.style.opacity=1;var n=+new Date,o=function a(){e.style.opacity=+e.style.opacity-(new Date-n)/100,n=+new Date,+e.style.opacity>0?setTimeout(a,t):e.style.display="none"};o()},b=function(n){if("function"==typeof MouseEvent){var o=new MouseEvent("click",{view:e,bubbles:!1,cancelable:!0});n.dispatchEvent(o)}else if(t.createEvent){var a=t.createEvent("MouseEvents");a.initEvent("click",!1,!1),n.dispatchEvent(a)}else t.createEventObject?n.fireEvent("onclick"):"function"==typeof n.onclick&&n.onclick()},h=function(t){"function"==typeof t.stopPropagation?(t.stopPropagation(),t.preventDefault()):e.event&&e.event.hasOwnProperty("cancelBubble")&&(e.event.cancelBubble=!0)};a.hasClass=r,a.addClass=s,a.removeClass=l,a.escapeHtml=i,a._show=u,a.show=c,a._hide=d,a.hide=f,a.isDescendant=p,a.getTopMargin=m,a.fadeIn=v,a.fadeOut=y,a.fireClick=b,a.stopEventPropagation=h},{}],5:[function(t,o,a){Object.defineProperty(a,"__esModule",{value:!0});var r=t("./handle-dom"),s=t("./handle-swal-dom"),l=function(t,o,a){var l=t||e.event,i=l.keyCode||l.which,u=a.querySelector("button.confirm"),c=a.querySelector("button.cancel"),d=a.querySelectorAll("button[tabindex]");if(-1!==[9,13,32,27].indexOf(i)){for(var f=l.target||l.srcElement,p=-1,m=0;m<d.length;m++)if(f===d[m]){p=m;break}9===i?(f=-1===p?u:p===d.length-1?d[0]:d[p+1],(0,r.stopEventPropagation)(l),f.focus(),o.confirmButtonColor&&(0,s.setFocusStyle)(f,o.confirmButtonColor)):13===i?("INPUT"===f.tagName&&(f=u,u.focus()),f=-1===p?u:n):27===i&&o.allowEscapeKey===!0?(f=c,(0,r.fireClick)(f,l)):f=n}};a["default"]=l,o.exports=a["default"]},{"./handle-dom":4,"./handle-swal-dom":6}],6:[function(n,o,a){function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(a,"__esModule",{value:!0});var s=n("./utils"),l=n("./handle-dom"),i=n("./default-params"),u=r(i),c=n("./injected-html"),d=r(c),f=".sweet-alert",p=".sweet-overlay",m=function(){var e=t.createElement("div");for(e.innerHTML=d["default"];e.firstChild;)t.body.appendChild(e.firstChild)},v=function x(){var e=t.querySelector(f);return e||(m(),e=x()),e},y=function(){var e=v();return e?e.querySelector("input"):void 0},b=function(){return t.querySelector(p)},h=function(e,t){var n=(0,s.hexToRgb)(t);e.style.boxShadow="0 0 2px rgba("+n+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"},g=function(n){var o=v();(0,l.fadeIn)(b(),10),(0,l.show)(o),(0,l.addClass)(o,"showSweetAlert"),(0,l.removeClass)(o,"hideSweetAlert"),e.previousActiveElement=t.activeElement;var a=o.querySelector("button.confirm");a.focus(),setTimeout(function(){(0,l.addClass)(o,"visible")},500);var r=o.getAttribute("data-timer");if("null"!==r&&""!==r){var s=n;o.timeout=setTimeout(function(){var e=(s||null)&&"true"===o.getAttribute("data-has-done-function");e?s(null):sweetAlert.close()},r)}},w=function(){var e=v(),t=y();(0,l.removeClass)(e,"show-input"),t.value=u["default"].inputValue,t.setAttribute("type",u["default"].inputType),t.setAttribute("placeholder",u["default"].inputPlaceholder),C()},C=function(e){if(e&&13===e.keyCode)return!1;var t=v(),n=t.querySelector(".sa-input-error");(0,l.removeClass)(n,"show");var o=t.querySelector(".sa-error-container");(0,l.removeClass)(o,"show")},S=function(){var e=v();e.style.marginTop=(0,l.getTopMargin)(v())};a.sweetAlertInitialize=m,a.getModal=v,a.getOverlay=b,a.getInput=y,a.setFocusStyle=h,a.openModal=g,a.resetInput=w,a.resetInputError=C,a.fixVerticalPosition=S},{"./default-params":2,"./handle-dom":4,"./injected-html":7,"./utils":9}],7:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var o='<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert"><div class="sa-icon sa-error">\n <span class="sa-x-mark">\n <span class="sa-line sa-left"></span>\n <span class="sa-line sa-right"></span>\n </span>\n </div><div class="sa-icon sa-warning">\n <span class="sa-body"></span>\n <span class="sa-dot"></span>\n </div><div class="sa-icon sa-info"></div><div class="sa-icon sa-success">\n <span class="sa-line sa-tip"></span>\n <span class="sa-line sa-long"></span>\n\n <div class="sa-placeholder"></div>\n <div class="sa-fix"></div>\n </div><div class="sa-icon sa-custom"></div><h2>Title</h2>\n <p>Text</p>\n <fieldset>\n <input type="text" tabIndex="3" />\n <div class="sa-input-error"></div>\n </fieldset><div class="sa-error-container">\n <div class="icon">!</div>\n <p>Not valid!</p>\n </div><div class="sa-button-container">\n <button class="cancel" tabIndex="2">Cancel</button>\n <div class="sa-confirm-button-container">\n <button class="confirm" tabIndex="1">OK</button><div class="la-ball-fall">\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n </div></div>';n["default"]=o,t.exports=n["default"]},{}],8:[function(e,t,o){Object.defineProperty(o,"__esModule",{value:!0});var a=e("./utils"),r=e("./handle-swal-dom"),s=e("./handle-dom"),l=["error","warning","info","success","input","prompt"],i=function(e){var t=(0,r.getModal)(),o=t.querySelector("h2"),i=t.querySelector("p"),u=t.querySelector("button.cancel"),c=t.querySelector("button.confirm");if(o.innerHTML=e.html?e.title:(0,s.escapeHtml)(e.title).split("\n").join("<br>"),i.innerHTML=e.html?e.text:(0,s.escapeHtml)(e.text||"").split("\n").join("<br>"),e.text&&(0,s.show)(i),e.customClass)(0,s.addClass)(t,e.customClass),t.setAttribute("data-custom-class",e.customClass);else{var d=t.getAttribute("data-custom-class");(0,s.removeClass)(t,d),t.setAttribute("data-custom-class","")}if((0,s.hide)(t.querySelectorAll(".sa-icon")),e.type&&!(0,a.isIE8)()){var f=function(){for(var o=!1,a=0;a<l.length;a++)if(e.type===l[a]){o=!0;break}if(!o)return logStr("Unknown alert type: "+e.type),{v:!1};var i=["success","error","warning","info"],u=n;-1!==i.indexOf(e.type)&&(u=t.querySelector(".sa-icon.sa-"+e.type),(0,s.show)(u));var c=(0,r.getInput)();switch(e.type){case"success":(0,s.addClass)(u,"animate"),(0,s.addClass)(u.querySelector(".sa-tip"),"animateSuccessTip"),(0,s.addClass)(u.querySelector(".sa-long"),"animateSuccessLong");break;case"error":(0,s.addClass)(u,"animateErrorIcon"),(0,s.addClass)(u.querySelector(".sa-x-mark"),"animateXMark");break;case"warning":(0,s.addClass)(u,"pulseWarning"),(0,s.addClass)(u.querySelector(".sa-body"),"pulseWarningIns"),(0,s.addClass)(u.querySelector(".sa-dot"),"pulseWarningIns");break;case"input":case"prompt":c.setAttribute("type",e.inputType),c.value=e.inputValue,c.setAttribute("placeholder",e.inputPlaceholder),(0,s.addClass)(t,"show-input"),setTimeout(function(){c.focus(),c.addEventListener("keyup",swal.resetInputError)},400)}}();if("object"==typeof f)return f.v}if(e.imageUrl){var p=t.querySelector(".sa-icon.sa-custom");p.style.backgroundImage="url("+e.imageUrl+")",(0,s.show)(p);var m=80,v=80;if(e.imageSize){var y=e.imageSize.toString().split("x"),b=y[0],h=y[1];b&&h?(m=b,v=h):logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+e.imageSize)}p.setAttribute("style",p.getAttribute("style")+"width:"+m+"px; height:"+v+"px")}t.setAttribute("data-has-cancel-button",e.showCancelButton),e.showCancelButton?u.style.display="inline-block":(0,s.hide)(u),t.setAttribute("data-has-confirm-button",e.showConfirmButton),e.showConfirmButton?c.style.display="inline-block":(0,s.hide)(c),e.cancelButtonText&&(u.innerHTML=(0,s.escapeHtml)(e.cancelButtonText)),e.confirmButtonText&&(c.innerHTML=(0,s.escapeHtml)(e.confirmButtonText)),e.confirmButtonColor&&(c.style.backgroundColor=e.confirmButtonColor,c.style.borderLeftColor=e.confirmLoadingButtonColor,c.style.borderRightColor=e.confirmLoadingButtonColor,(0,r.setFocusStyle)(c,e.confirmButtonColor)),t.setAttribute("data-allow-outside-click",e.allowOutsideClick);var g=!!e.doneFunction;t.setAttribute("data-has-done-function",g),e.animation?"string"==typeof e.animation?t.setAttribute("data-animation",e.animation):t.setAttribute("data-animation","pop"):t.setAttribute("data-animation","none"),t.setAttribute("data-timer",e.timer)};o["default"]=i,t.exports=o["default"]},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],9:[function(t,n,o){Object.defineProperty(o,"__esModule",{value:!0});var a=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},r=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16):null},s=function(){return e.attachEvent&&!e.addEventListener},l=function(t){"undefined"!=typeof e&&e.console&&e.console.log("SweetAlert: "+t)},i=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;var n,o,a="#";for(o=0;3>o;o++)n=parseInt(e.substr(2*o,2),16),n=Math.round(Math.min(Math.max(0,n+n*t),255)).toString(16),a+=("00"+n).substr(n.length);return a};o.extend=a,o.hexToRgb=r,o.isIE8=s,o.logStr=l,o.colorLuminance=i},{}]},{},[1]),"function"==typeof define&&define.amd?define(function(){return sweetAlert}):"undefined"!=typeof module&&module.exports&&(module.exports=sweetAlert)}(window,document);
本文最后更新于2019-7-31,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
分享到:
打赏
未经允许不得转载:

作者: 黑毒网络, 转载或复制请以 超链接形式 并注明出处 黑毒资源网
原文地址: 《Emlog给主题添加复制粘贴弹窗代码》 发布于2019-7-31

评论

切换注册

登录

您也可以使用第三方帐号快捷登录

切换登录

注册

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

黑毒网络科技

关注公众号

黑毒网络技术团队公众号关注我们有好礼哟!

了解一下
00:00 / 00:00
随机播放
欢迎来到黑毒资源网
黑毒