Discovery Gaming Community

Full Version: New BBCode tags implemented
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
has provided some code to implement a few BBCode tags.
These were done a while ago, I just never got around to writing a post for them.
If you want to try these out please use the 'Preview' function.



Here's a couple to assist in compliance with rule 2:

imgw automatically restricts display of images into the maximum width of 700px required by rule 2.1:
Code:
[imgw]https://i.redd.it/t74qxr8ycmnz.jpg[/imgw]

sigimg automatically restricts display of images into the 700*250px box required by rule 2.2:
Code:
[sigimg]https://i.redd.it/t74qxr8ycmnz.jpg[/sigimg]

In both cases, the URL provided must end in jpg/png/gif/jpeg. Also note that you must still ensure that signature images are less than 1MB in size.



anchor generates a hidden element that can be linked to directly. You don't add an end tag. You provide it with up to 5 characters (alphanumeric or underscore) which you can then link to with...
Code:
[anchor=abcde]

a generates a link that points to an anchor element generated with the above. Upon clicking on it the browser will jump to the target part of the page. You need to provide the ID of the anchor.
Code:
[a=abcde]Example[/a]



rep generates a reputation bar display on the forums.
The syntax for this is a bit complicated. It's slightly more generic than it generally (assuming you're representing a single fixed reputation and not some sort of range) needs to be - you can provide four colours (the start and end of two gradients - one ending at completely neutral and one beginning at completely neutral) and the starting and ending position (where 0 is most hostile and 100 most friendly, each block is 5).
This is slightly off because the starting point usually seems to need 1 added to it, but reference (again provided by ):
[Image: MbG4Ojz.png]

So for negative reputations you'll give it the colours #f00,#fff,transparent,transparent, ending point 50 and your own start point. In this example I'll use 11 as each block shown is 5, then we add 1 extra for the starting point. This shows Freelancer reputation -0.8:
Code:
[rep=11,50]#f00,#fff,transparent,transparent[/rep]


For positive reputations you'll give it the colours transparent,transparent,#fff,#0f0, starting point 51 and your own end point. In this example I'll use 90% as each block is 5. This shows Freelancer reputation 0.8:
Code:
[rep=51,90]transparent,transparent,#fff,#0f0[/rep]

Kudos to you two, that's pretty cool and better than making graphics for each repsheet. Good job, go celebrate your birthday now! Smile
Ooooh nice I do like this ALOT
Kudos
Anchors are amazing.

Reputations are brilliant. However, I must ask, why can't we have the regular hex color syntax? And if we can't, how does one convert regular ones to these shorter one?

Quote:why can't we have the regular hex color syntax

You can. The code should support shorthand hex, regular hex, and css colour names.



Code:
[rep=30,70]gold,#fff000,crimson,#fff[/rep]
(11-18-2017, 11:31 PM)SnakThree Wrote: [ -> ]why can't we have the regular hex color syntax? And if we can't, how does one convert regular ones to these shorter one?

You can, the shorter version is just an example: https://developer.mozilla.org/en-US/docs...and_rgba()
MDN Wrote:The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB)
Also I'll do a bit of a shameless plug: if you want to see how these new codes look in the wild Custodi info page has made use of the anchors while the LPI one uses repbars.

edit:
Also something I just remembered is that you can directly link to an anchor, so for instance if you wanted to link directly to Custodi diplomacy, you can use an anchor to do that, just append the link with #anchor-abcde.
Right. Means I made a mistake during nighttime editing. Here you go then: