]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
clean & lint stuff
authorThomas Citharel <tcit@tcit.fr>
Thu, 9 Jun 2016 17:02:38 +0000 (19:02 +0200)
committerThomas Citharel <tcit@tcit.fr>
Thu, 9 Jun 2016 17:02:38 +0000 (19:02 +0200)
.eslintrc.json [new file with mode: 0644]
Gruntfile.js
app/Resources/static/themes/_global/js/restoreScroll.js
app/Resources/static/themes/baggy/js/autoClose.js
app/Resources/static/themes/baggy/js/autoCompleteTags.js
app/Resources/static/themes/baggy/js/closeMessage.js
app/Resources/static/themes/baggy/js/init.js
app/Resources/static/themes/baggy/js/popupForm.js
app/Resources/static/themes/baggy/js/saveLink.js
app/Resources/static/themes/material/js/init.js
package.json

diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644 (file)
index 0000000..976a9eb
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "extends": "airbnb",
+    "installedESLint": true,
+}
index c63c392b2819309974d3833de142e3139391651f..04fd1fe865596f71ca54656316ff8279f13e7407 100644 (file)
@@ -9,85 +9,81 @@ module.exports = function (grunt) {
       material: {
         options: {
           map: {
-              inline: false
+            inline: false,
           },
 
           processors: [
             require('pixrem')(),
-            require('autoprefixer')({browsers: 'last 2 versions'}),
-            require('cssnano')()
-          ]
+            require('autoprefixer')({ browsers: 'last 2 versions' }),
+            require('cssnano')(),
+          ],
         },
         src: '<%= buildDir %>/material.css',
-        dest: '<%= buildDir %>/themes/material/css/style.min.css'
+        dest: '<%= buildDir %>/themes/material/css/style.min.css',
       },
       baggy: {
         options: {
           map: {
-              inline: false
+            inline: false,
           },
 
           processors: [
             require('pixrem')(),
-            require('autoprefixer')({browsers: 'last 2 versions'}),
-            require('cssnano')()
-          ]
+            require('autoprefixer')({ browsers: 'last 2 versions' }),
+            require('cssnano')(),
+          ],
         },
         src: '<%= buildDir %>/baggy.css',
-        dest: '<%= buildDir %>/themes/baggy/css/style.min.css'
-      }
+        dest: '<%= buildDir %>/themes/baggy/css/style.min.css',
+      },
     },
     concat: {
       options: {
-        separator: ';'
+        separator: ';',
       },
       jsMaterial: {
         src: [
-          'node_modules/jquery/dist/jquery.js',
-          'node_modules/jquery-ui/jquery-ui.js',
-          'node_modules/materialize-css/bin/materialize.js',
+          '<%= appDir %>/themes/material/js/init.js',
           '<%= appDir %>/themes/_global/js/restoreScroll.js',
-          '<%= appDir %>/themes/material/js/init.js'
         ],
-        dest: '<%= buildDir %>/material.js'
+        dest: '<%= buildDir %>/material.js',
       },
       jsBaggy: {
         src: [
-          'node_modules/jquery/dist/jquery.js',
-          'node_modules/jquery-ui/jquery-ui.js',
           '<%= appDir %>/themes/baggy/js/init.js',
           '<%= appDir %>/themes/_global/js/restoreScroll.js',
           '<%= appDir %>/themes/baggy/js/autoClose.js',
           '<%= appDir %>/themes/baggy/js/autoCompleteTags.js',
           '<%= appDir %>/themes/baggy/js/closeMessage.js',
           '<%= appDir %>/themes/baggy/js/popupForm.js',
-          '<%= appDir %>/themes/baggy/js/saveLink.js'
+          // Save link is no more used for now
+          // '<%= appDir %>/themes/baggy/js/saveLink.js',
         ],
-        dest: '<%= buildDir %>/baggy.js'
+        dest: '<%= buildDir %>/baggy.js',
       },
       cssMaterial: {
         src: [
           'node_modules/materialize-css/bin/materialize.css',
-          '<%= appDir %>/themes/material/css/*.css'
+          '<%= appDir %>/themes/material/css/*.css',
         ],
-        dest: '<%= buildDir %>/material.css'
+        dest: '<%= buildDir %>/material.css',
       },
       cssBaggy: {
         src: [
-          '<%= appDir %>/themes/baggy/css/*.css'
+          '<%= appDir %>/themes/baggy/css/*.css',
         ],
-        dest: '<%= buildDir %>/baggy.css'
-      }
+        dest: '<%= buildDir %>/baggy.css',
+      },
     },
     browserify: {
       '<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'],
