Fix some issues from ESLint
This commit is contained in:
parent
99972b5f7b
commit
0687448d0a
5 changed files with 37 additions and 30 deletions
|
@ -19,6 +19,7 @@ globals:
|
||||||
it: false
|
it: false
|
||||||
jsc: false
|
jsc: false
|
||||||
jsdom: true
|
jsdom: true
|
||||||
|
kjua: true
|
||||||
|
|
||||||
# http://eslint.org/docs/rules/
|
# http://eslint.org/docs/rules/
|
||||||
rules:
|
rules:
|
||||||
|
|
39
.jshintrc
39
.jshintrc
|
@ -16,26 +16,31 @@
|
||||||
"nonew": true,
|
"nonew": true,
|
||||||
"quotmark": "single",
|
"quotmark": "single",
|
||||||
"singleGroups": true,
|
"singleGroups": true,
|
||||||
"strict": "global",
|
"strict": true,
|
||||||
"undef": true,
|
"undef": true,
|
||||||
"unused": true,
|
"unused": true,
|
||||||
"jquery": true,
|
"jquery": true,
|
||||||
|
"browser": true,
|
||||||
"predef": {
|
"predef": {
|
||||||
"after": true,
|
"after": true,
|
||||||
"before": true,
|
"before": true,
|
||||||
"cleanup": true,
|
"cleanup": true,
|
||||||
"console": true,
|
"console": true,
|
||||||
"describe": false,
|
"describe": false,
|
||||||
"document": true,
|
"document": true,
|
||||||
"fs": false,
|
"fs": false,
|
||||||
"global": true,
|
"global": true,
|
||||||
"exports": true,
|
"exports": true,
|
||||||
"it": false,
|
"it": false,
|
||||||
"jsc": false,
|
"jsc": false,
|
||||||
"jsdom": true,
|
"jsdom": true,
|
||||||
"require": false,
|
"require": false,
|
||||||
"setTimeout": false,
|
"setTimeout": false,
|
||||||
"window": true
|
"window": true
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"sjcl": true,
|
||||||
|
"DOMPurify": true,
|
||||||
|
"kjua": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ sjcl.random.startCollectors();
|
||||||
|
|
||||||
// main application start, called when DOM is fully loaded
|
// main application start, called when DOM is fully loaded
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
|
'use strict';
|
||||||
// run main controller
|
// run main controller
|
||||||
$.PrivateBin.Controller.init();
|
$.PrivateBin.Controller.init();
|
||||||
});
|
});
|
||||||
|
@ -331,7 +332,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||||
var usesPlurals = $.isArray(args[0]);
|
var usesPlurals = $.isArray(args[0]);
|
||||||
if (usesPlurals) {
|
if (usesPlurals) {
|
||||||
// use the first plural form as messageId, otherwise the singular
|
// use the first plural form as messageId, otherwise the singular
|
||||||
messageId = (args[0].length > 1 ? args[0][1] : args[0][0]);
|
messageId = args[0].length > 1 ? args[0][1] : args[0][0];
|
||||||
} else {
|
} else {
|
||||||
messageId = args[0];
|
messageId = args[0];
|
||||||
}
|
}
|
||||||
|
@ -415,16 +416,16 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||||
case 'fr':
|
case 'fr':
|
||||||
case 'oc':
|
case 'oc':
|
||||||
case 'zh':
|
case 'zh':
|
||||||
return (n > 1 ? 1 : 0);
|
return n > 1 ? 1 : 0;
|
||||||
case 'pl':
|
case 'pl':
|
||||||
return (n === 1 ? 0 : (n % 10 >= 2 && n %10 <=4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2));
|
return n === 1 ? 0 : (n % 10 >= 2 && n %10 <=4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
||||||
case 'ru':
|
case 'ru':
|
||||||
return (n % 10 === 1 && n % 100 !== 11 ? 0 : (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2));
|
return n % 10 === 1 && n % 100 !== 11 ? 0 : (n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2);
|
||||||
case 'sl':
|
case 'sl':
|
||||||
return (n % 100 === 1 ? 1 : (n % 100 === 2 ? 2 : (n % 100 === 3 || n % 100 === 4 ? 3 : 0)));
|
return n % 100 === 1 ? 1 : (n % 100 === 2 ? 2 : (n % 100 === 3 || n % 100 === 4 ? 3 : 0));
|
||||||
// de, en, es, it, no, pt
|
// de, en, es, it, no, pt
|
||||||
default:
|
default:
|
||||||
return (n !== 1 ? 1 : 0);
|
return n !== 1 ? 1 : 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -660,7 +661,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||||
*/
|
*/
|
||||||
me.hasCipherData = function()
|
me.hasCipherData = function()
|
||||||
{
|
{
|
||||||
return (me.getCipherData().length > 0);
|
return me.getCipherData().length > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -831,7 +832,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||||
var viewportTop = $(window).scrollTop();
|
var viewportTop = $(window).scrollTop();
|
||||||
var viewportBottom = viewportTop + $(window).height();
|
var viewportBottom = viewportTop + $(window).height();
|
||||||
|
|
||||||
return (elementTop > viewportTop && elementTop < viewportBottom);
|
return elementTop > viewportTop && elementTop < viewportBottom;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1194,8 +1195,8 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||||
*/
|
*/
|
||||||
function sendToShortener()
|
function sendToShortener()
|
||||||
{
|
{
|
||||||
window.location.href = $shortenButton.data('shortener')
|
window.location.href = $shortenButton.data('shortener') +
|
||||||
+ encodeURIComponent($pasteUrl.attr('href'));
|
encodeURIComponent($pasteUrl.attr('href'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2008,7 +2009,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||||
me.hasAttachment = function()
|
me.hasAttachment = function()
|
||||||
{
|
{
|
||||||
var link = $attachmentLink.prop('href');
|
var link = $attachmentLink.prop('href');
|
||||||
return (typeof link !== 'undefined' && link !== '');
|
return typeof link !== 'undefined' && link !== '';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -75,7 +75,7 @@ if ($MARKDOWN):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-kln7CKhJse+R3qsKw01qJ5nLISVhC/S4T/RRetZbNW3uhheH49NBd8NamOaYcXGQ+CRU8OoN1iD7JLX88Jt0Sg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-9HcFkJcGWfvpGHD7tTGYzBtx4TbVfR9z7oujlX2WZ2dYWVv/2QIW5eMSjpvfxUVTJVF+DHD7Ps/80qR8GcQsIg==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
|
@ -54,7 +54,7 @@ if ($QRCODE):
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-kln7CKhJse+R3qsKw01qJ5nLISVhC/S4T/RRetZbNW3uhheH49NBd8NamOaYcXGQ+CRU8OoN1iD7JLX88Jt0Sg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-9HcFkJcGWfvpGHD7tTGYzBtx4TbVfR9z7oujlX2WZ2dYWVv/2QIW5eMSjpvfxUVTJVF+DHD7Ps/80qR8GcQsIg==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
Loading…
Reference in a new issue