From 46d8e3d9510d268b54698bed6cc9c04366ae4d19 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 11 Aug 2022 18:49:37 +0800 Subject: [PATCH] dynamic medal size --- include/functions.php | 13 ++++++++++--- public/js/nexus.js | 1 - 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/functions.php b/include/functions.php index 537fd4a9..050d4296 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3695,7 +3695,9 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f $leechwarnpic = "leechwarnedbig"; $warnedpic = "warnedbig"; $disabledpic = "disabledbig"; - $style = "style='margin-left: 4pt'"; + $marginLeft = '4pt'; + $medalSize = '16px'; + $style = "style='margin-left: $marginLeft'"; } else { @@ -3703,7 +3705,9 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f $leechwarnpic = "leechwarned"; $warnedpic = "warned"; $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')) ? "\"Donor\"" : ""; @@ -3737,7 +3741,10 @@ function get_username($id, $big = false, $link = true, $bold = true, $target = f //medal $medalHtml = ''; foreach ($arr['wearing_medals'] as $medal) { - $medalHtml .= sprintf('', $medal['image_large'], $medal['name']); + $medalHtml .= sprintf( + '', + $medal['image_large'], $medal['name'], $medalSize, $medalSize, $marginLeft + ); } $href = getSchemeAndHttpHost() . "/userdetails.php?id=$id"; diff --git a/public/js/nexus.js b/public/js/nexus.js index 3ace044b..0e5622e3 100644 --- a/public/js/nexus.js +++ b/public/js/nexus.js @@ -10,7 +10,6 @@ jQuery(document).ready(function () { var previewEle = jQuery('#nexus-preview') jQuery("body").on("mouseover", ".preview", function (e) { - console.log(e) let src = jQuery(this).attr("src") if (src) { previewEle.attr("src", src).css({"display": "block", "left": e.pageX + 5, "top": e.pageY + 5})