Logo on taskbar

Hello guys,
I have added a logo to the taskbar using the script below inside a template node :

the problem is that if I have multiple groups and select them repeatly from the hamburger icon, the logo will appear multiple times on the toolbar instead of showing once at the top right...
How do I get the image to stay fixed at the top right ?

Thanks and regards,
Dominic

<script id="logoscript" type="text/javascript">
    $(function () {

        //add logo
        var div1 = $('<div/>');
        var logo = new Image();

        logo.src = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyNC4zLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4KCjxzdmcKICAgdmVyc2lvbj0iMS4xIgogICB4PSIwcHgiCiAgIHk9IjBweCIKICAgdmlld0JveD0iMCAwIDE5NyAzNC41Njc0NDUiCiAgIHhtbDpzcGFjZT0icHJlc2VydmUiCiAgIGlkPSJzdmcxMiIKICAgc29kaXBvZGk6ZG9jbmFtZT0ibmNfbWFyY2hpb19wb3NpdGl2b19zY2FsYXRvMi5zdmciCiAgIHdpZHRoPSIxOTciCiAgIGhlaWdodD0iMzQuNTY3NDQ0IgogICBpbmtzY2FwZTp2ZXJzaW9uPSIxLjIuMiAoNzMyYTAxZGE2MywgMjAyMi0xMi0wOSkiCiAgIHhtbG5zOmlua3NjYXBlPSJodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy9uYW1lc3BhY2VzL2lua3NjYXBlIgogICB4bWxuczpzb2RpcG9kaT0iaHR0cDovL3NvZGlwb2RpLnNvdXJjZWZvcmdlLm5ldC9EVEQvc29kaXBvZGktMC5kdGQiCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnMKICAgaWQ9Im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UuMyBjIC00LjMsMCAtNy44LDMuNSAtNy44LDcuOCB2IDI2LjYgYyAwLDUuMSA0LjEsOS4yIDkuMiw5LjIgaCAzOC42IGMgNS4xLDAgOS4yLC00LjEgOS4yLC05LjIgdiAtNTEuMiBjIDAuMSwtNC40IC0zLjQsLTcuOSAtNy44LC03LjkgeiBtIC0xNDEuMiw2OC4zIGggMTguNyBWIDI2MyBIIDU4My43IFogTSAxMjkuMiwyODIuNSBoIDE4LjcgViAyNjMgaCAtMTguNyB6IG0gNDMuOSw1LjIgSCAxNTQuNCBWIDM0NyBjIDAsNS4xIDQuMSw5LjIgOS4yLDkuMiBoIDM0LjcgdiAtMTkuNyBoIC0yNS4yIHogbSAzMS42LDY4LjUgSCA2MDIuNCBWIDMzNi41IEggMjA0LjcgWiIKICAgaWQ9InBhdGg2IiAvPgoJPC9nPgo8L2c+CjxnCiAgIGlkPSJMaXZlbGxvXzIiCiAgIGNsYXNzPSJzdDIiCiAgIHRyYW5zZm9ybT0idHJhbnNsYXRlKC05MS41Njc0NzIsLTEzNS4yNTE2KSI+CjwvZz4KPC9zdmc+Cg=='
        logo.height = 30;
        div1[0].style.margin = 'auto 5px auto auto';

        div1.remove(logo);

        function addToToolbar() {
            var toolbar = $('.md-toolbar-tools');
            
            if(!toolbar.length) return;
            
            toolbar.append(div1);
            
        }
        addToToolbar();
    });
</script>

You will need to check if it exists before appending it then.

Give your logo an id eg "myId" then check for it

var exists = document.getElementById("myId");
if(!exists) {addToToolbar()}

2 Likes

Hi smcgann99,
forgive me, not sure how to modify my code with your solution...

Thanks,
Dominic

Ok got it!

if(!exists) {addToToolbar()}

Thanks for your time and effort!

cheers
Dominic

Sorry about the typo :wink:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.