[Forntend] app.bundle.js 納入 require 引用

This commit is contained in:
dev01 2022-11-22 15:14:23 +08:00
parent 6c27f98138
commit 0d6870f32f
2 changed files with 79 additions and 79 deletions

View File

@ -2441,7 +2441,6 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
<!-- verdors.bundle.js 已含有 jquery Library v3.5.1--> <!-- verdors.bundle.js 已含有 jquery Library v3.5.1-->
<script src="lib/vendors.bundle.js"></script> <script src="lib/vendors.bundle.js"></script>
<script src="lib/app.bundle.js"></script>
<!-- toast 第三方套件 若 require 此套件只能用 define 使用,先暫時 html 引用--> <!-- toast 第三方套件 若 require 此套件只能用 define 使用,先暫時 html 引用-->
<script src="lib/notifications/toastr/toastr.min.js"></script> <script src="lib/notifications/toastr/toastr.min.js"></script>
<script src="js/toast.js"></script> <script src="js/toast.js"></script>
@ -2487,6 +2486,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
function loadedBasePack() { function loadedBasePack() {
require( require(
[ [
"lib/app.bundle",
"datatables.net.b4", "datatables.net.b4",
"n4js/alarmbaja", "n4js/alarmbaja",
"lib/statistics/flot/flot.bundle", "lib/statistics/flot/flot.bundle",
@ -2505,9 +2505,9 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
"yourteam/plugins/yt-tooltip/yt-tooltip", "yourteam/plugins/yt-tooltip/yt-tooltip",
"yourteam/plugins/yt-tab/yt-tab", "yourteam/plugins/yt-tab/yt-tab",
"style", "style",
"init",
], function () { ], function () {
require(["site"], loadedJsPack) require(["init", "site"], loadedJsPack)
}); });
} }

View File

