Jump to content
Welcome to our new Citrix community!

Storefront 1811 - Default to Categories view


Tony Brookus

Recommended Posts

Try putting this into script.js:

 

function categoriesDelay() {
    $('#categoriesTabBtn').click();
}

CTXS.Extensions.afterDisplayHomeScreen = function (callback) {
    CTXS.ExtensionAPI.changeView('store');
    window.setTimeout(categoriesDelay,250);
    callback();
};


 

  • Like 1
Link to comment
Share on other sites

Tony,

 

My apologies ... the extension afterDisplayHomeScreen() does not take a callback.

While the above will still work, the technically correct version is (without any callback):

function appsDelay() {
    $('#categoriesTabBtn').click();
}

CTXS.Extensions.afterDisplayHomeScreen = function () {
    CTXS.ExtensionAPI.changeView('store');
    window.setTimeout(appsDelay,250);
};

Sam

Link to comment
Share on other sites

  • 3 weeks later...

To select the Uncategorized category by default (this will only work if it ends up to be the last category in the group):

function changeToUncategorized() {
    $('.appFiltersItem-Text').last().click();
}

function appsDelay() {
    $('#categoriesTabBtn').click();
    window.setTimeout(changeToUncategorized,500);
}

CTXS.Extensions.afterDisplayHomeScreen = function () {
    CTXS.ExtensionAPI.changeView('store');
    window.setTimeout(appsDelay,250);
};

 

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • 4 months later...
  • 3 months later...
  • 2 weeks later...

Hi,

 

I used this code like metion before:

For me this is ok for the web users, but for receiver and ipad/apdroid, this isn't workign yet.

 

We have a minimum off apps so we don't want to choose the apps and gave them all, but we should be able to organise them in web, receiver and ipad/android apps.

 

 

 

 

function changeToUncategorized() {
    $('.appFiltersItem-Text').last().click();
}

function appsDelay() {
    $('#categoriesTabBtn').click();
    window.setTimeout(changeToUncategorized,500);
}

CTXS.Extensions.afterDisplayHomeScreen = function () {
    CTXS.ExtensionAPI.changeView('store');
    window.setTimeout(appsDelay,250);
};

CTXS.Extensions.onViewChange = function (viewName) {
  if (viewName == 'store') {
  //  window.setTimeout(changeToUncategorized,250);
  //}
  // CTXS.ExtensionAPI.changeView('store');
    window.setTimeout(appsDelay,250);
  }
};

Link to comment
Share on other sites

  • 2 months later...

We leveraged Sam Jacob's code from 1/14/2019 to come up more surefire method to select the "Uncategorized" category, or any category of your choosing. This appears to be working OK in StoreFront 1912 LTSR. 

function changeToUncategorized() {
    for (var k=0;k<$('.appFiltersItem-Text').length;k++) {
      var objCategoryLink = $($('.appFiltersItem-Text')[k]);
                      
      // Locate link name specified in the if statement below, and then click it
      if (objCategoryLink.text().trim().toLowerCase().indexOf("uncategorized (") == 0) { 
          objCategoryLink.click(); 
      }
    } 
}

function appsDelay() {
    $('#categoriesTabBtn').click();
    window.setTimeout(changeToUncategorized,250);
}

CTXS.Extensions.afterDisplayHomeScreen = function (callback) {
    CTXS.ExtensionAPI.changeView('store');
    $(document).ready(function() { window.setTimeout(appsDelay,250); });
}

 

 

On 1/14/2019 at 12:48 PM, Sam Jacobs said:

To select the Uncategorized category by default (this will only work if it ends up to be the last category in the group):


function changeToUncategorized() {
    $('.appFiltersItem-Text').last().click();
}

function appsDelay() {
    $('#categoriesTabBtn').click();
    window.setTimeout(changeToUncategorized,500);
}

CTXS.Extensions.afterDisplayHomeScreen = function () {
    CTXS.ExtensionAPI.changeView('store');
    window.setTimeout(appsDelay,250);
};

 

 

 

