mirror of
https://bitbucket.org/bellord13/kit.git
synced 2026-11-13 19:06:11 +03:00
153 lines
4.4 KiB
JavaScript
153 lines
4.4 KiB
JavaScript
kit.PluginManager.registerPlugins({
|
|
menu: {
|
|
path: kit.config.defaultPath + '/menu',
|
|
module: '/menu.js',
|
|
css: [
|
|
'/menu.css'
|
|
],
|
|
type: 'loader',
|
|
deps: ['lib', 'align', 'utils']
|
|
},
|
|
lib: {
|
|
path: kit.config.defaultPath + '/lib',
|
|
module: '/lib.js',
|
|
type: 'loader',
|
|
},
|
|
align: {
|
|
path: kit.config.defaultPath + '/align',
|
|
module: '/align.js',
|
|
type: 'loader',
|
|
},
|
|
utils: {
|
|
path: kit.config.defaultPath + '/utils',
|
|
module: '/utils.js',
|
|
type: 'loader',
|
|
},
|
|
jquery: {
|
|
path: kit.config.defaultPath + '/jquery',
|
|
module: '/jquery.min.js',
|
|
type: 'loader',
|
|
alias: '$',
|
|
},
|
|
tooltip: {
|
|
path: kit.config.defaultPath + '/tooltip',
|
|
module: '/tooltip.js',
|
|
type: 'loader',
|
|
css: '/tooltip.css',
|
|
onInstall: function(){
|
|
kit.$('[data-toggle="tooltip"]').tooltip();
|
|
},
|
|
deps: ['popper', 'bsCore'],
|
|
},
|
|
popper: {
|
|
path: kit.config.defaultPath + '/popper',
|
|
alias: 'popper.js',
|
|
module: '/popper.js',
|
|
type: 'loader',
|
|
},
|
|
bsCore: {
|
|
path: kit.config.defaultPath + '/bsCore',
|
|
module: '/bsCore.js',
|
|
type: 'loader',
|
|
css: [
|
|
'/bsCore.css'
|
|
]
|
|
},
|
|
mask: {
|
|
path: kit.config.defaultPath + '/mask',
|
|
module: '/mask.js',
|
|
type: 'loader',
|
|
deps: ['jquery'],
|
|
},
|
|
toolkit: {
|
|
path: kit.config.defaultPath + '/toolkit',
|
|
module: '/toolkit.js',
|
|
type: 'loader',
|
|
css: ['/toolkit.css'],
|
|
deps: ['jquery', 'mask'],
|
|
},
|
|
modal: {
|
|
path: kit.config.defaultPath + '/modal',
|
|
module: '/modal.js',
|
|
type: 'loader',
|
|
css: [
|
|
'/modal.css',
|
|
],
|
|
deps: ['bsCore'],
|
|
onRegister: function (plugin) {
|
|
plugin.onLoadConditionHandler = function (event) {
|
|
if(event.target && event.target.dataset && event.target.dataset.bsTarget && event.target.dataset.bsToggle === 'modal') {
|
|
kit.exec(plugin.id, function(){
|
|
var newEvent = new Event("click");
|
|
event.target.dispatchEvent(newEvent);
|
|
});
|
|
}
|
|
};
|
|
window.addEventListener('click', plugin.onLoadConditionHandler, false);
|
|
},
|
|
onInstall: function (plugin) {
|
|
if(plugin.onLoadConditionHandler) {
|
|
window.removeEventListener('click', plugin.onLoadConditionHandler, false);
|
|
}
|
|
},
|
|
},
|
|
collapse: {
|
|
path: kit.config.defaultPath + '/collapse',
|
|
module: '/collapse.js',
|
|
type: 'loader',
|
|
css: [
|
|
'/collapse.css',
|
|
],
|
|
deps: ['bsCore'],
|
|
onRegister: function (plugin) {
|
|
kit.PluginManager.install('collapse')
|
|
},
|
|
onInstall: function (plugin) {
|
|
},
|
|
},
|
|
datepicker: {
|
|
path: kit.config.defaultPath + '/datepicker',
|
|
module: '/js/datepicker.js',
|
|
type: 'loader',
|
|
css: [
|
|
'/css/datepicker.css',
|
|
],
|
|
deps: ['jquery'],
|
|
onRegister: function (plugin) {
|
|
kit.PluginManager.install(plugin.id)
|
|
},
|
|
onInstall: function (plugin) {
|
|
},
|
|
},
|
|
|
|
});
|
|
|
|
kit.exec([], function () {
|
|
console.log('start init');
|
|
|
|
function _init(){
|
|
console.log('_init');
|
|
kit.PluginManager.install('jquery');
|
|
kit.PluginManager.install('toolkit');
|
|
kit.PluginManager.install('tooltip');
|
|
kit.PluginManager.install('bsCore');
|
|
}
|
|
|
|
if (/complete|interactive|loaded/.test(document.readyState)) {
|
|
// In case the document has finished parsing, document's readyState will
|
|
// be one of "complete", "interactive" or (non-standard) "loaded".
|
|
console.log('1');
|
|
_init();
|
|
} else {
|
|
console.log('2');
|
|
// The document is not ready yet, so wait for the DOMContentLoaded event
|
|
document.addEventListener("DOMContentLoaded", _init);
|
|
}
|
|
console.log('readyState', document.readyState);
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
console.log('DOMContentLoaded', document.readyState);
|
|
});
|
|
$(function(){
|
|
console.log('$', document.readyState, typeof kit.toolkit);
|
|
});
|
|
}); |