forked from 0x2620/pandora
make mobile code usable for embedding
This commit is contained in:
parent
cf6374e8a6
commit
84c2a3ac3c
2 changed files with 13 additions and 11 deletions
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
|
|
||||||
function parseURL() {
|
function parseURL() {
|
||||||
var fragment = document.location.hash.slice(1)
|
var url = pandora.url ? pandora.url : document.location,
|
||||||
if (!fragment && document.location.pathname.startsWith('/m/')) {
|
fragment = url.hash.slice(1)
|
||||||
var prefix = document.location.protocol + '//' + document.location.hostname + '/m/'
|
if (!fragment && url.pathname.startsWith('/m/')) {
|
||||||
fragment = document.location.href.slice(prefix.length)
|
var prefix = url.protocol + '//' + url.hostname + '/m/'
|
||||||
|
fragment = url.href.slice(prefix.length)
|
||||||
}
|
}
|
||||||
var args = fragment.split('?')
|
var args = fragment.split('?')
|
||||||
var id = args.shift()
|
var id = args.shift()
|
||||||
|
|
|
@ -31,17 +31,18 @@ function renderItem(data) {
|
||||||
<div class="video"></div>
|
<div class="video"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="value">${data.value}</div>
|
<div class="value">${data.value}</div>
|
||||||
|
<div class="comments"></div>
|
||||||
<div class="more">
|
<div class="more">
|
||||||
<a href="${data.link}">Open on ${data.site}</a>
|
<a href="${data.link}">Open on ${data.site}</a>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
var comments = `
|
|
||||||
<div class="comments" style="width: 100%;text-align: center;">
|
var comments = div.querySelector('.comments')
|
||||||
<textarea style="width:90%;height:45px" placeholder="Respond in style..."></textarea>
|
if (window.renderComments) {
|
||||||
<button style="width:90%">Submit</button>
|
renderComments(comments, data)
|
||||||
<br>
|
} else {
|
||||||
</div>
|
comments.remove()
|
||||||
`
|
}
|
||||||
|
|
||||||
div.querySelectorAll('.layer a').forEach(a => {
|
div.querySelectorAll('.layer a').forEach(a => {
|
||||||
a.addEventListener("click", clickLink)
|
a.addEventListener("click", clickLink)
|
||||||
|
|
Loading…
Reference in a new issue