1 | // ==UserScript==
|
---|
2 | // @name Bib Stinky
|
---|
3 | // @namespace http://bibstinky.sowemustthink.space/
|
---|
4 | // @version 0.1
|
---|
5 | // @description Helps identify when metadata stored by a publication provider or agregator might be a bit 'off'
|
---|
6 | // @author David Bainbridge
|
---|
7 | // @author Dave Nichols
|
---|
8 | // @author Mike Twidale
|
---|
9 | // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
|
---|
10 | // @match https://www.cs.waikato.ac.nz/*
|
---|
11 | // @match https://search.crossref.org/*
|
---|
12 | // @grant GM_xmlhttpRequest
|
---|
13 | // @connect localhost
|
---|
14 | // @connect bibstinky.sowemustthink.space
|
---|
15 | // ==/UserScript==
|
---|
16 |
|
---|
17 | //alert("foo");
|
---|
18 |
|
---|
19 | (function() {
|
---|
20 | 'use strict';
|
---|
21 |
|
---|
22 | var $ = window.jQuery;
|
---|
23 |
|
---|
24 | var elmWrapperDiv = document.createElement('div');
|
---|
25 | elmWrapperDiv.id = "doiStinkyBar";
|
---|
26 |
|
---|
27 | $(document).ready(function() {
|
---|
28 | console.log("Adding in <div> to display DOI Stinky bar at top:");
|
---|
29 | elmWrapperDiv.style.width = '100%';
|
---|
30 | //elmWrapperDiv.style.textAlign = 'center';
|
---|
31 | elmWrapperDiv.style.fontFamily = 'sans-serif';
|
---|
32 | elmWrapperDiv.style.backgroundColor = 'wheat';
|
---|
33 |
|
---|
34 | elmWrapperDiv.style.zIndex = '25';
|
---|
35 | elmWrapperDiv.style.position = 'fixed';
|
---|
36 |
|
---|
37 | document.body.insertBefore(elmWrapperDiv, document.body.firstChild);
|
---|
38 |
|
---|
39 | GM_xmlhttpRequest ( {
|
---|
40 | method: 'GET',
|
---|
41 | url: 'https://bibstinky.sowemustthink.space/doi-stinky-bar.html',
|
---|
42 | onload: function (responseDetails) {
|
---|
43 | console.log (
|
---|
44 | "GM_xmlhttpRequest() response is:\n",
|
---|
45 | responseDetails.responseText.substring (0, 80) + '...'
|
---|
46 | );
|
---|
47 |
|
---|
48 | var returned_html_str = responseDetails.responseText;
|
---|
49 | var body_str = returned_html_str.substring(returned_html_str.indexOf("<body>")+6,returned_html_str.indexOf("</body>"))
|
---|
50 | console.log("returned body = " + body_str.substring (0) + '...');
|
---|
51 |
|
---|
52 | var body = $.parseHTML(body_str);
|
---|
53 | $("#doiStinkyBar").append(body);
|
---|
54 | }
|
---|
55 | } );
|
---|
56 | });
|
---|
57 |
|
---|
58 | })();
|
---|