- Imagelib backward compatibility enhancement: Allow string based API
again so as not to break old SVG-Edit which fail at *presence* of `namespace` (fixes #274) - Known regression: Remove Openclipart as its site's now setting of `X-Frame-Options` to `"sameorigin"` makes it unusable on our end for our cross-origin uses - Forward compatibility enhancement: For IAN image library, add `svgedit=3` param to URL so that it can keep using old API for SVG-Edit versions before 3, while conditionally using new object-based API now (and if we switch exclusively to the object-based API in the future, this site will continue to work) - Docs: Add "Forward compatibility enhancement" to listmaster
parent
83aa156353
commit
0034447d44
16
CHANGES.md
16
CHANGES.md
|
@ -13,8 +13,9 @@
|
||||||
source without XSS risk (though params should already be XML-safe
|
source without XSS risk (though params should already be XML-safe
|
||||||
given `encodeURIComponent` and lack of a single quote attribute
|
given `encodeURIComponent` and lack of a single quote attribute
|
||||||
context)
|
context)
|
||||||
- Known regression for 3.\*: Image libraries
|
- Known regression: Remove Openclipart as its site's now setting of
|
||||||
[broken](https://github.com/SVG-Edit/svgedit/issues/274)
|
`X-Frame-Options` to `"sameorigin"` makes it unusable on our end
|
||||||
|
for our cross-origin uses
|
||||||
- Breaking change (minor): Change export to check `exportWindowName`
|
- Breaking change (minor): Change export to check `exportWindowName`
|
||||||
for filename and change default from `download` to `svg.pdf` to
|
for filename and change default from `download` to `svg.pdf` to
|
||||||
distinguish from other downloads
|
distinguish from other downloads
|
||||||
|
@ -34,9 +35,14 @@
|
||||||
- Forward compatibility enhancement: Once IE9 support may be dropped,
|
- Forward compatibility enhancement: Once IE9 support may be dropped,
|
||||||
we may post messages as objects, so don't break if objects received
|
we may post messages as objects, so don't break if objects received
|
||||||
(embedded API, xdomain, Imagelib)
|
(embedded API, xdomain, Imagelib)
|
||||||
- Imagelib backward compatibility enhancement: Allow `namespace-key` as
|
- Forward compatibility enhancement: For IAN image library, add
|
||||||
alternative to `namespace` so as not to break old SVG-Edit which fail
|
`svgedit=3` param to URL so that it can keep using old API for
|
||||||
at *presence* of `namespace` (fixes #274)
|
SVG-Edit versions before 3, while conditionally using new object-based
|
||||||
|
API now (and if we switch exclusively to the object-based API in the
|
||||||
|
future, this site will continue to work)
|
||||||
|
- Imagelib backward compatibility enhancement: Allow string based API
|
||||||
|
again so as not to break old SVG-Edit which fail at *presence* of
|
||||||
|
`namespace` (fixes #274)
|
||||||
- Refactoring: Avoid passing unused arguments, setting unused variables,
|
- Refactoring: Avoid passing unused arguments, setting unused variables,
|
||||||
and making unnecessary checks; avoid useless call to `createSVGMatrix`
|
and making unnecessary checks; avoid useless call to `createSVGMatrix`
|
||||||
- Refactoring: Avoid useless assignment (courtesty lgtm)
|
- Refactoring: Avoid useless assignment (courtesty lgtm)
|
||||||
|
|
|
@ -120,9 +120,7 @@ var svgEditorExtension_imagelib = (function () {
|
||||||
description = _ref6.description;
|
description = _ref6.description;
|
||||||
|
|
||||||
$('<li>').appendTo(libOpts).text(name).on('click touchend', function () {
|
$('<li>').appendTo(libOpts).text(name).on('click touchend', function () {
|
||||||
frame.attr('src',
|
frame.attr('src', url).show();
|
||||||
// Todo: Adopt some standard formatting library like `fluent.js` instead
|
|
||||||
url).show();
|
|
||||||
header.text(name);
|
header.text(name);
|
||||||
libOpts.hide();
|
libOpts.hide();
|
||||||
back.show();
|
back.show();
|
||||||
|
@ -208,6 +206,7 @@ var svgEditorExtension_imagelib = (function () {
|
||||||
url = _ref3.url,
|
url = _ref3.url,
|
||||||
description = _ref3.description;
|
description = _ref3.description;
|
||||||
|
|
||||||
|
// Todo: Adopt some standard formatting library like `fluent.js` instead
|
||||||
url = url.replace(/\{path\}/g, extIconsPath).replace(/\{modularVersion\}/g, modularVersion ? imagelibStrings.moduleEnding || '-es' : '');
|
url = url.replace(/\{path\}/g, extIconsPath).replace(/\{modularVersion\}/g, modularVersion ? imagelibStrings.moduleEnding || '-es' : '');
|
||||||
return { name: name, url: url, description: description };
|
return { name: name, url: url, description: description };
|
||||||
});
|
});
|
||||||
|
@ -236,48 +235,60 @@ var svgEditorExtension_imagelib = (function () {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var id = void 0;
|
||||||
|
var type = void 0;
|
||||||
try {
|
try {
|
||||||
// Todo: This block can be removed (and the above check changed to
|
// Todo: This block can be removed (and the above check changed to
|
||||||
// insist on an object) if embedAPI moves away from a string to
|
// insist on an object) if embedAPI moves away from a string to
|
||||||
// an object (if IE9 support not needed)
|
// an object (if IE9 support not needed)
|
||||||
response = (typeof response === 'undefined' ? 'undefined' : _typeof(response)) === 'object' ? response : JSON.parse(response);
|
response = (typeof response === 'undefined' ? 'undefined' : _typeof(response)) === 'object' ? response : JSON.parse(response);
|
||||||
if (response.namespace !== 'imagelib' &&
|
if (response.namespace !== 'imagelib') {
|
||||||
// Allow this alternative per https://github.com/SVG-Edit/svgedit/issues/274
|
|
||||||
// so that older libraries may post with `namespace-key` and not
|
|
||||||
// break older SVG-Edit versions which insisted on the *absence*
|
|
||||||
// of a `namespace` property
|
|
||||||
response['namespace-key'] !== 'imagelib') {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) {
|
if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) {
|
||||||
console.log('Origin ' + origin + ' not whitelisted for posting to ' + window.origin);
|
console.log('Origin ' + origin + ' not whitelisted for posting to ' + window.origin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var hasName = 'name' in response;
|
||||||
|
var hasHref = 'href' in response;
|
||||||
|
|
||||||
|
if (!hasName && transferStopped) {
|
||||||
|
transferStopped = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasHref) {
|
||||||
|
id = response.href;
|
||||||
|
response = response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide possible transfer dialog box
|
||||||
|
$('#dialog_box').hide();
|
||||||
|
type = hasName ? 'meta' : response.charAt(0);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// This block is for backward compatibility (for IAN and Openclipart)
|
||||||
|
if (typeof response === 'string') {
|
||||||
|
var char1 = response.charAt(0);
|
||||||
|
|
||||||
|
if (char1 !== '{' && transferStopped) {
|
||||||
|
transferStopped = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (char1 === '|') {
|
||||||
|
var secondpos = response.indexOf('|', 1);
|
||||||
|
id = response.substr(1, secondpos - 1);
|
||||||
|
response = response.substr(secondpos + 1);
|
||||||
|
type = response.charAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasName = 'name' in response;
|
|
||||||
var hasHref = 'href' in response;
|
|
||||||
|
|
||||||
if (!hasName && transferStopped) {
|
|
||||||
transferStopped = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var id = void 0;
|
|
||||||
if (hasHref) {
|
|
||||||
id = response.href;
|
|
||||||
response = response.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide possible transfer dialog box
|
|
||||||
$('#dialog_box').hide();
|
|
||||||
var entry = void 0,
|
var entry = void 0,
|
||||||
curMeta = void 0,
|
curMeta = void 0,
|
||||||
svgStr = void 0,
|
svgStr = void 0,
|
||||||
imgStr = void 0;
|
imgStr = void 0;
|
||||||
var type = hasName ? 'meta' : response.charAt(0);
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'meta':
|
case 'meta':
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_de = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,18 @@ var svgEditorExtensionLocale_imagelib_en = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/* ,
|
||||||
name: 'Openclipart',
|
// Disabling until X-Frame-Options may be removed again (or allow cross-origin):
|
||||||
url: 'https://openclipart.org/svgedit',
|
// Getting messages like this in console:
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
// Refused to display 'https://openclipart.org/detail/307176/sign-bike' in a frame
|
||||||
|
// because it set 'X-Frame-Options' to 'sameorigin'.
|
||||||
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
} */
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_fr = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_pl = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_pt_BR = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_ro = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_sk = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_sl = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,17 @@ var svgEditorExtensionLocale_imagelib_zh_CN = (function () {
|
||||||
description: 'Demonstration library for SVG-edit on this server'
|
description: 'Demonstration library for SVG-edit on this server'
|
||||||
}, {
|
}, {
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
}, {
|
/*
|
||||||
name: 'Openclipart',
|
// See message in "en" locale as to why disabling
|
||||||
url: 'https://openclipart.org/svgedit',
|
,
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
{
|
||||||
|
name: 'Openclipart',
|
||||||
|
url: 'https://openclipart.org/svgedit',
|
||||||
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
|
}
|
||||||
|
*/
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
- `Breaking change: `
|
- `Breaking change: `
|
||||||
- `Fix: `
|
- `Fix: `
|
||||||
- `Fix (<component>): ` Component may be an extension, locale, etc.
|
- `Fix (<component>): ` Component may be an extension, locale, etc.
|
||||||
|
- `Forward compatibility enhancement: `
|
||||||
- `Enhancement: `
|
- `Enhancement: `
|
||||||
- `Refactoring: `
|
- `Refactoring: `
|
||||||
- `Linting (<type>):` - Linting by type, e.g., "ESLint"
|
- `Linting (<type>):` - Linting by type, e.g., "ESLint"
|
||||||
|
|
|
@ -22,6 +22,7 @@ export default {
|
||||||
const {uiStrings, canvas: svgCanvas, curConfig: {extIconsPath}} = svgEditor;
|
const {uiStrings, canvas: svgCanvas, curConfig: {extIconsPath}} = svgEditor;
|
||||||
|
|
||||||
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(({name, url, description}) => {
|
imagelibStrings.imgLibs = imagelibStrings.imgLibs.map(({name, url, description}) => {
|
||||||
|
// Todo: Adopt some standard formatting library like `fluent.js` instead
|
||||||
url = url
|
url = url
|
||||||
.replace(/\{path\}/g, extIconsPath)
|
.replace(/\{path\}/g, extIconsPath)
|
||||||
.replace(/\{modularVersion\}/g, modularVersion
|
.replace(/\{modularVersion\}/g, modularVersion
|
||||||
|
@ -72,48 +73,59 @@ export default {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let id;
|
||||||
|
let type;
|
||||||
try {
|
try {
|
||||||
// Todo: This block can be removed (and the above check changed to
|
// Todo: This block can be removed (and the above check changed to
|
||||||
// insist on an object) if embedAPI moves away from a string to
|
// insist on an object) if embedAPI moves away from a string to
|
||||||
// an object (if IE9 support not needed)
|
// an object (if IE9 support not needed)
|
||||||
response = typeof response === 'object' ? response : JSON.parse(response);
|
response = typeof response === 'object' ? response : JSON.parse(response);
|
||||||
if (response.namespace !== 'imagelib' &&
|
if (response.namespace !== 'imagelib') {
|
||||||
// Allow this alternative per https://github.com/SVG-Edit/svgedit/issues/274
|
|
||||||
// so that older libraries may post with `namespace-key` and not
|
|
||||||
// break older SVG-Edit versions which insisted on the *absence*
|
|
||||||
// of a `namespace` property
|
|
||||||
response['namespace-key'] !== 'imagelib'
|
|
||||||
) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) {
|
if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) {
|
||||||
console.log(`Origin ${origin} not whitelisted for posting to ${window.origin}`);
|
console.log(`Origin ${origin} not whitelisted for posting to ${window.origin}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const hasName = 'name' in response;
|
||||||
|
const hasHref = 'href' in response;
|
||||||
|
|
||||||
|
if (!hasName && transferStopped) {
|
||||||
|
transferStopped = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasHref) {
|
||||||
|
id = response.href;
|
||||||
|
response = response.data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide possible transfer dialog box
|
||||||
|
$('#dialog_box').hide();
|
||||||
|
type = hasName
|
||||||
|
? 'meta'
|
||||||
|
: response.charAt(0);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// This block is for backward compatibility (for IAN and Openclipart)
|
||||||
|
if (typeof response === 'string') {
|
||||||
|
const char1 = response.charAt(0);
|
||||||
|
|
||||||
|
if (char1 !== '{' && transferStopped) {
|
||||||
|
transferStopped = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (char1 === '|') {
|
||||||
|
const secondpos = response.indexOf('|', 1);
|
||||||
|
id = response.substr(1, secondpos - 1);
|
||||||
|
response = response.substr(secondpos + 1);
|
||||||
|
type = response.charAt(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasName = 'name' in response;
|
|
||||||
const hasHref = 'href' in response;
|
|
||||||
|
|
||||||
if (!hasName && transferStopped) {
|
|
||||||
transferStopped = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let id;
|
|
||||||
if (hasHref) {
|
|
||||||
id = response.href;
|
|
||||||
response = response.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide possible transfer dialog box
|
|
||||||
$('#dialog_box').hide();
|
|
||||||
let entry, curMeta, svgStr, imgStr;
|
let entry, curMeta, svgStr, imgStr;
|
||||||
const type = hasName
|
|
||||||
? 'meta'
|
|
||||||
: response.charAt(0);
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'meta': {
|
case 'meta': {
|
||||||
// Metadata
|
// Metadata
|
||||||
|
@ -379,7 +391,6 @@ export default {
|
||||||
.on('click touchend', function () {
|
.on('click touchend', function () {
|
||||||
frame.attr(
|
frame.attr(
|
||||||
'src',
|
'src',
|
||||||
// Todo: Adopt some standard formatting library like `fluent.js` instead
|
|
||||||
url
|
url
|
||||||
).show();
|
).show();
|
||||||
header.text(name);
|
header.text(name);
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,18 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/* ,
|
||||||
|
// Disabling until X-Frame-Options may be removed again (or allow cross-origin):
|
||||||
|
// Getting messages like this in console:
|
||||||
|
// Refused to display 'https://openclipart.org/detail/307176/sign-bike' in a frame
|
||||||
|
// because it set 'X-Frame-Options' to 'sameorigin'.
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
} */
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,17 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'IAN Symbol Libraries',
|
name: 'IAN Symbol Libraries',
|
||||||
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php',
|
url: 'https://ian.umces.edu/symbols/catalog/svgedit/album_chooser.php?svgedit=3',
|
||||||
description: 'Free library of illustrations'
|
description: 'Free library of illustrations'
|
||||||
},
|
}
|
||||||
|
/*
|
||||||
|
// See message in "en" locale as to why disabling
|
||||||
|
,
|
||||||
{
|
{
|
||||||
name: 'Openclipart',
|
name: 'Openclipart',
|
||||||
url: 'https://openclipart.org/svgedit',
|
url: 'https://openclipart.org/svgedit',
|
||||||
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
description: 'Share and Use Images. Over 50,000 Public Domain SVG Images and Growing.'
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue