Actions

Widget

Difference between revisions of "CastofCharacters"

From ThornsWiki

 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<style>
 
<style>
.row {
+
 
    margin: 10px auto;
+
.filter-navigation {
 +
  width: 100%;
 +
  background: #242422;
 +
  position: relative;
 +
  border-bottom: 4px solid #deb975;
 +
  padding: 15px 0;
 +
  color: #fffcf2;
 +
}
 +
 
 +
.filter-navigation .filters {padding:10px 45px 0 45px;}
 +
.filter-navigation ul {padding:0;}
 +
 
 +
.filter-navigation li {
 +
  list-style-type: none;
 +
  display: inline-block;
 
}
 
}
  
/* Add padding BETWEEN each column */
+
.filter-navigation li.blank {
.row,
+
color: #242422;
.row > .column {
+
    margin: 2px 1px;
     padding: 5px;
+
    display: inline-block;
 +
    background: #463f3a;
 +
     padding: 2px 5px;
 +
    text-decoration: none;
 +
font-size:.8em;
 +
letter-spacing:0.05em;
 +
font-family:'Open Sans', sans-serif;
 +
text-transform:uppercase;
 +
 
 
}
 
}
  
/* Create three equal columns that floats next to each other */
+
.filter-navigation li a {
.column {
+
color: #deb975;
     float: left;
+
    margin: 2px 1px;
     width: 32.15%;
+
    display: inline-block;
/*min-width:250px;*/
+
    background: #454545;
/*max-width:350px;*/
+
     padding: 2px 5px;
    display: none; /* Hide all elements by default */
+
     text-decoration: none;
 +
font-size:.8em;
 +
letter-spacing:0.05em;
 +
font-family:'Open Sans', sans-serif;
 +
text-transform:uppercase;
 +
 
 
}
 
}
 +
 +
.filter-navigation li a.selected {
 +
color: #242422;
 +
background: #deb975;
 +
  font-weight: bold;
 +
}
  
/* Clear floats after rows */
+
.filter-navigation ul b {
.row:after {
+
  margin: 0 5px;
    content: "";
 
    display: table;
 
    clear: both;
 
 
}
 
}
  
/* Content */
+
table tr th.infobox-label {
.card-content {
+
     text-align: left;
     background-color: #403c39;
+
    text-transform: uppercase;
     padding: 0px 0px;
+
    font-weight: bold;
     color:#ccc5b9;
+
    font-size: .75rem;
     border: 4px solid #deb975;
+
     line-height: 1.25em;
 +
     color: #deb975;
 +
     background-color: #474440;
 +
    vertical-align: middle;
 +
    letter-spacing: 0.035rem;
 
}
 
}
  
 
h4.charname {
 
h4.charname {
background-color:#deb975;
+
    background-color:#deb975;
 
     padding:10px;
 
     padding:10px;
 
     color:#fffcf2;
 
     color:#fffcf2;
Line 43: Line 77:
 
     margin:-5px auto;
 
     margin:-5px auto;
 
     font-family: 'Metamorphous', cursive;
 
     font-family: 'Metamorphous', cursive;
     font-size:.9em; }
+
     font-size:.9em;
 
p {
 
padding:0px 20px;
 
  }
 
 
 
/* Race Colors */
 
.tint img { display: block;  
 
 
}
 
}
  
.tint {
+
.grid {
  position: relative;
+
    max-width: 100%;
  float: left;
+
    display: flex;
  cursor: pointer;
+
    flex-flow: row wrap;
  width:100%;
+
    justify-content: space-evenly;
  margin-left:0px;
+
    align-content: center;
  margin-top:0px;
+
    /*margin: 0px auto;*/
 
}
 
}
  
.tint:before {
+
.grid .item {
   content: "";
+
   width: 30%;
  display: block;
+
   margin: 1%;
  position: absolute;
 
  top: 0;
 
  bottom: 0;
 
  left: 0;
 
  right: 0;
 
  background: rgba(148, 124, 84, 0.45);
 
   transition: all .3s linear;
 
 
}
 
}
 +
 +
