$(function(){ var pattern ={ // /products/list.php の変換マスタ // "カテゴリID":"変換後ファイル名" "category_list":{ "2" :"basketball", "4" :"badminton", "8" :"volleyball", "9" :"soccer", "45" :"futsal", "6" :"softtennis", "7" :"tennis", "10" :"softball", "11" :"handball", "12" :"rugby", "43" :"golf", "3" :"tabletennis", "13" :"baseball", "5" :"kendo", "46" :"naginata", "14" :"judo", "15" :"kyudo", "42" :"gymnastics", "16" :"rhythmicgymnastics", "17" :"athletics", "19" :"creativedance", "18" :"aerobics", "20" :"dance", "44" :"mentaltraining", "22" :"lympamassage", "23" :"training", "24" :"taping", "26" :"recruit", "27" :"english", "31" :"takken", "32" :"shakaihokenroumushi", "33" :"gyouseisyoshi", "35" :"nisshouboki", "36" :"kokunairyokou", "37" :"kaigofukushishi", "38" :"manshonkanrishi", "39" :"fudousankanteishi", "47" :"wrestling", "48" :"roadbikes", "49" :"taiiku" }, "products_category_list":{ "1" :"aerobics", "2" :"aerobics", "3" :"aerobics", "4" :"aerobics", "5" :"baseball", "6" :"baseball", "7" :"baseball", "8" :"baseball", "9" :"baseball", "10" :"baseball", "11" :"baseball", "12" :"basketball", "13" :"basketball", "14" :"basketball", "15" :"basketball", "16" :"basketball", "17" :"basketball", "18" :"basketball", "19" :"basketball", "20" :"basketball", "21" :"basketball", "22" :"basketball", "23" :"basketball", "24" :"basketball", "25" :"basketball", "26" :"basketball", "27" :"basketball", "28" :"basketball", "29" :"basketball", "30" :"basketball", "31" :"basketball", "32" :"basketball", "33" :"basketball", "34" :"badminton", "35" :"badminton", "36" :"badminton", "37" :"badminton", "38" :"badminton", "39" :"badminton", "40" :"badminton", "41" :"badminton", "42" :"badminton", "43" :"badminton", "44" :"badminton", "45" :"badminton", "46" :"badminton", "47" :"basketball", "48" :"training", "49" :"creativedance", "50" :"creativedance", "51" :"creativedance", "52" :"dance", "53" :"dance", "54" :"english", "55" :"english", "56" :"soccer", "57" :"soccer", "58" :"soccer", "59" :"soccer", "60" :"soccer", "61" :"gymnastics", "62" :"gymnastics", "63" :"gymnastics", "64" :"gymnastics", "65" :"gymnastics", "66" :"gymnastics", "67" :"golf", "68" :"basketball", "69" :"tabletennis", "70" :"tabletennis", "71" :"tabletennis", "72" :"tabletennis", "73" :"tabletennis", "74" :"tabletennis", "75" :"tabletennis", "76" :"tabletennis", "77" :"tabletennis", "78" :"tabletennis", "79" :"tabletennis", "80" :"tabletennis", "81" :"tabletennis", "82" :"tabletennis", "83" :"tabletennis", "84" :"tabletennis", "85" :"tabletennis", "86" :"tabletennis", "87" :"tabletennis", "88" :"handball", "89" :"handball", "90" :"handball", "91" :"handball", "92" :"judo", "93" :"judo", "94" :"judo", "95" :"judo", "96" :"judo", "97" :"judo", "98" :"judo", "99" :"judo", "100" :"judo", "101" :"judo", "102" :"judo", "103" :"judo", "104" :"kendo", "105" :"kendo", "106" :"kendo", "107" :"kendo", "108" :"kendo", "109" :"kendo", "110" :"kendo", "111" :"kendo", "112" :"kendo", "113" :"kendo", "114" :"kendo", "115" :"kendo", "116" :"kendo", "117" :"kendo", "118" :"kendo", "119" :"lympamassage", "120" :"basketball", "121" :"basketball", "124" :"rugby", "125" :"rhythmicgymnastics", "126" :"rhythmicgymnastics", "127" :"recruit", "128" :"softball", "129" :"softball", "130" :"softball", "131" :"softball", "132" :"softball", "133" :"softball", "134" :"softball", "135" :"softball", "136" :"softball", "137" :"softtennis", "138" :"softtennis", "139" :"softtennis", "140" :"softtennis", "141" :"softtennis", "142" :"softtennis", "143" :"softtennis", "144" :"softtennis", "145" :"softtennis", "146" :"softtennis", "147" :"softtennis", "148" :"softtennis", "149" :"softtennis", "150" :"softtennis", "152" :"athletics", "153" :"athletics", "154" :"athletics", "155" :"athletics", "156" :"athletics", "157" :"taping", "158" :"training", "159" :"volleyball", "160" :"volleyball", "161" :"volleyball", "162" :"volleyball", "163" :"volleyball", "164" :"volleyball", "165" :"volleyball", "166" :"volleyball", "167" :"volleyball", "168" :"volleyball", "169" :"volleyball", "170" :"volleyball", "171" :"volleyball", "172" :"volleyball", "173" :"kyudo", "174" :"kyudo", "175" :"kyudo", "176" :"aerobics", "177" :"aerobics", "178" :"aerobics", "190" :"baseball", "191" :"baseball", "192" :"baseball", "193" :"baseball", "194" :"baseball", "195" :"baseball", "196" :"baseball", "197" :"baseball", "198" :"baseball", "199" :"baseball", "200" :"baseball", "201" :"baseball", "202" :"baseball", "203" :"baseball", "204" :"baseball", "205" :"baseball", "206" :"basketball", "207" :"baseball", "208" :"baseball", "209" :"baseball", "210" :"baseball", "211" :"baseball", "212" :"baseball", "263" :"basketball", "264" :"basketball", "265" :"basketball", "266" :"basketball", "267" :"basketball", "268" :"basketball", "269" :"basketball", "270" :"basketball", "271" :"basketball", "272" :"basketball", "273" :"basketball", "274" :"basketball", "275" :"basketball", "276" :"basketball", "277" :"basketball", "278" :"basketball", "279" :"basketball", "280" :"basketball", "281" :"basketball", "282" :"basketball", "283" :"basketball", "284" :"basketball", "285" :"basketball", "286" :"basketball", "287" :"basketball", "288" :"basketball", "289" :"basketball", "290" :"basketball", "291" :"basketball", "295" :"basketball", "296" :"basketball", "297" :"basketball", "298" :"basketball", "303" :"basketball", "304" :"basketball", "305" :"basketball", "306" :"basketball", "307" :"basketball", "308" :"basketball", "309" :"basketball", "310" :"basketball", "311" :"basketball", "312" :"basketball", "313" :"basketball", "314" :"basketball", "315" :"basketball", "316" :"basketball", "317" :"basketball", "318" :"basketball", "321" :"basketball", "322" :"basketball", "323" :"badminton", "324" :"badminton", "325" :"badminton", "326" :"badminton", "327" :"badminton", "328" :"badminton", "385" :"creativedance", "386" :"creativedance", "387" :"creativedance", "397" :"english", "398" :"english", "399" :"english", "400" :"english", "401" :"english", "402" :"english", "403" :"english", "404" :"english", "405" :"english", "429" :"gymnastics", "430" :"gymnastics", "431" :"gymnastics", "432" :"gymnastics", "437" :"gymnastics", "438" :"gymnastics", "439" :"gymnastics", "440" :"gymnastics", "441" :"gymnastics", "450" :"basketball", "451" :"basketball", "494" :"tabletennis", "505" :"tabletennis", "506" :"tabletennis", "507" :"tabletennis", "508" :"tabletennis", "586" :"judo", "598" :"judo", "599" :"judo", "600" :"judo", "601" :"judo", "612" :"kendo", "613" :"kendo", "614" :"kendo", "615" :"kendo", "616" :"kendo", "617" :"kendo", "618" :"kendo", "619" :"kendo", "620" :"kendo", "621" :"kendo", "652" :"kendo", "675" :"basketball", "676" :"basketball", "677" :"basketball", "683" :"rugby", "684" :"rugby", "685" :"rugby", "818" :"volleyball", "870" :"volleyball", "885" :"kyudo", "891" :"kendo", "896" :"takken", "897" :"takken", "898" :"takken", "899" :"takken", "900" :"takken", "901" :"takken", "902" :"shakaihokenroumushi", "903" :"shakaihokenroumushi", "904" :"shakaihokenroumushi", "905" :"shakaihokenroumushi", "906" :"shakaihokenroumushi", "907" :"shakaihokenroumushi", "908" :"shakaihokenroumushi", "909" :"gyouseisyoshi", "910" :"gyouseisyoshi", "911" :"gyouseisyoshi", "916" :"nisshouboki", "917" :"nisshouboki", "918" :"nisshouboki", "919" :"nisshouboki", "920" :"kokunairyokou", "921" :"kokunairyokou", "922" :"kokunairyokou", "923" :"kokunairyokou", "924" :"kokunairyokou", "925" :"kokunairyokou", "926" :"kokunairyokou", "927" :"kaigofukushishi", "928" :"kaigofukushishi", "929" :"kaigofukushishi", "930" :"kaigofukushishi", "931" :"manshonkanrishi", "932" :"manshonkanrishi", "933" :"manshonkanrishi", "934" :"manshonkanrishi", "935" :"manshonkanrishi", "936" :"manshonkanrishi", "937" :"manshonkanrishi", "938" :"manshonkanrishi", "939" :"fudousankanteishi", "940" :"fudousankanteishi", "941" :"fudousankanteishi", "942" :"fudousankanteishi", "943" :"gymnastics", "954" :"english", "955" :"english", "956" :"english", "957" :"english", "958" :"english", "959" :"english", "960" :"english", "961" :"english", "962" :"english", "963" :"english", "964" :"english", "965" :"volleyball", "966" :"kyudo", "967" :"volleyball", "968" :"volleyball", "969" :"volleyball", "970" :"kyudo", "971" :"kyudo", "972" :"kyudo", "974" :"soccer", "975" :"soccer", "976" :"soccer", "977" :"baseball", "978" :"baseball", "979" :"baseball", "980" :"baseball", "981" :"baseball", "982" :"baseball", "983" :"badminton", "984" :"badminton", "985" :"badminton", "986" :"softtennis", "987" :"softtennis", "988" :"softtennis", "989" :"softtennis", "990" :"softtennis", "991" :"kendo", "992" :"kendo", "993" :"kendo", "994" :"kendo", "995" :"soccer", "996" :"soccer", "997" :"soccer", "998" :"mentaltraining", "999" :"mentaltraining", "1000" :"mentaltraining", "1001" :"kendo", "1002" :"kendo", "1003" :"kendo", "1004" :"kendo", "1007" :"judo", "1008" :"judo", "1009" :"judo", "1010" :"judo", "1011" :"judo", "1012" :"judo", "1013" :"judo", "1014" :"judo", "1015" :"judo", "1016" :"basketball", "1017" :"basketball", "1018" :"basketball", "1019" :"basketball", "1020" :"kendo", "1021" :"kendo", "1022" :"kendo", "1023" :"kendo", "1024" :"kendo", "1025" :"basketball", "1026" :"basketball", "1027" :"basketball", "1028" :"basketball", "1029" :"basketball", "1030" :"judo", "1031" :"judo", "1032" :"judo", "1033" :"judo", "1034" :"tabletennis", "1035" :"tabletennis", "1036" :"tabletennis", "1037" :"tabletennis", "1038" :"tabletennis", "1039" :"soccer", "1040" :"soccer", "1041" :"soccer", "1042" :"soccer", "1043" :"basketball", "1044" :"basketball", "1045" :"basketball", "1046" :"basketball", "1047" :"kendo", "1048" :"kendo", "1049" :"kendo", "1050" :"kendo", "1051" :"badminton", "1052" :"badminton", "1053" :"badminton", "1054" :"badminton", "1055" :"badminton", "1056" :"futsal", "1057" :"futsal", "1058" :"futsal", "1059" :"judo", "1060" :"judo", "1061" :"judo", "1062" :"judo", "1063" :"judo", "1064" :"judo", "1065" :"judo", "1066" :"judo", "1067" :"judo", "1068" :"softtennis", "1069" :"softtennis", "1070" :"softtennis", "1071" :"softtennis", "1073" :"soccer", "1074" :"soccer", "1075" :"soccer", "1076" :"soccer", "1077" :"soccer", "1078" :"naginata", "1079" :"naginata", "1080" :"naginata", "1081" :"badminton", "1082" :"badminton", "1083" :"badminton", "1084" :"badminton", "1085" :"basketball", "1086" :"basketball", "1087" :"basketball", "1088" :"basketball", "1089" :"basketball", "1090" :"kendo", "1091" :"kendo", "1092" :"kendo", "1093" :"kendo", "1094" :"kendo", "1095" :"athletics", "1096" :"athletics", "1097" :"athletics", "1098" :"tennis", "1099" :"tennis", "1100" :"tennis", "1101" :"tennis", "1102" :"tennis", "1103" :"badminton", "1104" :"badminton", "1105" :"badminton", "1106" :"tennis", "1107" :"tennis", "1108" :"tennis", "1109" :"tennis", "1110" :"tennis", "1111" :"tennis", "1112" :"kyudo", "1113" :"kyudo", "1114" :"kyudo", "1115" :"kyudo", "1116" :"judo", "1117" :"judo", "1118" :"judo", "1119" :"kendo", "1120" :"kendo", "1121" :"kendo", "1122" :"kendo", "1123" :"kendo", "1124" :"softtennis", "1125" :"softtennis", "1126" :"softtennis", "1127" :"softtennis", "1128" :"judo", "1129" :"judo", "1130" :"judo", "1131" :"judo", "1132" :"badminton", "1133" :"badminton", "1134" :"badminton", "1135" :"softtennis", "1136" :"softtennis", "1137" :"softtennis", "1138" :"kendo", "1139" :"kendo", "1140" :"kendo", "1141" :"kendo", "1142" :"kendo", "1143" :"rhythmicgymnastics", "1144" :"rhythmicgymnastics", "1145" :"rhythmicgymnastics", "1146" :"rhythmicgymnastics", "1147" :"rhythmicgymnastics", "1148" :"rhythmicgymnastics", "1149" :"volleyball", "1150" :"volleyball", "1151" :"volleyball", "1152" :"volleyball", "1153" :"handball", "1154" :"handball", "1155" :"handball", "1156" :"handball", "1157" :"handball", "1158" :"handball", "1159" :"soccer", "1160" :"soccer", "1161" :"soccer", "1162" :"soccer", "1163" :"basketball", "1164" :"basketball", "1165" :"basketball", "1166" :"basketball", "1167" :"softball", "1168" :"softball", "1169" :"softball", "1170" :"softball", "1171" :"wrestling", "1172" :"wrestling", "1173" :"wrestling", "1174" :"wrestling", "1175" :"volleyball", "1176" :"volleyball", "1177" :"volleyball", "1178" :"volleyball", "1179" :"volleyball", "1180" :"athletics", "1181" :"athletics", "1182" :"athletics", "1183" :"softball", "1184" :"softball", "1185" :"softball", "1186" :"softball", "1187" :"softtennis", "1188" :"softtennis", "1189" :"softtennis", "1190" :"softtennis", "1191" :"tabletennis", "1192" :"tabletennis", "1193" :"tabletennis", "1194" :"tabletennis", "1195" :"tabletennis", "1196" :"softtennis", "1197" :"softtennis", "1198" :"softtennis", "1199" :"softtennis", "1201" :"basketball", "1202" :"basketball", "1203" :"basketball", "1204" :"basketball", "1205" :"basketball", "1206" :"basketball", "1207" :"judo", "1208" :"judo", "1209" :"judo", "1210" :"kyudo", "1211" :"kyudo", "1212" :"kyudo", "1213" :"soccer", "1214" :"soccer", "1215" :"soccer", "1216" :"soccer", "1217" :"soccer", "1218" :"basketball", "1219" :"basketball", "1220" :"volleyball", "1221" :"volleyball", "1222" :"volleyball", "1223" :"volleyball", "1224" :"volleyball", "1225" :"tabletennis", "1226" :"tabletennis", "1227" :"tabletennis", "1228" :"tabletennis", "1229" :"rhythmicgymnastics", "1230" :"rhythmicgymnastics", "1231" :"rhythmicgymnastics", "1232" :"rhythmicgymnastics", "1233" :"judo", "1234" :"judo", "1235" :"judo", "1236" :"judo", "1237" :"basketball", "1238" :"basketball", "1239" :"basketball", "1240" :"softball", "1241" :"softball", "1242" :"softball", "1243" :"softball", "1244" :"tennis", "1245" :"tennis", "1246" :"tennis", "1247" :"tennis", "1248" :"tennis", "1249" :"basketball", "1250" :"basketball", "1251" :"basketball", "1252" :"basketball", "1253" :"basketball", "1254" :"athletics", "1255" :"athletics", "1256" :"athletics", "1257" :"volleyball", "1258" :"volleyball", "1259" :"volleyball", "1260" :"judo", "1261" :"judo", "1262" :"judo", "1263" :"kendo", "1264" :"kendo", "1265" :"kendo", "1266" :"soccer", "1267" :"soccer", "1268" :"soccer", "1269" :"soccer", "1270" :"mentaltraining", "1271" :"mentaltraining", "1272" :"mentaltraining", "1273" :"mentaltraining", "1274" :"mentaltraining", "1275" :"basketball", "1276" :"basketball", "1277" :"basketball", "1278" :"basketball", "1279" :"basketball", "1280" :"basketball", "1281" :"soccer", "1282" :"soccer", "1283" :"soccer", "1284" :"soccer", "1285" :"basketball", "1286" :"basketball", "1287" :"basketball", "1288" :"basketball", "1289" :"basketball", "1290" :"judo", "1291" :"judo", "1292" :"judo", "1293" :"soccer", "1294" :"soccer", "1295" :"soccer", "1296" :"soccer", "1297" :"volleyball", "1298" :"volleyball", "1299" :"volleyball", "1300" :"volleyball", "1301" :"kendo", "1302" :"kendo", "1303" :"kendo", "1304" :"kendo", "1305" :"kendo", "1306" :"kendo", "1307" :"baseball", "1308" :"baseball", "1309" :"baseball", "1310" :"soccer", "1311" :"soccer", "1312" :"soccer", "1313" :"soccer", "1314" :"basketball", "1315" :"basketball", "1316" :"basketball", "1317" :"basketball", "1318" :"softball", "1319" :"softball", "1320" :"softball", "1321" :"softball", "1322" :"badminton", "1323" :"badminton", "1324" :"badminton", "1325" :"soccer", "1326" :"soccer", "1327" :"soccer", "1328" :"roadbikes", "1329" :"roadbikes", "1330" :"roadbikes", "1331" :"roadbikes", "1332" :"training", "1333" :"training", "1334" :"training", "1335" :"training", "1336" :"judo", "1337" :"judo", "1338" :"judo", "1339" :"judo", "1340" :"judo", "1341" :"taiiku", "1342" :"taiiku", "1343" :"taiiku", "1344" :"taiiku", "1345" :"basketball", "1346" :"basketball", "1347" :"basketball", "1348" :"basketball", "1349" :"basketball", "1350" :"basketball", "1351" :"basketball", "1352" :"basketball", "1353" :"basketball", "1354" :"judo", "1355" :"creativedance", "1356" :"creativedance", "1357" :"creativedance", "1358" :"creativedance", "1359" :"softtennis", "1360" :"softtennis", "1361" :"softtennis", "1362" :"tennis", "1363" :"tennis", "1364" :"tennis", "1365" :"tennis", "1366" :"tennis", "1367" :"tennis", "1368" :"tabletennis", "1369" :"tabletennis", "1370" :"tabletennis", "1371" :"tabletennis", "1372" :"tabletennis", "1373" :"taiiku", "1374" :"taiiku", "1375" :"taiiku", "1376" :"taiiku", "1377" :"taiiku", "1378" :"tabletennis", "1379" :"taping", "1380" :"taping", "1381" :"taping", "1382" :"taping", "1383" :"taping", "1384" :"basketball", "1385" :"basketball", "1386" :"basketball", "1387" :"basketball", "1388" :"mentaltraining", "1389" :"mentaltraining", "1390" :"mentaltraining", "1391" :"mentaltraining", "1392" :"softtennis", "1393" :"softtennis", "1394" :"softtennis" } }; /* リンクURL書き換え */ $('a').each(function() { var ret = $(this).attr('href'); if(ret){ var res_data = null; var cat_res = ret.match(/\/products\/list\.php\?(.*)category_id=(\d{1,})(.*)/); // カテゴリ別商品ページ var detail_res = ret.match(/\/products\/detail\.php\?(.*)product_id=(\d{1,})(.*)/); // 商品詳細ページ // 初期化 var rep_url = null; var rep_param = ''; if(cat_res){ // カテゴリ別商品ページ用URL変換処理 res_data = cat_res; if((typeof res_data[2] != "undefined") && res_data[2] && (typeof pattern['category_list'][res_data[2]] != "undefined") && pattern['category_list'][res_data[2]]){ rep_url = window.location.protocol + '//' + window.location.host + '/' + pattern['category_list'][res_data[2]] + '.php'; } } else if(detail_res){ // 商品詳細ページ用URL変換処理 res_data = detail_res; if((typeof res_data[2] != "undefined") && res_data[2] && (typeof pattern['products_category_list'][res_data[2]] != "undefined") && pattern['products_category_list'][res_data[2]]){ rep_url = window.location.protocol + '//' + window.location.host + '/' + pattern['products_category_list'][res_data[2]] + '_' + res_data[2] + '.php'; } } if(res_data && rep_url){ if((typeof res_data[1] != "undefined") && res_data[1]){ rep_param = '?' + res_data[1].slice(0, -1); } if((typeof res_data[3] != "undefined") && res_data[3]){ if(rep_param){ rep_param = rep_param + res_data[3]; }else{ rep_param = '?' + res_data[3]; } } if(rep_param){ rep_param = rep_param.replace('??','?'); rep_param = rep_param.replace('?&','?'); rep_param = rep_param.replace('&&','&'); } $(this).attr('href', rep_url + rep_param); } } }); });