Forum:Condensing Infoboxes with Switch Template

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
Forums: Yew Grove > Condensing Infoboxes with Switch Template
Archive
This page or section is an archive.
Please do not edit the contents of this page.
This thread was archived on 30 July 2012 by Thebrains222.

Some of our articles, particularly monsters and NPCs, have tons of information that we try to force into one infobox.

Let's take Bolrie for an NPC example. It appears he has three stages - young during cutscenes, old in prison, and old after all the gnome quests involving him are completed. For this, we have multiple images, multiple examine texts, the multiple quests he's involved in should be mentioned, and he should have multiple locations listed. Obviously we've not done a good job cramming this all into one infobox. The infobox is almost as long as the page itself when viewing the page as an IP.

The spiritual warrior page is a good example for monsters. For whatever reason, we have one article for all the different types of spiritual warriors (I guess they have the same drops). To make up for this, our infobox suffers by listing all the combat levels, LPs, slayer xp, attack styles, max hits, weaknesses, examines... *Facepalm*. Don't even get me started on the images.

I've come across several wikis which make use of the [[w:c:onepiece:Template:Switch|Switch template]] for infobox use. In [[w:c:onepiece:Template:Monkey_D._Luffy_Infobox|this example]], the switch coding is used to allow people to change between the pre-timeskip and post-timeskip pictures, with the post-timeskip being the selected default. If we incorporate the use of this template into our infoboxes, we won't have these endless discussions over the messiness of articles of creatures with lots of information. We could provide all information into one neat little infobox that has some sort of tabs at the top which allow people to switch between, say, human-form and mahjarrat-form(s); pre-quest, during-quest and post-quest; tiers, etc.

Infobox examples of where it can be used:

As this would be a big change to the way our infoboxes and spoiler information work, I decided to take it to the YG (also I'm no coding genius, so it'd be great if some mockups were discussed). (: sssSp7p.pngIjLCqFF.png 06:09, June 24, 2012 (UTC)

Discussion

  • Partial support - To start with a notice, we can also use the tabber, which has easier coding (images page in my signature is an example and no, it is not laggy). But when only infoboxes are significantly different, e.g. GWD monsters-non-GWD versions, I'd gladly see this. Ali and Wahisietel should remain split though, even if only because people may want to seek information on Wahisietel through, say, the Mahjarrat navbox, and be redirected to Ali the Wise, thinking "what the hell" (even if they don't care about spoilers) before noticing the little click thingy at the top of the infobox. But yes, for things like Bolrie and turoths and ESPECIALLY articles like Sir Bedivere and other Camelot knights, this should be implemented. User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 07:02, June 24, 2012 (UTC)
Note about the tabber, in case people think tabber loads slowly because of Fswe's page, the tabber doesn't show up as long as there are still images within that haven't fully loaded yet. Because Fswe uses tabber to store lots of images within, this makes the tabber show up after every single image on the page has loaded, which might take a while. For normal pages, this shouldn't be such a big problem and tabber is indeed a possibility. The switch template is still better in my opinion though. JOEYTJE50TALKpull my finger 11:59, June 24, 2012 (UTC)
^That. User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 15:39, June 24, 2012 (UTC)
That's why you put "Ali the Wise, also known as Wah-whatever" in the first sentence. Problem solved. sssSp7p.pngIjLCqFF.png 16:07, June 24, 2012 (UTC)
Which'd leave them wondering where the information on Wahisietel is. Moreover, removing spoiler alerts is one thing, knowingly and purposefully throwing them in the face is just wrong. (metaphor: removing the DANGER! warnings from a mine field is fine, but that'd be deliberately placing a mine at the entrance) User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 16:14, June 24, 2012 (UTC)
This discussion is not about spoilers, it's about condensing infoboxes. Since Ali & Wah are on the same page, they would benefit in being in one infobox, and it would also help reduce the "messiness" of the article as argued in RuneScape:Requests for splitting/Ali the Wise 2. sssSp7p.pngIjLCqFF.png 16:34, June 24, 2012 (UTC)

