Home>
ภาควิชาวิศวกรรมป่าไม้
{{title}}

{{avatarName}}
{{viewCount}} View
`
var componentFile = `
`
var componentFAQ = ``
var componentImage = `
`
componentFile = componentFile.replace("ดูเพิ่มเติม", 'ดูเพิ่มเติม')
import Lightbox from 'https://demo-ku-ff.clicknext.net/wp-content/themes/kuff/assets/plugins/photoSwipe/dist/photoswipe-lightbox.esm.js';
var lightbox = new Lightbox({
gallery: '#listBlog',
children: 'a',
pswpModule: () => import('https://demo-ku-ff.clicknext.net/wp-content/themes/kuff/assets/plugins/photoSwipe/dist/photoswipe.esm.js')
});
$(function() {
var data = {
'action': 'getDepByCatID',
'postType': 'dep_engine_type',
'postCategories': 'dep_engine_cat',
'catID': 119,
'posts': -1
}
initCatOffset(data,'เกี่ยวกับภาควิชา', 7)
$('#selectCategories').selectpicker()
// Click
$('[data-js=openCategories]').on('click', function (e) {
data.catID = $(this).data('id')
$('#listBlog').empty();
$('#accordionFAQ').empty();
$('#departmentsCategories li').find('.btn').removeClass('active')
$(this).addClass('active')
initCatOffset(data, $(this).data('title'))
})
$('#selectCategories').on('change', function (e) {
data.catID = $(this).val('id')
$('#listBlog').empty();
$('#accordionFAQ').empty();
$('#departmentsCategories li').find('.btn').removeClass('active')
$(this).addClass('active')
initCatOffset(data, $(this).text())
})
});
function initCatOffset(e, title, type) {
// $('#pagination').pagination('destroy')
let typeData = ''
$('#pagination').pagination({
dataSource: function(done) {
$.ajax({
url: my_ajax.ajaxurl,
method: 'POST',
dataType: 'json',
data: e,
success: function(result) {
$('#departmentsTitle').text(title)
if (result.data != "Post Empty") {
// console.log(result);
if (result.data.length > 0) {
var htmlBlog = ''
var htmlfile = ''
// template method of yourself
typeData = result.type
if (typeData == 'faq') {
initAccordion(result.data)
} else {
done(result.data);
}
} else {
$('#listBlog').append( 'ไม่พบรายการ' );
}
// if (result.data.file.length > 0) {
// htmlfile = templateDownload(result.data.file,componentFile);
// $('#listBlogFile').html(htmlfile);
// } else {
// $('#listBlogFile').append( 'ไม่พบรายการ' );
// }
} else {
$('#listBlog').append( 'ไม่พบรายการ' );
}
}
});
},
className: "kuff-pagination",
prevText: '',
nextText: '',
pageSize: 7,
callback: function(data, pagination) {
var htmlBlog = ''
var htmlfile = ''
if (typeData == 'content_editor') {
$('#accordionFAQ').addClass('d-none');
htmlBlog = templatePublicRelations(data,component);
$('#listBlog').attr('class', 'list-item list-item--blog');
$('#listBlog').html(htmlBlog);
} else if(typeData == 'file') {
$('#accordionFAQ').addClass('d-none');
htmlBlog = templateDownload(data,componentFile);
$('#listBlog').attr('class', 'list-item list-item--file');
$('#listBlog').html(htmlBlog);
} else if(typeData == 'image_gallery') {
$('#accordionFAQ').addClass('d-none');
htmlBlog = templateGallery(data,componentImage);
$('#listBlog').attr('class', 'list-item list-item--gallery');
$('#listBlog').html(htmlBlog);
lightbox.init();
} else if(typeData == 'post_grid') {
$('#accordionFAQ').addClass('d-none');
htmlBlog = templatePublicRelations(data,component);
$('#listBlog').attr('class', 'list-item list-item--blog list-item--blog__not-first');
$('#listBlog').html(htmlBlog);
}
// console.log(data);
},
afterPageOnClick: function(data, pagination) {
// template method of yourself
// console.log(data);
}
})
}
function initAccordion(data) {
let htmlBlog = ''
$('#accordionFAQ').removeClass('d-none');
htmlBlog = templateAccordion(data,componentFAQ);
$('#listBlog').attr('class', 'list-item d-none');
$('#accordionFAQ').html(htmlBlog);
}