1/** 2 * jquery.tcfloatbox.js 3 * 4 * @param {Object} $ The jQuery object 5 * @version: v2.0 6 * @author: ThemeComplete 7 * 8 * Created by ThemeComplete 9 * 10 * Copyright (c) 2025 themeComplete http://themecomplete.com 11 */ 12( function( $ ) { 13 'use strict'; 14 15 var FloatBox = function( dom, options ) { 16 this.element = $( dom ); 17 18 this.settings = $.extend( {}, $.fn.tcFloatBox.defaults, options ); 19 this.settings.type = '<' + this.settings.type + '>'; 20 21 if ( this.element.length === 1 ) { 22 this.init(); 23 return this; 24 } 25 26 return false; 27 }; 28 29 FloatBox.prototype = { 30 constructor: FloatBox, 31 32 destroy: function() { 33 var settings = this.settings; 34 35 if ( this.instance !== undefined ) { 36 $.fn.tcFloatBox.instances.splice( this.instance, 1 ); 37 38 delete this.instance; 39 40 if ( settings.hideelements ) { 41 $( 'embed, object, select' ).css( { 42 visibility: 'visible' 43 } ); 44 } 45 46 if ( settings._ovl ) { 47 settings._ovl.off(); 48 } 49 50 $( settings.floatboxIDMain ).remove(); 51 52 this.element.removeData( 'tcfloatbox' ); 53 54 $( window ).off( 'scroll.tcfloatbox' + this.instance ); 55 $( window ).off( 'resize.tcfloatbox' + this.instance ); 56 } 57 58 return this; 59 }, 60 61 hide: function() { 62 var settings = this.settings; 63 64 if ( settings.hideelements ) { 65 $( 'embed, object, select' ).css( { 66 visibility: 'visible' 67 } ); 68 } 69 if ( settings.showoverlay === true ) { 70 if ( settings._ovl ) { 71 settings._ovl.removeClass( 'fl-overlay' ); 72 } 73 } 74 75 $( settings.floatboxID ) 76 .addClass( 'tc-closing' ) 77 .removeClass( settings.animateIn ) 78 .addClass( settings.animateOut ); 79 $( settings.floatboxID ).animate( 80 { 81 opacity: 0 82 }, 83 settings.closefadeouttime, 84 function() { 85 $( settings.floatboxIDMain ).hide(); 86 $( settings.floatboxID ) 87 .removeClass( 'tc-closing' ) 88 .addClass( 'tc-closed' ); 89 } 90 ); 91 92 $( window ).off( 'scroll.tcfloatbox' + this.instance ); 93 $( window ).off( 'resize.tcfloatbox' + this.instance ); 94 }, 95 96 show: function() { 97 var settings = this.settings; 98 99 if ( this.element.length === 1 ) { 100 if ( this.instance === undefined ) { 101 this.init(); 102 } 103 104 if ( settings.hideelements ) { 105 $( 'embed, object, select' ).css( { 106 visibility: 'hidden' 107 } ); 108 } 109 110 if ( settings.showoverlay === true ) { 111 if ( ! settings._ovl ) { 112 settings._ovl = settings.main; 113 settings._ovl.css( 114 { 115 zIndex: parseInt( settings.zIndex, 10 ) - 1 116 } 117 ); 118 if ( ! settings.ismodal ) { 119 if ( settings.cancelEvent || settings.unique ) { 120 settings._ovl.on( 121 'click', 122 function( e ) { 123 if ( e.target === $( settings.floatboxID )[ 0 ] || $( e.target ).closest( settings.floatboxID ).length ) { 124 return; 125 } 126 this.applyCancelEvent.call( this, this ); 127 }.bind( this ) 128 ); 129 } else { 130 settings._ovl.on( 131 'click', 132 function( e ) { 133 if ( e.target === $( settings.floatboxID )[ 0 ] || $( e.target ).closest( settings.floatboxID ).length ) { 134 return; 135 } 136 settings.cancelfunc.call( this, this ); 137 }.bind( this ) 138 ); 139 } 140 } 141 } 142 settings._ovl.addClass( 'fl-overlay' ); 143 } 144 145 if ( settings.showfunc ) { 146 settings.showfunc.call(); 147 } 148 149 $( settings.floatboxID ) 150 .removeClass( 'tc-closing tc-closed' ) 151 .addClass( 152 settings.animationBaseClass + ' ' + settings.animateIn 153 ); 154 155 $( settings.floatboxID ).addClass( 'flasho-center' ); 156 } 157 }, 158 159 applyCancelEvent: function() { 160 var settings = this.settings; 161 162 if ( settings.cancelEvent === true ) { 163 this.destroy(); 164 } else if ( typeof settings.cancelEvent === 'function' ) { 165 settings.cancelEvent.call( this, this ); 166 } 167 }, 168 169 applyCancelEventFromKey: function( e ) { 170 if ( e.which === 27 ) { 171 this.applyCancelEvent(); 172 } 173 }, 174 175 applyUpdateEvent: function() { 176 var settings = this.settings; 177 178 if ( typeof settings.updateEvent === 'function' ) { 179 settings.updateEvent.call( this, this ); 180 } 181 }, 182 183 applyUpdateEventFromKey: function( e ) { 184 if ( e.which === 13 ) { 185 this.applyUpdateEvent(); 186 } 187 }, 188 189 init: function() { 190 var settings = this.settings; 191 var main; 192 193 if ( this.element.length === 1 ) { 194 // Instance initialization 195 if ( $.fn.tcFloatBox.instances.length > 0 ) { 196 settings.zIndex = 197 parseInt( 198 $.fn.tcFloatBox.instances[ 199 $.fn.tcFloatBox.instances.length - 1 200 ].zIndex, 201 10 202 ) + 100; 203 } 204 this.instance = $.fn.tcFloatBox.instances.length; 205 $.fn.tcFloatBox.instances.push( settings ); 206 207 settings.id = settings.id + this.instance; 208 settings.floatboxID = '#' + $.epoAPI.dom.id( settings.id ); 209 210 if ( settings.idMain === settings.id ) { 211 settings.idMain = 'main-' + settings.idMain; 212 } 213 214 settings.idMain = settings.idMain + this.instance; 215 settings.floatboxIDMain = '#' + $.epoAPI.dom.id( settings.idMain ); 216 217 this.hide(); 218 219 main = $( '<div>' ) 220 .attr( 'id', settings.idMain ) 221 .addClass( settings.classnameMain ); 222 223 $( settings.type ) 224 .attr( 'id', settings.id ) 225 .addClass( settings.classname ) 226 .html( settings.data ) 227 .appendTo( main ); 228 229 main.appendTo( this.element ); 230 231 settings.main = main; 232 233 if ( settings.leger ) { 234 $( settings.floatboxIDMain ).css( { 235 width: settings.width, 236 height: settings.height 237 } ); 238 } else { 239 $( settings.floatboxID ).css( { 240 width: settings.width, 241 height: settings.height 242 } ); 243 } 244 245 if ( settings.minWidth ) { 246 $( settings.floatboxID ).css( { 247 'min-width': settings.minWidth 248 } ); 249 } 250 251 if ( settings.minHeight ) { 252 $( settings.floatboxID ).css( { 253 'min-height': settings.minHeight 254 } ); 255 } 256 257 if ( settings.maxWidth ) { 258 $( settings.floatboxID ).css( { 259 'max-width': settings.maxWidth 260 } ); 261 } 262 263 if ( settings.maxHeight ) { 264 $( settings.floatboxID ).css( { 265 'max-height': settings.maxHeight 266 } ); 267 } 268 269 $( settings.floatboxIDMain ).css( { 270 'z-index': settings.zIndex 271 } ); 272 273 this.cancelfunc = settings.cancelfunc; 274 275 if ( settings.cancelEvent && settings.cancelClass ) { 276 $( settings.floatboxID ) 277 .find( settings.cancelClass ) 278 .on( 'click', this.applyCancelEvent.bind( this ) ); 279 if ( settings.isconfirm ) { 280 $( document ) 281 .off( 'keyup.escape-' + settings.floatboxID ) 282 .on( 283 'keyup.escape-' + settings.floatboxID, 284 this.applyCancelEventFromKey.bind( this ) 285 ); 286 } 287 } 288 289 if ( settings.updateEvent && settings.updateClass ) { 290 $( settings.floatboxID ) 291 .find( settings.updateClass ) 292 .on( 'click', this.applyUpdateEvent.bind( this ) ); 293 if ( settings.isconfirm ) { 294 $( document ) 295 .off( 'keyup.enter-' + settings.floatboxID ) 296 .on( 297 'keyup.enter-' + settings.floatboxID, 298 this.applyUpdateEventFromKey.bind( this ) 299 ); 300 } 301 } 302 303 this.show(); 304 } 305 } 306 }; 307 308 $.fn.tcFloatBox = function( option ) { 309 var methodReturn; 310 var targets = $( this ); 311 var data = targets.data( 'tcfloatbox' ); 312 var options; 313 var ret; 314 315 if ( typeof option === 'object' ) { 316 options = option; 317 } else { 318 options = {}; 319 } 320 321 if ( ! data ) { 322 data = new FloatBox( this, options ); 323 targets.data( 'tcfloatbox', data ); 324 } 325 326 if ( typeof option === 'string' ) { 327 methodReturn = data[ option ].apply( data, [] ); 328 } 329 330 if ( methodReturn === undefined ) { 331 ret = targets; 332 } else { 333 ret = methodReturn; 334 } 335 336 return ret; 337 }; 338 339 $.fn.tcFloatBox.defaults = { 340 idMain: 'floatbox', 341 classnameMain: 'floatbox', 342 leger: false, 343 id: 'flasho', 344 classname: 'flasho', 345 type: 'div', 346 data: '', 347 width: 'auto', 348 height: 'auto', 349 minWidth: 0, 350 minHeight: 0, 351 maxWidth: 0, 352 maxHeight: 0, 353 closefadeouttime: 1000, 354 animationBaseClass: 'tm-animated', 355 animateIn: 'fadein', 356 animateOut: 'fadeout', 357 fps: 4, 358 hideelements: false, 359 showoverlay: true, 360 zIndex: 100100, 361 ismodal: false, 362 cancelfunc: FloatBox.prototype.hide, 363 showfunc: null, 364 cancelEvent: true, 365 cancelClass: '.floatbox-cancel', 366 updateEvent: false,
367 updateClass: false, 368 unique: true, 369 isconfirm: false 370 }; 371 372 $.fn.tcFloatBox.instances = []; 373 374 $.fn.tcFloatBox.Constructor = FloatBox; 375 376 $.tcFloatBox = function( options ) { 377 var target = $( 'body' ); 378 var data = false; 379 var hasAtLeastOneNonToolTip = target 380 .map( function() { 381 return $( this ).data( 'tcfloatbox' ) || ''; 382 } ) 383 .get() 384 .some( function( value ) { 385 return value === ''; 386 } ); 387 if ( hasAtLeastOneNonToolTip || options.unique ) { 388 data = new FloatBox( target, options ); 389 target.data( 'tcfloatbox', data ); 390 } else { 391 data = target.data( 'tcfloatbox' ); 392 data.init(); 393 } 394 return data; 395 }; 396}( window.jQuery ) );
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.