Introducing User Scripts


posted on Dec. 19, 2015, 18:41

With the recent addition of Wikipedia-like user scripts, now you can change how the DMOJ looks and works! A user script is a small bit of customizable Javascript that is embedded into every page, and allows you to modify everything regarding the site's look. User scripts may be defined in the edit profile page.

For example, if you wanted to make the navigation bar non-sticky, you could use a simple script.

// Wait for page load
$(function() {
    // Select the navigation bar
    $("#navigation").css({
        // Update the CSS
        position: "absolute"
    });
});

Or perhaps you'd prefer a more festive look to the site.

$(function() {
    $("#page-container").css({background: "#FDDDDD"});
    $("body").css({background: "#99FFA8"});
});

Or even display an encouraging message on every page load.

$(function() {
    alert("You can do it!");
});

Comments


  • -1
    Kirito
     commented on Aug. 1, 2016, 10:27 a.m. edited
    Can't Update Profile

    EDIT: Works now, don't know why, but OK then


  • -6
    smurff
     commented on May 31, 2016, 1:38 p.m. edited
    super!!

    I love this new user script feature, but do you know what I love even more!?!??! Filling out surveys for other students' data classes!!!!! https://docs.google.com/forms/d/1WZ5hhSjVff-fnxihd5maTdsJXpFT4nit5kLfUu_ubWE/viewform#responses


    • 9
      FatalEagle
       commented on May 31, 2016, 2:14 p.m. edit 3

      You need to subscribe to DMOJ premium to advertise on DMOJ.


      • 10
        Xyene
         commented on May 31, 2016, 2:15 p.m. edit 2

        "premium"

        Premium outlier data services!


  • 4
    XIAOAGE
     commented on Jan. 3, 2016, 2:01 p.m.
    issue report???

    I am not sure is it just me or else. When i am viewing the problem list, i can't sort the problems according to their point value after clicking the "Points".


    • 4
      Xyene
       commented on Jan. 3, 2016, 3:40 p.m.

      Thanks for noticing. The tablesorting plugin we used used eval() for multi-column sorting, which was denied by our recently-implemented Content-Security-Policy.

      I've switched to a fork of the plugin that removed the use of eval(), so everything should be working fine now.


    • 4
      bobhob314
       commented on Jan. 3, 2016, 2:39 p.m.

      Yes, you can't do it on the users page as well.


  • 3
    bobhob314
     commented on Dec. 27, 2015, 1:08 p.m. edit 2
    Congrats Jeffrey Xiao!

    Finally, someone has usurped our benevolent dictator FatalEagle in terms of DMOJ points!

    Here, have Reddit silver to help celebrate this momentous occasion!