fix: `replaceDisquscdn` (#47)

dependabot/npm_and_yarn/lodash-4.17.19
Kid 5 years ago committed by GitHub
parent fd7bdec054
commit 112f5d0f31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -28,7 +28,7 @@
function DisqusJS(config) {
((window, document, localStorage, fetch, Promise) => {
// 封装一下基于 Object.asign 的方法
// 封装一下基于 Object.assign 的方法
function _extends(...args) {
_extends = Object.assign || function (target) {
for (const source of arguments) {
@ -536,7 +536,7 @@ function DisqusJS(config) {
el.innerHTML = msg;
const aTag = el.getElementsByTagName('a');
for (const i of aTag) {
const link = decodeURIComponent(i.href.replace(/https:\/\/disq.us\/url\?url=/g, '')).replace(/(.*):.+cuid=.*/, '$1');
const link = decodeURIComponent(i.href.replace(/https:\/\/disq\.us\/url\?url=/g, '')).replace(/(.*):.+cuid=.*/, '$1');
i.href = link;
i.innerHTML = link;
@ -552,7 +552,7 @@ function DisqusJS(config) {
* @param {string} str - 字符串
* @return {string} - 替换后的字符串
*/
const replaceDisquscdn = (str) => str.replace('/a.disquscdn.com/ig', 'c.disquscdn.com');
const replaceDisquscdn = (str) => str.replace(/a\.disquscdn\.com/g, 'c.disquscdn.com');
const renderPostItem = (s) => {
let authorEl = '';

Loading…
Cancel
Save