plugins-popup-tksj.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
  3. typeof define === 'function' && define.amd ? define(['exports'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.main = {}));
  5. }(this, (function (exports) { 'use strict';
  6. function ___$insertStyle(css) {
  7. if (!css) {
  8. return;
  9. }
  10. if (typeof window === 'undefined') {
  11. return;
  12. }
  13. var style = document.createElement('style');
  14. style.setAttribute('type', 'text/css');
  15. style.innerHTML = css;
  16. document.head.appendChild(style);
  17. return css;
  18. }
  19. var main = "<div class=\"popup-content\">\r\n <div class=\"head clearfix\">\r\n <span class=\"head-item-1\">提示</span><span class=\"head-item-2\">X</span>\r\n </div> \r\n <div class=\"content\">\r\n 抱歉,您所使用的浏览器无法完成此操作。 加入收藏失败,请使用Ctrl+D进行添加\r\n </div>\r\n <div class=\"bottom\">\r\n 确定\r\n </div>\r\n</div>\r\n";
  20. ___$insertStyle("* {\n margin: 0;\n padding: 0;\n}\n\n.gudie-button {\n cursor: pointer;\n}\n\n.clearfix:after {\n visibility: hidden;\n display: block;\n font-size: 0;\n content: \" \";\n clear: both;\n height: 0;\n}\n\n#plugin-popup {\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n position: fixed;\n display: none;\n z-index: 2;\n top: 0;\n left: 0;\n}\n#plugin-popup .popup-content {\n margin: 20% auto;\n width: 310px;\n height: 200px;\n background-color: white;\n border-radius: 20px;\n line-height: 30px;\n}\n#plugin-popup .popup-content .head {\n padding: 15px;\n border-bottom: 1px solid #999;\n}\n#plugin-popup .popup-content .head .head-item-1 {\n float: left;\n font-size: 16px;\n}\n#plugin-popup .popup-content .head .head-item-2 {\n float: right;\n font-size: 16px;\n cursor: pointer;\n}\n#plugin-popup .popup-content .content {\n font-size: 14px;\n color: #333;\n padding: 5% 20px;\n}\n#plugin-popup .popup-content .bottom {\n background-color: #c76315;\n color: white;\n width: 50px;\n height: 30px;\n font-size: 16px;\n text-align: center;\n line-height: 30px;\n float: right;\n cursor: pointer;\n margin-right: 20px;\n}");
  21. function initMain() {
  22. var div = document.createElement("div");
  23. div.innerHTML = _.template(main)({
  24. ABC: "AAAA"
  25. });
  26. div.id = "plugin-popup";
  27. document.body.appendChild(div);
  28. var target = document.querySelector("#plugin-popup");
  29. var bottom = document.querySelector(".bottom");
  30. var button = document.querySelector(".head-item-2");
  31. var collectButton = document.querySelector(".gudie-button");
  32. bottom.addEventListener("click", function () {
  33. target.style.display = "none";
  34. });
  35. button.addEventListener("click", function () {
  36. target.style.display = "none";
  37. });
  38. collectButton.addEventListener("click", function () {
  39. target.style.display = "block";
  40. });
  41. }
  42. initMain();
  43. exports.initMain = initMain;
  44. Object.defineProperty(exports, '__esModule', { value: true });
  45. })));