-      '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js']
+      '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js'],
     },
     uglify: {
       material: {
         files: {
           '<%= buildDir %>/themes/material/js/material.min.js':
-            ['<%= buildDir %>/material.browser.js']
+            ['<%= buildDir %>/material.browser.js'],
         },
         options: {
           sourceMap: true,
@@ -96,7 +92,7 @@ module.exports = function (grunt) {
       baggy: {
         files: {
           '<%= buildDir %>/themes/baggy/js/baggy.min.js':
-            ['<%= buildDir %>/baggy.browser.js']
+            ['<%= buildDir %>/baggy.browser.js'],
         },
         options: {
           sourceMap: true,
@@ -108,14 +104,14 @@ module.exports = function (grunt) {
         expand: true,
         cwd: 'node_modules/pickadate/lib',
         src: 'picker.js',
-        dest: '<%= buildDir %>'
+        dest: '<%= buildDir %>',
       },
       annotator: {
         expand: true,
         cwd: 'node_modules/annotator/pkg',
         src: 'annotator.min.js',
-        dest: '<%= buildDir %>/themes/_global/js/'
-      }
+        dest: '<%= buildDir %>/themes/_global/js/',
+      },
     },
     symlink: {
       baggyfonts: {
@@ -123,50 +119,50 @@ module.exports = function (grunt) {
           {
             expand: true,
             overwrite: true,
-            cwd: "<%= appDir %>/lib/icomoon-bower/",
-            src: "fonts",
-            dest: "<%= buildDir %>/themes/baggy/"
+            cwd: '<%= appDir %>/lib/icomoon-bower/',
+            src: 'fonts',
+            dest: '<%= buildDir %>/themes/baggy/',
           },
           {
             expand: true,
             overwrite: true,
-            cwd: "<%= appDir %>/lib/bower-pt-sans/fonts",
-            src: "*",
-            dest: "<%= buildDir %>/themes/baggy/fonts/"
-          }
-        ]
+            cwd: '<%= appDir %>/lib/bower-pt-sans/fonts',
+            src: '*',
+            dest: '<%= buildDir %>/themes/baggy/fonts/',
+          },
+        ],
       },
       materialfonts: {
         files: [
           {
             expand: true,
             overwrite: true,
-            cwd: "<%= appDir %>/lib/icomoon-bower/",
-            src: "fonts",
-            dest: "<%= buildDir %>/themes/material/"
+            cwd: '<%= appDir %>/lib/icomoon-bower/',
+            src: 'fonts',
+            dest: '<%= buildDir %>/themes/material/',
           },
           {
             expand: true,
             overwrite: true,
-            cwd: "node_modules/materialize-css/",
-            src: "font",
-            dest: "<%= buildDir %>/themes/material"
+            cwd: 'node_modules/materialize-css/',
+            src: 'font',
+            dest: '<%= buildDir %>/themes/material',
           },
           {
             expand: true,
             overwrite: true,
-            cwd: "<%= appDir %>/lib/roboto-fontface/fonts/",
-            src: "*",
-            dest: "<%= buildDir %>/themes/material/fonts/roboto/"
+            cwd: '<%= appDir %>/lib/roboto-fontface/fonts/',
+            src: '*',
+            dest: '<%= buildDir %>/themes/material/fonts/roboto/',
           },
           {
             expand: true,
             overwrite: true,
-            cwd: "<%= appDir %>/lib/material-design-icons/iconfont/",
-            src: "*",
-            dest: "<%= buildDir %>/themes/material/fonts/"
-          }
-        ]
+            cwd: '<%= appDir %>/lib/material-design-icons/iconfont/',
+            src: '*',
+            dest: '<%= buildDir %>/themes/material/fonts/',
+          },
+        ],
       },
       pics: {
         files: [
@@ -175,22 +171,22 @@ module.exports = function (grunt) {
             overwrite: true,
             cwd: '<%= appDir %>/themes/_global/',
             src: 'img',
-            dest: '<%= buildDir %>/themes/_global/'
-          }
-        ]
-      }
+            dest: '<%= buildDir %>/themes/_global/',
+          },
+        ],
+      },
     },
     clean: {
       css: {
-        src: [ '<%= buildDir %>/**/*.css' ]
+        src: ['<%= buildDir %>/**/*.css'],
       },
       js: {
-        src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map']
+        src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'],
       },
       all: {
-        src: ['./<%= buildDir %>']
-      }
-    }
+        src: ['./<%= buildDir %>'],
+      },
+    },
   });
 
   grunt.registerTask(
@@ -216,4 +212,4 @@ module.exports = function (grunt) {
     'Compiles the stylesheets.',
     ['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss']
   );
-}
+};
index e63d06c695985b998d1eda35cfc2760be0e5294b..9c4d7e20b94f85822159cfe8b2c3520dd8aa13e3 100644 (file)
@@ -1,25 +1,25 @@
 function supportsLocalStorage() {
-    try {
-        return 'localStorage' in window && window['localStorage'] !== null;
-    } catch (e) {
-        return false;
-    }
+  try {
+    return 'localStorage' in window && window.localStorage !== null;
+  } catch (e) {
+    return false;
+  }
 }
 
 function savePercent(id, percent) {
-    if (!supportsLocalStorage()) { return false; }
-    localStorage["wallabag.article." + id + ".percent"] = percent;
-    return true;
+  if (!supportsLocalStorage()) { return false; }
+  localStorage['wallabag.article.' + id + '.percent'] = percent;
+  return true;
 }
 
 function retrievePercent(id) {
-    if (!supportsLocalStorage()) { return false; }
+  if (!supportsLocalStorage()) { return false; }
 
-    var bheight = $(document).height();
-    var percent = localStorage["wallabag.article." + id + ".percent"];
-    var scroll = bheight * percent;
+  var bheight = $(document).height();
+  var percent = localStorage['wallabag.article.' + id + '.percent'];
+  var scroll = bheight * percent;
 
-    $('html,body').animate({scrollTop: scroll}, 'fast');
+  $('html,body').animate({ scrollTop: scroll }, 'fast');
 
-    return true;
+  return true;
 }
