PageSourceSearch

https://retinalphysician.com/scripts/ContextualAI2.js

js retinalphysician.com collected 2026-09-24 18:59:45 UTC 2,140 bytes, 63 lines download raw bytes

1function matchCurrentPage(mediumId) {
2    fetch('https://contextualaiapi.azurewebsites.net/api/v1/match', {
3      method: 'POST',
4      headers: { 'Content-Type': 'application/json' },
5      body: JSON.stringify({
6        url: window.location.href,
7        mediumId: mediumId
8      })
9    })
10    .then(function(r) { return r.json(); })
11    .then(function(data) {
12      if (data.isMatch) {
13        console.log('Matched topic:', data.matchedTopicName, '| TopicId:', data.topicId);
14        
15        return data.matchedTopicName;
16        
17      } else if (!data.isIndexed) {
18        console.log('Article Not Indexed');
19        
20        return 'Article Not Indexed';
21      } else {
22        console.log('No topic match for this page');
23        
24        return '';
25      }
26    })
27    .catch(function(err) { console.error('Match failed:', err); });
28    
29    return 'Unknown';
30  }
31                
32function analyzeCurrentPage(publicationName, apiKey) {
33    
34    // Extract title: text content from all <h1> tags
35    var h1Elements = document.querySelectorAll('h1');
36    var title = Array.from(h1Elements)
37      .map(function(el) { return el.textContent.trim(); })
38      .filter(Boolean)
39      .join(' ');
40
41    // Extract plain_text: text content from <article> tags, HTML stripped
42    var articleElements = document.querySelectorAll('article');
43    var plainText = Array.from(articleElements)
44      .map(function(el) { return el.textContent.trim(); })
45      .filter(Boolean)
46      .join('\n');
47
48    fetch('https://contextualaiapi.azurewebsites.net/api/v1/articles/analyze', {
49      method: 'POST',
50      headers: { 'Content-Type': 'application/json' },
51      body: JSON.stringify({
52        url: window.location.href,
53        api_key: apiKey,
54        publication: publicationName,
55        auto_approve: true,
56        title: title || undefined,
57        plain_text: plainText || undefined
58      })
59    })
60    .then(function(r) { return r.json(); console.log('ContextMax Success - ' + r); })
61    .then(function(data) { console.log('ContextMax Analyze result:', data); })
62    .catch(function(err) { console.error('ContextMax Analyze failed:', err); });
63}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.