plugin updates
This commit is contained in:
@@ -74,6 +74,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
||||
}).then(function (result) {
|
||||
if (result.status) {
|
||||
$container.html(result.html);
|
||||
if($container.find('.wpmf-pdfemb-viewer').length) {
|
||||
$container.find('.wpmf-pdfemb-viewer').pdfEmbedder();
|
||||
}
|
||||
}
|
||||
},
|
||||
// errors
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
(result) => {
|
||||
if (result.status) {
|
||||
$container.html(result.html);
|
||||
if($container.find('.wpmf-pdfemb-viewer').length) {
|
||||
$container.find('.wpmf-pdfemb-viewer').pdfEmbedder();
|
||||
}
|
||||
}
|
||||
},
|
||||
// errors
|
||||
|
||||
@@ -95,6 +95,13 @@
|
||||
if ($(this).find('a[data-lightbox="1"]').length) {
|
||||
e.preventDefault();
|
||||
var index = $(this).find('a[data-lightbox="1"]').data('index');
|
||||
var item = (items[index]);
|
||||
if (item['src'] !== "undefined") {
|
||||
var check_video_kaltura = item['src'].indexOf("cdnapisec.kaltura.com");
|
||||
if (check_video_kaltura !== "undefined" && check_video_kaltura > 0) {
|
||||
$('.mfp-iframe-holder .mfp-content').css('max-width', '640px');
|
||||
}
|
||||
}
|
||||
$.magnificPopup.open({
|
||||
items: items,
|
||||
gallery: {
|
||||
|
||||
209
wp/wp-content/plugins/wp-media-folder/assets/js/folder_upload.js
Normal file
209
wp/wp-content/plugins/wp-media-folder/assets/js/folder_upload.js
Normal file
@@ -0,0 +1,209 @@
|
||||
/**
|
||||
* Main WP Media Gallery addon script
|
||||
*/
|
||||
var wpmfGalleryModule;
|
||||
(function ($) {
|
||||
if (typeof ajaxurl === "undefined") {
|
||||
ajaxurl = wpmf.vars.ajaxurl;
|
||||
}
|
||||
|
||||
var this_url = new URL(location.href);
|
||||
var get_wpmf_folder = this_url.searchParams.get("wpmf-folder");
|
||||
|
||||
wpmfGalleryModule = {
|
||||
comment_parent: 0,
|
||||
upload_from_pc: false,
|
||||
wpmf_current_gallery: 0, // current gallery selected
|
||||
target_gallery: 0,
|
||||
is_gallery_loading: false,
|
||||
is_perpage_change: false,
|
||||
current_page_nav: 1, // current page for images gallery selection
|
||||
gallery_details: {},
|
||||
shouldconfirm: false,
|
||||
custom_gird_gutter_change: false,
|
||||
is_resizing: true,
|
||||
current_tab: 'main-gallery',
|
||||
events: [], // event handling
|
||||
init: function () {
|
||||
var folder_options_html = '';
|
||||
var space = ' ';
|
||||
var list_cloud_google = [];
|
||||
var list_cloud_dropbox = [];
|
||||
var list_cloud_odv = [];
|
||||
var list_cloud_odvbs = [];
|
||||
var list_cloud_nextcloud = [];
|
||||
var list_local = [];
|
||||
$('.form_edit_gallery input, .form_edit_gallery select').on('change', function () {
|
||||
if ($(this).data('param') === 'gutterwidth') {
|
||||
wpmfGalleryModule.custom_gird_gutter_change = true;
|
||||
}
|
||||
wpmfGalleryModule.shouldconfirm = true;
|
||||
window.onbeforeunload = function() {
|
||||
if (wpmfGalleryModule.shouldconfirm) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
$('.form_edit_gallery .edit-gallery-name').on('keyup', function () {
|
||||
wpmfGalleryModule.shouldconfirm = true;
|
||||
window.onbeforeunload = function() {
|
||||
if (wpmfGalleryModule.shouldconfirm) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
wpmfFoldersTreeModule.importCategories();
|
||||
$.each(wpmfFoldersTreeModule.categories, function (i, v) {
|
||||
if (parseInt(v.id) !== 0) {
|
||||
if (typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'google_drive') {
|
||||
list_cloud_google.push({id: v.id, label: v.label, depth: v.depth});
|
||||
} else if(typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'dropbox') {
|
||||
list_cloud_dropbox.push({id: v.id, label: v.label, depth: v.depth});
|
||||
} else if(typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'onedrive') {
|
||||
list_cloud_odv.push({id: v.id, label: v.label, depth: v.depth});
|
||||
} else if (typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'onedrive_business') {
|
||||
list_cloud_odvbs.push({id: v.id, label: v.label, depth: v.depth});
|
||||
} else if (typeof v.drive_type !== 'undefined' && v.drive_type !== '' && v.drive_type === 'nextcloud') {
|
||||
list_cloud_nextcloud.push({id: v.id, label: v.label, depth: v.depth});
|
||||
} else {
|
||||
list_local.push({id: v.id, label: v.label, depth: v.depth});
|
||||
}
|
||||
} else {
|
||||
list_local.push({id: 0, label: v.label, depth: 0});
|
||||
}
|
||||
});
|
||||
|
||||
$.each(list_local, function (i, v) {
|
||||
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
|
||||
} else {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + v.label + '</option>';
|
||||
}
|
||||
});
|
||||
|
||||
$.each(list_cloud_dropbox, function (i, v) {
|
||||
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
|
||||
} else {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + v.label + '</option>';
|
||||
}
|
||||
});
|
||||
|
||||
$.each(list_cloud_google, function (i, v) {
|
||||
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
|
||||
} else {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + v.label + '</option>';
|
||||
}
|
||||
});
|
||||
|
||||
$.each(list_cloud_odv, function (i, v) {
|
||||
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
|
||||
} else {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + v.label + '</option>';
|
||||
}
|
||||
});
|
||||
|
||||
$.each(list_cloud_odvbs, function (i, v) {
|
||||
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
|
||||
} else {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + v.label + '</option>';
|
||||
}
|
||||
});
|
||||
|
||||
$.each(list_cloud_nextcloud, function (i, v) {
|
||||
if (typeof v.depth !== "undefined" && parseInt(v.depth) > 0) {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + space.repeat(v.depth) + v.label + '</option>';
|
||||
} else {
|
||||
folder_options_html += '<option value="' + v.id + '"';
|
||||
if (get_wpmf_folder !== 'undefined' && get_wpmf_folder == v.id){
|
||||
folder_options_html += ' selected ';
|
||||
}
|
||||
folder_options_html += '>' + v.label + '</option>';
|
||||
}
|
||||
});
|
||||
|
||||
$('.wpmf-gallery-folder').html(folder_options_html);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on( 'wp-collapse-menu', function () {
|
||||
wpmfGalleryModule.initPackery();
|
||||
});
|
||||
|
||||
// initialize WPMF gallery features
|
||||
$(document).ready(function () {
|
||||
wpmfGalleryModule.init();
|
||||
var wmpf_nonce = $('.wpmf-gallery-folder').attr('data-wmpf-nonce');
|
||||
uploader.bind('BeforeUpload', function(up, file) {
|
||||
var multipart_params = up.settings.multipart_params;
|
||||
multipart_params['wpmf_folder'] = 0;
|
||||
if (get_wpmf_folder !== 'undefined') {
|
||||
multipart_params['id_category'] = get_wpmf_folder;
|
||||
multipart_params['wpmf_folder'] = get_wpmf_folder;
|
||||
multipart_params['wpmf_nonce'] = wmpf_nonce;
|
||||
}
|
||||
up.settings.multipart_params = multipart_params;
|
||||
});
|
||||
$('.wpmf-gallery-folder').on('change', function(){
|
||||
var id_category = $(this).val();
|
||||
uploader.bind('BeforeUpload', function(up, file) {
|
||||
var multipart_params = up.settings.multipart_params;
|
||||
multipart_params['id_category'] = id_category;
|
||||
multipart_params['wpmf_folder'] = id_category;
|
||||
multipart_params['wpmf_nonce'] = wmpf_nonce;
|
||||
up.settings.multipart_params = multipart_params;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -4388,9 +4388,10 @@ let wpmfFoldersModule, wpmfAddCloudQueue, cloud_sync_loader_icon;
|
||||
allowHTML: true,
|
||||
onShow(instance) {
|
||||
var tippy_html = '';
|
||||
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
|
||||
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, kaltura, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.youtube.com/watch?v=5ncy4gn6S0k</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://vimeo.com/496843494</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://videos.kaltura.com/media/Kaltura+Overview/1_11mvteme</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.facebook.com/svmteam/videos/972235670261003</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.twitch.tv/videos/999290199</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.dailymotion.com/video/x80wibi</p>';
|
||||
|
||||
@@ -1676,13 +1676,13 @@ var wpmfFoldersModule = void 0,
|
||||
var folder_color = '<div class="custom_color_wrap">';
|
||||
if (typeof colorlists[wpmf.vars.colors[wpmfFoldersModule.editFolderId]] === 'undefined') {
|
||||
if (typeof wpmf.vars.colors[wpmfFoldersModule.editFolderId] === 'undefined') {
|
||||
custom_color = '#8f8f8f';
|
||||
custom_color = '#b2b2b2';
|
||||
} else {
|
||||
custom_color = wpmf.vars.colors[wpmfFoldersModule.editFolderId];
|
||||
value = wpmf.vars.colors[wpmfFoldersModule.editFolderId];
|
||||
}
|
||||
} else {
|
||||
custom_color = '#8f8f8f';
|
||||
custom_color = '#b2b2b2';
|
||||
}
|
||||
folder_color += '\n <input name="wpmf_color_folder" type="text"\n placeholder="' + wpmf.l18n.placegolder_color + '"\n value="' + value + '"\n class="inputbox input-block-level wp-color-folder wp-color-picker">';
|
||||
folder_color += '<div data-color="' + custom_color + '" class="color custom_color" style="background: ' + custom_color + '"><i class="material-icons color_uncheck">check</i></div>';
|
||||
@@ -4056,6 +4056,7 @@ var wpmfFoldersModule = void 0,
|
||||
html += '<div class="video-thumbnail-btn-wrap"><button class="add-video-thumbnail-btn">' + wpmf.l18n.add_image + '</button></div>';
|
||||
html += '<p class="add_video_msg"></p>';
|
||||
html += '</div>';
|
||||
var folder_id = wpmfFoldersModule.last_selected_folder;
|
||||
showDialog({
|
||||
id: 'wpmf-add-video-dialog',
|
||||
title: wpmf.l18n.add_video,
|
||||
@@ -4082,7 +4083,7 @@ var wpmfFoldersModule = void 0,
|
||||
}
|
||||
}
|
||||
|
||||
wpmfFoldersModule.addVideoToGallery(video_url, thumbnail_id);
|
||||
wpmfFoldersModule.addVideoToGallery(video_url, thumbnail_id, folder_id);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -4097,9 +4098,10 @@ var wpmfFoldersModule = void 0,
|
||||
allowHTML: true,
|
||||
onShow: function onShow(instance) {
|
||||
var tippy_html = '';
|
||||
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
|
||||
tippy_html += '<p class="video-tippy-help" style="color: yellow; font-size:14px">Support: youtube, vimeo, kaltura, facebook watch, wistia, twitch, dailymotion, self-hosted</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.youtube.com/watch?v=5ncy4gn6S0k</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://vimeo.com/496843494</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://videos.kaltura.com/media/Kaltura+Overview/1_11mvteme</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.facebook.com/svmteam/videos/972235670261003</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.twitch.tv/videos/999290199</p>';
|
||||
tippy_html += '<p class="video-tippy-help">https://www.dailymotion.com/video/x80wibi</p>';
|
||||
@@ -4180,6 +4182,7 @@ var wpmfFoldersModule = void 0,
|
||||
addVideoToGallery: function addVideoToGallery() {
|
||||
var video_url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
||||
var thumbnail_id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
||||
var folder_id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
||||
|
||||
if (video_url === '') {
|
||||
return;
|
||||
@@ -4193,14 +4196,14 @@ var wpmfFoldersModule = void 0,
|
||||
task: "create_remote_video",
|
||||
video_url: video_url,
|
||||
thumbnail_id: thumbnail_id,
|
||||
folder_id: wpmfFoldersModule.last_selected_folder,
|
||||
folder_id: folder_id,
|
||||
wpmf_nonce: wpmf.vars.wpmf_nonce
|
||||
},
|
||||
beforeSend: function beforeSend() {},
|
||||
success: function success(res) {
|
||||
if (res.status) {
|
||||
wpmfFoldersModule.reloadAttachments(true);
|
||||
wpmfFoldersModule.trigger('addRemoteVideo', wpmfFoldersModule.last_selected_folder);
|
||||
wpmfFoldersModule.trigger('addRemoteVideo', folder_id);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user