Support - Although I'd like to add that this is probably unnecessary for inventory sprites in infoboxes. Never have I seen a case where it looks cluttered enough to warrant this (I know it wasn't put in the proposal, but I wanted to put it out there). cqm 09:08,24/6/2012 (UTC) (UTC)

See Cat Prayer-icon.pngTyiloTalkQuest.png 14:05, June 24, 2012 (UTC)
You want a separate infobox for each inventory sprite there? O_o Them being small icons, the current situation is still better than having even one NPC image in there. User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 15:39, June 24, 2012 (UTC)
I was thinking separate boxes for each color. Have the chathead, inventory image and NPC image all in one box. I didn't put it up in the examples because I wasn't sure how good it'd look. But anyway, that'd fix the issue. sssSp7p.pngIjLCqFF.png 16:06, June 24, 2012 (UTC)

Support - I'm trying to make a mockup of it now. Matt (t) 09:15, June 24, 2012 (UTC)

Support - The switch template seems to be a superior idea to any tabber or whatnot. Just make sure that the page really needs the coding. 222 talk 12:14, June 24, 2012 (UTC)

Support - Prayer-icon.pngTyiloTalkQuest.png 14:05, June 24, 2012 (UTC)

Support - This would make pages a bit more organized from what I see. --Recent uploads SpineTalkGuest book 16:47, June 24, 2012 (UTC)

(Strong) Support - I think this is a very elegant solution for a messy problem. And in a similar way, I think it may also be used in this discussion: Forum:Suggested_gear . . . Yours, This user admires the Void Knights. Who aim to maintain Gielinor's Equilibrium. Enquidou Talk This user likes to do Quests and genuinely loves the story line; lore is his love! . . 17:32, June 24, 2012 (UTC)

Another use - Perhaps it can also be of use with these pages Dyed brown d'hide blessed set where there are three noteworthy images on the page. A characters wearing the full set (1 male, 1 female) and an image of the 'whole set' in the box that you can buy at the G.E. There might be a forth option, too, the individual items. They could all be shown in the Template:Infobox item on the right. . . . Yours, This user admires the Void Knights. Who aim to maintain Gielinor's Equilibrium. Enquidou Talk This user likes to do Quests and genuinely loves the story line; lore is his love! . . 19:44, June 24, 2012 (UTC)

Strong Support - These infoboxes have been chaotic for far too long. — Enigma 20:17, June 25, 2012 (UTC)

Comment - Kay, mockup time. The template's at User:Matthew2602/Sandbox/b, and the js behind it is at [[User:Matthew2602/wikia.js]]. You can import it to use the template yourself by adding importScript('User:Matthew2602/wikia.js') to your wikia.js/monobook,js. The template supports up to 10 different options to switch between, though that number is not hard to change. The parameters it supports are as follows:

{{User:Matthew2602/Sandbox/b
|id=
|type=
|item1=
|text1=
|item2=
|text2=
|item3=
|text3=
|item4=
|text4=
|item5=
|text5=
|item6=
|text6=
|item7=
|text7=
|item8=
|text8=
|item9=
|text9=
|item10=
|text10=
}}

The item parameters define the actual content that will be switched, and the text parameters define what will appear on the buttons used to switch to that content. The type parameter is used to optimise the template for a particular application. Right now, the only value it supports is "infobox", which will put the buttons under the name of the item/monster/whatever, but above the actual infobox table. It should be compatible with most infoboxes. If a type parameter is not specified, the buttons just flow in the page as if they were normal text.

The template appears as a single button that just says "Loading..." until the elements that the script depends on load, then it disappears to reveal the buttons and the content. The first item will display by default.

A good proof of concept of this is at User:Matthew2602/Sandbox/a. I took one of the articles Fergie talked about above and redid the infobox to use the template.

