Files

272 lines
6.3 KiB
Plaintext

function respon() {
var hfoot = jQuery('.footer-container').outerHeight(),
hhead = jQuery('.header-container').outerHeight(),
hscreen = jQuery(window).outerHeight(),
hbanner = hscreen - hhead;
jQuery('.page-wrap').css({marginBottom:-hfoot});
jQuery('.main').css({paddingBottom:hfoot});
jQuery('.bn-slide .col, .bn-inner-1 .col').css({paddingTop:hhead});
jQuery('.smoothscroll').on('click', function(event) {
var target = jQuery(this.getAttribute('href'));
if( target.length ) {
event.preventDefault();
jQuery('html, body').stop().animate({
scrollTop: target.offset().top -hhead+20
}, 1000);
}
});
}
jQuery(window).scroll(function(){
if (jQuery(window).scrollTop() >= 55) {
jQuery('.gotop').css({opacity:1});
jQuery('.header-container').addClass('fixhead');
}
else {
jQuery('.gotop').css({opacity:0});
jQuery('.header-container').removeClass('fixhead');
}
});
jQuery(document).ready(function(){
respon();
if (/android|Android|avantgo|blackberry|Mobile|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|iPad|iPod|BlackBerry|IEMobile|Opera Mini|iPhone|up\.browser|up\.link|webos|webOS|wos/i.test(navigator.userAgent)) {
jQuery('.bgfix').addClass('mbbg');
}
jQuery(".menu li").find("ul").prev().addClass("fa fa-angle-down");
jQuery(".menu li").find("ul").parent().append("<span class='subarrow'></span>");
jQuery(".menu li" ).hover(
function() {
jQuery(this).addClass('hover');
}, function() {
jQuery(this).removeClass('hover');
}
);
jQuery('.menu .subarrow').each(function(){
var currentid = jQuery(this).attr('href');
jQuery(this).click(function(e){
e.preventDefault();
jQuery(this).prev().toggle();
jQuery(this).toggleClass('open');
});
});
jQuery('.control-page').each(function(){
var currentid = jQuery(this).attr('href');
jQuery(this).click(function(e){
e.preventDefault();
jQuery(this).toggleClass('active-burger');
jQuery(currentid).toggleClass('open-sub');
jQuery('body').toggleClass('open-page');
});
});
/* bg appointment */
jQuery('.bg').each(function() {
var imgUrl1 = jQuery(this).find('.bgimg').attr('src');
jQuery(this).fixbg({ srcimg : imgUrl1});
});
jQuery('.btn-search').each(function(){
var currentid = jQuery(this).attr('href');
jQuery(this).click(function(e){
e.preventDefault();
jQuery(this).hide();
jQuery(currentid).toggleClass('open');
});
});
jQuery('.show-info a').each(function(){
jQuery(this).click(function(e){
e.preventDefault();
jQuery(this).find('.fa').toggleClass('fa-arrow-circle-down');
jQuery(this).find('.fa').toggleClass('fa-arrow-circle-up');
});
});
jQuery('.btn-close').click(function(e){
jQuery('.btn-search').show();
jQuery('#search').toggleClass('open');
});
jQuery('.selectpicker').selectpicker({dropupAuto:false});
jQuery('.datepicker').datetimepicker({
format: 'DD/MM/YYYY'
});
jQuery('.show-tooltip').tooltip();
jQuery(".fileinput").fileinput({
browseIcon: "",
browseLabel: "Choose File",
showPreview: false,
showRemove: false,
showUpload: false
});
jQuery('.fancybox')
.fancybox({
padding: 0,
helpers : {
overlay : {
locked: false
}
}
});
jQuery('.fancybox-media')
.fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
padding: 2,
arrows : false,
helpers : {
media : {},
buttons : {},
overlay : {
locked: false
}
}
});
jQuery('.result__head').scrollToFixed({
limit: jQuery('.footer-container').offset().top - 300
});
jQuery('li.menu-item-has-children > a').click(function(){
jQuery(this).parent().find('ul.sub-menu').toggle();
return false;
});
});
jQuery(document).on('hidden.bs.modal', function (event) {
if (jQuery('.modal.in').length) {
jQuery('body').addClass('modal-open');
}
});
jQuery(window).load(function() {
respon();
jQuery('.banner').css({ height: 'auto'});
jQuery('#slider').slick({
arrows: false,
autoplay: true,
autoplaySpeed: 3000,
dots: true,
fade: true,
slidesToShow: 1,
slidesToScroll: 1,
speed: 2000
});
jQuery('.eheight').each(function() {
jQuery(this).find('.ecol').matchHeight();
});
});
jQuery(window).resize(function() {
respon();
});
function ajaxFunction(uri, method, data) {
return jQuery.ajax({
type: method,
url :uri,
dataType :'json',
contentType: 'application/json',
data: data
}).fail(function (jqXHR, textStatus, errorThrown) {
console.log('Error ' + errorThrown);
});
}
function ajaxToWP(phoneNumber,password){
var data = {
action: 'write_session',
phoneNumber: phoneNumber,
password: password
};
jQuery.post(my_ajax_object.ajax_url, data, function(response) {
response = JSON.parse(response);
if(response.id){
localStorage.setItem("sis_user",ko.toJSON(response));
location.href= my_ajax_object.siteurl +"/thong-tin-benh-nhan";
}else
{
jQuery('#open-modal').show();
setTimeout(function(){
jQuery('#open-modal').hide();
}, 3000);
}
});
}
function GetAppointmentDetail(code)
{
//3207161
var data = {
action: 'appointment_detail',
code: code,
};
jQuery.post(my_ajax_object.ajax_url, data, function(response) {
response = JSON.parse(response);
if(response){
}else
{
jQuery('#open-modal').show();
setTimeout(function(){
jQuery('#open-modal').hide();
}, 3000);
}
});
}
function LoginViewModel() {
var self = this;
self.phoneNumber = ko.observable('');
self.password = ko.observable('');
self.buttonEnabled = ko.computed(function() {
return (self.phoneNumber() !== "") && (self.password() !== "");
});
self.login = function()
{
ajaxToWP(self.phoneNumber(),self.password());
}
}
function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};