$(document).ready(function() {
$("#search-form").hide();
+ $("#bagit-form").hide();
- function closeSearch() {
+ //---------------------------------------------------------------------------
+ // Toggle the "Search" popup in the sidebar
+ //---------------------------------------------------------------------------
+ function toggleSearch() {
$("#search-form").toggle();
$("#search").toggleClass("current");
+ $("#search").toggleClass("active-current");
$("#search-arrow").toggleClass("arrow-down");
+ if ($("#search").hasClass("current")) {
+ $("#content").addClass("opacity03");
+ } else {
+ $("#content").removeClass("opacity03");
+ }
}
- $("#search").click(function(){
- closeSearch();
- // if other popup is already shown
- if ($("#bagit-form").length != 0) {
- $("#bagit").removeClass("active-current");
- $('#content').removeClass("opacity03");
- $("#bagit").removeClass("current");
- $("#bagit-arrow").removeClass("arrow-down");
- $("#bagit-form").hide();
+ //---------------------------------------------------------------------------
+ // Toggle the "Save a Link" popup in the sidebar
+ //---------------------------------------------------------------------------
+ function toggleBagit() {
+ $("#bagit-form").toggle();
+ $("#bagit").toggleClass("current");
+ $("#bagit").toggleClass("active-current");
+ $("#bagit-arrow").toggleClass("arrow-down");
+ if ($("#bagit").hasClass("current")) {
+ $("#content").addClass("opacity03");
+ } else {
+ $("#content").removeClass("opacity03");
}
- $('#searchfield').focus();
+ }
+
+ //---------------------------------------------------------------------------
+ // Close all #links popups in the sidebar
+ //---------------------------------------------------------------------------
+ function closePopups() {
+ $("#links .messages").hide();
+ $("#links > li > a").removeClass("active-current");
+ $("#links > li > a").removeClass("current");
+ $("[id$=-arrow]").removeClass("arrow-down");
+ $("#content").removeClass("opacity03");
+ }
+
+ $("#search").click(function(){
+ closePopups();
+ toggleSearch();
+ $("#searchfield").focus();
+ });
+
+ $("#bagit").click(function(){
+ closePopups();
+ toggleBagit();
+ $("#plainurl").focus();
});
$("#search-form-close").click(function(){
- closeSearch();
+ toggleSearch();
});
+ $("#bagit-form-close").click(function(){
+ toggleBagit();
+ });
+
+ // $("#").click(function(){
+ // toggleSearch();
+ // });
+
-});
\ No newline at end of file
+});
$('#plainurl').focus();
}
-
- $bagit.click(function(){
- $bagit.toggleClass("current");
- $("#bagit-arrow").toggleClass("arrow-down");
- toggleSaveLinkForm();
- });
-
- $("#bagit-form-close").click(function(){
- $bagit.removeClass("current");
- $("#bagit-arrow").removeClass("arrow-down");
- toggleSaveLinkForm();
- });
+ //---------------------------------------------------------------------------
+ // These two functions are now taken care of in popupForm.js
+ //---------------------------------------------------------------------------
+
+ // $bagit.click(function(){
+ // $bagit.toggleClass("current");
+ // $("#bagit-arrow").toggleClass("arrow-down");
+ // toggleSaveLinkForm();
+ // });
+
+ // $("#bagit-form-close").click(function(){
+ // $bagit.removeClass("current");
+ // $("#bagit-arrow").removeClass("arrow-down");
+ // toggleSaveLinkForm();
+ // });
//send "bag it link" form request via ajax