/* On screens that are 992px wide or less, go from four columns to two columns */ @media screen and (max-width: 992px) {
  
.tint:hover:before { background: none; }
+
.grid .item {
  
.galdor:before {
+
      min-width:350px;
background: rgba(255,234,119, 0.45);
+
      max-width:100%;
    }
 
.human:before {
 
background: rgba(204, 128, 63, 0.45);
 
 
}
 
}
.passive:before {
 
background: rgba(190, 183, 164, 0.45);
 
}
 
.raen:before {
 
background: rgba(89, 159, 160, 0.45);
 
}
 
.wick:before {
 
background: rgba(203, 232, 150, 0.45);
 
}
 
  
/* The "show" class is added to the filtered elements */
+
/* On screens that are 600px wide or less, make the columns stack on top of each other instead of next to each other */ @media screen and (max-width: 600px) {
.show {
 
  display: block;
 
}
 
  
/* Style the buttons */
+
.grid .item {
  
#btn-group button {
+
      min-width:350px;
background-color: #403c39;
+
      max-width:100%;
color: #fffcf2;
+
  }
padding: 10px 30px;
 
float: left;
 
font-family: 'Open Sans', sans-serif;
 
font-size: .75em;
 
text-transform: uppercase;
 
border: 1px solid #deb975;
 
display: block;
 
max-width: 100%;
 
margin: 0px 13px;
 
border-radius: 0px !important;
 
}
 
 
 
/* Clear floats (clearfix hack) */
 
#btn-group:after {
 
    content: "";
 
    clear: both;
 
    display: table;
 
 
}
 
}
  
/*#btn-group button:not(:last-child) {
+
/* Character Links */
    border-right: none;
+
.cs-image img {
}*/
+
width:100%;
 
 
/* Add a background color on hover */
 
 
 
#btn-group button:hover {
 
    background-color: #403c39;
 
    color:#deb975;
 
}
 
 
 
#btn-group button:active {
 
    background-color: #403c39;
 
    color:#deb975;
 
}
 
 
 
#btn-group button.active {
 
    background-color: #deb975;
 
    color:#403c39;
 
 
}
 
}
  
/* Character Links */
+
span.cs-link {
.cs-link {
+
  display: block;
display: block;
+
  border: 1px solid #deb975;
border: 1px solid #deb975;
+
  padding: 10px;
padding: 10px;
+
  text-decoration: none;
text-decoration: none;
+
  color: #fffcf2;
color: #fffcf2;
+
  background-color: #242422;
background-color: #242422;
+
  width: 75%;
width: 75%;
+
  margin: 10px auto;
margin: 10px auto;
 
 
}
 
}
  
Line 170: Line 142:
 
}
 
}
 
 
/* GLOBAL NAV */
+
</style>
.staticnav {
+
 
background-color:#474440;
+
<script
overflow:hidden;
+
  src="https://code.jquery.com/jquery-3.4.0.min.js"
margin-top:-30px;
+
  integrity="sha256-BJeo0qm959uMBGb65z40ejJYGSgR7REI4+CW1fNKwOg="
margin-bottom:20px;
+
  crossorigin="anonymous"></script>
border-bottom:2px solid #deb975;
+
}
+
<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script>
 +
 +
<script>
 +
