The tag is to be used for complete userscripts. It would also feel kind of pollutive to swamp it with lots of smallish submissions.

Hencewhy I'm making this proposal as reference question to collect:

  • small user scripts
  • or one-liners
  • scripts with too little incentive to complete, or which require collaboration
  • prototypes
  • mostly cosmetic changes, or even just user stylesheets

I'm certain other people have a few which fail the usual StackApp requirements, but might be interesting to share anyway. (Also, I have some I want to dump here.)

link|improve this question
Sounds like a good idea. – George Edison Mar 29 '11 at 17:14
feedback

3 Answers

This was supposed to become an extension for the site search. All it does currently is add a clickable ???. This allows to bring up search results in a new tab. So, not a one-liner, but still way too banal for a separate post.

// ==UserScript==
// @description    Adds a link besides the search box
// @include        http://*stackexchange.com/*
// @include        http://*stackoverflow.com/*
// ==/UserScript==

(function(){

    // append link which can be used for middle-clicking
    $("#search div").append(
        '<a style="position:absolute" id="q_search" href="/search?q=...">???</a>'
    );

    // register update handler, to update ??? link
    $("input[name=q]").keyup(function(){
        $("#q_search").attr("href", "/search?q="+encodeURI(this.value));
    });

    // temporary fix for missing space after [tag]
    var q = document.forms.search.q;
    if (q.value && q.value != "search") {
        q.value += " ";
    }

})()
link|improve this answer
feedback

This would actually warrant a separate post. But I can't be bothered to make it look nice. So, if anyone wants to pick it up..

Question voting from the main view

So it was 23:57 and I forgot to spend all my votes for the day. Obviously I didn't write this script right then, but laboriously clicked through interesting questions to upvote one by one. But to save future effort I made this script which adds upvote links directly to the main view / question lists. It's a workaround for one of the issues raised in Why aren't people voting for questions?

// ==UserScript==
// @name           Temp
// @description    Cheats
// @include        http://*stackexchange.com/*
// @include        http://*stackoverflow.com/*
// ==/UserScript==

(function(){
    /***** if ((new Date).getUTCHours() >= 22) *****/

    // voting from main
    $("div.question-summary").each(function(){
         var id = this.id.substr(17);
         if (id)
         $(this).find(".vote-count-post").append("<sup style='opacity:0.3'>+</sup>").click(function() {

              var url = "/posts/"+id+"/vote/2";

              // send POST request to /posts/ID######/vote/2
              $.ajax({
                  type: "POST",
                  url: url,      //   #2=up, 3=down, 0=cancel
                  data: { fkey: StackExchange.options.user.fkey },
                  dataType: "json",
                  success: function(result) {
                      if (result.Success) {    // colorful result
                         $("#question-summary-"+id+" .vote-count-post strong").text(result.NewScore).css({color:"orange"});
                      }
                      else {
                         alert("error occured: " + $.param(result));
                      }
                  },
                  error: function (x, r, e) {
                      alert("error="+r +" status="+x.status +" exception="+e);
                  }
              });

         });
    });

})()

License

Public Domain

Status

unsupported

link|improve this answer
this is "small"? – Jeff Atwood Jul 11 '11 at 16:53
feedback

Probably making myself unpopular again. But this one-liner just adds the old ✉ envelope back.

Meanwhile I find the new activity popup more useful than the old /recent page. But I do like UI clutter, and still enjoy the retro look of the envelope. So here it is:

$("#hlinks span.profile-triangle").text("✉").click(function(){location="/users/recent"}); //.replaceWith('<a href="/users/recent" class="envelope-off profile-triangle">&#9993;</a> ');
link|improve this answer
feedback

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged