| 1 |
CHARITABLE = window.CHARITABLE || {}; |
| 2 |
|
| 3 |
/** |
| 4 |
* Add sanitize_url to the Helpers. |
| 5 |
*/ |
| 6 |
( function( exports, $ ) { |
| 7 |
exports.Helpers = exports.Helpers || {}; |
| 8 |
exports.Helpers.sanitize_url = function( input ) { |
| 9 |
var url = input.value.toLowerCase(); |
| 10 |
|
| 11 |
if ( !/^https?:\/\//i.test( url ) && url.length > 0 ) { |
| 12 |
url = 'http://' + url; |
| 13 |
input.value = url; |
| 14 |
} |
| 15 |
}; |
| 16 |
} )( CHARITABLE, jQuery ); |
| 17 |
|
| 18 |
/** |
| 19 |
* URL sanitization. |
| 20 |
* |
| 21 |
* This is provided for backwards compatibility. |
| 22 |
*/ |
| 23 |
CHARITABLE.SanitizeURL = function( input ) { |
| 24 |
CHARITABLE.Helpers.sanitize_url( input ); |
| 25 |
}; |
| 26 |
|