$(document).ready(function() {
 +
  var $container = $(".grid"); // the container with all the elements to filter inside
 +
  var filters = {}; //should be outside the scope of the filtering function
 +
 
 +
  /* --- read the documentation on isotope.metafizzy.co for more options --- */
 +
  var $grid = $container.isotope({
 +
    itemSelector: ".item", // the elements to filter
 +
    percentPosition: true, // true if you use percentage widths
 +
  });
 +
 
 +
  // save some classes for later usage
 +
  /* ---
 +
  activeClass: adds this class to filters that are selected (active)
 +
  comboClass: the class that indicates that the filter group is a chain filter, i.e. if you select two filters, only items with BOTH filters will be shown
 +
  exclClass: the class that indicates that the filter group is an exclusion filter, i.e. you can only select one filter from that group at a time
 +
  resetClass: the class for the overall reset button
 +
  --- */
 +
  var activeClass = "selected",
 +
    comboClass = "combine",
 +
    exclClass = "exclusive",
 +
    resetClass = "reset";
  
.staticnav a:link, .staticnav a:visited {
+
  var $defaults = $("a." + activeClass + '[data-filter-value=""]');
float:left;
+
  $(".option-set a").click(function(e) {
display:block;
+
    // insert your link selector where it says '.option-set a'
Text-align:center;
+
    var $this = $(this); // cache the clicked link
Padding:15px 20px;
+
    var comboFilter,
Text-decoration:none;
+
      filterAttr = "data-filter-value";
Font-size:0.85em;
+
    if (resetClass && !$this.hasClass(resetClass)) {
Font-family:'Metamorphous', serif;
+
      // defining variables
text-transform:uppercase;
+
      var filterValue = $this.attr(filterAttr); // cache the filter
color:#ccc5b9;
+
      var $optionSet = $this.parents(".option-set"); // cache the parent element
 +
      var group = $optionSet.attr("data-filter-group"); // cache the parent filter group
 +
      var filterGroup = filters[group]; // make new variable for the property being filtered
 +
      if (!filterGroup) {
 +
        // if the property doesn't exist
 +
        filterGroup = filters[group] = []; // make a new empty array
 +
      }
 +
      var $selectAll = $optionSet.find("a[" + filterAttr + '=""]'); // cache the 'select all' button in the current group
 +
      $("." + resetClass).removeClass(activeClass);
 +
      comboFiltering(
 +
        $this,
 +
        filters,
 +
        filterAttr,
 +
        filterValue,
 +
        $optionSet,
 +
        group,
 +
        $selectAll,
 +
        activeClass,
 +
        comboClass,
 +
        exclClass
 +
      );
 +
      comboFilter = getComboFilter(filters); // join all the filters
 +
      if (!comboFilter.length) $("a." + resetClass).addClass(activeClass);
 +
      $this.toggleClass(activeClass);
 +
    } else {
 +
      filters = {};
 +
      comboFilter = "";
 +
      $(".option-set a").removeClass(activeClass);
 +
      $(this).addClass(activeClass);
 +
      $defaults.addClass(activeClass);
 +
    }
 +
    $grid.isotope({
 +
      filter: comboFilter
 +
    });
 +
    e.preventDefault();
 +
  });
 +
});
 +
function comboFiltering(
 +
  $this,
 +
  filters,
 +
  filterAttr,
 +
  filterValue,
 +
  $optionSet,
 +
  group,
 +
  $selectAll,
 +
  activeClass,
 +
  comboClass,
 +
  exclClass
 +
) {
 +
  // for non-exclusive groups of filters
 +
  if (!$optionSet.hasClass(exclClass)) {
 +
    // replace 'exclusive' with the class of your exclusive filter groups
 +
    // if link is a filter that isn't selected
 +
    if (!$this.hasClass(activeClass) && filterValue.length) {
 +
      filters[group].push(filterValue); // add filter to array
 +
      $selectAll.removeClass(activeClass); // remove the selected class from the 'select all' button
 +
    } else if (filterValue.length) {
 +
      // if link is a selected filter
 +
      // remove filter from array
 +
      // check if the filter group we're concerned with is a combination filter (.one.two instead of .one,.two)
 +
      if ($optionSet.hasClass(comboClass)) {
 +
        filters[group][0] = filters[group][0].replace(filterValue, ""); // delete the filter from the combined string
 +
        if (!filters[group][0].length)
 +
          // check if there is anything left in the string after deletion
 +
          filters[group].splice(0, 1); // if no, remove the empty string
 +
      } else {
 +
        // if filter group is not a combo filter
 +
        var curIndex = filters[group].indexOf(filterValue); // get index of filter string in array
 +
        if (curIndex > -1) filters[group].splice(curIndex, 1); // remove the filter
 +
      }
 +
      if (!$optionSet.find("a." + activeClass).not($this).length)
 +
        // if there are no remaining filters
 +
        $selectAll.addClass(activeClass); // add the active class to the 'select all' button
 +
    } else {
 +
      // if link is the show all button for that group
 +
      $optionSet.find("a." + activeClass).removeClass(activeClass); // remove the active class from all other buttons
 +
      filters[group] = []; // clear the array of all filters
 +
    }
 +
    // join everything to a single string for the combined filtering groups
 +
    if ($optionSet.hasClass(comboClass) && filters[group].length)
 +
      filters[group] = [filters[group].join("")];
 +
  } else {
 +
    // for exclusive groups
 +
    // if link is a filter that isn't selected
 +
    if (!$this.hasClass(activeClass) && filterValue.length) {
 +
      // run a loop for all active filters
 +
      $optionSet.find("a." + activeClass).each(function(k, filterLink) {
 +
        // remove all active filters in the same group from the array
 +
        var removeFilter = $(filterLink).attr(filterAttr);
 +
        var removeIndex = filters[group].indexOf(removeFilter);
 +
        filters[group].splice(removeIndex, 1);
 +
      });
 +
      filters[group].push(filterValue); // add selected filter to array
 +
      $optionSet.find("a." + activeClass).removeClass(activeClass); // remove the active class from all other links in the group
 +
    } else if (filterValue.length) {
 +
      // if link is a selected filter
 +
      // remove filter from array
 +
      var curIndex = filters[group].indexOf(filterValue);
 +
      if (curIndex > -1) filters[group].splice(curIndex, 1);
 +
      if (!$optionSet.find("a." + activeClass).not($this).length)
 +
        // if there are no remaining filters
 +
        $selectAll.addClass(activeClass); // add active class to 'select all' button
 +
    } else {
 +
      // if link is the show all button for that group
 +
      $optionSet.find("a." + activeClass).removeClass(activeClass); // remove active class from all other buttons
 +
      filters[group] = []; // reset all filters for this group
 +
    }
 +
  }
 
}
 
}
 +
