Removing the "Favorite Feature" from the Cireson Portal?
Best Answers
-
joivan_hedrick Cireson Consultant Advanced IT Monkey ✭✭✭The following code will enable you to click the image and load the request offering.
$(document).ready(function(){
//Since this uses a mutationobserver against a guaranteed-to-exist object, make sure we are only on the Home alternate page.
if (document.URL.indexOf("/View/02efdc70-55c7-4ba8-9804-ca01631c1a54") === -1) {
return;
}
//The service catalog and request offerings don't load immediately. So wait until it does load.
var mainPageNode = document.getElementById('main_wrapper');
// create an observer instance
var observer = new MutationObserver(function(mutations) {
//The page changed. See if any RO descriptions exist yet.
var titleElements = $(".sc-item-title");
if (titleElements.length > 0) {
fn_SetRequestOfferingImagesToOpenROs();
observer.disconnect();
}
});
// configure the observer. For our purposes, subtree is required.
var observerConfig = { attributes: true, childList: true, subtree: true, characterData: true };
// pass in the node, and our mutationobserver options.
observer.observe(mainPageNode, observerConfig);
//Create the function to add our click event.
function fn_SetRequestOfferingImagesToOpenROs() {
//hide all star icons so that you cannot set favorites. This would interfere with clicking on the request offering images.
var favoriteIconElements = $('.fa-star-o');
favoriteIconElements.hide();
function clickChildRequestOffering(event) {
console.log("clicked!");
var parentAElement = event.target;
//call the click event of the child img element.
var childImgElement = $(parentAElement).find("img")
childImgElement.click();
};
//For every icon, there's a sibling img element. Get it since it contains our click() event, which opens up the RO. We need to apply this to the parent <a>.
for (var i = 0; i < favoriteIconElements.length; i++) {
var siblingImgElement = $(favoriteIconElements[i]).parent().find("img")
var parentAElement = siblingImgElement.parent();
//Add our custom event to our img element, which will just end up calling the click event of the child <i>
parentAElement.click(clickChildRequestOffering);
//Change the hover event on this sibling img element.
parentAElement.css('cursor', 'pointer');
}
}
});9 -
Nicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭Although style changes are being made, this is JavaScript code so it needs to go in custom.js, not the css file. Can you give it a shot there instead?1
Answers
Can you tell me what version of the portal you are using. Do you have a screen shot available?
Thanks,
We are on Portal 5.1
Please see the below linked image which shows what happens when the mouse moves over the SR image
https://i.imgur.com/S90Wrni.png
You can hide the favorite icons with the following code:
Note-- this will not make the icons themselves into links (clicking them would just do nothing). Making these clickable links would require some additional code. Maybe somebody else in the community has done this already?
Thanks,
Nick
Thanks! That worked. You guys rock!
Thank you for the code, it work great. The only issue I see if the SO is Favorited the clicking on the icon doesn't work and it show the star.
How we can hide the Favorite Button from bar next to Save/Cancel while in RO?
$(function() {
});
Hi dear
I'am using
What have you tried so far? Did you apply @joivan_hedrick script above to your custom.js and it didn't work?
exactly what i did.
here is the script.
what i used but it is not working
i have to Change to Format from js to txt to upload here
Thank you for your help.
Best regards
https://us.v-cdn.net/6026663/uploads/editor/mh/16xdz9fxkrh0.zip
@ Cory_bowie
Currently is working that the favorite Icon is no more, but when i click on the Icon the request as i expect is not open.
Best regrads
The script you sent is the old version that doesn't work with the newer versions of the portal. Please verify you are using the newest version of the script again.
This is the correct one:
https://us.v-cdn.net/6026663/uploads/editor/mh/16xdz9fxkrh0.zip
Thank you very much now it works best regards
This worked for me really well thank you!
The only issue i can see if that when i hover over the Request Offering i want it to open up the the page.
Or have it so that the picture is just a picture and not a link anymore. When you hover over the picture it changes colour so its almost like its still there?
Daniel