Moved link scheme to frontend

https://github.com/LinkStackOrg/LinkStack/issues/722
This commit is contained in:
Julian Prieber 2024-02-10 19:40:45 +01:00
parent 0bf5e4716e
commit 2179cf3bec
3 changed files with 22 additions and 4 deletions

View File

@ -273,14 +273,12 @@ class UserController extends Controller
'title' => $sanitizedText,
]);
}elseif($linkType->typename == "email"){
$LinkURL = "mailto:".$LinkURL;
$OrigLink->update([
'link' => $LinkURL,
'button_id' => $button?->id,
'title' => $LinkTitle,
]);
}elseif($linkType->typename == "telephone"){
$LinkURL = "tel:".$LinkURL;
$OrigLink->update([
'link' => $LinkURL,
'button_id' => $button?->id,
@ -398,10 +396,8 @@ class UserController extends Controller
$links->button_id = "93";
$links->title = $sanitizedText;
}elseif($linkType->typename == "email"){
$links->link = "mailto:".$links->link;
$links->button_id = $button?->id;
}elseif($linkType->typename == "telephone"){
$links->link = "tel:".$links->link;
$links->button_id = $button?->id;
}elseif($linkType->typename == "vcard"){

View File

@ -10,3 +10,14 @@
<input type='email' name='link' value='{{str_replace("mailto:", "", $link_url)}}' class='form-control' required />
<span class='small text-muted'>{{__('messages.Enter your E-Mail')}}</span>
<script>
$(document).ready(function() {
$('form').on('submit', function(e) {
var linkInput = $(this).find('input[name="link"]');
var linkValue = linkInput.val();
if (!linkValue.toLowerCase().startsWith('mailto:')) {
linkInput.val('mailto:' + linkValue);
}
});
});
</script>

View File

@ -10,3 +10,14 @@
<input type='tel' name='link' value='{{str_replace("tel:", "", $link_url)}}' class='form-control' required />
<span class='small text-muted'>{{__('messages.Enter your telephone number')}}</span>
<script>
$(document).ready(function() {
$('form').on('submit', function(e) {
var linkInput = $(this).find('input[name="link"]');
var linkValue = linkInput.val();
if (!linkValue.toLowerCase().startsWith('tel:')) {
linkInput.val('tel:' + linkValue);
}
});
});
</script>