dynamic medal size

This commit is contained in:
xiaomlove
2022-08-11 18:49:37 +08:00
parent 8071efd487
commit 46d8e3d951
2 changed files with 10 additions and 4 deletions
+10 -3
View File
@@ -3695,7 +3695,9 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f
$leechwarnpic = "leechwarnedbig"; $leechwarnpic = "leechwarnedbig";
$warnedpic = "warnedbig"; $warnedpic = "warnedbig";
$disabledpic = "disabledbig"; $disabledpic = "disabledbig";
$style = "style='margin-left: 4pt'"; $marginLeft = '4pt';
$medalSize = '16px';
$style = "style='margin-left: $marginLeft'";
} }
else else
{ {
@@ -3703,7 +3705,9 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f
$leechwarnpic = "leechwarned"; $leechwarnpic = "leechwarned";
$warnedpic = "warned"; $warnedpic = "warned";
$disabledpic = "disabled"; $disabledpic = "disabled";
$style = "style='margin-left: 2pt'"; $marginLeft = '2pt';
$medalSize = '11px';
$style = "style='margin-left: $marginLeft'";
} }
$pics = $arr["donor"] == "yes" && ($arr['donoruntil'] === null || $arr['donoruntil'] < '1970' || $arr['donoruntil'] >= date('Y-m-d H:i:s')) ? "<img class=\"".$donorpic."\" src=\"/pic/trans.gif\" alt=\"Donor\" ".$style." />" : ""; $pics = $arr["donor"] == "yes" && ($arr['donoruntil'] === null || $arr['donoruntil'] < '1970' || $arr['donoruntil'] >= date('Y-m-d H:i:s')) ? "<img class=\"".$donorpic."\" src=\"/pic/trans.gif\" alt=\"Donor\" ".$style." />" : "";
@@ -3737,7 +3741,10 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f
//medal //medal
$medalHtml = ''; $medalHtml = '';
foreach ($arr['wearing_medals'] as $medal) { foreach ($arr['wearing_medals'] as $medal) {
$medalHtml .= sprintf('<img src="%s" title="%s" class="preview" style="max-height: 16px;max-width: 16px;margin-left: 2pt"/>', $medal['image_large'], $medal['name']); $medalHtml .= sprintf(
'<img src="%s" title="%s" class="preview" style="max-height: %s;max-width: %s;margin-left: %s"/>',
$medal['image_large'], $medal['name'], $medalSize, $medalSize, $marginLeft
);
} }
$href = getSchemeAndHttpHost() . "/userdetails.php?id=$id"; $href = getSchemeAndHttpHost() . "/userdetails.php?id=$id";
-1
View File
@@ -10,7 +10,6 @@ jQuery(document).ready(function () {
var previewEle = jQuery('#nexus-preview') var previewEle = jQuery('#nexus-preview')
jQuery("body").on("mouseover", ".preview", function (e) { jQuery("body").on("mouseover", ".preview", function (e) {
console.log(e)
let src = jQuery(this).attr("src") let src = jQuery(this).attr("src")
if (src) { if (src) {
previewEle.attr("src", src).css({"display": "block", "left": e.pageX + 5, "top": e.pageY + 5}) previewEle.attr("src", src).css({"display": "block", "left": e.pageX + 5, "top": e.pageY + 5})