Is it possible to (via a plug-in if necessary) randomly choose a logo (and small logo) from a set of 3 every time someone starts a new session (or until their browser refreshes the assets for the logo)?
The Ruby code is trivial - but how can we incorporate that into Discourse?
This is doable in a theme component, the method by @Alankrit_Choudh can work but I would recommend adding a custom ember initializer instead that overrides the URL in discourse instead of relying on window.onload here.
Я столкнулся с той же проблемой. window.onload работает, если вызывается до </head>, но не работает, если вызывается позже. Из-за этого document.getElementById не срабатывает (ID ещё не определён).
Не могли бы вы подсказать, где найти введение/пример/инструкцию по созданию кастомного инициализатора Ember для человека без опыта работы с Ember?
Для полноты картины: я пытаюсь отображать случайное баннерное изображение из массива URL-адресов:
var jlmyPix = new Array(
'/img/pic0.jpeg',
[ ... ]
'/img/picN.jpeg'
);
function jlchoosePic() {
var jlrandomPicNum = Math.floor(Math.random() * jlmyPix.length);
document.getElementById("jlmyPicture").src = jlmyPix[jlrandomPicNum];
};
window.onload = jlchoosePic;