Skip to content

Instantly share code, notes, and snippets.

@matthieubosquet
Last active October 24, 2018 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieubosquet/4c420b08e09778d49099f4a7a7911688 to your computer and use it in GitHub Desktop.
Save matthieubosquet/4c420b08e09778d49099f4a7a7911688 to your computer and use it in GitHub Desktop.
A YASGUI with some prefix added (can't seem to get prefix fetch configuration working)
<!DOCTYPE html>
<html>
<head>
<link href='https://cdn.jsdelivr.net/npm/yasgui@2.7.29/dist/yasgui.min.css' rel='stylesheet' type='text/css'/>
<script src='https://cdn.jsdelivr.net/npm/yasgui@2.7.29/dist/yasgui.min.js'></script>
<style>
.yasgui .endpointText {
display:none !important;
}
</style>
<script type="text/javascript">
var appInsights=window.appInsights||function(a){
function b(a){c[a]=function(){var b=arguments;c.queue.push(function(){c[a].apply(c,b)})}}var c={config:a},d=document,e=window;setTimeout(function(){var b=d.createElement("script");b.src=a.url||"https://az416426.vo.msecnd.net/scripts/a/ai.0.js",d.getElementsByTagName("script")[0].parentNode.appendChild(b)});try{c.cookie=d.cookie}catch(a){}c.queue=[];for(var f=["Event","Exception","Metric","PageView","Trace","Dependency"];f.length;)b("track"+f.pop());if(b("setAuthenticatedUserContext"),b("clearAuthenticatedUserContext"),b("startTrackEvent"),b("stopTrackEvent"),b("startTrackPage"),b("stopTrackPage"),b("flush"),!a.disableExceptionTracking){f="onerror",b("_"+f);var g=e[f];e[f]=function(a,b,d,e,h){var i=g&&g(a,b,d,e,h);return!0!==i&&c["_"+f](a,b,d,e,h),i}}return c
}({
instrumentationKey: "c0960a0f-30ad-4a9a-b508-14c6a4f61179",
cookieDomain: ".parliament.uk"
});
window.appInsights=appInsights,appInsights.queue&&0===appInsights.queue.length&&appInsights.trackPageView();
appInsights.queue.push(function () {
appInsights.context.addTelemetryInitializer(function (envelope) {
envelope.tags["ai.operation.id"] = "AIOPERATIONID";
});
});
</script>
</head>
<body>
<div id="gui"></div>
<script>
var config = {
yasqe: {
sparql: {
endpoint: "https://api.parliament.uk/sparql",
acceptHeaderGraph: "application/rdf+json"
}
},
yasr: {
useGoogleCharts: false
}
};
// Doesn't seem to work: YASGUI.YASQE.Autocompleters.prefixes.fetchFrom = "https://gist.githubusercontent.com/matthieubosquet/b100f58f9f99cc956cf85f950bb9f9a1/raw/17da6f5d6d58fcfd2aff131d547ea2aad7fd9e6b/prefixes.json";
let yasgui = YASGUI(document.getElementById("gui"), config);
document.querySelector('[role="addTab"]').addEventListener("click", addPrefixes);
let currentUrl = new URL(window.location);
if (currentUrl.searchParams.get("query") !== null) {
addPrefixes();
}
function addPrefixes() {
yasgui.current().yasqe.addPrefixes({"id": "https://id.parliament.uk/", "": "https://id.parliament.uk/schema/"});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment