if(!("console" in window)){ window.console = {}; window.console.log = function(str){ return str; }; } //お気に入りクリップ追加ボタンクリック //複数テンプレートから呼び出されるのでinit_jsにて記述 biz_create_pageclip=function(page_no){ if(page_no==null){ }else{ jQuery.ajax({ type: "POST", async: true, // 非同期 url: "https://user.sogyotecho.jp/api/page_clip_create", data: "md=json_output&page_no="+page_no, dataType: "jsonp", success: function(result){ if(result['result']){ alert("お気に入りに追加しました"); }else{ if(result['result_status']=='no_regist_user'){ //alert(""お気に入りに登録するにはログインして下さい""); //location.href="/biz_login"; if(window.confirm('"お気に入りに登録するにはログインして下さい"')){ location.href = "http://user.sogyotecho.jp/login/"; } }else if(result['msg']!=null){ alert(result['msg']); //if(window.confirm(result['msg'])){ // location.href = "http://user.sogyotecho.jp/login/"; //} } } }, error: function(){ alert("エラーが発生しました。後ほどお試し下さい"); } }); } } //あとで読むクリップ追加ボタンクリック //複数テンプレートから呼び出されるのでinit_jsにて記述 biz_create_sogyotechowebclip=function(page_path,page_title){ if(page_path==null||page_title==null){ }else{ jQuery.ajax({ type: "POST", async: true, // 非同期 url: "", data: "md=json_output&page_path="+page_path+"&page_title="+page_title, dataType: "jsonp", success: function(result){ if(result['result']){ alert("あとで読むに追加しました"); }else{ if(result['result_status']=='no_regist_user'){ //alert(""あとで読むに登録するにはログインして下さい""); //location.href="/biz_login"; if(window.confirm('"あとで読むに登録するにはログインして下さい"')){ location.href = "http://user.sogyotecho.jp/login/"; } }else if(result['msg']!=null){ alert(result['msg']); //if(window.confirm(result['msg'])){ // location.href = "http://user.sogyotecho.jp/login/"; //} } } }, error: function(){ alert("エラーが発生しました。後ほどお試し下さい"); } }); } } //問い合わせリスト追加ボタンクリック biz_append_inforequest=function(page_no,type){ if(page_no==null){ }else{ jQuery.ajax({ type: "POST", async: true, // 非同期 url: "https://user.sogyotecho.jp/api/append_info_request", data: "md=json_output&page_no="+page_no, dataType: "jsonp", success: function(result){ //既に入っていてもリダイレクト if(type=="direct"){ location.href="/client/info_request"; return; } if(result['result']){ if(type=="direct"){ location.href="/client/info_request"; }else{ alert("問い合わせリストに追加しました"); } }else{ if(result['result_status']=='no_regist_user'){ //alert("お気に入りに登録するにはログインして下さい"); //if(window.confirm('To add Request List, please login first.')){ // location.href = "http://user.sogyotecho.jp/login/"; //} }else if(result['msg']!=null){ alert(result['msg']); //if(window.confirm(result['msg'])){ //location.href = "http://user.sogyotecho.jp/login/"; // location.href="/client/info_request"; //} } } }, error: function(){ alert("エラーが発生しました。後ほどお試し下さい"); } }); } } //知りたいボタン biz_create_interest=function(page_no,mode){ //alert("inter"+page_no+mode); if(page_no==null){ }else{ if(mode=="check"){ //知りたいチェック jQuery.ajax({ type: "POST", async: true, // 非同期 url: "https://user.sogyotecho.jp/api/interest_create", data: "md=json_output&page_no="+page_no+"&type=check", dataType: "jsonp", success: function(result){ bizceed_interest_count_str=""; if(result['bizceed_interest_count']!=null){ bizceed_interest_count_str=""+result['bizceed_interest_count']+"人"; } if(result['result_status']=='exists'){ jQuery(".biz_interest_"+page_no).addClass("basic_btn--selected"); jQuery(".biz_interest_"+page_no).html("知りたい"+bizceed_interest_count_str); }else{ jQuery(".biz_interest_"+page_no).html("知りたい"+bizceed_interest_count_str); } }, error: function(){ //alert("エラーが発生しました。後ほどお試し下さい"); } }); }else{ //知りたいボタンクリック jQuery.ajax({ type: "POST", async: true, // 非同期 url: "https://user.sogyotecho.jp/api/interest_create", data: "md=json_output&page_no="+page_no, dataType: "jsonp", success: function(result){ bizceed_interest_count_str=""; if(result['bizceed_interest_count']!=null){ bizceed_interest_count_str=""+result['bizceed_interest_count']+"人"; } if(result['result']){ if(result['result_status']=='create'){ jQuery(".biz_interest_"+page_no).addClass("basic_btn--selected"); jQuery(".biz_interest_"+page_no).html("知りたい"+bizceed_interest_count_str); }else if(result['result_status']=='delete'){ jQuery(".biz_interest_"+page_no).removeClass("basic_btn--selected"); jQuery(".biz_interest_"+page_no).html("知りたい"+bizceed_interest_count_str); } }else{ if(result['result_status']=='no_regist_user'){ alert("お気に入りに登録するにはログインして下さい"); //location.href="/biz_login"; }else if(result['msg']!=null){ alert(result['msg']); } } }, error: function(){ //alert("エラーが発生しました。後ほどお試し下さい"); } }); } } } //スレッド作成ボタンクリック時処理 //テンプレートから呼び出し biz_create_thread=function(){ jQuery('span#biz_name_error').html(""); jQuery('span#biz_title_error').html(""); jQuery('span#biz_description_error').html(""); biz_name=jQuery('input[name=\'biz_name\']').val(); biz_title=jQuery('input[name=\'biz_title\']').val(); biz_description=jQuery('textarea[name=\'biz_description\']').val(); if(biz_name==null||biz_name==""){ jQuery('span#biz_name_error').html("名前が入力されていません"); }else if(biz_title==null||biz_title==''){ jQuery('span#biz_title_error').html("スレッドタイトルが入力されていません"); }else if(biz_description==null||biz_description==''){ jQuery('span#biz_description_error').html("スレッド内容が入力されていません"); }else{ //共に入力されていたのでAJAXで認証 jQuery.ajax({ type: "GET", async: true, // 非同期 url: "https://user.sogyotecho.jp/api/create_thread", data: "md=json_output&name="+biz_name+"&title="+biz_title+"&description="+biz_description, dataType: "jsonp", success: function(result){ if(result['result']){ jQuery('span#biz_form_success').html("スレッドを作成しました"); jQuery('input[name=\'biz_name\']').val(""); jQuery('input[name=\'biz_title\']').val(""); jQuery('textarea[name=\'biz_description\']').val(""); location.href="/bbs/"; }else{ if(result['msg']!=null){ msg_str=result['msg'].join("
"); jQuery('span#biz_form_error').html(msg_str); } } }, error: function(){ jQuery('span#biz_form_error').html("エラーが発生しました。後ほどお試し下さい"); } }); } } //ログインボタンクリック時処理 //テンプレートから呼び出し biz_login_submit=function(){ jQuery('span#biz_user_id_error').html(""); jQuery('span#biz_password_error').html(""); jQuery('span#biz_form_error').html(""); biz_user_id=jQuery('input[name=\'biz_user_id\']').val(); biz_password=jQuery('input[name=\'biz_password\']').val(); if(biz_user_id==null||biz_user_id==""){ jQuery('span#biz_user_id_error').html("メールアドレスが入力されていません"); }else if(biz_password==null||biz_password==''){ jQuery('span#biz_password_error').html("パスワードが入力されていません"); }else{ //共に入力されていたのでAJAXで認証 jQuery.ajax({ type: "GET", async: true, // 非同期 url: "https://user.sogyotecho.jp/login", data: "md=json_output&mailaddress="+biz_user_id+"&password="+biz_password, dataType: "jsonp", success: function(result){ if(result['result']){ alert("ログインしました"); location.href="/"; }else{ if(result['msg']!=null){ jQuery('span#biz_form_error').html(result['msg']); } } }, error: function(){ jQuery('span#biz_form_error').html("エラーが発生しました。後ほどお試し下さい"); } }); } } //ログインチェック成功 chg_ok=function(result){ //140723追加 jQuery('.biz-guest').hide(); jQuery('.biz-member').show(); jQuery('.biz-area').show(); jQuery('a[title=\'Bizceedログイン/ログアウト\']').text("ログアウト"); jQuery('a.bizceed_login_btn').text("ログアウト"); jQuery('a.bizceed_login_btn').addClass("biz_login_ok"); jQuery('a[title=\'Bizceedログイン/ログアウト\']').attr("onclick","location.href='/biz_login?md=logout'"); jQuery('a.bizceed_login_btn').attr("onclick","location.href='/biz_login?md=logout'"); jQuery('a[title=\'業者一覧\']').show(); jQuery('a.bizceed_client_btn').show(); jQuery('a[title=\'業者一覧\']').attr("onclick","location.href='/client/'"); jQuery('a.bizceed_client_btn').attr("onclick","location.href='/client/'"); jQuery('a[title=\'掲示板一覧\']').show(); jQuery('a.bizceed_bbs_btn').show(); jQuery('a[title=\'掲示板一覧\']').attr("onclick","location.href='/bbs/'"); jQuery('a.bizceed_bbs_btn').attr("onclick","location.href='/bbs/'"); //150521ボタン追加 jQuery('a.bizceed_client_clip_btn').show(); jQuery('a.bizceed_client_clip_btn').attr("onclick","location.href='/client/clip'"); jQuery('a.bizceed_client_info_request_btn').show(); jQuery('a.bizceed_client_info_request_btn').attr("onclick","location.href='/client/info_request'"); jQuery('a.bizceed_swclip_btn').show(); jQuery('a.bizceed_swclip_btn').attr("onclick","location.href='/client/swclip'"); jQuery('a[title=\'Bizceed管理画面へ\']').show(); jQuery('a.bizceed_admin_btn').show(); jQuery('a[title=\'Bizceed管理画面へ\']').attr("href","http://user.sogyotecho.jp/"); jQuery('a.bizceed_admin_btn').attr("href","http://user.sogyotecho.jp/"); jQuery('a[title=\'Bizceed管理画面へ\']').attr("target","_blank"); jQuery('a.bizceed_admin_btn').attr("target","_blank"); jQuery('a[title=\'Bizceedログイン/ログアウト\']').parent("li").show(); jQuery('a.bizceed_login_btn').parent("li").show(); jQuery('a[title=\'業者一覧\']').parent("li").show(); jQuery('a.bizceed_client_btn').parent("li").show(); //ログイン時のみ表示 jQuery('a[title=\'Bizceed管理画面へ\']').parent("li").show(); jQuery('a.bizceed_admin_btn').parent("li").show(); //各種ページ if(result['lun']!=null){ var lun=result['lun']; //alert(lun); //掲示板スレッド //掲示板コメント //業者コメント //名前入力を初期入力 //スレッド作成時名前//掲示板名前//業者名前 if(result['name']!=null){ jQuery('input.bizceed_name_input').val(result['name']); } //signupボックスあれば非表示 jQuery('div#signup_box').html(""); //コメント削除用 var comment_ed_list=jQuery('div.comment_ed_'+result['lun']); //alert(comment_ed_list); comment_ed_list.each(function(){ //繰り返し処理 var page_comment_no=jQuery(this)[0].id; page_comment_no=page_comment_no.replace('comment_ed_'+result['lun']+"_",""); //alert(page_comment_no); if(page_comment_no!=''){ var btnhtml='[削除]'; jQuery('#comment_ed_'+result['lun']+"_"+page_comment_no).html(btnhtml); } }); } } // window open 汎用 function open_win($window_name, $url, $width, $height, $options) { if (!$window_name) return; if (!$url) return ; if ($width) $width = 'width='+ $width +','; if ($height) $height = 'height='+ $height +','; if (!$options) $options = "resizable=yes,toolbar=no,scrollbars=yes,"; $new_win = window.open($url, $window_name , $width+ $height + $options); if ($new_win) { $new_win.focus(); } } //ログインチェックNG chg_ng=function(){ //140723追加 jQuery('.biz-guest').show(); jQuery('.biz-member').hide(); jQuery('.biz-area').show(); jQuery('a[title=\'Bizceedログイン/ログアウト\']').show(); jQuery('a.bizceed_login_btn').show(); jQuery('a.bizceed_login_btn').removeClass("biz_login_ok"); jQuery('a[title=\'Bizceedログイン/ログアウト\']').attr("onclick","location.href='http://user.sogyotecho.jp/login/?type=redirect'"); jQuery('a[class=\'bizceed_login_btn\']').attr("onclick","location.href='http://user.sogyotecho.jp/login/?type=redirect'"); jQuery('a[title=\'業者一覧\']').hide(); jQuery('a.bizceed_client_btn').hide(); jQuery('a[title=\'業者一覧\']').attr("onclick","location.href='/client/'"); jQuery('a[class=\'bizceed_client_btn\']').attr("onclick","location.href='/client/'"); jQuery('a[title=\'掲示板一覧\']').hide(); jQuery('a.bizceed_bbs_btn').hide(); jQuery('a[title=\'掲示板一覧\']').attr("onclick","location.href='/bbs/'"); jQuery('a[class=\'bizceed_bbs_btn\']').attr("onclick","location.href='/bbs/'"); //150521ボタン追加 jQuery('a.bizceed_client_clip_btn').hide(); jQuery('a.bizceed_client_clip_btn').attr("onclick","location.href='/client/clip'"); jQuery('a.bizceed_client_info_request_btn').hide(); jQuery('a.bizceed_client_info_request_btn').attr("onclick","location.href='/client/info_request'"); jQuery('a.bizceed_swclip_btn').hide(); jQuery('a.bizceed_swclip_btn').attr("onclick","location.href='/client/swclip'"); jQuery('a[title=\'Bizceed管理画面へ\']').hide(); jQuery('a.bizceed_admin_btn').hide(); jQuery('a[title=\'Bizceed管理画面へ\']').attr("href","http://user.sogyotecho.jp/"); jQuery('a[class=\'bizceed_admin_btn\']').attr("href","http://user.sogyotecho.jp/"); jQuery('a[title=\'Bizceed管理画面へ\']').attr("target","_blank"); jQuery('a[class=\'bizceed_admin_btn\']').attr("target","_blank"); jQuery('a[title=\'Bizceedログイン/ログアウト\']').parent("li").show(); jQuery('a[class=\'bizceed_login_btn\']').parent("li").show(); //ログイン時のみ表示 jQuery('a[title=\'Bizceed管理画面へ\']').parent("li").hide(); } check_bizceed_login=function(){ //apiでログイン情報チェック jQuery.ajax({ type: "GET", async: true, // 非同期 url: "https://user.sogyotecho.jp/api/login_check", data: "md=", dataType: "jsonp", success: function(result){ if(result['result']){ chg_ok(result); }else{ //もしログアウト成功ならリダイレクト if(result['status']=='logout'){ location.href="/"; }else{ //alert("ng"); chg_ng(); } } }, error: function(){ //alert("ng2"); chg_ng(); } }); //console.log("loginchk"); //ログイン済みで一覧へのメニューリンクあれば有効化 } ///////////////////////////////////////// //cookie用関数群 function setCookie(key,val){ tmp = key+"="+escape(val)+";"; tmp += " max-age=36000;"; tmp += "path=/;"; document.cookie = tmp; }; function getCookie(key){ tmp = document.cookie+";"; tmp1 = tmp.indexOf(key,0); if(tmp1 != -1){ tmp = tmp.substring(tmp1,tmp.length); start = tmp.indexOf("=",0); end = tmp.indexOf(";",start); return(unescape(tmp.substring(start+1,end))); } return(""); }; function delCookie(key){ expiredate = new Date(); expiredate.setYear(expiredate.getYear()-1); tmp = key+"=;"; tmp += "expires="+expiredate.toGMTString(); document.cookie = tmp; }; function show_ad_item(){ var ad_item_list_str=getCookie('ad_item_list'); //alert(ad_item_list_str); console.log("show_ad_item"+ad_item_list_str); if(ad_item_list_str!=null&&ad_item_list_str!=""){ ad_item_list=JSON.parse(ad_item_list_str); for(key in ad_item_list){ ad_no=key; //表示に切り替え jQuery(".product_option_"+ad_no+"_area").show(); console.log(".product_option_"+ad_no+"_areaをshow"); } } }; function append_ad_item(item_ar_str){ item_ar=item_ar_str.split(","); if(item_ar!=null){ for(var i=0;i知りたい'; var btnhtml='お気に入り問い合わせリストに追加問い合わせ'; jQuery(this).find('#bizceed_manual_regist_'+client_no).html(btnhtml+interest_btn_html); } }else if(jQuery(this).find('.bizceed_auto_regist')[0]){ //alert("bizceed_auto_regist"); var client_no=jQuery(this).find('.bizceed_auto_regist')[0].id; client_no=client_no.replace("bizceed_auto_regist_",""); //alert(client_no); if(client_no!=''){ //独自知りたいボタン biz_create_interest(client_no,"check"); interest_btn_html='知りたい'; var btnhtml='お気に入り'; jQuery(this).find('#bizceed_auto_regist_'+client_no).html(btnhtml+interest_btn_html); } } }); sw_flg=false; if(sw_flg){ //ここからあとで読む処理 var sw_list=jQuery('.sogyotecho_page'); //alert(page_list); sw_list.each(function(){ //alert(jQuery(this).data('path')); var path=jQuery(this).data('path'); var title=jQuery(this).data('title'); if(path!=null&&path!=""&&title!=null&&title!=""){ var btnhtml='あとで読む'; jQuery(this).html(btnhtml); } }); } });