Home Analyst Portal

Modify home page with javascript/jquery

Morten_MeislerMorten_Meisler Premier Partner Advanced IT Monkey ✭✭✭
If I want to modify elements on the Home page today, I am using a rather ugly method of creating a small delay on the code I want to execute. Otherwise the effect is not seen.

Example:

$(document).ready(function () {

 function hideHomeTitle()
 {
	$(".page_bar .page_title:contains('Home')").hide(); 

 }
 /*Execute the hide home title after 1 second */
 setTimeout(hideHomeTitle, 1000);
});

So even though the DOM is fully loaded, I still need to throw in a delay for the element to be modified. Is there any other method to use here or something in the pipeline? Like an app.custom.formTasks.add('HomePage' .. or similar?

Thanks :) 

Best Answer

Answers

  • Morten_MeislerMorten_Meisler Premier Partner Advanced IT Monkey ✭✭✭
    Correct way to target strings would of course be using localization: $(".page_bar .page_title:contains(" + localization.Home + ")").hide();  (just an example) :)
  • Morten_MeislerMorten_Meisler Premier Partner Advanced IT Monkey ✭✭✭
    edited July 2016
    Thanks Geoff, I'm making a blogpost about portal customization, so just wanted to be sure :smile: 

    Normally CSS would be the right way for this of course, but I took the Home title as example because it has no Id or exclusive class so, as far as I see, if I hide the page_title in CSS I hide all the page titles and it's not possible to use a contain method in CSS for text inside elements, only attributes (ex. div[class*="test"] { } )
  • Morten_MeislerMorten_Meisler Premier Partner Advanced IT Monkey ✭✭✭
  • merlenette_jonesmerlenette_jones Member Advanced IT Monkey ✭✭✭
    Very insightful and informative Blog post. 
Sign In or Register to comment.