Not signed in (Sign In)

Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  

    I just went to Math Overflow from a different computer, without logging in, and noticed that questions contain the following banner:

    Remember to vote up questions/answers you find interesting or helpful (requires 15 reputation points)

    From my reading of the above, the banner seems to nudge person toward clicking on the "vote up" button, which is strange, since for a person who is new to Math Overflow this action is guaranteed to fail. Helpfully, the banner says something about reputation points — the concept most novices will easily "get" after an unsuccessful attempt to vote a question up. Is this by design?

    I guess the banner could be targeting returning users who forgot to login, but the more likely explanation is that it's a bug.

  2.  

    The banners are meant to be ad spots, and are displayed to any user with less than 200 reputation (a number which is currently not configurable). It might be possible (with javascript ninjitsu) to get them to display only to users who have at least 15 reputation, but I haven't looked into it.

  3.  

    I also found out that the following banner before some answers:

    You can also accept an answer to one of your own questions by clicking the check mark next to it. This awards 15 reputation points to the person who answered and 2 reputation points to you.

    Good to know that, but isn't the usefulness of this banner limited only to the poster of the question and only when logged in?

  4.  

    Perhaps it would be possible to display them only to logged-in users?

  5.  

    The ninjitsu could be something along the lines of (in JS/pseudocode):

    if (length(document.getElementsByClassName("vote-accepted")) = 0) document.getElementById("banner-bottom").hide()

    and

    scores = document.getElementsByClassName("reputation-score")

    if (length(scores) = 0 || int(scores[0].innerHTML.replace(",", "")) < 15) document.getElementById("banner-top").hide()

  6.  

    I read the HTML source of the page a bit more carefully. It seems like the code actually is there:

        <div id="question" class="">
    
        <div class="porthole" id="banner-top"> <h3>Remember to vote up questions/answers you find interesting or helpful (requires 15 <a href="http://mathoverflow.net/faq#reputation">reputation points</a>)</h3>
           <script>
           if($("#question").length === 1){
               var questionId = $("#question-header a").attr("href").split('/')[2];
               var query = "#" + questionId + "-is-owned-by-current-user";
               var reminder = $("You can also accept an answer by clicking the check mark next to it. This awards 15 reputation points to the person who answered and 2 reputation points to you.");
               if($(query).val()){     
                   $("#question").append(reminder);
               }
           }
           </script>
    

    From what I can read at 4AM, the text "You can also accept..." is automatically inserted as the top banner provided that (1) the user owns the question (2) some attribute $("#question").length === 1.

    Update: the latter condition in jQuery means that there is exactly one element with id "question" which should be true. So, unless I miss something, for a person with less than 200 rep the line $("#question").append(reminder) gets executed.

    I'm not sure if the $(...text...) will really create just a text line and then the next line will correctly append it, but if it does, then a <200 rep user will see two "accept an answer" texts on an answer s/he owns. Could anyone debug it a bit please?

  7.  

    Yeah, that was some code I took from a meta.SE answer that I never got working properly. I've updated the site and it should be working now. Here's what I used (I imagine it looks horrible to anybody who knows javascript or jquery):

    var scores = document.getElementsByClassName("reputation-score");
    if (scores.length == 0 || parseInt(scores[0].innerHTML.replace(",", "")) < 15) {
      document.getElementById("banner-top").style.display = "none";
    }
    

    and

    var questionId = $("#question-header a").attr("href").split('/')[2];
    var query = "#" + questionId + "-is-owned-by-current-user";
    if(!($(query).val())){     
      document.getElementById("banner-bottom").style.display = "none";
    }