re-applying sprintf simplification and rephrased jsdoc block
This commit is contained in:
parent
29efc14aa7
commit
2d11d7b29e
3 changed files with 15 additions and 18 deletions
|
@ -322,19 +322,12 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
let format = args[0],
|
let format = args[0],
|
||||||
i = 1;
|
i = 1;
|
||||||
return format.replace(/%(s|d)/g, function (m) {
|
return format.replace(/%(s|d)/g, function (m) {
|
||||||
// m is the matched format, e.g. %s, %d
|
|
||||||
let val = args[i];
|
let val = args[i];
|
||||||
// A switch statement so that the formatter can be extended.
|
if (m === '%d') {
|
||||||
switch (m)
|
val = parseFloat(val);
|
||||||
{
|
if (isNaN(val)) {
|
||||||
case '%d':
|
val = 0;
|
||||||
val = parseFloat(val);
|
}
|
||||||
if (isNaN(val)) {
|
|
||||||
val = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Default is %s
|
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
return val;
|
return val;
|
||||||
|
@ -549,10 +542,14 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
*
|
*
|
||||||
* Optionally pass a jQuery element as the first parameter, to automatically
|
* Optionally pass a jQuery element as the first parameter, to automatically
|
||||||
* let the text of this element be replaced. In case the (asynchronously
|
* let the text of this element be replaced. In case the (asynchronously
|
||||||
* loaded) language is not downloadet yet, this will make sure the string
|
* loaded) language is not downloaded yet, this will make sure the string
|
||||||
* is replaced when it is actually loaded.
|
* is replaced when it eventually gets loaded. Using this is both simpler
|
||||||
* So for easy translations passing the jQuery object to apply it to is
|
* and more secure, as it avoids potential XSS when inserting text.
|
||||||
* more save, especially when they are loaded in the beginning.
|
* The next parameter is the message ID, matching the ones found in
|
||||||
|
* the translation files under the i18n directory.
|
||||||
|
* Any additional parameters will get inserted into the message ID in
|
||||||
|
* place of %s (strings) or %d (digits), applying the appropriate plural
|
||||||
|
* in case of digits. See also Helper.sprintf().
|
||||||
*
|
*
|
||||||
* @name I18n.translate
|
* @name I18n.translate
|
||||||
* @function
|
* @function
|
||||||
|
|
|
@ -72,7 +72,7 @@ endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.7.js" integrity="sha512-XjNEK1xwh7SJ/7FouwV4VZcGW9cMySL3SwNpXgrURLBcXXQYtZdqhGoNdEwx9vwLvFjUGDQVNgpOrTsXlSTiQg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.7.js" integrity="sha512-XjNEK1xwh7SJ/7FouwV4VZcGW9cMySL3SwNpXgrURLBcXXQYtZdqhGoNdEwx9vwLvFjUGDQVNgpOrTsXlSTiQg==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-U9Au7V0FSY8S1xI6MrhPawEOFAPFejMI8PYlQNhC++XIQCQgQhYEqTYkhczN6F2MFAq/P1Hwn9A3IWaq9hu95g==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-H1yl7DMaZcsr+Lz774u1sD6HanAPJ/jqYaAIUz1HVDwgSpAFfi68Yifrain6gd9Dz0BoxNf9OavTas0RNRIIPA==" crossorigin="anonymous"></script>
|
||||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
|
<link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
|
||||||
|
|
|
@ -50,7 +50,7 @@ endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.7.js" integrity="sha512-XjNEK1xwh7SJ/7FouwV4VZcGW9cMySL3SwNpXgrURLBcXXQYtZdqhGoNdEwx9vwLvFjUGDQVNgpOrTsXlSTiQg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-2.0.7.js" integrity="sha512-XjNEK1xwh7SJ/7FouwV4VZcGW9cMySL3SwNpXgrURLBcXXQYtZdqhGoNdEwx9vwLvFjUGDQVNgpOrTsXlSTiQg==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-U9Au7V0FSY8S1xI6MrhPawEOFAPFejMI8PYlQNhC++XIQCQgQhYEqTYkhczN6F2MFAq/P1Hwn9A3IWaq9hu95g==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-H1yl7DMaZcsr+Lz774u1sD6HanAPJ/jqYaAIUz1HVDwgSpAFfi68Yifrain6gd9Dz0BoxNf9OavTas0RNRIIPA==" crossorigin="anonymous"></script>
|
||||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||||
<link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
|
<link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
|
||||||
|
|
Loading…
Reference in a new issue