Link to comment
Share on other sites

I'd looked at this earlier, but it only expands the Categories menu. It doesn't select/display the desired category apps.  Are getting a different result?

 

2 minutes ago, Sam Jacobs said:

Here's the "official" Citrix blog version (which works pretty much the same way):

https://www.citrix.com/blogs/2019/09/03/how-to-land-on-the-categories-view-in-storefront-1811/ 

 

Link to comment
Share on other sites

Here's and enhanced version that allows you to specify any desired child category via a variable. Thanks again to Sam Jacobs for most of the code used here:

 

var defaultCategory = "Uncategorized";

// Display desired "Categories" apps by default (part 1 of 3)
function changeToUncategorized() {
    for (var k=0;k<$('.appFiltersItem-Text').length;k++) {
		var objCategoryLink = $($('.appFiltersItem-Text')[k]);

		// Locate the desired "defaultCategory" variable name, and then click it
		if (objCategoryLink.text().trim().toLowerCase().indexOf(defaultCategory.toLowerCase() + " (") == 0) { 
		    objCategoryLink.click(); 
		}
    } 
}

// Display desired "Categories" apps by default (part 2 of 3)
function appsDelay() {
    $('#categoriesTabBtn').click();
    window.setTimeout(changeToUncategorized,250);
}

CTXS.Extensions.afterDisplayHomeScreen = function (callback) {

    // Display desired "Categories" apps by default (part 3 of 3)
    CTXS.ExtensionAPI.changeView('store');
    $(document).ready(function() { window.setTimeout(appsDelay,250); });

}

 

Link to comment
Share on other sites

  • 11 months later...
  • 1 month later...
  • 3 weeks later...

Hi All,

 

I was using the "enhanced version" posted by fcoa last year and it was working well with 1912 CU1, except our user base prefers the folders so we're testing out 1912 CU2 now, for which the script does not seem to work as well.  If we choose the Collapsed View for Categories, we get the desired folders view but no child category is selected on the landing page.  If we select the Expanded View instead, we get the child category expanded however the top navigation for Categories is hidden unless you click on it manually.  Ideally, we get the folder view with the category defined in the script already selected/expanded (same as we had in pre-1811 versions).  

 

** we've already changed the categoriesTabBtn to folderHierarchyFilterBtn... thanks for that tip!  However, it still does not achieve the desired view.  Any additional tips would be greatly appreciated.  We're going to open a ticket with Citrix as well.

Link to comment
Share on other sites

  • 2 months later...

Hi all,

in regards of landing to Categories View with  Storefront 1912 CU2 there is an example of such customization in online documentation (edocs) at this link https://docs.citrix.com/en-us/storefront/1912-ltsr/manage-citrix-receiver-for-web-site/unified-receiver-experience.html (i think originally posted in Citrix Blog by Richard Hayton https://www.citrix.com/blogs/2015/08/25/citrix-customization-cookbook/ using the following JS code:

$('#customScrollTop').append('&lt;div class="whitespace"&gt;&lt;/div&gt;');

CTXS.Extensions.onViewChange = function(view) {
  if (view == "store") {
    $('.whitespace').height(5000);
    window.setTimeout(function() {
      CTXS.ExtensionAPI.navigateToFolder("/");
      $('.whitespace').height(0);
    }, 1);
  }
};

At first using the code as such It didn't work for me but then i modified the first line to $('#customScrollTop').append('<div class="whitespace"></div>'); 

and I added 10ms delay (instead of 1 as described in the text, so i ended up with something like this:

$('#customScrollTop').append('<div class="whitespace"></div>');

CTXS.Extensions.onViewChange = function(view) {
  if (view == "store") {
    $('.whitespace').height(5000);
    window.setTimeout(function() {
      CTXS.ExtensionAPI.navigateToFolder("/");
      $('.whitespace').height(0);
    }, 10);
  }
};

then it worked. I'm not a JS guy and it surely can be done in better way, but if it can help someone...

cheers

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...