";
// Load outfits via filters
searchcount = 0;
categorylink = "";
stylelink = "";
titlelink = "";
colorlink = "";
piecelink = "";
aspectlink = "";
serieslink = "";
soundlink = "";
typelink = "";
outfitslink = "";
function combinedLinkFunction() {
return "?" + whichtypeofcategoryview + "search=true" + categorylink + stylelink + titlelink + colorlink + piecelink + aspectlink + serieslink + soundlink + typelink;
}
// Function to load outfits
function loadoutfits() {
var combinedLink = combinedLinkFunction();
$(".armor-filters-cover").show();
// Load Description
var descriptionlink = "/" + whichtypeofcategoryview + "/description.php" + combinedLink;
$(".description").html(descriptionloadinghtml);
$(".description").load(descriptionlink);
// Load Outfits List
outfitslink = "/" + whichtypeofcategoryview + "/" + whichtypeofcategorypage + combinedLink;
$(".outfits").html("");
$(".outfits").load(outfitslink, function () {
$(".armor-filters-cover").hide();
var newdynamictitle = "Swtorista "+$("h1").text();
// Save both outfits and description URLs to history
var mylocationhash = "https://swtorista.com/" + whichtypeofcategoryview + "/category.php" + combinedLink;
history.pushState(
{
ajaxUrl: outfitslink,
descriptionUrl: descriptionlink
},
newdynamictitle,
mylocationhash
);
document.title = newdynamictitle;
});
} // end loadoutfits
// Pagination
jQuery(document).on('click', '.pagination a', function (e) {
e.preventDefault();
var bottompaginationbuttons = $(this).parent().hasClass("pagination-bottom");
var clickedpage = $(this).data("page");
var realpoplink = $(this).attr("href");
var newpaginationlink = $(this).attr("href").replace("category.php", whichtypeofcategorypage);
var newdescriptionlink = $(this).attr("href").replace("category.php", "description.php");
if (bottompaginationbuttons) {
document.getElementById("paginationTop").scrollIntoView();
}
$(".outfits").html("");
$(".description").html(descriptionloadinghtml);
$(".outfits").load(newpaginationlink);
$(".description").load(newdescriptionlink);
// Save both URLs to history
window.history.pushState(
{
ajaxUrl: newpaginationlink,
descriptionUrl: newdescriptionlink
},
"Swtorista " + whichtypeofcategoryview + " List",
realpoplink
);
});
// Handle back/forward navigation
$(window).on("popstate", function (event) {
var state = event.originalEvent.state;
if (state && state.ajaxUrl) {
$(".outfits").html("");
$(".description").html(descriptionloadinghtml);
$(".outfits").load(state.ajaxUrl);
if (state.descriptionUrl) {
$(".description").load(state.descriptionUrl);
}
}
});
// YEYARG
//Check selected fitlers
function checkSelectedFilters(){
categorylist = "";
categorycount = 0;
$(".filter-group-category input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(categorycount == 0){
categorylist = checkboxvalue;
}
else{
categorylist = categorylist + "," + checkboxvalue;
}
categorycount = categorycount +1;
});//end each
if(categorycount>0){
categorylink = "&category="+categorylist;
searchcount = searchcount + 1;
}
else{
categorylink = "";
}
//Create style link
stylelist = "";
stylecount = 0;
$(".filter-group-style input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(checkboxvalue != ""){
if(stylecount == 0){
stylelist = checkboxvalue;
}
else{
stylelist = stylelist + "," + checkboxvalue;
}
stylecount = stylecount +1;
}
});//end each
if(stylecount>0){
stylelink = "&style="+stylelist;
searchcount = searchcount + 1;
}
else{
stylelink = "";
}
// Title search
const urlParams = new URLSearchParams(window.location.search);
const title = urlParams.get('title');
if (title && title.trim() !== '') {
titlelink = "&title="+titlelist;
searchcount = searchcount + 1;
} else {
titlelink = "";
}
//Create color link
colorlist = "";
colorcount = 0;
$(".filter-group-color input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(checkboxvalue != ""){
if(colorcount == 0){
colorlist = checkboxvalue;
}
else{
colorlist = colorlist + "," + checkboxvalue;
}
colorcount = colorcount +1;
}
});//end each
if(colorcount>0){
colorlink = "&color="+colorlist;
searchcount = searchcount + 1;
}
else{
colorlink = "";
}
//Create aspect link
aspectlist = "";
aspectcount = 0;
var dataaspectpiece = "";
$(".filter-group-aspect input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(checkboxvalue != ""){
if(aspectcount == 0){
aspectlist = checkboxvalue;
dataaspectpiece = $(this).data("aspectpiece");
}
else{
aspectlist = aspectlist + "," + checkboxvalue;
}
aspectcount = aspectcount +1;
}
});//end each
if(aspectcount>0){
aspectlink = "&aspect="+aspectlist;
searchcount = searchcount + 1;
}
else{
aspectlink = "";
}
// end aspect link
//Create series link
serieslist = "";
seriescount = 0;
var dataseriespiece = "";
$(".filter-group-series input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(checkboxvalue != ""){
if(seriescount == 0){
serieslist = checkboxvalue;
dataseriespiece = $(this).data("seriespiece");
}
else{
serieslist = serieslist + "," + checkboxvalue;
}
seriescount = seriescount +1;
}
});//end each
if(seriescount>0){
serieslink = "&series="+serieslist;
searchcount = searchcount + 1;
}
else{
serieslink = "";
}
// end series link
//Create sound link
soundlist = "";
soundcount = 0;
var datasoundpiece = "";
$(".filter-group-sound input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(checkboxvalue != ""){
if(soundcount == 0){
soundlist = checkboxvalue;
datasoundpiece = $(this).data("soundpiece");
}
else{
soundlist = soundlist + "," + checkboxvalue;
}
soundcount = soundcount +1;
}
});//end each
if(soundcount>0){
soundlink = "&sound="+soundlist;
searchcount = searchcount + 1;
}
else{
soundlink = "";
}
// end sound link
//Create type link
typelist = "";
typecount = 0;
var datatypepiece = "";
$(".filter-group-type input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(checkboxvalue != ""){
if(typecount == 0){
typelist = checkboxvalue;
datatypepiece = $(this).data("typepiece");
}
else{
typelist = typelist + "," + checkboxvalue;
}
typecount = typecount +1;
}
});//end each
if(typecount>0){
typelink = "&type="+typelist;
searchcount = searchcount + 1;
}
else{
typelink = "";
}
// end type link
//Create piece link
piecelist = "";
piececount = 0;
$(".filter-group-piece input:checked").each(function( index ) {
var checkboxvalue = $(this).val();
if(checkboxvalue != ""){
if(piececount == 0){
piecelist = checkboxvalue;
}
else{
piecelist = piecelist + "," + checkboxvalue;
}
piececount = piececount +1;
}
});//end each
if(dataaspectpiece != ""){
piecelist = dataaspectpiece;
console.log("piecelist hrrrrrr: "+ piecelist );
piececount = piececount+1;
}
if(piececount>0){
console.log("more than zero pieces");
if(piecelist == "player"){
piecelist = "back";
}
else if(piecelist == "outfit"){
piecelist = "front";
}
else if(piecelist == "capes"){
piecelist == "back";
}
else if(piecelist == "headpiece"){
piecelist = "head";
}
else if(piecelist == "chestpiece"){
piecelist == "chest";
}
else if(piecelist == "legs"){
piecelist = "legs";
}
else if(piecelist == "boots"){
piecelist = "boots";
}
else if(piecelist == "gloves"){
piecelist = "hands";
}
else if(piecelist == "back"){
piecelist == "back";
}
else if(piecelist == "twilek"){
$get_piece = "twilek";
}
else{
$get_piece = "thumbnil";
}
piecelink = "&piece="+piecelist;
searchcount = searchcount + 1;
}
else{
piecelink = "";
}
loadoutfits();
}
//Change categories
$(".filter-group-category input").change(function (e) {
//Create link
if($(this).is(":checked")){
$(this).parent().addClass("filter-selected");
}
else{
$(this).parent().removeClass("filter-selected");
}
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change categories
//Change style
$(".filter-group-style input").change(function (e) {
//Uncheck all
if($(this).val() != ""){
if($(this).is(":checked")){
$(this).parent().addClass("filter-selected");
}
else{
$(this).parent().removeClass("filter-selected");
}
$(".all-checkbox-label").removeClass("filter-selected");
$(".all-checkbox-label input").prop("checked",false);
}
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change style
//Change color
$(".filter-group-color input").change(function (e) {
//Uncheck all
if($(this).val() != ""){
if($(this).is(":checked")){
$(this).parent().addClass("filter-selected");
}
else{
$(this).parent().removeClass("filter-selected");
}
$(".all-checkbox-label").removeClass("filter-selected");
$(".all-checkbox-label input").prop("checked",false);
}
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change color
//Change aspect
$(".filter-group-aspect input").change(function (e) {
//Uncheck all
if($(this).val() != ""){
if($(this).is(":checked")){
$(this).parent().addClass("filter-selected");
//Special circumstances for aspect
if($(this).val() == "fingerless-gloves"){
$(".filter-group-piece label").removeClass("filter-selected");
$(".filter-group-piece #id-gloves").attr("checked","checked");
}
else if($(this).val() == "circlet" || $(this).val() == "eyepatch" || $(this).val() == "goggles" || $(this).val() == "helmet" || $(this).val() == "mask" || $(this).val() == "rebreather"){
$(".filter-group-piece label").removeClass("filter-selected");
$(".filter-group-piece #id-head").attr("checked","checked");
}
else if($(this).val() == "bikini-bottom" || $(this).val() == "pants" || $(this).val() == "skirt" || $(this).val() == "short-skert" || $(this).val() == "shorts"){
$(".filter-group-piece label").removeClass("filter-selected");
$(".filter-group-piece #id-legs").attr("checked","checked");
}
//end special circumstances for aspects
}
else{
$(this).parent().removeClass("filter-selected");
}
$(".all-checkbox-label").removeClass("filter-selected");
$(".all-checkbox-label input").prop("checked",false);
}
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change aspect
//Change series
$(".filter-group-series input").change(function (e) {
if($(this).val() != ""){
if($(this).is(":checked")){
$(this).parent().addClass("filter-selected");
}
else{
$(this).parent().removeClass("filter-selected");
}
$(".all-checkbox-label").removeClass("filter-selected");
$(".all-checkbox-label input").prop("checked",false);
}
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change series
//Change sound
$(".filter-group-sound input").change(function (e) {
//Uncheck all
if($(this).val() != ""){
if($(this).is(":checked")){
$(this).parent().addClass("filter-selected");
}
else{
$(this).parent().removeClass("filter-selected");
}
$(".all-checkbox-label").removeClass("filter-selected");
$(".all-checkbox-label input").prop("checked",false);
}
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change sound
//Change type
$(".filter-group-type input").change(function (e) {
if($(this).val() != ""){
if($(this).is(":checked")){
$(this).parent().addClass("filter-selected");
}
else{
$(this).parent().removeClass("filter-selected");
}
$(".all-checkbox-label").removeClass("filter-selected");
$(".all-checkbox-label input").prop("checked",false);
}
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change type
//Change piece
$(".filter-group-piece input").change(function (e) {
//Uncheck all
$(".filter-group-piece label").removeClass("filter-selected");
$(this).parent().addClass("filter-selected");
checkSelectedFilters();
$(this).parent().parent().children("b").after($(this).parent());
$(".filter-group").scrollTop = 0;
});//e end change piece
//stupid overlapping bootstrap buttons
var zindexcount = 6;
jQuery(document).on('click','.armor-context-menu-holder .btn', function() {
zindexcount = zindexcount + 1;
$(this).parent().parent().css("z-index",zindexcount);
});
});//end document ready