index e9145b7e2e091b5443fc39b1d9a336a5180b8fdb..b0dafab210651d579c9f6ea2f287788b4e0c3a1b 100644 (file)
@@ -1,6 +1,8 @@
-$(document).ready(function() {
-       current_url = window.location.href
-       if (current_url.match("&closewin=true")) {
-               window.close();
-       }
+var $ = global.jquery = require('jquery');
+
+$(document).ready(function () {
+  var currentUrl = window.location.href;
+  if (currentUrl.match('&closewin=true')) {
+    window.close();
+  }
 });
index 90bc982c2080ed61fe42e92b7707dd1f70d3231c..edd0a421e27be5d16f76b188bf1fdbc6bd852386 100755 (executable)
@@ -1,47 +1,46 @@
-jQuery(function($) {
+var $ = global.jquery = require('jquery');
 
-  function split( val ) {
-    return val.split( /,\s*/ );
+jQuery(function ($) {
+  function split(val) {
+    return val.split(/,\s*/);
   }
-  function extractLast( term ) {
-    return split( term ).pop();
+  function extractLast(term) {
+    return split(term).pop();
   }
 
 
-  $("#value").bind("keydown", function(event) {
-    if (event.keyCode === $.ui.keyCode.TAB && $(this).data("ui-autocomplete").menu.active) {
+  $('#value').bind('keydown', function (event) {
+    if (event.keyCode === $.ui.keyCode.TAB && $(this).data('ui-autocomplete').menu.active) {
       event.preventDefault();
     }
   }).autocomplete({
-    source : function(request, response) {
-      $.getJSON("./?view=tags", {
-        term : extractLast(request.term),
+    source: function (request, response) {
+      $.getJSON('./?view=tags', {
+        term: extractLast(request.term),
         //id: $(':hidden#entry_id').val()
       }, response);
     },
-    search : function() {
+    search: function () {
       // custom minLength
       var term = extractLast(this.value);
       if (term.length < 1) {
         return false;
       }
     },
-    focus : function() {
+    focus: function () {
       // prevent value inserted on focus
       return false;
     },
-    select : function(event, ui) {
+    select: function (event, ui) {
       var terms = split(this.value);
       // remove the current input
       terms.pop();
       // add the selected item
       terms.push(ui.item.value);
       // add placeholder to get the comma-and-space at the end
-      terms.push("");
-      this.value = terms.join(", ");
+      terms.push('');
+      this.value = terms.join(', ');
       return false;
-    }
+    },
   });
-
-
 });
index 527719d5a07837b29f1b9595dde451bd063adeff..ae4b179127972d03e259a7cbf56b61a2264aa783 100644 (file)
@@ -1,17 +1,19 @@
-$(function(){
-     //---------------------------------------------------------------------------
-     // Show the close icon when the user hover over a message 
-     //---------------------------------------------------------------------------
-     // $('.messages').on('mouseenter', function(){
-     //      $(this).find('a.closeMessage').stop(true, true).show();
-     // }).on('mouseleave', function(){
-     //      $(this).find('a.closeMessage').stop(true, true).hide();
-     // });
-     //---------------------------------------------------------------------------
-     // Close the message box when the user clicks the close icon
-     //---------------------------------------------------------------------------
-     $('a.closeMessage').on('click', function(){
-          $(this).parents('div.messages').slideUp(300, function(){ $(this).remove(); });
-          return false;
-     });
-});
\ No newline at end of file
+var $ = global.jquery = require('jquery');
+
+$(function () {
+  //---------------------------------------------------------------------------
+  // Show the close icon when the user hover over a message
+  //---------------------------------------------------------------------------
+  // $('.messages').on('mouseenter', function(){
+  //      $(this).find('a.closeMessage').stop(true, true).show();
+  // }).on('mouseleave', function(){
+  //      $(this).find('a.closeMessage').stop(true, true).hide();
+  // });
+  //---------------------------------------------------------------------------
+  // Close the message box when the user clicks the close icon
+  //---------------------------------------------------------------------------
+  $('a.closeMessage').on('click', function () {
+    $(this).parents('div.messages').slideUp(300, function () { $(this).remove(); });
+    return false;
+  });
+});
index 1721ae41ab392ffc1bd64827586733a904f64479..d7d4b166155daf3a4a2c43fb79150ee30949d343 100755 (executable)
@@ -4,19 +4,18 @@ require('jquery-ui');
 var annotator = require('annotator');
 
 
-$.fn.ready(function() {
-
-  var $listmode = $('#listmode'),
-      $listentries = $("#list-entries");
+$.fn.ready(function () {
+  var $listmode = $('#listmode');
+  var $listentries = $('#list-entries');
 
   /* ==========================================================================
      Menu
      ========================================================================== */
 
-  $("#menu").click(function(){
-    $("#links").toggleClass('menu--open');
+  $('#menu').click(function () {
+    $('#links').toggleClass('menu--open');
     if ($('#content').hasClass('opacity03')) {
-        $('#content').removeClass('opacity03');
+      $('#content').removeClass('opacity03');
     }
   });
 
@@ -24,34 +23,32 @@ $.fn.ready(function() {
      List mode or Table Mode
      ========================================================================== */
 
-  $listmode.click(function(){
-    if ( jquery.cookie("listmode") == 1 ) {
+  $listmode.click(function () {
+    if (jquery.cookie('listmode') === 1) {
       // Cookie
-      $.removeCookie("listmode");
+      $.removeCookie('listmode');
 
-      $listentries.removeClass("listmode");
-      $listmode.removeClass("tablemode");
-      $listmode.addClass("listmode");
-    }
-    else {
+      $listentries.removeClass('listmode');
+      $listmode.removeClass('tablemode');
+      $listmode.addClass('listmode');
+    } else {
       // Cookie
-      jquery.cookie("listmode", 1, {expires: 365});
+      jquery.cookie('listmode', 1, { expires: 365 });
 
-      $listentries.addClass("listmode");
-      $listmode.removeClass("listmode");
-      $listmode.addClass("tablemode");
+      $listentries.addClass('listmode');
+      $listmode.removeClass('listmode');
+      $listmode.addClass('tablemode');
     }
-
   });
 
   /* ==========================================================================
      Cookie listmode
      ========================================================================== */
 
-  if ( jquery.cookie("listmode") == 1 ) {
-    $listentries.addClass("listmode");
-    $listmode.removeClass("listmode");
-    $listmode.addClass("tablemode");
+  if (jquery.cookie('listmode') === 1) {
+    $listentries.addClass('listmode');
+    $listmode.removeClass('listmode');
+    $listmode.addClass('tablemode');
   }
 
   /* ==========================================================================
@@ -59,43 +56,43 @@ $.fn.ready(function() {
      ========================================================================== */
 
 
-  $('#nav-btn-add-tag').on('click', function(){
-       $(".nav-panel-add-tag").toggle(100);
-       $(".nav-panel-menu").addClass('hidden');
-       $("#tag_label").focus();
-       return false;
-    });
+  $('#nav-btn-add-tag').on('click', function () {
+    $('.nav-panel-add-tag').toggle(100);
+    $('.nav-panel-menu').addClass('hidden');
+    $('#tag_label').focus();
+    return false;
+  });
 
   /* ==========================================================================
      Annotations & Remember position
      ========================================================================== */
 
-    if ($("article").length) {
-        var app = new annotator.App();
+    if ($('article').length) {
+      var app = new annotator.App();
 
-        app.include(annotator.ui.main, {
-            element: document.querySelector('article')
-        });
+      app.include(annotator.ui.main, {
+        element: document.querySelector('article'),
+      });
 
-        var x = JSON.parse($('#annotationroutes').html());
-        app.include(annotator.storage.http, x);
+      var x = JSON.parse($('#annotationroutes').html());
+      app.include(annotator.storage.http, x);
 
-        app.start().then(function () {
-             app.annotations.load({entry: x.entryId});
-        });
+      app.start().then(function () {
+        app.annotations.load({ entry: x.entryId });
+      });
 
-        $(window).scroll(function(e){
-            var scrollTop = $(window).scrollTop();
-            var docHeight = $(document).height();
-            var scrollPercent = (scrollTop) / (docHeight);
-            var scrollPercentRounded = Math.round(scrollPercent*100)/100;
-            savePercent(x.entryId, scrollPercentRounded);
-        });
+      $(window).scroll(function (e) {
+        var scrollTop = $(window).scrollTop();
+        var docHeight = $(document).height();
+        var scrollPercent = (scrollTop) / (docHeight);
+        var scrollPercentRounded = Math.round(scrollPercent * 100) / 100;
+        savePercent(x.entryId, scrollPercentRounded);
+      });
 
-        retrievePercent(x.entryId);
+      retrievePercent(x.entryId);
 
-        $(window).resize(function(){
-            retrievePercent(x.entryId);
-        });
+      $(window).resize(function () {
+          retrievePercent(x.entryId);
+      });
     }
 });
index 0b478fadd50e5a9634b353310fe79ae396dc9cd5..95ba60ee55feebe1b05f105671681478e72408ac 100644 (file)
-$(document).ready(function() {
+var $ = global.jquery = require('jquery');
 
-    $("#search-form").hide();
-    $("#bagit-form").hide();
-    $("#filter-form").hide();
-    $("#download-form").hide();
+$(document).ready(function () {
+  $('#search-form').hide();
+  $('#bagit-form').hide();
+  $('#filter-form').hide();
+  $('#download-form').hide();
 
-    //---------------------------------------------------------------------------
-    // 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");
-        }
+  //---------------------------------------------------------------------------
+  // 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');
     }
+  }
 
-    //---------------------------------------------------------------------------
-    // Toggle the "Filter" popup on entries list
-    //---------------------------------------------------------------------------
-    function toggleFilter() {
-        $("#filter-form").toggle();
-    }
+  //---------------------------------------------------------------------------
+  // Toggle the 'Filter' popup on entries list
+  //---------------------------------------------------------------------------
+  function toggleFilter() {
+    $('#filter-form').toggle();
+  }
 
-    //---------------------------------------------------------------------------
-    // Toggle the "Download" popup on entries list
-    //---------------------------------------------------------------------------
-    function toggleDownload() {
-        $("#download-form").toggle();
-    }
+  //---------------------------------------------------------------------------
+  // Toggle the 'Download' popup on entries list
+  //---------------------------------------------------------------------------
+  function toggleDownload() {
+    $('#download-form').toggle();
+  }
 
-    //---------------------------------------------------------------------------
-    // 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");
-        }
+  //---------------------------------------------------------------------------
+  // 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");
-    }
+  //---------------------------------------------------------------------------
+  // 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();
-    });
+  $('#search').click(function () {
+    closePopups();
+    toggleSearch();
+    $('#searchfield').focus();
+  });
 
-    $(".filter-btn").click(function(){
-        closePopups();
-        toggleFilter();
-    });
+  $('.filter-btn').click(function () {
+    closePopups();
+    toggleFilter();
+  });
 
-    $(".download-btn").click(function(){
-        closePopups();
-        toggleDownload();
-    });
+  $('.download-btn').click(function () {
+    closePopups();
+    toggleDownload();
+  });
 
-    $("#bagit").click(function(){
-        closePopups();
-        toggleBagit();
-        $("#plainurl").focus();
-    });
+  $('#bagit').click(function () {
+    closePopups();
+    toggleBagit();
+    $('#plainurl').focus();
+  });
 
-    $("#search-form-close").click(function(){
-        toggleSearch();
-    });
+  $('#search-form-close').click(function () {
+    toggleSearch();
+  });
 
-    $("#filter-form-close").click(function(){
-        toggleFilter();
-    });
+  $('#filter-form-close').click(function () {
+    toggleFilter();
+  });
 
-    $("#download-form-close").click(function(){
-        toggleDownload();
-    });
+  $('#download-form-close').click(function () {
+    toggleDownload();
+  });
 
-    $("#bagit-form-close").click(function(){
-        toggleBagit();
-    });
+  $('#bagit-form-close').click(function () {
+    toggleBagit();
+  });
 });
index 91cc2c3fab58d2909eef681ea08099e8eca6faab..5c72088629e5657371705f98a14b951e7e17eaea 100755 (executable)
@@ -1,60 +1,60 @@
-$.fn.ready(function() {
+var $ = global.jquery = require('jquery');
 
-  var $bagit = $('#bagit'),
-      $bagitForm = $('#bagit-form'),
-      $bagitFormForm = $('#bagit-form-form');
+$.fn.ready(function () {
+  var $bagit = $('#bagit');
+  var $bagitForm = $('#bagit-form');
+  var $bagitFormForm = $('#bagit-form-form');
 
   /* ==========================================================================
    bag it link and close button
    ========================================================================== */
 
   function toggleSaveLinkForm(url, event) {
-    $("#add-link-result").empty();
+    $('#add-link-result').empty();
 
-    $bagit.toggleClass("active-current");
+    $bagit.toggleClass('active-current');
 
-    //only if bag-it link is not presented on page
-    if ( $bagit.length === 0 ) {
-      if ( event !== 'undefined' && event ) {
-        $bagitForm.css( {position:"absolute", top:event.pageY, left:event.pageX-200});
-      }
-      else {
-        $bagitForm.css( {position:"relative", top:"auto", left:"auto"});
+    // only if bag-it link is not presented on page
+    if ($bagit.length === 0) {
+      if (event !== 'undefined' && event) {
+        $bagitForm.css({ position: 'absolute', top: event.pageY, left: event.pageX - 200 });
+      } else {
+        $bagitForm.css({ position: 'relative', top: 'auto', left: 'auto' });
       }
     }
 
-    if ($("#search-form").length != 0) {
-       $("#search").removeClass("current");
-       $("#search-arrow").removeClass("arrow-down");
-       $("#search-form").hide();
+    if ($('#search-form').length !== 0) {
+      $('#search').removeClass('current');
+      $('#search-arrow').removeClass('arrow-down');
+      $('#search-form').hide();
     }
     $bagitForm.toggle();
-    $('#content').toggleClass("opacity03");
+    $('#content').toggleClass('opacity03');
     if (url !== 'undefined' && url) {
       $('#plainurl').val(url);
     }
     $('#plainurl').focus();
   }
 
-  //send "bag it link" form request via ajax
-  $bagitFormForm.submit( function(event) {
-    $("body").css("cursor", "wait");
-    $("#add-link-result").empty();
+  // send 'bag it link' form request via ajax
+  $bagitFormForm.submit(function (event) {
+    $('body').css('cursor', 'wait');
+    $('#add-link-result').empty();
 
     $.ajax({
       type: $bagitFormForm.attr('method'),
       url: $bagitFormForm.attr('action'),
       data: $bagitFormForm.serialize(),
-      success: function(data) {
-        $('#add-link-result').html("Done!");
+      success: function (data) {
+        $('#add-link-result').html('Done!');
         $('#plainurl').val('');
         $('#plainurl').blur('');
-        $("body").css("cursor", "auto");
+        $('body').css('cursor', 'auto');
+      },
+      error: function (data) {
+        $('#add-link-result').html('Failed!');
+        $('body').css('cursor', 'auto');
       },
-      error: function(data) {
-        $('#add-link-result').html("Failed!");
-        $("body").css("cursor", "auto");
-      }
     });
 
     event.preventDefault();
@@ -64,15 +64,12 @@ $.fn.ready(function() {
    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\"></a> ";
+  $('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"></a> ';
   });
 
-  $(".add-to-wallabag-link-after").click(function(event){
+  $('.add-to-wallabag-link-after').click(function (event) {
     toggleSaveLinkForm($(this).attr('href'), event);
     event.preventDefault();
   });
-
 });
-
-
index 33019d3db12dd4310251dfd33cf86e0a6e62ef1e..d6a87941ee1baf89171731034869e5bf63793f05 100755 (executable)
-var $ = require("jquery"),
-materialize = require("materialize");
+var $ = require('jquery');
+require('materialize');
 var annotator = require('annotator');
 
-function init_filters() {
-    // no display if filters not aviable
-    if ($("div").is("#filters")) {
-        $('#button_filters').show();
-        $('.button-collapse-right').sideNav({ edge: 'right' });
-        $('#clear_form_filters').on('click', function(){
-            $('#filters input').val('');
-            $('#filters :checked').removeAttr('checked');
-            return false;
-        });
-    }
+function initFilters() {
+  // no display if filters not aviable
+  if ($('div').is('#filters')) {
+    $('#button_filters').show();
+    $('.button-collapse-right').sideNav({ edge: 'right' });
+    $('#clear_form_filters').on('click', function () {
+      $('#filters input').val('');
+      $('#filters :checked').removeAttr('checked');
+      return false;
+    });
+  }
 }
 
-function init_export() {
-    // no display if export not aviable
-    if ($("div").is("#export")) {
-        $('#button_export').show();
-        $('.button-collapse-right').sideNav({ edge: 'right' });
-    }
+function initExport() {
+  // no display if export not aviable
+  if ($('div').is('#export')) {
+    $('#button_export').show();
+    $('.button-collapse-right').sideNav({ edge: 'right' });
+  }
 }
 
-$(document).ready(function(){
-    // sideNav
-    $('.button-collapse').sideNav();
-    $('select').material_select();
-    $('.collapsible').collapsible({
-        accordion : false
-    });
-    $('.datepicker').pickadate({
-        selectMonths: true,
-        selectYears: 15,
-        formatSubmit: 'dd/mm/yyyy',
-        hiddenName: true,
-        format: 'dd/mm/yyyy',
-    });
-    init_filters();
-    init_export();
+$(document).ready(function () {
+  // sideNav
+  $('.button-collapse').sideNav();
+  $('select').material_select();
+  $('.collapsible').collapsible({
+    accordion: false,
+  });
+  $('.datepicker').pickadate({
+    selectMonths: true,
+    selectYears: 15,
+    formatSubmit: 'dd/mm/yyyy',
+    hiddenName: true,
+    format: 'dd/mm/yyyy',
+  });
+  initFilters();
+  initExport();
 
-    $('#nav-btn-add-tag').on('click', function(){
-       $(".nav-panel-add-tag").toggle(100);
-       $(".nav-panel-menu").addClass('hidden');
-       $("#tag_label").focus();
-       return false;
-    });
-    $('#nav-btn-add').on('click', function(){
-       $(".nav-panel-buttom").hide(100);
-       $(".nav-panel-add").show(100);
-       $(".nav-panels .action").hide(100);
-       $(".nav-panel-menu").addClass('hidden');
-       $(".nav-panels").css('background', 'white');
-       $("#entry_url").focus();
-       return false;
-    });
-    $('#nav-btn-search').on('click', function(){
-        $(".nav-panel-buttom").hide(100);
-        $(".nav-panel-search").show(100);
-        $(".nav-panels .action").hide(100);
-        $(".nav-panel-menu").addClass('hidden');
-        $(".nav-panels").css('background', 'white');
-        $("#searchfield").focus();
-        return false;
-    });
-    $('.close').on('click', function(){
-        $(".nav-panel-add").hide(100);
-        $(".nav-panel-search").hide(100);
-        $(".nav-panel-buttom").show(100);
-        $(".nav-panels .action").show(100);
-        $(".nav-panel-menu").removeClass('hidden');
-        $(".nav-panels").css('background', 'transparent');
-        return false;
-    });
-    $(window).scroll(function () {
-        var s = $(window).scrollTop(),
-        d = $(document).height(),
-        c = $(window).height();
-        var scrollPercent = (s / (d-c)) * 100;
-        $(".progress .determinate").css('width', scrollPercent+'%');
-    });
+  $('#nav-btn-add-tag').on('click', function () {
+    $('.nav-panel-add-tag').toggle(100);
+    $('.nav-panel-menu').addClass('hidden');
+    $('#tag_label').focus();
+    return false;
+  });
+  $('#nav-btn-add').on('click', function () {
+    $('.nav-panel-buttom').hide(100);
+    $('.nav-panel-add').show(100);
+    $('.nav-panels .action').hide(100);
+    $('.nav-panel-menu').addClass('hidden');
+    $('.nav-panels').css('background', 'white');
+    $('#entry_url').focus();
+    return false;
+  });
+  $('#nav-btn-search').on('click', function () {
+    $('.nav-panel-buttom').hide(100);
+    $('.nav-panel-search').show(100);
+    $('.nav-panels .action').hide(100);
+    $('.nav-panel-menu').addClass('hidden');
+    $('.nav-panels').css('background', 'white');
+    $('#searchfield').focus();
+    return false;
+  });
+  $('.close').on('click', function () {
+    $('.nav-panel-add').hide(100);
+    $('.nav-panel-search').hide(100);
+    $('.nav-panel-buttom').show(100);
+    $('.nav-panels .action').show(100);
+    $('.nav-panel-menu').removeClass('hidden');
+    $('.nav-panels').css('background', 'transparent');
+    return false;
+  });
+  $(window).scroll(function () {
+    var s = $(window).scrollTop();
+    var d = $(document).height();
+    var c = $(window).height();
+    var scrollPercent = (s / (d - c)) * 100;
+    $('.progress .determinate').css('width', scrollPercent + '%');
+  });
+
+/* ==========================================================================
+   Annotations & Remember position
+   ========================================================================== */
 
-  /* ==========================================================================
-     Annotations & Remember position
-     ========================================================================== */
+  if ($('article').length) {
+    var app = new annotator.App();
+    var x = JSON.parse($('#annotationroutes').html());
 
-    if ($("article").length) {
-        var app = new annotator.App();
 
-        app.include(annotator.ui.main, {
-            element: document.querySelector('article')
-        });
+    app.include(annotator.ui.main, {
+      element: document.querySelector('article'),
+    });
 
-        var x = JSON.parse($('#annotationroutes').html());
-        app.include(annotator.storage.http, x);
+    app.include(annotator.storage.http, x);
 
-        app.start().then(function () {
-             app.annotations.load({entry: x.entryId});
-        });
+    app.start().then(function () {
+      app.annotations.load({ entry: x.entryId });
+    });
 
-        $(window).scroll(function(e){
-            var scrollTop = $(window).scrollTop();
-            var docHeight = $(document).height();
-            var scrollPercent = (scrollTop) / (docHeight);
-            var scrollPercentRounded = Math.round(scrollPercent*100)/100;
-            savePercent(x.entryId, scrollPercentRounded);
-        });
+    $(window).scroll(function (e) {
+      var scrollTop = $(window).scrollTop();
+      var docHeight = $(document).height();
+      var scrollPercent = (scrollTop) / (docHeight);
+      var scrollPercentRounded = Math.round(scrollPercent * 100) / 100;
+      savePercent(x.entryId, scrollPercentRounded);
+    });
 
-        retrievePercent(x.entryId);
+    retrievePercent(x.entryId);
 
-        $(window).resize(function(){
-            retrievePercent(x.entryId);
-        });
-    }
+    $(window).resize(function () {
+      retrievePercent(x.entryId);
+    });
+  }
 });
index 603596ae92208699422babca9d6e3bf2e3735928..5d6306f0211b5e6b787019c2eefb7e95c63df2da 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "wallabag",
-  "version": "2.0.0",
+  "version": "2.1.0",
   "description": "wallabag is a self hostable application for saving web pages",
   "main": "index.js",
   "private": true,
     "grunt-contrib-clean": "^1.0.0",
     "grunt-contrib-concat": "^1.0.0",
     "grunt-contrib-copy": "^1.0.0",
-    "grunt-contrib-cssmin": "^1.0.0",
     "grunt-contrib-symlink": "^1.0.0",
     "grunt-contrib-uglify": "^1.0.0",
     "grunt-postcss": "^0.8.0",
-    "grunt-shell": "^1.2.1",
     "hammerjs": "^2.0.6",
     "jquery": "^2.2.1",
     "jquery-ui": "^1.10.5",
@@ -80,5 +78,9 @@
   "license": "MIT",
   "bugs": {
     "url": "https://github.com/wallabag/wallabag/issues"
+  },
+  "devDependencies": {
+    "eslint": "^2.11.1",
+    "eslint-config-airbnb": "^9.0.1",
   }
 }