Skip to content

Commit

Permalink
FIXED: Integrated common DOM ready callback 'SUKR' to support dynamic…
Browse files Browse the repository at this point in the history
…ally loaded scripts.
  • Loading branch information
SagnikGanguly96 committed Feb 14, 2023
1 parent 944db7e commit e99235d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/js/addons/SGNDataTables.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 SGNetworks. All rights reserved.
* Copyright (c) 2022-2023 SGNetworks. All rights reserved.
*
* The software is an exclusive copyright of "SGNetworks" and is provided as is exclusively with only "USAGE" access. "Modification", "Alteration", "Re-distribution" is completely prohibited.
* VIOLATING THE ABOVE TERMS IS A PUNISHABLE OFFENSE WHICH MAY LEAD TO LEGAL CONSEQUENCES.
Expand Down Expand Up @@ -383,7 +383,7 @@ if(typeof jQuery === "undefined") {
});
};

$(function() {
SUKR(() => {
const $datatables = $('.datatable');

$datatables.SGNDataTable({
Expand Down
6 changes: 3 additions & 3 deletions src/js/components/dropdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 SGNetworks. All rights reserved.
* Copyright (c) 2022-2023 SGNetworks. All rights reserved.
*
* The software is an exclusive copyright of "SGNetworks" and is provided as is exclusively with only "USAGE" access. "Modification", "Alteration", "Re-distribution" is completely prohibited.
* VIOLATING THE ABOVE TERMS IS A PUNISHABLE OFFENSE WHICH MAY LEAD TO LEGAL CONSEQUENCES.
Expand Down Expand Up @@ -32,8 +32,8 @@ if(typeof jQuery === "undefined") {
});
};

$(document).ready(function() {
SUKR(() => {
const $dropdowns = $('[data-toggle="dropdown"]');
$dropdowns.SGNDropdown();
});
})(window, document, jQuery);
})(window, document, jQuery);
4 changes: 2 additions & 2 deletions src/js/components/modals.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ if(typeof jQuery === "undefined") {
return this;
};

$(function() {
SUKR(() => {
const $modals = $(".sgn-modal");
const $modalToggle = $("[data-sgn-toggle=\"modal\"], [data-toggle=\"modal\"]");
const $modalTarget = $("[data-sgn-target=\"modal\"], [data-target=\"modal\"]");
Expand All @@ -177,4 +177,4 @@ if(typeof jQuery === "undefined") {
});

return this;
}(window, document, jQuery));
}(window, document, jQuery));
6 changes: 3 additions & 3 deletions src/js/components/sidebar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 SGNetworks. All rights reserved.
* Copyright (c) 2022-2023 SGNetworks. All rights reserved.
*
* The software is an exclusive copyright of "SGNetworks" and is provided as is exclusively with only "USAGE" access. "Modification", "Alteration", "Re-distribution" is completely prohibited.
* VIOLATING THE ABOVE TERMS IS A PUNISHABLE OFFENSE WHICH MAY LEAD TO LEGAL CONSEQUENCES.
Expand Down Expand Up @@ -173,8 +173,8 @@ if(typeof jQuery === "undefined") {
init(_this.config);
};

$(document).ready(function() {
SUKR(() => {
const $sidebars = $('.sgn-sidebar');
$sidebars.SGNSidebar();
});
})(window, document, jQuery);
})(window, document, jQuery);
6 changes: 3 additions & 3 deletions src/js/components/tablayout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 SGNetworks. All rights reserved.
* Copyright (c) 2022-2023 SGNetworks. All rights reserved.
*
* The software is an exclusive copyright of "SGNetworks" and is provided as is exclusively with only "USAGE" access. "Modification", "Alteration", "Re-distribution" is completely prohibited.
* VIOLATING THE ABOVE TERMS IS A PUNISHABLE OFFENSE WHICH MAY LEAD TO LEGAL CONSEQUENCES.
Expand Down Expand Up @@ -72,8 +72,8 @@ if(typeof jQuery === "undefined") {
});
};

$(function() {
const $tab = ($('[sgn-component="tab"]').length > 0) ? $('[sgn-component="tab"]') : (($('[data-component="tab"]').length > 0) ? $('[data-component="tab"]') : $('.tab-layout'));
SUKR(() => {
const $tab = $('[sgn-component="tab"], [sgn-component="tab"], [data-component="tab"]') || $('.tab-layout');
$tab.SGNTabLayout();
});
})(window, document, jQuery);
2 changes: 1 addition & 1 deletion src/js/components/windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ if(typeof jQuery === "undefined") {
return this;
};

$(function() {
SUKR(() => {
const $windowToggles = $("[sgn-window], [data-sgn-window], [data-window]");
const $windows = $(".sgn-window");

Expand Down
6 changes: 2 additions & 4 deletions src/js/components/wizard.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 SGNetworks. All rights reserved.
* Copyright (c) 2022-2023 SGNetworks. All rights reserved.
*
* The software is an exclusive copyright of "SGNetworks" and is provided as is exclusively with only "USAGE" access. "Modification", "Alteration", "Re-distribution" is completely prohibited.
* VIOLATING THE ABOVE TERMS IS A PUNISHABLE OFFENSE WHICH MAY LEAD TO LEGAL CONSEQUENCES.
Expand Down Expand Up @@ -163,6 +163,4 @@ $.extend({
}
});

$(document).ready(function() {
$.initWizardNav();
});
SUKR(() => $.initWizardNav());

0 comments on commit e99235d

Please sign in to comment.