Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Actions/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ protected function setupTemplate(): void
}

// topic.js
Theme::loadJavaScriptFile('topic.js', ['defer' => false, 'minimize' => true], 'smf_topic');
Theme::loadJavaScriptFile('topic.js', ['defer' => true, 'minimize' => true], 'smf_topic');

// quotedText.js
Theme::loadJavaScriptFile('quotedText.js', ['defer' => true, 'minimize' => true], 'smf_quotedText');
Expand Down
2 changes: 1 addition & 1 deletion Sources/Actions/MessageIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ protected function setupTemplate(): void
Theme::loadTemplate('MessageIndex');

// Javascript for inline editing.
Theme::loadJavaScriptFile('topic.js', ['defer' => false, 'minimize' => true], 'smf_topic');
Theme::loadJavaScriptFile('topic.js', ['defer' => true, 'minimize' => true], 'smf_topic');

// 'Print' the header and board info.
Utils::$context['page_title'] = strip_tags(Board::$info->name);
Expand Down
2 changes: 2 additions & 0 deletions Sources/Actions/Search2.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ protected function setupTemplate(): void
}
}

Theme::loadJavaScriptFile('topic.js', ['defer' => true, 'minimize' => true], 'smf_topic');

SearchApi::$loadedApi->resultsContext();
}

Expand Down
132 changes: 52 additions & 80 deletions Themes/default/Display.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,63 +288,45 @@ function template_main()
</div>';

