Add http to urlinput if missing

This commit is contained in:
onli 2014-01-18 23:08:28 +01:00
parent 209f3ec710
commit aaa4094cdd
2 changed files with 11 additions and 0 deletions

View File

@ -564,6 +564,7 @@ if (preg_match(PAT_ARCHIVES, $uri, $matches) || isset($serendipity['GET']['range
header('Content-type: application/javascript; charset=' . LANG_CHARSET);
$out = "";
include(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
serendipity_plugin_api::hook_event('js', $out);
echo $out;
exit;

View File

@ -119,6 +119,16 @@ function serendipity_plugin_api_pre_event_hook($event, &$bag, &$eventData, &$add
echo serendipity_smarty_show('admin/serendipity_editor.js.tpl', $data);
break;
}
case 'js':
echo "jQuery(function() {
jQuery('input[type=\"url\"]').change(function() {
if (this.value != '' && ! (this.value.substr(0,7) == 'http://' || this.value.substr(0,8) == 'https://')) {
this.value = 'http://' + this.value;
}
});
})";
break;
return true;
break;
}