| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)pathways.org.hk/MIS20140127/old20140407/js/ |
Upload File : |
function scrollToTop() {
var $root = $('html, body');
$root.animate({
scrollTop: 0
}, 500);
}
var enableLeaveWarning = false;
$(function() {
// bootstrap
$.fn.typeahead.Constructor.prototype.customLookup = function (event) {
var items
this.query = this.$element.val()
if (this.query.length < this.options.minLength) {
return this.shown ? this.hide() : this
}
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
return items ? this.process(items) : this
};
// Leave confirm
$('input, textarea, select').change(function() {
var $this = $(this),
readonly = $this.prop('readonly'),
disabled = $this.prop('disabled');
if (!readonly && !disabled) {
// ignore search form
var $form = $this.closest('form');
if ($form.length) {
var id = $form.attr('id');
if (id != 'search_form') {
enableLeaveWarning = true;
}
}
}
});
$(window).bind('beforeunload', function(e) {
if (enableLeaveWarning) {
return '★ Data still NOT SAVED, are you want to leave this page? ★';
}
});
var checkedSubmit = false,
checkedSubmitLastEnableLeaveWarning = false;
$(':submit').click(function() {
checkedSubmit = true;
checkedSubmitLastEnableLeaveWarning = enableLeaveWarning;
enableLeaveWarning = false;
});
// validator
$.validator.setDefaults({
errorClass: 'text-error',
invalidHandler: function(event, validator) {
var errors = validator.numberOfInvalids();
if (errors) {
if (checkedSubmit) {
enableLeaveWarning = checkedSubmitLastEnableLeaveWarning;
checkedSubmit = false;
}
validator.showErrors(); // show errors before fix IE placeholder position
if ($.browser.msie) {
$(window).resize(); // fix IE placeholder position
}
}
}
});
// select2
$.fn.select2.defaults = $.extend({}, $.fn.select2.defaults, {
minimumInputLength: 0,
allowClear: true,
placeholder: 'Please Select...'
});
$(document).on('blur', 'input[type=text], input[type=textarea]', function() {
if ($.browser.msie) {
$(window).resize(); // fix IE placeholder position
}
});
});