/* --- concat filters --- */
 +
function getComboFilter(filters) {
 +
  // pass the entire array of filters to the function
 +
  var i = 0; // set counter variable as zero
 +
  var comboFilters = []; // make a new array to save the string of filters
  
.staticnav a:first-child {
+
  for (var prop in filters) {
margin-left:30px;
+
    // loop through all the properties in the filter array passed to the function
}
+
    var filterGroup = filters[prop]; // define variable
 +
    // skip to next filter group if it doesn't have any values
 +
    if (!filterGroup.length) {
 +
      continue; // exit loop and move on with next iteration
 +
    }
 +
    if (i === 0) {
 +
      // copy to new array
 +
      comboFilters = filterGroup.slice(0);
 +
    } else {
 +
      var filterSelectors = [];
 +
      // copy to fresh array
 +
      var groupCombo = comboFilters.slice(0);
 +
      // merge filter Groups
 +
      for (var k = 0, len3 = filterGroup.length; k < len3; k++) {
 +
        for (var j = 0, len2 = groupCombo.length; j < len2; j++) {
 +
          filterSelectors.push(groupCombo[j] + filterGroup[k]);
 +
        }
 +
      }
 +
      // apply filter selectors to combo filters for next group
 +
      comboFilters = filterSelectors;
 +
    }
 +
    i++; // increment
 +
  }
  
.staticnav a:hover {
+
  var comboFilter = comboFilters.join(", ");
Background-color: #ccc5b9;
+
  return comboFilter;
Color:#474440;
+
}
}
+
</script>
  
