Repository navigation
Expand file tree
/
Copy pathframework.js
More file actions
74 lines (58 loc) · 2.49 KB
/
Copy pathframework.js
File metadata and controls
74 lines (58 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* usefulQueries: adds buttons to Wikibase item pages that run SPARQL queries
* or open external tools relevant to the item's statements.
*
* Documentation: https://www.wikidata.org/wiki/User:Kristbaum/usefulQueries
*
* License of this file: CC0
*/
$(function () {
"use strict";
/* __SETTINGS__ */
// Exit the script if we're not in the main namespace (article namespace).
if (mw.config.get("wgNamespaceNumber") !== SETTINGS.allowedNamespace) {
return;
}
// ===== CONFIGURATION =====
/**
* @typedef {Object} UsefulQuery
* @property {string} id - Unique identifier for the query
* @property {"entity"|"property"|"value"} scope - Where to attach the query button
* - "entity": Attaches to the entity title (entity-wide query)
* - "property": Attaches to a property label
* - "value": Attaches to a specific property+value combination
* @property {string[]} [propertyId] - Property IDs to match (required for "property" and "value" scope)
* @property {string[]|null} [valueId] - Value entity IDs to match ("value" scope; null matches any value)
* @property {string} template - SPARQL query template with placeholders
* @property {string} emoji - Emoji/text label for the button
* @property {string} title - Button tooltip and popup heading (supports {itemLabel}, {itemQid} placeholders)
*/
/**
* @typedef {Object} UsefulLink
* @property {string} id - Unique identifier for the link
* @property {"entity"|"property"|"value"} scope - Where to attach the link button
* @property {string[]} [propertyId] - Property IDs to match (required for "property" and "value" scope)
* @property {string[]|null} [valueId] - Value entity IDs to match ("value" scope; null matches any value)
* @property {string} urlTemplate - URL template with placeholders ({itemQid}, {valueQid})
* @property {string} emoji - Emoji/text label for the button
* @property {string} title - Button tooltip text
*/
// ===== USEFUL QUERIES CONFIGURATION =====
// Add new queries here - they will automatically be attached to the right places
/** @type {UsefulQuery[]} */
const USEFUL_QUERIES = [
/* __USEFUL_QUERIES__ */
];
// ===== USEFUL LINKS CONFIGURATION =====
// Add new external links here - they will automatically be attached to the right places
/** @type {UsefulLink[]} */
const USEFUL_LINKS = [
/* __USEFUL_LINKS__ */
];
/* __HELPERS__ */
/* __QLEVER__ */
/* __UI__ */
/* __DOM__ */
/* __PROCESSING__ */
/* __MAIN__ */
});