1
1
Fork 0
friendica_2019-12_sharedHos.../view/theme/smoothly/templates/jot-header.tpl

271 lines
6.4 KiB
Smarty
Raw Normal View History

2013-04-23 13:47:57 +02:00
<script language="javascript" type="text/javascript">
2017-01-27 04:54:32 +01:00
var editor = false;
2013-04-23 13:47:57 +02:00
var textlen = 0;
2017-01-27 04:54:32 +01:00
function initEditor(callback) {
if (editor == false){
2013-04-23 13:47:57 +02:00
$("#profile-jot-text-loading").show();
2017-01-27 04:54:32 +01:00
$("#profile-jot-text-loading").hide();
$("#profile-jot-text").css({ 'height': 200, 'color': '#000' });
$("#profile-jot-text").editor_autocomplete(baseurl + '/search/acl');
2017-01-27 04:54:32 +01:00
$("#profile-jot-text").bbco_autocomplete('bbcode');
$(".jothidden").show();
$("a#jot-perms-icon").colorbox({
2013-04-23 13:47:57 +02:00
'inline' : true,
'transition' : 'elastic'
2017-01-27 04:54:32 +01:00
});
$("#profile-jot-submit-wrapper").show();
{{if $newpost}}
$("#profile-upload-wrapper").show();
$("#profile-attach-wrapper").show();
$("#profile-link-wrapper").show();
$("#profile-video-wrapper").show();
$("#profile-audio-wrapper").show();
$("#profile-location-wrapper").show();
$("#profile-nolocation-wrapper").show();
$("#profile-title-wrapper").show();
$("#profile-jot-plugin-wrapper").show();
$("#jot-preview-link").show();
{{/if}}
editor = true;
2013-04-23 13:47:57 +02:00
}
2017-01-27 04:54:32 +01:00
if (typeof callback != "undefined") {
callback();
}
2013-04-23 13:47:57 +02:00
} // initEditor
function enableOnUser(){
2017-01-27 04:54:32 +01:00
if (editor) {
return;
}
2013-04-23 13:47:57 +02:00
$(this).val("");
initEditor();
}
</script>
<script type="text/javascript" src="view/js/ajaxupload.js?v={{$smarty.const.FRIENDICA_VERSION}}">
2013-04-23 13:47:57 +02:00
</script>
<script>
var ispublic = '{{$ispublic nofilter}}';
2013-04-23 13:47:57 +02:00
$(document).ready(function() {
2017-01-27 04:54:32 +01:00
/* enable editor on focus and click */
2022-10-30 05:17:54 +01:00
$("#profile-jot-text")
.focus(enableOnUser)
.click(enableOnUser);
2013-04-23 13:47:57 +02:00
var uploader = new window.AjaxUpload(
'wall-image-upload',
2022-10-30 05:17:54 +01:00
{ action: 'profile/{{$nickname}}/photos/upload',
2013-04-23 13:47:57 +02:00
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {
addeditortext(response);
$('#profile-rotator').hide();
2017-01-27 04:54:32 +01:00
}
2013-04-23 13:47:57 +02:00
}
);
var file_uploader = new window.AjaxUpload(
'wall-file-upload',
{ action: 'profile/{{$nickname}}/attachment/upload',
2013-04-23 13:47:57 +02:00
name: 'userfile',
onSubmit: function(file,ext) { $('#profile-rotator').show(); },
onComplete: function(file,response) {
addeditortext(response);
$('#profile-rotator').hide();
2017-01-27 04:54:32 +01:00
}
2013-04-23 13:47:57 +02:00
}
2017-01-27 04:54:32 +01:00
);
2013-04-23 13:47:57 +02:00
$('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
var selstr;
$('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
selstr = $(this).html();
2013-04-23 13:47:57 +02:00
$('#jot-perms-icon').removeClass('unlock').addClass('lock');
$('#jot-public').hide();
$('.profile-jot-net input').attr('disabled', 'disabled');
});
2017-01-27 04:54:32 +01:00
if(selstr == null) {
2013-04-23 13:47:57 +02:00
$('#jot-perms-icon').removeClass('lock').addClass('unlock');
$('#jot-public').show();
$('.profile-jot-net input').attr('disabled', false);
}
}).trigger('change');
});
function deleteCheckedItems() {
if(confirm('{{$delitems}}')) {
var checkedstr = '';
$("#item-delete-selected").hide();
$('#item-delete-selected-rotator').show();
$('.item-select').each( function() {
if($(this).is(':checked')) {
if(checkedstr.length != 0) {
checkedstr = checkedstr + ',' + $(this).val();
}
else {
checkedstr = $(this).val();
}
2017-01-27 04:54:32 +01:00
}
2013-04-23 13:47:57 +02:00
});
$.post('item', { dropitems: checkedstr }, function(data) {
window.location.reload();
});
}
}
function jotGetLink() {
reply = prompt("{{$linkurl}}");
if(reply && reply.length) {
reply = bin2hex(reply);
$('#profile-rotator').show();
$.get('parseurl?binurl=' + reply, function(data) {
2013-04-23 13:47:57 +02:00
addeditortext(data);
$('#profile-rotator').hide();
});
}
}
function jotVideoURL() {
reply = prompt("{{$vidurl}}");
if(reply && reply.length) {
addeditortext('[video]' + reply + '[/video]');
}
}
function jotAudioURL() {
reply = prompt("{{$audurl}}");
if(reply && reply.length) {
addeditortext('[audio]' + reply + '[/audio]');
}
}
function jotGetLocation() {
reply = prompt("{{$whereareu}}", $('#jot-location').val());
if(reply && reply.length) {
$('#jot-location').val(reply);
}
}
function jotTitle() {
reply = prompt("{{$title}}", $('#jot-title').val());
if(reply && reply.length) {
$('#jot-title').val(reply);
}
}
function jotShare(id) {
$('#like-rotator-' + id).show();
$.get('share/' + id, function(data) {
if (!editor) $("#profile-jot-text").val("");
initEditor(function(){
addeditortext(data);
$('#like-rotator-' + id).hide();
$(window).scrollTop(0);
});
});
}
function linkdropper(event) {
var linkFound = event.dataTransfer.types.contains("text/uri-list");
if(linkFound)
event.preventDefault();
}
function linkdrop(event) {
var reply = event.dataTransfer.getData("text/uri-list");
event.target.textContent = reply;
event.preventDefault();
if(reply && reply.length) {
reply = bin2hex(reply);
$('#profile-rotator').show();
$.get('parseurl?binurl=' + reply, function(data) {
2013-04-23 13:47:57 +02:00
if (!editor) $("#profile-jot-text").val("");
initEditor(function(){
addeditortext(data);
$('#profile-rotator').hide();
});
});
}
}
function itemTag(id) {
reply = prompt("{{$term}}");
if(reply && reply.length) {
reply = reply.replace('#','');
if(reply.length) {
commentBusy = true;
$('body').css('cursor', 'wait');
$.post('post/' + id + '/tag/add', {term: reply});
2013-04-23 13:47:57 +02:00
if(timer) clearTimeout(timer);
timer = setTimeout(NavUpdate,3000);
liking = 1;
}
}
}
2017-01-27 04:54:32 +01:00
2013-04-23 13:47:57 +02:00
function itemFiler(id) {
2017-01-27 04:54:32 +01:00
2013-04-23 13:47:57 +02:00
var bordercolor = $("input").css("border-color");
2017-01-27 04:54:32 +01:00
2013-04-23 13:47:57 +02:00
$.get('filer/', function(data){
$.colorbox({html:data});
$("#id_term").keypress(function(){
$(this).css("border-color",bordercolor);
})
$("#select_term").change(function(){
$("#id_term").css("border-color",bordercolor);
})
2017-01-27 04:54:32 +01:00
2013-04-23 13:47:57 +02:00
$("#filer_save").click(function(e){
e.preventDefault();
reply = $("#id_term").val();
if(reply && reply.length) {
commentBusy = true;
$('body').css('cursor', 'wait');
$.get('filer/' + id + '?term=' + reply, NavUpdate);
// if(timer) clearTimeout(timer);
// timer = setTimeout(NavUpdate,3000);
liking = 1;
force_update = true;
2013-04-23 13:47:57 +02:00
$.colorbox.close();
} else {
$("#id_term").css("border-color","#FF0000");
}
return false;
});
});
2017-01-27 04:54:32 +01:00
2013-04-23 13:47:57 +02:00
}
2017-01-27 04:54:32 +01:00
2013-04-23 13:47:57 +02:00
function jotClearLocation() {
$('#jot-coord').val('');
$('#profile-nolocation-wrapper').hide();
}
2017-01-27 04:54:32 +01:00
function addeditortext(data) {
var currentText = $("#profile-jot-text").val();
$("#profile-jot-text").val(currentText + data);
}
2013-04-23 13:47:57 +02:00
{{$geotag nofilter}}
2013-04-23 13:47:57 +02:00
</script>