- Fix: Broken lv locale, inconsistent tabs/spaces pt-PR
- Linting: Add ESLint script and devDeps and begin ESLint conversion (completed locales and jspdf directories only)master
parent
ac6d5092e4
commit
820964334c
|
@ -0,0 +1,3 @@
|
||||||
|
node_modules
|
||||||
|
editor/jspdf/jspdf.min.js
|
||||||
|
editor/jspdf/underscore-min.js
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"extends": "standard",
|
||||||
|
"parserOptions": {
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"node": false,
|
||||||
|
"browser": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"semi": [2, "always"],
|
||||||
|
"indent": ["error", "tab", {"outerIIFEBody": 0}],
|
||||||
|
"no-tabs": 0,
|
||||||
|
"object-property-newline": 0,
|
||||||
|
"one-var": 0,
|
||||||
|
"no-var": 2,
|
||||||
|
"prefer-const": 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,5 @@
|
||||||
|
node_modules
|
||||||
|
|
||||||
# See editor/config-sample.js for an example
|
# See editor/config-sample.js for an example
|
||||||
editor/config.js
|
editor/config.js
|
||||||
editor/custom.css
|
editor/custom.css
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* globals RGBColor, DOMParser, jsPDF */
|
/* globals RGBColor, DOMParser, jsPDF */
|
||||||
/*jslint eqeq:true, vars:true*/
|
/* eslint-disable no-var */
|
||||||
/*
|
/*
|
||||||
* svgToPdf.js
|
* svgToPdf.js
|
||||||
*
|
*
|
||||||
|
@ -46,7 +46,7 @@ var nodeIs = function (node, possible) {
|
||||||
var removeAttributes = function (node, attributes) {
|
var removeAttributes = function (node, attributes) {
|
||||||
var toRemove = [];
|
var toRemove = [];
|
||||||
[].forEach.call(node.attributes, function (a) {
|
[].forEach.call(node.attributes, function (a) {
|
||||||
if (attributeIsNotEmpty(a) && attributes.indexOf(a.name.toLowerCase()) == -1) {
|
if (attributeIsNotEmpty(a) && attributes.indexOf(a.name.toLowerCase()) === -1) {
|
||||||
toRemove.push(a.name);
|
toRemove.push(a.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -59,13 +59,13 @@ var removeAttributes = function(node, attributes) {
|
||||||
var svgElementToPdf = function (element, pdf, options) {
|
var svgElementToPdf = function (element, pdf, options) {
|
||||||
// pdf is a jsPDF object
|
// pdf is a jsPDF object
|
||||||
// console.log("options =", options);
|
// console.log("options =", options);
|
||||||
var remove = (options.removeInvalid == undef ? false : options.removeInvalid);
|
var remove = (options.removeInvalid === undef ? false : options.removeInvalid);
|
||||||
var k = (options.scale == undef ? 1.0 : options.scale);
|
var k = (options.scale === undef ? 1.0 : options.scale);
|
||||||
var colorMode = null;
|
var colorMode = null;
|
||||||
[].forEach.call(element.children, function (node) {
|
[].forEach.call(element.children, function (node) {
|
||||||
// console.log("passing: ", node);
|
// console.log("passing: ", node);
|
||||||
var hasFillColor = false;
|
var hasFillColor = false;
|
||||||
var hasStrokeColor = false;
|
// var hasStrokeColor = false;
|
||||||
var fillRGB;
|
var fillRGB;
|
||||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'text'])) {
|
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'text'])) {
|
||||||
var fillColor = node.getAttribute('fill');
|
var fillColor = node.getAttribute('fill');
|
||||||
|
@ -90,9 +90,9 @@ var svgElementToPdf = function(element, pdf, options) {
|
||||||
if (attributeIsNotEmpty(strokeColor)) {
|
if (attributeIsNotEmpty(strokeColor)) {
|
||||||
var strokeRGB = new RGBColor(strokeColor);
|
var strokeRGB = new RGBColor(strokeColor);
|
||||||
if (strokeRGB.ok) {
|
if (strokeRGB.ok) {
|
||||||
hasStrokeColor = true;
|
// hasStrokeColor = true;
|
||||||
pdf.setDrawColor(strokeRGB.r, strokeRGB.g, strokeRGB.b);
|
pdf.setDrawColor(strokeRGB.r, strokeRGB.g, strokeRGB.b);
|
||||||
if(colorMode == 'F') {
|
if (colorMode === 'F') {
|
||||||
colorMode = 'FD';
|
colorMode = 'FD';
|
||||||
} else {
|
} else {
|
||||||
colorMode = null;
|
colorMode = null;
|
||||||
|
@ -160,17 +160,17 @@ var svgElementToPdf = function(element, pdf, options) {
|
||||||
if (hasFillColor) {
|
if (hasFillColor) {
|
||||||
pdf.setTextColor(fillRGB.r, fillRGB.g, fillRGB.b);
|
pdf.setTextColor(fillRGB.r, fillRGB.g, fillRGB.b);
|
||||||
}
|
}
|
||||||
var fontType = "";
|
var fontType = '';
|
||||||
if (node.hasAttribute('font-weight')) {
|
if (node.hasAttribute('font-weight')) {
|
||||||
if(node.getAttribute('font-weight') == "bold") {
|
if (node.getAttribute('font-weight') === 'bold') {
|
||||||
fontType = "bold";
|
fontType = 'bold';
|
||||||
} else {
|
} else {
|
||||||
node.removeAttribute('font-weight');
|
node.removeAttribute('font-weight');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node.hasAttribute('font-style')) {
|
if (node.hasAttribute('font-style')) {
|
||||||
if(node.getAttribute('font-style') == "italic") {
|
if (node.getAttribute('font-style') === 'italic') {
|
||||||
fontType += "italic";
|
fontType += 'italic';
|
||||||
} else {
|
} else {
|
||||||
node.removeAttribute('font-style');
|
node.removeAttribute('font-style');
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,6 @@ var svgElementToPdf = function(element, pdf, options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
jsPDFAPI.addSVG = function (element, x, y, options) {
|
jsPDFAPI.addSVG = function (element, x, y, options) {
|
||||||
|
|
||||||
options = (options === undef ? {} : options);
|
options = (options === undef ? {} : options);
|
||||||
options.x_offset = x;
|
options.x_offset = x;
|
||||||
options.y_offset = y;
|
options.y_offset = y;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "af",
|
lang: "af",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ar",
|
lang: "ar",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "az",
|
lang: "az",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "be",
|
lang: "be",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "bg",
|
lang: "bg",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ca",
|
lang: "ca",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "cs",
|
lang: "cs",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "cy",
|
lang: "cy",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "da",
|
lang: "da",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "de",
|
lang: "de",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "el",
|
lang: "el",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "en",
|
lang: "en",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "es",
|
lang: "es",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "et",
|
lang: "et",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "fa",
|
lang: "fa",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "fi",
|
lang: "fi",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "fr",
|
lang: "fr",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "fy",
|
lang: "fy",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ga",
|
lang: "ga",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "gl",
|
lang: "gl",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "he",
|
lang: "he",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "hi",
|
lang: "hi",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "hr",
|
lang: "hr",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "hu",
|
lang: "hu",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "hy",
|
lang: "hy",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "id",
|
lang: "id",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "is",
|
lang: "is",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "it",
|
lang: "it",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ja",
|
lang: "ja",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ko",
|
lang: "ko",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "lt",
|
lang: "lt",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*globals svgEditor */
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "lv",
|
lang: "lv",
|
||||||
|
@ -218,12 +218,9 @@ svgEditor.readLang({
|
||||||
"enterNewLayerName": "Please enter the new layer name",
|
"enterNewLayerName": "Please enter the new layer name",
|
||||||
"layerHasThatName": "Layer already has that name",
|
"layerHasThatName": "Layer already has that name",
|
||||||
"QmoveElemsToLayer": "Move selected elements to layer '%s'?",
|
"QmoveElemsToLayer": "Move selected elements to layer '%s'?",
|
||||||
"QwantToClear":"Do you want to clear the drawing?
|
"QwantToClear": "Do you want to clear the drawing?\nThis will also erase your undo history!",
|
||||||
This will also erase your undo history!",
|
"QwantToOpen": "Do you want to open a new file?\nThis will also erase your undo history!",
|
||||||
"QwantToOpen":"Do you want to open a new file?
|
"QerrorsRevertToSource": "There were parsing errors in your SVG source.\nRevert back to original SVG source?",
|
||||||
This will also erase your undo history!",
|
|
||||||
"QerrorsRevertToSource":"There were parsing errors in your SVG source.
|
|
||||||
Revert back to original SVG source?",
|
|
||||||
"QignoreSourceChanges": "Ignore changes made to SVG source?",
|
"QignoreSourceChanges": "Ignore changes made to SVG source?",
|
||||||
"featNotSupported": "Feature not supported",
|
"featNotSupported": "Feature not supported",
|
||||||
"enterNewImgURL": "Enter the new image URL",
|
"enterNewImgURL": "Enter the new image URL",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "mk",
|
lang: "mk",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ms",
|
lang: "ms",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "mt",
|
lang: "mt",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "nl",
|
lang: "nl",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "no",
|
lang: "no",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "pl",
|
lang: "pl",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "pt-BR",
|
lang: "pt-BR",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "pt-PT",
|
lang: "pt-PT",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ro",
|
lang: "ro",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "ru",
|
lang: "ru",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "sk",
|
lang: "sk",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "sl",
|
lang: "sl",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "sq",
|
lang: "sq",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "sr",
|
lang: "sr",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "sv",
|
lang: "sv",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "sw",
|
lang: "sw",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "test",
|
lang: "test",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "th",
|
lang: "th",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "tl",
|
lang: "tl",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "tr",
|
lang: "tr",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "uk",
|
lang: "uk",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "vi",
|
lang: "vi",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "yi",
|
lang: "yi",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "zh-CN",
|
lang: "zh-CN",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "zh-HK",
|
lang: "zh-HK",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable quotes */
|
||||||
/* globals svgEditor */
|
/* globals svgEditor */
|
||||||
svgEditor.readLang({
|
svgEditor.readLang({
|
||||||
lang: "zh-TW",
|
lang: "zh-TW",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
/* eslint-disable no-var */
|
||||||
/* globals jQuery */
|
/* globals jQuery */
|
||||||
/*jslint vars: true, eqeq: true, forin: true*/
|
|
||||||
/*
|
/*
|
||||||
* Localizing script for SVG-edit UI
|
* Localizing script for SVG-edit UI
|
||||||
*
|
*
|
||||||
|
@ -15,9 +15,10 @@
|
||||||
// 2) svgcanvas.js
|
// 2) svgcanvas.js
|
||||||
// 3) svg-editor.js
|
// 3) svg-editor.js
|
||||||
|
|
||||||
var svgEditor = (function($, editor) {'use strict';
|
var svgEditor = (function ($, editor) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
var lang_param;
|
var langParam;
|
||||||
|
|
||||||
function setStrings (type, obj, ids) {
|
function setStrings (type, obj, ids) {
|
||||||
// Root element to look for element from
|
// Root element to look for element from
|
||||||
|
@ -46,8 +47,6 @@ var svgEditor = (function($, editor) {'use strict';
|
||||||
elem.title = val;
|
elem.title = val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('Missing: ' + sel);
|
console.log('Missing: ' + sel);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +54,7 @@ var svgEditor = (function($, editor) {'use strict';
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.readLang = function (langData) {
|
editor.readLang = function (langData) {
|
||||||
var more = editor.canvas.runExtensions('addlangData', lang_param, true);
|
var more = editor.canvas.runExtensions('addlangData', langParam, true);
|
||||||
$.each(more, function (i, m) {
|
$.each(more, function (i, m) {
|
||||||
if (m.data) {
|
if (m.data) {
|
||||||
langData = $.merge(langData, m.data);
|
langData = $.merge(langData, m.data);
|
||||||
|
@ -66,7 +65,7 @@ var svgEditor = (function($, editor) {'use strict';
|
||||||
if (!langData.tools) { return; }
|
if (!langData.tools) { return; }
|
||||||
|
|
||||||
var tools = langData.tools,
|
var tools = langData.tools,
|
||||||
misc = langData.misc,
|
// misc = langData.misc,
|
||||||
properties = langData.properties,
|
properties = langData.properties,
|
||||||
config = langData.config,
|
config = langData.config,
|
||||||
layers = langData.layers,
|
layers = langData.layers,
|
||||||
|
@ -102,7 +101,7 @@ var svgEditor = (function($, editor) {'use strict';
|
||||||
smallest_object: tools.smallest_object,
|
smallest_object: tools.smallest_object,
|
||||||
straight_segments: properties.straight_segments,
|
straight_segments: properties.straight_segments,
|
||||||
|
|
||||||
svginfo_bg_url: config.editor_img_url + ":",
|
svginfo_bg_url: config.editor_img_url + ':',
|
||||||
svginfo_bg_note: config.editor_bg_note,
|
svginfo_bg_note: config.editor_bg_note,
|
||||||
svginfo_change_background: config.background,
|
svginfo_change_background: config.background,
|
||||||
svginfo_dim: config.doc_dims,
|
svginfo_dim: config.doc_dims,
|
||||||
|
@ -272,46 +271,42 @@ var svgEditor = (function($, editor) {'use strict';
|
||||||
|
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
editor.setLang(lang_param, langData);
|
editor.setLang(langParam, langData);
|
||||||
};
|
};
|
||||||
|
|
||||||
editor.putLocale = function (given_param, good_langs) {
|
editor.putLocale = function (givenParam, goodLangs) {
|
||||||
|
if (givenParam) {
|
||||||
if (given_param) {
|
langParam = givenParam;
|
||||||
lang_param = given_param;
|
} else {
|
||||||
}
|
langParam = $.pref('lang');
|
||||||
else {
|
if (!langParam) {
|
||||||
lang_param = $.pref('lang');
|
|
||||||
if (!lang_param) {
|
|
||||||
if (navigator.userLanguage) { // Explorer
|
if (navigator.userLanguage) { // Explorer
|
||||||
lang_param = navigator.userLanguage;
|
langParam = navigator.userLanguage;
|
||||||
|
} else if (navigator.language) { // FF, Opera, ...
|
||||||
|
langParam = navigator.language;
|
||||||
}
|
}
|
||||||
else if (navigator.language) { // FF, Opera, ...
|
if (langParam == null) { // Todo: Would cause problems if uiStrings removed; remove this?
|
||||||
lang_param = navigator.language;
|
|
||||||
}
|
|
||||||
if (lang_param == null) { // Todo: Would cause problems if uiStrings removed; remove this?
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Lang: ' + lang_param);
|
console.log('Lang: ' + langParam);
|
||||||
|
|
||||||
// Set to English if language is not in list of good langs
|
// Set to English if language is not in list of good langs
|
||||||
if ($.inArray(lang_param, good_langs) === -1 && lang_param !== 'test') {
|
if ($.inArray(langParam, goodLangs) === -1 && langParam !== 'test') {
|
||||||
lang_param = "en";
|
langParam = 'en';
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't bother on first run if language is English
|
// don't bother on first run if language is English
|
||||||
// The following line prevents setLang from running
|
// The following line prevents setLang from running
|
||||||
// extensions which depend on updated uiStrings,
|
// extensions which depend on updated uiStrings,
|
||||||
// so commenting it out.
|
// so commenting it out.
|
||||||
// if (lang_param.indexOf("en") === 0) {return;}
|
// if (langParam.indexOf("en") === 0) {return;}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var conf = editor.curConfig;
|
var conf = editor.curConfig;
|
||||||
|
|
||||||
var url = conf.langPath + "lang." + lang_param + ".js";
|
var url = conf.langPath + 'lang.' + langParam + '.js';
|
||||||
|
|
||||||
$.getScript(url, function (d) {
|
$.getScript(url, function (d) {
|
||||||
// Fails locally in Chrome 5+
|
// Fails locally in Chrome 5+
|
||||||
|
@ -321,8 +316,7 @@ var svgEditor = (function($, editor) {'use strict';
|
||||||
document.querySelector('head').appendChild(s);
|
document.querySelector('head').appendChild(s);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return editor;
|
return editor;
|
||||||
}(jQuery, svgEditor));
|
}(jQuery, svgEditor)); // eslint-disable-line no-use-before-define
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
|
@ -10,6 +10,7 @@
|
||||||
},
|
},
|
||||||
"engines": {},
|
"engines": {},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"eslint": "eslint .",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -35,5 +36,13 @@
|
||||||
"url": "https://github.com/SVG-Edit/svgedit/issues"
|
"url": "https://github.com/SVG-Edit/svgedit/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/SVG-Edit/svgedit#readme",
|
"homepage": "https://github.com/SVG-Edit/svgedit#readme",
|
||||||
"dependencies": {}
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"eslint": "4.19.1",
|
||||||
|
"eslint-config-standard": "11.0.0",
|
||||||
|
"eslint-plugin-import": "2.11.0",
|
||||||
|
"eslint-plugin-node": "6.0.1",
|
||||||
|
"eslint-plugin-promise": "3.7.0",
|
||||||
|
"eslint-plugin-standard": "3.1.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue