Create index.html

This commit is contained in:
Stripes
2022-10-27 10:34:17 +03:00
committed by GitHub
parent b3c23e9cf0
commit 880a564be8
+129
View File
@@ -0,0 +1,129 @@
<html>
<head>
<meta name="description" content="{home-description}">
<meta name="keywords" content="{home-keywords}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="{home-meta-title}">
<meta property="og:description" content="{home-description}">
<meta name="application-name" content="{home-meta-title}">
<meta property="og:image" content="https://{home-netlify-domain}/{home-favicon}">
<link rel="icon" type="image/png" href="https://{home-netlify-domain}/{home-favicon}">
<title>{home-meta-title}</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap" rel="stylesheet">
<script type="module" src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="ionicons.5.5.2.js"></script>
<link rel="stylesheet" href="styles.css">
<script src="isotope.3.0.6.pkgd.min.js"></script>
<script src="jquery-3.6.1.min.js"></script>
<script src="isMobile.js"></script>
</head>
<body>
<div class="header-note"><b>Not all community addons are available in Stremio's internal addon catalog.</b><div class="header-note-space"></div>To load the community curated addons list in Stremio on your current device (presumes you have Stremio installed), simply press <a href="stremio://{home-netlify-domain}/catalog.json">this link</a>!</div>
<h1>{home-page-title}</h1>
<div id="searchBox" class="mobile-form">
<form action="" class="search-form" id="searchform" method="get">
<span id="noEasy">
<input class="sb-search-submit" type="submit" value="">
<ion-icon name="search"></ion-icon>
</span>
<input id="sbox" name="q" autocomplete="off" onblur="if (this.placeholder == '') {this.placeholder = 'Search addons';}" onfocus="this.value = ''; if (this.placeholder == 'Search addons') {this.placeholder = '';}" placeholder="Search addons" type="text" x-webkit-speech="">
</form>
</div>
<div class="labels-list">{labels-list}</div>
<div class="addon-list">{addons-list}</div>
<div class="end-page-space"></div>
<a class="addon-button footer-button" href="https://github.com/{repo-name}/blob/main/README.md#how-can-i-help" target="_blank">How Can I Help?</a><a class="addon-button footer-button" href="https://github.com/{repo-name}/blob/main/README.md#how-it-works" target="_blank">How It Works</a><a class="addon-button footer-button" href="https://github.com/{repo-name}/issues/new?assignees=&labels=misc&template=submit-addon.yaml&title=Addon+Name" target="_blank">Publish Addon</a><a class="addon-button footer-button" href="https://github.com/{repo-name}/" target="_blank">Source Code</a><a class="addon-button footer-button" href="https://reddit.com/r/StremioAddons" target="_blank">Reddit</a><a class="addon-button footer-button" href="https://discord.gg/zNRf6YF" target="_blank">Discord</a><a class="addon-button footer-button" href="https://stremio.com/downloads" target="_blank">Download Stremio</a>
<div class="end-page-space"></div>
<div class="footer-note">Built with ❤️, the Stremio Addons website is curated by the community!</div>
<script>
let isotopeLoaded = false
function loadIsotope() {
isotopeLoaded = true
window.iso = new Isotope('.addon-list', {
itemSelector: '.addon-list-item',
getSortData: {
bumps: itemElem => parseInt($(itemElem).find('.score-value').text()),
alpha: '.addon-title',
},
layoutMode: 'vertical',
fitWidth: true
})
$('form#searchform').submit(function() {
const query = $("input#sbox").val().toLowerCase()
$("input#sbox").blur()
window.history.replaceState('', '', window.location.href.replace(window.location.search || '', '') + '?q=' + encodeURIComponent(query))
window.iso.arrange({
filter: function(itemElem) {
return $(itemElem).find('.addon-details .addon-title a').text().toLowerCase().includes(query)
|| $(itemElem).find('.addon-details .addon-description').text().toLowerCase().includes(query)
|| ($(itemElem).find('.addon-types .label-small').map((ij, el) => $(el).text()).toArray() || []).join(',').toLowerCase().includes(query)
}
})
return false;
})
setTimeout(() => {
const urlSearchParams = new URLSearchParams(window.location.search)
const params = Object.fromEntries(urlSearchParams.entries())
if (params.label) {
$('.labels-list .label.selected').removeClass('selected')
const pressedLabel = params.label.split('-').join(' ')
$('.labels-list .label').each(function() {
if ($(this).text() === pressedLabel)
$(this).addClass('selected')
})
const label = pressedLabel.split(' ').join('-')
window.iso.arrange({ filter: '.'+label })
} else if (params.q) {
$("input#sbox").val(params.q)
const query = params.q.toLowerCase()
$("input#sbox").blur()
window.iso.arrange({
filter: function(itemElem) {
return $(itemElem).find('.addon-details .addon-title a').text().toLowerCase().includes(query)
|| $(itemElem).find('.addon-details .addon-description').text().toLowerCase().includes(query)
|| ($(itemElem).find('.addon-types .label-small').map((ij, el) => $(el).text()).toArray() || []).join(',').toLowerCase().includes(query)
}
})
} else
window.iso.arrange({ sortBy: 'bumps', sortAscending: false })
}, 250)
}
$(document).ready(function() {
$('.labels-list .label').click(function() {
if ($("input#sbox").val()) $("input#sbox").val('')
$('.labels-list .label.selected').removeClass('selected')
$(this).addClass('selected')
const label = $(this).text().split(' ').join('-')
window.history.replaceState('', '', window.location.href.replace(window.location.search || '', '') + (label === 'show-all' ? '' : '?label=' + label))
window.iso.arrange({ filter: label === 'show-all' ? '*' : '.'+label })
})
$('.addon-types .label').click(function() {
if ($("input#sbox").val()) $("input#sbox").val('')
window.scrollTo(0, 0)
$('.labels-list .label.selected').removeClass('selected')
const pressedLabel = $(this).text()
$('.labels-list .label').each(function() {
if ($(this).text() === pressedLabel)
$(this).addClass('selected')
})
const label = $(this).text().split(' ').join('-')
window.history.replaceState('', '', window.location.href.replace(window.location.search || '', '') + '?label=' + label )
window.iso.arrange({ filter: '.'+label })
})
loadIsotope()
})
function copyLink(event, link) {
console.log('link', link)
console.log('event', event)
let copyLinkMsg = 'Copy Share Link to Clipboard: Ctrl+C, Enter\nPaste in the Search of the Stremio App'
if (window.isMobile)
copyLinkMsg = 'Copy Share Link to Clipboard: Long Press Text, Select Copy\nPaste in the Search of the Stremio App'
window.prompt(copyLinkMsg, link)
event.preventDefault()
return false
}
</script>
</body>
</html>