mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-23 09:32:15 -05:00
Merge pull request #919 from jsit/popupjs_
Improving JavaScript for popup forms
This commit is contained in:
commit
20bb3f7f2a
@ -1,29 +1,72 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$("#search-form").hide();
|
$("#search-form").hide();
|
||||||
|
$("#bagit-form").hide();
|
||||||
|
|
||||||
function closeSearch() {
|
//---------------------------------------------------------------------------
|
||||||
|
// Toggle the "Search" popup in the sidebar
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
function toggleSearch() {
|
||||||
$("#search-form").toggle();
|
$("#search-form").toggle();
|
||||||
$("#search").toggleClass("current");
|
$("#search").toggleClass("current");
|
||||||
|
$("#search").toggleClass("active-current");
|
||||||
$("#search-arrow").toggleClass("arrow-down");
|
$("#search-arrow").toggleClass("arrow-down");
|
||||||
|
if ($("#search").hasClass("current")) {
|
||||||
|
$("#content").addClass("opacity03");
|
||||||
|
} else {
|
||||||
|
$("#content").removeClass("opacity03");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// 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(){
|
$("#search").click(function(){
|
||||||
closeSearch();
|
closePopups();
|
||||||
// if other popup is already shown
|
toggleSearch();
|
||||||
if ($("#bagit-form").length != 0) {
|
$("#searchfield").focus();
|
||||||
$("#bagit").removeClass("active-current");
|
});
|
||||||
$('#content').removeClass("opacity03");
|
|
||||||
$("#bagit").removeClass("current");
|
$("#bagit").click(function(){
|
||||||
$("#bagit-arrow").removeClass("arrow-down");
|
closePopups();
|
||||||
$("#bagit-form").hide();
|
toggleBagit();
|
||||||
}
|
$("#plainurl").focus();
|
||||||
$('#searchfield').focus();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#search-form-close").click(function(){
|
$("#search-form-close").click(function(){
|
||||||
closeSearch();
|
toggleSearch();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#bagit-form-close").click(function(){
|
||||||
|
toggleBagit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// $("#").click(function(){
|
||||||
|
// toggleSearch();
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
@ -36,18 +36,21 @@ $.fn.ready(function() {
|
|||||||
$('#plainurl').focus();
|
$('#plainurl').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// These two functions are now taken care of in popupForm.js
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
$bagit.click(function(){
|
// $bagit.click(function(){
|
||||||
$bagit.toggleClass("current");
|
// $bagit.toggleClass("current");
|
||||||
$("#bagit-arrow").toggleClass("arrow-down");
|
// $("#bagit-arrow").toggleClass("arrow-down");
|
||||||
toggleSaveLinkForm();
|
// toggleSaveLinkForm();
|
||||||
});
|
// });
|
||||||
|
|
||||||
$("#bagit-form-close").click(function(){
|
// $("#bagit-form-close").click(function(){
|
||||||
$bagit.removeClass("current");
|
// $bagit.removeClass("current");
|
||||||
$("#bagit-arrow").removeClass("arrow-down");
|
// $("#bagit-arrow").removeClass("arrow-down");
|
||||||
toggleSaveLinkForm();
|
// toggleSaveLinkForm();
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
|
||||||
//send "bag it link" form request via ajax
|
//send "bag it link" form request via ajax
|
||||||
|
Loading…
Reference in New Issue
Block a user