diff options
Diffstat (limited to 'themes/mantra/admin/js')
-rw-r--r-- | themes/mantra/admin/js/admin.js | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/themes/mantra/admin/js/admin.js b/themes/mantra/admin/js/admin.js index 462394f0..0b6aad1d 100644 --- a/themes/mantra/admin/js/admin.js +++ b/themes/mantra/admin/js/admin.js @@ -2,25 +2,22 @@ * Admin js */ -function media_upload( button_class) { +function mantra_media_upload( button_class) { if (!window.wp || !window.wp.media || !window.wp.media.editor || !window.wp.media.editor.send || !window.wp.media.editor.send.attachment) return; var _custom_media = true, - _orig_send_attachment = wp.media.editor.send.attachment; + _orig_send_attachment = wp.media.editor.send.attachment, + uploadparent = 0; jQuery('body').on('click',button_class, function(e) { uploadparent = jQuery(this).closest('div'); var button_id ='#'+jQuery(this).attr('id'); - /* console.log(button_id); */ var self = jQuery(button_id); var send_attachment_bkp = wp.media.editor.send.attachment; var button = jQuery(button_id); - /* var id = button.attr('id').replace('_button', ''); */ _custom_media = true; wp.media.editor.send.attachment = function(props, attachment){ if ( _custom_media ) { - /* jQuery('.custom_media_id').val(attachment.id); */ uploadparent.find('.slideimages').val(attachment.url); uploadparent.find('.imagebox').attr('src',attachment.url); - /* jQuery('.custom_media_image').attr('src',attachment.url).css('display','block'); */ } else { return _orig_send_attachment.apply( button_id, [props, attachment] ); } @@ -32,21 +29,20 @@ function media_upload( button_class) { jQuery(document).ready(function() { - var uploadparent = 0; - media_upload( '.upload_image_button' ); + mantra_media_upload( '.upload_image_button' ); // Show/hide slides - jQuery('.slidetitle').click(function() { + jQuery('.slidetitle').on('click', function() { jQuery(this).next().toggle("fast"); }); // Jquery confim window on reset to defaults - jQuery('#mantra_defaults').click( function() { + jQuery('#mantra_defaults').on('click', function() { if (!confirm('Reset Mantra Settings to Defaults?')) { return false; } }); // Hide or show dimmensions - jQuery('#mantra_dimselect').change(function() { + jQuery('#mantra_dimselect').on('change', function() { if (jQuery('#mantra_dimselect option:selected').val()=="Absolute") { jQuery('#relativedim').hide("normal");jQuery('#absolutedim').show("normal"); } else { @@ -62,7 +58,7 @@ jQuery(document).ready(function() { // Hide or show slider settings - jQuery('#mantra_slideType').change(function() { + jQuery('#mantra_slideType').on('change',function() { jQuery('.slideDivs').hide("normal"); switch (jQuery('#mantra_slideType option:selected').val()) { @@ -126,7 +122,7 @@ jQuery(document).ready(function() { else jQuery('#slider-post-number').hide(); //On change - jQuery('#mantra_slideType').change(function(){ + jQuery('#mantra_slideType').on('change',function(){ $sliderNr=jQuery('#mantra_slideType').val(); //Show category if a category type is selected if ($sliderNr=="Latest Posts from Category" || $sliderNr=="Random Posts from Category" ) @@ -136,7 +132,7 @@ jQuery(document).ready(function() { if ($sliderNr=="Latest Posts" || $sliderNr =="Random Posts" || $sliderNr =="Sticky Posts" || $sliderNr=="Latest Posts from Category" || $sliderNr=="Random Posts from Category" ) jQuery('#slider-post-number').show(); else jQuery('#slider-post-number').hide(); - });//onchange funciton + });//onchange function @@ -230,7 +226,7 @@ function startfarb(a,b) { jQuery(b).css('display','none'); jQuery(b).farbtastic(a); - jQuery(a).click(function() { + jQuery(a).on('click', function() { if(jQuery(b).css('display') == 'none') { jQuery(b).parents('.ui-accordion-content').addClass('ui-accordion-content-overflow'); jQuery(b).css('display','inline-block').hide().show(300); @@ -249,6 +245,7 @@ function tooltip_terain() { jQuery(this).children('.tooltip').tooltip({content : tooltip_info}); jQuery(this).children('.tooltip').tooltip( "option", "items", "a" ); jQuery(this).children('.tooltip').tooltip( "option", "hide", "false"); + jQuery(this).children('.tooltip').tooltip( "option", "position", { my: "left+15 center", at: "right center" } ); jQuery(this).children('small').remove(); if (!jQuery(this).hasClass('slmini') && !jQuery(this).hasClass('slidercontent') && !jQuery(this).hasClass('slideDivs')) jQuery(this).addClass('tooltip_div'); }); @@ -284,23 +281,5 @@ function changeBorder(idName, className) { return 0; } -/* FB like button */ -(function(d, s, id) { - var js, fjs = d.getElementsByTagName(s)[0]; - if (d.getElementById(id)) return; - js = d.createElement(s); js.id = id; - js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0"; - fjs.parentNode.insertBefore(js, fjs); -}(document, 'script', 'facebook-jssdk')); - -/* Twitter follow button */ -window.twttr = (function (d, s, id) { - var t, js, fjs = d.getElementsByTagName(s)[0]; - if (d.getElementById(id)) return; - js = d.createElement(s); js.id = id; - js.src= "https://platform.twitter.com/widgets.js"; - fjs.parentNode.insertBefore(js, fjs); - return window.twttr || (t = { _e: [], ready: function (f) { t._e.push(f) } }); -}(document, "script", "twitter-wjs")); /* FIN */ |