Last active
September 11, 2017 02:04
-
-
Save wmh/e09decf6bc2d2ef06e88a64382c58277 to your computer and use it in GitHub Desktop.
Get MCC List by jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/musalbas/mcc-mnc-table/blob/master/mcc-mnc-table.csv | |
var mccs={}; | |
document.querySelectorAll('table.js-csv-data > tbody > tr > td:nth-child(2)').forEach(function (ele) { | |
mccs[ele.innerText] = 1; | |
}); | |
Object.keys(mccs).join(','); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://en.wikipedia.org/wiki/Mobile_country_code | |
var mcc = {} | |
$('table.wikitable').each(function (idx, t) { | |
var $t = $(t), | |
$th = $t.find('th:nth-child(1)'); | |
if ($th.length === 0) { | |
return; | |
} | |
if ($th[0].innerText != 'MCC') { | |
return; | |
} | |
var $td = $t.find('tr td:nth-child(1)'); | |
if ($td.length === 0) { | |
return; | |
} | |
var tdLen = $td.length; | |
for (var i = 0; i < tdLen; ++i) { | |
var m = $.trim($td[i].innerText); | |
if (m === '') { | |
continue; | |
} | |
mcc[m] = 1; | |
} | |
}); | |
console.log("'" + Object.keys(mcc).join("','") + "'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment