clean & lint stuff

This commit is contained in:
Thomas Citharel 2016-06-09 19:02:38 +02:00
parent 5ecdfcd041
commit 0743287f95
11 changed files with 395 additions and 394 deletions

4
.eslintrc.json Normal file
View file

@ -0,0 +1,4 @@
{
"extends": "airbnb",
"installedESLint": true,
}

View file

@ -9,85 +9,81 @@ module.exports = function (grunt) {
material: { material: {
options: { options: {
map: { map: {
inline: false inline: false,
}, },
processors: [ processors: [
require('pixrem')(), require('pixrem')(),
require('autoprefixer')({ browsers: 'last 2 versions' }), require('autoprefixer')({ browsers: 'last 2 versions' }),
require('cssnano')() require('cssnano')(),
] ],
}, },
src: '<%= buildDir %>/material.css', src: '<%= buildDir %>/material.css',
dest: '<%= buildDir %>/themes/material/css/style.min.css' dest: '<%= buildDir %>/themes/material/css/style.min.css',
}, },
baggy: { baggy: {
options: { options: {
map: { map: {
inline: false inline: false,
}, },
processors: [ processors: [
require('pixrem')(), require('pixrem')(),
require('autoprefixer')({ browsers: 'last 2 versions' }), require('autoprefixer')({ browsers: 'last 2 versions' }),
require('cssnano')() require('cssnano')(),
] ],
}, },
src: '<%= buildDir %>/baggy.css', src: '<%= buildDir %>/baggy.css',
dest: '<%= buildDir %>/themes/baggy/css/style.min.css' dest: '<%= buildDir %>/themes/baggy/css/style.min.css',
} },
}, },
concat: { concat: {
options: { options: {
separator: ';' separator: ';',
}, },
jsMaterial: { jsMaterial: {
src: [ src: [
'node_modules/jquery/dist/jquery.js', '<%= appDir %>/themes/material/js/init.js',
'node_modules/jquery-ui/jquery-ui.js',
'node_modules/materialize-css/bin/materialize.js',
'<%= appDir %>/themes/_global/js/restoreScroll.js', '<%= appDir %>/themes/_global/js/restoreScroll.js',
'<%= appDir %>/themes/material/js/init.js'
], ],
dest: '<%= buildDir %>/material.js' dest: '<%= buildDir %>/material.js',
}, },
jsBaggy: { jsBaggy: {
src: [ src: [
'node_modules/jquery/dist/jquery.js',
'node_modules/jquery-ui/jquery-ui.js',
'<%= appDir %>/themes/baggy/js/init.js', '<%= appDir %>/themes/baggy/js/init.js',
'<%= appDir %>/themes/_global/js/restoreScroll.js', '<%= appDir %>/themes/_global/js/restoreScroll.js',
'<%= appDir %>/themes/baggy/js/autoClose.js', '<%= appDir %>/themes/baggy/js/autoClose.js',
'<%= appDir %>/themes/baggy/js/autoCompleteTags.js', '<%= appDir %>/themes/baggy/js/autoCompleteTags.js',
'<%= appDir %>/themes/baggy/js/closeMessage.js', '<%= appDir %>/themes/baggy/js/closeMessage.js',
'<%= appDir %>/themes/baggy/js/popupForm.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: { cssMaterial: {
src: [ src: [
'node_modules/materialize-css/bin/materialize.css', '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: { cssBaggy: {
src: [ src: [
'<%= appDir %>/themes/baggy/css/*.css' '<%= appDir %>/themes/baggy/css/*.css',
], ],
dest: '<%= buildDir %>/baggy.css' dest: '<%= buildDir %>/baggy.css',
} },
}, },
browserify: { browserify: {
'<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'], '<%= buildDir %>/material.browser.js': ['<%= buildDir %>/material.js'],
'<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js'] '<%= buildDir %>/baggy.browser.js': ['<%= buildDir %>/baggy.js'],
}, },
uglify: { uglify: {
material: { material: {
files: { files: {
'<%= buildDir %>/themes/material/js/material.min.js': '<%= buildDir %>/themes/material/js/material.min.js':
['<%= buildDir %>/material.browser.js'] ['<%= buildDir %>/material.browser.js'],
}, },
options: { options: {
sourceMap: true, sourceMap: true,
@ -96,7 +92,7 @@ module.exports = function (grunt) {
baggy: { baggy: {
files: { files: {
'<%= buildDir %>/themes/baggy/js/baggy.min.js': '<%= buildDir %>/themes/baggy/js/baggy.min.js':
['<%= buildDir %>/baggy.browser.js'] ['<%= buildDir %>/baggy.browser.js'],
}, },
options: { options: {
sourceMap: true, sourceMap: true,
@ -108,14 +104,14 @@ module.exports = function (grunt) {
expand: true, expand: true,
cwd: 'node_modules/pickadate/lib', cwd: 'node_modules/pickadate/lib',
src: 'picker.js', src: 'picker.js',
dest: '<%= buildDir %>' dest: '<%= buildDir %>',
}, },
annotator: { annotator: {
expand: true, expand: true,
cwd: 'node_modules/annotator/pkg', cwd: 'node_modules/annotator/pkg',
src: 'annotator.min.js', src: 'annotator.min.js',
dest: '<%= buildDir %>/themes/_global/js/' dest: '<%= buildDir %>/themes/_global/js/',
} },
}, },
symlink: { symlink: {
baggyfonts: { baggyfonts: {
@ -123,50 +119,50 @@ module.exports = function (grunt) {
{ {
expand: true, expand: true,
overwrite: true, overwrite: true,
cwd: "<%= appDir %>/lib/icomoon-bower/", cwd: '<%= appDir %>/lib/icomoon-bower/',
src: "fonts", src: 'fonts',
dest: "<%= buildDir %>/themes/baggy/" dest: '<%= buildDir %>/themes/baggy/',
}, },
{ {
expand: true, expand: true,
overwrite: true, overwrite: true,
cwd: "<%= appDir %>/lib/bower-pt-sans/fonts", cwd: '<%= appDir %>/lib/bower-pt-sans/fonts',
src: "*", src: '*',
dest: "<%= buildDir %>/themes/baggy/fonts/" dest: '<%= buildDir %>/themes/baggy/fonts/',
} },
] ],
}, },
materialfonts: { materialfonts: {
files: [ files: [
{ {
expand: true, expand: true,
overwrite: true, overwrite: true,
cwd: "<%= appDir %>/lib/icomoon-bower/", cwd: '<%= appDir %>/lib/icomoon-bower/',
src: "fonts", src: 'fonts',
dest: "<%= buildDir %>/themes/material/" dest: '<%= buildDir %>/themes/material/',
}, },
{ {
expand: true, expand: true,
overwrite: true, overwrite: true,
cwd: "node_modules/materialize-css/", cwd: 'node_modules/materialize-css/',
src: "font", src: 'font',
dest: "<%= buildDir %>/themes/material" dest: '<%= buildDir %>/themes/material',
}, },
{ {
expand: true, expand: true,
overwrite: true, overwrite: true,
cwd: "<%= appDir %>/lib/roboto-fontface/fonts/", cwd: '<%= appDir %>/lib/roboto-fontface/fonts/',
src: "*", src: '*',
dest: "<%= buildDir %>/themes/material/fonts/roboto/" dest: '<%= buildDir %>/themes/material/fonts/roboto/',
}, },
{ {
expand: true, expand: true,
overwrite: true, overwrite: true,
cwd: "<%= appDir %>/lib/material-design-icons/iconfont/", cwd: '<%= appDir %>/lib/material-design-icons/iconfont/',
src: "*", src: '*',
dest: "<%= buildDir %>/themes/material/fonts/" dest: '<%= buildDir %>/themes/material/fonts/',
} },
] ],
}, },
pics: { pics: {
files: [ files: [
@ -175,22 +171,22 @@ module.exports = function (grunt) {
overwrite: true, overwrite: true,
cwd: '<%= appDir %>/themes/_global/', cwd: '<%= appDir %>/themes/_global/',
src: 'img', src: 'img',
dest: '<%= buildDir %>/themes/_global/' dest: '<%= buildDir %>/themes/_global/',
} },
] ],
} },
}, },
clean: { clean: {
css: { css: {
src: [ '<%= buildDir %>/**/*.css' ] src: ['<%= buildDir %>/**/*.css'],
}, },
js: { js: {
src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'] src: ['<%= buildDir %>/**/*.js', '<%= buildDir %>/**/*.map'],
}, },
all: { all: {
src: ['./<%= buildDir %>'] src: ['./<%= buildDir %>'],
} },
} },
}); });
grunt.registerTask( grunt.registerTask(
@ -216,4 +212,4 @@ module.exports = function (grunt) {
'Compiles the stylesheets.', 'Compiles the stylesheets.',
['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss'] ['clean:css', 'concat:cssMaterial', 'concat:cssBaggy', 'postcss']
); );
} };

View file

@ -1,6 +1,6 @@
function supportsLocalStorage() { function supportsLocalStorage() {
try { try {
return 'localStorage' in window && window['localStorage'] !== null; return 'localStorage' in window && window.localStorage !== null;
} catch (e) { } catch (e) {
return false; return false;
} }
@ -8,7 +8,7 @@ function supportsLocalStorage() {
function savePercent(id, percent) { function savePercent(id, percent) {
if (!supportsLocalStorage()) { return false; } if (!supportsLocalStorage()) { return false; }
localStorage["wallabag.article." + id + ".percent"] = percent; localStorage['wallabag.article.' + id + '.percent'] = percent;
return true; return true;
} }
@ -16,7 +16,7 @@ function retrievePercent(id) {
if (!supportsLocalStorage()) { return false; } if (!supportsLocalStorage()) { return false; }
var bheight = $(document).height(); var bheight = $(document).height();
var percent = localStorage["wallabag.article." + id + ".percent"]; var percent = localStorage['wallabag.article.' + id + '.percent'];
var scroll = bheight * percent; var scroll = bheight * percent;
$('html,body').animate({ scrollTop: scroll }, 'fast'); $('html,body').animate({ scrollTop: scroll }, 'fast');

View file

@ -1,6 +1,8 @@
var $ = global.jquery = require('jquery');
$(document).ready(function () { $(document).ready(function () {
current_url = window.location.href var currentUrl = window.location.href;
if (current_url.match("&closewin=true")) { if (currentUrl.match('&closewin=true')) {
window.close(); window.close();
} }
}); });

View file

@ -1,5 +1,6 @@
jQuery(function($) { var $ = global.jquery = require('jquery');
jQuery(function ($) {
function split(val) { function split(val) {
return val.split(/,\s*/); return val.split(/,\s*/);
} }
@ -8,13 +9,13 @@ jQuery(function($) {
} }
$("#value").bind("keydown", function(event) { $('#value').bind('keydown', function (event) {
if (event.keyCode === $.ui.keyCode.TAB && $(this).data("ui-autocomplete").menu.active) { if (event.keyCode === $.ui.keyCode.TAB && $(this).data('ui-autocomplete').menu.active) {
event.preventDefault(); event.preventDefault();
} }
}).autocomplete({ }).autocomplete({
source: function (request, response) { source: function (request, response) {
$.getJSON("./?view=tags", { $.getJSON('./?view=tags', {
term: extractLast(request.term), term: extractLast(request.term),
//id: $(':hidden#entry_id').val() //id: $(':hidden#entry_id').val()
}, response); }, response);
@ -37,11 +38,9 @@ jQuery(function($) {
// add the selected item // add the selected item
terms.push(ui.item.value); terms.push(ui.item.value);
// add placeholder to get the comma-and-space at the end // add placeholder to get the comma-and-space at the end
terms.push(""); terms.push('');
this.value = terms.join(", "); this.value = terms.join(', ');
return false; return false;
} },
}); });
}); });

View file

@ -1,3 +1,5 @@
var $ = global.jquery = require('jquery');
$(function () { $(function () {
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Show the close icon when the user hover over a message // Show the close icon when the user hover over a message

View file

@ -5,16 +5,15 @@ var annotator = require('annotator');
$.fn.ready(function () { $.fn.ready(function () {
var $listmode = $('#listmode');
var $listmode = $('#listmode'), var $listentries = $('#list-entries');
$listentries = $("#list-entries");
/* ========================================================================== /* ==========================================================================
Menu Menu
========================================================================== */ ========================================================================== */
$("#menu").click(function(){ $('#menu').click(function () {
$("#links").toggleClass('menu--open'); $('#links').toggleClass('menu--open');
if ($('#content').hasClass('opacity03')) { if ($('#content').hasClass('opacity03')) {
$('#content').removeClass('opacity03'); $('#content').removeClass('opacity03');
} }
@ -25,33 +24,31 @@ $.fn.ready(function() {
========================================================================== */ ========================================================================== */
$listmode.click(function () { $listmode.click(function () {
if ( jquery.cookie("listmode") == 1 ) { if (jquery.cookie('listmode') === 1) {
// Cookie // Cookie
$.removeCookie("listmode"); $.removeCookie('listmode');
$listentries.removeClass("listmode"); $listentries.removeClass('listmode');
$listmode.removeClass("tablemode"); $listmode.removeClass('tablemode');
$listmode.addClass("listmode"); $listmode.addClass('listmode');
} } else {
else {
// Cookie // Cookie
jquery.cookie("listmode", 1, {expires: 365}); jquery.cookie('listmode', 1, { expires: 365 });
$listentries.addClass("listmode"); $listentries.addClass('listmode');
$listmode.removeClass("listmode"); $listmode.removeClass('listmode');
$listmode.addClass("tablemode"); $listmode.addClass('tablemode');
} }
}); });
/* ========================================================================== /* ==========================================================================
Cookie listmode Cookie listmode
========================================================================== */ ========================================================================== */
if ( jquery.cookie("listmode") == 1 ) { if (jquery.cookie('listmode') === 1) {
$listentries.addClass("listmode"); $listentries.addClass('listmode');
$listmode.removeClass("listmode"); $listmode.removeClass('listmode');
$listmode.addClass("tablemode"); $listmode.addClass('tablemode');
} }
/* ========================================================================== /* ==========================================================================
@ -60,9 +57,9 @@ $.fn.ready(function() {
$('#nav-btn-add-tag').on('click', function () { $('#nav-btn-add-tag').on('click', function () {
$(".nav-panel-add-tag").toggle(100); $('.nav-panel-add-tag').toggle(100);
$(".nav-panel-menu").addClass('hidden'); $('.nav-panel-menu').addClass('hidden');
$("#tag_label").focus(); $('#tag_label').focus();
return false; return false;
}); });
@ -70,11 +67,11 @@ $.fn.ready(function() {
Annotations & Remember position Annotations & Remember position
========================================================================== */ ========================================================================== */
if ($("article").length) { if ($('article').length) {
var app = new annotator.App(); var app = new annotator.App();
app.include(annotator.ui.main, { app.include(annotator.ui.main, {
element: document.querySelector('article') element: document.querySelector('article'),
}); });
var x = JSON.parse($('#annotationroutes').html()); var x = JSON.parse($('#annotationroutes').html());

View file

@ -1,51 +1,52 @@
$(document).ready(function() { var $ = global.jquery = require('jquery');
$("#search-form").hide(); $(document).ready(function () {
$("#bagit-form").hide(); $('#search-form').hide();
$("#filter-form").hide(); $('#bagit-form').hide();
$("#download-form").hide(); $('#filter-form').hide();
$('#download-form').hide();
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Toggle the "Search" popup in the sidebar // Toggle the 'Search' popup in the sidebar
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
function toggleSearch() { function toggleSearch() {
$("#search-form").toggle(); $('#search-form').toggle();
$("#search").toggleClass("current"); $('#search').toggleClass('current');
$("#search").toggleClass("active-current"); $('#search').toggleClass('active-current');
$("#search-arrow").toggleClass("arrow-down"); $('#search-arrow').toggleClass('arrow-down');
if ($("#search").hasClass("current")) { if ($('#search').hasClass('current')) {
$("#content").addClass("opacity03"); $('#content').addClass('opacity03');
} else { } else {
$("#content").removeClass("opacity03"); $('#content').removeClass('opacity03');
} }
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Toggle the "Filter" popup on entries list // Toggle the 'Filter' popup on entries list
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
function toggleFilter() { function toggleFilter() {
$("#filter-form").toggle(); $('#filter-form').toggle();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Toggle the "Download" popup on entries list // Toggle the 'Download' popup on entries list
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
function toggleDownload() { function toggleDownload() {
$("#download-form").toggle(); $('#download-form').toggle();
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Toggle the "Save a Link" popup in the sidebar // Toggle the 'Save a Link' popup in the sidebar
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
function toggleBagit() { function toggleBagit() {
$("#bagit-form").toggle(); $('#bagit-form').toggle();
$("#bagit").toggleClass("current"); $('#bagit').toggleClass('current');
$("#bagit").toggleClass("active-current"); $('#bagit').toggleClass('active-current');
$("#bagit-arrow").toggleClass("arrow-down"); $('#bagit-arrow').toggleClass('arrow-down');
if ($("#bagit").hasClass("current")) { if ($('#bagit').hasClass('current')) {
$("#content").addClass("opacity03"); $('#content').addClass('opacity03');
} else { } else {
$("#content").removeClass("opacity03"); $('#content').removeClass('opacity03');
} }
} }
@ -53,48 +54,48 @@ $(document).ready(function() {
// Close all #links popups in the sidebar // Close all #links popups in the sidebar
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
function closePopups() { function closePopups() {
$("#links .messages").hide(); $('#links .messages').hide();
$("#links > li > a").removeClass("active-current"); $('#links > li > a').removeClass('active-current');
$("#links > li > a").removeClass("current"); $('#links > li > a').removeClass('current');
$("[id$=-arrow]").removeClass("arrow-down"); $('[id$=-arrow]').removeClass('arrow-down');
$("#content").removeClass("opacity03"); $('#content').removeClass('opacity03');
} }
$("#search").click(function(){ $('#search').click(function () {
closePopups(); closePopups();
toggleSearch(); toggleSearch();
$("#searchfield").focus(); $('#searchfield').focus();
}); });
$(".filter-btn").click(function(){ $('.filter-btn').click(function () {
closePopups(); closePopups();
toggleFilter(); toggleFilter();
}); });
$(".download-btn").click(function(){ $('.download-btn').click(function () {
closePopups(); closePopups();
toggleDownload(); toggleDownload();
}); });
$("#bagit").click(function(){ $('#bagit').click(function () {
closePopups(); closePopups();
toggleBagit(); toggleBagit();
$("#plainurl").focus(); $('#plainurl').focus();
}); });
$("#search-form-close").click(function(){ $('#search-form-close').click(function () {
toggleSearch(); toggleSearch();
}); });
$("#filter-form-close").click(function(){ $('#filter-form-close').click(function () {
toggleFilter(); toggleFilter();
}); });
$("#download-form-close").click(function(){ $('#download-form-close').click(function () {
toggleDownload(); toggleDownload();
}); });
$("#bagit-form-close").click(function(){ $('#bagit-form-close').click(function () {
toggleBagit(); toggleBagit();
}); });
}); });

View file

@ -1,60 +1,60 @@
$.fn.ready(function() { var $ = global.jquery = require('jquery');
var $bagit = $('#bagit'), $.fn.ready(function () {
$bagitForm = $('#bagit-form'), var $bagit = $('#bagit');
$bagitFormForm = $('#bagit-form-form'); var $bagitForm = $('#bagit-form');
var $bagitFormForm = $('#bagit-form-form');
/* ========================================================================== /* ==========================================================================
bag it link and close button bag it link and close button
========================================================================== */ ========================================================================== */
function toggleSaveLinkForm(url, event) { 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 // only if bag-it link is not presented on page
if ($bagit.length === 0) { if ($bagit.length === 0) {
if (event !== 'undefined' && event) { if (event !== 'undefined' && event) {
$bagitForm.css( {position:"absolute", top:event.pageY, left:event.pageX-200}); $bagitForm.css({ position: 'absolute', top: event.pageY, left: event.pageX - 200 });
} } else {
else { $bagitForm.css({ position: 'relative', top: 'auto', left: 'auto' });
$bagitForm.css( {position:"relative", top:"auto", left:"auto"});
} }
} }
if ($("#search-form").length != 0) { if ($('#search-form').length !== 0) {
$("#search").removeClass("current"); $('#search').removeClass('current');
$("#search-arrow").removeClass("arrow-down"); $('#search-arrow').removeClass('arrow-down');
$("#search-form").hide(); $('#search-form').hide();
} }
$bagitForm.toggle(); $bagitForm.toggle();
$('#content').toggleClass("opacity03"); $('#content').toggleClass('opacity03');
if (url !== 'undefined' && url) { if (url !== 'undefined' && url) {
$('#plainurl').val(url); $('#plainurl').val(url);
} }
$('#plainurl').focus(); $('#plainurl').focus();
} }
//send "bag it link" form request via ajax // send 'bag it link' form request via ajax
$bagitFormForm.submit(function (event) { $bagitFormForm.submit(function (event) {
$("body").css("cursor", "wait"); $('body').css('cursor', 'wait');
$("#add-link-result").empty(); $('#add-link-result').empty();
$.ajax({ $.ajax({
type: $bagitFormForm.attr('method'), type: $bagitFormForm.attr('method'),
url: $bagitFormForm.attr('action'), url: $bagitFormForm.attr('action'),
data: $bagitFormForm.serialize(), data: $bagitFormForm.serialize(),
success: function (data) { success: function (data) {
$('#add-link-result').html("Done!"); $('#add-link-result').html('Done!');
$('#plainurl').val(''); $('#plainurl').val('');
$('#plainurl').blur(''); $('#plainurl').blur('');
$("body").css("cursor", "auto"); $('body').css('cursor', 'auto');
}, },
error: function (data) { error: function (data) {
$('#add-link-result').html("Failed!"); $('#add-link-result').html('Failed!');
$("body").css("cursor", "auto"); $('body').css('cursor', 'auto');
} },
}); });
event.preventDefault(); event.preventDefault();
@ -64,15 +64,12 @@ $.fn.ready(function() {
Process all links inside an article Process all links inside an article
========================================================================== */ ========================================================================== */
$("article a[href^='http']").after(function() { $('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> "; 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); toggleSaveLinkForm($(this).attr('href'), event);
event.preventDefault(); event.preventDefault();
}); });
}); });

View file

@ -1,10 +1,10 @@
var $ = require("jquery"), var $ = require('jquery');
materialize = require("materialize"); require('materialize');
var annotator = require('annotator'); var annotator = require('annotator');
function init_filters() { function initFilters() {
// no display if filters not aviable // no display if filters not aviable
if ($("div").is("#filters")) { if ($('div').is('#filters')) {
$('#button_filters').show(); $('#button_filters').show();
$('.button-collapse-right').sideNav({ edge: 'right' }); $('.button-collapse-right').sideNav({ edge: 'right' });
$('#clear_form_filters').on('click', function () { $('#clear_form_filters').on('click', function () {
@ -15,9 +15,9 @@ function init_filters() {
} }
} }
function init_export() { function initExport() {
// no display if export not aviable // no display if export not aviable
if ($("div").is("#export")) { if ($('div').is('#export')) {
$('#button_export').show(); $('#button_export').show();
$('.button-collapse-right').sideNav({ edge: 'right' }); $('.button-collapse-right').sideNav({ edge: 'right' });
} }
@ -28,7 +28,7 @@ $(document).ready(function(){
$('.button-collapse').sideNav(); $('.button-collapse').sideNav();
$('select').material_select(); $('select').material_select();
$('.collapsible').collapsible({ $('.collapsible').collapsible({
accordion : false accordion: false,
}); });
$('.datepicker').pickadate({ $('.datepicker').pickadate({
selectMonths: true, selectMonths: true,
@ -37,62 +37,63 @@ $(document).ready(function(){
hiddenName: true, hiddenName: true,
format: 'dd/mm/yyyy', format: 'dd/mm/yyyy',
}); });
init_filters(); initFilters();
init_export(); initExport();
$('#nav-btn-add-tag').on('click', function () { $('#nav-btn-add-tag').on('click', function () {
$(".nav-panel-add-tag").toggle(100); $('.nav-panel-add-tag').toggle(100);
$(".nav-panel-menu").addClass('hidden'); $('.nav-panel-menu').addClass('hidden');
$("#tag_label").focus(); $('#tag_label').focus();
return false; return false;
}); });
$('#nav-btn-add').on('click', function () { $('#nav-btn-add').on('click', function () {
$(".nav-panel-buttom").hide(100); $('.nav-panel-buttom').hide(100);
$(".nav-panel-add").show(100); $('.nav-panel-add').show(100);
$(".nav-panels .action").hide(100); $('.nav-panels .action').hide(100);
$(".nav-panel-menu").addClass('hidden'); $('.nav-panel-menu').addClass('hidden');
$(".nav-panels").css('background', 'white'); $('.nav-panels').css('background', 'white');
$("#entry_url").focus(); $('#entry_url').focus();
return false; return false;
}); });
$('#nav-btn-search').on('click', function () { $('#nav-btn-search').on('click', function () {
$(".nav-panel-buttom").hide(100); $('.nav-panel-buttom').hide(100);
$(".nav-panel-search").show(100); $('.nav-panel-search').show(100);
$(".nav-panels .action").hide(100); $('.nav-panels .action').hide(100);
$(".nav-panel-menu").addClass('hidden'); $('.nav-panel-menu').addClass('hidden');
$(".nav-panels").css('background', 'white'); $('.nav-panels').css('background', 'white');
$("#searchfield").focus(); $('#searchfield').focus();
return false; return false;
}); });
$('.close').on('click', function () { $('.close').on('click', function () {
$(".nav-panel-add").hide(100); $('.nav-panel-add').hide(100);
$(".nav-panel-search").hide(100); $('.nav-panel-search').hide(100);
$(".nav-panel-buttom").show(100); $('.nav-panel-buttom').show(100);
$(".nav-panels .action").show(100); $('.nav-panels .action').show(100);
$(".nav-panel-menu").removeClass('hidden'); $('.nav-panel-menu').removeClass('hidden');
$(".nav-panels").css('background', 'transparent'); $('.nav-panels').css('background', 'transparent');
return false; return false;
}); });
$(window).scroll(function () { $(window).scroll(function () {
var s = $(window).scrollTop(), var s = $(window).scrollTop();
d = $(document).height(), var d = $(document).height();
c = $(window).height(); var c = $(window).height();
var scrollPercent = (s / (d - c)) * 100; var scrollPercent = (s / (d - c)) * 100;
$(".progress .determinate").css('width', scrollPercent+'%'); $('.progress .determinate').css('width', scrollPercent + '%');
}); });
/* ========================================================================== /* ==========================================================================
Annotations & Remember position Annotations & Remember position
========================================================================== */ ========================================================================== */
if ($("article").length) { if ($('article').length) {
var app = new annotator.App(); var app = new annotator.App();
var x = JSON.parse($('#annotationroutes').html());
app.include(annotator.ui.main, { app.include(annotator.ui.main, {
element: document.querySelector('article') 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.start().then(function () {

View file

@ -1,6 +1,6 @@
{ {
"name": "wallabag", "name": "wallabag",
"version": "2.0.0", "version": "2.1.0",
"description": "wallabag is a self hostable application for saving web pages", "description": "wallabag is a self hostable application for saving web pages",
"main": "index.js", "main": "index.js",
"private": true, "private": true,
@ -20,11 +20,9 @@
"grunt-contrib-clean": "^1.0.0", "grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.0", "grunt-contrib-concat": "^1.0.0",
"grunt-contrib-copy": "^1.0.0", "grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "^1.0.0",
"grunt-contrib-symlink": "^1.0.0", "grunt-contrib-symlink": "^1.0.0",
"grunt-contrib-uglify": "^1.0.0", "grunt-contrib-uglify": "^1.0.0",
"grunt-postcss": "^0.8.0", "grunt-postcss": "^0.8.0",
"grunt-shell": "^1.2.1",
"hammerjs": "^2.0.6", "hammerjs": "^2.0.6",
"jquery": "^2.2.1", "jquery": "^2.2.1",
"jquery-ui": "^1.10.5", "jquery-ui": "^1.10.5",
@ -80,5 +78,9 @@
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://github.com/wallabag/wallabag/issues" "url": "https://github.com/wallabag/wallabag/issues"
},
"devDependencies": {
"eslint": "^2.11.1",
"eslint-config-airbnb": "^9.0.1",
} }
} }