diff --git a/library/includes/datastore/build_cat_forums.php b/library/includes/datastore/build_cat_forums.php index 0f52729bc..5d66ef5dc 100644 --- a/library/includes/datastore/build_cat_forums.php +++ b/library/includes/datastore/build_cat_forums.php @@ -103,21 +103,6 @@ $data['tracker_forums'] = implode(',', $data['tracker_forums']); $this->store('cat_forums', $data); -// -// jumpbox -// -if ($bb_cfg['show_jumpbox']) { - $data = array( - 'guest' => get_forum_select('guest', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'), - 'user' => get_forum_select('user', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'), - ); - - $this->store('jumpbox', $data); - - file_write($data['guest'], AJAX_HTML_DIR . '/jumpbox_guest.html', false, true, true); - file_write($data['user'], AJAX_HTML_DIR . '/jumpbox_user.html', false, true, true); -} - // // viewtopic_forum_select // diff --git a/library/includes/functions.php b/library/includes/functions.php index f002d95ec..0a2ce55b6 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -998,24 +998,6 @@ function get_userdata($u, $force_name = false, $allow_guest = false) return $u_data; } -function make_jumpbox($selected = 0) -{ - global $datastore, $template, $bb_cfg; - - if (!$bb_cfg['show_jumpbox']) { - return; - } - - if (!$jumpbox = $datastore->get('jumpbox')) { - $datastore->update('jumpbox'); - $jumpbox = $datastore->get('jumpbox'); - } - - $template->assign_vars(array( - 'JUMPBOX' => (IS_GUEST) ? $jumpbox['guest'] : $jumpbox['user'], - )); -} - // $mode: array(not_auth_forum1,not_auth_forum2,..) or (string) 'mode' function get_forum_select($mode = 'guest', $name = POST_FORUM_URL, $selected = null, $max_length = HTML_SELECT_MAX_LENGTH, $multiple_size = null, $js = '', $all_forums_option = null) { diff --git a/library/includes/page_header.php b/library/includes/page_header.php index af65da172..6ebe12f50 100644 --- a/library/includes/page_header.php +++ b/library/includes/page_header.php @@ -108,6 +108,17 @@ $template->assign_vars(array( 'HAVE_UNREAD_PM' => $have_unread_pm, )); +// Jumpbox init +if ($bb_cfg['show_jumpbox']) { + $data = array( + 'guest' => get_forum_select('guest', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'), + 'user' => get_forum_select('user', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'), + ); + + file_write($data['guest'], AJAX_HTML_DIR . '/jumpbox_guest.html', false, true, true); + file_write($data['user'], AJAX_HTML_DIR . '/jumpbox_user.html', false, true, true); +} + // The following assigns all _common_ variables that may be used at any point in a template $template->assign_vars(array( 'SIMPLE_HEADER' => !empty($gen_simple_header), @@ -191,7 +202,7 @@ $template->assign_vars(array( 'PROFILE_URL' => BB_ROOT . PROFILE_URL, 'TOPIC_URL' => BB_ROOT . TOPIC_URL, - 'AJAX_HTML_DIR' => AJAX_HTML_DIR, + 'AJAX_HTML_DIR' => hide_bb_path(AJAX_HTML_DIR), // Misc 'BOT_UID' => BOT_UID, diff --git a/src/Legacy/Datastore/Common.php b/src/Legacy/Datastore/Common.php index b759c1a55..d94509483 100644 --- a/src/Legacy/Datastore/Common.php +++ b/src/Legacy/Datastore/Common.php @@ -39,7 +39,6 @@ class Common */ public $known_items = [ 'cat_forums' => 'build_cat_forums.php', - 'jumpbox' => 'build_cat_forums.php', 'viewtopic_forum_select' => 'build_cat_forums.php', 'latest_news' => 'build_cat_forums.php', 'network_news' => 'build_cat_forums.php', diff --git a/styles/templates/default/page_header.tpl b/styles/templates/default/page_header.tpl index 6587da54d..3eb8709f9 100644 --- a/styles/templates/default/page_header.tpl +++ b/styles/templates/default/page_header.tpl @@ -78,12 +78,14 @@ $(document).ready(function(){ \ \ '); - $('#jumpbox-container').one('click', function(){ - $('#jumpbox-title').html('   {L_LOADING} ...  '); - var jumpbox_src = '/internal_data/ajax_html' + ({LOGGED_IN} ? '/jumpbox_user.html' : '/jumpbox_guest.html'); - $(this).load(jumpbox_src); - $('#jumpbox-submit').click(function(){ window.location.href='{FORUM_URL}'+$('#jumpbox').val(); }); - }); + $('#jumpbox-container').one('click', function () { + $('#jumpbox-title').html('   {L_LOADING} ...  '); + let jumpbox_src = '{AJAX_HTML_DIR}' + ({LOGGED_IN} ? '/jumpbox_user.html' : '/jumpbox_guest.html'); + $(this).load(jumpbox_src); + $('#jumpbox-submit').click(function () { + window.location.href = '{FORUM_URL}' + $('#jumpbox').val(); + }); + }); });