K-Meleon
KMeleonWiki > Resources > MacroLibrary > KmmOpenAllLinks
Original code submitted by: jsnj
Updated by: desga2
Notes:
For K-Meleon v.1.1.X.
Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following text file(s):
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage) # ---------- Open All Links --------------------------------------------------- # # Dependencies : main.kmm # Resources : - # Preferences : - # # ----------------------------------------------------------------------------- OpenAllLinks{ # Obtain Popups pref value: $_PUB_value = getpref(BOOL, $pref_Popups); $_PUB_value == true ? &pref_TogglePopups : 0; # Open all links in page: &_OpenLinks; # Restore pref value: $_PUB_value == true ? &pref_TogglePopups : 0; } # ----- PRIVATE _OpenLinks{ injectJS("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(dl[i].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(dl[i].href)) window.open(dl[i].href); } })();"); } _OpenAllLinks_BuildMenu{ $kLayers==true?setmenu("LayerButtonPopup",inline,"Open_Links",1):0; setmenu("DocumentPopup",inline,"Open_Links",1); setmenu("Open_Links",separator,1); setmenu("Open_Links",macro,"Open All Links","OpenAllLinks",2); } $OnInit=$OnInit."_OpenAllLinks_BuildMenu;"; # ----------------------------------------------------------------------------- $macroModules=$macroModules."OpenAllLinks;";