1var e_hocm_isDebug = false; 2class eadd_waveLine { 3 4 constructor($target, c = 10, h = 10) { 5 this.target = $target.find('path')[0]; 6 // height 7 this.h = Number($target.find('path').attr('data-wave-h')); 8 // curves 9 this.c = Number($target.find('path').attr('data-wave-c')); 10 //animate 11 this.isAnim = Boolean($target.find('path').attr('data-wave-anim')); 12 13 this.xs = []; 14 for (var i = 0; i <= 80; i++) { 15 this.xs.push(i); 16 } 17 18 this.t = 0; 19 20 //this.generateCurve(); 21 this.generatePath(); 22 } 23 generatePath() { 24 let m = 0.5; 25 26 let h = this.h; 27 let w = 80; 28 29 let n = this.c; 30 31 let kh = 1; 32 let kw = 1 / (n); 33 34 var pathData = [ 35 'M', 0, h + ((80 - h) / 2), 36 'c', kw * w * m, 0, 37 38 kw * w * (1 - m), -kh * h, 39 kw * w, -kh * h, 40 41 's', kw * w * (1 - m), kh * h, 42 kw * w, kh * h, 43 ]; 44 for (var i = 0; i < n - 1; i++) { 45 let node = [ 46 // up 47 's', kw * w * (1 - m), -kh * h, 48 kw * w, -kh * h, 49 // down 50 's', kw * w * (1 - m), kh * h, 51 kw * w, kh * h, 52 ]; 53 pathData = pathData.concat(node); 54 } 55 pathData = pathData.join(' '); 56 this.target.setAttribute("d", pathData); 57 } 58 generateCurve() { 59 60 let points = this.xs.map(x => { 61 62 let y = 10 + this.c * Math.sin((x + this.t) / this.h); 63 64 return [x, y]; 65 }); 66 67 let pathData = "M" + points.map(p => { 68 return p[0] + "," + p[1]; 69 }).join(" L"); 70 71 this.target.setAttribute("d", pathData); 72 73 if (this.isAnim) { 74 this.t += 0.5; 75 76 requestAnimationFrame(() => this.generateCurve()); 77 } 78 } 79} 80class eadd_hamburgeroffcanvasmenu { 81 82 constructor($elements, $ob) { 83 this.$id_scope = $elements.$id_scope; 84 this.elements = $elements; 85 this.mainmodal = $elements.$hamburgeroffcanvasmenu_modal; 86 this.modal = $elements.$hamburgeroffcanvasmenu; 87 this.menu = $elements.$menu; 88 this.scope = $elements.$scope; 89 this.params = $ob; 90 this.deviceMode = ''; 91 this.rate_menuside = 50; 92 93 this.isActive = false; 94 95 this.w = 0; 96 this.h = 0; 97 98 //console.log(this.mainmodal.length) 99 // 100 if (e_hocm_isDebug) { 101 this.openMenu(false); 102 } 103 104 this.eventsInit(); 105 this.onResize(); 106 107 //se abilitato 108 this.createOverlay(); 109 110 this._triggers = {}; 111 112 113 } 114 test() { 115 //alert('e_addonsModules.hamburgeroffcanvasmenu ' + this.scope.attr('data-id')) 116 } 117 onResize() { 118 this.deviceMode = jQuery('body').attr('data-elementor-device-mode'); 119 120 this.w = window.innerWidth; 121 this.h = window.innerHeight 122 } 123 createOverlay() { 124 this.modal.parent().append("<div class=\"e-add-hocm-overlay\"></div>"); 125 jQuery( document.body ).on("click", '.e-add-hocm-overlay', (e) => { 126 this.closeMenu(); 127 128 return false; 129 }); 130 } 131 //@p non usato.. 132 rateMenu() { 133 this.onResize(); 134 if (this.deviceMode == 'tablet' && this.params.rate_menuside_tablet) { 135 this.rate_menuside = this.params.rate_menuside_tablet; 136 } else if (this.deviceMode == 'mobile' && this.params.rate_menuside_mobile) { 137 this.rate_menuside = this.params.rate_menuside_mobile; 138 } 139 } 140 eventsInit() { 141 // open 142 if(this.params.hamburgerTarget == 'element'){ 143 let targetElement = jQuery(this.params.targetElement); 144 145 if(targetElement.length){ 146 jQuery( document.body ).on("click", this.params.targetElement, (e) => { 147 this.modal.show(); //.removeClass('e-add-load-hocm'); 148 this.openMenu(); 149 150 return false; 151 }); 152 this.scope.find('.warning-trace').empty(); 153 }else{ 154 this.scope.find('.warning-trace').text('Target not found'); 155 } 156 157 }else{ 158 this.scope.find('.e-add-button-hamburger').on("click", (e) => { 159 this.modal.show(); //.removeClass('e-add-load-hocm'); 160 this.openMenu(); 161 162 return false; 163 }); 164 } 165 166 // close on key ESC 167 jQuery(document).on('keyup', (e) => { 168 if (e.keyCode == 27) { 169 this.closeMenu(); 170 } 171 }); 172 173 174 175 176 // this.elements.$hamburgeroffcanvasmenu.find('ul > li.menu-item-has-children > .menu-item-wrap + ul').each((i,el)=>{ 177 // //#hamburgeroffcanvasmenu-{{ID}} ul.e-add-ul-menu li span.indicator-child 178 // jQuery(el).prev().append(this.elements.$hamburgeroffcanvasmenu.find('.e-add-hocm-icon')); 179 // }) 180 181 182 //#hamburgeroffcanvasmenu-{{ID}} ul.e-add-ul-menu li span.indicator-child 183 184 this.elements.$hamburgeroffcanvasmenu.find('ul > li.menu-item-has-children > .menu-item-wrap + ul').prev().append(this.elements.$hamburgeroffcanvasmenu.find('.e-add-hocm-icon')); 185 186 // ACCORDION Menu 187 this.elements.$hamburgeroffcanvasmenu.find('ul > li.menu-item-has-children > .menu-item-wrap .indicator-child').click(function(e){
188 e.preventDefault(); 189 jQuery(this).toggleClass('e-add-hocm-active'); 190 jQuery(this).closest('li').find('> .sub-menu').not(':animated').slideToggle(); 191 192 return false; 193 }); 194 195 if (!elementorFrontend.isEditMode()) { 196 let elementoPageContent = this.elements.$hamburgeroffcanvasmenu.attr('data-id-page-modal'); 197 //alert(this.elements.$scope.attr('class')); 198 jQuery('body').prepend('<div id="hamburgeroffcanvasmenu-modal-'+this.$id_scope+'" class="'+this.elements.$scope.attr('class')+'"></div>'); 199 this.elements.$hamburgeroffcanvasmenu.appendTo('#hamburgeroffcanvasmenu-modal-'+this.$id_scope); 200 //this.elements.$scope.appendTo('.elementor.elementor-'+elementoPageContent); 201 202 } 203 204 205 206 207 208 // close on click any <a> to menu 209 this.menu.find('a:not(.e-add-close):not([target="_blank"]):not([href="#"])').on("click", (e) => { 210 //console.log(e); 211 212 if (!jQuery(e.target).hasClass('sub-arrow')) { 213 if (this.params.close_animations) { 214 this.closeMenu(true, e.currentTarget); // instead of .target, will support also buttons and anchor with sub elements 215 return false; 216 } 217 } 218 //sub-arrow 219 }); 220 this.modal.find('.e-add-close').on("click", (e) => { 221 222 this.closeMenu(); 223 return false; 224 }); 225 } 226 openMenu(anim = true) { 227 228 this.modal.addClass("e-add-active"); 229 this.modal.closest('.elementor-widget-e-hamburgeroffcanvasmenu').addClass("e-add-active"); 230 231 if (!anim) { 232 this.modal.addClass('e-add-no-anim'); 233 } else { 234 this.modal.removeClass('e-add-no-anim'); 235 } 236 this.isActive = true; 237 e_hocm_isDebug = true; 238 239 jQuery('body,html').addClass('e-add-modal-open'); 240 241 //alert(jQuery('.hamburgeroffcanvasmenu').length) 242 //alert(this.modal.find('.hamburgeroffcanvasmenu .e-add-nav .e-add-menu-hocm ul.e-add-ul-menu').height()) 243 244 245 this.modal.on('webkitTransitionEnd oTransitionEnd transitionend msTransitionEnd', () => { 246 //l'evento di ritorno.... 247 this.triggerHandler('openmodal',this.modal); 248 249 this.modal.off('webkitTransitionEnd oTransitionEnd transitionend msTransitionEnd'); 250 }); 251 252 } 253 closeMenu(anim = true, targethref = null) { 254 255 //alert(targethref); 256 //@p al termine della transizione lancio l'href.... 257 if (targethref) { 258 // 259 //alert(this.modal.css('transition-duration')); 260 if (this.params.close_animations) { 261 /*this.modal.on('webkitTransitionEnd oTransitionEnd transitionend msTransitionEnd', () => { 262 if(this.isActive) window.location = targethref; 263 });*/ 264 setTimeout(() => { 265 window.location = targethref; 266 }, 500) 267 } else { 268 window.location = targethref; 269 } 270 271 } 272 273 274 this.modal.removeClass("e-add-active"); 275 this.modal.closest('.elementor-widget-e-hamburgeroffcanvasmenu').removeClass("e-add-active"); 276 277 if (!anim) 278 this.modal.addClass('e-add-no-anim'); 279 this.isActive = false; 280 e_hocm_isDebug = false; 281 282 jQuery('body,html').removeClass('e-add-modal-open'); 283 284 //l'evento di ritorno.... 285 this.triggerHandler('closemodal',this.modal); 286 } 287 288 //https://stackoverflow.com/questions/17165096/custom-events-in-class/17165730 289 290 on(event,callback) { 291 if(!this._triggers[event]) 292 this._triggers[event] = []; 293 this._triggers[event].push( callback ); 294 } 295 296 triggerHandler(event,params) { 297 if( this._triggers[event] ) { 298 for( const i in this._triggers[event] ) 299 this._triggers[event][i](params); 300 } 301 } 302} 303 304//elementorModules.editor.utils. 305jQuery(window).on('elementor/frontend/init', () => { 306 class WidgetHamburgerOffcanvasMenuHandlerClass extends elementorModules.frontend.handlers.Base { 307 308 getDefaultSettings() { 309 const target = '#hamburgeroffcanvasmenu-' + this.getID(); 310 return { 311 selectors: { 312 hamburgeroffcanvasmenu_modal: '#hamburgeroffcanvasmenu-modal-' + this.getID(), 313 hamburgeroffcanvasmenu: target, 314 modal: target + ' .e-add-menu-hocm', 315 hamburger: '.e-add-hamburger-svg', 316 sidebg: target + ' .e-add-bg', 317 panel: target + ' .e-add-nav', 318 quit: target + ' .e-add-close', 319 menu: target + ' .e-add-nav-menu', 320 menu_li: target + ' ul#e-add-ul-menu > li', 321 template_before: target + ' .e-add-template-after' 322 }, 323 }; 324 } 325 test(value = 'ciao') { 326 console.log(value) 327 } 328 getE() { 329 return this.eaddons_hocm; 330 } 331 onEditSettingsChange(propertyName) { 332 //console.log(propertyName); 333 } 334 onElementChange(propertyName) { 335 if ('menu' === propertyName) { 336 //var valore = this.getElementSettings('menu'); 337 //console.log(this.getE()); 338 //this.eaddons_hocm.openMenu(false); 339 } 340 /* 341 if ( 0 === propertyName.indexOf( 'lightbox_content_animation' ) ) { 342 this.animateVideo(); 343 344 return; 345 } 346 347 const isLightBoxEnabled = this.getElementSettings( 'lightbox' ); 348 349 if ( 'lightbox' === propertyName && ! isLightBoxEnabled ) { 350 this.getLightBox().getModal().hide(); 351 352 return; 353 } 354 355 if ( 'aspect_ratio' === propertyName && isLightBoxEnabled ) { 356 this.handleAspectRatio(); 357 } 358 */ 359 } 360 getDefaultElements() {
361 const selectors = this.getSettings('selectors'); 362 return { 363 $scope: this.$element, 364 $hamburgeroffcanvasmenu_modal: this.$element.find(selectors.hamburgeroffcanvasmenu_modal), 365 $hamburgeroffcanvasmenu: this.$element.find(selectors.hamburgeroffcanvasmenu), 366 $modal: this.$element.find(selectors.modal), 367 $hamburger: this.$element.find(selectors.hamburger), 368 $sidebg: this.$element.find(selectors.sidebg), 369 $panel: this.$element.find(selectors.panel), 370 $quit: this.$element.find(selectors.quit), 371 $menu: this.$element.find(selectors.menu), 372 $menu_li: this.$element.find(selectors.menu_li), 373 $template_before: this.$element.find(selectors.template_before), 374 // 375 $id_scope: this.$element.attr('data-id'), 376 }; 377 } 378 379 bindEvents() { 380 381 let scope = this.elements.$scope, 382 elementSettings = this.getElementSettings(); 383 384 this.eaddons_hocm = null; 385 // console.log(this.getDefaultElements()); 386 387 // console.log(this); 388 // console.log(this.getSettings()); 389 // console.log(this.getWidgetType()); 390 // console.log(this.getCurrentDeviceSetting()); 391 // console.log(this.getUniqueHandlerID()); 392 // console.log(this.getEditSettings()); 393 394 // console.log(this.elements); 395 396 let elementsObject = { 397 // --------- Responsiive 398 //rate_menuside_desktop: Number(elementSettings.hamburgeroffcanvasmenu_rate.size), 399 //rate_menuside_tablet: Number(elementSettings.hamburgeroffcanvasmenu_rate_tablet.size), 400 //rate_menuside_mobile: Number(elementSettings.hamburgeroffcanvasmenu_rate_mobile.size), 401 //rate_menuside: rate_menuside_desktop, 402 close_animations: Boolean(elementSettings.close_animations), 403 speed_menu: 0.4, 404 // 405 hamburgerTarget: elementSettings.hamburger_target, 406 targetElement: elementSettings.target_element 407 } 408 let e_addons_hocm = new eadd_hamburgeroffcanvasmenu(this.elements, elementsObject); 409 this.eaddons_hocm = e_addons_hocm; 410 411 if (elementSettings.hamburger_style == 'wave') { 412 let e_addons_wave = new eadd_waveLine(this.elements.$hamburger); 413 } 414 // 415 elementorFrontend.utils.e_hocm = e_addons_hocm; 416 //console.log(elementorFrontend.utils); 417 418 /* 419 //@p memorizzo listanza in data per sincronizzarla con o altro 420 tabs.data('Ehocm', e_addons_hocm); 421 */ 422 //console.log('----'); 423 //console.log(this.eaddons_hocm); 424 425 // Editor 426 if (elementorFrontend.isEditMode()) { 427 428 this.elements.$hamburgeroffcanvasmenu.show(); //removeClass('e-add-load-hocm'); 429 /* 430 // console.log(elementor.channels.panelElements); 431 // al change della proprietà se prima era aperto rimane aperto 432 elementor.channels.editor.on('change', (sectionName, editor) => { 433 //var editedElement = editor.getOption('editedElementView'); 434 435 // 436 if(e_addons_hocm.isActive && editor.model.id == this.getID()){ 437 console.log('xxxx '); 438 console.log(sectionName); 439 console.log(editor.model.id+' '+this.getID()); 440 console.log(e_addons_hocm.isActive); 441 e_addons_hocm.openMenu(false); 442 } 443 444 }); 445 */ 446 447 // quando seleziono le sezioni dell'editor 448 elementor.channels.editor.on('section:activated', (sectionName, editor) => { 449 var editedElement = editor.getOption('editedElementView'); 450 451 //console.log(editor.activeSection); 452 //console.log(editedElement); 453 // controllo di trovarmi nell'editor del ciccetto giusto 454 if ('e-hamburgeroffcanvasmenu' !== editedElement.model.get('widgetType')) { 455 return; 456 } 457 458 var selectedSection = -1 !== ['section_modal', 'section_menu', 'section_close'].indexOf(sectionName); 459 //editedElement.$el.toggleClass('elementor-flip-box--flipped', selectedSection); 460 461 if (selectedSection && editedElement.model.id == this.getID()) { 462 e_addons_hocm.openMenu(false); 463 } 464 if (!selectedSection && editedElement.model.id == this.getID()) { 465 e_addons_hocm.closeMenu(false); 466 } 467 468 //console.log(editedElement.model); 469 //console.log(editedElement.model.get('widgetType')); 470 471 // l'oggetto nel contesto da elaborare 472 //console.log(editedElement.$el); 473 474 475 }); 476 } 477 } 478 } 479 /* 480 export default ( $scope ) => { 481 elementorFrontend.elementsHandler.addHandler( WidgetHamburgerOffcanvasMenuHandlerClass, { $element: $scope } ); 482 }; 483 */ 484 485 486 // Frontend 487 const hamburgeroffcanvasmenuHandler = ($element) => { 488 489 elementorFrontend.elementsHandler.addHandler(WidgetHamburgerOffcanvasMenuHandlerClass, { 490 $element, 491 }); 492 //console.log(elementorFrontend); 493 494 // raggiungo da fuori l'istanza memorizzata in utils 495 //elementorFrontend.utils.e_hocm.test(); 496 497 //console.log(WidgetHamburgerOffcanvasMenuHandlerClass.prototype.getE()); 498 }; 499 elementorFrontend.hooks.addAction('frontend/element_ready/e-hamburgeroffcanvasmenu.default', hamburgeroffcanvasmenuHandler); 500 501 //console.log(elementor); 502});
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.