Skip to content

Commit

Permalink
Move -you_sure- from javascript to class
Browse files Browse the repository at this point in the history
  • Loading branch information
XinYenFon committed May 23, 2020
1 parent dcbbf52 commit 93c3799
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
6 changes: 4 additions & 2 deletions Sources/Display.php
Original file line number Diff line number Diff line change
Expand Up @@ -1686,14 +1686,16 @@ function prepareDisplayContext($reset = false)
'remove_topic' => array(
'label' => $txt['remove_topic'],
'href' => $scripturl.'?action=removetopic2;topic='.$context['current_topic'].'.'.$context['start'].';'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['are_sure_remove_topic'].'" class="you_sure"',
'javascript' => 'data-confirm="'.$txt['are_sure_remove_topic'].'"',
'class' => 'you_sure',
'icon' => 'remove_button',
'show' => $context['can_delete'] && ($context['topic_first_message'] == $output['id'])
),
'remove' => array(
'label' => $txt['remove'],
'href' => $scripturl.'?action=deletemsg;topic='.$context['current_topic'].'.'.$context['start'].';msg='.$output['id'].';'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['remove_message_question'].'" class="you_sure"',
'javascript' => 'data-confirm="'.$txt['remove_message_question'].'"',
'class' => 'you_sure',
'icon' => 'remove_button',
'show' => $output['can_remove'] && ($context['topic_first_message'] != $output['id'])
),
Expand Down
6 changes: 4 additions & 2 deletions Sources/Drafts.php
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,8 @@ function showProfileDrafts($memID, $draft_type = 0)
'delete' => array(
'label' => $txt['draft_delete'],
'href' => $scripturl.'?action=profile;u='.$context['member']['id'].';area=showdrafts;delete='.$row['id_draft'].';'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['draft_remove'].'" class="you_sure"',
'javascript' => 'data-confirm="'.$txt['draft_remove'].'"',
'class' => 'you_sure',
'icon' => 'remove_button'
),
),
Expand Down Expand Up @@ -842,7 +843,8 @@ function showPMDrafts($memID = -1)
'delete' => array(
'label' => $txt['draft_delete'],
'href' => $scripturl.'?action=pm;sa=showpmdrafts;delete='.$row['id_draft'].';'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['draft_remove'].'?" class="you_sure"',
'javascript' => 'data-confirm="'.$txt['draft_remove'].'?"',
'class' => 'you_sure',
'icon' => 'remove_button'
),
),
Expand Down
6 changes: 4 additions & 2 deletions Sources/PersonalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,8 @@ function prepareMessageContext($type = 'subject', $reset = false)
'delete' => array(
'label' => $txt['delete'],
'href' => $scripturl . '?action=pm;sa=pmactions;pm_actions%5b' . $output['id'] . '%5D=delete;f=' . $context['folder'] . ';start=' . $context['start'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'],
'javascript' => 'data-confirm="' . JavaScriptEscape($txt['remove_message_question']) . '" class="you_sure"',
'javascript' => 'data-confirm="' . JavaScriptEscape($txt['remove_message_question']) . '"',
'class' => 'you_sure',
'icon' => 'remove_button',
),
'more' => array(
Expand Down Expand Up @@ -1771,7 +1772,8 @@ function MessageSearch2()
'delete' => array(
'label' => $txt['delete'],
'href' => $scripturl . '?action=pm;sa=pmactions;pm_actions%5b' . $row['id_pm'] . '%5D=delete;f=' . $context['folder'] . ';start=' . $context['start'] . ($context['current_label_id'] != -1 ? ';l=' . $context['current_label_id'] : '') . ';' . $context['session_var'] . '=' . $context['session_id'],
'javascript' => 'data-confirm="' . JavaScriptEscape($txt['remove_message_question']) . '" class="you_sure"',
'javascript' => 'data-confirm="' . JavaScriptEscape($txt['remove_message_question']) . '"',
'class' => 'you_sure',
'icon' => 'remove_button',
),
'more' => array(
Expand Down
5 changes: 3 additions & 2 deletions Sources/Profile-View.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ function showAlerts($memID)
'delete' => array(
'label' => $txt['delete'],
'href' => $scripturl . '?action=profile;u=' . $context['id_member'] . ';area=showalerts;do=remove;aid=' . $id . ';' . $context['session_var'] . '=' . $context['session_id'] . (!empty($context['start']) ? ';start=' . $context['start'] : ''),
'javascript' => 'class="you_sure"',
'class' => 'you_sure',
'icon' => 'remove_button'
),
'mark' => array(
Expand Down Expand Up @@ -1173,7 +1173,8 @@ function showPosts($memID)
'remove' => array(
'label' => $txt['remove'],
'href' => $scripturl.'?action=deletemsg;msg='.$post['id'].';topic='.$post['topic'].';profile;u='.$context['member']['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['remove_message'].'" class="you_sure"',
'javascript' => 'data-confirm="'.$txt['remove_message'].'"',
'class' => 'you_sure',
'icon' => 'remove_button',
'show' => $post['can_delete']
)
Expand Down
3 changes: 2 additions & 1 deletion Sources/Recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,8 @@ function RecentPosts()
'delete' => array(
'label' => $txt['remove'],
'href' => $scripturl.'?action=deletemsg;msg='.$post['id'].';topic='.$post['topic'].';recent;'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['remove_message'].'" class="you_sure"',
'javascript' => 'data-confirm="'.$txt['remove_message'].'"',
'class' => 'you_sure',
'icon' => 'remove_button',
'show' => $post['can_delete']
),
Expand Down
6 changes: 4 additions & 2 deletions Sources/ReportedContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ function ReportedContent()
'ignore' => array(
'label' => $report['ignore'] ? $txt['mc_reportedp_unignore'] : $txt['mc_reportedp_ignore'],
'href' => $scripturl.'?action=moderate;area=reported'.$context['report_type'].';sa=handle;ignore='.(int)!$report['ignore'].';rid='.$report['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'].';'.$context['mod-report-ignore_token_var'].'='.$context['mod-report-ignore_token'],
'javascript' => !$report['ignore'] ? ' class="you_sure" data-confirm="' . $txt['mc_reportedp_ignore_confirm'] . '"' : '',
'javascript' => !$report['ignore'] ? ' data-confirm="' . $txt['mc_reportedp_ignore_confirm'] . '"' : '',
'class' => 'you_sure',
'icon' => 'ignore'
),
'close' => array(
Expand All @@ -109,7 +110,8 @@ function ReportedContent()
$context['reports'][$key]['quickbuttons']['delete'] = array(
'label' => $txt['mc_reportedp_delete'],
'href' => $scripturl.'?action=deletemsg;topic='.$report['topic']['id'].'.0;msg='.$report['topic']['id_msg'].';modcenter;'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="'.$txt['mc_reportedp_delete_confirm'].'" class="you_sure"',
'javascript' => 'data-confirm="'.$txt['mc_reportedp_delete_confirm'].'"',
'class' => 'you_sure',
'icon' => 'delete',
'show' => !$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards']))
);
Expand Down
3 changes: 2 additions & 1 deletion Themes/default/ModerationCenter.template.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ function template_user_watch_post_callback($post)
'delete' => array(
'label' => $txt['remove_message'],
'href' => $scripturl.'?action=moderate;area=userwatch;sa=post;delete='.$post['id'].';start='.$context['start'].';'.$context['session_var'].'='.$context['session_id'],
'javascript' => 'data-confirm="' . $txt['mc_watched_users_delete_post'] . '" class="you_sure"',
'javascript' => 'data-confirm="' . $txt['mc_watched_users_delete_post'] . '"',
'class' => 'you_sure',
'icon' => 'remove_button',
'show' => $post['can_delete']
),
Expand Down

0 comments on commit 93c3799

Please sign in to comment.