Hey,
I have this really weird occurrence in which one script messes with another and I cannot really grasp why:
this is the code I use to hide all avatars for guests and make them see only a standard-avatar. I use it inline in the overall_header template because otherwise it's too slow when used with the script management in the administration panel.
it worked perfectly, until I recently implemnted the code for displaying the group numbers in the legend of the groups
Can somebody help me? I'd really like to have the avatar-script working again. At the moment the avatar-one only sets the visibility to hidden, which is at least something, I guess. But I'd also have the alternative avatar displayed again.
I'm using modernbb
I have this really weird occurrence in which one script messes with another and I cannot really grasp why:
- Code:
<!-- BEGIN switch_user_logged_out -->
<style type="text/css">
.postprofile-avatar img,
.lastpost-avatar img,
.avatar-mini img,
.mod-login-avatar img {
visibility: hidden;
}
.tooltipster-base img { display: none; }
</style>
<script type="text/javascript">
(function($) {
var $img = [
'.postprofile-avatar img',
'.lastpost-avatar img',
'.avatar-mini img',
'.mod-login-avatar img',
];
$(function() {
$($img.join(',')).each(function() {
var $this = $(this);
$this.attr('src', 'https://2img.net/i/fa/modernbb/pp-blank-thumb.png').css('visibility', 'visible');
});
});
}(jQuery));
</script>
<!-- END switch_user_logged_out -->
this is the code I use to hide all avatars for guests and make them see only a standard-avatar. I use it inline in the overall_header template because otherwise it's too slow when used with the script management in the administration panel.
it worked perfectly, until I recently implemnted the code for displaying the group numbers in the legend of the groups
- Code:
$(document).ready(function() {
const FORUM_VERSION = _userdata["tpl_used"];
var objs = {
'subsilver': $(".gensmall b a"),
'prosilver': $("em b a"),
'punbb': $("p b a"),
'invision': $("div b a"),
'modernbb': $(".block-footer b a"),
'awesomebb': $("em b a")
};
var numberOfGroups = objs[FORUM_VERSION].length;
for (i = 0; i < numberOfGroups; i++) {
var titleValue = objs[FORUM_VERSION][i].getAttribute("title");
var numberOfUsers = titleValue.slice(titleValue.indexOf(":"));
var originalText = objs[FORUM_VERSION][i].innerHTML;
objs[FORUM_VERSION][i].innerHTML = originalText + numberOfUsers;
}
});
Can somebody help me? I'd really like to have the avatar-script working again. At the moment the avatar-one only sets the visibility to hidden, which is at least something, I guess. But I'd also have the alternative avatar displayed again.
I'm using modernbb
Last edited by Zwiebel on Tue Jan 31, 2023 8:55 am; edited 1 time in total