Each use of the template has to have an id parameter, a number anywhere from 0 to 25, to stop it conflicting with other switch templates on the page. The id has to be unique relative to the page -- You can't have two templates with the same id. If the id parameter is not defined, it defaults to 0. This is fine for just one on a page, it's fine for more. It just means you can't not define the id parameter on any of the other templates, nor can you give them an id of 0. The limit of which the id's go up to (ie. 25) is very very easy to change. An example of how id's enable you to use multiple templates on the same page is at User:Matthew2602/Sandbox

In case you haven't noticed yet, I've designed this to not just be used for infoboxes. I think there's real potential in having a universally applicable switch template like this, that can switch out any content. I'm all ears for suggestions for changes to the template and the code or whatever.

And yes, I am aware there is a large gap under the buttons when they are put in an infobox. There are still some kinks to iron out. This is just a rough draft.

I know what you're saying. "But Matthew! I don't wanted to switch a whole infobox! I just want to change the content of one parameter!". In that case, instead of encompassing the whole infobox with the template, you can just put it in the parameter you want to switch, as seen [[User:Matthew2602/Sandbox/c|here]]. The template doesn't currently support chaining together multiple switch templates with the same id's and switching them with one set of buttons, but I could probably do that if people are interested.

Or you can just use tabber. Matt (t) 23:28, June 26, 2012 (UTC)

Honestly, if a discussion involves javascript that doesn't affect any existent features, just add it to the common.js – it's far less complicated and can always be removed --Henneyj 17:08, June 27, 2012 (UTC)

Discussion 2

