K-Meleon
KMeleonWiki > Resources > MacroLibrary > MacroLibrary2 > Page Theme Kit
Submitted by: MonkeeSage
Notes:
Designed with the goal of bringing better 'page theme' integration to KM. It's a step anyhow. How ya likes. Cleaned up the menus a bit with submenus and added a few more external stylesheets.
$style_sel = ""; $external_css = ""; # Replace these with your own external styles (e.g., copied from opera), # but be careful to stick to the format here, and if you're not sure of what # it all means it's probably a good idea to keep the same directory too, # only replacing the 8 x's with the appropriate numbers for your profile # directory, and the file names (test.css, &c.) with your own file names. $external_css_0 = "!resource:///Profiles/default/xxxxxxxx.slt/chrome/test.css"; $external_css_1 = "!resource:///Profiles/default/xxxxxxxx.slt/chrome/dir.css"; $external_css_2 = "!resource:///Profiles/default/xxxxxxxx.slt/chrome/test2.css"; # Here are a few external http stylesheets to play with: # MSDN-like $external_css_3 = "http://www.arach.net.au/~kurdt/csszengarden/035.css"; # Mozilla-like $external_css_4 = "http://www.zeit.ca/zenzilla/001/001.css"; # "Bonsai Sky" $external_css_5 = "http://csszengarden.com/069/069.css"; style_switcher { open("javascript:(function() { var styles = document.styleSheets, s; for(s = 0; s < styles.length; s++) { if (s == ".$style_sel.") { styles[s].disabled = false; } else { styles[s].disabled = true; } } })();"); $style_sel = ""; } get_styles { menu = "List Styles"; open("javascript:(function() { var names = new Array(5); var flat_names = ''; var n, s; var styles = document.styleSheets; for(s = 0; s < 5; s++) { if (styles[s]) { if (styles[s].title) { names[s] = styles[s].title; } else { if (s == 0) { names[s] = 'Default'; } else { names[s] = 'Untitled'; } } } else { names[s] = 'Unavailable'; } } for (n = 0; n < 5; n++) { if (n != 5) { flat_names += names[n] + ',\\n'; } else { flat_names += names[n] + '\\n\'; } } alert('Styles from 0:\\n\\n' + flat_names); })();"); } add_styles { menu = "External Styles"; $style_sel = 0; macros(style_switcher); $external_css == "" ? $external_css = prompt("External CSS resource number (from 0):", "External CSS prompt...", "") : 0; $external_css == "" ? $external_css = $external_css_0 : 0; $external_css == "0" ? $external_css = $external_css_0 : 0; $external_css == "1" ? $external_css = $external_css_1 : 0; $external_css == "2" ? $external_css = $external_css_2 : 0; $external_css == "3" ? $external_css = $external_css_3 : 0; $external_css == "4" ? $external_css = $external_css_4 : 0; $external_css == "5" ? $external_css = $external_css_5 : 0; open("javascript:(function() { var appended = document.getElementById('append'); if (appended) { document.getElementsByTagName('head')[0].removeChild(appended); } var sty = document.createElement('link'); sty.title='External Stylesheet'; sty.rel='stylesheet'; sty.id = 'append'; document.getElementsByTagName('head')[0].appendChild(sty); sty = document.getElementById('append'); sty.type = 'text/css'; sty.href = '".$external_css."'; })();"); $external_css = ""; } kill_styles { menu = "Remove Styles"; $style_sel = -1; macros(style_switcher); } change_styles { menu = "Change Styles..."; $style = prompt("Style by Number (from 0):", "Style prompt...", ""); $style != "" ? $style_sel = $style : 0; $style != "" ? macros(style_switcher) : 0; } default_style { menu = "Default"; $style_sel = 0; macros(style_switcher); } style_1 { menu = "First"; $style_sel = 1; macros(style_switcher); } style_2 { menu = "Second"; $style_sel = 2; macros(style_switcher); } style_3 { menu = "Third"; $style_sel = 3; macros(style_switcher); } style_4 { menu = "Fourth"; $style_sel = 4; macros(style_switcher); } add_style_0 { menu = "Default"; $external_css = 0; macros(add_styles); } add_style_1 { menu = "First"; $external_css = 1; macros(add_styles); } add_style_2 { menu = "Second"; $external_css = 2; macros(add_styles); } add_style_3 { menu = "Third"; $external_css = 3; macros(add_styles); } add_style_4 { menu = "Fourth"; $external_css = 4; macros(add_styles); } add_style_5 { menu = "Fifth"; $external_css = 5; macros(add_styles); }
&General { macros(get_styles) macros(change_styles) macros(add_styles) macros(kill_styles) } &Internal Styles { macros(default_style) macros(style_1) macros(style_2) macros(style_3) macros(style_4) } &External Styles { macros(add_style_0) macros(add_style_1) macros(add_style_2) macros(add_style_3) macros(add_style_4) macros(add_style_5) } &Page Styles { :&General - :&Internal Styles - :&External Styles }
... - :&Page Styles ...
CTRL SHIFT C = macros(kill_styles) CTRL SHIFT VK_F1 = macros(default_style) CTRL SHIFT VK_F2 = macros(style_1) CTRL SHIFT VK_F3 = macros(style_2) CTRL SHIFT VK_F4 = macros(style_3) CTRL SHIFT VK_F5 = macros(style_4) CTRL SHIFT VK_F6 = macros(add_style_0) CTRL SHIFT VK_F7 = macros(add_style_1) CTRL SHIFT VK_F8 = macros(add_style_2) CTRL SHIFT VK_F9 = macros(add_style_3) CTRL SHIFT VK_F10 = macros(add_style_4) CTRL SHIFT VK_F11 = macros(add_style_5) CTRL SHIFT VK_F12 = macros(change_styles)