mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 12:11:19 +00:00
move all init function into one function and call after loading html
This commit is contained in:
parent
10e3ae560c
commit
6b0b72a062
|
@ -47,47 +47,7 @@ function treeDocumentSelected(formid, nodeid, nodename) {
|
|||
$('#docChooser'+formid).modal('hide');
|
||||
}
|
||||
|
||||
$(document).ready( function() {
|
||||
// $('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
|
||||
$('body').on('click', '.dropdown-menu a.dropdown-toggle', function (e) {
|
||||
if (!$(this).next().hasClass('show')) {
|
||||
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
|
||||
}
|
||||
var $subMenu = $(this).next(".dropdown-menu");
|
||||
$subMenu.toggleClass('show');
|
||||
|
||||
|
||||
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
|
||||
$('.dropdown-submenu .show').removeClass("show");
|
||||
});
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/* close popovers when clicking somewhere except in the popover or the
|
||||
* remove icon
|
||||
*/
|
||||
$('html').on('click', function(e) {
|
||||
if (typeof $(e.target).data('original-title') == 'undefined' && !$(e.target).parents().is('.popover.in') && !$(e.target).is('.fa fa-remove')) {
|
||||
$('[data-original-title]').popover('hide');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('hidden', '.modal', function () {
|
||||
$(this).removeData('modal');
|
||||
});
|
||||
|
||||
/* Bootstrap 4 does not support to the remote loading of the modal content
|
||||
* anymore. This adds it by using jquery.
|
||||
*/
|
||||
$('body').on('click', '[data-toggle="modal"]', function(ev){
|
||||
ev.preventDefault();
|
||||
$($(this).data("target")+' .modal-body').load($(this).data("remote"));
|
||||
});
|
||||
|
||||
// $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
|
||||
|
||||
function initMost() {
|
||||
$('.datepicker, #expirationdate, #createstartdate, #createenddate, #expirationstartdate, #expirationenddate')
|
||||
.datepicker({todayHighlight: true, toggleActive: true, autoclose: "true"})
|
||||
/*
|
||||
|
@ -282,6 +242,50 @@ $(document).ready( function() {
|
|||
return '<i class="fa fa-folder-o"></i> ' + strarr[1].replace(/</g, '<');
|
||||
}
|
||||
}); /* }}} */
|
||||
}
|
||||
|
||||
$(document).ready( function() {
|
||||
// $('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
|
||||
$('body').on('click', '.dropdown-menu a.dropdown-toggle', function (e) {
|
||||
if (!$(this).next().hasClass('show')) {
|
||||
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
|
||||
}
|
||||
var $subMenu = $(this).next(".dropdown-menu");
|
||||
$subMenu.toggleClass('show');
|
||||
|
||||
|
||||
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
|
||||
$('.dropdown-submenu .show').removeClass("show");
|
||||
});
|
||||
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
/* close popovers when clicking somewhere except in the popover or the
|
||||
* remove icon
|
||||
*/
|
||||
$('html').on('click', function(e) {
|
||||
if (typeof $(e.target).data('original-title') == 'undefined' && !$(e.target).parents().is('.popover.in') && !$(e.target).is('.fa fa-remove')) {
|
||||
$('[data-original-title]').popover('hide');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('hidden', '.modal', function () {
|
||||
$(this).removeData('modal');
|
||||
});
|
||||
|
||||
/* Bootstrap 4 does not support to the remote loading of the modal content
|
||||
* anymore. This adds it by using jquery.
|
||||
*/
|
||||
$('body').on('click', '[data-toggle="modal"]', function(ev){
|
||||
ev.preventDefault();
|
||||
$($(this).data("target")+' .modal-body').load($(this).data("remote"));
|
||||
});
|
||||
|
||||
// $('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });
|
||||
|
||||
initMost();
|
||||
|
||||
$('body').on('click', '[id^=clearfolder]', function(ev) { /* {{{ */
|
||||
ev.preventDefault();
|
||||
|
@ -509,32 +513,13 @@ $(document).ready( function() {
|
|||
element.prepend('<div style="position: _absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: 200px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>');
|
||||
$.get(url, function(data) {
|
||||
element.html(data);
|
||||
$(".chzn-select").select2({
|
||||
theme: "bootstrap4",
|
||||
width: '100%',
|
||||
templateResult: chzn_template_func//,
|
||||
//templateSelection: chzn_template_func
|
||||
});
|
||||
$(".pwd").passStrength({ /* {{{ */
|
||||
url: "../op/op.Ajax.php",
|
||||
onChange: function(data, target) {
|
||||
pwsp = 100*data.score;
|
||||
$('#'+target+' div.bar').width(pwsp+'%');
|
||||
if(data.ok) {
|
||||
$('#'+target+' div.bar').removeClass('bg-danger');
|
||||
$('#'+target+' div.bar').addClass('bg-success');
|
||||
} else {
|
||||
$('#'+target+' div.bar').removeClass('bg-success');
|
||||
$('#'+target+' div.bar').addClass('bg-danger');
|
||||
}
|
||||
}
|
||||
}); /* }}} */
|
||||
if(afterload) {
|
||||
var func = eval(afterload);
|
||||
if(typeof func === "function"){
|
||||
func();
|
||||
}
|
||||
}
|
||||
initMost();
|
||||
});
|
||||
}); /* }}} */
|
||||
|
||||
|
@ -576,26 +561,6 @@ $(document).ready( function() {
|
|||
element.prepend('<div style="position: absolute; overflow: hidden; background: #f7f7f7; z-index: 1000; height: '+element.height()+'px; width: '+element.width()+'px; opacity: 0.7; display: table;"><div style="display: table-cell;text-align: center; vertical-align: middle; "><img src="../views/bootstrap/images/ajax-loader.gif"></div>');
|
||||
$.get(url, function(data) {
|
||||
element.html(data);
|
||||
$(".chzn-select").select2({
|
||||
theme: "bootstrap4",
|
||||
width: '100%',
|
||||
templateResult: chzn_template_func//,
|
||||
//templateSelection: chzn_template_func
|
||||
});
|
||||
$(".pwd").passStrength({ /* {{{ */
|
||||
url: "../op/op.Ajax.php",
|
||||
onChange: function(data, target) {
|
||||
pwsp = 100*data.score;
|
||||
$('#'+target+' div.bar').width(pwsp+'%');
|
||||
if(data.ok) {
|
||||
$('#'+target+' div.bar').removeClass('bg-danger');
|
||||
$('#'+target+' div.bar').addClass('bg-success');
|
||||
} else {
|
||||
$('#'+target+' div.bar').removeClass('bg-success');
|
||||
$('#'+target+' div.bar').addClass('bg-danger');
|
||||
}
|
||||
}
|
||||
}); /* }}} */
|
||||
if(callback)
|
||||
callback.call();
|
||||
if(afterload) {
|
||||
|
@ -604,6 +569,7 @@ $(document).ready( function() {
|
|||
func();
|
||||
}
|
||||
}
|
||||
initMost();
|
||||
});
|
||||
}); /* }}} */
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user