function resizeResponsive(){var nWidth = window.innerWidth;if(nWidth>=1200){jQuery(".mb-desktop").removeClass("mb-desktop").addClass("mb-desktop-large");jQuery(".mb-tablet").removeClass("mb-tablet").addClass("mb-desktop-large");jQuery(".mb-mobile").removeClass("mb-mobile").addClass("mb-desktop-large");}else if(nWidth>=992){jQuery(".mb-desktop-large").removeClass("mb-desktop-large").addClass("mb-desktop");jQuery(".mb-tablet").removeClass("mb-tablet").addClass("mb-desktop");jQuery(".mb-mobile").removeClass("mb-mobile").addClass("mb-desktop");}else if(nWidth>=768){jQuery(".mb-desktop-large").removeClass("mb-desktop-large").addClass("mb-tablet");jQuery(".mb-desktop").removeClass("mb-desktop").addClass("mb-tablet");jQuery(".mb-mobile").removeClass("mb-mobile").addClass("mb-tablet");}else if(nWidth<768){jQuery(".mb-desktop-large").removeClass("mb-desktop-large").addClass("mb-mobile");jQuery(".mb-desktop").removeClass("mb-desktop").addClass("mb-mobile");jQuery(".mb-tablet").removeClass("mb-tablet").addClass("mb-mobile");}}if(typeof jQuery != "undefined"){ jQuery(window).on("resize",resizeResponsive);resizeResponsive();};var category_text = '';mb_categorys["value1"] = "";mb_categorys["value2"] = "";mb_categorys["value3"] = "";mb_urls["base"] = "https://k-foodfan.com/wp-content/plugins/mangboard/";mb_urls["image"] = "https://k-foodfan.com/?lang=en/?mb_ext=file";mb_urls["file"] = "https://k-foodfan.com/?lang=en/?mb_ext=file";mb_urls["search"] = "https://k-foodfan.com/b2b?lang=en&mode=list&lang=en";mb_options["device_type"] = "desktop";mb_options["mode"] = "view";mb_options["board_action"] = "";mb_options["board_name"] = "board";mb_options["board_type"] = "board";mb_options["table_prefix"] = "mb_board_";mb_options["pid"] = "58";mb_options["nonce"] = "mb_nonce_value=12bb424cfab3f6f801f50f6009b30cdf&mb_nonce_time=1766102815&wp_nonce_value=29bf5d357c&lang=en";mb_options["list_type"] = "list";mb_options["search_field"] = "fn_title";mb_options["search_text"] = "";mb_languages["selectbox1"] = "All";mb_languages["selectbox2"] = "All";mb_languages["selectbox3"] = "All";var category_data = "";
try {
if(isJsonType(category_text)){
category_data = JSON.parse(category_text);
}
}catch(e) {}
var view_action = "";
function showBoardViewDeleteConfirm(data){
showConfirmPopup("Are you sure you want to delete this item?
Please enter your password.", data, sendBoardViewDeleteData);
}
function sendBoardViewDeleteData(){
sendBoardViewData("delete");
}
function sendBoardViewData(action){
view_action = action;
var data = "mode=view&board_action="+action+"&board_name="+mb_options["board_name"]+"&board_pid="+mb_options["pid"];
if(action=="delete") data = data+"&passwd="+jQuery("#mb_confirm_passwd").val();
else if(action.indexOf('modify')==0) data = data+"&"+jQuery('#'+mb_options["board_name"]+'_form_board_view').serialize();
sendDataRequest(mb_urls["board_api"], data, sendBoardViewDataHandler);
}
function sendBoardViewDataHandler(response, state)
{
if(typeof(response)!=='undefined'){
if(response.state=="success"){
if(view_action=="delete"){
moveURL("https://k-foodfan.com/b2b?lang=en&mode=list&board_page=2&lang=en");
}else if(view_action=="vote_good"){
jQuery("#"+mb_options["board_name"]+"_vote_good").html("("+response.count+")");
}else if(view_action=="vote_bad"){
jQuery("#"+mb_options["board_name"]+"_vote_bad").html("("+response.count+")");
}else if(view_action.indexOf('modify')==0){
moveURL("reload");
}
}else{
showAlertPopup(response);
}
}
}
var comment_action = "";
var send_action = "";
var comment_index = 0;
var comment_pid = 0;
var comment_page = 0;
var comment_temp = 0;
var comment_load = false;
var comment_size = 50;
var comment_page_total = 0;
function sendCommentDeleteHandler(args){
var passwd = jQuery("#mb_confirm_passwd").val();
var data = "board_name="+mb_options["board_name"]+"&parent_pid="+mb_options["pid"]+"&mode=comment";
data = data+"&board_action="+args.board_action+"&comment_pid="+args.pid+"&passwd="+passwd+"&comment_size="+comment_page;
sendDataRequest(mb_urls["comment_api"], data, sendCommentDataHandler);
comment_page = 0;
}
function sendCommentData(action, pid, idx){
if(typeof(idx)==='undefined') idx = "";
if(typeof(pid)==='undefined') pid = "";
send_action = action;
var data = jQuery('#'+mb_options["board_name"]+'_form_comment_'+action).serialize();
data = data+"&board_name="+mb_options["board_name"]+"&parent_pid="+mb_options["pid"]+"&mode=comment";
if(action=="write"){
data = data+"&board_action="+action+"&comment_pid="+pid;
}else if(action=="reply"){
data = data+"&board_action="+action+"&comment_pid="+comment_pid+"&comment_size="+(comment_page+1);
}else if(action=="modify"){
data = data+"&board_action="+action+"&comment_pid="+comment_pid+"&comment_size="+(comment_page);
}else{
data = data+"&board_action="+action+"&comment_pid="+pid+"&comment_size="+comment_page;
}
if(mb_options["search_field"]!=""){
if(mb_options["search_text"]!=""){
data = data+"&search_field="+mb_options["search_field"]+"&search_text="+mb_options["search_text"];
}
}
sendDataRequest(mb_urls["comment_api"], data, sendCommentDataHandler);
comment_temp = comment_page;
comment_page = 0;
}
function sendCommentList(mode){
if(typeof(mode)==='undefined') mode = "";
if(comment_page_total>comment_page){
var data = "board_name="+mb_options["board_name"]+"&parent_pid="+mb_options["pid"]+"&mode=comment";
data = data+"&board_action=list&comment_page="+comment_page;
if(mb_options["search_field"]!=""){
if(mb_options["search_text"]!=""){
data = data+"&search_field="+mb_options["search_field"]+"&search_text="+mb_options["search_text"];
}
}
if(mode=="init"){
sendDataRequest2(mb_urls["comment_api"], data, sendCommentDataHandler);
}else{
sendDataRequest(mb_urls["comment_api"], data, sendCommentDataHandler);
}
}
}
function modifyCommentForm(response, state){
if(response.state == "success"){
jQuery("#mb_comment_reply"+comment_index).html(response.data);
}else{
showAlertPopup(response);
}
}
function showCommentForm(action, pid, idx){
var addHtml = "";
var form_type = 1;
if(comment_index==idx){
if(comment_action==action) form_type = 2;
}
if(action=="delete"){
showConfirmPopup("Are you sure you want to delete this item?", {"board_action":action,"pid":pid}, sendCommentDeleteHandler);
}else if(action=="delete_passwd"){
showConfirmPopup("Are you sure you want to delete this item?
Please enter your password.", {"type":"passwd","board_action":"delete","pid":pid}, sendCommentDeleteHandler);
}else if(action=="modify"){
if(form_type==2){
jQuery("#mb_comment_reply"+comment_index).html("");
comment_index = 0;
comment_pid = 0;
comment_action = "";
}else{
if(comment_index!=0) jQuery("#mb_comment_reply"+comment_index).html("");
comment_index = idx;
comment_pid = pid;
comment_action = action;
var param = "mode=comment&board_action=modify&board_name="+mb_options["board_name"]+"&comment_pid="+pid;
sendDataRequest(mb_urls["template_api"], param, modifyCommentForm);
}
}else if(action=="reply"){
addHtml= '
';
if(form_type==2){
jQuery("#mb_comment_reply"+comment_index).html("");
comment_index = 0;
comment_pid = 0;
comment_action = "";
}else{
if(comment_index!=0) jQuery("#mb_comment_reply"+comment_index).html("");
comment_index = idx;
comment_pid = pid;
comment_action = action;
jQuery("#mb_comment_reply"+comment_index).html(addHtml);
}
}
}
function sendCommentDataHandler(response, state){
if(response.state == "success"){
comment_index = 0;
comment_pid = 0;
comment_action = "";
jQuery(".cmt-input-box input[type='text']").val("");
jQuery(".cmt-input-box input[type='password']").val("");
jQuery(".cmt-input-box textarea").val("");
if(send_action =="write"){
jQuery("#mb_comment_write_box").html(jQuery("#mb_comment_write_box").html());
}
if(comment_load) hidePopupBox();
comment_load = true;
var comment_items = "";
var comment_item = "";
var select_index = comment_page+1;
var fn_pid = 'pid';
var fn_parent_pid = 'parent_pid';
var fn_reply = 'reply';
var fn_is_secret = 'is_secret';
jQuery.each(response.data, function(key,value){
if(parseInt(value[fn_reply])>0){
reply_class = ' cmt-reply-item';
reply_sign = '
';
} else {
reply_class = "";
reply_sign = "";
}
if(value[fn_is_secret]=="1"){
reply_sign = reply_sign+'
';
}
comment_item = "";
comment_item = comment_item+'
';
comment_item = comment_item+''+reply_sign+value['user_name']+' '+value['reg_date']+'
';comment_item = comment_item+''+value['content']+'
';
comment_item = comment_item+'';
if(value['secret_type']!='lock'){if(value['mode']=='list'){comment_item = comment_item+'View '; }if(value['delete_type']=='user'){comment_item = comment_item+'Delete '; }else if(value['delete_type']=='guest'){comment_item = comment_item+'Delete '; }if(value['modify_type']=='user' || value['modify_type']=='guest' ){comment_item = comment_item+'Modify '; }if(reply_class==''){ if(value['reply_type']=='user' || value['reply_type']=='guest'){comment_item = comment_item+'Reply ';}}}
comment_item = comment_item+'
';
comment_item = comment_item+' ';
select_index = select_index+1;
comment_items = comment_items+comment_item;
});
if(comment_page==0)
jQuery("#comment_list_box").html(comment_items);
else
jQuery("#comment_list_box").append(comment_items);
comment_page = select_index-1;
comment_page_total = parseInt(response.total_count);
if(comment_page_total==0){
jQuery("#comment_list_box").hide();
}else{
jQuery("#comment_list_box").show();
}
jQuery(".cmt-count-box").show();
jQuery("#mb_comment_totalcount").html(comment_page_total);
if(comment_page>=comment_page_total) jQuery("#comment_add_list").hide();
else jQuery("#comment_add_list").show();
}else{
comment_page = comment_temp;
showAlertPopup(response);
}
}