Skip to content

Commit

Permalink
講座検索した後でも講座情報が表示されるように
Browse files Browse the repository at this point in the history
  • Loading branch information
tomo0611 committed Mar 8, 2021
1 parent 35bf322 commit a952392
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function listener(details) {
} else if (details.url == "https://pos.toshin.com/JKMR/Student2/StdKobetsuJukoYoyaku/KosuSelect") {
var kozaid = str.match(/<label id=\"LblKozaCode\">.+?<\/label>/g)[0];
kozaid = kozaid.substring(24, kozaid.length - 8);
str = str.replace("</head>", "<script>$.ajax({url: 'https://pos.toshin.com/KKS/KKS1/Page/Design/KozaInfo.aspx?KozaCode=" + kozaid + "&Refresh=1',type: 'GET',statusCode: {302: function (data) {console.log(data);const result = data.responseText.match(/<td nowrap=\\\"nowrap\\\" align=\\\"Center\\\" valign=\\\"Middle\\\">.+?<\\\/td><td>.+?<\\\/td>/g);var kozaList = {};for(var i=0; i < result.length; i++){var kozainfo = result[i].substring(51,result[i].length-5).split(\"</td><td>\");var kozaNum = kozainfo[0];var kozaName = kozainfo[1];kozaList[kozaNum.replace(/ /g,'')] = kozaName;}var title2List = document.getElementsByClassName(\"tit_02\");for(var i=0; i < title2List.length; i++){if(kozaList[title2List[i].innerText.replace(/ /g,'')]){title2List[i].innerText = title2List[i].innerText.replace(/[A-Za-z0-9!"#$%&'()*+,-./:;<=>?@[\]^_`{|}]/g, function (s) {return String.fromCharCode(s.charCodeAt(0) - 0xfee0);}).replace(/[‐-―]/g, \"-\").replace(/[~〜]/g, \"~\").replace(/ /g, \" \") + \" - \" + kozaList[title2List[i].innerText.replace(/ /g,'')].replace(/[A-Za-z0-9!"#$%&'()*+,-./:;<=>?@[\]^_`{|}]/g, function (s) {return String.fromCharCode(s.charCodeAt(0) - 0xfee0);}).replace(/[‐-―]/g, \"-\").replace(/[~〜]/g, \"~\").replace(/ /g, \" \");}}}}});</script></head>");
str = str.replace("</head>", "<script>$.ajax({url: 'https://pos.toshin.com/KKS/KKS1/Page/Design/KozaInfo.aspx?KozaCode=" + kozaid + "&Refresh=1',type: 'GET',statusCode: {200: function (data) {console.log(data);const result = data.match(/<td nowrap=\\\"nowrap\\\" align=\\\"Center\\\" valign=\\\"Middle\\\">.+?<\\\/td><td>.+?<\\\/td>/g);var kozaList = {};for(var i=0; i < result.length; i++){var kozainfo = result[i].substring(51,result[i].length-5).split(\"</td><td>\");var kozaNum = kozainfo[0];var kozaName = kozainfo[1];kozaList[kozaNum.replace(/ /g,'')] = kozaName;}var title2List = document.getElementsByClassName(\"tit_02\");for(var i=0; i < title2List.length; i++){if(kozaList[title2List[i].innerText.replace(/ /g,'')]){title2List[i].innerText = title2List[i].innerText.replace(/[A-Za-z0-9!"#$%&'()*+,-./:;<=>?@[\]^_`{|}]/g, function (s) {return String.fromCharCode(s.charCodeAt(0) - 0xfee0);}).replace(/[‐-―]/g, \"-\").replace(/[~〜]/g, \"~\").replace(/ /g, \" \") + \" - \" + kozaList[title2List[i].innerText.replace(/ /g,'')].replace(/[A-Za-z0-9!"#$%&'()*+,-./:;<=>?@[\]^_`{|}]/g, function (s) {return String.fromCharCode(s.charCodeAt(0) - 0xfee0);}).replace(/[‐-―]/g, \"-\").replace(/[~〜]/g, \"~\").replace(/ /g, \" \");}}},302: function (data) {console.log(data);const result = data.responseText.match(/<td nowrap=\\\"nowrap\\\" align=\\\"Center\\\" valign=\\\"Middle\\\">.+?<\\\/td><td>.+?<\\\/td>/g);var kozaList = {};for(var i=0; i < result.length; i++){var kozainfo = result[i].substring(51,result[i].length-5).split(\"</td><td>\");var kozaNum = kozainfo[0];var kozaName = kozainfo[1];kozaList[kozaNum.replace(/ /g,'')] = kozaName;}var title2List = document.getElementsByClassName(\"tit_02\");for(var i=0; i < title2List.length; i++){if(kozaList[title2List[i].innerText.replace(/ /g,'')]){title2List[i].innerText = title2List[i].innerText.replace(/[A-Za-z0-9!"#$%&'()*+,-./:;<=>?@[\]^_`{|}]/g, function (s) {return String.fromCharCode(s.charCodeAt(0) - 0xfee0);}).replace(/[‐-―]/g, \"-\").replace(/[~〜]/g, \"~\").replace(/ /g, \" \") + \" - \" + kozaList[title2List[i].innerText.replace(/ /g,'')].replace(/[A-Za-z0-9!"#$%&'()*+,-./:;<=>?@[\]^_`{|}]/g, function (s) {return String.fromCharCode(s.charCodeAt(0) - 0xfee0);}).replace(/[‐-―]/g, \"-\").replace(/[~〜]/g, \"~\").replace(/ /g, \" \");}}}}});</script></head>");
} else if (details.url.includes("https://pos.toshin.com/KKS/KKS1/Page/Design/KozaInfo.aspx?KozaCode=")) {
str = str.replace("charset=shift_jis", "charset=utf8");
} else if (details.url.includes("https://pos.toshin.com/SDBJ/dashboard/")) {
Expand Down
19 changes: 18 additions & 1 deletion embed_player/kozainfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@ $.ajax({
url: 'https://pos.toshin.com/KKS/KKS1/Page/Design/KozaInfo.aspx?KozaCode=4785&Refresh=1',
type: 'GET',
statusCode: {
302: function (data) {
200: function (data) {
console.log(data);
const result = data.responseText.match(/<td nowrap="nowrap" align="Center" valign="Middle">.+?<\/td><td>.+?<\/td>/g);
var kozaList = {};
for (var i = 0; i < result.length; i++) {
var kozainfo = result[i].substring(51, result[i].length - 5).split("</td><td>");
var kozaNum = kozainfo[0].replace(/ /g, '');
var kozaName = kozainfo[1];
kozaList[kozaNum] = kozaName;
}
var title2List = document.getElementsByClassName("tit_02");
for (var i = 0; i < title2List.length; i++) {
if (kozaList[title2List.innerText[i].replace(/ /g, '')]) {
title2List[i].innerText = title2List[i].innerText.replace(/[---_]/g, function (s) { return String.fromCharCode(s.charCodeAt(0) - 0xfee0); }).replace(/[]/g, "-").replace(/[]/g, "~").replace(/ /g, " ") + " - " + kozaList[title2List[i].innerText.replace(/ /g, '')].replace(/[---_]/g, function (s) { return String.fromCharCode(s.charCodeAt(0) - 0xfee0); }).replace(/[]/g, "-").replace(/[]/g, "~").replace(/ /g, " ");
}
}
},
302: function (data) {
console.log(data);
const result = data.responseText.match(/<td nowrap="nowrap" align="Center" valign="Middle">.+?<\/td><td>.+?<\/td>/g);
var kozaList = {};
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"manifest_version": 2,
"name": "ToshinFox",
"version": "12.4b",
"version": "12.5b",
"description": "Help your study with Firefox, saying goodbye Internet Explorer",
"icons": {
"48": "icons/ic_main.png"
Expand Down

0 comments on commit a952392

Please sign in to comment.