// Social Media Toolbar // This toolbar has three modes of display: // Open: Fully opened and expanded, viewer can see recent tweets and social media links - not stored as a state in webstateManager // Closed: Still visible, but viewer can only see the top "Facebook" area - uses code "c" in webstateManager // Hidden: No longer visible, with the exception of the tab - uses code "h" in webstateManager function toggleSMT() { if ($("#social-media-toolbar").hasClass("open")) { $("#social-media-toolbar .content").animate({ "height": "0" }, 500, function() { $("#social-media-toolbar").attr("class","hidden"); }); $("#social-media-toolbar .partial-label").css("height","45px"); // store the closed value in the webstateManager for next visit webstateManager.setWebstateValue("smt","h"); } else { $("#social-media-toolbar .content").animate({ "height": "45px" }, 500).show(); $("#social-media-toolbar").attr("class","open"); // store the closed value in the webstateManager for next visit webstateManager.setWebstateValue("smt","o"); } } function hideSMT() { if ($("#social-media-toolbar").hasClass("closed")) { $("#social-media-toolbar .partial-label").animate({ "height": "0px" }, 500, function() { $("#social-media-toolbar").attr("class", "open"); }); // store the hidden value in the webstateManager for next visit webstateManager.setWebstateValue("smt","h"); } } function showSMT() { $("#social-media-toolbar .partial-label").animate({ "height": "45px" }, 500).show(); $("#social-media-toolbar .content").animate({ "height": "45px" }, 500).show(); $("#social-media-toolbar").attr("class","open"); // store the closed value in the webstateManager for next visit webstateManager.setWebstateValue("smt","o"); } function isTouchDevice() { try { document.createEvent("TouchEvent"); return true; } catch (e) { return false; } } $(function() { if (isTouchDevice()) { $("#social-media-toolbar").addClass("touchscreen"); } else { var cookieValue = webstateManager.getWebstateValue("smt"); var styleClass = "closed"; $("#social-media-toolbar #toolbar-tab a").click(function(e) { e.preventDefault(); toggleSMT(); }); if (cookieValue == "o") { styleClass = "open"; } else if (cookieValue == "h") { styleClass = "hidden"; } // Set the toolbar class to value determined above $("#social-media-toolbar").attr("class", styleClass); $("#social-media-toolbar").ready(function() { window.setTimeout('showSMT()', 10); }); } });