Skip to content

Commit

Permalink
Merge pull request #1131 from OpenGeoscience/update-pako
Browse files Browse the repository at this point in the history
build: update pako library.
  • Loading branch information
manthey authored Dec 22, 2021
2 parents ebbd70f + 54ba4c9 commit a39b280
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
17 changes: 12 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^3.0.5",
"nib": "^1.1.2",
"pako": "^1.0.11",
"pako": "^2.0.4",
"phantomjs-prebuilt": "^2.1.5",
"pug": "^3.0.2",
"pug-lint": "^2.6.0",
Expand Down Expand Up @@ -147,8 +147,8 @@
"test-headed-xvfb": "GEOJS_TEST_CASE=tests/test-headed.js xvfb-run -s '-ac -screen 0 1280x1024x24' karma start karma-cov.conf.js --single-run --browsers ChromeFull",
"test-webglheadless": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
"test-webglheadless-all": "GEOJS_TEST_CASE=tests/test-gl.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
"test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,PhantomJS",
"test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch,PhantomJS",
"test-tutorials": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch",
"test-tutorialsci-all": "GEOJS_TEST_CASE=tests/tutorials.js karma start karma-cov.conf.js --single-run --browsers ChromeHeadlessTouch,FirefoxHeadlessTouch",
"get-data-files": "node scripts/datastore.js dist/data",
"ci-clean": "git clean -fxd dist -e dist/data jsdoc/tmpl jsdoc/static images lcov",
"ci": "npm run ci-build && npm run ci-test",
Expand Down
5 changes: 3 additions & 2 deletions tutorials/common/tutorials.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function fill_codeblocks(query) {
/* Strip out white space and pluses, then convert ., -, and _ to /, +,
* =. By removing whitespace, the url is more robust against email
* handling. The others keep things short. */
var src = atob(query[key].replace(/(\s|\+)/g, '').replace(/\./g, '/').replace(/-/g, '+').replace(/_/g, '='));
let src = query[key].replace(/(\s|\+)/g, '').replace(/\./g, '/').replace(/-/g, '+').replace(/_/g, '=');
src = pako.inflate(src, {to: 'string', raw: true});
if ($('.CodeMirror', block).length) {
$('.CodeMirror', block)[0].CodeMirror.setValue(src);
Expand Down Expand Up @@ -287,7 +287,8 @@ function start_keeper(alwaysKeep) {
var src = $('.CodeMirror', block).length ? $('.CodeMirror', block)[0].CodeMirror.getValue() : $('textarea', block).val();
src = src.trim().replace(/ [ ]*\n/g, '\n');
if (src !== defaultSrc) {
var comp = btoa(pako.deflate(src, {to: 'string', level: 9, raw: true}));
let comp = pako.deflate(src, {to: 'string', level: 9, raw: true});
comp = btoa(String.fromCharCode.apply(null, comp));
/* instead of using regular base64, convert /, +, and = to ., -, and _
* so that they don't need to be escaped on the url. This reduces the
* average length of the url by 6 percent. */
Expand Down

0 comments on commit a39b280

Please sign in to comment.