Created
January 16, 2009 05:22
-
-
Save gcr/47829 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pagehandler.clearAllActive = function(tlist) { | |
// tlist is the jQuery list of tabs. | |
// This function hides all the tabs' user lists and sets them to inactive. | |
$(tlist).find(".active").each(function (i, tab){ // For each active tab... | |
if (typeof session.subscribed_docs[$(tab).text()] != undefined) { // If our document still exists... | |
$(tab).removeClass("active"); // Make it inactive | |
$(tab).next().slideUp("medium"); // ...and slide up the user list (in the next node) | |
$(tab).find("img").hide(); // ...and remove all images | |
// Rebind our click handler. | |
$(tab).click(function() { | |
pagehandler.setActive(tab, tlist); // Then, we'll make this tab clickable again | |
}); | |
// Pretty hover effect. DOESN'T WORK.' | |
//$(tab).hover(function() {$(tab).addClass("hover");}, | |
// function() {$(tab).removeClass("hover");}); | |
// Now, hide our document itself | |
// TODO: This is ugly! | |
$(session.subscribed_docs[$(tab).text()].jqedit).hide(); //hides the editor | |
} | |
}); | |
} | |
pagehandler.setActive = function(tab, tlist) { | |
if (typeof session.subscribed_docs[$(tab).text()] != undefined) { | |
// This function sets the tab to active. | |
// First, clear any other active tabs | |
pagehandler.clearAllActive(tlist); | |
// Then, make it active | |
$(tab).addClass("active"); | |
$(tab).next().slideDown("medium"); // show userlist | |
$(tab).find("img").fadeIn("slow"); // and the close button | |
// Now, make sure we can't click it no more. | |
$(tab).unbind("click"); // Makes it so we can't click on this one | |
//$(tab).unbind("mouseover").unbind("mouseout"); // Unbinds hover- TODO: Doesn't work in IE6 | |
//$(tab).removeClass("hover"); | |
// Finally, show our document itself | |
// TODO: This is ugly! | |
$(session.subscribed_docs[$(tab).text()].jqedit).show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment