2021-03-31 05:47:34 +08:00
|
|
|
/* eslint-disable no-unused-vars */
|
2021-03-31 05:43:06 +08:00
|
|
|
function pageNumbers() {
|
|
|
|
var vars = {};
|
|
|
|
var paramsKey = ['frompage', 'topage', 'page', 'webpage', 'section', 'subsection', 'subsubsection'];
|
|
|
|
var params = document.location.search.substring(1).split('&');
|
|
|
|
|
2021-05-03 21:27:17 +08:00
|
|
|
var pageOffset = document.getElementsByClassName('pagination')[0].dataset.pageOffset;
|
|
|
|
|
2021-03-31 05:43:06 +08:00
|
|
|
params.forEach(function(p) {
|
|
|
|
var param = p.split('=', 2);
|
|
|
|
vars[param[0]] = decodeURIComponent(param[1]);
|
|
|
|
});
|
|
|
|
paramsKey.forEach(function(key) {
|
|
|
|
var elements = document.getElementsByClassName(key);
|
2021-03-31 05:47:34 +08:00
|
|
|
var i;
|
|
|
|
for (i = 0; i < elements.length; i += 1) {
|
2021-05-03 21:27:17 +08:00
|
|
|
if (key === 'page' || key === 'topage') {
|
|
|
|
elements[i].textContent = parseInt(vars[key], 10) + parseInt(pageOffset, 10);
|
|
|
|
} else {
|
|
|
|
elements[i].textContent = vars[key];
|
|
|
|
}
|
2021-03-31 05:43:06 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2023-05-18 20:20:20 +08:00
|
|
|
|
2023-06-21 16:42:27 +08:00
|
|
|
pageNumbers();
|