Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-mw committed Jun 29, 2023
1 parent 694dfac commit 1cb846f
Showing 1 changed file with 34 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,18 @@

if (array_key_exists('types', $_GET)) {
$types = explode(',', $_GET['types']);

$types = xss_clean($types);
} else {
$types = array('files', 'images', 'videos');
}

if (array_key_exists('title', $_GET)) {
$title = $_GET['title'];

$title = xss_clean($title);
} else {
$title = __('Media');
}


?>

<div id="filepick"></div>
Expand All @@ -40,13 +39,12 @@
if (mw.parent().image.currentResizing[0].nodeName === 'IMG') {
mw.parent().image.currentResizing.attr("src", url);
mw.parent().image.currentResizing.css('height', 'auto');
}
else {
} else {
mw.parent().image.currentResizing.css("backgroundImage", 'url(' + mw.files.safeFilename(url) + ')');
mw.top().wysiwyg.bgQuotesFix(mw.parent().image.currentResizing[0])
}
}
if(window.thismodal) {
if (window.thismodal) {
thismodal.result(url);
}
};
Expand All @@ -72,7 +70,7 @@
if (hash !== '') {
if (hash === 'editimage') {
UpdateImage(url);
if(mw.parent().image.currentResizing){
if (mw.parent().image.currentResizing) {
mw.parent().wysiwyg.change(mw.parent().image.currentResizing[0])
mw.parent().image.resize.resizerSet(mw.parent().image.currentResizing[0]);
mw.parent().trigger('imageSrcChanged', [mw.parent().image.currentResizing[0], url])
Expand All @@ -85,7 +83,7 @@
if (typeof parent[hash] === 'function') {
parent[hash](url, eventType);
} else {
if(mw.parent().iframecallbacks['insert_image']) {
if (mw.parent().iframecallbacks['insert_image']) {
mw.parent().iframecallbacks['insert_image'](url, eventType);
}

Expand Down Expand Up @@ -121,7 +119,7 @@


mw.parent().iframecallbacks[hash](pval);
if(mw.parent().image.currentResizing && mw.parent().image.currentResizing){
if (mw.parent().image.currentResizing && mw.parent().image.currentResizing) {
mw.parent().image.resize.resizerSet(mw.parent().image.currentResizing[0]);

}
Expand All @@ -135,11 +133,11 @@

parent[hash](GlobalEmbed)
}
if(mw.parent().image.currentResizing && mw.parent().image.currentResizing[0]) {
if (mw.parent().image.currentResizing && mw.parent().image.currentResizing[0]) {
mw.parent().trigger('imageSrcChanged', [mw.parent().image.currentResizing[0], this]);
}

if(window.thismodal) {
if (window.thismodal) {
thismodal.result(pval)
}

Expand All @@ -163,7 +161,7 @@
mw.require('filepicker.js');

var picker = new mw.filePicker({
element:'#filepick',
element: '#filepick',
nav: 'tabs',
footer: true,
boxed: false,
Expand All @@ -172,25 +170,22 @@
});



$(picker).on('Result', function (e, res) {
var filetypes = '<?php print join(",", $types);; ?>';
var url = res.src ? res.src : res;
if (filetypes.indexOf('images') !== -1) {
afterMediaIsInserted(url, '', "FileUploaded");
}
else if (filetypes === 'videos' || filetypes === 'media') {
} else if (filetypes === 'videos' || filetypes === 'media') {
afterMediaIsInserted(url, 'video', "FileUploaded");
}
else if (filetypes === 'files') {
} else if (filetypes === 'files') {
if (item.src.contains("base64")) {
afterMediaIsInserted(url, '', "FileUploaded");
} else {
afterMediaIsInserted(url, 'files', "FileUploaded");
}

}
if(window.thismodal) {
if (window.thismodal) {
thismodal.result(url);
thismodal.remove()
}
Expand Down Expand Up @@ -219,25 +214,21 @@
ProgressInfo.html(file.name);




});
$(frame).on("FileUploaded", function (frame, item) {
if (filetypes.indexOf('images') !== -1) {
afterMediaIsInserted(item.src, '', "FileUploaded");
}
else if (filetypes === 'videos' || filetypes === 'media') {
} else if (filetypes === 'videos' || filetypes === 'media') {
afterMediaIsInserted(item.src, 'video', "FileUploaded");
}
else if (filetypes === 'files') {
} else if (filetypes === 'files') {
if (item.src.contains("base64")) {
afterMediaIsInserted(item.src, '', "FileUploaded");
} else {
afterMediaIsInserted(item.src, 'files', "FileUploaded");
}

}
if(window.thismodal) {
if (window.thismodal) {
thismodal.result(item.src)
}

Expand All @@ -259,7 +250,6 @@
});



});


Expand Down Expand Up @@ -290,7 +280,7 @@
var val = urlSearcher.val();
if (hash === 'fileWindow') {

if(window.thismodal) {
if (window.thismodal) {
thismodal.result(val)
}
$('body').trigger('change', [val]);
Expand All @@ -309,7 +299,7 @@
parent[hash](GlobalEmbed);

}
if(window.thismodal) {
if (window.thismodal) {
thismodal.result(GlobalEmbed)
}
mw.parent().dialog.remove('mw_rte_image');
Expand Down Expand Up @@ -344,10 +334,10 @@
}

}
if(window.thismodal) {
if (window.thismodal) {
thismodal.result(val)
}
if(mw.parent().image.currentResizing) {
if (mw.parent().image.currentResizing) {
mw.parent().trigger('imageSrcChanged', [mw.parent().image.currentResizing[0], val]);

}
Expand All @@ -370,7 +360,7 @@
}
})

if(mode === 'dialog' && index > 0) {
if (mode === 'dialog' && index > 0) {

} else {
$('.tab').hide()//.eq(index).show()
Expand All @@ -387,15 +377,15 @@
window.fileBrowserLoaded = true;
mw.top().load_module('files/admin', '#file_module_live_edit_adm', function () {

}, {'filetype':'images'});
}, {'filetype': 'images'});
}

} else {
}
if(window.thismodal){
if(this.selectedIndex === ($(selector).length - 1)){
}
if (window.thismodal) {
if (this.selectedIndex === ($(selector).length - 1)) {
thismodal.resize(800)
} else if(this.selectedIndex === 2){
} else if (this.selectedIndex === 2) {
thismodal.resize(600)
} else {
thismodal.resize(460)
Expand Down Expand Up @@ -466,11 +456,11 @@
</script>


<style >
<style>

/* body, html {
overflow: hidden;
}*/
/* body, html {
overflow: hidden;
}*/

.mw-upload-filetypes {
list-style: none;
Expand Down Expand Up @@ -539,10 +529,12 @@
width: 275px;
margin-inline-end: 15px;
}
.image-tabs-header > div h6{

.image-tabs-header > div h6 {
margin-bottom: 0;
}
.image-tabs-header{

.image-tabs-header {
display: flex;
justify-content: space-between;
align-content: center;
Expand Down

0 comments on commit 1cb846f

Please sign in to comment.