Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src='http://code.jquery.com/jquery-latest.js' type='text/javascript'></script>
- <style type='text/css'>
- .cegdicon { position:relative;float:right;height:9px;width:9px;top:3px;margin-top:0px;}
- .cegdlink { display:block; }
- .cegdclosed { background: url(data:image/gif;base64,R0lGODlhCQAJAKIAAO/v5/fz78TK1/f39wAAAIuRoP///wAAACH5BAAAAAAALAAAAAAJAAkAAAMeKLVcajCaFQkca2gywiwDIYpfEAAWREHpJ0VOwwgJADs=) center center no-repeat;}
- .cegdopen { background: url(data:image/gif;base64,R0lGODlhCQAJAKIAAO/v5/fz78TK1/f39wAAAIuRoP///wAAACH5BAAAAAAALAAAAAAJAAkAAAMbKLVcajCaJeFYI+cwyyAg2AUBIFFVl05KswgJADs=) center center no-repeat;}
- </style>
- <script type='text/javascript'>
- //<![CDATA[
- // collapse/expand blogger sidebar gadgets
- // MS-potilas 2012. See http://yabtb.blogspot.com/2012/02/hack-to-expandcollapse-blogger-sidebar.html
- var cegdMargin = 6;
- var cegdGroups = {};
- function cegdToggle(ee, closeonly) {
- if(!closeonly) closeonly = false;
- var ele = $(ee);
- var ene = ele.find(".widget-content:first");
- if(!ene.length) ene = ele.find(".gadgets-gadget-container:first");
- var h2 = ele.find("h2:first");
- if(closeonly || !ene.is(":hidden")) {
- ene.slideUp("fast");
- h2.find(".cegdicon").addClass("cegdclosed");
- h2.find(".cegdicon").removeClass("cegdopen");
- } else {
- ene.slideDown("fast");
- h2.find(".cegdicon").addClass("cegdopen");
- h2.find(".cegdicon").removeClass("cegdclosed");
- }
- }
- function cegdClose(ee) { cegdToggle(ee, true); }
- function cegdDo(ee) {
- if(cegdGroups["#"+$(ee).attr("id")] && cegdGroups["#"+$(ee).attr("id")] != "") {
- var ccc=cegdGroups["#"+$(ee).attr("id")].split(",");
- for(var i=0; i<ccc.length; i++) cegdClose(ccc[i]);
- }
- cegdToggle(ee);
- }
- function cegdInit(ele, closed) {
- var h2 = $(ele).find("h2:first");
- if(h2.length) {
- if(!(h2.parent().is("a")))
- h2.wrap('<a title="Click to show/hide" class="cegdlink" href="javascript:void(0)" onclick="cegdDo(''+ele+'');this.blur();"></a>');
- $(ele).css('margin-top', cegdMargin);
- $(ele).css('margin-bottom', cegdMargin);
- if(!(h2.find(".cegdicon").length))
- h2.prepend('<div class="cegdicon cegdopen"></div>');
- if(closed) cegdClose(ele);
- }
- }
- function cedgID(gdg) {
- if(gdg[0] == '#') return gdg;
- if($(gdg).length == 1) return gdg;
- if(gdg[0] != '#' && $('#'+gdg).length == 1) return '#'+gdg;
- if($(".widget h2:contains('"+gdg+"')").length == 1)
- return '#'+($(".widget h2:contains('"+gdg+"')").parents(".widget").attr("id"));
- return gdg;
- }
- function cedgAddOpen() {
- if(arguments.length > 1 && cegdGroups[cedgID(arguments[0])]) return;
- for(var i = 0; i < arguments.length; i++) {
- arguments[i] = cedgID(arguments[i]);
- cegdInit(arguments[i]);
- var oth = "";
- for(var j = 0; j < arguments.length; j++) {
- if(i!=j) {
- if(oth!="") oth += ",";
- oth += cedgID(arguments[j]);
- }
- }
- if(oth != "") cegdGroups[arguments[i]] = oth;
- if(i) cegdClose(arguments[i]);
- }
- }
- function cedgAddClosed(gdgid) {
- cegdInit(cedgID(gdgid), true);
- }
- $(window).load(function() {
- // call cedgAddOpen / cedgAddClosed for gadgets you want to expand/collapse
- // parameter: gadget ID with # in front of it (CSS/jQuery selector), or gadget title.
- // cedgAddOpen can also create a group, from which only one is open at a time.
- // Adds "About Me", initially closed
- cedgAddClosed("#Profile1");
- // would add "Subscribe" gadget
- // cedgAddOpen("#Subscribe1");
- // This would add all sidebar gadgets, and make them closed initially
- // $(".sidebar .widget").each(function() { cedgAddClosed("#"+$(this).attr("id")); });
- });
- //]]>
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement