mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 00:48:55 +00:00
[js_upload] Rewrite addon after ACl changes
- Move HTML to template - Remove redundant uninstall method - Enforce coding standards - Add type-hinting
This commit is contained in:
parent
75a7d6f1c7
commit
665c2c3337
2 changed files with 147 additions and 194 deletions
51
js_upload/templates/js_upload.tpl
Normal file
51
js_upload/templates/js_upload.tpl
Normal file
|
@ -0,0 +1,51 @@
|
|||
|
||||
<div id="js_upload">
|
||||
<noscript>
|
||||
<p>Please enable JavaScript to use file uploader.</p>
|
||||
<!-- or put a simple form for upload here -->
|
||||
</noscript>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var uploader = null;
|
||||
function createUploader() {
|
||||
uploader = new qq.FileUploader({
|
||||
element: document.getElementById('js_upload'),
|
||||
action: '{{$post_url}}',
|
||||
|
||||
template: '<div class="qq-uploader">' +
|
||||
'<div class="qq-upload-drop-area"><span>{{$drop_msg}}</span></div>' +
|
||||
'<div class="qq-upload-button">{{$upload_msg}}</div>' +
|
||||
'<ul class="qq-upload-list"></ul>' +
|
||||
'</div>',
|
||||
|
||||
// template for one item in file list
|
||||
fileTemplate: '<li>' +
|
||||
'<span class="qq-upload-file"></span>' +
|
||||
'<span class="qq-upload-spinner"></span>' +
|
||||
'<span class="qq-upload-size"></span>' +
|
||||
'<a class="qq-upload-cancel" href="#">{{$cancel}}</a>' +
|
||||
'<span class="qq-upload-failed-text">{{$failed}}</span>' +
|
||||
'</li>',
|
||||
|
||||
debug: true,
|
||||
sizeLimit: {{$maximagesize}},
|
||||
onSubmit: function(id, filename) {
|
||||
let newalbumElm = document.getElementById('photos-upload-newalbum');
|
||||
let albumElm = document.getElementById('photos-upload-album-select');
|
||||
|
||||
uploader.setParams({
|
||||
newalbum : newalbumElm ? newalbumElm.value : '',
|
||||
album : albumElm ? albumElm.value : '',
|
||||
not_visible : document.getElementById('photos-upload-noshare').checked,
|
||||
contact_allow : document.querySelector('[name="contact_allow"]').value,
|
||||
group_allow : document.querySelector('[name="group_allow"]').value,
|
||||
contact_deny : document.querySelector('[name="contact_deny"]').value,
|
||||
group_deny : document.querySelector('[name="group_deny"]').value,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('load', createUploader);
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue