Skip to content

Commit

Permalink
fix(embed): codepen
Browse files Browse the repository at this point in the history
  • Loading branch information
mekery committed Apr 30, 2020
1 parent 0a51e16 commit ce7261d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/data/article.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions src/data/embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ export const EmbedServiceLink = {
tips: 'Google Map > select location > Share > Embed a map > COPY HTML'
},
modao: {
link: 'https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2',
src: 'https://free.modao.cc/app/2cd26580a6717a147454df7470e7ec464093cba3/embed/v2',
link: 'https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2',
src: 'https://free.modao.cc/app/6UkpAxcGE3nPz52GLqhnOZgC7MATBSy/embed/v2',
srcPrefix: '',
linkRule: [
'https:\\/\\/\\w+.modao.cc\\/app\\/\\w+\\/embed\\/v2'
Expand Down Expand Up @@ -168,6 +168,14 @@ export const EmbedServiceLink = {
'https:\\/\\/www.processon.com\\/embed\\/\\w+'
]
},
codepen: {
link: 'https://codepen.io/mekery/embed/YzyrKOJ',
src: 'https://codepen.io/mekery/embed/YzyrKOJ',
srcPrefix: '',
linkRule: [
'https:\\/\\/codepen.io\\/.+\\/embed\\/\\w+'
]
},
jinshuju: {
link: 'https://jinshuju.net/f/q9YvVf',
src: 'https://jinshuju.net/f/q9YvVf',
Expand Down Expand Up @@ -323,6 +331,14 @@ function getProcessonSrc (originalLink, result) {
return result
}

function getCodepenSrc (originalLink, result) {
result.src = `${result.matchedUrl}`
result.validId = true
result.originalLink = result.src

return result
}

function getJinshujuSrc (originalLink, result) {
result.src = `${result.matchedUrl}?background=white&banner=show&embedded=true`
result.validId = true
Expand Down Expand Up @@ -406,6 +422,8 @@ export const getServiceSrc = (service, originalLink) => {
return getCanvaSrc(originalLink, result)
case 'processon':
return getProcessonSrc(originalLink, result)
case 'codepen':
return getCodepenSrc(originalLink, result)
case 'jinshuju':
return getJinshujuSrc(originalLink, result)
case 'google_forms':
Expand Down

0 comments on commit ce7261d

Please sign in to comment.