Download all files FTP
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
var uploadContainer = $('#drag_to_upload');
|
||||
|
||||
// Media Library button hook (WP >= 3.5):
|
||||
$('a#dgd_library_button').click(function(e){
|
||||
|
||||
// Prevent default:
|
||||
e.preventDefault();
|
||||
|
||||
// Set frame object:
|
||||
var frame = wp.media({
|
||||
id: 'dgd_featured_image',
|
||||
title : dgd_strings.panel.title,
|
||||
multiple : true,
|
||||
library : { type : 'image'},
|
||||
button : { text : dgd_strings.panel.button }
|
||||
});
|
||||
|
||||
// On select image:
|
||||
frame.on('select', function(){
|
||||
var attachment = frame.state().get('selection').first().toJSON();
|
||||
doSetFeaturedImage(attachment.id);
|
||||
});
|
||||
|
||||
// Display:
|
||||
frame.open();
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Set as featured image hook (WP < 3.5):
|
||||
$('body').on('click', 'a.wp-post-thumbnail', function(e){
|
||||
parent.tb_remove();
|
||||
parent.location.reload(1);
|
||||
});
|
||||
|
||||
// Remove featured image:
|
||||
uploadContainer.on('click', '#remove-post-thumbnail', function (){
|
||||
$('#current-uploaded-image').slideUp('medium');
|
||||
updateHotspotImages('');
|
||||
});
|
||||
|
||||
|
||||
// Set featured image:
|
||||
function doSetFeaturedImage(attachmentID){
|
||||
$.post(ajaxurl, {
|
||||
action: 'dgd_set_featured_image',
|
||||
postID: dgd_post_id,
|
||||
nonce: dgd_set_featured_image_nonce,
|
||||
attachmentID: attachmentID
|
||||
}, function (response){
|
||||
var response = $.parseJSON(response);
|
||||
if (response.response_code == 200){
|
||||
|
||||
// Publish post:
|
||||
if (dgd_page_reload){
|
||||
$('div#publishing-action input#publish').trigger('click');
|
||||
}
|
||||
|
||||
// Fetch image:
|
||||
doFetchFeaturedImage();
|
||||
|
||||
} else {
|
||||
alert(response.response_content);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Fetch featured image function:
|
||||
function doFetchFeaturedImage(){
|
||||
$.post(ajaxurl, {
|
||||
action: 'dgd_get_featured_image',
|
||||
post_id: dgd_post_id
|
||||
}, function (response){
|
||||
|
||||
// Parse response AS JSON:
|
||||
var response = $.parseJSON(response);
|
||||
|
||||
// Valid response:
|
||||
if (response.response_code == 200){
|
||||
|
||||
// Find current image and continue:
|
||||
$('#current-uploaded-image').slideUp('medium', function(){
|
||||
|
||||
// Update image with new info:
|
||||
var imageObject = uploadContainer.find('div.inside img.attachment-full');
|
||||
imageObject.removeAttr('width');
|
||||
imageObject.removeAttr('height');
|
||||
imageObject.removeAttr('title');
|
||||
imageObject.removeAttr('alt');
|
||||
imageObject.removeAttr('srcset');
|
||||
imageObject.removeAttr('sizes');
|
||||
imageObject.attr('src', response.response_content);
|
||||
|
||||
// Hide container:
|
||||
imageObject.load(function(){
|
||||
|
||||
// Display container:
|
||||
$('#current-uploaded-image').slideDown('medium');
|
||||
|
||||
// Fade in upload container:
|
||||
$('div#plupload-upload-ui').fadeIn('medium');
|
||||
$('#uploaderSection .loading').fadeOut('medium');
|
||||
|
||||
});
|
||||
updateHotspotImages(imageObject.attr('src'));
|
||||
});
|
||||
} else {
|
||||
alert(response.response_content);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function updateHotspotImages(src) {
|
||||
var fields = $('input[name$="[coordinates]"]');
|
||||
|
||||
fields.each(function(){
|
||||
$(this).attr('data-image-url', src);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
// Load iOS Switch script:
|
||||
$('input.iOSToggle').iToggle();
|
||||
|
||||
// Info panel blob jump:
|
||||
$('div.blobContainer img').hover(function(){
|
||||
$(this).stop(true, false).fadeTo(200, 1.0);
|
||||
}, function(){
|
||||
$(this).stop(true, false).fadeTo(200, 0.7);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
/*---------------
|
||||
* jQuery iToggle Plugin by Engage Interactive
|
||||
* Examples and documentation at: http://labs.engageinteractive.co.uk/itoggle/
|
||||
* Copyright (c) 2009 Engage Interactive
|
||||
* Version: 1.0 (10-JUN-2009)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
* Version: 1.7 (30-May-2012) by pshiryaev
|
||||
* Requires: jQuery v1.7 or later
|
||||
---------------*/
|
||||
(function(a){a.fn.iToggle=function(g){function f(b,c){!0==b?"radio"==d.type?a("label[for="+c+"]").addClass("ilabel_radio"):a("label[for="+c+"]").addClass("ilabel"):a("label[for="+c+"]").remove()}function e(b,c){d.onClick.call(b);h=b.innerHeight();t=b.prop("for");b.hasClass("iTon")?(d.onClickOff.call(b),b.animate({backgroundPositionX:"100%",backgroundPositionY:"-"+h+"px"},d.speed,d.easing,function(){b.removeClass("iTon").addClass("iToff");clickEnabled=!0;d.onSlide.call(this);d.onSlideOff.call(this)}),
|
||||
a("input#"+t).removeAttr("checked")):(d.onClickOn.call(b),b.animate({backgroundPositionX:"0%",backgroundPositionY:"-"+h+"px"},d.speed,d.easing,function(){b.removeClass("iToff").addClass("iTon");clickEnabled=!0;d.onSlide.call(this);d.onSlideOn.call(this)}),a("input#"+t).prop("checked","checked"));!0==c&&(name=a("#"+t).prop("name"),e(b.siblings("label[for]")))}clickEnabled=!0;var d=a.extend({},{type:"checkbox",keepLabel:!0,easing:!1,speed:200,onClick:function(){},onClickOn:function(){},onClickOff:function(){},
|
||||
onSlide:function(){},onSlideOn:function(){},onSlideOff:function(){}},g);this.each(function(){var b=a(this);if(b.is("input")){var c=b.attr("id");f(d.keepLabel,c);if(b.attr("checked")){c=a('<label class="itoggle" for="'+c+'"><span></span></label>');b.addClass("iT_checkbox").before(c);var e=a(c).innerHeight();a(c).css({"background-position-x":"0%","background-position-y":"-"+e+"px"});b.prev("label").addClass("iTon")}else c=a('<label class="itoggle" for="'+c+'"><span></span></label>'),b.addClass("iT_checkbox").before(c),
|
||||
e=a(c).innerHeight(),a(c).css({"background-position-x":"100%","background-position-y":"-"+e+"px"}),b.prev("label").addClass("iToff")}else b.children("input:"+d.type).each(function(){var b=a(this).attr("id");f(d.keepLabel,b);if(a(this).attr("checked")){b=a('<label class="itoggle" for="'+b+'"><span></span></label>');a(this).addClass("iT_checkbox").before(b);var c=a(b).innerHeight();a(b).css({"background-position-x":"0%","background-position-y":"-"+c+"px"});a(this).prev("label").addClass("iTon")}else b=
|
||||
a('<label class="itoggle" for="'+b+'"><span></span></label>'),a(this).addClass("iT_checkbox").before(b),c=a(b).innerHeight(),a(b).css({"background-position-x":"100%","background-position-y":"-"+c+"px"}),a(this).prev("label").addClass("iToff");"radio"==d.type&&a(this).prev("label").addClass("iT_radio")})});a("label.itoggle").click(function(){!0==clickEnabled&&(clickEnabled=!1,a(this).hasClass("iT_radio")?a(this).hasClass("iTon")?clickEnabled=!0:e(a(this),!0):e(a(this)));return!1});a("label.ilabel").click(function(){!0==
|
||||
clickEnabled&&(clickEnabled=!1,e(a(this).next("label.itoggle")));return!1})}})(jQuery);
|
||||
Reference in New Issue
Block a user