mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-18 18:33:42 +00:00
Replace deprecated String.prototype.substr()
This commit is contained in:
parent
e16688573b
commit
b762f8723a
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
function capitalize(input) {
|
||||
return input.toString().charAt(0).toUpperCase() + input.toString().substr(1);
|
||||
return input.toString().charAt(0).toUpperCase() + input.toString().substring(1);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -64,7 +64,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (content && content.value) {
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = content.value;
|
||||
result += `<a href="${data.permalink}"><p class="search-result">${div.textContent.substr(0, 100)}...</p></a>`;
|
||||
result += `<a href="${data.permalink}"><p class="search-result">${div.textContent.substring(0, 100)}...</p></a>`;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user