tablecol.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. jQuery(document).ready(function ($) {
  2. $('select[name=action]').append('<option value="delshort">Remove Shortlink</option>');
  3. $('select[name=action2]').append('<option value="delshort">Remove Shortlink</option>');
  4. function do_ajaxshort(pid) {
  5. var post = {};
  6. post['action'] = 'urlshortener_act';
  7. post['pid'] = pid;
  8. post['_ajax_nonce'] = nonce;
  9. $.ajaxq('urlyarshortenurl', {
  10. type: 'POST',
  11. url: aaurl,
  12. data: post,
  13. success: function (data) {
  14. if (data == '-1') {
  15. } else {
  16. $('#post-' + pid).find('span.shortlink').hide();
  17. $('#page-' + pid).find('span.shortlink').hide();
  18. }
  19. },
  20. error: function (data) {
  21. }
  22. });
  23. }
  24. function do_delshort() {
  25. $('table input:checkbox').each(function () {
  26. if ($(this).is(':checked')) {
  27. var sid = $(this).val();
  28. do_ajaxshort(sid);
  29. }
  30. });
  31. }
  32. $('#doaction').click(function () {
  33. var actval = $('select[name=action]').val();
  34. if (actval == 'delshort') {
  35. do_delshort();
  36. return false;
  37. }
  38. });
  39. $('#doaction2').click(function () {
  40. var actval = $('select[name=action2]').val();
  41. if (actval == 'delshort') {
  42. do_delshort();
  43. return false;
  44. }
  45. });
  46. });