fix a warning and suggestions for pullrequest

* fix indentation to tabs
* remove unneeded calls for dropzone.min.js and dropzone.min.css
* removed debug output
This commit is contained in:
Jakobus Schürz 2023-03-13 10:37:12 +01:00
parent 6a7f17559e
commit 359ad6ff5a
9 changed files with 164 additions and 141 deletions

View File

@ -29,6 +29,7 @@
"asika/simple-console": "^1.0", "asika/simple-console": "^1.0",
"bacon/bacon-qr-code": "^2.0.0", "bacon/bacon-qr-code": "^2.0.0",
"divineomega/password_exposed": "^2.8", "divineomega/password_exposed": "^2.8",
"enyo/dropzone": "^5.9",
"ezyang/htmlpurifier": "^4.7", "ezyang/htmlpurifier": "^4.7",
"friendica/json-ld": "^1.0", "friendica/json-ld": "^1.0",
"geekwright/po": "^2.0", "geekwright/po": "^2.0",
@ -72,8 +73,7 @@
"npm-asset/textcomplete": "^0.18.2", "npm-asset/textcomplete": "^0.18.2",
"npm-asset/typeahead.js": "^0.11.1", "npm-asset/typeahead.js": "^0.11.1",
"kornrunner/blurhash": "^1.2", "kornrunner/blurhash": "^1.2",
"psr/clock": "^1.0", "psr/clock": "^1.0"
"enyo/dropzone": "^5.9"
}, },
"repositories": [ "repositories": [
{ {

38
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "5af9ac9003f4653f3aa1860dd5a4d821", "content-hash": "c9e005c79c8556215c30a66c470659eb",
"packages": [ "packages": [
{ {
"name": "asika/simple-console", "name": "asika/simple-console",
@ -550,6 +550,42 @@
"description": "This PHP package provides a `password_exposed` helper function, that uses the haveibeenpwned.com API to check if a password has been exposed in a data breach.", "description": "This PHP package provides a `password_exposed` helper function, that uses the haveibeenpwned.com API to check if a password has been exposed in a data breach.",
"time": "2019-01-25T12:00:28+00:00" "time": "2019-01-25T12:00:28+00:00"
}, },
{
"name": "enyo/dropzone",
"version": "v5.9.3",
"source": {
"type": "git",
"url": "https://github.com/dropzone/dropzone-packagist.git",
"reference": "286b2dc1f1195bd12169e4c9d5f91cfbe46e245f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dropzone/dropzone-packagist/zipball/286b2dc1f1195bd12169e4c9d5f91cfbe46e245f",
"reference": "286b2dc1f1195bd12169e4c9d5f91cfbe46e245f",
"shasum": ""
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matias Meno",
"email": "m@tias.me",
"homepage": "http://www.yesmeno.com"
}
],
"description": "Handles drag and drop of files for you.",
"homepage": "http://www.dropzonejs.com",
"keywords": [
"drag and drop",
"dragndrop",
"file upload",
"upload"
],
"time": "2021-09-21T17:03:36+00:00"
},
{ {
"name": "ezyang/htmlpurifier", "name": "ezyang/htmlpurifier",
"version": "v4.14.0", "version": "v4.14.0",

View File

@ -445,7 +445,6 @@ class Conversation
$this->page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js'));
$this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
$this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); $this->page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
$this->page->registerStylesheet(Theme::getPathForFile('vendor/enyo/dropzone/dist/min/dropzone.min.css'));
$live_update_div = ''; $live_update_div = '';

View File

@ -59,10 +59,8 @@ class ACL
$page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js')); $page->registerFooterScript(Theme::getPathForFile('asset/typeahead.js/dist/typeahead.bundle.js'));
$page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js')); $page->registerFooterScript(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.js'));
$page->registerFooterScript(Theme::getPathForFile('../vendor/enyo/dropzone/dist/min/dropzone.min.js'));
$page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css')); $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
$page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css')); $page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
$page->registerStylesheet(Theme::getPathForFile('../vendor/enyo/dropzone/dist/min/dropzone.min.css'));
$contacts = self::getValidMessageRecipientsForUser(DI::userSession()->getLocalUserId()); $contacts = self::getValidMessageRecipientsForUser(DI::userSession()->getLocalUserId());

View File

@ -164,7 +164,6 @@ class Compose extends BaseModule
$this->page->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/ajaxupload.js'));
$this->page->registerFooterScript(Theme::getPathForFile('js/linkPreview.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/linkPreview.js'));
$this->page->registerFooterScript(Theme::getPathForFile('js/compose.js')); $this->page->registerFooterScript(Theme::getPathForFile('js/compose.js'));
$this->page->registerFooterScript(Theme::getPathForFile('../vendor/enyo/dropzone/dist/min/dropzone.min.js'));
$contact = Contact::getById($a->getContactId()); $contact = Contact::getById($a->getContactId());
if ($this->pConfig->get(DI::userSession()->getLocalUserId(), 'system', 'set_creation_date')) { if ($this->pConfig->get(DI::userSession()->getLocalUserId(), 'system', 'set_creation_date')) {

View File

@ -1,11 +1,11 @@
<div class="generic-page-wrapper"> <div class="generic-page-wrapper">
<h2>{{$l10n.compose_title}}</h2> <h2>{{$l10n.compose_title}}</h2>
{{if $l10n.always_open_compose}} {{if $l10n.always_open_compose}}
<p>{{$l10n.always_open_compose nofilter}}</p> <p>{{$l10n.always_open_compose nofilter}}</p>
{{/if}} {{/if}}
<div id="profile-jot-wrapper"> <div id="profile-jot-wrapper">
<form class="comment-edit-form dropzone" data-item-id="{{$id}}" id="comment-edit-form-{{$id}}" action="compose/{{$type}}" method="post"> <form class="comment-edit-form dropzone" data-item-id="{{$id}}" id="comment-edit-form-{{$id}}" action="compose/{{$type}}" method="post">
{{*<!--<input type="hidden" name="return" value="{{$return_path}}" />-->*}} {{*<!--<input type="hidden" name="return" value="{{$return_path}}" />-->*}}
<input type="hidden" name="post_id_random" value="{{$rand_num}}" /> <input type="hidden" name="post_id_random" value="{{$rand_num}}" />
<input type="hidden" name="post_type" value="{{$posttype}}" /> <input type="hidden" name="post_type" value="{{$posttype}}" />
<input type="hidden" name="wall" value="{{$wall}}" /> <input type="hidden" name="wall" value="{{$wall}}" />
@ -13,11 +13,11 @@
<div id="jot-title-wrap"> <div id="jot-title-wrap">
<input type="text" name="title" id="jot-title" class="jothidden jotforms form-control" placeholder="{{$l10n.placeholdertitle}}" title="{{$l10n.placeholdertitle}}" value="{{$title}}" tabindex="1" dir="auto" /> <input type="text" name="title" id="jot-title" class="jothidden jotforms form-control" placeholder="{{$l10n.placeholdertitle}}" title="{{$l10n.placeholdertitle}}" value="{{$title}}" tabindex="1" dir="auto" />
</div> </div>
{{if $l10n.placeholdercategory}} {{if $l10n.placeholdercategory}}
<div id="jot-category-wrap"> <div id="jot-category-wrap">
<input name="category" id="jot-category" class="jothidden jotforms form-control" type="text" placeholder="{{$l10n.placeholdercategory}}" title="{{$l10n.placeholdercategory}}" value="{{$category}}" tabindex="2" dir="auto" /> <input name="category" id="jot-category" class="jothidden jotforms form-control" type="text" placeholder="{{$l10n.placeholdercategory}}" title="{{$l10n.placeholdercategory}}" value="{{$category}}" tabindex="2" dir="auto" />
</div> </div>
{{/if}} {{/if}}
<p class="comment-edit-bb-{{$id}} comment-icon-list"> <p class="comment-edit-bb-{{$id}} comment-icon-list">
<span> <span>
@ -55,12 +55,12 @@
<span role="presentation" class="form-inline"> <span role="presentation" class="form-inline">
<input type="text" name="location" class="form-control" id="jot-location" value="{{$location}}" placeholder="{{$l10n.location_set}}"/> <input type="text" name="location" class="form-control" id="jot-location" value="{{$location}}" placeholder="{{$l10n.location_set}}"/>
<button type="button" class="btn btn-sm template-icon" id="profile-location" <button type="button" class="btn btn-sm template-icon" id="profile-location"
data-title-set="{{$l10n.location_set}}" data-title-set="{{$l10n.location_set}}"
data-title-disabled="{{$l10n.location_disabled}}" data-title-disabled="{{$l10n.location_disabled}}"
data-title-unavailable="{{$l10n.location_unavailable}}" data-title-unavailable="{{$l10n.location_unavailable}}"
data-title-clear="{{$l10n.location_clear}}" data-title-clear="{{$l10n.location_clear}}"
title="{{$l10n.location_set}}" title="{{$l10n.location_set}}"
tabindex="6"> tabindex="6">
<i class="fa fa-map-marker" aria-hidden="true"></i> <i class="fa fa-map-marker" aria-hidden="true"></i>
</button> </button>
</span> </span>
@ -71,7 +71,7 @@
<span role="presentation" id="character-counter" class="grey text-info"></span> <span role="presentation" id="character-counter" class="grey text-info"></span>
<button type="button" class="btn btn-defaul" onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" tabindex="5"><i class="fa fa-eye"></i> {{$l10n.preview}}</button> <button type="button" class="btn btn-defaul" onclick="preview_comment({{$id}});" id="comment-edit-preview-link-{{$id}}" tabindex="5"><i class="fa fa-eye"></i> {{$l10n.preview}}</button>
<button type="submit" class="btn btn-primary" id="comment-edit-submit-{{$id}}" name="submit" tabindex="4"><i class="fa fa-envelope"></i> {{$l10n.submit}}</button> <button type="submit" class="btn btn-primary" id="comment-edit-submit-{{$id}}" name="submit" tabindex="4"><i class="fa fa-envelope"></i> {{$l10n.submit}}</button>
<div id="dz-previewsCompose" class="dropzone-previews"></div> <div id="dz-previewsCompose" class="dropzone-previews"></div>
</p> </p>
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div> <div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
@ -96,42 +96,41 @@
</div> </div>
</div> </div>
<script> <script>
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
var dropzoneCompose = new Dropzone( '#comment-edit-form-{{$id}}', { var dropzoneCompose = new Dropzone( '#comment-edit-form-{{$id}}', {
paramName: "userfile", // The name that will be used to transfer the file paramName: "userfile", // The name that will be used to transfer the file
maxFilesize: 2, // MB maxFilesize: 6, // MB - change this to use systemsettings
previewsContainer: '#dz-previewsCompose', previewsContainer: '#dz-previewsCompose',
preventDuplicates: true, preventDuplicates: true,
clickable: true, clickable: true,
thumbnailWidth: 100, thumbnailWidth: 100,
thumbnailHeight: 100, thumbnailHeight: 100,
url: "/media/photo/upload?response=url&album=", url: "/media/photo/upload?response=url&album=",
accept: function(file, done) { accept: function(file, done) {
done(); done();
}, },
init: function() { init: function() {
this.on("success", function(file, serverResponse) { this.on("success", function(file, serverResponse) {
var target = $('#comment-edit-text-{{$id}}') var target = $('#comment-edit-text-{{$id}}')
var resp = $(serverResponse).find('div#content').text() var resp = $(serverResponse).find('div#content').text()
if (target.setRangeText) { if (target.setRangeText) {
//if setRangeText function is supported by current browser //if setRangeText function is supported by current browser
target.setRangeText(" " + $.trim(resp) + " ") target.setRangeText(" " + $.trim(resp) + " ")
} else { } else {
target.focus() target.focus()
document.execCommand('insertText', false /*no UI*/, $.trim(resp)); document.execCommand('insertText', false /*no UI*/, $.trim(resp));
} }
}); });
}, },
}); });
$('#comment-edit-form-{{$id}}').on('paste', function(event){ $('#comment-edit-form-{{$id}}').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items; const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => { items.forEach((item) => {
if (item.kind === 'file') { if (item.kind === 'file') {
// adds the file to your dropzone instance // adds the file to your dropzone instance
console.log(item); dropzoneCompose.addFile(item.getAsFile())
dropzoneCompose.addFile(item.getAsFile()) }
} })
}) });
});
</script> </script>

View File

@ -61,49 +61,46 @@
<div class="comment-edit-end clear"></div> <div class="comment-edit-end clear"></div>
</form> </form>
<div id="dz-preview-{{$id}}" class="dropzone-preview"></div> <div id="dz-preview-{{$id}}" class="dropzone-preview"></div>
<div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div> <div id="comment-edit-preview-{{$id}}" class="comment-edit-preview" style="display:none;"></div>
</div> </div>
<script> <script>
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', { var dropzone{{$id}} = new Dropzone( '#comment-edit-wrapper-{{$id}}', {
paramName: "userfile", // The name that will be used to transfer the file paramName: "userfile", // The name that will be used to transfer the file
maxFilesize: 6, // MB maxFilesize: 6, // MB - change this to use systemsettings
previewsContainer: '#dz-preview-{{$id}}', previewsContainer: '#dz-preview-{{$id}}',
preventDuplicates: true, preventDuplicates: true,
clickable: true, clickable: true,
thumbnailWidth: 100, thumbnailWidth: 100,
thumbnailHeight: 100, thumbnailHeight: 100,
url: "/media/photo/upload?response=url&album=", url: "/media/photo/upload?response=url&album=",
accept: function(file, done) { accept: function(file, done) {
done(); done();
}, },
init: function() { init: function() {
this.on("success", function(file, serverResponse) { this.on("success", function(file, serverResponse) {
var target = $('#comment-edit-text-{{$id}}') var target = $('#comment-edit-text-{{$id}}')
var resp = $(serverResponse).find('div#content').text() var resp = $(serverResponse).find('div#content').text()
if (target.setRangeText) { if (target.setRangeText) {
//if setRangeText function is supported by current browser //if setRangeText function is supported by current browser
target.setRangeText(" " + $.trim(resp) + " ") target.setRangeText(" " + $.trim(resp) + " ")
} else { } else {
target.focus() target.focus()
document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " "); document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " ");
} }
}); });
}, },
}); });
$('#comment-edit-wrapper-{{$id}}').on('paste', function(event){ $('#comment-edit-wrapper-{{$id}}').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items; const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => { items.forEach((item) => {
if (item.kind === 'file') { if (item.kind === 'file') {
// adds the file to your dropzone instance // adds the file to your dropzone instance
console.log(item); dropzone{{$id}}.addFile(item.getAsFile())
dropzone{{$id}}.addFile(item.getAsFile()) }
} })
}) });
});
</script> </script>

View File

@ -55,7 +55,7 @@
media="screen" /> media="screen" />
<link rel="stylesheet" href="view/theme/frio/css/font-awesome.custom.css?v={{$smarty.const.FRIENDICA_VERSION}}" <link rel="stylesheet" href="view/theme/frio/css/font-awesome.custom.css?v={{$smarty.const.FRIENDICA_VERSION}}"
type="text/css" media="screen" /> type="text/css" media="screen" />
<link rel="stylesheet" href="/vendor/enyo/dropzone/dist/min/dropzone.min.css?v={{$smarty.const.FRIENDICA_VERSION}}" <link rel="stylesheet" href="vendor/enyo/dropzone/dist/min/dropzone.min.css?v={{$smarty.const.FRIENDICA_VERSION}}"
type="text/css" media="screen" /> type="text/css" media="screen" />
{{foreach $stylesheets as $stylesheetUrl => $media}} {{foreach $stylesheets as $stylesheetUrl => $media}}

View File

@ -152,7 +152,7 @@
<div id="jot-fbrowser-wrapper" class="minimize" aria-labelledby="jot-browser-link" role="tabpanel" aria-hidden="true"></div> <div id="jot-fbrowser-wrapper" class="minimize" aria-labelledby="jot-browser-link" role="tabpanel" aria-hidden="true"></div>
</form> </form>
<div id="dz-preview-jot" class="dropzone-preview"></div> <div id="dz-preview-jot" class="dropzone-preview"></div>
{{if $content}}<script type="text/javascript">initEditor();</script>{{/if}} {{if $content}}<script type="text/javascript">initEditor();</script>{{/if}}
</div> </div>
@ -180,47 +180,42 @@ can load different content into the jot moadl (e.g. the item edit jot)
}); });
</script> </script>
<script> <script>
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
var dropzoneJot = new Dropzone( '#jot-modal-body', { var dropzoneJot = new Dropzone( '#jot-modal-body', {
//var dropzone{{$id}} = new Dropzone( document.body, { paramName: "userfile", // The name that will be used to transfer the file
paramName: "userfile", // The name that will be used to transfer the file maxFilesize: 6, // MB - change this to use systemsettings
maxFilesize: 6, // MB previewsContainer: '#dz-preview-jot',
previewsContainer: '#dz-preview-jot', url: "/media/photo/upload?response=url&album=",
url: "/media/photo/upload?response=url&album=", accept: function(file, done) {
accept: function(file, done) { if (file.name == "justinbieber.jpg") {
if (file.name == "justinbieber.jpg") { done("Naha, you don't.");
done("Naha, you don't."); } else {
} else { done();
done(); }
} },
}, init: function() {
init: function() { this.on("success", function(file, serverResponse) {
this.on("success", function(file, serverResponse) { var target = $('#profile-jot-text')
var target = $('#profile-jot-text') var resp = $(serverResponse).find('div#content').text()
var resp = $(serverResponse).find('div#content').text() if (target.setRangeText) {
if (target.setRangeText) { //if setRangeText function is supported by current browser
//if setRangeText function is supported by current browser target.setRangeText(" " + $.trim(resp) + " ")
target.setRangeText(" " + $.trim(resp) + " ") } else {
} else { target.focus()
target.focus() document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " ");
document.execCommand('insertText', false /*no UI*/, " " + $.trim(resp) + " "); }
} });
}); },
}, });
});
// document.onpaste = function(event){
$('#jot-modal-body').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => {
if (item.kind === 'file') {
// adds the file to your dropzone instance
console.log(item);
dropzoneJot.addFile(item.getAsFile())
}
})
})
// document.onpaste = function(event){
$('#jot-modal-body').on('paste', function(event){
const items = (event.clipboardData || event.originalEvent.clipboardData).items;
items.forEach((item) => {
if (item.kind === 'file') {
// adds the file to your dropzone instance
dropzoneJot.addFile(item.getAsFile())
}
})
})
</script> </script>