first commit
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /assets/js/display.js
|
||||
Desc. : JS - Halaman Utama Display
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 24th, 2010.
|
||||
Last Modified : January 2nd, 2026.
|
||||
|
||||
(c) 2010 - 2026, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
$(document).ready(function(){
|
||||
jQuery('#preloader').remove();
|
||||
DispJS.loading();
|
||||
});
|
||||
|
||||
var DispJS = {
|
||||
PHP: FoniaJS.WEB_PATH+'apps/php/display.php',
|
||||
DEF_PROMO_DUR: 10,
|
||||
DEF_THANK_TIME: 1,
|
||||
DEF_IDLE_TIME: 5,
|
||||
IDLE_TIME: 0,
|
||||
ISSHOW_POS: false,
|
||||
ISSHOW_THANK: false,
|
||||
|
||||
loading: function(){
|
||||
new Request.JSON({
|
||||
url: this.PHP,
|
||||
sendParam: ['data=default'],
|
||||
onSuccess: function(ares){
|
||||
$('#pageContent').html(ares.html);
|
||||
this.data_query('config');
|
||||
this.data_query('info-promo');
|
||||
this.data_query('info-iklan');
|
||||
this.hide_pos();
|
||||
this.hide_thank();
|
||||
setInterval(function(){
|
||||
if (DispJS.IDLE_TIME >= DispJS.DEF_THANK_TIME || DispJS.IDLE_TIME >= DispJS.DEF_IDLE_TIME) {
|
||||
if (DispJS.ISSHOW_POS) { DispJS.hide_pos(); DispJS.ISSHOW_POS = false }
|
||||
if (DispJS.IDLE_TIME < DispJS.DEF_IDLE_TIME) {
|
||||
if (DispJS.ISSHOW_THANK) { DispJS.show_thank(); }
|
||||
} else {
|
||||
if (DispJS.ISSHOW_THANK) { DispJS.data_query('close-thank'); }
|
||||
}
|
||||
DispJS.data_query('count-delay');
|
||||
} else {
|
||||
if (DispJS.ISSHOW_THANK) { DispJS.data_query('close-thank'); }
|
||||
if (!DispJS.ISSHOW_POS) { DispJS.show_pos(); DispJS.ISSHOW_POS = true }
|
||||
if ($('#divShop').length) DispJS.data_query('info-shop');
|
||||
}
|
||||
}, 1000);
|
||||
}.bind(this)
|
||||
}).send();
|
||||
},
|
||||
|
||||
hide_pos: function(){
|
||||
$('#divBanner').removeClass('d-none');
|
||||
$('#divShop').addClass('d-none');
|
||||
},
|
||||
|
||||
show_pos: function(){
|
||||
$('#divBanner').addClass('d-none');
|
||||
$('#divShop').removeClass('d-none');
|
||||
this.data_query('shop');
|
||||
},
|
||||
|
||||
hide_thank: function(){
|
||||
$('#divBlur').addClass('d-none');
|
||||
$('#divThank').addClass('d-none');
|
||||
},
|
||||
|
||||
show_thank: function(){
|
||||
$('#divBlur').removeClass('d-none');
|
||||
$('#divThank').removeClass('d-none');
|
||||
this.data_query('thank');
|
||||
},
|
||||
|
||||
data_query: function(tipe){
|
||||
if (tipe=='config'){
|
||||
$.post(this.PHP, {data:'config'}, function(ajson){
|
||||
if (ajson.PROMO_DURASI) DispJS.DEF_PROMO_DUR = ajson.PROMO_DURASI;
|
||||
if (ajson.PROMO_IDLE) DispJS.DEF_IDLE_TIME = ajson.PROMO_IDLE;
|
||||
if (ajson.BANNER_TEXT) $('#divBanner').html(ajson.BANNER_TEXT);
|
||||
}, 'json');
|
||||
} else if (tipe=='info-iklan'){
|
||||
$.post(this.PHP, {data:'info-iklan'}, function(data){
|
||||
$('#divIklan').html(data);
|
||||
const car_iklan = new bootstrap.Carousel('#divIklan', {
|
||||
interval: DispJS.DEF_PROMO_DUR
|
||||
});
|
||||
});
|
||||
} else if (tipe=='info-promo'){
|
||||
$.post(this.PHP, {data:'info-promo'}, function(data){
|
||||
$('#divPromo').html(data);
|
||||
const car_iklan = new bootstrap.Carousel('#divPromo', {
|
||||
interval: DispJS.DEF_PROMO_DUR
|
||||
});
|
||||
});
|
||||
} else if (tipe=='count-delay'){
|
||||
$.post(this.PHP, {data:'count-delay'}, function(ajson){
|
||||
if (parseInt(ajson.total)==0) this.IDLE_TIME++; else this.IDLE_TIME = 0;
|
||||
this.ISSHOW_THANK = (parseInt(ajson.thank)==1) ? true : false;
|
||||
}.bind(this), 'json');
|
||||
} else if (tipe=='shop'){
|
||||
$.post(this.PHP, {data:'shop'}, function(data){
|
||||
$('#divShop').html(data);
|
||||
});
|
||||
} else if (tipe=='thank'){
|
||||
$.post(this.PHP, {data:'thank'}, function(data){
|
||||
$('#divThank').html(data);
|
||||
});
|
||||
} else if (tipe=='close-thank'){
|
||||
$.post(this.PHP, {data:'close-thank'}, function(){
|
||||
this.ISSHOW_THANK = false;
|
||||
this.hide_thank();
|
||||
}.bind(this));
|
||||
} else if (tipe=='info-shop'){
|
||||
$.post(this.PHP, {data:'info-shop'}, function(ajson){
|
||||
$('#Total_Harga').html(ajson.Total_Harga);
|
||||
$('#Info_Qty').html(ajson.Info_Qty);
|
||||
$('#Info_Barang').html(ajson.Info_Barang);
|
||||
if (parseFloat($('#Total_Harga').html())==0) this.IDLE_TIME++; else this.IDLE_TIME = 0;
|
||||
}.bind(this), 'json');
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user