Stanislav Staff replied

55 weeks ago

Ever wanted an auto updating list of special items?

Simply add the Linkshell Roster widget and change the following:

Template

<div class="widget">
  <div class="widget-header">Relics/Mythics/Empy</div>
  <div class="widget-body">
    {{#specialItems}}
      <div class="special-item">
        {{#item}}
        <img src="{{icons.small}}" width="16" height="16" />
        <a href="{{link}}">{{name}}</a>
        {{/item}}
      </div>
      {{#owners}}
        <img src="{{avatar}}" class="avatar avatar-small" width="16" height="16" />
        <a href="{{link}}">{{name}}</a>
        <br />
      {{/owners}}
    {{/specialItems}}
  </div>
</div>

JavaScript

var items = {}, owners = {};

// Collect all the items and owners.
each(this.members, function(member) { 
  if (member.specialItems) {
    each(member.specialItems, function(item) {
      items[item.name] = item;
      owners[item.name] = owners[item.name] || [];
      owners[item.name].push(member);
    });
  }
});

// Create a list of item/owner pairs.
this.specialItems = map(items, function(item) {
  return {
    item: item,
    owners: owners[item.name]
  }
});

// Sort by item name.
this.specialItems = sortBy(this.specialItems, function(specialItem) {
  return specialItem.item.name;
});

And it should end up looking something like this.



last edited 55 weeks ago by Stanislav
Founder / Engineer

Pythean replied

55 weeks ago

Awesome :) Tosses old widget out the window :)

Demonicpagan replied

55 weeks ago

There a way to exclude certain items from the list? Current code includes Maat's Cap which isn't relic, mythic, or empyrean.

What is there to say? I am me, and no one can change that.

Stanislav Staff replied

55 weeks ago

In the first specialItems loop simply do.

if (item.name === "Maat's Cap") {
  return;
}


last edited 55 weeks ago by Stanislav
Founder / Engineer

Pythean replied

55 weeks ago

Thanks was trying to figure out that to. Wasn't far off with my script. Here's to happy Javascript learing :)

Alshandra replied

55 weeks ago

im fairly non-smart with this stuff, ive simply copied and pasted, and ended up with something similar, but the text for the weapons is the same as the characters so it kind of all mixes in together instead of having definition for each list, how would i go about fixing this to look like stan's example? thanks in advance!

Stanislav Staff replied

55 weeks ago

I was leaving that for your own imagination.

Put this in the style tab.

.special-item {
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  margin: 5px 0;
  
  a {
    color: #999; 
  }
}
Founder / Engineer

Faelar replied

55 weeks ago

That widget isnt on my list. Or is this Premium/Elite onry?

Stanislav Staff replied

55 weeks ago

The widget is called Linkshell Roster and it will only appear if the site is bound to a linkshell.


last edited 55 weeks ago by Stanislav
Founder / Engineer

Naytan replied

53 weeks ago

I see how to remove an Item from the special items, is there way to add it. Say I wanteed to make a list of salvage gear collected, is this possible? I don't know where specialitems is pulling from, assuming its a predefined category within guildwork
Please log in to post a reply.