Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abbe98/human-readable-kulturarvsdata

Userscript for Wikidata to make all Kulturarvsdata URIs(P1260) link to their human readable source.
https://github.com/abbe98/human-readable-kulturarvsdata

k-samsok raa-collection soch wikidata

Last synced: 3 days ago
JSON representation

Userscript for Wikidata to make all Kulturarvsdata URIs(P1260) link to their human readable source.

Awesome Lists containing this project

README

        

# Human Readable Kulturarvsdata for Wikidata

Userscript for Wikidata to make all Kulturarvsdata URIs(`P1260`) link to their human readable source.

## Usage

Paste the following into your `commons.js` file:

```js
mw.loader.using(['jquery.ui.dialog'], function() {
$(document).ready(function() {
// common functions
String.prototype.insertAt=function(index, string) {
return this.substr(0, index) + string + this.substr(index);
}

if (window.mw.config.values.wbEntity) {
// replace external kulturarvsdata.se(P1260) RDF links with human readable ones
if (JSON.parse(window.mw.config.values.wbEntity).claims.P1260) {
var link = $('a[href*="kulturarvsdata.se"]');
if (link.attr('href').indexOf('/html/') == -1) {
var re = new RegExp('\/.[^/]+(|\/)$');

insertIndex = re.exec(link.attr('href'))['index'];
newUrl = link.attr('href').insertAt(insertIndex, '/html')
link.attr('href', newUrl);
}
}
}
});
});
```