{{User:Matthew2602/Sandbox/b
|type=infobox
|id=1
|item1={{Infobox Monster
|name = Spiritual warrior (Zamorak)
|image = [[File:Spiritualwarrior.png|Zamorak's Spiritual Warrior.|130px]]
|release = [[28 August]] [[2007]]
|update = God Wars Dungeon
|level =  125
|LP = 1000
|slaylvl = 68
|slayxp = 98-134
|sumona = yes
|members = Yes
|aggressive = Yes
|poisonous = No
|immune to poison = No
|attack style = Melee
|attack speed = 5
|max hit = 114
|weakness = Magic, Stab attacks
|always drops = None
|examine = Warrior of Zamorak.
}}
|text1=Zamorak
|item2={{Infobox Monster
|name = Spiritual warrior (Saradomin)
|image = [[File:Saradomin spiritual warrior.png|Saradomin's Spiritual Warrior.|100px]]
|release = [[28 August]] [[2007]]
|update = God Wars Dungeon
|level = 125
|LP = 1150
|slaylvl = 68
|slayxp = 98-134
|sumona = yes
|members = Yes
|aggressive = Yes
|poisonous = No
|immune to poison = No
|attack style = Melee
|attack speed = 5
|max hit = 130
|weakness = Magic, Stab attacks
|always drops = None
|examine = Saradomin's chosen warrior.
}}
|text2=Saradomin
|item3={{Infobox Monster
|name = Spiritual warrior (Bandos)
|image = [[File:Bandos spiritual warrior.png|Bandos' spiritual warrior.|120px]]
|release = [[28 August]] [[2007]]
|update = God Wars Dungeon
|level = 134
|LP = 1310
|slaylvl = 68
|slayxp = 98-134
|sumona = yes
|members = Yes
|aggressive = Yes
|poisonous = No
|immune to poison = No
|attack style = Melee
|attack speed = 5
|max hit = 160
|weakness = Magic, Stab attacks
|always drops = None
|examine = A true servant of Bandos.
}}
|text3=Bandos
|item4={{Infobox Monster
|name = Spiritual warrior (Armadyl)
|image = [[File:Armadyl spiritual warrior.png|Armadyl's Spirutal Warrior.|120px]]
|release = [[28 August]] [[2007]]
|update = God Wars Dungeon
|level = 123
|LP = 980
|slaylvl = 68
|slayxp = 98-134
|sumona = yes
|members = Yes
|aggressive = Yes
|poisonous = No
|immune to poison = No
|attack style = Ranged
|attack speed = 5
|max hit = 120
|weakness = Magic, Stab attacks
|always drops = None
|examine = A servant of Armadyl
}}
|text4=Armadyl
}}

Update/bump -

  • The template now supports up to 25 different items, over the previous ten.
  • The ids have been completely abolished, and the script runs without them. (The id parameter does nothing now)
  • Buttons now render properly in Monobook (they appeared as just normal text before)
  • The first item now displays even while the script is still loading and the loading button is still showing
  • Fixed the massive whitespace that was being created by using the template with infoboxes.
  • General improvements to the code
  • The code is now located at [[User:Matthew2602/switch.js]] and [[User:Matthew2602/switch.css]].
  • The code is being loaded sitewide for autoconfirmed users while this discussion is ongoing, like Henney suggested. You can go to User:Matthew2602/Sandbox, or just use the template to the side of this to try it out for yourself. User:Matthew2602/Sandbox/a shows what using it would be like in an actual article.

I think those are all the points I wanted to cover. Anyways, I think this script is pretty much ready to go. It just needs the consensus. Leave any suggestions you have for it below, and if you find a bug, please point it out. .-.

Come on guys, don't let this thread die pls Matt (t) 08:29, July 10, 2012 (UTC)


Support - Looks kewl. HaidroH rune.pngEagle feather 3.pngCandle (blood red).png 1XqyDNM.png Crystal triskelion fragment 3.pngHazelmere's signet ring.png 08:36, July 10, 2012 (UTC)

Support - Looks great! Make it alphabetical though. :P User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 09:15, July 10, 2012 (UTC)

Support - Looks great Matt, gj. (: sssSp7p.pngIjLCqFF.png 19:50, July 10, 2012 (UTC)

Support - Awesome! MolMan 21:34, July 10, 2012 (UTC)

Support - Looks better, although the infobox contains alot of information, so maybe you could come up with a way to highlight the data that changes between two tabs. This avoids the situation where the user has to look back and forth to check each and every detail. Otherwise, good job! --Alchez 10:40, July 11, 2012 (UTC)

Comment - On this new computer, it takes forever to load. I.e. it doesn't work. =( User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 11:58, July 11, 2012 (UTC)

Comment - The buttons looks awful, I would prefer if it looked like tabs instead that was connected to the box. Also use the same background color of the infobox when you are currently on that tab and a darker one for the other tabs. Prayer-icon.pngTyiloTalkQuest.png 23:54, July 16, 2012 (UTC)

Comment - I agree with Tyilo, tabs that are connected to the box would look better. Assuming they are of similar design and colour. 222 talk 07:11, July 17, 2012 (UTC)

Suggestion - Would is be possible to combine different infoboxes into a switch-thing? For example, Vanstrom has a monster and an NPC infobox, could those be stuffed together? User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 08:26, July 17, 2012 (UTC)

What about in terms of the rest of the article? I mean like having monster/strategy information as well as history and general NPC information... sssSp7p.pngIjLCqFF.png 18:09, July 19, 2012 (UTC)
Good point, it might confuse people to have monster information with a "hidden" infobox. This is where the tabber comes in handy... User_talk:Fswe1 Fswe1 Brassica Prime symbol.png 05:53, July 20, 2012 (UTC)
From what I've seen/understand, tabber isn't really customizable. We could just use the switch template, which completely is. sssSp7p.pngIjLCqFF.png 07:29, July 20, 2012 (UTC)

Support - Support, though I would like to see what it would like attached to the box.  —The preceding unsigned comment was added by Blaze fire12 (talk).

Support - Makes things much neater, assuming it works for everyone. Hunter cape (t).png Sentra246Blue hallowe'en mask.png 11:15, July 21, 2012 (UTC)

Closed - There is consensus to implement the second proposal. Minor aesthetic changes can be discussed by the implementing editors. 222 talk 11:33, July 30, 2012 (UTC)