K-Meleon

KMeleonWiki > Resources > MacroLibrary > MacroLibrary2 > Slideshow Generator

Submitted by: Johnny Sim-Bravenboer



Notes:

This macro is a combination of the Auto Reload function (which is part of K-Meleon 0.9) and the Link Increment macro.

When looking at a picture on a webpage that has pictures that are named in sequence, (pic01.jpg, pic02.jpg, pic03.jpg, etc...)
this macro will create an instant slideshow and automatically go to the next picture in sequence.

To stop the slideshow, click on the "back" button.

As this is a Javascript program, there is a limited functionality while watching the slideshow, for example;

  • K-Meleon will stop functioning properly when going to full screen when the slideshow is running, so you will need to restart K-Meleon.
  • The only way to stop the slideshow is the "back" button or to close the tab/window.
  • Before the slideshow starts, the user needs to enter a time for the interval between pictures loading.
  • The counter will not wait for a picture to load before it goes on to the next, so you will need to set a longer time on slow web-pages.
  • The Address Bar will not be properly updated during the slideshow.

This is not a full featured macro, but it does the job ;-)

Note: You might like to use the Auto Image Resize macro, to enable automatic picture resizing, or add this macro to
the Image Browsing Toolbar, as I did.


Changes:

04-08-05 Added the image link to be displayed below the image currently being displayed


To use this macro, please make the following additions to your .cfg files:


In Macros:

# Slideshow

slide_show{
    $macro = "slideshow"; &JSEnable;
}

# Slideshow Generator

slideshow{        
    open("javascript:(function(){var intv=prompt('Enter number of seconds between images. (Click Back to stop the show)');if(intv&&!isNaN(intv)){with(document){write('<html><frameset rows=\"*,22\" framespacing=0 border=0 frameborder=no><frame noresize frameborder=no><frame scrolling=no noresize frameborder=no></frameset></html>');frames[0].location.href=document.location.href;var docstr='<html><body bgcolor=#33FF99 style=\"margin-top:0px\">\n';docstr+='<span id=\"caption\"></span></body>\n';docstr+='<script>\nvar reloadIntv='+intv+';\nvar secsLeft='+intv+';\nfunction reloadFrame(){secsLeft=reloadIntv+1;Increment();}\nfunction countDown(){secsLeft--;showTime();}\nfunction showTime(){document.getElementById(\"caption\").innerHTML=\"-- Current image: \"+L.substring(0,s)+newNum+L.slice(e+1)+\"  --  Next image in \"+ parseInt(secsLeft)+\" secs.\";}\nfunction Increment(){IB=1;\nfunction isDigit(c){return ("0" <= c && c <= "9");}L = parent.frames[0].location.href;LL = L.length;for (e=LL-1; e>=0; --e)if (isDigit(L.charAt(e))){for(s=e-1; s>=0; --s)if (!isDigit(L.charAt(s)))break;break;}++s;if (e<0)return;oldNum = L.substring(s,e+1);newNum = "" + (parseInt(oldNum,10) + IB);while (newNum.length < oldNum.length)newNum = "0" + newNum;parent.frames[0].location.href = L.substring(0,s) + newNum + L.slice(e+1);}\nsetInterval(\"reloadFrame()\",'+intv*1000+');\nsetInterval(\"countDown()\",1000);\nshowTime();\n</script>\n</html>';frames[1].document.write(docstr);}}})();");
}


In Menus:

&View{
     :&Toolbars
     -
     !Nav
     %ifplugin macros
     -
     macros(slide_show, Start Slideshow)
     :Mail and News
     :Home
     %else
     Home = ID_NAV_HOME
     ...
}


Comments & Questions

K-Meleon

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.