FANDOM


  • Are there any css codes for styling how the Dynamic Categories look?

    Example: I added the following code to MediaWiki:Common.css

    .redirect-in-category
    { font-style: italic;
      font-size: 80%;
    }
    .redirect-in-category:after
    { color: #808080;
      content: " (redirect)"
    }
    

    To cause all redirected pages to be in smaller, italicized and to have "(redirect)" appended to the end of the page name in their respective categories.

    Is there a way to make the Dynamic Category do this a well?

      Loading editor
    • What exactly is a "Dynamic Category"?

        Loading editor
    • Fandyllic wrote: What exactly is a "Dynamic Category"?

      See this.

        Loading editor
    • If you look at the source and find the right classes/ids, you should have no problem using CSS.

        Loading editor
    • Fandyllic wrote: What exactly is a "Dynamic Category"?

      Category Type Buttons

      Dynamic Category (right most button)

      When looking at a Category page, look in the top right corner and you will see 3 buttons that changes the way the Category page looks to you (Classic Categories, Category Exhibition, and Dynamic Category)

      Dynamic Categories have the template Bigcat built-into it.

        Loading editor
    • Fandyllic - Thanks for telling me where to look!  I found my answer.

      The 2 classes I needed are .category-page__member-link and .category-page__member-link:after

      OOPS! I am mistaken - those are for the normal pages ( not the redirected pages ) but now I do know where to look at least -- thanks again.

        Loading editor
    • Sadly, it looks like there is no special coding for Redirected pages when in 'Dynamic Category' mode - each item has the exact same css codes, unlike the 'Classic Category' mode which has special css for redirected pages. :(

        Loading editor
    • Can you give a link to a category page on the wiki in question? We still don't know that.

        Loading editor
    • Can you give the name of a redirect so I can look at it in the category page?

        Loading editor
    • Anatomy redirects to Research:Anatomy

        Loading editor
    • Okay, so yeah it seems you're screwed, but you may have a case for saying redirects not-italicized is a bug, since the old category pages used to italicize redirects. If you can get FANDOM staff to fix this, then you can filter them.

      So try Special:Contact/bug.

        Loading editor
    • this script will add class redirect to all redirects on a page:

      mw.hook('wikipage.content').add(function($content) {
          var links = [],
              tlinks = [],
              re = /.*?\/wiki\//,
              $els = $content.find('a:not(.redirect):not(.extiw):not(.external):not([rel="nofollow"])');
          $els.each(function() {
              var $this = $(this),
                  page = ($this.attr('href') || '').replace(re, '');
              if (!page) return;
              links.push(page);
          });
          tlinks = links.concat();
          while (tlinks.length) {
              $.getJSON(window.wgScriptPath + '/api.php', {
                  action: 'query',
                  redirects: 1,
                  titles: tlinks.splice(0, 49).join('|'),
                  format: 'json',
              })
              .done(function(data) {
                  if (!data || data.error || !data.query || !$.isArray(data.query.redirects)) return this;
                  data.query.redirects.forEach(function(v) {
                      $els.filter('[title="' + v.from.replace(/\"/g, '\\"') + '"]:not(.redirect)').addClass('redirect');
                  });
              });
          }
      });
        Loading editor
    • Ahh, using the API to figure if it is a redirect. I still think it's a bug, but this is a workaround that should work.

        Loading editor
    • Kewl, Thanks, Greatly appreciated!

      Added to MediaWiki:Common.js, Submitted it, Tested it in Test mode and it works perfectly and attributed it to User:Fngplg

        Loading editor
    • Ack - it works great with the redirects in the dynamic category pages B U T it also applies this class to the redirects in the normal article / template pages as well where I want redirects to appear normal

      So, I will have to remove the script :( and send in the bug report so that only the redirects in the dynamic category pages are affected! (hopefully)

        Loading editor
    • u don't have to style all of .redirect classes everywhere. for instance, if u want to add styling to redirect in categories, u can narrow ur styles to namespace:

      .ns-14 .redirect {style}
      

      u can read more here.

        Loading editor
    • I later thought of that and was going to ask if there was a way to just limit it to the category namespace only instead of the whole wiki.

      Thanks again, this is exactly what I wanted and is greatly appreciated!

      Thank you very much!!!

        Loading editor
    • Fngplg wrote: u don't have to style all of .redirect classes everywhere. for instance, if u want to add styling to redirect in categories, u can narrow ur styles to namespace:

      .ns-14 .redirect {style}
      

      This works on the classic and exhibition modes as well -- thus replacing the original code that I had posted in my request -- this code is exactly the one I was originally asking for!

      Again, Thank you very much!!!

        Loading editor
    • A FANDOM user
        Loading editor
Give Kudos to this message
You've given this message Kudos!
See who gave Kudos to this message
Community content is available under CC-BY-SA unless otherwise noted.