K-Meleon
KMeleonWiki > Resources > MacroLibrary > Slideshow Generator
Submitted by: Johnny Sim-Bravenboer
Notes:
This macro is a combination of the Auto Reload function (which was made 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.
Because this is a Javascript program, there is a limited functionality while watching the slideshow, for example;
This is not a full featured macro, but it does the job ;-)
Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following text file:
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage) # ---------- Slide Show -------------------------------------------------------------------------------------------- # # Dependencies : - # Resources : - # Preferences : - # # ------------------------------------------------------------------------------------------------------------------ # ----- PRIVATE # SLIDESHOW GENERATOR _SLIDESHOW_GENERATOR{ # Enable Javascript setpref(BOOL,$pref_JavaScript, true); # Run the Slide Show 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);}}})();"); } _SSG_BuildMenu{ setmenu("Page &Properties", macro, "Start Slide Show", _SLIDESHOW_GENERATOR, 3); } $OnInit=$OnInit."_SSG_BuildMenu;"; # ------------------------------------------------------------------------------------------------------------------ $macroModules=$macroModules."SlideShow;";