plugin updates
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
if (typeof wp !== "undefined" && typeof wp.media !== "undefined") {
|
||||
var myEmbedImage = wp.media.view.ImageDetails;
|
||||
if (typeof myEmbedImage !== 'undefined') {
|
||||
wp.media.view.ImageDetails = wp.media.view.ImageDetails.extend({
|
||||
initialize: function() {
|
||||
myEmbedImage.prototype.initialize.apply(this, arguments);
|
||||
this.on('post-render', this.add_settings);
|
||||
},
|
||||
// To add the Settings
|
||||
add_settings: function() {
|
||||
var $el = this.$el;
|
||||
$el.find('.embed-media-settings .column-settings .setting.link-to').after(wp.media.template('image-wpmf'));
|
||||
//this.controller.image.set({"data-settings": 'wpmf_size_lightbox'})
|
||||
$el.find('.wpmf_size_lightbox option[value="'+ this.controller.image.attributes.wpmf_size_lightbox +'"]').prop('selected',true).change();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,59 @@
|
||||
(function ($) {
|
||||
$(document).ready(function () {
|
||||
if (jQuery().magnificPopup) {
|
||||
/* open lightbox when click to image */
|
||||
if ($('.wpmf_image_lightbox, .open-lightbox-feature-image').length) {
|
||||
$('.wpmf_image_lightbox, .open-lightbox-feature-image').magnificPopup({
|
||||
gallery: {
|
||||
enabled: true,
|
||||
tCounter: '<span class="mfp-counter">%curr% / %total%</span>',
|
||||
arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>' // markup of an arrow button
|
||||
},
|
||||
callbacks: {
|
||||
elementParse: function (q) {
|
||||
if (q.el.closest('a').length) {
|
||||
q.src = q.el.closest('a').attr('href');
|
||||
} else {
|
||||
q.src = q.el.attr('src');
|
||||
}
|
||||
}
|
||||
},
|
||||
type: 'image',
|
||||
showCloseBtn: false,
|
||||
image: {
|
||||
titleSrc: 'title'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* open lightbox when click to image */
|
||||
$('body a').each(function(i,v){
|
||||
if($(v).find('img[data-wpmflightbox="1"]').length !== 0){
|
||||
$(v).magnificPopup({
|
||||
delegate: 'img',
|
||||
gallery: {
|
||||
enabled: true,
|
||||
tCounter: '<span class="mfp-counter">%curr% / %total%</span>',
|
||||
arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>' // markup of an arrow button
|
||||
},
|
||||
callbacks: {
|
||||
elementParse: function(q) {
|
||||
var wpmf_lightbox = q.el.data('wpmf_image_lightbox');
|
||||
if(typeof wpmf_lightbox === "undefined"){
|
||||
q.src = q.el.attr('src');
|
||||
}else{
|
||||
q.src = wpmf_lightbox;
|
||||
}
|
||||
}
|
||||
},
|
||||
type: 'image',
|
||||
showCloseBtn : false,
|
||||
image: {
|
||||
titleSrc: 'title'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user