diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/images/buttonbg.png b/images/buttonbg.png new file mode 100644 index 0000000..084d7f9 Binary files /dev/null and b/images/buttonbg.png differ diff --git a/images/icon_color_arrow.gif b/images/icon_color_arrow.gif new file mode 100644 index 0000000..b458c7a Binary files /dev/null and b/images/icon_color_arrow.gif differ diff --git a/images/menuhoverbg.png b/images/menuhoverbg.png new file mode 100644 index 0000000..c94cf53 Binary files /dev/null and b/images/menuhoverbg.png differ diff --git a/images/theme_90_black_matte.png b/images/theme_90_black_matte.png new file mode 100644 index 0000000..182cc0e Binary files /dev/null and b/images/theme_90_black_matte.png differ diff --git a/images/theme_90_black_tie.png b/images/theme_90_black_tie.png new file mode 100644 index 0000000..4ea6693 Binary files /dev/null and b/images/theme_90_black_tie.png differ diff --git a/images/theme_90_blitzer.png b/images/theme_90_blitzer.png new file mode 100644 index 0000000..5dde122 Binary files /dev/null and b/images/theme_90_blitzer.png differ diff --git a/images/theme_90_cupertino.png b/images/theme_90_cupertino.png new file mode 100644 index 0000000..0d9f11a Binary files /dev/null and b/images/theme_90_cupertino.png differ diff --git a/images/theme_90_dark_hive.png b/images/theme_90_dark_hive.png new file mode 100644 index 0000000..66ab870 Binary files /dev/null and b/images/theme_90_dark_hive.png differ diff --git a/images/theme_90_dot_luv.png b/images/theme_90_dot_luv.png new file mode 100644 index 0000000..2f7bf69 Binary files /dev/null and b/images/theme_90_dot_luv.png differ diff --git a/images/theme_90_eggplant.png b/images/theme_90_eggplant.png new file mode 100644 index 0000000..92e3d5a Binary files /dev/null and b/images/theme_90_eggplant.png differ diff --git a/images/theme_90_excite_bike.png b/images/theme_90_excite_bike.png new file mode 100644 index 0000000..5f58e82 Binary files /dev/null and b/images/theme_90_excite_bike.png differ diff --git a/images/theme_90_flick.png b/images/theme_90_flick.png new file mode 100644 index 0000000..4baa549 Binary files /dev/null and b/images/theme_90_flick.png differ diff --git a/images/theme_90_hot_sneaks.png b/images/theme_90_hot_sneaks.png new file mode 100644 index 0000000..cde01b3 Binary files /dev/null and b/images/theme_90_hot_sneaks.png differ diff --git a/images/theme_90_humanity.png b/images/theme_90_humanity.png new file mode 100644 index 0000000..891b39e Binary files /dev/null and b/images/theme_90_humanity.png differ diff --git a/images/theme_90_le_frog.png b/images/theme_90_le_frog.png new file mode 100644 index 0000000..80d0d8b Binary files /dev/null and b/images/theme_90_le_frog.png differ diff --git a/images/theme_90_mint_choco.png b/images/theme_90_mint_choco.png new file mode 100644 index 0000000..97d2c87 Binary files /dev/null and b/images/theme_90_mint_choco.png differ diff --git a/images/theme_90_overcast.png b/images/theme_90_overcast.png new file mode 100644 index 0000000..b1e5dcc Binary files /dev/null and b/images/theme_90_overcast.png differ diff --git a/images/theme_90_pepper_grinder.png b/images/theme_90_pepper_grinder.png new file mode 100644 index 0000000..97b5d73 Binary files /dev/null and b/images/theme_90_pepper_grinder.png differ diff --git a/images/theme_90_smoothness.png b/images/theme_90_smoothness.png new file mode 100644 index 0000000..fa0f8fe Binary files /dev/null and b/images/theme_90_smoothness.png differ diff --git a/images/theme_90_south_street.png b/images/theme_90_south_street.png new file mode 100644 index 0000000..1545fd0 Binary files /dev/null and b/images/theme_90_south_street.png differ diff --git a/images/theme_90_start_menu.png b/images/theme_90_start_menu.png new file mode 100644 index 0000000..abd9b67 Binary files /dev/null and b/images/theme_90_start_menu.png differ diff --git a/images/theme_90_sunny.png b/images/theme_90_sunny.png new file mode 100644 index 0000000..32867b9 Binary files /dev/null and b/images/theme_90_sunny.png differ diff --git a/images/theme_90_swanky_purse.png b/images/theme_90_swanky_purse.png new file mode 100644 index 0000000..4ae2a33 Binary files /dev/null and b/images/theme_90_swanky_purse.png differ diff --git a/images/theme_90_trontastic.png b/images/theme_90_trontastic.png new file mode 100644 index 0000000..f77b455 Binary files /dev/null and b/images/theme_90_trontastic.png differ diff --git a/images/theme_90_ui_dark.png b/images/theme_90_ui_dark.png new file mode 100644 index 0000000..80e0fe8 Binary files /dev/null and b/images/theme_90_ui_dark.png differ diff --git a/images/theme_90_ui_light.png b/images/theme_90_ui_light.png new file mode 100644 index 0000000..04544e3 Binary files /dev/null and b/images/theme_90_ui_light.png differ diff --git a/images/theme_90_windoze.png b/images/theme_90_windoze.png new file mode 100644 index 0000000..2b8c3bd Binary files /dev/null and b/images/theme_90_windoze.png differ diff --git a/jquery.themeswitcher.js b/jquery.themeswitcher.js new file mode 100644 index 0000000..d31644a --- /dev/null +++ b/jquery.themeswitcher.js @@ -0,0 +1,433 @@ +(function( $ ){ + + $.fn.themeswitcher = function( options ) { + var switcherDiv = this, switcherOptions = {}; + var settings = { + loadtheme : "", + height: 200, + width: 175, + rounded: true, + imgpath: "", + jqueryuiversion: "1.8.10", + initialtext: "Switch Theme", + buttonpretext: "Theme:", + closeonselect: true, + buttonheight: 14, + cookiename: "jquery-ui-theme", + themes: [{title:"Blah blah",name:"Blah",icon: "theme_90_black_tie.png",url:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/trontastic/jquery-ui.css"}], + additionalthemes: [], + onopen: null, + onclose: null, + onselect: null + }; + + if(options) { + //lowercase all options passed in + $.each(options, function(k,v){ + switcherOptions[k.toLowerCase()] = v; + }); + + $.extend( settings, switcherOptions ); + } + + if( ! settings.themes.length ){ + var themes = [ + { + title: "Black Tie", + name: "black-tie", + icon: "theme_90_black_tie.png" + }, + { + title: "Blitzer", + name: "blitzer", + icon: "theme_90_blitzer.png" + }, + { + title: "Cupertino", + name: "cupertino", + icon: "theme_90_cupertino.png" + }, + { + title: "Dark Hive", + name: "dark-hive", + icon: "theme_90_dark_hive.png" + }, + { + title: "Dot Luv", + name: "dot-luv", + icon: "theme_90_dot_luv.png" + }, + { + title: "Eggplant", + name: "eggplant", + icon: "theme_90_eggplant.png" + }, + { + title: "Excite Bike", + name: "excite-bike", + icon: "theme_90_excite_bike.png" + }, + { + title: "Flick", + name: "flick", + icon: "theme_90_flick.png" + }, + { + title: "Hot Sneaks", + name: "hot-sneaks", + icon: "theme_90_hot_sneaks.png" + }, + { + title: "Humanity", + name: "humanity", + icon: "theme_90_humanity.png" + }, + { + title: "Le Frog", + name: "le-frog", + icon: "theme_90_le_frog.png" + }, + { + title: "Mint Choc", + name: "mint-choc", + icon: "theme_90_mint_choco.png" + }, + { + title: "Overcast", + name: "overcast", + icon: "theme_90_overcast.png" + }, + { + title: "Pepper Grinder", + name: "pepper-grinder", + icon: "theme_90_pepper_grinder.png" + }, + { + title: "Redmond", + name: "redmond", + icon: "theme_90_windoze.png" + }, + { + title: "Smoothness", + name: "smoothness", + icon: "theme_90_smoothness.png" + }, + { + title: "South Street", + name: "south-street", + icon: "theme_90_south_street.png" + }, + { + title: "Start", + name: "start", + icon: "theme_90_start_menu.png" + }, + { + title: "Sunny", + name: "sunny", + icon: "theme_90_sunny.png" + }, + { + title: "Swanky Purse", + name: "swanky-purse", + icon: "theme_90_swanky_purse.png" + }, + { + title: "Trontastic", + name: "trontastic", + icon: "theme_90_trontastic.png" + }, + { + title: "UI Darkness", + name: "ui-darkness", + icon: "theme_90_ui_dark.png" + }, + { + title: "UI Lightness", + name: "ui-lightness", + icon: "theme_90_ui_light.png" + }, + { + title: "Vader", + name: "vader", + icon: "theme_90_black_matte.png" + } + ] + }else{ + var themes = settings.themes; + } + + if( settings.additionalthemes.length ){ + $.extend( themes, settings.additionalthemes ); + } + + // Switcher link + var switcherLinkStyle = { + "cursor": "pointer", + "font-family": "'Trebuchet MS', Verdana, sans-serif", + "font-size": "11px", + "color": "#666", + "background": "#eee url("+settings.imgpath+"buttonbg.png) repeat-x 50% 50%", + "border": "1px solid #CCC", + "text-decoration": "none", + "padding": "3px 3px 3px 8px", + "width": settings.width+"px", + "display": "block", + "height": settings.buttonheight+"px", + "outline": "0px" , + "line-height": settings.buttonheight+"px" + } + + if( settings.rounded ){ + switcherLinkStyle['border-radius'] = "6px"; + switcherLinkStyle['-moz-border-radius'] = "6px"; + switcherLinkStyle['-webkit-border-radius'] = "6px"; + } + + var switcherLink = $("") + .addClass("jquery-ui-switcher-link") + .css(switcherLinkStyle) + .bind({ + mouseenter: function(){ + $(this).css({ + "background": "#eee" + }) + }, + mouseleave: function(){ + if( ! switcherDiv.find(".jquery-ui-switcher-list-hldr").is(":visible") ){ + $(this).css({ + "background":"#eee url("+settings.imgpath+"buttonbg.png) repeat-x 50% 50%" + }) + } + }, + click: function(){ + if( !switcherDiv.find(".jquery-ui-switcher-list-hldr").is(":visible") ){ + openSwitcher(); + }else{ + closeSwitcher(); + } + } + }); + + // Title & Icon for switcher link + var switcherTitle = $("").addClass("jquery-ui-switcher-title").appendTo(switcherLink); + $("").addClass("jquery-ui-switcher-arrow") + .css({ + "float": "right", + "width": "16px", + "height": "16px", + "background": "url("+settings.imgpath+"icon_color_arrow.gif) no-repeat 50% 50%" + }) + .appendTo(switcherLink); + + // load the default theme or the theme stored in the cookie + if( $.cookie(settings.cookiename) ){ + updateTheme( findTheme($.cookie(settings.cookiename)) ); + + }else if( settings.loadtheme.length ){ + updateTheme( findTheme(settings.loadtheme) ); + + }else{ + switcherTitle.text(settings.initialtext); + } + + var switcherListHldr = $("
") + .addClass("jquery-ui-switcher-list-hldr") + .css({ + "width": eval(settings.width+8)+"px", + "background": "#000", + "color": "#FFF", + "font-family": "'Trebuchet MS', Verdana, sans-serif", + "font-size": "12px", + "border": "1px solid #CCC", + "border-top": "none", + "z-index": "999999", + "position": "absolute", + "top": eval(settings.buttonheight+3)+"px", + "left": "0px", + "padding": "3px 3px 3px 0", + "display": "none" + }) + .bind({ + mouseleave: function(){ + closeSwitcher(); + } + }); + + if( settings.rounded ){ + switcherListHldr.css("border-radius","0 0 6px 6px"); + switcherListHldr.css("-moz-border-radius","0 0 6px 6px"); + switcherListHldr.css("-webkit-border-radius","0 0 6px 6px"); + } + + var switcherList = $("