PageSourceSearch

https://vanermuseet.se/download/18.14cbd161707e557d1a190/1584087832801/mmenu.debugger.js

js vanermuseet.se collected 2026-10-02 12:36:50 UTC 13,076 bytes, 417 lines download raw bytes

1/**
2 * Debugger for mmenu.js
3 * Include this file after including the mmenu.js plugin to debug your menu.
4 */
5(function() {
6    const _console = Mmenu.console ||
7        console || {
8            log: function() {},
9            warn: function() {},
10            error: function() {},
11            group: function() {},
12            groupEnd: function() {}
13        };
14
15    const warnings = [];
16    const deprecated = (depr, repl, vers) => {
17        var msg = 'Mmenu: ' + depr + ' is deprecated';
18
19        if (vers) {
20            msg += ' as of version ' + vers;
21        }
22        if (repl) {
23            msg += ', use ' + repl + ' instead';
24        }
25        msg += '.';
26
27        warnings.push(msg);
28    };
29
30    if (typeof Mmenu == 'undefined') {
31        _console.error(
32            'Global variable "Mmenu" (needed for the debugger) not found!'
33        );
34        return;
35    }
36
37    /** Log deprecated warnings. */
38    Mmenu.prototype._deprecatedWarnings = function() {
39        /**
40         * ----------------------------
41         * Version 8.4 > 8.5
42         * ----------------------------
43         */
44
45        /* Add-ons */
46
47        //  Navbars "next" content is removed.
48        if (this.opts.navbars) {
49            this.opts.navbars.forEach(navbar => {
50                if (navbar.content.includes('next')) {
51                    deprecated(
52                        'The "next" content for the "navbars" add-on',
53                        null,
54                        '8.5.0'
55                    );
56                }
57            });
58        }
59
60        /* Extensions */
61
62        // Removed the tileview extension.
63        ['tileview'].forEach(ext => {
64            Object.keys(this.opts.extensions).forEach(key => {
65                if (this.opts.extensions[key].includes(ext)) {
66                    deprecated(
67                        'The "' + ext + '" extension',
68                        'custom CSS',
69                        '8.5.0'
70                    );
71                }
72            });
73        });
74
75        /**
76         * ----------------------------
77         * Version 8.3 > 8.4
78         * ----------------------------
79         */
80
81        /* Config */
82
83        //  Styling listitems with "spacer" is removed.
84        if (
85            this.conf.classNames.spacer ||
86            this.node.menu.querySelector('.Spacer')
87        ) {
88            deprecated(
89                'Styling a listitem with "Spacer"',
90                'custom CSS',
91                '8.4.0'
92            );
93        }
94
95        /**
96         * ----------------------------
97         * Version 8.2 > 8.3
98         * ----------------------------
99         */
100
101        /* OPTIONS */
102
103        //  The navbar.title option can no longer be a function.
104        if (typeof this.opts.navbar.title == 'function') {
105            deprecated(
106                'A function for the "navbar.title" option',
107                'a custom JS loop',
108                '8.3.0'
109            );
110
111            //  Prevent an error.
112            this.opts.navbar.title = Mmenu.options.navbar.title;
113        }
114
115        /* ADD-ONS */
116
117        //  New Drag add-on with lesser options.
118        if (this.opts.drag) {
119            //  Swiping to close panels no longer supported.
120            if (this.opts.drag.panels) {
121                deprecated(
122                    'Swiping to close panels using the "drag" add-on',
123                    null,
124                    '8.3.0'
125                );
126            }
127
128            //  "drag.menu" Suboptions now are the "drag" options.
129            if (this.opts.drag.menu) {
130                deprecated(
131                    'The "drag.menu" options for the "drag" add-on',
132                    'the "drag" option',
133                    '8.3.0'
134                );
135            }
136        }
137
138        // The dividers.type option is removed.
139        if (this.opts.dividers) {
140            if (this.opts.dividers.type == 'light') {
141                deprecated(
142                    'The "type" option for the "dividers" add-on',
143                    'custom CSS',
144                    '8.3.0'
145                );
146            }
147        }
148
149        /* EXTENSIONS */
150
151        // Removed panel-scoped extensions.
152        [
153            'mm-panel-border-none',
154            'mm-panel-border-full',
155            'mm-panel_listview-justify',
156            'mm-panel-slide-0',
157            'mm-panel-slide-100'
158        ].forEach(ext => {
159            if (this.node.menu.querySelector(ext)) {
160                deprecated(
161                    'Using the classname ' + ext + ' on a specific panel.',
162                    'custom CSS',
163                    '8.3.0'
164                );
165            }
166        });
167
168        //  Removed (parts of) extensions.
169        [
170            'border-offset',
171            'fx-menu-fade',
172            'fx-menu-zoom',
173            'fx-panels-slide-up',
174            'fx-panels-slide-right',
175            'fx-panels-zoom',
176            'fx-listitems-drop',
177            'fx-listitems-fade',
178            'fx-listitems-slide'
179        ].forEach(ext => {
180            Object.keys(this.opts.extensions).forEach(key => {
181                if (this.opts.extensions[key].includes(ext)) {
182                    deprecated(
183                        'The "' + ext + '" extension',
184                        'custom CSS',
185                        '8.3.0'
186                    );
187                }
188            });
189        });
190
191        /**
192         * ----------------------------
193         * Version 8.1 > 8.2
194         * ----------------------------
195         */
196
197        /* API */
198
199        //  Deprecated API methods.
200        this.bind('initPanels:deprecated', method => {
201            deprecated('The "initPanels" API method', '"initPanel"', '8.2.0');
202        });
203
204        /**
205         * ----------------------------
206         * Version 8.0 > 8.1
207         * ----------------------------
208         */
209
210        /* CONFIGURATION */
211
212        //	conf.clone is moved to conf.offCanvas.clone.
213        if (typeof this.conf.clone != 'undefined') {
214            deprecated(
215                'The "clone" configuration option',
216                '"offCanvas.clone"',
217                '8.1.0'
218            );
219
220            //	Try to fix it.
221            if (typeof this.conf.offCanvas.clone == 'undefined') {
222                this.conf.offCanvas.clone = this.conf.clone;
223            }
224        }
225
226        /**
227         * ----------------------------
228         * Version 7.3 > 8.0
229         * ----------------------------
230         */
231
232        /* API */
233
234        //	These methods no longer accept a jQuery object as an argument,
235        //		they now only accept a HTMLElement.
236        [
237            'setPage',
238            'openPanel',
239            'closePanel',
240            'closeAllPanels',
241            'setSelected'
242        ].forEach(method => {
243            this.bind(method + ':before', panel => {
244                if (
245                    typeof panel != 'undefined' &&
246                    typeof jQuery != 'undefined' &&
247                    panel instanceof jQuery
248                ) {
249                    deprecated(
250                        'Passing a jQuery object as an argument to the "' +
251                            method +
252                            '" API method',
253                        'a HTMLElement',
254                        '8.0.0'
255                    );
256                }
257            });
258        });
259
260        //	These methods no longer accept a jQuery object as an argument,
261        //		they now only accept an array of HTMLElements.
262        ['initPanels'].forEach(method => {
263            this.bind(method + ':before', panel => {
264                if (
265                    typeof panel != 'undefined' &&
266                    typeof jQuery != 'undefined' &&
267                    panel instanceof jQuery
268                ) {
269                    deprecated(
270                        'Passing a jQuery object as an argument to the "' +
271                            method +
272                            '" API method',
273                        'a HTMLElement array',
274                        '8.0.0'
275                    );
276                }
277            });
278        });
279
280        /* OPTIONS */
281
282        //	opts.navbars.navbar.height is removed in favor of specifying a different CSS variable (--mm-navbar-size ) for each navbar.
283        if (this.opts.navbars) {
284            this.opts.navbars.forEach(navbar => {
285                if (typeof navbar.height !== 'undefined') {
286                    deprecated(
287                        'The "height" option in the "navbars" options.',
288                        'the CSS variable "--mm-navbar-size"',
289                        '8.0.0'
290                    );
291                }
292            });
293        }
294
295        //	opts.dividers.fixed is removed, all dividers are now sticky by default.
296        if (this.opts.dividers) {
297            if (
298                typeof this.opts.dividers == 'object' &&
299                typeof this.opts.dividers.fixed !== 'undefined'
300            ) {
301                deprecated(
302                    'The "fixed" option in the "dividers" options.',
303                    null,
304                    '8.0.0'
305                );
306            }
307        }
308
309        //	opts.iconbar.add is renamed to opts.iconbar.use.
310        if (this.opts.iconbar) {
311            if (
312                typeof this.opts.iconbar == 'object' &&
313                typeof this.opts.iconbar.add !== 'undefined'
314            ) {
315                deprecated(
316                    'The "add" option in the "iconbar" options.',
317                    '"use"',
318                    '8.0.0'
319                );
320
321                //	Try to fix it.
322                this.opts.iconbar.use = this.opts.iconbar.add;
323            }
324        }
325
326        /* CONFIGURATION */
327
328        //	conf.fixedElements.elemInsertMethod is changed to conf.fixedElements.fixed.insertMethod.
329        if (typeof this.conf.fixedElements.elemInsertMethod != 'undefined') {
330            deprecated(
331                'The "elemInsertMethod" option in the "fixedElements" configuration',
332                '"fixed.insertMethod"',
333                '8.0.0'
334            );
335
336            //	Try to fix it.
337            if (
338                typeof this.conf.fixedElements.fixed.insertMethod == 'undefined'
339            ) {
340                this.conf.fixedElements.fixed.insertMethod = this.conf.fixedElements.elemInsertMethod;
341            }
342        }
343
344        //	conf.fixedElements.elemInsertSelector is changed to conf.fixedElements.fixed.insertSelector.
345        if (typeof this.conf.fixedElements.elemInsertMethod != 'undefined') {
346            deprecated(
347                'The "elemInsertSelector" option in the "fixedElements" configuration',
348                '"fixed.insertSelector"',
349                '8.0.0'
350            );
351
352            //	Try to fix it.
353            if (
354                typeof this.conf.fixedElements.fixed.insertSelector ==
355                'undefined'
356            ) {
357                this.conf.fixedElements.fixed.insertSelector = this.conf.fixedElements.elemInsertSelector;
358            }
359        }
360
361        /* WRAPPERS */
362
363        //	Removed and renamed framework wrappers
364        if (this.opts.wrappers) {
365            this.opts.wrappers.forEach(wrapper => {
366                switch (wrapper) {
367                    //  Bootstrap 3 framework wrapper is removed
368                    case 'bootstrap3':
369                        deprecated('The "bootstrap3" wrapper', null, '8.0.0');
370
371                        //  Try to fix it.
372                        let indexbs3 = this.opts.wrappers.indexOf(wrapper);
373                        if (indexbs3 > -1) {
374                            this.opts.wrappers.splice(indexbs3, 1);
375                        }
376                        break;
377
378                    //  Bootstrap 4 framework wrapper is renamed to "bootstrap"
379                    case 'bootstrap4':
380                        deprecated(
381                            'The "bootstrap4" wrapper',
382                            '"bootstrap"',
383                            '8.0.0'
384                        );
385
386                        //	Try to fix it.
387                        this.opts.wrappers.push('bootstrap');
388
389                        let indexbs4 = this.opts.wrappers.indexOf(wrapper);
390                        if (indexbs4 > -1) {
391                            this.opts.wrappers.splice(indexbs4, 1);
392                        }
393                        break;
394
395                    //  jQuery Mobile framework wrapper is removed
396                    case 'jqueryMobile':
397                        deprecated('The "jqueryMobile" wrapper', null, '8.0.0');
398
399                        //  Try to fix it.
400                        let indexjqm = this.opts.wrappers.indexOf(wrapper);
401                        if (indexjqm > -1) {
402                            this.opts.wrappers.splice(indexjqm, 1);
403                        }
404                        break;
405                }
406            });
407        }
408
409        if (warnings.length) {
410            _console.group('Mmenu deprecated warnings.');
411            warnings.forEach(msg => {
412                _console.warn(msg);
413            });
414            _console.groupEnd();
415        }
416    };
417})();

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.