@ -522,66 +522,66 @@ var initApp = (function(app) {
* @param anchor * @param anchor
* @return * @return
*/ */
//app.listFilter = function (list, input, anchor) { app.listFilter = function (list, input, anchor) {
// /* add class to filter hide/show */ /* add class to filter hide/show */
// if (anchor) { if (anchor) {
// $(anchor).addClass('js-list-filter'); $(anchor).addClass('js-list-filter');
// } else { } else {
// $(list).addClass('js-list-filter'); $(list).addClass('js-list-filter');
// } }
// /* on change keyboard */ /* on change keyboard */
// $(input).change( function () { $(input).change( function () {
// var filter = $(this).val().toLowerCase(), var filter = $(this).val().toLowerCase(),
// listPrev = $(list).next().filter('.js-filter-message'); listPrev = $(list).next().filter('.js-filter-message');
// /* when user types more than 1 letter start search filter */ /* when user types more than 1 letter start search filter */
// if(filter.length > 1) { if(filter.length > 1) {
// /* this finds all data-filter-tags in a list that contain the input val, /* this finds all data-filter-tags in a list that contain the input val,
// hiding the ones not containing the input while showing the ones that do */ hiding the ones not containing the input while showing the ones that do */
// /* (1) hide all that does not match */ /* (1) hide all that does not match */
// $(list).find($("[data-filter-tags]:not([data-filter-tags*='" + filter + "'])")) $(list).find($("[data-filter-tags]:not([data-filter-tags*='" + filter + "'])"))
// .parentsUntil(list).removeClass('js-filter-show') .parentsUntil(list).removeClass('js-filter-show')
// .addClass('js-filter-hide'); .addClass('js-filter-hide');
// /* (2) hide all that does match */ /* (2) hide all that does match */
// $(list).find($("[data-filter-tags*='" + filter + "']")) $(list).find($("[data-filter-tags*='" + filter + "']"))
// .parentsUntil(list).removeClass('js-filter-hide') .parentsUntil(list).removeClass('js-filter-hide')
// .addClass('js-filter-show'); .addClass('js-filter-show');
// /* if element exists then print results */ /* if element exists then print results */
// if (listPrev){ if (listPrev){
// listPrev.text("showing " + $(list).find('li.js-filter-show').length + " from " + $(list).find('[data-filter-tags]').length + " total"); listPrev.text("showing " + $(list).find('li.js-filter-show').length + " from " + $(list).find('[data-filter-tags]').length + " total");
// } }
// } else { } else {
// /* when filter length is blank reset the classes */ /* when filter length is blank reset the classes */
// $(list).find('[data-filter-tags]').parentsUntil(list).removeClass('js-filter-hide js-filter-show'); $(list).find('[data-filter-tags]').parentsUntil(list).removeClass('js-filter-hide js-filter-show');
// /* if element exists reset print results */ /* if element exists reset print results */
// if (listPrev){ if (listPrev){
// listPrev.text(""); listPrev.text("");
// } }
// } }
// return false; return false;
})
//}).keyup( $.debounce( myapp_config.filterDelay, function (e) {
// }).keyup( $.debounce( myapp_config.filterDelay, function (e) { // /* fire the above change event after every letter is typed with a delay of 250ms */
// $(this).change();
// /* fire the above change event after every letter is typed with a delay of 250ms */ // /*if(e.keyCode == 13) {
// $(this).change(); // console.log( $(list).find(".filter-show:not(.filter-hide) > a") );
// }*/
// /*if(e.keyCode == 13) { //}));
// console.log( $(list).find(".filter-show:not(.filter-hide) > a") ); };
// }*/
// }));
//};
/** /**
* Load scripts using lazyload method * Load scripts using lazyload method
@ -1296,15 +1296,15 @@ var initApp = (function(app) {
* Activate listFilters * Activate listFilters
* usage: <input id="inputID" data-listfilter="listFilter" /> * usage: <input id="inputID" data-listfilter="listFilter" />
**/ **/
//if( typeof initApp.listFilter !== 'undefined' && $.isFunction(initApp.listFilter) && $('[data-listfilter]').length ) { if( typeof initApp.listFilter !== 'undefined' && $.isFunction(initApp.listFilter) && $('[data-listfilter]').length ) {
// var inputID = $('[data-listfilter]').attr('id'), var inputID = $('[data-listfilter]').attr('id'),
// listFilter = $('[data-listfilter]').attr("data-listfilter"); listFilter = $('[data-listfilter]').attr("data-listfilter");
// /* initApp.listFilter($('.list'), $('#intput-id')); */ /* initApp.listFilter($('.list'), $('#intput-id')); */
// initApp.listFilter(listFilter, '#' + inputID); initApp.listFilter(listFilter, '#' + inputID);
//} }
/** /**
* Start bootstrap tooltips * Start bootstrap tooltips
@ -2068,26 +2068,26 @@ var layouts = (function(setlayout) {
**/ **/
$(window).resize( $(window).resize(
$.throttle( myapp_config.throttleDelay, function (e) { // $.throttle( myapp_config.throttleDelay, function (e) {
/** // /**
* (1a) ADD CLASS WHEN BELOW CERTAIN WIDTH (MOBILE MENU) // * (1a) ADD CLASS WHEN BELOW CERTAIN WIDTH (MOBILE MENU)
* Description: tracks the page min-width of #CONTENT and NAV when navigation is resized. // * Description: tracks the page min-width of #CONTENT and NAV when navigation is resized.
* This is to counter bugs for minimum page width on many desktop and mobile devices. // * This is to counter bugs for minimum page width on many desktop and mobile devices.
**/ // **/
initApp.mobileCheckActivation(); // initApp.mobileCheckActivation();
/** // /**
* (1b) CHECK NAVIGATION STATUS (IF HORIZONTAL OR VERTICAL) // * (1b) CHECK NAVIGATION STATUS (IF HORIZONTAL OR VERTICAL)
* Description: fires an event to check for navigation orientation. // * Description: fires an event to check for navigation orientation.
* Based on the condition, it will initliaze or destroy the slimscroll, or horizontal nav plugins // * Based on the condition, it will initliaze or destroy the slimscroll, or horizontal nav plugins
**/ // **/
initApp.checkNavigationOrientation(); // initApp.checkNavigationOrientation();
/** -- insert your resize codes below this line -- **/ // /** -- insert your resize codes below this line -- **/
}) //})
); );
/** /**
@ -2095,19 +2095,19 @@ $(window).resize(
**/ **/
$(window).scroll( $(window).scroll(
$.throttle( myapp_config.throttleDelay, function (e) { // $.throttle( myapp_config.throttleDelay, function (e) {
/** // /**
* FIX APP HEIGHT // * FIX APP HEIGHT
* Compare the height of nav and content; // * Compare the height of nav and content;
* If one is longer/shorter than the other, measure them to be equal. // * If one is longer/shorter than the other, measure them to be equal.
* This event is only fired on desktop. // * This event is only fired on desktop.
**/ // **/
/** -- insert your other scroll codes below this line -- **/ // /** -- insert your other scroll codes below this line -- **/
}) //})
); );
@ -2147,7 +2147,7 @@ document.addEventListener('DOMContentLoaded', function() {
/** /**
* c. initialize nav filter * c. initialize nav filter
**/ **/
/*initApp.listFilter(myapp_config.navHooks, myapp_config.navFilterInput, myapp_config.navAnchor);*/ initApp.listFilter(myapp_config.navHooks, myapp_config.navFilterInput, myapp_config.navAnchor);
/** /**
* d. run DOM misc functions * d. run DOM misc functions