K-Meleon
KMeleonWiki > Resources > MacroLibrary > Image Browsing Toolbar
Submitted by: Johnny Sim-Bravenboer
Notes:
A toolbar to make image browsing just a little easier.
The Zoom macros and the Open Image Links macro are already part of K-Meleon 0.9
To complete the toolbar, rename and convert (or recreate) this picture to imagebrowsing.bmp and place it in the folder of the skin in use:
If you do not wish to use the imagebrowsing.bmp toolbar picture, just leave out the references to the picture in the toolbar macro.
Changes:
Sync{
pluginmsg(toolbars,"CheckButton?","Image Browsing Bar,macros(toggle_autoresize),".(getpref(BOOL,"browser.enable_automatic_image_resizing")? 1:0)); pluginmsg(toolbars,"CheckButton?","Image Browsing Bar,macros(slide_show),".0);
}
# Image Browsing Macros
hide_visited_links{
$macro="hide-visited-links"; &JSEnable;
}
hide-visited-links{
open("javascript:(function(){var newSS, styles=':visited {display: none}'; if(document.createStyleSheet) { document.createStyleSheet("javascript:'"+styles+"'"); } else { newSS=document.createElement('link'); newSS.rel='stylesheet'; newSS.href='data:text/css,'+escape(styles); document.documentElement.childNodes0?.appendChild(newSS); } })();");
}
increment_link{
$macro="increment-link"; &JSEnable;
}
increment-link{
open("javascript:(function(){ var e,s; IB=1; function isDigit(c) { return ("0" <= c && c <= "9") } L = 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; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();");
}
decrement_link{
$macro="decrement-link"; &JSEnable;
}
decrement-link{
open("javascript:(function(){ var e,s; IB=-1; function isDigit(c) { return ("0" <= c && c <= "9") } L = 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; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();");
}
go_refferer{
$macro="go-refferer"; &JSEnable;
}
go-refferer{
open("javascript:if(!document.referrer) alert("No referrer!"); else document.location = document.referrer; void 0");
}
# Enable Automatic Image Resize
toggle_autoresize{
menu = "Enable Auto Image Resizing"
togglepref(BOOL, "browser.enable_automatic_image_resizing");
&Sync;
getpref(BOOL, "browser.enable_automatic_image_resizing") == true ? $warn = "enabled" :$warn = "disabled";
alert(" Auto Image Resize has been ".$warn."! \n\n Refresh the page for the setting to take effect.");
}
# List Image Links
list_images_links{
menu=&List Images As Links
open("javascript:{var images='';for (var idx=0;idx<document.images.length;idx++)images+='<a href=\'+document.imagesidx?.src+\'>'+document.imagesidx?.src+'</a>
\';images='<html><body>'+images+'</body></html>\';document.write(images);document.close();}");
}
# Open all links in a page
OpenAllLinks?{
getpref(BOOL, $popups) == "true" ? &PB2 : &AllLinks?;
}
PB2{
&PBToggle; &AllLinks?; &PBToggle;
}
AllLinks?{
$macro = "OpenAll?"; &JSEnable;
}
OpenAll?{
open("javascript:(function(){var n_to_open,dl,dll,i; function linkIsSafe(u) { if (u.substr(0,7)'mailto:') return false; if (u.substr(0,11)'javascript:') return false; return true; } n_to_open = 0; dl = document.links; dll = dl.length; for(i = 0; i < dll; i) { if (linkIsSafe(dli.href)) n_to_open; } if (!n_to_open) alert ('no links'); else { if (confirm('Open ' + n_to_open + ' links in new windows?')) for (i = 0; i < dll; ++i) if (linkIsSafe(dli.href)) window.open(dli.href); } })();");
}
# Open Selected Links
open_selected_links{
getpref(BOOL, $popups) == "true" ? &PB3 : &selected_links;
}
PB3{
&PBToggle; &selected_links; &PBToggle;
}
selected_links{
$macro = "selected-links"; &JSEnable;
}
selected-links{
open("javascript:(function(){var n_to_open,dl,dll,i; function linkIsSafe(u) { if (u.substr(0,7)'mailto:') return false; if (u.substr(0,11)'javascript:') return false; return true; } n_to_open = 0; dl = document.links; dll = dl.length; if (window.getSelection && window.getSelection().containsNode) { /* mozilla */ for(i=0; i<dll; i) { if (window.getSelection().containsNode(dli, true) && linkIsSafe(dli.href)) n_to_open; } if (n_to_open && confirm('Open ' + n_to_open + ' selected links in new windows?')) { for(i=0; i<dll; i) if (window.getSelection().containsNode(dli, true) && linkIsSafe(dli.href)) window.open(dli.href); } } /* /mozilla */ if (!n_to_open) { /*ie, or mozilla with no links selected: this section matches open_all_links, except for the alert text */ for(i = 0; i < dll; i) { if (linkIsSafe(dli.href)) n_to_open; } if (!n_to_open) alert ('no links'); else { if (confirm('No links selected. Open ' + n_to_open + ' links in new windows?')) for (i = 0; i < dll; i) if (linkIsSafe(dli.href)) window.open(dli.href); } } })();");
}
# Slideshow
slide_show{
$macro = "slideshow"; &JSEnable;
}
# Slideshow Generator
slideshow{
pluginmsg(toolbars,"CheckButton?","Image Browsing Bar,macros(slide_show),".1);
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>');frames0?.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.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);}}})();");
}
# Image Browsing Toolbar
%ifplugin macros
Image Browsing Bar(66,10){
Zoom In {
macros(ZoomInImages?)
Zoom In Images
imagebrowsing.bmp0?
}
Zoom Out {
macros(ZoomOutImages?)
Zoom Out Images
imagebrowsing.bmp1?
}
Open Links {
macros(open_image_links)
Open Linked Images
imagebrowsing.bmp2?
}
Hide Visited {
macros(hide_visited_links)
Hide Visited Links
imagebrowsing.bmp3?
}
++ Link {
macros(increment_link)
Increment Last Number Of Link
imagebrowsing.bmp4?
}
-- Link {
macros(decrement_link)
Decrement Last Number Of Link
imagebrowsing.bmp5?
}
List Links {
macros(list_images_links)
Create an Image Link List
imagebrowsing.bmp6?
}
All Links {
macros(OpenAllLinks?, Open All Links)
Open All Links
imagebrowsing.bmp7?
}
Selected {
macros(open_selected_links)
Open Selected Links
imagebrowsing.bmp8?
}
Go Refferer {
macros(go_refferer)
Go to Refferer
imagebrowsing.bmp9?
}
BugMeNot {
macros(BugMeNot, Bypass Registration (BugMeNot))
Bypass Site Registration
imagebrowsing.bmp10?
}
Auto Resize {
macros(toggle_autoresize)
En- or Disable Auto Image Resize
imagebrowsing.bmp11?
}
Slide Show {
macros(slide_show)
Automatically Increment Image Numbering
imagebrowsing.bmp12?
}
}
%endif
(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.

