PageSourceSearch

https://kbrainc.com/weven_service/asset/js/bm2/com/tooloption/ToolOpTextLinkSmall.js

js kbrainc.com collected 2026-10-04 11:39:52 UTC 4,599 bytes, 147 lines download raw bytes

1/**
2 * created by WEVEN on 2020-03-02
3 * 아래의 소스는 WEVEN에 저작권이 있으므로 무단 사용 및 재 배포를 금합니다.
4 */
5var ToolOpTextLinkSmall = function() {
6    /*
7    옵션 생성시 아래 2개의 변수는 반드시 처음 생성해줘야 함.
8     */
9    this.type = "ToolOpTextLinkSmall";
10    this.element = $("[data-wv-tool-option=ToolOpTextLinkSmall]");
11    var _this = this;
12
13    this.inputList = [];
14    this.radioList = [];
15
16    this.radioList.push(this.element.find('[data-wv-tool-option-btn="_self"]').parent()[0]);
17    this.radioList.push(this.element.find('[data-wv-tool-option-btn="_blank"]').parent()[0]);
18    this.inputList.push(this.element.find('[data-wv-tool-option-btn="url"]')[0]);
19    this.inputList.push(this.element.find('[data-wv-tool-option-btn="title"]')[0]);
20
21    //this.onWindowDown = function(e){
22    //    e.stopImmediatePropagation();
23    //    bm.selectionManager.restoreRange();
24    //}
25
26    this.onTextInputDown = function(e){
27        e.stopImmediatePropagation();
28        if( bm.selectionManager.getRange() && $(bm.selectionManager.getRange().startContainer).closest(".wveditor_text").length > 0 ){
29            bm.selectionManager.saveRange();
30        }
31    }
32
33    this.getUrl = function () {
34        return $(this.optionBtnList["url"]).val();
35    }
36
37    this.getTitle = function () {
38        return $(this.optionBtnList["title"]).val();
39    }
40
41    this.getTarget = function () {
42        return $(this.optionBtnList["_self"]).is(":checked") ? "_self" : "_blank";
43    }
44
45    this.applyLink = function ( type ) {
46
47        var url = this.getUrl();
48
49        if(type === "apply" && !url) {
50            alert(systemLangPack.getMessage('SLSATTB0025')); //링크주소를 입력해주세요.
51            $(this.optionBtnList["url"]).focus();
52            return;
53        } else if(type === "home"){
54            url = WEB_ROOT.replace("webadm/", "web/");
55            if( WEB_ROOT.indexOf(SITE_ID+".weven") > -1 ){
56                url = WEB_ROOT.replace("webadm/", "");
57            }
58        }
59
60        var checkUrl = url.split('?')[0];
61        var isValidUrl = bm.valid.isValidUrl(checkUrl);
62        if(type === "apply" && !isValidUrl && !url.includes('[WEB_ROOT]')) {
63            alert(systemLangPack.getMessage('SLSATTB0026')); //링크주소 형식이 잘못 되었습니다. 다시 입력해주세요.
64            $(this.optionBtnList["url"]).focus();
65            return;
66        }
67
68        var title = this.getTitle();
69        /*if(!title) {
70            alert("타이틀을 입력해주세요.");
71            $(this.optionBtnList["title"]).focus();
72            return;
73        }*/
74
75        _this.onOptionChange( _this.type, { type : "apply", url :url, title: title, target : _this.getTarget() } );
76    }
77
78    this.removeLink = function () {
79        this.onOptionChange( _this.type, { type : "remove" } );
80    }
81
82    this.findPage = function () {
83        this.onOptionChange( _this.type, { type : "page" } );
84    }
85
86    this.onOptionBtnClick = function( data ){
87        switch (data){
88            case "home":
89            case "apply":
90                this.applyLink( data );
91                break;
92            case "remove":
93                this.removeLink();
94                break;
95            case "page":
96                this.findPage();
97                break;
98        }
99    }
100}
101
102bm.extend(ToolOpBase , ToolOpTextLinkSmall);
103
104ToolOpTextLinkSmall.prototype.addEvent = function() {
105    var _this = this;
106
107    $(_this.inputList).on("focus", function() {
108        $(this).select();
109    });
110
111    $(_this.inputList).on("focusout", function() {
112        var val = $(this).val();
113        $(this).val($.trim(val));
114    });
115
116    $(_this.radioList).on("mousedown", function(e) {
117        _this.onTextInputDown(e);
118    });
119
120    $(_this.inputList).on("mousedown", function(e) {
121        _this.onTextInputDown(e);
122        $(this).select();
123    });
124
125
126    $(_this.inputList).on("keydown", function(e) {
127        if(e.keyCode == 13) {
128            _this.setLink("apply");
129
130            e.preventDefault();
131        }
132    });
133
134    //$(window).on("mousedown", this.onWindowDown);
135}
136
137ToolOpTextLinkSmall.prototype.removeEvent = function() {
138    var _this = this;
139
140    $(_this.inputList).off("focus");
141    $(_this.inputList).off("focusout");
142    $(_this.inputList).off("mousedown");
143    $(_this.radioList).off("mousedown");
144    $(_this.inputList).off("keydown");
145
146    //$(window).off("mousedown", this.onWindowDown);
147}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.