echo '
<script>';
<script>
window.addEventListener("DOMContentLoaded", function() {';

if (!empty(Theme::$current->options['display_quick_mod']) && Theme::$current->options['display_quick_mod'] == 1 && Utils::$context['can_remove_post'])
{
echo '
var oInTopicModeration = new InTopicModeration({
sCheckboxContainerMask: \'in_topic_mod_check_\',
aMessageIds: [\'', implode('\', \'', Utils::$context['removableMessageIDs']), '\'],
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sButtonStrip: \'moderationbuttons\',
sButtonStripDisplay: \'moderationbuttons_strip\',
bUseImageButton: false,
bCanRemove: ', Utils::$context['can_remove_post'] ? 'true' : 'false', ',
sRemoveButtonLabel: \'', Lang::getTxt('quickmod_delete_selected', file: 'General'), '\',
sRemoveButtonImage: \'delete_selected.png\',
sRemoveButtonConfirm: \'', Lang::getTxt('quickmod_confirm', file: 'General'), '\',
bCanRestore: ', Utils::$context['can_restore_msg'] ? 'true' : 'false', ',
sRestoreButtonLabel: \'', Lang::getTxt('quick_mod_restore', file: 'General'), '\',
sRestoreButtonImage: \'restore_selected.png\',
sRestoreButtonConfirm: \'', Lang::getTxt('quickmod_confirm', file: 'General'), '\',
bCanSplit: ', Utils::$context['can_split'] ? 'true' : 'false', ',
sSplitButtonLabel: \'', Lang::getTxt('quickmod_split_selected', file: 'General'), '\',
sSplitButtonImage: \'split_selected.png\',
sSplitButtonConfirm: \'', Lang::getTxt('quickmod_confirm', file: 'General'), '\',
sFormId: \'quickModForm\'
});';

// Add it to the mobile button strip as well
echo '
var oInTopicModerationMobile = new InTopicModeration({
sCheckboxContainerMask: \'in_topic_mod_check_\',
aMessageIds: [\'', implode('\', \'', Utils::$context['removableMessageIDs']), '\'],
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sButtonStrip: \'moderationbuttons_mobile\',
sButtonStripDisplay: \'moderationbuttons_strip_mobile\',
bUseImageButton: false,
bCanRemove: ', Utils::$context['can_remove_post'] ? 'true' : 'false', ',
sRemoveButtonLabel: \'', Lang::getTxt('quickmod_delete_selected', file: 'General'), '\',
sRemoveButtonImage: \'delete_selected.png\',
sRemoveButtonConfirm: \'', Lang::getTxt('quickmod_confirm', file: 'General'), '\',
bCanRestore: ', Utils::$context['can_restore_msg'] ? 'true' : 'false', ',
sRestoreButtonLabel: \'', Lang::getTxt('quick_mod_restore', file: 'General'), '\',
sRestoreButtonImage: \'restore_selected.png\',
sRestoreButtonConfirm: \'', Lang::getTxt('quickmod_confirm', file: 'General'), '\',
bCanSplit: ', Utils::$context['can_split'] ? 'true' : 'false', ',
sSplitButtonLabel: \'', Lang::getTxt('quickmod_split_selected', file: 'General'), '\',
sSplitButtonImage: \'split_selected.png\',
sSplitButtonConfirm: \'', Lang::getTxt('quickmod_confirm', file: 'General'), '\',
sFormId: \'quickModForm\'
});';
const strips = [
{ id: "moderationbuttons", display: "moderationbuttons_strip", varName: "oInTopicModeration" },
{ id: "moderationbuttons_mobile", display: "moderationbuttons_strip_mobile", varName: "oInTopicModerationMobile" }
];

for (let i = 0; i < strips.length; i++) {
const strip = strips[i];
window[strip.varName] = new InTopicModeration({
sCheckboxContainerMask: "in_topic_mod_check_",
aMessageIds: ["', implode('", "', Utils::$context['removableMessageIDs']), '"],
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sButtonStrip: strip.id,
sButtonStripDisplay: strip.display,
bUseImageButton: false,
bCanRemove: ', Utils::$context['can_remove_post'] ? 'true' : 'false', ',
sRemoveButtonLabel: "', Lang::getTxt('quickmod_delete_selected', file: 'General'), '",
sRemoveButtonImage: "delete_selected.png",
sRemoveButtonConfirm: "', Lang::getTxt('quickmod_confirm', file: 'General'), '",
bCanRestore: ', Utils::$context['can_restore_msg'] ? 'true' : 'false', ',
sRestoreButtonLabel: "', Lang::getTxt('quick_mod_restore', file: 'General'), '",
sRestoreButtonImage: "restore_selected.png",
sRestoreButtonConfirm: "', Lang::getTxt('quickmod_confirm', file: 'General'), '",
bCanSplit: ', Utils::$context['can_split'] ? 'true' : 'false', ',
sSplitButtonLabel: "', Lang::getTxt('quickmod_split_selected', file: 'General'), '",
sSplitButtonImage: "split_selected.png",
sSplitButtonConfirm: "', Lang::getTxt('quickmod_confirm', file: 'General'), '",
sFormId: "quickModForm"
});
}';
}

echo '
if (\'XMLHttpRequest\' in window)
{
var oQuickModify = new QuickModify({
sScriptUrl: smf_scripturl,
sClassName: \'quick_edit\',
Expand All @@ -371,7 +353,7 @@ function template_main()
sFormRemoveAccessKeys: \'postmodify\'' : '', '
});

aJumpTo[aJumpTo.length] = new JumpTo({
new JumpTo({
sContainerId: "display_jump_to",
sJumpToTemplate: "<label class=\"smalltext jump_to\" for=\"%select_id%\">', Utils::$context['jump_to']['label'], '<" + "/label> %dropdown_list%",
iCurBoardId: ', Utils::$context['current_board'], ',
Expand All @@ -384,34 +366,23 @@ function template_main()
sGoButtonLabel: "', Lang::getTxt('go', file: 'General'), '"
});

aIconLists[aIconLists.length] = new IconList({
sBackReference: "aIconLists[" + aIconLists.length + "]",
new IconList({
sIconIdPrefix: "msg_icon_",
sScriptUrl: smf_scripturl,
bShowModify: ', !empty(Config::$modSettings['show_modify']) ? 'true' : 'false', ',
iBoardId: ', Utils::$context['current_board'], ',
iTopicId: ', Utils::$context['current_topic'], ',
sSessionId: smf_session_id,
sSessionVar: smf_session_var,
sLabelIconList: "', Lang::getTxt('message_icon', file: 'General'), '",
sBoxBackground: "transparent",
sBoxBackgroundHover: "#ffffff",
iBoxBorderWidthHover: 1,
sBoxBorderColorHover: "#adadad" ,
sContainerBackground: "#ffffff",
sContainerBorder: "1px solid #adadad",
sItemBorder: "1px solid #ffffff",
sItemBorderHover: "1px dotted gray",
sItemBackground: "transparent",
sItemBackgroundHover: "#e0e0f0"
});
}';
sLabelIconList: "', Lang::getTxt('message_icon', file: 'General'), '"
});';

if (!empty(Utils::$context['ignoredMsgs']))
echo '
ignore_toggles([', implode(', ', Utils::$context['ignoredMsgs']), '], ', Utils::escapeJavaScript(Lang::getTxt('show_ignore_user_post', file: 'General')), ');';
ignore_toggles([', implode(', ', Utils::$context['ignoredMsgs']), '], ', Utils::escapeJavaScript(Lang::getTxt('show_ignore_user_post', file: 'General')), ');';

echo '
});
</script>';
}

Expand Down Expand Up @@ -1039,21 +1010,22 @@ function insertQuoteFast(messageid)

echo '
<script>
var oQuickReply = new QuickReply({
bDefaultCollapsed: false,
iTopicId: ', Utils::$context['current_topic'], ',
iStart: ', Utils::$context['start'], ',
sScriptUrl: smf_scripturl,
sImagesUrl: smf_images_url,
sContainerId: "quickreply_options",
sImageId: "quickReplyExpand",
sClassCollapsed: "toggle_up",
sClassExpanded: "toggle_down",
sJumpAnchor: "quickreply_anchor",
bIsFull: true
window.addEventListener("DOMContentLoaded", function() {
new QuickReply({
bDefaultCollapsed: false,
iTopicId: ', Utils::$context['current_topic'], ',
iStart: ', Utils::$context['start'], ',
sScriptUrl: smf_scripturl,
sImagesUrl: smf_images_url,
sContainerId: "quickreply_options",
sImageId: "quickReplyExpand",
sClassCollapsed: "toggle_up",
sClassExpanded: "toggle_down",
sJumpAnchor: "quickreply_anchor",
bIsFull: true
});
});
var oEditorID = "', Utils::$context['post_box_name'], '";
var oEditorObject = oEditorHandle_', Utils::$context['post_box_name'], ';
var oJumpAnchor = "quickreply_anchor";
</script>';
}
30 changes: 16 additions & 14 deletions Themes/default/MessageIndex.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ function template_main()
', $topic['is_posted_in'] ? '<span class="main_icons profile_sm"></span>' : '', '
</div>
<div class="info', !empty(Utils::$context['can_quick_mod']) ? '' : ' info_block', '">
<div ', (!empty($topic['quick_mod']['modify']) ? 'id="topic_' . $topic['first_post']['id'] . '" ondblclick="oQuickModifyTopic.modify_topic(\'' . $topic['id'] . '\', \'' . $topic['first_post']['id'] . '\');"' : ''), '>';
<div ', (!empty($topic['quick_mod']['modify']) ? 'data-msg-id="' . $topic['first_post']['id'] : ''), '">';

// Now we handle the icons
echo '
<div class="icons floatright">';
<div id="icons', $topic['first_post']['id'], '" class="icons floatright">';

if ($topic['is_watched'])
echo '
Expand Down Expand Up @@ -237,7 +237,7 @@ function template_main()
<div class="message_index_title">
', $topic['new'] && User::$me->is_logged ? '<a href="' . $topic['new_href'] . '" id="newicon' . $topic['first_post']['id'] . '" class="new_posts">' . Lang::getTxt('new', file: 'General') . '</a>' : '', '
<span class="preview', $topic['is_sticky'] ? ' bold_text' : '', '" title="', $topic[(empty(Config::$modSettings['message_index_preview_first']) ? 'last_post' : 'first_post')]['preview'], '">
<span id="msg_', $topic['first_post']['id'], '">', $topic['first_post']['link'], (!$topic['approved'] ? '&nbsp;<em>(' . Lang::getTxt('awaiting_approval', file: 'General') . ')</em>' : ''), '</span>
<span id="msg', $topic['first_post']['id'], '">', $topic['first_post']['link'], (!$topic['approved'] ? '&nbsp;<em>(' . Lang::getTxt('awaiting_approval', file: 'General') . ')</em>' : ''), '</span>
</span>
</div>
<p class="floatleft">
Expand Down Expand Up @@ -346,11 +346,13 @@ function template_main()
// Show breadcrumbs at the bottom too.
theme_linktree();

if (!empty(Utils::$context['can_quick_mod']) && Theme::$current->options['display_quick_mod'] == 1 && !empty(Utils::$context['topics']) && Utils::$context['can_move'])
echo '
<script>
if (typeof(window.XMLHttpRequest) != "undefined")
aJumpTo[aJumpTo.length] = new JumpTo({
window.addEventListener("DOMContentLoaded", function() {';

if (!empty(Utils::$context['can_quick_mod']) && Theme::$current->options['display_quick_mod'] == 1 && !empty(Utils::$context['topics']) && Utils::$context['can_move'])
echo '
new JumpTo({
sContainerId: "quick_mod_jump_to",
sClassName: "qaction",
sJumpToTemplate: "%dropdown_list%",
Expand All @@ -364,15 +366,14 @@ function template_main()
bNoRedirect: true,
bDisabled: true,
sCustomName: "move_to"
});
</script>';
});';

// Javascript for inline editing.
echo '
<script>
var oQuickModifyTopic = new QuickModifyTopic({
aHidePrefixes: Array("lockicon", "stickyicon", "pages", "newicon"),
bMouseOnDiv: false,
new QuickModifyTopic({
aHidePrefixes: ["icons", "msg", "pages", "newicon"],
sTopicContainer: "topic_container",
});
});
</script>';

Expand Down Expand Up @@ -548,8 +549,8 @@ function template_topic_legend()
if (!empty(Utils::$context['jump_to']))
echo '
<script>
if (typeof(window.XMLHttpRequest) != "undefined")
aJumpTo[aJumpTo.length] = new JumpTo({
window.addEventListener("DOMContentLoaded", function() {
new JumpTo({
sContainerId: "message_index_jump_to",
sJumpToTemplate: "<label class=\"smalltext jump_to\" for=\"%select_id%\">', Utils::$context['jump_to']['label'], '<" + "/label> %dropdown_list%",
iCurBoardId: ', Utils::$context['current_board'], ',
Expand All @@ -561,6 +562,7 @@ function template_topic_legend()
sCatPrefix: "",
sGoButtonLabel: "', Lang::getTxt('quick_mod_go', file: 'General'), '"
});
});
</script>';

echo '
Expand Down
25 changes: 13 additions & 12 deletions Themes/default/Search.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,18 +460,19 @@ function template_results()
echo '
<div class="smalltext pagelinks floatright" id="search_jump_to"></div>
<script>
if (typeof(window.XMLHttpRequest) != "undefined")
aJumpTo[aJumpTo.length] = new JumpTo({
sContainerId: "search_jump_to",
sJumpToTemplate: "<label class=\"smalltext jump_to\" for=\"%select_id%\">', Utils::$context['jump_to']['label'], '<" + "/label> %dropdown_list%",
iCurBoardId: 0,
iCurBoardChildLevel: 0,
sCurBoardName: "', Utils::$context['jump_to']['board_name'], '",
sBoardChildLevelIndicator: "==",
sBoardPrefix: "=> ",
sCatSeparator: "-----------------------------",
sCatPrefix: "",
sGoButtonLabel: "', Lang::getTxt('quick_mod_go', file: 'General'), '"
window.addEventListener("DOMContentLoaded", function() {
new JumpTo({
sContainerId: "search_jump_to",
sJumpToTemplate: "<label class=\"smalltext jump_to\" for=\"%select_id%\">', Utils::$context['jump_to']['label'], '<" + "/label> %dropdown_list%",
iCurBoardId: 0,
iCurBoardChildLevel: 0,
sCurBoardName: "', Utils::$context['jump_to']['board_name'], '",
sBoardChildLevelIndicator: "==",
sBoardPrefix: "=> ",
sCatSeparator: "-----------------------------",
sCatPrefix: "",
sGoButtonLabel: "', Lang::getTxt('quick_mod_go', file: 'General'), '"
});
});
</script>
</div>';
Expand Down
37 changes: 35 additions & 2 deletions Themes/default/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ blockquote cite::before {
margin: 5px;
}
.bbc_details[open] > .bbc_summary {
padding-bottom: 7px;
padding-bottom: 7px;
border-bottom: 1px dotted #aaa;
}
.bbc_inline_spoiler {
Expand Down Expand Up @@ -4018,6 +4018,39 @@ p.information img {
.topic_pages::after {
content: " \00bb"
}

/* Icon container (normal) */
.icon_list_box {
background: transparent;
padding: 3px;
text-align: center;
cursor: pointer;
}
.icon_list_box:hover {
background: #ffffff;
border: 1px solid #adadad;
padding: 2px;
}
.icon_list_container {
position: absolute;
cursor: pointer;
background: #ffffff;
border: 1px solid #adadad;
padding: 6px 0;
z-index: 1000;
}
.icon_list_item {
padding: 2px 3px;
line-height: 20px;
border: 1px solid #ffffff;
background: transparent;
display: inline-block;
}
.icon_list_item:hover {
background: #e0e0f0;
border: 1px dotted gray;
}

/* Mentions */
.atwho-view {
position: absolute;
Expand Down Expand Up @@ -4255,7 +4288,7 @@ h3.profile_hd::before,
margin-top: 12px;
}
#attachment_previews {
display: none;
display: none;
}
#attachment_previews div.descbox > div,
#attachment_previews div.errorbox > div,
Expand Down
Loading