Commit Graph

21 Commits

Author SHA1 Message Date
Jonas Jenwald
5f5db4b160 Run the PDF.js-viewer API unit-test in Node.js environments (PR 16592 follow-up)
It occurred to me that we can actually run this unit-test in Node.js environments by making use of the preprocessor to stub out the browser globals there.
2023-06-26 09:37:34 +02:00
Jonas Jenwald
4902ad8923 Use modern DOM methods a bit more (PR 15031 follow-up)
Apparently the ESLint rule added in PR 15031 wasn't able to catch all cases that can be converted, which is probably not all that surprising given how some of these call-sites look.

 - Use `Element.prepend()` to insert nodes before all other ones in the element, rather than using `firstChild` with `insertBefore`-calls; see https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend

 - Fix one *incorrect* `insertBefore` call, in the AnnotationLayer-code.
   Initially the patch simply changed that to an `Element.before()`-call, however that broke one of the integration-tests. It turns out that the `index` may try to access a non-existent select-child, which triggers undefined behaviour; note the warning in https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore#parameters
2022-06-13 10:47:37 +02:00
Jonas Jenwald
6d1595b669 Stop dispatching a "localized" event from the webL10n library, since it's unused and may clash with the default viewer
Currently this leads to confusing behaviour with `eventBusDispatchToDOM = true` set, since then there's *two* different "localized" events being fired.
2019-09-13 12:38:36 +02:00
Jonas Jenwald
842e9206c0 Replace String.prototype.substr() occurrences with String.prototype.substring()
As outlined in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr, which refers to the ECMA-262 specification, using the `substr` function is advised against.

Hence this PR, which replaces all remaining `substr` occurrences with `substring` instead. Please refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr#Syntax respectively https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substring#Syntax for the differences between the two functions.

Note that in most cases in the code-base there's only one argument passed to `substr`, and those require no other changes except replacing "substr" with "substring". For the other cases, the `substr(start, length)` calls are changed to `substring(start, start + length)` instead.
2018-09-28 11:41:07 +02:00
Wojciech Maj
ea2850e9a7 Fix typos 2018-04-01 23:20:41 +02:00
Yury Delendik
5438ce9b98 Wraps mozL10n to async calls; splits firefox and generic l10n libs. 2017-05-31 09:22:25 -05:00
Yury Delendik
a4402c84de Refactor toolbar (and secondary toolbar). 2016-11-18 12:51:15 -06:00
Tim van der Meij
0ab5bb4b42 Fixes minor typo from #5826 2015-03-11 21:09:03 +01:00
Rob Wu
537216b872 [webL10n] Apply PDF.js-specific changes 2015-03-10 16:13:25 +01:00
Rob Wu
f20c5ddf99 Update to latest version of webL10n
New commits since last update:
- b5e072c...7d351d51b1
- Plus unmerged patch from PDF.js: https://github.com/fabi1cazenave/webL10n/pull/62

(the PDF.js-specific changes will be applied in a separate commit)
2015-03-10 16:11:59 +01:00
Rob Wu
ac5a8bcdda [l10n] Treat language as case-insensitive
See "Case-insensitive language comparisons per RFC 4646"
https://github.com/fabi1cazenave/webL10n/pull/51

Removed the "patch" in compatibility.js and fixed the bug in webL10n,
because the logic belongs to webL10n instead of PDF.js.
The immediate motivation for this patch is that Chrome 40 converts
navigator.language to lower case: https://crbug.com/454331
2015-02-02 22:02:18 +01:00
araghava
e2c001c19d [issue 5440] fix rtl direction bug for full language codes 2014-10-26 17:16:56 -04:00
Mitar
2c82e720b8 Updated to current latest stable version of jshint. 2014-03-01 13:31:25 -08:00
Rob Wu
9f4745fd3f webL10n: Apply PDF.js-specific changes
Based on http://pastebin.mozilla.org/3061694

1. Remove "debug helpers" and use console.log/console.warn directly (top).
2. Remove page load initialization (middle).
3. Remove window._ alias (bottom)

The original diff contained an extra entry
"Adds fallback argument to the getL10nData;",
but this was already implemented in the rebased webL10n, so it's no
longer PDF.js-specific.
2013-09-15 15:31:37 +02:00
Rob Wu
d0d3b071ec Update webL10n to latest version + features
Base version of l10n:
- https://github.com/fabi1cazenave/webL10n/tree/b18c753c6f
4 extra commits (expected to be accepted):
- https://github.com/fabi1cazenave/webL10n/pull/38

New features compared to mozL10n:
- Support for getting translated attributes in get()

The previous version of mozL10n was based on:
- https://github.com/fabi1cazenave/webL10n/commits/0c06867a75
- diff: http://pastebin.mozilla.org/3061694

To make it easier to update webL10n in the future, I will apply
the PDF.js-specific changes in a separate commit.
2013-09-15 15:13:47 +02:00
Yury Delendik
e5247e4895 Updates webL10n; using viewer.properties as is 2012-11-29 14:02:33 -06:00
Yury Delendik
89156cec89 Fallback locale string for JS code; simplify locale embedding for the extension 2012-05-04 08:37:08 -05:00
Yury Delendik
7f98f77354 Allow fallback on langauge group; change localized text 2012-05-02 15:03:06 -05:00
Yury Delendik
32e9eb35fe Using web browsers locale in the extension mode 2012-05-01 20:37:03 -05:00
Yury Delendik
00543a1c89 Embed locale.properties in the viewer.html for extension 2012-04-30 21:55:21 -05:00
Yury Delendik
7859ba89c3 Missing webL10n library files 2012-04-30 15:33:37 -05:00