Changeset 36322
- Timestamp:
- 2022-07-28T14:23:14+12:00 (21 months ago)
- Location:
- other-projects/bib-stinky/trunk/nodejs-server/public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
other-projects/bib-stinky/trunk/nodejs-server/public/doi-stinky-bar.html
r36319 r36322 9 9 10 10 <body> 11 <div style="width: 100%; background-color: wheat; padding: 8px; text-align: left;"> 12 <img style="vertical-align: bottom;" alt="DOI Stinky Logo" 13 src="//bib-stinky.so-we-must-think.space/images/doi-stinky-logo-57x61.png" /> 14 <h2 style="display:inline;">DOI-Stinky Investigation Bar</h2> 11 <style> 12 .container { 13 display: flex; 14 flex-direction: row; flex-wrap: nowrap; 15 justify-content: flex-start; align-items: flex-start; 16 width: 100%; padding: 8px; background-color: wheat; 17 } 18 .item-image { } 19 .item-text { flex-grow: 1; padding-left: 8px; padding-right: 8px; } 20 </style> 21 22 <div class="container"> 23 <div class="item-image" style="min-width: 57px; min-height: 61px;"> 24 <img style="width: 57px; height: 61px;" 25 src="//bib-stinky.so-we-must-think.space/images/doi-stinky-logo-57x61.png" 26 title="DOI Stinky Investigation Bar" alt="DOI Stinky logo" /> 27 </div> 28 <div id="doiStinkyInfo" class="item-text"> 29 </div> 15 30 </div> 16 31 </body> -
other-projects/bib-stinky/trunk/nodejs-server/public/doi-stinky.user.js
r36319 r36322 8 8 // @author Mike Twidale 9 9 // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js 10 // @match 11 // @match 12 // @grant 13 // @connect localhost14 // @connect bibstinky.sowemustthink.space10 // @match https://www.cs.waikato.ac.nz/* 11 // @match https://search.crossref.org/* 12 // @grant GM_xmlhttpRequest 13 // @connect bibstinky.sowemustthink.space 14 // @connect bib-stinky.so-we-must-think.space 15 15 // ==/UserScript== 16 16 … … 22 22 var $ = window.jQuery; 23 23 24 var doi_list = []; 25 var doi_pattern = /^http(?:s)?:\/\/doi.org\/(.*)$/i; 26 27 $('a').each(function() { 28 var href=$(this).attr('href'); 29 var doi_pattern_matches = doi_pattern.exec(href); 30 if (doi_pattern_matches != null) { 31 var doi_id = doi_pattern_matches[1]; 32 doi_list.push(doi_id); 33 } 34 }); 35 36 // console.log(doi_list); 37 24 38 var elmWrapperDiv = document.createElement('div'); 25 39 elmWrapperDiv.id = "doiStinkyBar"; 26 40 27 41 $(document).ready(function() { 28 console.log("Adding in <div> to display DOI Stinky bar at top:");42 //console.log("Adding in <div> to display DOI Stinky bar at top:"); 29 43 elmWrapperDiv.style.width = '100%'; 30 44 //elmWrapperDiv.style.textAlign = 'center'; … … 41 55 url: 'https://bibstinky.sowemustthink.space/doi-stinky-bar.html', 42 56 onload: function (responseDetails) { 43 console.log (44 "GM_xmlhttpRequest() response is:\n",45 responseDetails.responseText.substring (0, 80) + '...'46 );47 57 48 49 50 58 var returned_html_str = responseDetails.responseText; 59 var body_str = returned_html_str.substring(returned_html_str.indexOf("<body>")+6,returned_html_str.indexOf("</body>")) 60 //console.log("returned body = " + body_str.substring (0) + '...'); 51 61 52 var body = $.parseHTML(body_str); 53 $("#doiStinkyBar").append(body); 54 } 62 var body = $.parseHTML(body_str); 63 $("#doiStinkyBar").append(body); 64 65 if (doi_list.length > 0) { 66 $('#doiStinkyInfo').append(doi_list.join(",")); 67 } 68 else { 69 $('#doiStinkyInfo').append("No DOIs detected on the page"); 70 } 71 } 55 72 } ); 56 73 });
Note:
See TracChangeset
for help on using the changeset viewer.