PageSourceSearch

https://open-training.com/userfiles/modules/microweber/api/tools/common.js

js open-training.com collected 2026-09-27 04:26:55 UTC 6,111 bytes, 166 lines download raw bytes

1$(window).load(function () {
2    mw.loaded = true;
3    mw.tools.addClass(document.body, 'loaded');
4    mw.tools.removeClass(document.body, 'loading');
5    mw.$('div.mw-ui-field').click(function (e) {
6        if (e.target.type != 'text') {
7            try {
8                this.querySelector('input[type="text"]').focus();
9            }
10            catch (e) {
11            }
12        }
13    });
14
15    mw.dropdown();
16});
17$(mwd).ready(function () {
18    mw.tools.constructions();
19    mw.dropdown();
20    mw.$(document.body).ajaxStop(function () {
21        setTimeout(function () {
22            mw.dropdown();
23        }, 1222);
24    });
25    mw.on('mwDialogShow', function(){
26        mw.$(document.documentElement).addClass('mw-dialog-opened');
27    });
28    mw.on('mwDialogHide', function(){
29        mw.$(document.documentElement).removeClass('mw-dialog-opened');
30    });
31    mw.$(document.body).on('mousemove touchmove touchstart', function (event) {
32        var has = mw.tools.firstParentOrCurrentWithClass(event.target, 'tip');
33        if (has && (!has.dataset.trigger || has.dataset.trigger === 'move')) {
34            mw.tools.titleTip(has);
35        }
36        else {
37            mw.$(mw.tools._titleTip).hide();
38        }
39    }).on('click', function (event) {
40        var has = mw.tools.firstParentOrCurrentWithClass(event.target, 'tip');
41        if (has && has.dataset.trigger === 'click') {
42            mw.tools.titleTip(has, '_titleTipClick');
43        }
44        else {
45            mw.$(mw.tools._titleTipClick).hide();
46        }
47    });
48    mw.$(".mw-onoff").each(function () {
49        if (!$(this).hasClass('activated')) {
50            mw.$(this).addClass('activated');
51            mw.$(this).mousedown(function () {
52                var el = this;
53                if (mw.tools.hasClass(el, 'active')) {
54                    mw.tools.removeClass(el, 'active');
55                    el.querySelector('.is_active_n').checked = true;
56                }
57                else {
58                    mw.tools.addClass(el, 'active');
59                    el.querySelector('.is_active_y').checked = true;
60                }
61            });
62        }
63    });
64    mw.$(".wysiwyg-convertible-toggler").click(function () {
65        var el = mw.$(this), next = el.next();
66        mw.$(".wysiwyg-convertible").not(next).removeClass("active");
67        mw.$(".wysiwyg-convertible-toggler").not(el).removeClass("active");
68        next.toggleClass("active");
69        el.toggleClass("active");
70        if (el.hasClass("active")) {
71            if (typeof mw.liveEditWYSIWYG === 'object') {
72                mw.liveedit.toolbar.editor.fixConvertible(next);
73            }
74        }
75    });
76    mw.$(".mw-dropdown-search")
77        .on('focus', function (e) {
78            $(this).parents('.create-content-dropdown').addClass('focus');
79        })
80        .on('blur', function (e) {
81            $(this).parents('.create-content-dropdown').removeClass('focus');
82        })
83        .on('keyup', function (e) {
84        if (e.keyCode === '27') {
85            mw.$(this.parentNode.parentNode).hide();
86        }
87        if (e.keyCode !== '13' && e.keyCode !== '27' && e.keyCode !== '32') {
88            var el = mw.$(this);
89            el.addClass('mw-dropdown-searchSearching');
90            mw.tools.ajaxSearch({keyword: this.value, limit: 20}, function () {
91                var html = "<ul>", l = this.length, i = 0;
92                for (; i < l; i++) {
93                    var a = this[i];
94                    html += '<li class="' + a.content_type + ' ' + a.subtype + '"><a href="' + a.url + '" title="' + a.title + '">' + a.title + '</a></li>';
95                }
96                html += '</ul>';
97                el.parent().next("ul").replaceWith(html);
98                el.removeClass('mw-dropdown-searchSearching');
99            });
100        }
101    });
102    var _mwoldww = mw.$(window).width();
103    mw.$(window).resize(function () {
104        if ($(window).width() > _mwoldww) {
105            mw.trigger("increaseWidth");
106        }
107        else if ($(window).width() < _mwoldww) {
108            mw.trigger("decreaseWidth");
109        }
110        $.noop();
111        _mwoldww = mw.$(window).width();
112    });
113    mw.$(document.body).on("keydown", function (e) {
114        var isgal = document.querySelector('.mw_modal_gallery') !== null;
115        if (isgal) {
116            if (e.keyCode === 27) {  /* escape */
117                mw.dialog.remove(mw.$(".mw_modal_gallery"))
118                mw.tools.cancelFullscreen()
119            }
120            else if (e.keyCode === 37) { /* left */
121                mw.tools.gallery.prev(mw.$(".mw_modal_gallery")[0].modal)
122            }
123            else if (e.keyCode === 39) { /* right */
124                mw.tools.gallery.next(mw.$(".mw_modal_gallery")[0].modal)
125            }
126            else if (e.keyCode === 122) {/* F11 */
127                mw.event.cancel(e, true);
128                mw.tools.toggleFullscreen(mw.$(".mw_modal_gallery")[0]);
129                return false;
130            }
131        }
132        else {
133            if (e.keyCode === 27) {
134                var modal = mw.$(".mw_modal:last")[0];
135                if (modal) modal.modal.remove();
136            }
137        }
138    });
139
140    mw.$(".mw-image-holder").each(function () {
141        if ($(".mw-image-holder-overlay", this).length === 0) {
142            mw.$('img', this).eq(0).after('<span class="mw-image-holder-overlay"></span>');
143        }
144    });
145
146    mw.$(".mw-ui-dropdown").on('touchstart mousedown', function(){
147        mw.$(this).toggleClass('active')
148    });
149    mw.$(document.body).on('touchend mouseup', function(e){
150        if(!mw.tools.hasAnyOfClassesOnNodeOrParent(e.target, ['mw-ui-dropdown'])){
151            mw.$(".mw-ui-dropdown.active").removeClass('active')
152        }
153    });
154    mw.$(document.body).on('click', 'a', function(e){
155        if(location.hash.indexOf('#mw@') !== -1 && (e.target.href || '').indexOf('#mw@') !== -1){
156            if(location.href === e.target.href){
157                var el = mw.$('#' + e.target.href.split('mw@')[1])[0];
158                if(el){
159                    mw.tools.scrollTo(el)
160                }
161            }
162        }
163    })
164
165
166});

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.