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.1 > 8.2 42 * ---------------------------- 43 */ 44 45 /* API */ 46 this.bind('initPanels:deprecated', method => { 47 deprecated('The "initPanels" API method', '"initPanel"', '8.2.0'); 48 }); 49 50 /* ADD-ONS */ 51 52 // navbars "next" content is removed. 53 if (this.opts.navbars) { 54 this.opts.navbars.forEach(navbar => { 55 if (navbar.content.includes('next')) { 56 deprecated( 57 'The "next" content for the "navbars" add-on', 58 null, 59 '8.2.0' 60 ); 61 } 62 }); 63 } 64 65 /** 66 * ---------------------------- 67 * Version 8.0 > 8.1 68 * ---------------------------- 69 */ 70 71 /* CONFIGURATION */ 72 73 // conf.clone is moved to conf.offCanvas.clone. 74 if (typeof this.conf.clone != 'undefined') { 75 deprecated( 76 'The "clone" configuration option', 77 '"offCanvas.clone"', 78 '8.1.0' 79 ); 80 81 // Try to fix it. 82 if (typeof this.conf.offCanvas.clone == 'undefined') { 83 this.conf.offCanvas.clone = this.conf.clone; 84 } 85 } 86 87 /** 88 * ---------------------------- 89 * Version 7.3 > 8.0 90 * ---------------------------- 91 */ 92 93 /* API */ 94 95 // These methods no longer accept a jQuery object as an argument, 96 // they now only accept a HTMLElement. 97 [ 98 'setPage', 99 'openPanel', 100 'closePanel', 101 'closeAllPanels', 102 'setSelected' 103 ].forEach(method => { 104 this.bind(method + ':before', method => { 105 if (typeof panel != 'undefined' && panel instanceof jQuery) { 106 deprecated( 107 'Passing a jQuery object as an argument to the "' + 108 method + 109 '" API method', 110 'a HTMLElement', 111 '8.0.0' 112 ); 113 } 114 }); 115 }); 116 117 // These methods no longer accept a jQuery object as an argument, 118 // they now only accept an array of HTMLElements. 119 ['initPanels'].forEach(method => { 120 this.bind(method + ':before', method => { 121 if (typeof panel != 'undefined' && panel instanceof jQuery) { 122 deprecated( 123 'Passing a jQuery object as an argument to the "' + 124 method + 125 '" API method', 126 'a HTMLElement array', 127 '8.0.0' 128 ); 129 } 130 }); 131 }); 132 133 /* OPTIONS */ 134 135 // opts.navbars.navbar.height is removed in favor of specifying a different CSS variable (--mm-navbar-size ) for each navbar. 136 if (this.opts.navbars) {
137 this.opts.navbars.forEach(navbar => { 138 if (typeof navbar.height !== 'undefined') { 139 deprecated( 140 'The "height" option in the "navbars" options.', 141 'the CSS variable "--mm-navbar-size"', 142 '8.0.0' 143 ); 144 } 145 }); 146 } 147 148 // opts.dividers.fixed is removed, all dividers are now sticky by default. 149 if (this.opts.dividers) { 150 if ( 151 typeof this.opts.dividers == 'object' && 152 typeof this.opts.dividers.fixed !== 'undefined' 153 ) { 154 deprecated( 155 'The "fixed" option in the "dividers" options.', 156 null, 157 '8.0.0' 158 ); 159 } 160 } 161 162 // opts.iconbar.add is renamed to opts.iconbar.use. 163 if (this.opts.iconbar) { 164 if ( 165 typeof this.opts.iconbar == 'object' && 166 typeof this.opts.iconbar.add !== 'undefined' 167 ) { 168 deprecated( 169 'The "add" option in the "iconbar" options.', 170 '"use"', 171 '8.0.0' 172 ); 173 174 // Try to fix it. 175 this.opts.iconbar.use = this.opts.iconbar.add; 176 } 177 } 178 179 /* CONFIGURATION */ 180 181 // conf.fixedElements.elemInsertMethod is changed to conf.fixedElements.fixed.insertMethod. 182 if (typeof this.conf.fixedElements.elemInsertMethod != 'undefined') { 183 deprecated( 184 'The "elemInsertMethod" option in the "fixedElements" configuration', 185 '"fixed.insertMethod"', 186 '8.0.0' 187 ); 188 189 // Try to fix it. 190 if ( 191 typeof this.conf.fixedElements.fixed.insertMethod == 'undefined' 192 ) { 193 this.conf.fixedElements.fixed.insertMethod = this.conf.fixedElements.elemInsertMethod; 194 } 195 } 196 197 // conf.fixedElements.elemInsertSelector is changed to conf.fixedElements.fixed.insertSelector. 198 if (typeof this.conf.fixedElements.elemInsertMethod != 'undefined') { 199 deprecated( 200 'The "elemInsertSelector" option in the "fixedElements" configuration', 201 '"fixed.insertSelector"', 202 '8.0.0' 203 ); 204 205 // Try to fix it. 206 if ( 207 typeof this.conf.fixedElements.fixed.insertSelector == 208 'undefined' 209 ) { 210 this.conf.fixedElements.fixed.insertSelector = this.conf.fixedElements.elemInsertSelector; 211 } 212 } 213 214 /* WRAPPERS */ 215 216 // Removed and renamed framework wrappers 217 if (this.opts.wrappers) { 218 this.opts.wrappers.forEach(wrapper => { 219 switch (wrapper) { 220 // Bootstrap 3 framework wrapper is removed 221 case 'bootstrap3': 222 deprecated('The "bootstrap3" wrapper', null, '8.0.0'); 223 224 // Try to fix it. 225 let indexbs3 = this.opts.wrappers.indexOf(wrapper); 226 if (indexbs3 > -1) { 227 this.opts.wrappers.splice(indexbs3, 1); 228 } 229 break; 230 231 // Bootstrap 4 framework wrapper is renamed to "bootstrap" 232 case 'bootstrap4': 233 deprecated( 234 'The "bootstrap4" wrapper', 235 '"bootstrap"', 236 '8.0.0' 237 ); 238 239 // Try to fix it. 240 this.opts.wrappers.push('bootstrap'); 241 242 let indexbs4 = this.opts.wrappers.indexOf(wrapper); 243 if (indexbs4 > -1) { 244 this.opts.wrappers.splice(indexbs4, 1); 245 } 246 break; 247 248 // jQuery Mobile framework wrapper is removed 249 case 'jqueryMobile': 250 deprecated('The "jqueryMobile" wrapper', null, '8.0.0'); 251 252 // Try to fix it. 253 let indexjqm = this.opts.wrappers.indexOf(wrapper); 254 if (indexjqm > -1) { 255 this.opts.wrappers.splice(indexjqm, 1); 256 } 257 break; 258 } 259 }); 260 } 261 262 if (warnings.length) { 263 _console.group('Mmenu deprecated warnings.');
264 warnings.forEach(msg => { 265 _console.warn(msg); 266 }); 267 _console.groupEnd(); 268 } 269 }; 270})();
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.