mirror of
https://github.com/friendica/friendica
synced 2025-04-26 02:30:11 +00:00
Update composer module to use the new ACL selector
- Remove ACL-specific code from compose-footer - Move compose-footer template remaining content to compose.js
This commit is contained in:
parent
39d0735236
commit
8f4f6899dd
4 changed files with 107 additions and 417 deletions
57
view/theme/frio/js/compose.js
Normal file
57
view/theme/frio/js/compose.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
$(function() {
|
||||
// Jot attachment live preview.
|
||||
let $textarea = $('textarea[name=body]');
|
||||
$textarea.linkPreview();
|
||||
$textarea.keyup(function(){
|
||||
var textlen = $(this).val().length;
|
||||
$('#character-counter').text(textlen);
|
||||
});
|
||||
$textarea.editor_autocomplete(baseurl + '/search/acl');
|
||||
$textarea.bbco_autocomplete('bbcode');
|
||||
|
||||
let location_button = document.getElementById('profile-location');
|
||||
let location_input = document.getElementById('jot-location');
|
||||
|
||||
if (location_button && location_input) {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
|
||||
location_input.addEventListener('change', function () {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
location_input.addEventListener('keyup', function () {
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
|
||||
location_button.addEventListener('click', function() {
|
||||
if (location_input.value) {
|
||||
location_input.value = '';
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
} else if ("geolocation" in navigator) {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
location_input.value = position.coords.latitude + ', ' + position.coords.longitude;
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
}, function (error) {
|
||||
location_button.disabled = true;
|
||||
updateLocationButtonDisplay(location_button, location_input);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function updateLocationButtonDisplay(location_button, location_input)
|
||||
{
|
||||
location_button.classList.remove('btn-primary');
|
||||
if (location_input.value) {
|
||||
location_button.disabled = false;
|
||||
location_button.classList.add('btn-primary');
|
||||
location_button.title = location_button.dataset.titleClear;
|
||||
} else if (!"geolocation" in navigator) {
|
||||
location_button.disabled = true;
|
||||
location_button.title = location_button.dataset.titleUnavailable;
|
||||
} else if (location_button.disabled) {
|
||||
location_button.title = location_button.dataset.titleDisabled;
|
||||
} else {
|
||||
location_button.title = location_button.dataset.titleSet;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue