docbrown/app/views/admin/articles/_image_upload_script.html.erb
Daniel Uber 39c5bcd518
remove activex fallback for internet explorer (#16453)
* remove IE6 XHR support

IE7 and later support XMLHttpRequest natively, and most of the rest of
the code base uses fetch() which may not work in any version of IE

Drop the conditional here in the assumption that this would only be
the first of many problems for a user with an unsupported browser.
2022-02-08 08:36:04 -06:00

27 lines
887 B
Text

<script>
window.addEventListener('load', function() {
function generateUploadFormdata(image) {
var token = document.getElementsByName('authenticity_token')[0].value;
var formData = new FormData();
formData.append('authenticity_token', token);
formData.append('image', image[0]);
return formData;
}
function uploadImageCb(ajaxReq) {
if (ajaxReq.status === 200 && ajaxReq.readyState === XMLHttpRequest.DONE) {
var address = document.getElementById('uploaded-image');
address.value = JSON.parse(ajaxReq.response).link;
address.style.display = "inline-block";
address.style.width = "90%";
address.select();
var uploadedMessage = '';
document.getElementById('image-upload-submit').style.display = 'none';
}
}
function createAjaxReq() {
return new XMLHttpRequest();
}
});
</script>