地质所 沉降监测网建设项目
zmk
2024-05-22 28e168f05d3eb48223e69064188c6fce786442d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*!
 * Help dialog plugin for Editor.md
 *
 * @file        help-dialog.js
 * @author      pandao
 * @version     1.2.0
 * @updateTime  2015-03-08
 * {@link       https://github.com/pandao/editor.md}
 * @license     MIT
 */
 
(function() {
 
    var factory = function (exports) {
 
        var $            = jQuery;
        var pluginName   = "help-dialog";
 
        exports.fn.helpDialog = function() {
            var _this       = this;
            var lang        = this.lang;
            var editor      = this.editor;
            var settings    = this.settings;
            var path        = settings.pluginPath + pluginName + "/";
            var classPrefix = this.classPrefix;
            var dialogName  = classPrefix + pluginName, dialog;
            var dialogLang  = lang.dialog.help;
 
            if (editor.find("." + dialogName).length < 1)
            {            
                var dialogContent = "<div class=\"markdown-body\" style=\"font-family:微软雅黑, Helvetica, Tahoma, STXihei,Arial;height:390px;overflow:auto;font-size:14px;border-bottom:1px solid #ddd;padding:0 20px 20px 0;\"></div>";
 
                dialog = this.createDialog({
                    name       : dialogName,
                    title      : dialogLang.title,
                    width      : 840,
                    height     : 540,
                    mask       : settings.dialogShowMask,
                    drag       : settings.dialogDraggable,
                    content    : dialogContent,
                    lockScreen : settings.dialogLockScreen,
                    maskStyle  : {
                        opacity         : settings.dialogMaskOpacity,
                        backgroundColor : settings.dialogMaskBgColor
                    },
                    buttons    : {
                        close : [lang.buttons.close, function() {      
                            this.hide().lockScreen(false).hideMask();
                            
                            return false;
                        }]
                    }
                });
            }
 
            dialog = editor.find("." + dialogName);
 
            this.dialogShowMask(dialog);
            this.dialogLockScreen();
            dialog.show();
 
            var helpContent = dialog.find(".markdown-body");
 
            if (helpContent.html() === "") 
            {
                $.get(path + "help.md", function(text) {
                    var md = exports.$marked(text);
                    helpContent.html(md);
                    
                    helpContent.find("a").attr("target", "_blank");
                });
            }
        };
 
    };
    
    // CommonJS/Node.js
    if (typeof require === "function" && typeof exports === "object" && typeof module === "object")
    { 
        module.exports = factory;
    }
    else if (typeof define === "function")  // AMD/CMD/Sea.js
    {
        if (define.amd) { // for Require.js
 
            define(["editormd"], function(editormd) {
                factory(editormd);
            });
 
        } else { // for Sea.js
            define(function(require) {
                var editormd = require("./../../editormd");
                factory(editormd);
            });
        }
    } 
    else
    {
        factory(window.editormd);
    }
 
})();