SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function set_smiley(element, width, height, mode = 'selected')
  2. {
  3.     if (mode == 'selected')
  4.     {
  5.         var selected = $('input.with-ratio:checked'),
  6.             selected_width = selected.data('width'),
  7.             selected_height = selected.data('height'),
  8.             class_name;
  9.     } else {
  10.         var selected = mode,
  11.             selected_width = selected.data('width'),
  12.             selected_height = selected.data('height'),
  13.             class_name;
  14.     }
  15.  
  16.     if ((selected_width * 55) < width || (selected_height * 55) < height)
  17.     {
  18.         class_name = 'smiley-top';
  19.     } else if ((selected_width * 30) <= width || (selected_height * 30) <= height) {
  20.         class_name = 'smiley-ok';
  21.     } else {
  22.         class_name = 'smiley-bad';
  23.     }
  24.  
  25.     element.removeClass('smiley-bad').removeClass('smiley-ok').removeClass('smiley-top').addClass(class_name);
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top