- Optimization: Remove unmaintained chrome-app, firefox-extension,

opera-widget (an updated WebExtensions replacement (or such)
  would be welcome.)
master
Brett Zamir 2020-01-07 09:57:25 +08:00
parent 6287bdfb6b
commit 860dca4339
16 changed files with 5 additions and 280 deletions

View File

@ -44,10 +44,7 @@ module.exports = {
"editor/redirect-on-no-module-support.js",
"editor/extensions/imagelib/index.js",
"editor/external/dom-polyfill/dom-polyfill.js",
"screencasts/svgopen2010/script.js",
"opera-widget/handlers.js",
"firefox-extension/handlers.js",
"firefox-extension/content/svg-edit-overlay.js"
"screencasts/svgopen2010/script.js"
],
rules: {
"import/unambiguous": ["off"]
@ -223,15 +220,6 @@ module.exports = {
]
}
},
{
// Misc. probably to remove
files: ['firefox-extension/**', 'opera-widget/**'],
settings: {
polyfills: [
'console'
]
}
},
{
files: ["cypress/**"],
extends: ["plugin:cypress/recommended"],

View File

@ -24,6 +24,9 @@
`url` is set within the URL)
- Optimization: Remove unused `jquery-ui-1.8.custom.min.js` file
- Optimization: Remove old build/tools closure/yuicompressor code
- Optimization: Remove unmaintained chrome-app, firefox-extension,
opera-widget (an updated WebExtensions replacement (or such)
would be welcome.)
- Localization: Add 'SVG-Edit Home Page' to locale files
- Docs: Remove outdated info on jsdoc linting (now just part of eslint config)
- Docs: Add testing badge

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -1,20 +0,0 @@
{
"name": "SVG-edit",
"description": "A fast, web-based, Javascript-driven SVG editor that works in any modern browser",
"version": "2.6",
"app": {
"urls": [
"*://svg-edit.googlecode.com/svn/tags/stable/"
],
"launch": {
"web_url": "http://svg-edit.googlecode.com/svn/tags/stable/editor/svg-editor.html"
}
},
"icons": {
"128": "icon_128.png"
},
"permissions": [
"unlimitedStorage",
"notifications"
]
}

View File

@ -61,8 +61,6 @@ module.exports = {
'node_modules',
'dist',
'editor/external',
'firefox-extension',
'opera-widget',
'screencasts',
'test'
],

View File

@ -1,2 +0,0 @@
content svg-edit content/
overlay chrome://browser/content/browser.xul chrome://svg-edit/content/svg-edit-overlay.xul

View File

@ -1,21 +0,0 @@
#svg-edit-statusbar-button {
list-style-image: url("chrome://svg-edit/content/editor/images/logo.png");
display: -moz-box;
/*-moz-image-region: rect(16px, 16px, 32px, 0px);*/
padding-left: 0px;
padding-right: 0px;
width: 16px;
height: 16px;
}
#svg-edit-statusbar-button[state="active"] {
list-style-image: url("chrome://svg-edit/content/editor/images/logo.png");
-moz-image-region: rect(32px, 16px, 48px, 0px);
}
#svg-edit-statusbar-button[state="error"] {
list-style-image: url("chrome://svg-edit/content/editor/images/logo.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}

View File

@ -1,8 +0,0 @@
/**
* Opens the dialog with the SVG Editor.
* @returns {void}
*/
function startSvgEdit () { // eslint-disable-line no-unused-vars
const url = 'chrome://svg-edit/content/editor/svg-editor.html';
window.openDialog(url, 'SVG Editor', 'width=1024,height=700,menubar=no,toolbar=no');
}

View File

@ -1,25 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://svg-edit/content/svg-edit-overlay.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://chromelist/locale/ChromeListOverlay.dtd" >
<overlay id="SVGEditToolsOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"
src="chrome://svg-edit/content/svg-edit-overlay.js" />
<menupopup id="menu_ToolsPopup">
<menuitem insertafter="devToolsSeparator" label="SVG Editor"
oncommand="startSvgEdit();" />
</menupopup>
<!-- Firefox -->
<statusbar id="status-bar">
<statusbarpanel id="svg-edit-statusbar-button"
class="statusbarpanel-menu-iconic"
onclick="return startSvgEdit()"
tooltip="SvgEdit">
</statusbarpanel>
</statusbar>
</overlay>

View File

@ -1,60 +0,0 @@
/* global svgCanvas, jQuery, Components, netscape */
// Note: This JavaScript file must be included as the last script on the main HTML editor page to override the open/save handlers
jQuery(function () {
if (!window.Components) return;
/**
* Offer choice of file.
* @param {boolean} readflag
* @returns {nsILocalFile}
*/
function mozFilePicker (readflag) {
const fp = window.Components.classes['@mozilla.org/filepicker;1']
.createInstance(Components.interfaces.nsIFilePicker);
if (readflag) fp.init(window, 'Pick a SVG file', fp.modeOpen);
else fp.init(window, 'Pick a SVG file', fp.modeSave);
fp.defaultExtension = '*.svg';
fp.show();
return fp.file;
}
svgCanvas.setCustomHandlers({
open () {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
const file = mozFilePicker(true);
if (!file) {
return;
}
const inputStream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
inputStream.init(file, 0x01, 0o00004, null);
const sInputStream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
sInputStream.init(inputStream);
svgCanvas.setSvgString(sInputStream.read(sInputStream.available()));
} catch (e) {
console.log('Exception while attempting to load' + e); // eslint-disable-line no-console
}
},
save (svg, str) {
try {
const file = mozFilePicker(false);
if (!file) {
return;
}
if (!file.exists()) {
file.create(0, 0o0664);
}
const out = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
out.init(file, 0x20 | 0x02, 0o00004, null); // eslint-disable-line no-bitwise
out.write(str, str.length);
out.flush();
out.close();
} catch (e) {
alert(e); // eslint-disable-line no-alert
}
}
});
});

View File

@ -1,21 +0,0 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:extension:file:chrome"
em:package="content" />
<Description about="urn:mozilla:install-manifest">
<!-- required properties -->
<em:id>svg-edit@googlegroups.com</em:id>
<em:version>2.6</em:version>
<em:type>2</em:type>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>1.5</em:minVersion>
<em:maxVersion>4.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:name>SVG-edit</em:name>
</Description>
</RDF>

View File

@ -1,17 +0,0 @@
<?xml version="1.0"?>
<widget defaultmode="application">
<widgetname>SVG Edit</widgetname>
<description>
A simple SVG Editor.
</description>
<width>800</width>
<height>600</height>
<icon>editor/images/logo.svg</icon>
<id>
<name>SVG Edit</name>
<revised>2010-09</revised>
</id>
<feature name="http://xmlns.opera.com/fileio">
<param name="folderhint" value="home" />
</feature>
</widget>

View File

@ -1,60 +0,0 @@
/* globals jQuery, svgCanvas */
/* eslint-disable no-console */
// Note: This JavaScript file must be included as the last script on the main
// HTML editor page to override the open/save handlers
jQuery(function () {
if (window.opera && window.opera.io && window.opera.io.filesystem) {
svgCanvas.setCustomHandlers({
open () {
try {
window.opera.io.filesystem.browseForFile(
new Date().getTime(), /* mountpoint name */
'', /* default location */
function (file) {
try {
if (file) {
const fstream = file.open(file, 'r');
let output = '';
while (!fstream.eof) {
output += fstream.readLine();
}
svgCanvas.setSvgString(output); /* 'this' is bound to the filestream object here */
}
} catch (e) {
console.log('Reading file failed.');
}
},
false, /* not persistent */
false, /* no multiple selections */
'*.svg' /* file extension filter */
);
} catch (e) {
console.log('Open file failed.');
}
},
save (win, svg) {
try {
win.opera.io.filesystem.browseForSave(
new Date().getTime(), /* mountpoint name */
'', /* default location */
function (file) {
try {
if (file) {
const fstream = file.open(file, 'w');
fstream.write(svg, 'UTF-8');
fstream.close();
}
} catch (e) {
console.log('Write to file failed.');
}
},
false /* not persistent */
);
} catch (e) {
console.log('Save file failed.');
}
}
});
}
});

View File

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>SVG Edit</title>
<link rel="stylesheet" href="style.css">
<script>
/* eslint-disable no-unused-vars */
/**
* This method adds the script that overrides the default open/save handlers.
* @returns {void}
*/
function addHandlers () {
const cdoc = document.getElementById('container').contentDocument;
if (cdoc) {
const scriptelm = cdoc.createElement('script');
scriptelm.src = '../handlers.js';
cdoc.getElementsByTagName('head')[0].appendChild(scriptelm);
}
}
</script>
</head>
<body>
<object id="container" data="editor/svg-editor.html" onload="addHandlers()">
Failed to load for some reason.
</object>
</body>
</html>

View File

@ -1,2 +0,0 @@
body { margin: 0px; padding: 0px; }
#container { width: 100%; height: 100%; border: none; }

View File

@ -24,7 +24,7 @@
"open-docs-no-start": "open-cli http://localhost:8000/docs/jsdoc/",
"open-docs": "run-p start open-docs-no-start",
"build-html": "npx babel-node --plugins @babel/plugin-transform-modules-commonjs build/build-html.js",
"compress-images": "imageoptim \"chrome-app/*.png\" \"editor/extensions/*.png\" \"editor/spinbtn/*.png\" \"editor/jgraduate/images/*.{png,gif}\" \"editor/images/*.png\"",
"compress-images": "imageoptim \"editor/extensions/*.png\" \"editor/spinbtn/*.png\" \"editor/jgraduate/images/*.{png,gif}\" \"editor/images/*.png\"",
"copy": "copyfiles -f node_modules/load-stylesheets/dist/index-es.js editor/external/load-stylesheets && copyfiles -f node_modules/jamilih/dist/jml-es.js editor/external/jamilih && copyfiles -f node_modules/query-result/esm/index.js editor/external/query-result/esm && copyfiles -f node_modules/qr-manipulation/dist/index-es.js editor/external/qr-manipulation/dist && copyfiles -f node_modules/stackblur-canvas/dist/stackblur-es.js editor/external/stackblur-canvas/dist && copyfiles -f node_modules/regenerator-runtime/runtime.js editor/external/regenerator-runtime && copyfiles -f \"node_modules/core-js-bundle//minified*\" editor/external/core-js-bundle && copyfiles -f \"node_modules/underscore/underscore-*\" editor/jspdf && copyfiles -f \"node_modules/deparam/dist/deparam.esm.js\" editor/external/deparam",
"remark": "remark -q -f .",
"eslint-fix": "eslint --fix --ext js,md,html .",