.staticnav.active {
+
<div class="filter-navigation"><!--navigation-->
Background-color: #ccc5b9;
+
  <div class="filters"><!--filters-->
Color:#474440;
 
}
 
  
.staticnav .icon {
+
<li class="option-set">See Everything</li>
    display: none;
+
<!--li class="option-set">.New">Newest</li-->
}
 
  
@media screen and (max-width: 600px) {
+
<ul class="filter option-set exclusive" data-filter-group="race">
    .staticnav a {
+
      <li style="font-family:'Metamorphous',serif;text-transform:uppercase;font-size:.9rem;letter-spacing:0.025rem; width:200px;"><b>Sort by Race</b></li>
        float: none;
+
      <li>All</li>
margin:0px auto;
+
      <li>Galdor</li>
width: 100%; }
+
      <li>.Human">Human</li>
+
      <li><a href="#" data-filter-value=".Passive">Passive</li>
.staticnav a:first-child {
+
      <li>-value=".Raen">Raen</li>
margin-left:0px;
+
      <li>Wick</li>
}
+
</ul>
    }
 
  
</style>
+
<ul class="filter option-set" data-filter-group="location">
 +
      <li style="font-family:'Metamorphous',serif;text-transform:uppercase;font-size:.9rem;letter-spacing:0.025rem; width:200px;"><b>Sort by Kingdom</b></li>
 +
      <li>Any</li>
 +
      <li>Anaxas</li>
 +
      <li>Bastia</a></li>
 +
      <li class="blank">Gior</li>
 +
      <li class="blank">Hesse</li>
 +
      <li class="blank">Hox</li>
 +
      <li>Mugroba</li>
 +
    </ul>
  
<div style="width:100%; margin:25px auto 0px; padding:5px 0px;">
+
  </div><!--end navigation-->
      <div id="btn-group" style="width:85%; margin:0px auto;">
+
  <div class="log"></div>
            <button  class="btn active" onclick="filterSelection('all')"> Show all</button>
+
</div><!--end filters-->
            <button  class="btn" onclick="filterSelection('galdori')"> Galdor</button>
 
            <button  class="btn" onclick="filterSelection('humans')"> Human</button>
 
            <button class="btn" onclick="filterSelection('passives')"> Passive</button>
 
            <button  class="btn" onclick="filterSelection('raen')"> Raen</button>
 
            <button  class="btn" onclick="filterSelection('wicks')"> Wick</button>
 
      </div>
 
</div>
 

Latest revision as of 19:46, 5 May 2020

<style>

.filter-navigation {

 width: 100%;
 background: #242422;
 position: relative;
 border-bottom: 4px solid #deb975;
 padding: 15px 0;
 color: #fffcf2;

}

.filter-navigation .filters {padding:10px 45px 0 45px;} .filter-navigation ul {padding:0;}

.filter-navigation li {

 list-style-type: none;
 display: inline-block;

}

.filter-navigation li.blank {

	color: #242422;
   margin: 2px 1px;
   display: inline-block;
   background: #463f3a;
   padding: 2px 5px;
   text-decoration: none;

font-size:.8em; letter-spacing:0.05em; font-family:'Open Sans', sans-serif; text-transform:uppercase;

}

.filter-navigation li a {

	color: #deb975;
   margin: 2px 1px;
   display: inline-block;
   background: #454545;
   padding: 2px 5px;
   text-decoration: none;

font-size:.8em; letter-spacing:0.05em; font-family:'Open Sans', sans-serif; text-transform:uppercase;

}

.filter-navigation li a.selected { color: #242422;

		background: #deb975;
 		font-weight: bold;

}

.filter-navigation ul b {

 margin: 0 5px;

}

table tr th.infobox-label {

   text-align: left;
   text-transform: uppercase;
   font-weight: bold;
   font-size: .75rem;
   line-height: 1.25em;
   color: #deb975;
   background-color: #474440;
   vertical-align: middle;
   letter-spacing: 0.035rem;

}

h4.charname {

   background-color:#deb975;
   padding:10px;
   color:#fffcf2;
   display:block;
   width:100%;
   text-align:center;
   margin:-5px auto;
   font-family: 'Metamorphous', cursive;
   font-size:.9em;

}

