common.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. $(function()
  2. {
  3. $('#libList tbody tr').each(function()
  4. {
  5. var $content = $(this).find('td.content');
  6. var content = $content.find('div').html();
  7. if(content.indexOf('<br') >= 0 || content.indexOf('<img') >= 0)
  8. {
  9. $content.append("<a href='###' class='more'><i class='icon icon-chevron-double-down'></i></a>");
  10. }
  11. });
  12. $('#fromProduct').change(function()
  13. {
  14. link = createLink('assetlib', 'importStory', 'libID=' + libID + '&projectID=' + projectID + '&productID=' + $(this).val());
  15. location.href = link;
  16. })
  17. $('#fromDocLib').change(function()
  18. {
  19. var currentMethod = config.currentMethod;
  20. link = createLink('assetlib', currentMethod, 'libID=' + libID + '&projectID=' + projectID + '&docLibID=' + $(this).val());
  21. location.href = link;
  22. })
  23. });
  24. $(document).on('click', 'td.content .more', function(e)
  25. {
  26. var $toggle = $(this);
  27. if($toggle.hasClass('open'))
  28. {
  29. $toggle.removeClass('open');
  30. $toggle.closest('.content').find('div').css('height', '25px');
  31. $toggle.css('padding-top', 0);
  32. $toggle.find('i').removeClass('icon-chevron-double-up').addClass('icon-chevron-double-down');
  33. }
  34. else
  35. {
  36. $toggle.addClass('open');
  37. $toggle.closest('.content').find('div').css('height', 'auto');
  38. $toggle.css('padding-top', ($toggle.closest('.content').find('div').height() - $toggle.height()) / 2);
  39. $toggle.find('i').removeClass('icon-chevron-double-down').addClass('icon-chevron-double-up');
  40. }
  41. });
  42. /**
  43. * Reload.
  44. *
  45. * @param int projectID
  46. * @access public
  47. * @return void
  48. */
  49. function reload(projectID)
  50. {
  51. var currentMethod = config.currentMethod;
  52. link = createLink('assetlib', currentMethod, 'libID=' + libID + '&projectID=' + projectID);
  53. location.href = link;
  54. }