Show more than 5 items in Recent Activity
Here is a workaround to show 10 recent items, done and tested on the Copenhagen theme.
Just copy/paste this script at the end of your JS file, before closing doc.ready part.
setTimeout(function(){
$('.recent-activity-controls a')[0].click()
}, 800);
How the code looks and where it's added:
A demo is visible in the next few days on my ZD test account:
https://moderatorvlad.zendesk.com/hc/nl
What is a key of the code?
It will just click on the show more link once a page is loaded.
Hope someone will find this as helpful.
-
Thanks, Vladan! Another good one from you.
I missed this while I was on vacation. But I just added it to the Guide community tips list!
-
Vladan, thanks. What a nice little mod for our HC.
-
If the option to show unsafe code is off, will it affect the functionality of this code?
-
Hi Jose, I think that making any changes in that option will not affect provided code in any way. Let me know if any further question.
-
Thank you @Vladan. Hmm I can't seem to get this snippet to work.
|Edit:
Had a missing bracket! Now it is working like a charm! -
Glat to hear it worked, Thanks for the feedback Jose!
-
I like this idea but it is not working for me. I see the note that a bracket is missing. What is the correct snippet?
This is not working for me?
});
setTimeout(function(){
$('.recent-activity-controls a')[0].click()
}, 800);
}); -
Try this. Drop the extra characters before and after, insert at the very end of your js file, worked for me:
setTimeout(function(){
$('.recent-activity-controls a')[0].click()
}, 800); -
Don't use setTimeout for automated page actions like this. If a user is on a slower connection this will do nothing because that button won't exist in the DOM yet.
Instead wait until the page is fully loaded and then perform the automated click.
$(window).load(function() {
$('.recent-activity-controls a')[0].click()
});
You can also target the element by the unique attribute, this might shave a little off the time it takes to click the rendered element.
$(window).load(function() {
$('[data-recent-activity-seemore]')[0].click()
});
Edit: You may see a console error using the above described method on some browsers (maybe load order of js since the button runs on js as well) if that happens add the setTimeout inside the window.load function, just don't use setTimeout on it's own and expect good things.
$(window).load(function() {
setTimeout(()=> $('[data-recent-activity-seemore]')[0].click(), 200);
}); -
Thanks for taking the time to share this with everyone Jason!
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
10 Kommentare