Skip to content

Commit

Permalink
News: Add support for minisprites (#2300)
Browse files Browse the repository at this point in the history
* News: Add support for minisprites

* SANITIZE THE HTML.
  • Loading branch information
KrisXV authored Nov 26, 2024
1 parent 72d1216 commit e4e9512
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/js/client-mainmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
options.noMinimize = options.noMinimize || false;

this.$pmBox[options.append ? 'append' : 'prepend']('<div class="pm-window ' + options.cssClass + '" ' + options.attributes + '><h3><button class="closebutton" tabindex="-1" aria-label="Close"><i class="fa fa-times-circle"></i></button>' + (!options.noMinimize ? '<button class="minimizebutton" tabindex="-1" aria-label="Minimize"><i class="fa fa-minus-circle"></i></button>' : '') + options.title + '</h3><div class="pm-log" style="overflow:visible;height:' + (typeof options.height === 'number' ? options.height + 'px' : options.height) + ';' + (parseInt(options.height, 10) ? 'max-height:none' : (options.maxHeight ? 'max-height:' + (typeof options.maxHeight === 'number' ? options.maxHeight + 'px' : options.maxHeight) : '')) + '">' +
options.html +
BattleLog.sanitizeHTML(options.html) +
'</div></div>');
},

Expand Down
4 changes: 4 additions & 0 deletions pokemonshowdown.com/news/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function saveNews() {
$summary = str_replace("[/url]", '</a>', $summary);
$summary = str_replace("[b]", '<strong>', $summary);
$summary = str_replace("[/b]", '</strong>', $summary);
$summary = preg_replace('/\[psicon (pokemon|item|type|category)="([^\]]+)"\]/', '<psicon $1="$2" />', $summary);
$summary = preg_replace('/\[psicon (pokemon|item|type|category)=([^\]]+)\]/', '<psicon $1="$2" />', $summary);
$summary = '<p>'.$summary.'</p>';

$newsCache[$topic_id]['summary_html'] = $summary;
Expand All @@ -88,6 +90,8 @@ function saveNews() {
$details = str_replace("[/url]", '</a>', $details);
$details = str_replace("[b]", '<strong>', $details);
$details = str_replace("[/b]", '</strong>', $details);
$details = preg_replace('/\[psicon (pokemon|item|type|category)="([^\]]+)"\]/', '<psicon $1="$2" />', $details);
$details = preg_replace('/\[psicon (pokemon|item|type|category)=([^\]]+)\]/', '<psicon $1="$2" />', $details);
$details = '<p>'.$details.'</p>';
$newsCache[$topic_id]['details_html'] = $details;
} else {
Expand Down

0 comments on commit e4e9512

Please sign in to comment.