Aleksander Machniak
2013-03-22 73f094ff3ca151e928e61cc20578310e44d455a3
program/js/common.js
@@ -494,7 +494,9 @@
      atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+',
      quoted_pair = '\\x5c[\\x00-\\x7f]',
      quoted_string = '\\x22('+qtext+'|'+quoted_pair+')*\\x22',
      ip_addr = '\\[*(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}\\]*',
      ipv4 = '\\[(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}\\]',
      ipv6 = '\\[IPv6:[0-9a-f:.]+\\]',
      ip_addr = '(' + ipv4 + ')|(' + ipv6 + ')',
      // Use simplified domain matching, because we need to allow Unicode characters here
      // So, e-mail address should be validated also on server side after idn_to_ascii() use
      //domain_literal = '\\x5b('+dtext+'|'+quoted_pair+')*\\x5d',
@@ -718,10 +720,12 @@
    var elem = $(this);
    this.title = text;
    // Try HTML5 placeholder attribute first
    if ('placeholder' in this) {
      elem.attr('placeholder', text);  // Try HTML5 placeholder attribute first
      elem.attr('placeholder', text);
    }
    else {  // Fallback to Javascript emulation of placeholder
    // Fallback to Javascript emulation of placeholder
    else {
      this._placeholder = text;
      elem.blur(function(e) {
        if ($.trim(elem.val()) == "")
@@ -738,8 +742,13 @@
        elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active);
      });
      if (this != document.activeElement) // Do not blur currently focused element
        elem.blur();
      // Do not blur currently focused element
      // Catch "unspecified error" in IE9 (#1489008)
      try {
        if (this != document.activeElement)
          elem.blur();
      }
      catch(e) {}
    }
  });
};