2017-08-29 19:22:41 +02:00
|
|
|
importPackage(org.openrefine.wikidata.commands);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function invoked to initialize the extension.
|
|
|
|
*/
|
|
|
|
function init() {
|
|
|
|
var RefineServlet = Packages.com.google.refine.RefineServlet;
|
|
|
|
RefineServlet.registerClassMapping(
|
|
|
|
"org.openrefine.wikidata.operations.SaveWikibaseSchemaOperation$WikibaseSchemaChange",
|
|
|
|
"org.openrefine.wikidata.operations.SaveWikibaseSchemaOperation$WikibaseSchemaChange");
|
2017-09-19 11:39:52 +02:00
|
|
|
RefineServlet.registerClassMapping(
|
|
|
|
"org.openrefine.wikidata.operations.PerformWikibaseEditsOperation$PerformWikibaseEditsChange",
|
|
|
|
"org.openrefine.wikidata.operations.PerformWikibaseEditsOperation$PerformWikibaseEditsChange");
|
2017-08-29 19:22:41 +02:00
|
|
|
|
|
|
|
RefineServlet.cacheClass(Packages.org.openrefine.wikidata.operations.SaveWikibaseSchemaOperation$WikibaseSchemaChange);
|
2017-09-19 11:39:52 +02:00
|
|
|
RefineServlet.cacheClass(Packages.org.openrefine.wikidata.operations.PerformWikibaseEditsOperation$PerformWikibaseEditsChange);
|
2017-08-29 19:22:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Attach a Wikibase schema to each project.
|
|
|
|
*/
|
|
|
|
Packages.com.google.refine.model.Project.registerOverlayModel(
|
|
|
|
"wikibaseSchema",
|
|
|
|
Packages.org.openrefine.wikidata.schema.WikibaseSchema);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Operations
|
|
|
|
*/
|
|
|
|
Packages.com.google.refine.operations.OperationRegistry.registerOperation(
|
|
|
|
module, "save-wikibase-schema", Packages.org.openrefine.wikidata.operations.SaveWikibaseSchemaOperation);
|
2017-09-15 12:51:29 +02:00
|
|
|
Packages.com.google.refine.operations.OperationRegistry.registerOperation(
|
|
|
|
module, "perform-wikibase-edits", Packages.org.openrefine.wikidata.operations.PerformWikibaseEditsOperation);
|
2017-08-29 19:22:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Exporters
|
|
|
|
*/
|
|
|
|
var ExporterRegistry = Packages.com.google.refine.exporters.ExporterRegistry;
|
2017-09-04 10:40:47 +02:00
|
|
|
var QSExporter = Packages.org.openrefine.wikidata.exporters.QuickStatementsExporter;
|
2018-10-28 15:19:48 +01:00
|
|
|
var SchemaExporter = Packages.org.openrefine.wikidata.exporters.SchemaExporter;
|
2017-08-29 19:22:41 +02:00
|
|
|
|
2017-09-04 10:40:47 +02:00
|
|
|
ExporterRegistry.registerExporter("quickstatements", new QSExporter());
|
2018-10-28 15:19:48 +01:00
|
|
|
ExporterRegistry.registerExporter("wikibase-schema", new SchemaExporter());
|
2017-08-31 10:11:00 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Commands
|
|
|
|
*/
|
|
|
|
RefineServlet.registerCommand(module, "save-wikibase-schema", new SaveWikibaseSchemaCommand());
|
2017-09-04 22:00:58 +02:00
|
|
|
RefineServlet.registerCommand(module, "preview-wikibase-schema", new PreviewWikibaseSchemaCommand());
|
2017-09-15 12:51:29 +02:00
|
|
|
RefineServlet.registerCommand(module, "perform-wikibase-edits", new PerformWikibaseEditsCommand());
|
|
|
|
RefineServlet.registerCommand(module, "login", new LoginCommand());
|
2020-06-16 04:08:36 +02:00
|
|
|
|
2017-08-29 19:22:41 +02:00
|
|
|
/*
|
|
|
|
* Resources
|
|
|
|
*/
|
|
|
|
ClientSideResourceManager.addPaths(
|
|
|
|
"project/scripts",
|
|
|
|
module,
|
|
|
|
[
|
2020-08-22 17:58:56 +02:00
|
|
|
"scripts/ajv.min.js",
|
|
|
|
"scripts/wikidata-manifest-v1.0.js",
|
|
|
|
"scripts/wikibase-manifest-schema-v1.js",
|
2022-01-30 21:12:14 +01:00
|
|
|
"scripts/wikibase-manifest-schema-v2.js",
|
2020-08-22 17:58:56 +02:00
|
|
|
"scripts/wikibase-manager.js",
|
2017-08-29 19:22:41 +02:00
|
|
|
"scripts/menu-bar-extension.js",
|
2018-02-22 19:15:38 +01:00
|
|
|
"scripts/warningsrenderer.js",
|
|
|
|
"scripts/langsuggest.js",
|
2018-03-19 18:55:33 +01:00
|
|
|
"scripts/bettersuggest.js",
|
2018-03-20 17:20:00 +01:00
|
|
|
"scripts/previewrenderer.js",
|
2022-01-30 21:12:14 +01:00
|
|
|
"scripts/wikibase-suggest.js",
|
2020-08-22 17:58:56 +02:00
|
|
|
"scripts/schema-alignment.js",
|
|
|
|
"scripts/wikidata-extension-manager.js",
|
2017-09-15 12:51:29 +02:00
|
|
|
"scripts/dialogs/manage-account-dialog.js",
|
|
|
|
"scripts/dialogs/perform-edits-dialog.js",
|
2018-11-01 16:01:08 +01:00
|
|
|
"scripts/dialogs/import-schema-dialog.js",
|
2020-08-22 17:58:56 +02:00
|
|
|
"scripts/dialogs/wikibase-dialog.js",
|
2017-09-28 17:59:03 +02:00
|
|
|
"scripts/jquery.uls.data.js",
|
2017-08-29 19:22:41 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
ClientSideResourceManager.addPaths(
|
|
|
|
"project/styles",
|
|
|
|
module,
|
|
|
|
[
|
2020-08-22 17:58:56 +02:00
|
|
|
"styles/theme.less",
|
|
|
|
"styles/schema-alignment.less",
|
2017-09-15 12:51:29 +02:00
|
|
|
"styles/dialogs/manage-account-dialog.less",
|
2018-11-01 16:01:08 +01:00
|
|
|
"styles/dialogs/import-schema-dialog.less",
|
2018-02-22 19:15:38 +01:00
|
|
|
"styles/dialogs/perform-edits.less",
|
2020-08-22 17:58:56 +02:00
|
|
|
"styles/dialogs/wikibase-dialog.less",
|
|
|
|
"styles/dialogs/add-wikibase-dialog.less"
|
2017-08-29 19:22:41 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|