https://github.com/moeeinaali/tmp-github-page
https://github.com/moeeinaali/tmp-github-page
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/moeeinaali/tmp-github-page
- Owner: MoeeinAali
- Created: 2024-12-04T09:54:57.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-04T12:13:43.000Z (about 1 year ago)
- Last Synced: 2025-02-01T00:29:19.290Z (11 months ago)
- Language: HTML
- Size: 211 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)
```