icondropdown.js 841 B

12345678910111213141516171819202122232425262728293031323334
  1. $(document).ready(function()
  2. {
  3. $('#icon_count_input').change(function ()
  4. {
  5. var select_box = $('select#icon_image_input option:selected').val();
  6. var icon_count = $('#icon_count_input');
  7. if (icon_count.val() == 0 && select_box != 'blank.png')
  8. icon_count.val(1);
  9. if (icon_count.val().length > 2)
  10. icon_count.val(99);
  11. });
  12. $('#icon_image_input').change(function ()
  13. {
  14. refreshIconPreview();
  15. });
  16. refreshIconPreview();
  17. });
  18. function refreshIconPreview()
  19. {
  20. // Get the icon count element.
  21. var icon_count = $('#icon_count_input');
  22. var select_box = $('select#icon_image_input').val();
  23. // If it's empty, set it to 1.
  24. if (icon_count.val() == 0 && select_box != 'blank.png')
  25. icon_count.val(1);
  26. // Update the icon preview.
  27. $('#icon_preview').attr('src', smf_default_theme_url + '/images/membericons/' + select_box);
  28. }