Skip to content

Commit

Permalink
Evarisk#268 [JS] clean: JS files
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Jul 17, 2024
1 parent 2a23e7d commit 78e03c9
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 148 deletions.
2 changes: 0 additions & 2 deletions .tx/index.php

This file was deleted.

2 changes: 0 additions & 2 deletions build/index.php

This file was deleted.

194 changes: 113 additions & 81 deletions js/dolicar.js
Original file line number Diff line number Diff line change
@@ -1,97 +1,129 @@
/* Javascript library of module DoliCar */
/* Copyright (C) 2023-2024 EVARISK <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Library javascript to enable Browser notifications
*/

/**
* \file js/dolicar.js
* \ingroup dolicar
* \brief JavaScript file for module DoliCar
*/

/**
* @namespace Saturne_Framework_Init
*
* @author Evarisk <[email protected]>
* @copyright 2015-2023 Evarisk
* @author Evarisk <[email protected]>
* @copyright 2021-2024 Evarisk
*/

if ( ! window.dolicar ) {
/**
* [dolicar description]
*
* @memberof Saturne_Framework_Init
*
* @type {Object}
*/
window.dolicar = {};

/**
* [scriptsLoaded description]
*
* @memberof Saturne_Framework_Init
*
* @type {Boolean}
*/
window.dolicar.scriptsLoaded = false;
}

if ( ! window.dolicar.scriptsLoaded ) {
/**
* [description]
*
* @memberof Saturne_Framework_Init
*
* @returns {void} [description]
*/
window.dolicar.init = function() {
window.dolicar.load_list_script();
};
'use strict';

/**
* [description]
*
* @memberof Saturne_Framework_Init
*
* @returns {void} [description]
*/
window.dolicar.load_list_script = function() {
if ( ! window.dolicar.scriptsLoaded) {
var key = undefined, slug = undefined;
for ( key in window.dolicar ) {
if (!window.dolicar) {
/**
* Init Dolicar JS
*
* @memberof Saturne_Framework_Init
*
* @since 1.0.0
* @version 1.2.0
*
* @type {Object}
*/
window.dolicar = {};

if ( window.dolicar[key].init ) {
window.dolicar[key].init();
}

for ( slug in window.dolicar[key] ) {
/**
* Init load script dolicar JS
*
* @memberof Saturne_Framework_Init
*
* @since 1.0.0
* @version 1.2.0
*
* @type {Boolean}
*/
window.dolicar.scriptsLoaded = false;
}

if ( window.dolicar[key] && window.dolicar[key][slug] && window.dolicar[key][slug].init ) {
window.dolicar[key][slug].init();
}
if (!window.dolicar.scriptsLoaded) {
/**
* Dolicar init
*
* @memberof Saturne_Framework_Init
*
* @since 1.0.0
* @version 1.2.0
*
* @returns {void}
*/
window.dolicar.init = function() {
window.dolicar.load_list_script();
};

}
}
/**
* Load script/module of dolicar
*
* @memberof Saturne_Framework_Init
*
* @since 1.0.0
* @version 1.2.0
*
* @returns {void}
*/
window.dolicar.load_list_script = function() {
if (!window.dolicar.scriptsLoaded) {
for (let key in window.dolicar) {
if (window.dolicar.hasOwnProperty(key) && typeof window.dolicar[key] === 'object') {
if (typeof window.dolicar[key].init === 'function') {
window.dolicar[key].init();
}

window.dolicar.scriptsLoaded = true;
}
};
for (let slug in window.dolicar[key]) {
if (window.dolicar[key].hasOwnProperty(slug) && typeof window.dolicar[key][slug] === 'object' && typeof window.dolicar[key][slug].init === 'function') {
window.dolicar[key][slug].init();
}
}
}
}

/**
* [description]
*
* @memberof Saturne_Framework_Init
*
* @returns {void} [description]
*/
window.dolicar.refresh = function() {
var key = undefined;
var slug = undefined;
for ( key in window.dolicar ) {
if ( window.dolicar[key].refresh ) {
window.dolicar[key].refresh();
}
window.dolicar.scriptsLoaded = true;
}
};

for ( slug in window.dolicar[key] ) {
/**
* Reload script/module of dolicar
*
* @memberof Saturne_Framework_Init
*
* @returns {void}
*/
window.dolicar.refresh = function() {
for (let key in window.dolicar) {
if (window.dolicar.hasOwnProperty(key) && typeof window.dolicar[key] === 'object') {
if (typeof window.dolicar[key].refresh === 'function') {
window.dolicar[key].refresh();
}

if ( window.dolicar[key] && window.dolicar[key][slug] && window.dolicar[key][slug].refresh ) {
window.dolicar[key][slug].refresh();
}
}
}
};
for (let slug in window.dolicar[key]) {
if (window.dolicar[key].hasOwnProperty(slug) && window.dolicar[key][slug] && typeof window.dolicar[key][slug].refresh === 'function') {
window.dolicar[key][slug].refresh();
}
}
}
}
};

$( document ).ready( window.dolicar.init );
$(document).ready(window.dolicar.init);
}

2 changes: 1 addition & 1 deletion js/dolicar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions js/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
//Silence is golden apple
2 changes: 2 additions & 0 deletions js/modules/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
//Silence is golden apple
Loading

0 comments on commit 78e03c9

Please sign in to comment.