From aaa4094cdde0f856aab414f7c1e2c97970583353 Mon Sep 17 00:00:00 2001 From: onli <onli89@googlemail.com> Date: Sat, 18 Jan 2014 23:08:28 +0100 Subject: [PATCH] Add http to urlinput if missing --- index.php | 1 + templates/2k11/config.inc.php | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/index.php b/index.php index 21328ea2..e14ef80a 100644 --- a/index.php +++ b/index.php @@ -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; diff --git a/templates/2k11/config.inc.php b/templates/2k11/config.inc.php index f3af1923..daa368b4 100644 --- a/templates/2k11/config.inc.php +++ b/templates/2k11/config.inc.php @@ -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; }