2023-01-01 08:13:37 +00:00
|
|
|
<script src="vendor/blueimp/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
|
|
|
|
<script src="vendor/blueimp/jquery-file-upload/js/jquery.iframe-transport.js"></script>
|
|
|
|
<script src="vendor/blueimp/jquery-file-upload/js/jquery.fileupload.js"></script>
|
2022-09-16 10:57:04 +00:00
|
|
|
<script type="text/javascript">
|
2010-07-01 23:48:07 +00:00
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let editor = false;
|
|
|
|
let plaintext = '{{$editselect}}';
|
|
|
|
let pretext = '{{$pretext}}';
|
2011-01-31 22:21:23 +00:00
|
|
|
|
2023-01-01 08:13:37 +00:00
|
|
|
let activeCommentID = 0;
|
|
|
|
let activeCommentText = '';
|
|
|
|
let postSaveTimer = null;
|
|
|
|
|
|
|
|
$(document).on( "click", ".wall-item-delete-link,.page-delete-link,.layout-delete-link,.block-delete-link", function(e) {
|
|
|
|
let link = $(this).attr("href"); // "get" the intended link in a let
|
|
|
|
|
|
|
|
if (typeof(eval($.fn.modal)) === 'function'){
|
|
|
|
e.preventDefault();
|
|
|
|
bootbox.confirm("<h4>{{$confirmdelete}}</h4>",function(result) {
|
|
|
|
if (result) {
|
|
|
|
document.location.href = link;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
return confirm("{{$confirmdelete}}");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
|
|
let cleaned = false;
|
|
|
|
|
|
|
|
if({{$auto_save_draft}}) {
|
|
|
|
let doctype = $('#jot-webpage').val();
|
|
|
|
let postid = '-' + doctype + '-' + $('#jot-postid').val();
|
|
|
|
let postTitle = localStorage.getItem("post_title" + postid);
|
|
|
|
let postBody = localStorage.getItem("post_body" + postid);
|
|
|
|
let postCategory = (($("#jot-category").length) ? localStorage.getItem("post_category" + postid) : '');
|
|
|
|
let openEditor = false;
|
|
|
|
|
|
|
|
if(postTitle) {
|
|
|
|
$('#jot-title').val(postTitle);
|
|
|
|
openEditor = true;
|
2018-08-16 01:56:18 +00:00
|
|
|
}
|
2023-01-01 08:13:37 +00:00
|
|
|
if(postBody) {
|
|
|
|
$('#profile-jot-text').val(postBody);
|
|
|
|
openEditor = true;
|
|
|
|
}
|
|
|
|
if(postCategory) {
|
|
|
|
let categories = postCategory.split(',');
|
|
|
|
categories.forEach(function(cat) {
|
|
|
|
$('#jot-category').tagsinput('add', cat);
|
|
|
|
});
|
|
|
|
openEditor = true;
|
2018-08-16 01:56:18 +00:00
|
|
|
}
|
2023-01-01 08:13:37 +00:00
|
|
|
if(openEditor) {
|
|
|
|
enableOnUser();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
postSaveChanges('clean');
|
2015-03-12 21:57:00 +00:00
|
|
|
}
|
2011-07-20 08:00:33 +00:00
|
|
|
|
2023-01-01 08:13:37 +00:00
|
|
|
$(document).on('submit', '#profile-jot-form', function() {
|
|
|
|
postSaveChanges('clean');
|
|
|
|
cleaned = true;
|
|
|
|
});
|
2017-07-14 00:04:58 +00:00
|
|
|
|
2023-01-01 08:13:37 +00:00
|
|
|
$(document).on('focusout',"#profile-jot-wrapper",function(e){
|
|
|
|
if(! cleaned)
|
|
|
|
postSaveChanges('stop');
|
|
|
|
});
|
2017-07-14 00:04:58 +00:00
|
|
|
|
2023-01-01 08:13:37 +00:00
|
|
|
$(document).on('focusin',"#profile-jot-wrapper",function(e){
|
|
|
|
postSaveTimer = setTimeout(function () {
|
|
|
|
postSaveChanges('start');
|
|
|
|
},10000);
|
|
|
|
});
|
|
|
|
});
|
2017-08-09 05:55:47 +00:00
|
|
|
|
2010-07-23 03:22:03 +00:00
|
|
|
$(document).ready(function() {
|
2018-05-20 09:02:18 +00:00
|
|
|
|
2011-12-19 17:02:43 +00:00
|
|
|
$("#profile-jot-text").focus(enableOnUser);
|
|
|
|
$("#profile-jot-text").click(enableOnUser);
|
2015-04-16 21:26:11 +00:00
|
|
|
|
2018-01-30 02:43:20 +00:00
|
|
|
$('#id_mimetype').on('load', jotSetMime);
|
|
|
|
$('#id_mimetype').on('change', jotSetMime);
|
|
|
|
|
2019-04-17 00:44:42 +00:00
|
|
|
$("input[name='link_style']").change(function() {
|
2022-02-18 01:38:12 +00:00
|
|
|
let radioValue = $("input[name='link_style']:checked"). val();
|
2019-04-17 00:44:42 +00:00
|
|
|
if(radioValue == '0') {
|
|
|
|
$("#linkmodaldiscover").hide();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#linkmodaldiscover").show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2022-09-16 10:57:04 +00:00
|
|
|
jotLocateStatus();
|
2022-11-15 20:16:26 +00:00
|
|
|
jotCheckinStatus();
|
2022-11-21 19:15:54 +00:00
|
|
|
jotCheckoutStatus();
|
2022-09-16 10:57:04 +00:00
|
|
|
|
2020-02-27 04:48:28 +00:00
|
|
|
$('#jot-add-option').on('click', jotAddOption);
|
|
|
|
$(document).on('click', '.poll-option-close', jotRemoveOption);
|
|
|
|
|
2018-01-30 02:43:20 +00:00
|
|
|
function jotSetMime() {
|
2022-02-18 01:38:12 +00:00
|
|
|
let mtype = $('#id_mimetype').val();
|
2021-03-22 04:56:18 +00:00
|
|
|
if(mtype == 'text/bbcode' || mtype == 'text/x-multicode')
|
2018-01-30 02:43:20 +00:00
|
|
|
$('#profile-jot-submit-left').show();
|
|
|
|
else
|
|
|
|
$('#profile-jot-submit-left').hide();
|
|
|
|
}
|
2017-07-14 00:04:58 +00:00
|
|
|
|
2023-02-15 21:36:17 +00:00
|
|
|
/**
|
|
|
|
* uses the jQuery file upload plugin to upload files.
|
|
|
|
* It is initialized on an element with an ID of "invisible-wall-file-upload" using the .fileupload() method.
|
|
|
|
* It is configured with several options passed as an object to the .fileupload() method:
|
|
|
|
* url: specifies the server endpoint to which the uploaded file will be sent. It includes a PHP variable $nickname in the URL path.
|
|
|
|
* dataType: specifies the expected format of the response from the server, which is JSON in this case.
|
|
|
|
* dropZone: specifies the element that is used as the drop zone for the file upload. In this case, it's the element with an ID of "profile-jot-text".
|
|
|
|
* maxChunkSize: specifies the maximum chunk size for chunked file uploads. It's set to 2 megabytes in this case.
|
|
|
|
* add: specifies a callback function to be executed when a file is added to the queue.
|
|
|
|
* In this case, the function shows a rotating icon to indicate that the upload is in progress and submits the file for uploading.
|
|
|
|
* done: specifies a callback function to be executed when the upload is complete.
|
|
|
|
* In this case, the function appends the file's URL to a text area with an ID of "jot-media"
|
|
|
|
* and adds the file's URL to the text editor by calling a function named addeditortext().
|
|
|
|
* stop: specifies a callback function to be executed when the upload is stopped,
|
|
|
|
* either because it's completed or because it was cancelled.
|
|
|
|
* In this case, the function hides the rotating icon and calls a function named preview_post(), which previews the uploaded file in the user's post.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2017-07-14 00:04:58 +00:00
|
|
|
$('#invisible-wall-file-upload').fileupload({
|
|
|
|
url: 'wall_attach/{{$nickname}}',
|
|
|
|
dataType: 'json',
|
2020-09-25 02:30:07 +00:00
|
|
|
dropZone: $('#profile-jot-text'),
|
2019-03-05 23:22:43 +00:00
|
|
|
maxChunkSize: 2 * 1024 * 1024,
|
2017-07-14 00:04:58 +00:00
|
|
|
add: function(e,data) {
|
2023-03-01 00:45:51 +00:00
|
|
|
// console.log(e);
|
|
|
|
// console.log(data);
|
2017-09-26 11:02:11 +00:00
|
|
|
$('#profile-rotator').show();
|
2017-07-14 00:04:58 +00:00
|
|
|
data.submit();
|
|
|
|
},
|
|
|
|
done: function(e,data) {
|
|
|
|
addeditortext(data.result.message);
|
|
|
|
$('#jot-media').val($('#jot-media').val() + data.result.message);
|
|
|
|
},
|
|
|
|
stop: function(e,data) {
|
2017-08-02 01:05:04 +00:00
|
|
|
preview_post();
|
2017-09-26 11:02:11 +00:00
|
|
|
$('#profile-rotator').hide();
|
2017-07-14 00:04:58 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#wall-file-upload').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
|
|
|
|
$('#wall-file-upload-sub').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
|
|
|
|
|
2023-02-15 18:33:22 +00:00
|
|
|
/* start new */
|
|
|
|
|
|
|
|
$('#wall-file-upload-1').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
|
|
|
|
$('#wall-file-upload-sub').click(function(event) { event.preventDefault(); $('#invisible-wall-file-upload').trigger('click'); return false;});
|
|
|
|
|
|
|
|
/* end new */
|
|
|
|
|
2016-07-24 21:33:34 +00:00
|
|
|
// call initialization file
|
|
|
|
if (window.File && window.FileList && window.FileReader) {
|
2020-09-25 02:30:07 +00:00
|
|
|
DragDropUploadInit();
|
2016-07-24 21:33:34 +00:00
|
|
|
}
|
2017-07-14 00:04:58 +00:00
|
|
|
|
2017-08-09 05:55:47 +00:00
|
|
|
|
|
|
|
$('#invisible-comment-upload').fileupload({
|
|
|
|
url: 'wall_attach/{{$nickname}}',
|
|
|
|
dataType: 'json',
|
2020-09-25 02:30:07 +00:00
|
|
|
dropZone: $(),
|
2019-03-05 23:22:43 +00:00
|
|
|
maxChunkSize: 2 * 1024 * 1024,
|
2017-08-09 05:55:47 +00:00
|
|
|
add: function(e,data) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let tmpStr = $("#comment-edit-text-" + activeCommentID).val();
|
2017-08-09 05:55:47 +00:00
|
|
|
if(tmpStr == activeCommentText) {
|
|
|
|
tmpStr = "";
|
|
|
|
$("#comment-edit-text-" + activeCommentID).addClass("comment-edit-text-full");
|
|
|
|
$("#comment-edit-text-" + activeCommentID).removeClass("comment-edit-text-empty");
|
|
|
|
openMenu("comment-tools-" + activeCommentID);
|
|
|
|
$("#comment-edit-text-" + activeCommentID).val(tmpStr);
|
|
|
|
}
|
|
|
|
data.submit();
|
|
|
|
},
|
|
|
|
|
|
|
|
done: function(e,data) {
|
|
|
|
textarea = document.getElementById("comment-edit-text-" + activeCommentID);
|
2020-09-24 00:59:09 +00:00
|
|
|
if (textarea != null ) {
|
|
|
|
textarea.value = textarea.value + data.result.message;
|
|
|
|
}
|
2017-08-09 05:55:47 +00:00
|
|
|
},
|
|
|
|
stop: function(e,data) {
|
|
|
|
$('body').css('cursor', 'auto');
|
|
|
|
preview_comment(activeCommentID);
|
|
|
|
activeCommentID = 0;
|
|
|
|
},
|
|
|
|
});
|
2020-02-27 04:48:28 +00:00
|
|
|
|
2010-07-23 03:22:03 +00:00
|
|
|
});
|
|
|
|
|
2023-01-01 08:13:37 +00:00
|
|
|
function initEditor(cb){
|
|
|
|
if(editor == false){
|
|
|
|
$("#profile-jot-text-loading").show();
|
|
|
|
$("#profile-jot-reset").removeClass('d-none');
|
|
|
|
{{$geotag}}
|
|
|
|
if(plaintext == 'none') {
|
|
|
|
$("#profile-jot-text-loading").hide();
|
|
|
|
$(".jothidden").show();
|
|
|
|
$("#profile-jot-text").addClass('jot-expanded');
|
|
|
|
$("#profile-jot-summary").addClass('jot-expanded');
|
2023-01-04 03:32:03 +00:00
|
|
|
|
2023-01-10 18:53:00 +00:00
|
|
|
/*
|
|
|
|
let bodytextarea = document.querySelector('#profile-jot-text');
|
|
|
|
if (typeof bodytextarea != "undefined") {
|
|
|
|
bodytextarea.addEventListener('input', function handlechange(event) {
|
|
|
|
imagewatcher(event)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2023-01-01 08:13:37 +00:00
|
|
|
{{if $bbco_autocomplete}}
|
|
|
|
$("#profile-jot-text").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode
|
|
|
|
$("#profile-jot-summary").bbco_autocomplete('{{$bbco_autocomplete}}'); // autocomplete bbcode
|
|
|
|
{{/if}}
|
|
|
|
{{if $editor_autocomplete}}
|
|
|
|
if(typeof channelId === 'undefined') {
|
|
|
|
$("#profile-jot-text").editor_autocomplete(baseurl+"/acloader");
|
|
|
|
$("#profile-jot-summary").editor_autocomplete(baseurl+"/acloader");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#profile-jot-text").editor_autocomplete(baseurl+"/acloader",[channelId]); // Also gives suggestions from current channel's connections
|
|
|
|
$("#profile-jot-summary").editor_autocomplete(baseurl+"/acloader",[channelId]); // Also gives suggestions from current channel's connections
|
|
|
|
}
|
|
|
|
{{/if}}
|
|
|
|
editor = true;
|
|
|
|
if (typeof cb!="undefined") cb();
|
|
|
|
if(pretext.length)
|
|
|
|
addeditortext(pretext);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
editor = true;
|
|
|
|
} else {
|
|
|
|
if (typeof cb!="undefined") cb();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-04 03:32:03 +00:00
|
|
|
function imagewatcher(event) {
|
2023-01-10 18:53:00 +00:00
|
|
|
let imgfind = /\[[iz]mg.*?alt="(.*?)".*?](.*?)\[/.exec(event.target.value)
|
|
|
|
console.log(imgfind);
|
2023-01-04 03:32:03 +00:00
|
|
|
}
|
2023-01-01 08:13:37 +00:00
|
|
|
function enableOnUser(){
|
|
|
|
if(editor)
|
|
|
|
return;
|
|
|
|
|
|
|
|
initEditor();
|
|
|
|
}
|
|
|
|
|
2011-06-16 03:43:39 +00:00
|
|
|
function deleteCheckedItems() {
|
2022-02-18 01:38:12 +00:00
|
|
|
let checkedstr = '';
|
2011-06-16 03:43:39 +00:00
|
|
|
|
|
|
|
$('.item-select').each( function() {
|
|
|
|
if($(this).is(':checked')) {
|
2011-06-16 22:26:39 +00:00
|
|
|
if(checkedstr.length != 0) {
|
2011-06-16 03:43:39 +00:00
|
|
|
checkedstr = checkedstr + ',' + $(this).val();
|
2011-06-16 22:26:39 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-06-16 03:43:39 +00:00
|
|
|
checkedstr = $(this).val();
|
2011-06-16 22:26:39 +00:00
|
|
|
}
|
2015-03-12 21:57:00 +00:00
|
|
|
}
|
2011-06-16 03:43:39 +00:00
|
|
|
});
|
2011-06-16 07:38:41 +00:00
|
|
|
$.post('item', { dropitems: checkedstr }, function(data) {
|
|
|
|
window.location.reload();
|
|
|
|
});
|
2011-06-16 03:43:39 +00:00
|
|
|
}
|
|
|
|
|
2010-07-23 05:41:45 +00:00
|
|
|
function jotGetLink() {
|
2019-05-23 23:37:56 +00:00
|
|
|
textarea = document.getElementById('profile-jot-text');
|
|
|
|
if (textarea.selectionStart || textarea.selectionStart == "0") {
|
2022-02-18 01:38:12 +00:00
|
|
|
let start = textarea.selectionStart;
|
|
|
|
let end = textarea.selectionEnd;
|
2019-05-23 23:37:56 +00:00
|
|
|
if (end > start) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let reply = prompt("{{$linkurl}}");
|
2019-05-23 23:37:56 +00:00
|
|
|
if(reply && reply.length) {
|
|
|
|
textarea.value = textarea.value.substring(0, start) + "[url=" + reply + "]" + textarea.value.substring(start, end) + "[/url]" + textarea.value.substring(end, textarea.value.length);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2021-09-17 07:02:02 +00:00
|
|
|
$('#linkModal').modal('show');
|
2019-05-23 23:37:56 +00:00
|
|
|
$('#id_link_url').focus();
|
2019-05-30 02:55:29 +00:00
|
|
|
$('#link-modal-OKButton').on('click',jotgetlinkmodal);
|
|
|
|
$('#link-modal-CancelButton').on('click',jotclearmodal);
|
|
|
|
}
|
|
|
|
|
2022-09-16 10:57:04 +00:00
|
|
|
function jotLocateStatus() {
|
|
|
|
if($('#jot-lat').val() || $('#jot-lon').val() || $('#jot-location').val()) {
|
|
|
|
$('#profile-nolocation-wrapper').attr('disabled', false);
|
|
|
|
$('#profile-nolocation-wrapper').show();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#profile-nolocation-wrapper').attr('disabled', true);
|
|
|
|
$('#profile-nolocation-wrapper').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-30 02:55:29 +00:00
|
|
|
function jotclearmodal() {
|
|
|
|
$('#link-modal-OKButton').off('click',jotgetlinkmodal);
|
|
|
|
$('#link-modal-CancelButton').off('click',jotclearmodal);
|
|
|
|
}
|
|
|
|
|
|
|
|
function jotgetlinkmodal() {
|
2022-02-18 01:38:12 +00:00
|
|
|
let reply = $('#id_link_url').val();
|
2019-05-30 02:55:29 +00:00
|
|
|
|
|
|
|
if(reply && reply.length) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let radioValue = $("input[name='link_style']:checked"). val();
|
2019-05-30 02:55:29 +00:00
|
|
|
if(radioValue == '0') {
|
|
|
|
reply = '!' + reply;
|
|
|
|
}
|
2022-02-18 01:38:12 +00:00
|
|
|
let optstr = '';
|
|
|
|
let opts = $("input[name='oembed']:checked"). val();
|
2019-05-30 02:55:29 +00:00
|
|
|
if(opts) {
|
|
|
|
optstr = optstr + '&oembed=1';
|
2019-05-23 23:37:56 +00:00
|
|
|
}
|
2022-02-19 21:28:43 +00:00
|
|
|
opts = $("input[name='zotobj']:checked"). val();
|
2019-05-30 02:55:29 +00:00
|
|
|
if(opts) {
|
|
|
|
optstr = optstr + '&zotobj=1';
|
|
|
|
}
|
|
|
|
reply = bin2hex(reply);
|
|
|
|
$('#profile-rotator').show();
|
|
|
|
$.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply + optstr, function(data) {
|
|
|
|
addeditortext(data);
|
|
|
|
preview_post();
|
|
|
|
$('#id_link_url').val('');
|
|
|
|
$('#link-modal-OKButton').off('click',jotgetlinkmodal);
|
|
|
|
$('#link-modal-CancelButton').off('click',jotclearmodal);
|
|
|
|
$('#profile-rotator').hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#linkModal').modal('hide');
|
|
|
|
}
|
2010-07-23 05:41:45 +00:00
|
|
|
}
|
|
|
|
|
2010-08-20 21:33:15 +00:00
|
|
|
function jotGetLocation() {
|
2022-09-16 10:57:04 +00:00
|
|
|
let reply = prompt("{{$whereareu}}", $('#jot-location').val());
|
2010-08-20 21:33:15 +00:00
|
|
|
if(reply && reply.length) {
|
2020-05-11 05:02:44 +00:00
|
|
|
// A single period indicates "use my browser location"
|
2022-09-16 10:57:04 +00:00
|
|
|
if(reply == '.') {
|
|
|
|
if(navigator.geolocation) {
|
|
|
|
reply = '';
|
2020-05-11 05:02:44 +00:00
|
|
|
navigator.geolocation.getCurrentPosition(function(position) {
|
2022-09-16 10:57:04 +00:00
|
|
|
$('#jot-lat').val(position.coords.latitude);
|
|
|
|
$('#jot-lon').val(position.coords.longitude);
|
|
|
|
jotLocateStatus();
|
2023-01-01 05:41:31 +00:00
|
|
|
jotCheckinStatus();
|
|
|
|
jotCheckoutStatus();
|
2022-09-16 10:57:04 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#jot-location').val(reply);
|
|
|
|
jotLocateStatus();
|
2023-01-01 05:41:31 +00:00
|
|
|
jotCheckinStatus();
|
|
|
|
jotCheckoutStatus();
|
2020-05-11 05:02:44 +00:00
|
|
|
}
|
2010-08-20 21:33:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-20 04:08:50 +00:00
|
|
|
function superblock(author,item) {
|
|
|
|
$.get('superblock?f=&item=' + item + '&block=' + author, function(data) {
|
|
|
|
location.reload(true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-04-17 11:08:04 +00:00
|
|
|
function blocksite(author) {
|
|
|
|
$.get('superblock?f=&blocksite=' + author, function(data) {
|
|
|
|
location.reload(true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-07 08:47:50 +00:00
|
|
|
function jotGetExpiry() {
|
2013-12-22 13:21:57 +00:00
|
|
|
//reply = prompt("{{$expirewhen}}", $('#jot-expire').val());
|
2021-09-17 07:02:02 +00:00
|
|
|
$('#expiryModal').modal('show');
|
2013-12-22 13:21:57 +00:00
|
|
|
$('#expiry-modal-OKButton').on('click', function() {
|
2015-03-12 21:57:00 +00:00
|
|
|
reply=$('#expiration-date').val();
|
|
|
|
if(reply && reply.length) {
|
|
|
|
$('#jot-expire').val(reply);
|
|
|
|
$('#expiryModal').modal('hide');
|
|
|
|
}
|
|
|
|
})
|
2013-11-07 08:47:50 +00:00
|
|
|
}
|
|
|
|
|
2020-11-24 03:14:44 +00:00
|
|
|
function jotGetCommCtrl() {
|
2021-09-17 07:02:02 +00:00
|
|
|
$('#commModal').modal('show');
|
2020-11-24 03:14:44 +00:00
|
|
|
$('#comm-modal-OKButton').on('click', function() {
|
2020-11-25 03:22:59 +00:00
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let comment_state = $("input[name='comments_allowed']:checked").val();
|
2020-11-25 03:22:59 +00:00
|
|
|
if (comment_state && comment_state.length) {
|
|
|
|
$('#jot-commentstate').val(comment_state);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#jot-commentstate').val(0);
|
|
|
|
}
|
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let post_comments = $('#id_post_comments').val();
|
2020-11-24 03:14:44 +00:00
|
|
|
if (post_comments && post_comments.length) {
|
|
|
|
$('#jot-commfrom').val(post_comments);
|
|
|
|
}
|
2022-02-18 01:38:12 +00:00
|
|
|
let reply=$('#commclose-date').val();
|
2020-11-24 03:14:44 +00:00
|
|
|
if(reply && reply.length) {
|
|
|
|
$('#jot-commclosed').val(reply);
|
|
|
|
}
|
|
|
|
$('#commModal').modal('hide');
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-02-15 21:36:17 +00:00
|
|
|
/**
|
|
|
|
* opens a modal window with an ID of "createdModal"
|
|
|
|
* and listens for a click event on a button with an ID of "created-modal-OKButton".
|
|
|
|
* When the button is clicked, it retrieves the value of an input field with an ID of "created-date"
|
|
|
|
* and if it is not empty, it sets the value of an input field with an ID of "jot-created"
|
|
|
|
* to the retrieved value and hides the modal window.
|
|
|
|
*/
|
|
|
|
|
2015-10-25 23:54:18 +00:00
|
|
|
function jotGetPubDate() {
|
2021-09-17 07:02:02 +00:00
|
|
|
$('#createdModal').modal('show');
|
2015-10-25 23:54:18 +00:00
|
|
|
$('#created-modal-OKButton').on('click', function() {
|
|
|
|
reply=$('#created-date').val();
|
|
|
|
if(reply && reply.length) {
|
|
|
|
$('#jot-created').val(reply);
|
|
|
|
$('#createdModal').modal('hide');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2017-09-06 01:32:37 +00:00
|
|
|
function jotShare(id,post_type) {
|
2018-09-03 03:16:04 +00:00
|
|
|
$('#like-rotator-' + id).show();
|
|
|
|
$.get('{{$baseurl}}/share/' + id, function(data) {
|
|
|
|
$('#like-rotator-' + id).hide();
|
2019-02-08 05:05:42 +00:00
|
|
|
updateInit();
|
2018-09-03 03:16:04 +00:00
|
|
|
});
|
2011-03-17 02:36:59 +00:00
|
|
|
}
|
2010-08-20 21:33:15 +00:00
|
|
|
|
2022-11-09 11:42:23 +00:00
|
|
|
function jotCheckin() {
|
2022-11-10 08:56:42 +00:00
|
|
|
let checkinVal = 1 - $('#jot-checkin').val();
|
|
|
|
$('#jot-checkin').val(checkinVal);
|
|
|
|
if (checkinVal) {
|
|
|
|
$('#profile-checkin-wrapper').addClass('_orange');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#profile-checkin-wrapper').removeClass('_orange');
|
|
|
|
}
|
2022-11-09 11:42:23 +00:00
|
|
|
}
|
|
|
|
|
2022-11-15 20:16:26 +00:00
|
|
|
function jotCheckinStatus() {
|
2022-11-15 20:58:15 +00:00
|
|
|
let checkinVal = parseInt($('#jot-checkin').val());
|
|
|
|
if (checkinVal > 0) {
|
2022-11-15 20:16:26 +00:00
|
|
|
$('#profile-checkin-wrapper').addClass('_orange');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#profile-checkin-wrapper').removeClass('_orange');
|
|
|
|
}
|
2023-01-01 05:41:31 +00:00
|
|
|
if ($('#jot-lat').val() && $('#jot-lon').val()) {
|
|
|
|
$('#profile-checkin-wrapper').show();
|
|
|
|
} else {
|
|
|
|
$('#profile-checkin-wrapper').hide();
|
|
|
|
}
|
2022-11-15 20:16:26 +00:00
|
|
|
}
|
|
|
|
|
2022-11-21 19:15:54 +00:00
|
|
|
function jotCheckout() {
|
|
|
|
let checkoutVal = 1 - $('#jot-checkout').val();
|
|
|
|
$('#jot-checkout').val(checkoutVal);
|
|
|
|
if (checkoutVal) {
|
|
|
|
$('#profile-checkout-wrapper').addClass('_orange');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#profile-checkout-wrapper').removeClass('_orange');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function jotCheckoutStatus() {
|
|
|
|
let checkoutVal = parseInt($('#jot-checkout').val());
|
|
|
|
if (checkoutVal > 0) {
|
|
|
|
$('#profile-checkout-wrapper').addClass('_orange');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#profile-checkout-wrapper').removeClass('_orange');
|
|
|
|
}
|
2023-01-01 05:41:31 +00:00
|
|
|
if ($('#jot-lat').val() && $('#jot-lon').val()) {
|
|
|
|
$('#profile-checkout-wrapper').show();
|
|
|
|
} else {
|
|
|
|
$('#profile-checkout-wrapper').hide();
|
|
|
|
}
|
2022-11-21 19:15:54 +00:00
|
|
|
}
|
|
|
|
|
2022-11-16 18:51:58 +00:00
|
|
|
function jotEmbed(id,post_type) {
|
2019-01-30 05:34:26 +00:00
|
|
|
|
|
|
|
if ($('#jot-popup').length != 0) $('#jot-popup').show();
|
|
|
|
|
2019-01-30 05:26:52 +00:00
|
|
|
$('#like-rotator-' + id).show();
|
|
|
|
$.get('{{$baseurl}}/embed/' + id, function(data) {
|
2019-01-30 05:34:26 +00:00
|
|
|
if (!editor) $("#profile-jot-text").val("");
|
|
|
|
initEditor(function(){
|
|
|
|
addeditortext(data);
|
|
|
|
$('#like-rotator-' + id).hide();
|
|
|
|
$(window).scrollTop(0);
|
|
|
|
});
|
2019-01-30 05:26:52 +00:00
|
|
|
});
|
|
|
|
|
2019-01-30 05:34:26 +00:00
|
|
|
}
|
2018-09-03 03:16:04 +00:00
|
|
|
|
2010-08-03 02:06:36 +00:00
|
|
|
function linkdropper(event) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let linkFound = ((event.dataTransfer.types.indexOf("text/uri-list") > -1) ? true : false);
|
2016-09-06 00:08:48 +00:00
|
|
|
if(linkFound) {
|
2010-08-03 02:06:36 +00:00
|
|
|
event.preventDefault();
|
2022-02-18 01:38:12 +00:00
|
|
|
let editwin = '#' + event.target.id;
|
|
|
|
let commentwin = false;
|
2016-09-06 00:08:48 +00:00
|
|
|
if(editwin) {
|
|
|
|
commentwin = ((editwin.indexOf('comment') >= 0) ? true : false);
|
|
|
|
if(commentwin) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
|
2016-09-06 00:08:48 +00:00
|
|
|
$('#comment-edit-text-' + commentid).addClass('hover');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function linkdropexit(event) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let editwin = '#' + event.target.id;
|
|
|
|
let commentwin = false;
|
2016-09-06 00:08:48 +00:00
|
|
|
if(editwin) {
|
|
|
|
commentwin = ((editwin.indexOf('comment') >= 0) ? true : false);
|
|
|
|
if(commentwin) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
|
2016-09-06 00:08:48 +00:00
|
|
|
$('#comment-edit-text-' + commentid).removeClass('hover');
|
|
|
|
}
|
|
|
|
}
|
2010-08-03 02:06:36 +00:00
|
|
|
}
|
2010-07-24 13:56:02 +00:00
|
|
|
|
2010-08-03 02:06:36 +00:00
|
|
|
function linkdrop(event) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let reply = event.dataTransfer.getData("text/uri-list");
|
2017-07-14 00:04:58 +00:00
|
|
|
if(reply) {
|
|
|
|
event.preventDefault();
|
2022-02-18 01:38:12 +00:00
|
|
|
let editwin = '#' + event.target.id;
|
|
|
|
let commentwin = false;
|
2017-07-14 00:04:58 +00:00
|
|
|
if(editwin) {
|
|
|
|
commentwin = ((editwin.indexOf('comment') >= 0) ? true : false);
|
|
|
|
if(commentwin) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let commentid = editwin.substring(editwin.lastIndexOf('-') + 1);
|
2018-12-15 22:03:20 +00:00
|
|
|
$("#comment-edit-text-" + commentid).addClass("expanded");
|
2017-07-14 00:04:58 +00:00
|
|
|
}
|
2016-08-10 08:35:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-03 02:06:36 +00:00
|
|
|
if(reply && reply.length) {
|
2011-11-09 08:29:14 +00:00
|
|
|
reply = bin2hex(reply);
|
2017-09-26 11:02:11 +00:00
|
|
|
$('#profile-rotator').show();
|
2015-08-26 02:23:21 +00:00
|
|
|
$.get('{{$baseurl}}/linkinfo?f=&binurl=' + reply, function(data) {
|
2016-08-10 08:35:58 +00:00
|
|
|
if(commentwin) {
|
2016-08-10 05:52:14 +00:00
|
|
|
$(editwin).val( $(editwin).val() + data );
|
2017-09-26 11:02:11 +00:00
|
|
|
$('#profile-rotator').hide();
|
2016-08-10 08:35:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!editor) $("#profile-jot-text").val("");
|
|
|
|
initEditor(function(){
|
|
|
|
addeditortext(data);
|
2020-09-25 10:24:51 +00:00
|
|
|
preview_post();
|
2017-09-26 11:02:11 +00:00
|
|
|
$('#profile-rotator').hide();
|
2016-08-10 08:35:58 +00:00
|
|
|
});
|
|
|
|
}
|
2010-08-03 02:06:36 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2010-07-23 05:41:45 +00:00
|
|
|
|
2011-10-24 22:47:17 +00:00
|
|
|
function itemTag(id) {
|
2013-05-08 08:23:17 +00:00
|
|
|
reply = prompt("{{$term}}");
|
2011-10-24 22:47:17 +00:00
|
|
|
if(reply && reply.length) {
|
2011-10-25 00:00:22 +00:00
|
|
|
reply = reply.replace('#','');
|
2011-10-24 22:47:17 +00:00
|
|
|
if(reply.length) {
|
2011-11-11 01:11:55 +00:00
|
|
|
|
|
|
|
commentBusy = true;
|
|
|
|
$('body').css('cursor', 'wait');
|
|
|
|
|
2013-05-08 08:23:17 +00:00
|
|
|
$.get('{{$baseurl}}/tagger/' + id + '?term=' + reply);
|
2011-11-11 01:11:55 +00:00
|
|
|
if(timer) clearTimeout(timer);
|
2018-01-04 10:31:48 +00:00
|
|
|
timer = setTimeout(updateInit,3000);
|
2011-11-11 01:11:55 +00:00
|
|
|
liking = 1;
|
2011-10-24 22:47:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-11 03:54:48 +00:00
|
|
|
function itemCancel() {
|
|
|
|
$("#jot-title").val('');
|
|
|
|
$("#profile-jot-text").val('');
|
2020-02-27 04:48:28 +00:00
|
|
|
$(".jot-poll-option input").val('');
|
2018-05-20 09:02:18 +00:00
|
|
|
$("#jot-category").tagsinput('removeAll');
|
|
|
|
|
2018-05-20 07:23:44 +00:00
|
|
|
postSaveChanges('clean');
|
|
|
|
|
|
|
|
{{if $reset}}
|
|
|
|
$(".jothidden").hide();
|
|
|
|
$("#profile-jot-text").removeClass('jot-expanded');
|
|
|
|
$("#profile-jot-reset").addClass('d-none');
|
2020-02-27 04:48:28 +00:00
|
|
|
$("#jot-poll-wrap").addClass('d-none');
|
2018-05-20 10:30:08 +00:00
|
|
|
$("#jot-preview-content").html('').hide();
|
2018-05-20 07:23:44 +00:00
|
|
|
editor = false;
|
|
|
|
{{else}}
|
2018-05-11 03:54:48 +00:00
|
|
|
window.history.back();
|
2018-05-20 07:23:44 +00:00
|
|
|
{{/if}}
|
2018-05-11 03:54:48 +00:00
|
|
|
}
|
|
|
|
|
2012-03-14 01:13:03 +00:00
|
|
|
function itemFiler(id) {
|
2017-03-17 13:22:10 +00:00
|
|
|
if($('#item-filer-dialog').length)
|
|
|
|
$('#item-filer-dialog').remove();
|
2015-03-12 21:57:00 +00:00
|
|
|
|
2012-03-28 08:49:34 +00:00
|
|
|
$.get('filer/', function(data){
|
2017-03-17 13:22:10 +00:00
|
|
|
$('body').append(data);
|
|
|
|
$('#item-filer-dialog').modal('show');
|
2012-03-28 08:49:34 +00:00
|
|
|
$("#filer_save").click(function(e){
|
|
|
|
e.preventDefault();
|
|
|
|
reply = $("#id_term").val();
|
|
|
|
if(reply && reply.length) {
|
|
|
|
commentBusy = true;
|
|
|
|
$('body').css('cursor', 'wait');
|
2018-01-04 10:31:48 +00:00
|
|
|
$.get('{{$baseurl}}/filer/' + id + '?term=' + reply, updateInit);
|
2012-03-28 08:49:34 +00:00
|
|
|
liking = 1;
|
2017-03-17 13:22:10 +00:00
|
|
|
$('#item-filer-dialog').modal('hide');
|
2012-03-28 08:49:34 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2012-03-14 01:13:03 +00:00
|
|
|
}
|
|
|
|
|
2014-02-05 01:12:13 +00:00
|
|
|
function itemBookmark(id) {
|
|
|
|
$.get('{{$baseurl}}/bookmarks?f=&item=' + id);
|
|
|
|
if(timer) clearTimeout(timer);
|
2018-01-04 10:31:48 +00:00
|
|
|
timer = setTimeout(updateInit,1000);
|
2014-02-05 01:12:13 +00:00
|
|
|
}
|
|
|
|
|
2014-05-30 03:09:21 +00:00
|
|
|
function itemAddToCal(id) {
|
2019-05-13 01:20:37 +00:00
|
|
|
$.get('{{$baseurl}}/calendar/add/' + id);
|
2014-05-30 03:09:21 +00:00
|
|
|
if(timer) clearTimeout(timer);
|
2018-01-04 10:31:48 +00:00
|
|
|
timer = setTimeout(updateInit,1000);
|
2014-05-30 03:09:21 +00:00
|
|
|
}
|
|
|
|
|
2015-02-11 03:10:18 +00:00
|
|
|
function toggleVoting() {
|
|
|
|
if($('#jot-consensus').val() > 0) {
|
|
|
|
$('#jot-consensus').val(0);
|
2016-04-30 19:59:02 +00:00
|
|
|
$('#profile-voting, #profile-voting-sub').removeClass('fa-check-square-o').addClass('fa-square-o');
|
2015-02-11 03:10:18 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#jot-consensus').val(1);
|
2016-04-30 19:59:02 +00:00
|
|
|
$('#profile-voting, #profile-voting-sub').removeClass('fa-square-o').addClass('fa-check-square-o');
|
2015-02-11 03:10:18 +00:00
|
|
|
}
|
|
|
|
}
|
2014-02-05 01:12:13 +00:00
|
|
|
|
2016-06-03 05:06:19 +00:00
|
|
|
function jotReact(id,icon) {
|
|
|
|
if(id && icon) {
|
|
|
|
$.get('{{$baseurl}}/react?f=&postid=' + id + '&emoji=' + icon);
|
|
|
|
if(timer) clearTimeout(timer);
|
2018-01-04 10:31:48 +00:00
|
|
|
timer = setTimeout(updateInit,1000);
|
2016-06-03 05:06:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-20 07:33:17 +00:00
|
|
|
function jotClearLocation() {
|
2022-09-16 10:57:04 +00:00
|
|
|
$('#jot-lat').val('');
|
|
|
|
$('#jot-lon').val('');
|
|
|
|
$('#jot-location').val('');
|
|
|
|
jotLocateStatus();
|
2023-01-01 05:41:31 +00:00
|
|
|
jotCheckinStatus();
|
|
|
|
jotCheckoutStatus();
|
2010-10-20 07:33:17 +00:00
|
|
|
}
|
|
|
|
|
2023-02-27 20:10:34 +00:00
|
|
|
/* start initializeEmbedFileDialog function */
|
2023-02-17 17:54:21 +00:00
|
|
|
let initializeEmbedFileDialog = function () {
|
2023-02-18 13:39:35 +00:00
|
|
|
getFileDirList();
|
2023-02-19 17:36:48 +00:00
|
|
|
$('#embedFileModal').modal('show');
|
2023-02-18 14:07:08 +00:00
|
|
|
};
|
2023-02-27 20:10:34 +00:00
|
|
|
/* end initializeEmbedFileDialog function */
|
2016-06-13 00:10:37 +00:00
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let initializeEmbedPhotoDialog = function () {
|
2016-06-13 00:10:37 +00:00
|
|
|
$('.embed-photo-selected-photo').each(function (index) {
|
|
|
|
$(this).removeClass('embed-photo-selected-photo');
|
|
|
|
});
|
|
|
|
getPhotoAlbumList();
|
|
|
|
$('#embedPhotoModalBodyAlbumDialog').off('click');
|
2017-04-13 21:20:09 +00:00
|
|
|
$('#embedPhotoModal').modal('show');
|
2016-06-13 00:10:37 +00:00
|
|
|
};
|
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let choosePhotoFromAlbum = function (album) {
|
2016-06-13 00:10:37 +00:00
|
|
|
$.post("embedphotos/album", {name: album},
|
|
|
|
function(data) {
|
2023-02-27 21:52:11 +00:00
|
|
|
|
|
|
|
alert(JSON.stringify(data));
|
|
|
|
|
2016-06-13 00:10:37 +00:00
|
|
|
if (data['status']) {
|
2016-08-16 00:18:42 +00:00
|
|
|
$('#embedPhotoModalLabel').html("{{$modalchooseimages}}");
|
2016-06-13 00:10:37 +00:00
|
|
|
$('#embedPhotoModalBodyAlbumDialog').html('\
|
2017-03-22 12:15:53 +00:00
|
|
|
<div><div class="nav nav-pills flex-column">\n\
|
|
|
|
<li class="nav-item"><a class="nav-link" href="#" onclick="initializeEmbedPhotoDialog();return false;">\n\
|
2016-06-13 00:10:37 +00:00
|
|
|
<i class="fa fa-chevron-left"></i> \n\
|
|
|
|
{{$modaldiffalbum}}\n\
|
|
|
|
</a>\n\
|
|
|
|
</li>\n\
|
2017-03-22 12:15:53 +00:00
|
|
|
</div><br></div>')
|
2016-06-13 00:10:37 +00:00
|
|
|
$('#embedPhotoModalBodyAlbumDialog').append(data['content']);
|
|
|
|
$('#embedPhotoModalBodyAlbumDialog').click(function (evt) {
|
|
|
|
evt.preventDefault();
|
2022-02-18 01:38:12 +00:00
|
|
|
let image = document.getElementById(evt.target.id);
|
2016-06-13 00:10:37 +00:00
|
|
|
if (typeof($(image).parent()[0]) !== 'undefined') {
|
2022-02-18 01:38:12 +00:00
|
|
|
let imageparent = document.getElementById($(image).parent()[0].id);
|
2016-06-13 00:10:37 +00:00
|
|
|
$(imageparent).toggleClass('embed-photo-selected-photo');
|
2022-02-18 01:38:12 +00:00
|
|
|
let href = $(imageparent).attr('href');
|
2023-02-27 22:05:04 +00:00
|
|
|
$.post("embedphotos/photolink", {href: href},
|
2016-06-13 00:10:37 +00:00
|
|
|
function(ddata) {
|
2023-02-27 22:10:22 +00:00
|
|
|
if (ddata['status']) {
|
2023-02-28 14:21:04 +00:00
|
|
|
addeditortext(ddata['photolink']);
|
2017-08-02 02:02:42 +00:00
|
|
|
preview_post();
|
2016-06-13 00:10:37 +00:00
|
|
|
} else {
|
2016-08-16 00:18:42 +00:00
|
|
|
window.console.log("{{$modalerrorlink}}" + ':' + ddata['errormsg']);
|
2016-06-13 00:10:37 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
2018-02-26 03:25:00 +00:00
|
|
|
'json');
|
|
|
|
$('#embedPhotoModalBodyAlbumDialog').html('');
|
|
|
|
$('#embedPhotoModalBodyAlbumDialog').off('click');
|
|
|
|
$('#embedPhotoModal').modal('hide');
|
|
|
|
}
|
2016-06-13 00:10:37 +00:00
|
|
|
});
|
2018-02-26 03:25:00 +00:00
|
|
|
$('#embedPhotoModalBodyAlbumListDialog').addClass('d-none');
|
|
|
|
$('#embedPhotoModalBodyAlbumDialog').removeClass('d-none');
|
2016-06-13 00:10:37 +00:00
|
|
|
} else {
|
2016-08-16 00:18:42 +00:00
|
|
|
window.console.log("{{$modalerroralbum}} " + JSON.stringify(album) + ':' + data['errormsg']);
|
2016-06-13 00:10:37 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
'json');
|
|
|
|
};
|
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let getPhotoAlbumList = function () {
|
2016-06-13 00:10:37 +00:00
|
|
|
$.post("embedphotos/albumlist", {},
|
|
|
|
function(data) {
|
|
|
|
if (data['status']) {
|
2022-02-18 01:38:12 +00:00
|
|
|
let albums = data['albumlist']; //JSON.parse(data['albumlist']);
|
2016-08-16 00:18:42 +00:00
|
|
|
$('#embedPhotoModalLabel').html("{{$modalchoosealbum}}");
|
2017-03-22 12:15:53 +00:00
|
|
|
$('#embedPhotoModalBodyAlbumList').html('<ul class="nav nav-pills flex-column"></ul>');
|
2022-02-18 01:38:12 +00:00
|
|
|
for(let i=0; i<albums.length; i++) {
|
|
|
|
let albumName = albums[i].text;
|
|
|
|
let jsAlbumName = albums[i].jstext;
|
|
|
|
let albumLink = '<li class="nav-item">';
|
2017-03-22 12:15:53 +00:00
|
|
|
albumLink += '<a class="nav-link" href="#" onclick="choosePhotoFromAlbum(\'' + jsAlbumName + '\'); return false;">' + albumName + '</a>';
|
2016-06-13 00:10:37 +00:00
|
|
|
albumLink += '</li>';
|
|
|
|
$('#embedPhotoModalBodyAlbumList').find('ul').append(albumLink);
|
|
|
|
}
|
2017-03-22 12:15:53 +00:00
|
|
|
$('#embedPhotoModalBodyAlbumDialog').addClass('d-none');
|
|
|
|
$('#embedPhotoModalBodyAlbumListDialog').removeClass('d-none');
|
2016-06-13 00:10:37 +00:00
|
|
|
} else {
|
2016-08-16 00:18:42 +00:00
|
|
|
window.console.log("{{$modalerrorlist}}" + ':' + data['errormsg']);
|
2016-06-13 00:10:37 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
'json');
|
|
|
|
};
|
2016-07-24 21:33:34 +00:00
|
|
|
|
2023-03-04 13:38:20 +00:00
|
|
|
{{* start new createThumbnail *}}
|
2023-03-04 14:15:30 +00:00
|
|
|
function createThumbnail(sendplain) {
|
2023-03-04 13:38:20 +00:00
|
|
|
const para = document.createElement("p");
|
2023-03-04 14:15:30 +00:00
|
|
|
para.innerHTML = `<iframe id="special" src="${sendplain}" style="border:none" ></iframe>`;
|
2023-03-04 13:38:20 +00:00
|
|
|
const canvas = document.getElementById("special");
|
|
|
|
const dataURL = canvas.toDataURL();
|
2023-03-04 13:57:12 +00:00
|
|
|
console.log(dataURL);
|
2023-03-04 13:38:20 +00:00
|
|
|
return dataURL;
|
|
|
|
}
|
|
|
|
{{* end new createThumbnail *}}
|
|
|
|
|
2023-02-27 17:19:08 +00:00
|
|
|
{{* start new setEmbedFiles *}}
|
2023-02-27 19:04:26 +00:00
|
|
|
function setEmbedFiles(send) {
|
2023-02-27 17:19:08 +00:00
|
|
|
|
2023-02-28 20:28:29 +00:00
|
|
|
alert(`Send: ${send}`);
|
2023-02-28 21:05:43 +00:00
|
|
|
addeditortext(`${send}`);
|
2023-02-27 20:10:34 +00:00
|
|
|
preview_post();
|
2023-02-27 17:19:08 +00:00
|
|
|
}
|
|
|
|
{{* end new setEmbedFiles *}}
|
2023-02-26 20:10:49 +00:00
|
|
|
|
2023-02-27 17:19:08 +00:00
|
|
|
{{* start new getFileMimeType *}}
|
2023-02-26 23:44:46 +00:00
|
|
|
function getFileMimeType(result, address) {
|
2023-02-26 20:15:12 +00:00
|
|
|
|
2023-02-26 20:45:27 +00:00
|
|
|
switch(result.filetype) {
|
2023-02-26 23:59:35 +00:00
|
|
|
case "image/jpeg":
|
2023-02-27 01:33:14 +00:00
|
|
|
case "image/png":
|
|
|
|
case "image/gif":
|
2023-03-02 18:20:38 +00:00
|
|
|
//case "image/svg+xml": not working
|
2023-03-03 21:21:53 +00:00
|
|
|
let send = `[zmg]${baseurl}/cloud/${address}/${result.display_path}[/zmg]`;
|
2023-03-02 14:19:39 +00:00
|
|
|
{{*let send = `[zrl=${baseurl}/cloud/${address}/${result.hash}][/zrl][zmg]${baseurl}/cloud/${address}/{result.display_path}[/zmg]`;*}}
|
2023-02-28 20:39:43 +00:00
|
|
|
return `<li onclick ="setEmbedFiles('${send}')" data-bs-dismiss="modal" ><img src="/cloud/${address}/${result.display_path}" class="img-fluid img-thumbnail" ></li>`;
|
2023-02-27 01:33:14 +00:00
|
|
|
case "video/mp4":
|
2023-02-28 16:28:34 +00:00
|
|
|
case "video/webm":
|
2023-03-02 16:47:08 +00:00
|
|
|
case "video/ogg":
|
2023-03-03 21:56:37 +00:00
|
|
|
let sendmp4 = `[video]/cloud/${address}/${result.display_path}[/video]`;
|
2023-03-03 19:28:55 +00:00
|
|
|
return `<li class="border rounded my-1 p-2" ><h4 onclick ="setEmbedFiles('${sendmp4}')" data-bs-dismiss="modal" >${result.filename}<i class="float-end">{{$clicktitle}}</i></h4><video controls="controls" preload="auto" src="/cloud/${address}/${result.display_path}" style="width:100%;" /></li>`;
|
2023-03-03 21:56:37 +00:00
|
|
|
case "audio/mpeg":
|
2023-03-02 16:52:45 +00:00
|
|
|
case "audio/wav":
|
|
|
|
case "audio/ogg":
|
2023-02-28 21:10:17 +00:00
|
|
|
let sendmpeg = `[audio]/cloud/${address}/${result.display_path}[/audio]`;
|
2023-02-28 17:11:56 +00:00
|
|
|
return `<li class="border rounded my-1 p-2" onclick ="setEmbedFiles('${sendmpeg}')" data-bs-dismiss="modal" ><h4>${result.filename}</h4><img src="/images/mp3.png" class="img-fluid my-2" ><audio src="/cloud/${address}/${result.display_path}" controls="controls" preload="none" /></li>`;
|
2023-02-27 02:50:55 +00:00
|
|
|
case "application/json":
|
2023-03-02 17:56:42 +00:00
|
|
|
//case "text/html":
|
|
|
|
//case "text/vnd.abc": these 2 don't work, they open the download dialog
|
2023-02-27 13:55:30 +00:00
|
|
|
case "text/plain":
|
2023-03-04 13:44:27 +00:00
|
|
|
let sendplain = `/cloud/${address}/${result.display_path}`;
|
|
|
|
let plainTmb = createThumbnail(sendplain);
|
2023-03-04 13:54:25 +00:00
|
|
|
alert(plainTmb);
|
2023-03-04 14:19:18 +00:00
|
|
|
return '';
|
2023-03-04 13:38:20 +00:00
|
|
|
{{*return`<li class="border rounded my-1 p-2" onclick ="setEmbedFiles('${sendplain}')" data-bs-dismiss="modal" ><h4>${result.filename}<i class="float-end">{{$clicktitle}}</i></h4><iframe src="/cloud/${address}/${result.display_path}" ></iframe></li>`;*}}
|
|
|
|
|
2023-03-04 13:53:08 +00:00
|
|
|
return`<li class="border rounded my-1 p-2" onclick ="setEmbedFiles('${sendplain}')" data-bs-dismiss="modal" ><h4>${result.filename}<i class="float-end">{{$clicktitle}}</i></h4><img src="${plainTmb}" ></img></li>`;
|
2023-02-26 20:45:27 +00:00
|
|
|
default:
|
2023-02-27 01:56:47 +00:00
|
|
|
return;
|
2023-02-26 20:45:27 +00:00
|
|
|
}
|
|
|
|
}
|
2023-02-26 20:10:49 +00:00
|
|
|
{{* end new getFileMimeType *}}
|
|
|
|
|
2023-02-18 13:39:35 +00:00
|
|
|
{{* start new getFileDirList *}}
|
|
|
|
let getFileDirList = function () {
|
2023-02-19 22:18:36 +00:00
|
|
|
$.post("embedfiles", {},
|
2023-02-22 16:05:32 +00:00
|
|
|
function(data) {
|
2023-02-22 16:45:28 +00:00
|
|
|
// alert(JSON.stringify(data));
|
2023-02-22 15:45:11 +00:00
|
|
|
|
2023-02-22 15:50:00 +00:00
|
|
|
let success = data.success;
|
2023-02-26 20:05:48 +00:00
|
|
|
let address = data.address;
|
2023-02-22 15:45:11 +00:00
|
|
|
let results = data.content;
|
2023-02-26 22:27:59 +00:00
|
|
|
//console.log(JSON.stringify(results));
|
2023-02-22 15:50:00 +00:00
|
|
|
|
|
|
|
if (data.success) {
|
2023-02-24 16:53:43 +00:00
|
|
|
|
|
|
|
// results[0] breaks the loop because it has no object before it.
|
|
|
|
// we'll define it here and start the loop at 1
|
2023-02-26 18:20:44 +00:00
|
|
|
let content = `<button class="btn" type="button" data-bs-toggle="collapse" data-bs-target="#embedDir-0" aria-expanded="false" aria-controls="embedDir-0"><i class="fa fa-folder-o fa-lg me-1"></i>${results[0].filename}</button>`;
|
2023-02-24 21:51:08 +00:00
|
|
|
|
2023-02-26 16:00:21 +00:00
|
|
|
for(let i=1; i<(results.length); i++) {
|
2023-02-24 17:54:30 +00:00
|
|
|
|
2023-02-24 18:10:09 +00:00
|
|
|
if (results[i].is_dir === "1" && results[(i-1)].is_dir === "1") {
|
2023-02-24 22:36:53 +00:00
|
|
|
// is_dir preceded by another is_dir = if child directory add opening <ul> to the beginning of the button
|
2023-02-26 19:22:04 +00:00
|
|
|
if(results[i].folder === results[(i-1)].hash){ content += `<ul class="collapse list-unstyled" id="embedDir-${(i-1)}">`;}
|
2023-02-26 18:22:36 +00:00
|
|
|
content += `<button class="btn" type="button" data-bs-toggle="collapse" data-bs-target="#embedDir-${i}" aria-expanded="false" aria-controls="embedDir-${i}"><i class="fa fa-folder-o fa-lg me-1"></i>${results[i].filename}</button>`;
|
2023-02-24 22:04:33 +00:00
|
|
|
continue;
|
2023-02-24 21:45:25 +00:00
|
|
|
|
2023-02-24 18:20:03 +00:00
|
|
|
} else if (results[i].is_dir === '1' && results[(i-1)].is_dir !== '1') {
|
2023-02-24 22:54:51 +00:00
|
|
|
// is_dir preceded by a file = if directory is not a sibling add closing </ul> to the beginning of the button
|
2023-02-24 23:51:46 +00:00
|
|
|
if(results[i].folder !== results[(i-1)].folder){ content += `</ul>`;}
|
2023-02-26 18:22:36 +00:00
|
|
|
content += `<button class="btn" type="button" data-bs-toggle="collapse" data-bs-target="#embedDir-${i}" aria-expanded="false" aria-controls="embedDir-${i}"><i class="fa fa-folder-o fa-lg me-1"></i>${results[i].filename}</button>`;
|
2023-02-24 22:04:33 +00:00
|
|
|
continue;
|
2023-02-24 14:30:54 +00:00
|
|
|
|
2023-02-24 18:10:09 +00:00
|
|
|
} else if (results[i].is_dir !== '1' && results[(i-1)].is_dir === '1') {
|
2023-02-25 00:02:07 +00:00
|
|
|
// file preceded by a is_dir = only add opening <ul> to the beginning of file if button is not a sibling
|
2023-02-26 19:22:04 +00:00
|
|
|
if(results[i].folder !== results[(i-1)].folder){content += `<ul class="collapse list-unstyled" id="embedDir-${(i-1)}">`}
|
2023-02-27 00:03:00 +00:00
|
|
|
//content += `<li><img src="/cloud/${address}/${results[i].display_path}" class="img-fluid img-thumbnail" ></li>`;
|
2023-02-27 00:04:12 +00:00
|
|
|
let result = results[i];
|
2023-02-27 00:03:00 +00:00
|
|
|
content += getFileMimeType(result, address);
|
2023-02-24 22:04:33 +00:00
|
|
|
continue;
|
2023-02-24 14:30:54 +00:00
|
|
|
|
2023-02-24 20:59:22 +00:00
|
|
|
} else if (results[i].is_dir !== '1' && results[(i-1)].is_dir !== '1') {
|
2023-02-24 14:30:54 +00:00
|
|
|
// file preceded by another file = just the line item
|
2023-02-27 00:03:00 +00:00
|
|
|
//content += `<li><img src="/cloud/${address}/${results[i].display_path}" class="img-fluid img-thumbnail" ></li>`;
|
2023-02-26 20:23:06 +00:00
|
|
|
let result = results[i];
|
2023-02-27 00:03:00 +00:00
|
|
|
content += getFileMimeType(result, address);
|
2023-02-24 22:04:33 +00:00
|
|
|
continue;
|
2023-02-24 14:30:54 +00:00
|
|
|
}
|
2023-02-24 17:56:07 +00:00
|
|
|
|
2023-02-24 18:10:09 +00:00
|
|
|
} // end new loop
|
2023-02-22 16:45:28 +00:00
|
|
|
|
2023-02-25 01:18:46 +00:00
|
|
|
$('#embedFileDirModalBody').html( content);
|
2023-02-22 19:27:55 +00:00
|
|
|
|
2023-02-24 15:07:22 +00:00
|
|
|
} else {
|
2023-02-22 16:05:32 +00:00
|
|
|
window.console.log(`{{$modalerrorlist}} : data['errormsg']`);
|
2023-02-18 13:39:35 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
2023-02-19 22:18:36 +00:00
|
|
|
'json');
|
2023-02-18 14:17:28 +00:00
|
|
|
};
|
2023-02-18 13:39:35 +00:00
|
|
|
{{* end new getFileDirList *}}
|
|
|
|
|
2017-07-14 00:04:58 +00:00
|
|
|
// initialize drag-drop
|
2016-07-24 21:33:34 +00:00
|
|
|
function DragDropUploadInit() {
|
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let filedrag = $("#profile-jot-text");
|
2016-07-24 21:33:34 +00:00
|
|
|
|
2017-07-14 00:04:58 +00:00
|
|
|
// file drop
|
2016-07-24 21:33:34 +00:00
|
|
|
filedrag.on("dragover", DragDropUploadFileHover);
|
|
|
|
filedrag.on("dragleave", DragDropUploadFileHover);
|
|
|
|
filedrag.on("drop", DragDropUploadFileSelectHandler);
|
|
|
|
}
|
|
|
|
|
2018-07-20 08:42:16 +00:00
|
|
|
// file drag hover
|
|
|
|
function DragDropUploadFileHover(e) {
|
|
|
|
if(e.type == 'dragover')
|
|
|
|
$(e.target).addClass('hover');
|
|
|
|
else
|
|
|
|
$(e.target).removeClass('hover');
|
|
|
|
}
|
2016-07-24 21:33:34 +00:00
|
|
|
|
|
|
|
// file selection
|
|
|
|
function DragDropUploadFileSelectHandler(e) {
|
|
|
|
|
|
|
|
// cancel event and hover styling
|
|
|
|
DragDropUploadFileHover(e);
|
2017-07-14 00:04:58 +00:00
|
|
|
// open editor if it isn't yet initialised
|
2020-09-24 00:59:09 +00:00
|
|
|
if (! editor) {
|
2018-07-20 08:42:16 +00:00
|
|
|
enableOnUser();
|
2017-07-14 00:04:58 +00:00
|
|
|
}
|
|
|
|
linkdrop(e);
|
2016-07-24 21:33:34 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-02-27 04:48:28 +00:00
|
|
|
function initPoll() {
|
|
|
|
$('#jot-poll-wrap').toggleClass('d-none');
|
|
|
|
}
|
|
|
|
|
|
|
|
function jotAddOption() {
|
2022-02-18 01:38:12 +00:00
|
|
|
let option = '<div class="jot-poll-option form-group"><input class="w-100 border-0" name="poll_answers[]" type="text" value="" placeholder="Option"><div class="poll-option-close"><i class="fa fa-close"></i></div></div>';
|
2020-02-27 04:48:28 +00:00
|
|
|
$('#jot-poll-options').append(option);
|
|
|
|
}
|
|
|
|
|
|
|
|
function jotRemoveOption(e) {
|
|
|
|
$(this).closest('.jot-poll-option').remove();
|
|
|
|
}
|
|
|
|
|
2022-04-21 21:46:21 +00:00
|
|
|
function initRecipe() {
|
|
|
|
$('#jot-recipe-wrap').toggleClass('d-none');
|
|
|
|
}
|
|
|
|
|
|
|
|
function jotAddIngredient() {
|
|
|
|
let option = '<div class="jot-ingredient form-group"><input class="w-100 border-0" name="poll_answers[]" type="text" value="" placeholder="Option"><div class="poll-option-close"><i class="fa fa-close"></i></div></div>';
|
|
|
|
$('#jot-poll-options').append(option);
|
|
|
|
}
|
|
|
|
|
|
|
|
function jotRemoveIngedient(e) {
|
|
|
|
$(this).closest('.jot-ingredient').remove();
|
|
|
|
}
|
|
|
|
|
2018-05-20 07:23:44 +00:00
|
|
|
function postSaveChanges(action) {
|
2018-04-10 09:17:20 +00:00
|
|
|
if({{$auto_save_draft}}) {
|
2018-04-10 09:37:57 +00:00
|
|
|
|
2022-02-18 01:38:12 +00:00
|
|
|
let doctype = $('#jot-webpage').val();
|
|
|
|
let postid = '-' + doctype + '-' + $('#jot-postid').val();
|
2018-04-26 04:32:34 +00:00
|
|
|
|
2018-04-10 09:17:20 +00:00
|
|
|
if(action != 'clean') {
|
2018-04-26 04:32:34 +00:00
|
|
|
localStorage.setItem("post_title" + postid, $("#jot-title").val());
|
|
|
|
localStorage.setItem("post_body" + postid, $("#profile-jot-text").val());
|
2018-04-10 09:37:57 +00:00
|
|
|
if($("#jot-category").length)
|
2018-05-11 03:54:48 +00:00
|
|
|
localStorage.setItem("post_category" + postid, $("#jot-category").val());
|
2018-04-10 09:17:20 +00:00
|
|
|
}
|
2018-04-08 18:18:10 +00:00
|
|
|
|
2018-04-10 09:17:20 +00:00
|
|
|
if(action == 'start') {
|
|
|
|
postSaveTimer = setTimeout(function () {
|
|
|
|
postSaveChanges('start');
|
|
|
|
},10000);
|
|
|
|
}
|
2018-04-08 18:18:10 +00:00
|
|
|
|
2018-04-10 09:17:20 +00:00
|
|
|
if(action == 'stop') {
|
|
|
|
clearTimeout(postSaveTimer);
|
|
|
|
postSaveTimer = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(action == 'clean') {
|
|
|
|
clearTimeout(postSaveTimer);
|
|
|
|
postSaveTimer = null;
|
2018-04-26 04:32:34 +00:00
|
|
|
localStorage.removeItem("post_title" + postid);
|
|
|
|
localStorage.removeItem("post_body" + postid);
|
|
|
|
localStorage.removeItem("post_category" + postid);
|
2018-04-08 23:44:21 +00:00
|
|
|
}
|
2018-04-08 18:18:10 +00:00
|
|
|
}
|
2023-01-01 08:13:37 +00:00
|
|
|
}
|
2018-04-10 09:17:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
</script>
|