ulvis.paste.net - pastebin

Paste Search Dynamic
Recent pastes
wpml-domain-validation.js
  1. /**
  2.  * Used on the language settings page, validates the text content of one row
  3.  * of the language domains settings form and potentially sanitizes the contents
  4.  * of the row's text field.
  5.  * Un-checks the text fields validation checkbox in case the field contains an
  6.  * empty string after sanitization.
  7.  *
  8.  * @param domainInput Object
  9.  * @param domainCheckBox Object
  10.  * @returns {{run: run}}
  11.  * @constructor
  12.  */
  13. var WpmlDomainValidation = function (domainInput, domainCheckBox) {
  14.  
  15.     return {
  16.         run: function () {
  17.             var textInput = domainInput.val().match(/^(?:.+\/\/)?([\w\.-]*)/)[1];
  18.             if (!textInput) {
  19.                 domainCheckBox.prop('checked', false)
  20.             }
  21.             domainInput.val(textInput ? textInput : '');
  22.         }
  23.     }
  24. };
Parsed in 0.005 seconds