lotus gate
https://lh3.googleusercontent.com/a-/AAuE7mAblbqSm2KgzG4n0cI0QKJ9zhXGATA5l25POjXL0Q#.png
this is lotus_gate’s page
code:script.js
'use strict'
setTimeout(function updateContent() {
const promises = []
let hasError = false
// try { promises.push(insertSoundCloud()) } catch (error) { console.error(error); hasError = true }
// try { promises.push(insertNicovideo()) } catch (error) { console.error(error); hasError = true }
Promise.all(promises)
.then(() => { setTimeout(updateContent, hasError ? 3000 : 30) })
.catch((error) => {
console.error(error)
setTimeout(updateContent, 3000)
})
}, 0)
YouTubehttps://www.youtube.com/watch?v=RklhFPvoaQo
Vimeohttps://vimeo.com/90236896
code:script.js
function insertSoundCloud() {
const promises = []
for (const a of document.querySelectorAll('a.link')) {
if (!/^https:\/\/soundcloud.com\/^\/+\/^\/+$/.test(a.href)) { continue } const previous = a.previousElementSibling
if (previous && previous.dataset.soundCloudHref === a.href) { continue }
const promise = fetch(
{
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({format: 'json', url: a.href})
}
).then((response) => {
return response.json()
}).then((responseBody) => {
const div = document.createElement('div')
div.dataset.soundCloudHref = a.href
div.innerHTML = responseBody.html
return new Promise((resolve, reject) => {
requestAnimationFrame(() => {
try {
const previous = a.previousElementSibling
if (previous && previous.dataset.soundCloudHref) {
a.parentNode.replaceChild(div, previous)
} else {
a.parentNode.insertBefore(div, a)
}
resolve()
} catch (error) { reject(error) }
})
})
})
promises.push(promise)
}
return Promise.all(promises)
}
code:html
code:script.js
function insertNicovideo() {
const promises = []
for (const a of document.querySelectorAll('a.link')) {
const match = /^https:\/\/www.nicovideo.jp\/watch\/(a-z0-9+)$/.exec(a.href) if (!match) { continue }
const src = https://ext.nicovideo.jp/thumb/${match[1]}
const previous = a.previousElementSibling
if (previous && previous.nodeName === 'IFRAME' && previous.src === src) { continue }
const iframe = document.createElement('iframe')
iframe.setAttribute('width', '312')
iframe.setAttribute('height', '176')
iframe.setAttribute('src', src)
iframe.setAttribute('scrolling', 'no')
iframe.setAttribute('style', 'border:solid 1px #ccc;') iframe.setAttribute('frameborder', '0')
const promise = new Promise((resolve, reject) => {
requestAnimationFrame(() => {
try {
const previous = a.previousElementSibling
if (previous && previous.nodeName === 'IFRAME') {
a.parentNode.replaceChild(iframe, previous)
} else {
a.parentNode.insertBefore(iframe, a)
}
resolve()
} catch (error) { reject(error) }
})
})
promises.push(promise)
}
return Promise.all(promises)
}
// Refused to load the script 'https://embed.nicovideo.jp/watch/sm13395043/script?w=640&h=360' because it violates the following Content Security Policy directive: "script-src 'self' cdnjs.cloudflare.com www.google-analytics.com maps.googleapis.com 'unsafe-eval' js.stripe.com". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback. // Refused to frame 'https://ext.nicovideo.jp/' because it violates the following Content Security Policy directive: "frame-src 'self' www.google.com www.youtube.com player.vimeo.com js.stripe.com". code:html