1. Reference config.js in the editor (and remove encouragement for adding extensions to HTML) but ignore config.js in SVN (let user configure) but supply config-sample.js to indicate config/pref/extension possibilities;

2. Move ext-overview_window.js to default but overridable list of extensions (as with other extensions);
3. Allow extensions to avoid problems if failing to return an object (in svgcanvas.js);
4. Support new langReady callback to ensure extension always called when locale info is ready (and always load locale, even English);
5. Move localStorage storing to a new (i18n-ized and available-by-default) storage extension which adds a dialog asking user for whether to store prefs and/or SVG content; $.pref() now falls back to checking defaultPrefs (which may have been expanded at runtime to include URL or storage settings); use new config "forceStorage" to get old (bad) behavior
6. Remove initial cap from "Editor" to reflect singleton nature of object (as compared to JSLint conventions for initial cap constructors);
7. Begin a little JSDoc, clearer grouping of properties/methods; JSLint/clean-up
8. Omit values for lang and iconsize to be successfully auto-detected; 9. Document "save_notice_done" and "export_notice_done" within list of prefs; document "showlayers" and "no_save_warning" as config
10. Add "preventAllURLConfig" and "preventURLContentLoading" config for URL security; 
11. Add "lockExtensions" and "noDefaultExtensions" config for URL behavior re: extension loading
12. Document "showGrid", and new "noStorageOnLoad" and "emptyStorageOnDecline" extension-related config
13. Change setConfig to allow a second object with "overwrite" and "allowInitialUserOverride" properties and to behave accordingly (with URL config acting with overwrite=false to act under lower priority given security concern), along with checking "preventAllURLConfig" and "lockExtensions" config.
14. Remove any dupe extensions
15. Strip all path config from URL setting in addition to extPath (imgPath, langPath, jGraduatePath)
16. Support select+checkbox type dialog (used for storage ext.)
17. Ensure clickSelect is public so can be properly used by ext-connector.js
18. Reinstate 'in' checks just to be safe
19. Fix broken linkControlPoints() and addSubPath() functions
20. Fix problem when position returned by extension object was too high (e.g., if too few other extensions were included).

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2705 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Brett Zamir
2014-02-18 15:06:27 +00:00
parent cd560993f0
commit e463b43220
8 changed files with 1004 additions and 328 deletions

View File

@@ -1,5 +1,19 @@
/*globals svgEditor */
svgEditor.readLang({
confirmSetStorage: {
message: "By default and where supported, SVG-Edit can store your editor "+
"preferences and SVG content locally on your machine so you do not "+
"need to add these back each time you load SVG-Edit. If, for privacy "+
"reasons, you do not wish to store this information on your machine, "+
"you can change away from the default option below.",
storagePrefsAndContent: "Store preferences and SVG content locally",
storagePrefsOnly: "Only store preferences locally",
storagePrefs: "Store preferences locally",
storageNoPrefsOrContent: "Do not store my preferences or SVG content locally",
storageNoPrefs: "Do not store my preferences locally",
rememberLabel: "Remember this choice?",
rememberTooltip: "If you choose to opt out of storage while remembering this choice, the URL will change so as to avoid asking again."
},
lang: "en",
dir : "ltr",
common: {

View File

@@ -15,7 +15,7 @@
// 2) svgcanvas.js
// 3) svg-editor.js
var svgEditor = (function($, Editor) {'use strict';
var svgEditor = (function($, editor) {'use strict';
var lang_param;
@@ -54,10 +54,10 @@ var svgEditor = (function($, Editor) {'use strict';
}
}
Editor.readLang = function(langData) {
var more = Editor.canvas.runExtensions("addlangData", lang_param, true);
editor.readLang = function(langData) {
var more = editor.canvas.runExtensions("addlangData", lang_param, true);
$.each(more, function(i, m) {
if(m.data) {
if (m.data) {
langData = $.merge(langData, m.data);
}
});
@@ -272,10 +272,10 @@ var svgEditor = (function($, Editor) {'use strict';
}, true);
Editor.setLang(lang_param, langData);
editor.setLang(lang_param, langData);
};
Editor.putLocale = function (given_param, good_langs) {
editor.putLocale = function (given_param, good_langs) {
if (given_param) {
lang_param = given_param;
@@ -286,10 +286,10 @@ var svgEditor = (function($, Editor) {'use strict';
if (navigator.userLanguage) { // Explorer
lang_param = navigator.userLanguage;
}
else if (navigator.language) {// FF, Opera, ...
else if (navigator.language) { // FF, Opera, ...
lang_param = navigator.language;
}
if (lang_param == '') {
if (lang_param == null) { // Todo: Would cause problems if uiStrings removed; remove this?
return;
}
}
@@ -302,11 +302,14 @@ var svgEditor = (function($, Editor) {'use strict';
}
// don't bother on first run if language is English
if (lang_param.indexOf("en") === 0) {return;}
// The following line prevents setLang from running
// extensions which depend on updated uiStrings,
// so commenting it out.
// if (lang_param.indexOf("en") === 0) {return;}
}
var conf = Editor.curConfig;
var conf = editor.curConfig;
var url = conf.langPath + "lang." + lang_param + ".js";
@@ -321,5 +324,5 @@ var svgEditor = (function($, Editor) {'use strict';
};
return Editor;
return editor;
}(jQuery, svgEditor));