Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 09-10-2018, 12:41 PM   #1
babloyi
Member
babloyi began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Feb 2015
Device: none
Question How to show random images on poweroff?

Hi all!

I've got KSM and koreader on my Kobo Aura, and I want to show random images from a list. If I save my poweroff_info.html as this:
Code:
<html>
<head>
<script type="text/javascript">
  var imageURLs = [
       "1.png"
     , "2.png"
     , "3.png"
     , "4.png"
     , "5.png"
     , "6.png"
  ];
  function getImageTag() {
    var img = '<img src="/mnt/onboard/.adds/kbmenu_user/txt/';
    var randomIndex = Math.floor(Math.random() * imageURLs.length);
    img += imageURLs[randomIndex];
    img += '"/>';
    return img;
  }
</script>
</head>
<body>
<script type="text/javascript">
  document.write(getImageTag());
</script>
</body>
</html>
Nothing happens, and the reader powers off with a blank white page.

However, if I do this:
Code:
<html>
<body>
	<img src="/mnt/onboard/.adds/kbmenu_user/txt/1.png"/>
</body>
</html>
It shows 1.png fine. I've not done html in ages, and I'm not that skilled in javascript, so is that the problem, or is it something else? I copied the code off the net, but if I run it in a random folder on my PC, with the path corrected, it works fine.
babloyi is offline   Reply With Quote
Old 09-10-2018, 01:37 PM   #2
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,292
Karma: 2860927
Join Date: Jun 2012
Device: kobo touch
KSM displays the power off html without javascript support. For random html display see this post.
tshering is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advice needed - how to best show several small images patrik Workshop 5 09-04-2015 02:21 PM
html to epub images don't show moviejunkie Conversion 1 05-23-2012 08:22 PM
Images not show in Stanza or Kobo silviolorusso ePub 2 06-16-2011 06:04 PM
images don't show on Bebook One bobcdy ePub 2 11-24-2010 11:37 PM
Images don't show up after build angbrown Kindle Formats 3 09-25-2009 09:06 AM


All times are GMT -4. The time now is 07:21 PM.


MobileRead.com is a privately owned, operated and funded community.