Skip to content

Instantly share code, notes, and snippets.

View acoyfellow's full-sized avatar
🤖
Building

Jordan Coeyman acoyfellow

🤖
Building
View GitHub Profile
@acoyfellow
acoyfellow / prevent-dupes.html
Last active January 4, 2024 19:14
Prevent duplicate form submissions in Phonesites.com
<script>
// Add to Custom Code > Bottom of Body
try{
if(localStorage.getItem("lead_id")){
setError("Only one submission allowed.");
throw new Error();
};
} catch(e){
console.error(e);
};
@acoyfellow
acoyfellow / example.html
Created October 17, 2023 00:50
Custom Font Example
<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=Pixelify+Sans&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Pixelify Sans', sans-serif!important;
}
</style>
@acoyfellow
acoyfellow / formsync.html
Created January 30, 2023 20:31
FormSync + Phonesites
<script src="https://rawgit.com/acoyfellow/FormSync/master/FormSync.js"></script>
<script>
function success(){
clearFormSync();
};
</script>
@acoyfellow
acoyfellow / example.html
Created January 9, 2023 17:17
Swiper Example
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.css"
/>
<!-- Swiper -->
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<div class="swiper-slide tc"><img src="https://firebasestorage.googleapis.com/v0/b/phonesites-prod.appspot.com/o/images%2FUZCKxREA6sNku9tDPHVFxd5PSrG3%2F1672423440866*Slide3*jpg?alt=media&token=7eb8afaf-c931-4665-a2b8-9edad704b5c5" />
</div>
@acoyfellow
acoyfellow / hidden.html
Created September 17, 2022 15:26
Hidden Field
<script>
window.beforePost= function(){
formData.hiddenField1= "My Hidden Field";
};
</script>
@acoyfellow
acoyfellow / test.html
Created September 16, 2022 20:06
Add URL parameters into formData
<script>
window.beforePost= function(){
params.forEach(function(param){
formData[param.key]= param.val;
});
};
</script>
@acoyfellow
acoyfellow / example.html
Created March 15, 2022 23:03
Phonesites Custom Redirect
<!-- add this code to a Code block. Style with "style" and "class" attributes -->
<button
onclick="window.location= redirect;"
style=""
class="button-reset pv3 tc ba b--transparent bg-animate pointer w-100 br2">
Click Me
</button>
<!-- add this to a page's Custom Code > Below Body -->
@acoyfellow
acoyfellow / example.html
Created March 15, 2022 22:54
Phonesites.com redirect based on "referrerId" URL parameter
<script>
function beforePost(){
var referrerId= params.filter(function(p){
return p.key==='referrerId'
})[0]||{};
// add a new line for each referrer.
if(referrerId.val==='google'){ redirect = "https://google.com" };
};
</script>
@acoyfellow
acoyfellow / service-worker.js
Last active December 15, 2021 14:36
Svelte Kit service worker (does not cache external URLs)
import { timestamp, build, files } from '$service-worker';
const name = `cache-${timestamp}`;
self.addEventListener('install', (event) => {
event.waitUntil(caches.open(name).then((cache) => cache.addAll(['/', ...build, ...files])));
});
self.addEventListener('activate', (event) => {
event.waitUntil(
@acoyfellow
acoyfellow / url-params-inject.html
Created December 3, 2021 20:52
Phonesites Script: Add URL variables into form data
<script>
function beforePost(){
window.params.forEach(function (param) {
formData[param.key]= param.val;
});
};
</script>