common.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. function setComment(type)
  2. {
  3. $('#commentBox').toggle();
  4. $('#commentBox #type').val(type);
  5. $('#commentBox textarea').val('');
  6. window.editor['comment'].html('');
  7. $('.ke-container').css('width', '100%');
  8. }
  9. function like(feedbackID)
  10. {
  11. var likeLink = createLink('feedback', 'ajaxLike', 'feedbackID=' + feedbackID);
  12. $('.likesBox').load(likeLink);
  13. }
  14. $(function()
  15. {
  16. if(window['browseType'] == 'bysearch') $.toggleQueryBox(true);
  17. $(':checkbox[id^=isFeedback]').click(function()
  18. {
  19. var checked = $(this).prop('checked');
  20. $(this).closest('tr').find('input[type=checkbox]').prop('checked', checked);
  21. })
  22. $('#product').change(function()
  23. {
  24. var productID = $(this).val();
  25. var module = typeof(moduleID) != 'undefined' ? moduleID : '';
  26. var link = createLink('feedback', 'ajaxGetModule','productID=' + productID);
  27. $.post(link, function(data)
  28. {
  29. $('#module').replaceWith(data);
  30. $('#module_chosen').remove();
  31. $('#module').val(module).chosen();
  32. $('#module').change();
  33. })
  34. });
  35. /* Init pri. */
  36. $('#pri').on('change', function()
  37. {
  38. var $select = $(this);
  39. var $selector = $select.closest('.pri-selector');
  40. var value = $select.val();
  41. $selector.find('.pri-text').html('<span class="label-pri label-pri-' + value + '" title="' + value + '">' + value + '</span>');
  42. });
  43. if(typeof(productID) != 'undefined' && productID && productID !== 'all') $('#product').change();
  44. })