| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/admin/javascript/engine/compatibility/ |
Upload File : |
/* --------------------------------------------------------------
dynamic_page_breakpoints.js 2015-09-24 gm
Gambio GmbH
http://www.gambio.de
Copyright (c) 2015 Gambio GmbH
Released under the GNU General Public License (Version 2)
[http://www.gnu.org/licenses/gpl-2.0.html]
--------------------------------------------------------------
*/
/**
* ## Add the breakpoint class to elements dynamically.
*
* In some pages it is not possible to add the correct breakpoints because some content might
* be loaded dynamically or it might change position through compatibility JS (e.g. message_stack_container).
* Use this module to set the breakpoint after the page is loaded.
*
* ```html
* <div data-gx-compatibility="dynamic_page_breakpoints"
* data-dynamic_page_breakpoints-small='.class-one .class-two'
* data-dynamic_pate_breakpoints-large='.class-three #id-one'>
* <!-- HTML CONTENT -->
* </div>
* ```
*
* @module Compatibility/dynamic_page_breakpoints
*/
gx.compatibility.module(
'dynamic_page_breakpoints',
[],
/** @lends module:Compatibility/dynamic_page_breakpoints */
function (data) {
'use strict';
// ------------------------------------------------------------------------
// VARIABLES DEFINITION
// ------------------------------------------------------------------------
var
/**
* Module Selector
*
* @var {object}
*/
$this = $(this),
/**
* Callbacks for checking common patterns.
*
* @var {array}
*/
fixes = [],
/**
* Default Options
*
* @type {object}
*/
defaults = {
lifetime: 30000, // wait half minute before stopping the element search
interval: 300
},
/**
* Final Options
*
* @var {object}
*/
options = $.extend(true, {}, defaults, data),
/**
* Module Object
*
* @type {object}
*/
module = {};
// ------------------------------------------------------------------------
// PRIVATE FUNCTIONS
// ------------------------------------------------------------------------
var _watch = function (selector, breakpointClass) {
var startTimestamp = Date.now;
var intv = setInterval(function () {
if ($(selector).length > 0) {
$(selector).addClass(breakpointClass);
clearInterval(intv);
}
if (Date.now - startTimestamp > options.lifetime) {
clearInterval(intv);
}
}, options.interval);
};
// ------------------------------------------------------------------------
// INITIALIZE MODULE
// ------------------------------------------------------------------------
module.init = function (done) {
_watch(options.small, 'breakpoint-small');
_watch(options.large, 'breakpoint-large');
done();
};
return module;
});