Revert "Minor improvements (#766)"

This reverts commit 75c0920dce.
This commit is contained in:
Roman Kelesidis 2023-06-08 00:03:01 +07:00
commit 4c725f6246
5 changed files with 41 additions and 20 deletions

View file

@ -103,6 +103,21 @@ $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
//

View file

@ -1002,6 +1002,24 @@ 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)
{

View file

@ -108,17 +108,6 @@ $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),
@ -202,7 +191,7 @@ $template->assign_vars(array(
'PROFILE_URL' => BB_ROOT . PROFILE_URL,
'TOPIC_URL' => BB_ROOT . TOPIC_URL,
'AJAX_HTML_DIR' => hide_bb_path(AJAX_HTML_DIR),
'AJAX_HTML_DIR' => AJAX_HTML_DIR,
// Misc
'BOT_UID' => BOT_UID,

View file

@ -39,6 +39,7 @@ 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',

View file

@ -78,13 +78,11 @@ $(document).ready(function(){
</span> \
<input id="jumpbox-submit" type="button" class="lite" value="{L_GO}" /> \
');
$('#jumpbox-container').one('click', function () {
$('#jumpbox-container').one('click', function(){
$('#jumpbox-title').html('&nbsp;&nbsp; {L_LOADING} ... &nbsp;');
let jumpbox_src = '{AJAX_HTML_DIR}' + ({LOGGED_IN} ? '/jumpbox_user.html' : '/jumpbox_guest.html');
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-submit').click(function(){ window.location.href='{FORUM_URL}'+$('#jumpbox').val(); });
});
});
<!-- ENDIF -->