mirror of
https://github.com/wallabag/wallabag.git
synced 2025-10-10 19:32:07 +00:00
feature #505 - it is now possible to add link from bagged article (TODO: redev it to ajax action). Some enhancements to "save a link" popup div
This commit is contained in:
parent
f7382cd8c3
commit
6775da70a8
5 changed files with 109 additions and 29 deletions
|
@ -48,31 +48,58 @@ $.fn.ready(function() {
|
|||
}
|
||||
|
||||
/* ==========================================================================
|
||||
bag it link
|
||||
========================================================================== */
|
||||
bag it link and close button
|
||||
========================================================================== */
|
||||
|
||||
function toggleSaveLinkForm(url) {
|
||||
$bagit.toggleClass("active-current");
|
||||
$bagitForm.toggle();
|
||||
$('#content').toggleClass("opacity03");
|
||||
if (url !== 'undefined' && url) {
|
||||
$('#plainurl').val(url);
|
||||
}
|
||||
$('#plainurl').focus();
|
||||
}
|
||||
|
||||
$bagit.click(function(){
|
||||
$bagitForm.toggle();
|
||||
toggleSaveLinkForm();
|
||||
});
|
||||
|
||||
$("#bagit-form-close").click(function(){
|
||||
toggleSaveLinkForm();
|
||||
});
|
||||
|
||||
$('#bagit-form form').submit(function(){
|
||||
toggleSaveLinkForm();
|
||||
return true;
|
||||
});
|
||||
|
||||
/* ==========================================================================
|
||||
Keyboard gestion
|
||||
========================================================================== */
|
||||
Keyboard gestion
|
||||
========================================================================== */
|
||||
|
||||
$(window).keydown(function(e){
|
||||
if ( e.target.tagName.toLowerCase() !== 'input' ) {
|
||||
switch (e.keyCode) {
|
||||
// s letter
|
||||
case 83:
|
||||
$bagitForm.toggle();
|
||||
return false;
|
||||
break;
|
||||
case 27:
|
||||
$bagitForm.hide();
|
||||
break;
|
||||
}
|
||||
if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) {
|
||||
toggleSaveLinkForm();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
/* ==========================================================================
|
||||
Process all links inside an article
|
||||
========================================================================== */
|
||||
|
||||
$("article a[href^='http']").after(function() {
|
||||
return " <a href=\"" + $(this).attr('href') + "\" class=\"add-to-wallabag-link-after\" alt=\"add to wallabag\" title=\"add to wallabag\">w</a> ";
|
||||
});
|
||||
|
||||
$(".add-to-wallabag-link-after").click(function(event){
|
||||
event.preventDefault();
|
||||
toggleSaveLinkForm($(this).attr('href'));
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue