How to make deal titles bold again (Chrome/Firefox)

Hi,

This may sound weird, and frankly over the top, but some people don't really like the thin/narrow titles on the new OzBargain layout. I have thrown together a quick Tampermonkey/greasemonkey script which makes titles bold again for anyone else who loses titles amongst the other things :)

How to get bold titles back (Chrome):

1) Download Tampermonkey (Chrome extension). This allows you to add user created scripts to chrome to modify web pages (exactly what we're doing)
2) Find the new tampermonkey button on your browser, click it, and press "Add new script"(image). A big text box will appear (image).
3) Replace all the text in that text box with the following:


// ==UserScript== 
// @name BoldBargain 
// @description Make OzBargain titles bold again 
// @include *.ozbargain.com.au/*
// ==/UserScript== 

var els = document.getElementsByTagName("*");
for(var i = 0, l = els.length; i < l; i++) {
  var el = els[i];
    el.innerHTML = el.innerHTML.replace(/<h2 class="title"/gi, '<h2 class="title" style="font-weight: bold !important;');
}

4) Press save, and it should be enabled! Try loading OzBargain again, now with bold titles.

How to get bold titles back (Firefox):

1) Download Greasemonkey (Firefox addon). This is much the same as the chrome version.
2) Find the new greasermonkey button on your browser, click it, and press "Add new script" (image).
3) A dialog will appear (image, fill in any random data and press OK, the data doesn't matter.
4) A window will open with the data you just entered. You must type "allow pasting" (security precaution), and then replace the whole lot of text with the above code.
5) Save it, click the greasemonkey button and make sure it's enabled. Now load ozbargain and it should be bold!

Sorry if this isn't allowed, but I'm sure anyone with basic javascript knowledge can confirm this does what I said it does and isn't some sort of trick. If you don't want this thread, by all means delete it, but I think a lot of users like the bold titles so I'd rather not have just wasted my time typing all this out just to have it deleted :(

Thanks & if you need help, post below. If you're using internet explorer, god help you.

Thanks to this snippet of code as I'm not very good at anything like this

Comments

  • https://www.ozbargain.com.au/node/159877#comment-2222507

    I don't mind the way the titles are anymore :D

  • Good script - any idea how to do Identicon instead of generic avatar?

    • +1

      Interesting idea.

      I have made a script that replaces all avatars with identicons, but there's no super easy way to do it for only users without a gravatar set.

      Script to achieve this:

      // ==UserScript== 
      // @name BoldBargain 
      // @description Make OzBargain titles bold again 
      // @author /user/brezzo
      // @include *.ozbargain.com.au/*
      // ==/UserScript== 
      
      var logos = document.getElementsByClassName("gravatar");
      for( var i = 0; i < logos.length; i++ )
      {
          if( logos[i].tagName == "IMG" )
          {     
              var old = logos[i].src;
              logos[i].src = "https://identicon.org?t=" + old + "&s=38";
          }
      }
      
      • Thanks but you're missing
        class usericon
        with a width of 20 px.

        It's just a matter of copying the above between var logs and "&s=38"; and changing ("gravatar") to ("usericon") & "&s=20" right.

        • So this test script works.

          // ==UserScript==
          // @name BoldBargain
          // @description Make OzBargain titles bold again
          // @author /user/brezzo
          // @include .ozbargain.com.au/
          // ==/UserScript==

          var logos = document.getElementsByClassName("gravatar");
          for( var i = 0; i < logos.length; i++ )
          {
          if( logos[i].tagName == "IMG" )
          {
          var old = logos[i].src;
          logos[i].src = "https://identicon.org?t=" + old + "&s=38";
          }
          }

          logos = document.getElementsByClassName("usericon");
          for( var i = 0; i < logos.length; i++ )
          {
          if( logos[i].tagName == "IMG" )
          {
          var old = logos[i].src;
          logos[i].src = "https://identicon.org?t=" + old + "&s=20";
          }
          }

          PS How do you preserve indent and use code markdown?

        • @brisdaz:
          Formatted better:

            // ==UserScript==
            // @name BoldBargain
            // @description Make OzBargain titles bold again
            // @author /user/brezzo
            // @include *.ozbargain.com.au/*
            // ==/UserScript==
            var logos = document.getElementsByClassName('gravatar');
            for (var i = 0; i < logos.length; i++)
            {
              if (logos[i].tagName == 'IMG')
              {
                var old = logos[i].src;
                logos[i].src = 'https://identicon.org?t=' + old + '&s=38';
              }
            }
            logos = document.getElementsByClassName('usericon');
            for (var i = 0; i < logos.length; i++)
            {
              if (logos[i].tagName == 'IMG')
              {
                var old = logos[i].src;
                logos[i].src = 'https://identicon.org?t=' + old + '&s=20';
              }
            }
          
        • +1

          @brisdaz: this will give a different icon for the small icon and the big one I'm pretty sure (mobile so can't test) since it uses the text of the whole element rather than the username. You might want to check that if it matters much to you.

        • @brezzo:

          Yeah you're right I missed that. Best to isolate the hash and use that part. I could work that out with a bit of tinkering but could someone with more experience alter it?

        • @brezzo:

          What licence is your code under? I want to see if GreasyFork Script Creation forum or OpenUserJS Beggar's Corner forum can help us but some might not help unless they know the code creator has given permission despite the fact it's only a few lines long.

        • +1

          @brisdaz: go for it mate, I don't really hold this script highly or anything.. it's very minor lol

  • +2

    is there a script to unbold JV's comments. :P

Login or Join to leave a comment