K-Meleon

KMeleonWiki > Resources > MacroLibrary > Slideshow Generator

Submitted by: Johnny Sim-Bravenboer



Notes:

This macro is a combination of the Page 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 ;-)


In Macros:

# Slideshow

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

# Slideshow Generator

slideshow{        
    open("javascript:(function(){var intv=prompt('Enter number of seconds between pictures. (Click Back button to stop)');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>');frames0?.location.href=document.location.href;var docstr='<html><body style=\"margin-top:0px\">\n';docstr+='Next picture in <span id=\"caption\"></span>secs.</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=parseInt(secsLeft)+\" \";}\nfunction Increment(){IB=1;\nfunction isDigit(c){return ("0" <= c && c <= "9");}L = parent.frames0?.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.frames0?.location.href = L.substring(0,s) + newNum + L.slice(e+1);}\nsetInterval(\"reloadFrame()\",'+intv*1000+');\nsetInterval(\"countDown()\",1000);\nshowTime();\n</script>\n</html>';frames1?.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.