]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - themes/baggy/js/init.js
4830bd25021237739e466a406b2148b57b7ab1a2
1 $.fn
.ready(function() {
3 var $listmode
= $('#listmode'),
4 $listentries
= $("#list-entries"),
6 $bagitForm
= $('#bagit-form');
8 /* ==========================================================================
10 ========================================================================== */
12 $("#menu").click(function(){
16 /* ==========================================================================
17 List mode or Table Mode
18 ========================================================================== */
20 $listmode
.click(function(){
21 if ( $.cookie("listmode") == 1 ) {
23 $.removeCookie("listmode");
25 $listentries
.removeClass("listmode");
26 $listmode
.removeClass("tablemode");
27 $listmode
.addClass("listmode");
31 $.cookie("listmode", 1, {expires: 365});
33 $listentries
.addClass("listmode");
34 $listmode
.removeClass("listmode");
35 $listmode
.addClass("tablemode");
40 /* ==========================================================================
42 ========================================================================== */
44 if ( $.cookie("listmode") == 1 ) {
45 $listentries
.addClass("listmode");
46 $listmode
.removeClass("listmode");
47 $listmode
.addClass("tablemode");
50 /* ==========================================================================
51 bag it link and close button
52 ========================================================================== */
54 function toggleSaveLinkForm(url
) {
55 $bagit
.toggleClass("active-current");
57 $('#content').toggleClass("opacity03");
58 if (url
!== 'undefined' && url
) {
59 $('#plainurl').val(url
);
61 $('#plainurl').focus();
64 $bagit
.click(function(){
68 $("#bagit-form-close").click(function(){
72 $('#bagit-form form').submit(function(){
77 /* ==========================================================================
79 ========================================================================== */
81 $(window
).keydown(function(e
){
82 if ( ( e
.target
.tagName
.toLowerCase() !== 'input' && e
.keyCode
== 83 ) || e
.keyCode
== 27 ) {
88 /* ==========================================================================
89 Process all links inside an article
90 ========================================================================== */
92 $("article a[href^='http']").after(function() {
93 return " <a href=\"" + $(this).attr('href') + "\" class=\"add-to-wallabag-link-after\" alt=\"add to wallabag\" title=\"add to wallabag\">w</a> ";
96 $(".add-to-wallabag-link-after").click(function(event
){
97 event
.preventDefault();
98 toggleSaveLinkForm($(this).attr('href'));