An open API service indexing awesome lists of open source software.

https://github.com/moeeinaali/tmp-github-page


https://github.com/moeeinaali/tmp-github-page

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

url:
```
https://moeeinaali.github.io/tmp-github-page/iranjib/?ad=&click_url=
```

use this code for all demo templates:
```html


const myIframe = document.querySelector('#myIframe')

function getQueryParam(name) {
const urlParams = new URLSearchParams(window.location.search)
return urlParams.get(name)
}

let newUrl = getQueryParam('ad')
const click_url = getQueryParam('click_url') || 'https://google.com'

if (click_url) {
newUrl += `?click_url=${click_url}`
}

if (newUrl) {
myIframe.src = newUrl
}


function handleScroll(e) {
const scrolled =
((document.documentElement.scrollTop || document.body.scrollTop) /
((document.documentElement.scrollHeight ||
document.body.scrollHeight) -
document.documentElement.clientHeight)) *
100
const scrolledInPx =
document.documentElement.scrollTop || document.body.scrollTop
const heightOfPage = parent.document.body.scrollHeight
const myIframe = document.querySelector('#myIframe')
myIframe.contentWindow.postMessage(
{
type: 'yn-window-scroll',
scrolled,
scrolledInPx,
heightOfPage
},
'*'
)
}

window.addEventListener('scroll', handleScroll)

```