Advertisement
emcniece

Latest Custom Post Type Updates - tm-lcptu-options-1.7.js

Jul 31st, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 2.17 KB | None | 0 0
  1. jQuery(document).ready(function($) {
  2.  
  3.  
  4.  
  5.     // Show/hide the thumbnails section
  6.  
  7.     $(document).on('change', 'input.tm_lcptu_show-thumbnails',
  8.  
  9.         function(event) {
  10.  
  11.             var id = $(this).attr('id');
  12.  
  13.             if($(this).attr('checked')) {
  14.  
  15.                 $('.'+id).slideDown(100);
  16.  
  17.                 return;
  18.  
  19.             }
  20.  
  21.             $('.'+id).slideUp(100);
  22.  
  23.         }
  24.  
  25.     );
  26.  
  27.  
  28.  
  29.     // Show/hide the advanced section
  30.  
  31.     $(document).on('change', 'input.tm_lcptu_show-advanced',
  32.  
  33.         function(event) {
  34.  
  35.             var id = $(this).attr('id');
  36.  
  37.             if($(this).attr('checked')) {
  38.  
  39.                 $('.'+id).slideDown(100);
  40.  
  41.                 return;
  42.  
  43.             }
  44.  
  45.             $('.'+id).slideUp(100);
  46.  
  47.         }
  48.  
  49.     );
  50.  
  51.  
  52.  
  53.     // Get the taxonomies and update them
  54.  
  55.     $(document).on('change', 'select.tm_lcptu_post-type', function(event) {
  56.  
  57.             var myClass = $(this).attr('id');
  58.  
  59.             var data = {
  60.  
  61.                 action: 'tm_lcptu_tax',
  62.  
  63.                 posttype: $(this).attr('value')
  64.  
  65.             };
  66.  
  67.             $.post(ajaxurl, data,
  68.  
  69.                 function(response) {
  70.  
  71.                     $('.'+myClass).html(response);
  72.  
  73.                     $('.'+$('.'+myClass).attr('id')+'-container').slideUp(100);
  74.  
  75.                 }
  76.  
  77.             );
  78.  
  79.         }
  80.  
  81.     );
  82.  
  83.  
  84.  
  85.     // Get the tags/categories and update them
  86.  
  87.     $(document).on('change', 'select.tm_lcptu_tax', function(event) {
  88.  
  89.             var myClass = $(this).attr('id');
  90.  
  91.             if($(this).attr('value') == '--')
  92.  
  93.                 $('.'+myClass+'-container').slideUp(100);
  94.  
  95.             else {
  96.  
  97.                 $('.'+myClass+'-container').slideDown(100);
  98.  
  99.                 var data = {
  100.  
  101.                     action: 'tm_lcptu_tags',
  102.  
  103.                     taxonomy: $(this).attr('value'),
  104.  
  105.                     checkboxName: $('.'+myClass).attr('id')
  106.  
  107.                 };
  108.  
  109.                 $.post(ajaxurl, data,
  110.  
  111.                     function(response) {
  112.  
  113.                         $('.'+myClass).html(response);
  114.  
  115.                     }
  116.  
  117.                 );
  118.  
  119.             }
  120.  
  121.         }
  122.  
  123.     );
  124.  
  125.  
  126.  
  127. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement