Resolved Preferring a new window, not the overlay, for a click on a user

Discussion in 'Site and Forum Feedback' started by grahamperrin, Jun 14, 2015.

  1. grahamperrin macrumors 601

    grahamperrin

    Joined:
    Jun 8, 2007
    #1
    Please

    What stylesheet override can allow a click on a user's name, or his or her avatar, to open the profile in a new window?

    Background

    I was always surprised by Command-Click never working as expected for clicks on names and avatars whilst reading a topic.

    I did not look at profiles often enough for the misbehaviour to bother me.

    I realised that Command-Click can work as expected when twenty-six or more posts are on the page – thanks to AutoPagerize (see http://forums.macrumors.com/posts/21455119 and http://forums.macrumors.com/posts/21457821) – but there remains the misbehaviour for the first twenty-five.

    I'd like a new tab, consistently, for any and every Command-Click on a name or avatar.
     
  2. redheeler macrumors 603

    redheeler

    Joined:
    Oct 17, 2014
    #2
    Javascript can do this, but not CSS. And it's likely the solution would be to turn the profile link into a normal link, meaning no way to show the user card with a regular click.
     
  3. AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
  4. Mr. Retrofire macrumors 601

    Mr. Retrofire

    Joined:
    Mar 2, 2010
    Location:
    www.emiliana.cl/en
    #4
    This wastes resources for 99.99 % of all MR forum members for no good reason. This increases also green house gas emissions on a global scale.
     
  5. grahamperrin thread starter macrumors 601

    grahamperrin

    Joined:
    Jun 8, 2007
    #5
    The opening post seeks an override. Not a change of design that might affect that percentage.

    That's fine.

    Right now, Web. But later today I'll be back to Safari 7.x in Mavericks.
     
  6. AngerDanger, Jun 16, 2015
    Last edited: Jun 17, 2015

    AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #6
    Based on your post mentioning AutoPagerize, @grahamperrin, you're already familiar with user scripts. Here is a rather clunky workaround for pasting into a new user script:

    Code:
    // ==UserScript==
    // @name UserWindow
    // @namespace http://ss-o.net/
    // @include http://forums.macrumors.com/*
    // ==/UserScript==
    var usernames = document.getElementsByClassName('username');
    for (var n = 0; n < usernames.length; n++){
        if (usernames[n].tagName == 'A'){
            usernames[n].setAttribute('target', '_blank'); // <----
            usernames[n].className = 'dummy';
            usernames[n].style.fontWeight = 'bold';
            n--;
        }
    }
    After applying it, simply clicking on names should open profiles in new tabs. EDIT: If you remove the indicated line, the error @redheeler posted won't occur, but you will need to command-click to open profiles in a new tab instead.
     
  7. redheeler macrumors 603

    redheeler

    Joined:
    Oct 17, 2014
    #7
    What a fantastic idea :D
    Screen Shot 2015-06-16 at 2.58.22 PM.png
     
  8. AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #8
    Urm, yes, I thought it was quite an improvement. :p:oops: How frequently did that appear compared to nothing popping up except for a new tab? Also, what user script extension are you using? I'd like something different from NinjaKit.
     
  9. redheeler macrumors 603

    redheeler

    Joined:
    Oct 17, 2014
    #9
    My own extension which cleanly injects Javascript files into MacRumors Forums like a Safari extension should. I've been nicely browsing the forums with Retina avatars and "Thread Starter" badges for the OP, although your script seems to have broken one of those things :)

    It does it every time I click on a username link.
     
  10. redheeler macrumors 603

    redheeler

    Joined:
    Oct 17, 2014
    #10
    Nope, it's still happening the way I described.
     
  11. AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #11
    Yeah, yeah, yeah, don't worry about making me jealous with all your pixels; 72dpi is totally fine with me. Yep. Completely. :p
    Ah, I can imagine how that happened. Ideally, a script would prevent the calling of whatever function pulls up the member info overlay, but I haven't ben able to find out where in the xenforo.js and other scripts that occurs.

    Darn. I wonder which confounding variable is causing this difference. EDIT: It just happened to me a few times, but refreshing the page cleared it up. 'Clunky' might've been an underestimation of this script's functionality.
     
  12. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #12
    Just right click the name and select open in a new tab. I don't see the need to try to implement such kludgy work arounds.
     
  13. AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #13
    That's because there is no need, only preference.
     
  14. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #14
    Fair enough, but there is a simple work around, especially given that the need imo isn't rather high, i.e., people don't frequently click on the user name to view a member's profile.
     
  15. grahamperrin thread starter macrumors 601

    grahamperrin

    Joined:
    Jun 8, 2007
    #15
    Yes, but (defocusing from the redesigned MacRumors) I'm always bothered when a Command- variation to Click, Enter or Return does not work as expected. For example, with vBulletin here, every part of the search interface that required a contextual menu was a minor annoyance every time that requirement hit me. I always had to think twice before using the Command key; think, then refrain from using the Command key.

    To clarify: I don't suggest a change to the site.

    Sorry, I lack the script fu. Which line?
     
  16. AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #16
    I modified the script so there's an arrow next to the potentially problematic line, but if you're seeing what @redheeler posted, it most likely won't do anything. When I get the time, I'll look into functional solutions.
     
  17. grahamperrin thread starter macrumors 601

    grahamperrin

    Joined:
    Jun 8, 2007
    #17
    @AngerDanger thanks. With and without that line, a Command-click presents the modified overlay. No rush for a solution.
     
  18. redheeler macrumors 603

    redheeler

    Joined:
    Oct 17, 2014
    #18
    Here. This opens a profile in a new tab in addition to the user pop-up card on a Command-click of a username or avatar (@grahamperrin if you're still browsing without avatars you can remove the last line). It won't work with posts that have been inserted after the page load.
    Code:
    function openNewWindowOnCommandClick(linkElements){
        for(var i=0; i<linkElements.length; i++){
            linkElements[i].onclick = function(e){
                if(e.metaKey){
                    window.open(this.href);
                }
            }
        }
    }
    openNewWindowOnCommandClick(document.getElementsByClassName('username'));
    openNewWindowOnCommandClick(document.getElementsByClassName('avatar'));
     
  19. grahamperrin thread starter macrumors 601

    grahamperrin

    Joined:
    Jun 8, 2007
    #19
    From the opening post:

    That wish is realised, so the topic is resolved, but it remains open for any additional contributions.

    Thanks are as indicated above :)
     
  20. AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #20
    Out of curiously, would you mind sharing the script for thread starter badges?
     
  21. redheeler macrumors 603

    redheeler

    Joined:
    Oct 17, 2014
    #21
    No problem :)
    Code:
    function displayThreadStarter(){
        var pageDescription = document.getElementById('pageDescription');
        if(pageDescription == null || pageDescription.getElementsByClassName('username')[0] == null){return;}
        var originalPoster = pageDescription.getElementsByClassName('username')[0].innerHTML;
        var posts = document.getElementsByClassName('message');
        for(var i=0; i<posts.length; i++) {
            var post = posts[i];
            var poster = post.getAttribute('data-author');
            if(poster == originalPoster){
                post.getElementsByClassName('userText')[1].innerHTML += '<em class="userBanner wrapped" itemprop="title" style="background: rgb(84, 191, 86);"><span class="before"></span><strong>Thread Starter</strong><span class="after"></span></em>';
            }
        }
    }
    
     
  22. AngerDanger macrumors 68030

    AngerDanger

    Joined:
    Dec 9, 2008
    #22
    Thanks! FYI, if you want to stay true to Xenforo (whatever that means), userBanner has a class with a green background called bannerGreen. :)
     
  23. redheeler macrumors 603

    redheeler

    Joined:
    Oct 17, 2014
    #23
    Oh, I hadn't noticed that. It's actually closer to the shade of green used for "Thread Starter" on the old forums. I'll have to decide which I like more, but I'm leaning toward the lighter green, just as the "Staff Member" badge uses a custom shade of red.
     
  24. grahamperrin thread starter macrumors 601

    grahamperrin

    Joined:
    Jun 8, 2007
    #24
    Elsewhere please for that thread; http://forums.macrumors.com/threads/posts/21470320 suggested using the generic tips and tricks topic.

    Additional contributions here should relate to the title of this topic. Thanks.
     

Share This Page