.grid {

   max-width: 100%;
   display: flex;
   flex-flow: row wrap;
   justify-content: space-evenly;
   align-content: center;
   /*margin: 0px auto;*/

}

.grid .item {

 width: 30%;
 margin: 1%;

}

/* On screens that are 992px wide or less, go from four columns to two columns */ @media screen and (max-width: 992px) {

.grid .item {

      min-width:350px;
      max-width:100%;

}

/* On screens that are 600px wide or less, make the columns stack on top of each other instead of next to each other */ @media screen and (max-width: 600px) {

.grid .item {

      min-width:350px;
      max-width:100%;
  }

}

/* Character Links */ .cs-image img { width:100%; }

span.cs-link {

  display: block;
  border: 1px solid #deb975;
  padding: 10px;
  text-decoration: none;
  color: #fffcf2;
  background-color: #242422;
  width: 75%;
  margin: 10px auto;

}

.cs-link a { color:#fffcf2;; text-decoration:none; }

.cs-link a:hover { color:#403c39; text-decoration:none; }

.cs-link:hover { background: #deb975; color:#403c39; }

</style>

<script

 src="https://code.jquery.com/jquery-3.4.0.min.js"
 integrity="sha256-BJeo0qm959uMBGb65z40ejJYGSgR7REI4+CW1fNKwOg="
 crossorigin="anonymous"></script>

<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script>

<script> $(document).ready(function() {

 var $container = $(".grid"); // the container with all the elements to filter inside
 var filters = {}; //should be outside the scope of the filtering function
 /* --- read the documentation on isotope.metafizzy.co for more options --- */
 var $grid = $container.isotope({
   itemSelector: ".item", // the elements to filter
   percentPosition: true, // true if you use percentage widths
 });
 // save some classes for later usage
 /* ---
 activeClass: adds this class to filters that are selected (active)
 comboClass: the class that indicates that the filter group is a chain filter, i.e. if you select two filters, only items with BOTH filters will be shown
 exclClass: the class that indicates that the filter group is an exclusion filter, i.e. you can only select one filter from that group at a time
 resetClass: the class for the overall reset button
 --- */
 var activeClass = "selected",
   comboClass = "combine",
   exclClass = "exclusive",
   resetClass = "reset";
 var $defaults = $("a." + activeClass + '[data-filter-value=""]');
 $(".option-set a").click(function(e) {
   // insert your link selector where it says '.option-set a'
   var $this = $(this); // cache the clicked link
   var comboFilter,
     filterAttr = "data-filter-value";
   if (resetClass && !$this.hasClass(resetClass)) {
     // defining variables
     var filterValue = $this.attr(filterAttr); // cache the filter
     var $optionSet = $this.parents(".option-set"); // cache the parent element
     var group = $optionSet.attr("data-filter-group"); // cache the parent filter group
     var filterGroup = filters[group]; // make new variable for the property being filtered
     if (!filterGroup) {
       // if the property doesn't exist
       filterGroup = filters[group] = []; // make a new empty array
     }
     var $selectAll = $optionSet.find("a[" + filterAttr + '=""]'); // cache the 'select all' button in the current group
     $("." + resetClass).removeClass(activeClass);
     comboFiltering(
       $this,
       filters,
       filterAttr,
       filterValue,
       $optionSet,
       group,
       $selectAll,
       activeClass,
       comboClass,
       exclClass
     );
     comboFilter = getComboFilter(filters); // join all the filters
     if (!comboFilter.length) $("a." + resetClass).addClass(activeClass);
     $this.toggleClass(activeClass);
   } else {
     filters = {};
     comboFilter = "";
     $(".option-set a").removeClass(activeClass);
     $(this).addClass(activeClass);
     $defaults.addClass(activeClass);
   }
   $grid.isotope({
     filter: comboFilter
   });
   e.preventDefault();
 });

}); function comboFiltering(

 $this,
 filters,
 filterAttr,
 filterValue,
 $optionSet,
 group,
 $selectAll,
 activeClass,
 comboClass,
 exclClass

) {

 // for non-exclusive groups of filters
 if (!$optionSet.hasClass(exclClass)) {
   // replace 'exclusive' with the class of your exclusive filter groups
   // if link is a filter that isn't selected
   if (!$this.hasClass(activeClass) && filterValue.length) {
     filters[group].push(filterValue); // add filter to array
     $selectAll.removeClass(activeClass); // remove the selected class from the 'select all' button
   } else if (filterValue.length) {
     // if link is a selected filter
     // remove filter from array
     // check if the filter group we're concerned with is a combination filter (.one.two instead of .one,.two)
     if ($optionSet.hasClass(comboClass)) {
       filters[group][0] = filters[group][0].replace(filterValue, ""); // delete the filter from the combined string
       if (!filters[group][0].length)
         // check if there is anything left in the string after deletion
         filters[group].splice(0, 1); // if no, remove the empty string
     } else {
       // if filter group is not a combo filter
       var curIndex = filters[group].indexOf(filterValue); // get index of filter string in array
       if (curIndex > -1) filters[group].splice(curIndex, 1); // remove the filter
     }
     if (!$optionSet.find("a." + activeClass).not($this).length)
       // if there are no remaining filters
       $selectAll.addClass(activeClass); // add the active class to the 'select all' button
   } else {
     // if link is the show all button for that group
     $optionSet.find("a." + activeClass).removeClass(activeClass); // remove the active class from all other buttons
     filters[group] = []; // clear the array of all filters
   }
   // join everything to a single string for the combined filtering groups
   if ($optionSet.hasClass(comboClass) && filters[group].length)
     filters[group] = [filters[group].join("")];
 } else {
   // for exclusive groups
   // if link is a filter that isn't selected
   if (!$this.hasClass(activeClass) && filterValue.length) {
     // run a loop for all active filters
     $optionSet.find("a." + activeClass).each(function(k, filterLink) {
       // remove all active filters in the same group from the array
       var removeFilter = $(filterLink).attr(filterAttr);
       var removeIndex = filters[group].indexOf(removeFilter);
       filters[group].splice(removeIndex, 1);
     });
     filters[group].push(filterValue); // add selected filter to array
     $optionSet.find("a." + activeClass).removeClass(activeClass); // remove the active class from all other links in the group
   } else if (filterValue.length) {
     // if link is a selected filter
     // remove filter from array
     var curIndex = filters[group].indexOf(filterValue);
     if (curIndex > -1) filters[group].splice(curIndex, 1);
     if (!$optionSet.find("a." + activeClass).not($this).length)
       // if there are no remaining filters
       $selectAll.addClass(activeClass); // add active class to 'select all' button
   } else {
     // if link is the show all button for that group
     $optionSet.find("a." + activeClass).removeClass(activeClass); // remove active class from all other buttons
     filters[group] = []; // reset all filters for this group
   }
 }

} /* --- concat filters --- */ function getComboFilter(filters) {

 // pass the entire array of filters to the function
 var i = 0; // set counter variable as zero
 var comboFilters = []; // make a new array to save the string of filters
 for (var prop in filters) {
   // loop through all the properties in the filter array passed to the function
   var filterGroup = filters[prop]; // define variable
   // skip to next filter group if it doesn't have any values
   if (!filterGroup.length) {
     continue; // exit loop and move on with next iteration
   }
   if (i === 0) {
     // copy to new array
     comboFilters = filterGroup.slice(0);
   } else {
     var filterSelectors = [];
     // copy to fresh array
     var groupCombo = comboFilters.slice(0);
     // merge filter Groups
     for (var k = 0, len3 = filterGroup.length; k < len3; k++) {
       for (var j = 0, len2 = groupCombo.length; j < len2; j++) {
         filterSelectors.push(groupCombo[j] + filterGroup[k]);
       }
     }
     // apply filter selectors to combo filters for next group
     comboFilters = filterSelectors;
   }
   i++; // increment
 }
 var comboFilter = comboFilters.join(", ");
 return comboFilter;

} </script>

  • See Everything