{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); ' +\n\t\t\t\t\t\t\t\t\t\t\t\t'';\n\t\t\t\t\t\t\tresponse.writeHead(200, {'Content-Type': 'text/html'});\n\t\t\t\t\t\t\tresponse.write(body);\n\t\t\t\t\t\t\tresponse.end();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t}\n });\n });\n}","title":""},{"docid":"f15a5b874c8bfc5dade3723fd67ef0fc","score":"0.53661203","text":"function omdbSearch(urlRef){\n\n request(urlRef, function (error, response, body) {\n\n if(!error && response.statusCode === 200){\n \n console.log('######################################################');\n console.log('#');\n console.log('# ' + JSON.parse(body).Title);\n console.log('#');\n console.log('######################################################');\n console.log('');\n\n console.log('Release Year: ' + JSON.parse(body).Year);\n\n if(JSON.parse(body).Ratings[0].Value){\n console.log('IMDB rating: ' + JSON.parse(body).Ratings[0].Value);\n };\n\n if(JSON.parse(body).Ratings[1].Value){\n console.log('Rotten Tomatoes rating: ' + JSON.parse(body).Ratings[1].Value);\n };\n \n console.log('Produced in: ' +JSON.parse(body).Country);\n console.log('Language: ' + JSON.parse(body).Language);\n console.log('Plot: ' + JSON.parse(body).Plot);\n console.log('Actors: ' + JSON.parse(body).Actors);\n console.log('');\n console.log('######################################################');\n }\n\n if (error || response.statusCode === 400){\n console.log('Whoops, I had an error. Please try again.');\n }\n\n\n });\n}","title":""},{"docid":"ad5fd87b05438751816fd60a3c31e0b3","score":"0.5361512","text":"runSearch(state) {\n let url = getBuildingQueryUrl(state, selectFields);\n if (this.props.admin) {\n url += '&creator=true';\n }\n // add search terms (if any)\n const textSearch = document.querySelector('.building-search').value;\n if (textSearch) url += `fulltext=${encodeURIComponent(textSearch)}`;\n api.get(url, this.processBuildings);\n }","title":""},{"docid":"48a7cc22a4fba5225dfde5090a9e6396","score":"0.53553545","text":"function nct_versearch(pobject)\n{\n\tif(pobject.value.length > 3)\n\t\tnct_searchest();\n}","title":""},{"docid":"715a6454591d2f13bcfb865a67160c21","score":"0.53548956","text":"function searchShows() {\r\n fetch(`//api.tvmaze.com/search/shows?q=${search}`)\r\n .then((response) => {\r\n if (!response.ok) {\r\n throw response;\r\n }\r\n return response.json();\r\n })\r\n .then((data) => {\r\n if (data.length === 0) {\r\n notFound();\r\n } else {\r\n for (let i = 0; i < data.length; i++) {\r\n searchedShows.push(data[i].show);\r\n }\r\n paintShows();\r\n listenSearch();\r\n }\r\n })\r\n .catch((err) => {\r\n serverError(err);\r\n });\r\n}","title":""},{"docid":"f214bc110f8228713528861d0589ecb0","score":"0.5354411","text":"function soundCloudSearch() {\n // Should not be public, but for this website, oh well\n // If we wanted to hide it, we would have done it on server side and hidden it\n SC.initialize({\n client_id: 'bd791d329c430374438075140d3d3163'\n });\n soundCloudMakeRequest();\n}","title":""},{"docid":"5eb1a8ec311bbd33b54d422bf7c9d01c","score":"0.53518075","text":"function doTheSearch() {\n // $('.random').css('display','none');\n $('form').addClass('compact');\n\n var lang = navigator.language.substring(0,2) || \"en\";\n var searchTerm = $('input').val();\n var url = 'https://' + lang + '.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srsearch=' + searchTerm + '&srwhat=text&srinfo=totalhits&srprop=titlesnippet%7Csnippet';\n // empty the page before loading new result\n $('div.results').empty();\n\n // loading jsonp\n $.ajax({\n url:url,\n dataType: \"jsonp\",\n success: function(wikiData) {\n\n if ($('input').val() != '') {\n $('.border').addClass('grow');\n // if loading json successfully, do this:\n var totalHits = wikiData.query.searchinfo.totalhits;\n\n if (totalHits === 0) {\n // if there's no result matched, do this\n // $('form').removeClass('compact');\n $('.border').removeClass('grow');\n $('div.results').addClass('error').html(\"There's no match for \" + searchTerm);\n } else {\n // if there is result, do this\n displayAsHtml(wikiData);\n }\n }\n },\n error: function() {\n // if cannot load json, do this\n alert (\"There's a problem connecting to the server. Please refresh the page and try again.\");\n }\n });\n\n function displayAsHtml(wikiData) {\n /* run each value in the query 'wikiData.query.search'\n i is for index of each object inside 'wikiData.query.search'\n val is the content inside each object 'wikiData.query.search'\n */\n $.each(wikiData.query.search, function(i, val){\n // replace space with _\n\n var url = val.title.replace(/\\s/g, \"_\");\n if ($('div.results').hasClass('error')) {\n $('div.results').removeClass('error');\n }\n $('div.results').append(\n\n '' +\n '' + val.title + '' +\n '' + val.snippet + '' +\n ''\n\n );\n\n })\n }\n}","title":""},{"docid":"adc9ff285fca3fc22c6ddea19f5d72a0","score":"0.5342653","text":"async function getCourses() {\n const pageNumber = 1;\n const pageSize = 10;\n // /api/courses?pageNumber-2&pageSize=10\n const courses = await Course\n // .find({ author: 'Mosh', isPublished: true})\n // .find({ price: { $gte: 10, $lte: 20 } })\n // .find(({ price: { $in: [10, 15, 20] } }))\n .find({author: /^Mosh/}) // start with\n .find({author: /Hamedani$/i}) // end with, i => case insensive\n .find({author: /.*Mosh.*/i}) // include\n .skip((pageNumber - 1) * pageSize)\n .limit(pageSize)\n .or([ { author:'Mosh'}, {isPublished: true} ]) // !! either one of these match \n .sort({ name: 1 })\n .select({ name: 1, tags: 1})\n // .countDocuments()\n console.log(courses);\n \n}","title":""},{"docid":"bbf71a2a1453b95f75c62e3b6358f5d1","score":"0.5338899","text":"function searchOnText(books, searchText) {\n let searchedBooks = [];\n searchText = searchText.toLowerCase();\n for (let b of books) {\n if (b.title.toLowerCase().indexOf(searchText) != -1) {\n searchedBooks.push(b);\n continue;\n }\n if (b.author.toLowerCase().indexOf(searchText) != -1) {\n searchedBooks.push(b);\n continue;\n }\n if (b.details.toLowerCase().indexOf(searchText) != -1) {\n searchedBooks.push(b);\n continue;\n }\n }\n console.log(\"searchedBooks \" + searchedBooks);\n return searchedBooks;\n}","title":""},{"docid":"5eebd2ad574974f770ac1535a6763faa","score":"0.5335644","text":"function C009_Library_Search_SearchO() {\n\tif (!C009_Library_Search_BondageClubInvitationTaken) {\n\t\tC009_Library_Search_CurrentStage = 101;\n\t\tOverridenIntroText = GetText(\"FindO\");\n\t}\n}","title":""},{"docid":"f80f36c938cc7a16916de27c19d6a56c","score":"0.53323567","text":"function getArticle(value){\n var url = \"https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=\" + value + \"&prop=revisions&rvprop=content&format=json\";\n $.get(url,function(json){\n if (json.query.searchinfo.totalhits=== 0){\n html = '';\n $(\".results\").append(html); \n }/*checks if results are more than 1*/\n \n else{\n var results = json.query.search;\n \n/*loop to display results one by one*/ \n for (var result=0; result < results.length;result++){\n \n if (result > 10){break;}/*displays only 10 results*/\n html = '';\n \n$(\".results\").append(html);}\n\n }/*end of if-block*/\n }, 'jsonp');}","title":""},{"docid":"78acf91ee13605d77c64d45be7e46440","score":"0.5329016","text":"function searchWikipedia(text, callback) {\n\n var endpoint = 'https://en.wikipedia.org/w/api.php?callback=?'\n //object with wikipedia query items.\n var query = {\n action: 'query',\n format: 'json',\n list: 'search',\n generator: 'search',\n srsearch: text,\n gsrsearch: text\n }\n // AJAX call to fetch data from wikipedia\n $.getJSON(endpoint, query, callback)\n}","title":""},{"docid":"b7bfb5ca4c96c666dc860ed6d0615f1b","score":"0.5328839","text":"function highlightSearch(page, title, description, keywords) {\n var regex, desc = \"\", matchKey, currPos, repKey;\n frame = '

'+ title +'

';\n for(var src in keywords){\n regex = new RegExp(keywords[src], \"ig\");\n matchKey = description.match(regex);\n if(matchKey !== null){\n for(var i in matchKey) {\n currPos = description.search(matchKey[i]);\n repKey = ''+description.substr(currPos, matchKey[i].length)+'';\n if(desc == \"\")\n desc = description.replace(matchKey[i], repKey);\n else\n desc = desc.replace(new RegExp(matchKey[i], \"g\"), repKey);\n }\n }\n }\n frame += '

'+desc+'

';\n\treturn frame;\n}","title":""},{"docid":"546645e9b2a9820f60b28121a763c320","score":"0.53255075","text":"function search(req, res) {\n\tlet url = omdbUrl + \"&s=\" + req.query.title;\n\trequest(url, function(err, response, body) {\n\t let movies = JSON.parse(body).Search;\n\t if(!movies) {\n\t \tres.json({message: 'No results found'});\n\t } else {\n\t \tres.json(movies);\n\t }\n\t})\n}","title":""},{"docid":"5368f6416e5733663e6004cf579a6a14","score":"0.53208697","text":"function searchAlgolia() {\n const searchValue = searchInput.value.trim();\n if (searchValue.length > 0) {\n document.querySelector('.search-result').style.display = 'block';\n } else {\n emptySearch();\n return;\n }\n\n let perPageCount = 8;\n if (document.querySelector('body').classList.contains('td-searchpage')) {\n perPageCount = 10;\n }\n\n const client = algoliasearch('UMBCUJCBE8', 'e2f160cd7efe96b0ada15fd27f297d66');\n const index = client.initIndex('yugabyte_docs');\n const pageItems = searchURLParameter('page');\n const searchpagerparent = document.querySelector('#pagination-docs');\n const searchOptions = {\n hitsPerPage: perPageCount,\n page: 0,\n filters: 'version:\"preview\"',\n };\n\n if (pageItems && pageItems > 0) {\n searchOptions.page = pageItems - 1;\n }\n\n index.search(searchValue, searchOptions).then(({hits, nbHits, nbPages, page}) => {\n let pagerDetails = {};\n let sectionHTML = '';\n sectionHTML += docsSection(hits);\n if (hits.length > 0) {\n document.getElementById('doc-hit').innerHTML = sectionHTML;\n } else {\n document.getElementById('doc-hit').innerHTML = '
  • 0 results found for \"' + searchValue + '\"
  • ';\n }\n\n if (document.querySelector('body').classList.contains('td-searchpage')) {\n pagerDetails = {\n currentPage: page + 1,\n pagerId: 'pagination-docs',\n pagerType: 'docs',\n totalHits: nbHits,\n totalPages: nbPages,\n };\n\n searchPagination(pagerDetails);\n searchpagerparent.className = 'pager results-' + nbHits;\n } else {\n searchpagerparent.className = 'pager results-' + nbHits;\n let viewAll = '';\n if (nbPages > 1) {\n viewAll = 'View all results';\n }\n\n document.getElementById('pagination-docs').innerHTML = '';\n }\n });\n }","title":""},{"docid":"573440eba09bce0e6ced6837849ed058","score":"0.5320557","text":"function searchWikiClick(){\n\tif (document.getElementById('searchBox').value!==\"\") {\n\t\tvar search_words = document.getElementById('searchBox').value;\n\t\t//console.log('The search word(s): ' + search_words); // for debugging\n \n if (search_words!==\"\") {\n // search for the search_words\n searchWiki('en.wikipedia.org', search_words, {\n maxResults: 8,\n ssl: true,\n success: successFunction\n });\n }\n\t}\n}","title":""},{"docid":"91e4ec3e6faee4a7aab792ed203dbdef","score":"0.53205127","text":"function grabSearchText(){\n searchTerms = searchBox.value.split(' ').join('%20');\n let bookArr = document.querySelectorAll('.book');\n bookArr.forEach(book => resultShelf.removeChild(book));\n}","title":""},{"docid":"4419184eda0880f4f5daa63af8a10165","score":"0.53203017","text":"function C009_Library_Search_Run() {\n\tBuildInteraction(C009_Library_Search_CurrentStage);\n}","title":""},{"docid":"a830b088b13e8f2fc53772f246867b33","score":"0.53200364","text":"function doSearchCreator() { doSearch('creatordesc'); }","title":""},{"docid":"34a66e294fcb8701ed6551197c475b85","score":"0.5317199","text":"function whatItSays(search) {\n // read .txt file and set the parameter to input to the spotify API\n fs.readFile('random.txt', 'utf8', function(error, data) {\n if ( error ) {\n return console.log(error)\n }\n let arg = data.split(',')[1]\n song(arg)\n })\n}","title":""},{"docid":"bab0d8ecb2f3dc5856fd3af07bb468d5","score":"0.5316222","text":"function C009_Library_Search_SearchDesk() {\n\tif (!C009_Library_Library_FoundKey) {\n\t\tC009_Library_Library_FoundKey = true;\n\t\tOverridenIntroText = GetText(\"FindKey\");\n\t}\n}","title":""},{"docid":"214f6240687b15f86d7c924b0ec512c7","score":"0.53129977","text":"function onYouTubeApiLoad() {\n // This API key is intended for use only in this lesson.\n // See http://goo.gl/PdPA1 to get a key for your own applications.\n gapi.client.setApiKey('AIzaSyCR5In4DZaTP6IEZQ0r1JceuvluJRzQNLE');\n\n \n\n // var arrayLength = songs.length;\n\t\n\t// for (var i = 0; i < arrayLength; i++) {\n\t// var raw = songs[i];\n\t// var clean = raw.replace(/\\W/g, '');\n\n // search(clean);\n\t// }\n\n\n // search(\t\"Thrift Shop Macklemore and Ryan Lewis featuring Wanz\");\n \t searchNext();\n}","title":""},{"docid":"2822c12095128adac39b24103c606a2c","score":"0.5311583","text":"function search(keyword) {\n if (keyword.length > 0) {\n $(\"#suggestedBookList .book\").hide();\n $(\"#suggestedBookList .book:contains(\" + keyword + \")\").show();\n } else\n $(\"#suggestedBookList .book\").show();\n}","title":""},{"docid":"352e32b937fa3fb526c8f0f287d29c50","score":"0.5311416","text":"function search() {\n let searchWords = document.getElementById('search-box').value;\n if (searchWords.trim().length == 0) return;\n let url = '/search/' + searchWords;\n request('GET', url, function () {\n if (this.readyState == 4 && this.status == 200) {\n let response = JSON.parse(this.responseText);\n document.getElementById('main-container').innerHTML = response.body;\n document.title = response.title;\n }\n });\n }","title":""},{"docid":"f4d8253816ee2112c303471b6c666f45","score":"0.5307896","text":"function onYouTubeApiLoad() {\n // This API key is intended for use only in this lesson.\n // See http://goo.gl/PdPA1 to get a key for your own applications.\n gapi.client.setApiKey('AIzaSyCBzjxLmrI6-HCQbaKbyWkBQuplm2ESpCU');\n\n \n\n // var arrayLength = songs.length;\n\t\n\t// for (var i = 0; i < arrayLength; i++) {\n\t// var raw = songs[i];\n\t// var clean = raw.replace(/\\W/g, '');\n\n // search(clean);\n\t// }\n\n\n // search(\t\"Thrift Shop Macklemore and Ryan Lewis featuring Wanz\");\n \t searchNext();\n}","title":""},{"docid":"f4d8253816ee2112c303471b6c666f45","score":"0.5307896","text":"function onYouTubeApiLoad() {\n // This API key is intended for use only in this lesson.\n // See http://goo.gl/PdPA1 to get a key for your own applications.\n gapi.client.setApiKey('AIzaSyCBzjxLmrI6-HCQbaKbyWkBQuplm2ESpCU');\n\n \n\n // var arrayLength = songs.length;\n\t\n\t// for (var i = 0; i < arrayLength; i++) {\n\t// var raw = songs[i];\n\t// var clean = raw.replace(/\\W/g, '');\n\n // search(clean);\n\t// }\n\n\n // search(\t\"Thrift Shop Macklemore and Ryan Lewis featuring Wanz\");\n \t searchNext();\n}","title":""},{"docid":"f4d8253816ee2112c303471b6c666f45","score":"0.5307896","text":"function onYouTubeApiLoad() {\n // This API key is intended for use only in this lesson.\n // See http://goo.gl/PdPA1 to get a key for your own applications.\n gapi.client.setApiKey('AIzaSyCBzjxLmrI6-HCQbaKbyWkBQuplm2ESpCU');\n\n \n\n // var arrayLength = songs.length;\n\t\n\t// for (var i = 0; i < arrayLength; i++) {\n\t// var raw = songs[i];\n\t// var clean = raw.replace(/\\W/g, '');\n\n // search(clean);\n\t// }\n\n\n // search(\t\"Thrift Shop Macklemore and Ryan Lewis featuring Wanz\");\n \t searchNext();\n}","title":""},{"docid":"f4d8253816ee2112c303471b6c666f45","score":"0.5307896","text":"function onYouTubeApiLoad() {\n // This API key is intended for use only in this lesson.\n // See http://goo.gl/PdPA1 to get a key for your own applications.\n gapi.client.setApiKey('AIzaSyCBzjxLmrI6-HCQbaKbyWkBQuplm2ESpCU');\n\n \n\n // var arrayLength = songs.length;\n\t\n\t// for (var i = 0; i < arrayLength; i++) {\n\t// var raw = songs[i];\n\t// var clean = raw.replace(/\\W/g, '');\n\n // search(clean);\n\t// }\n\n\n // search(\t\"Thrift Shop Macklemore and Ryan Lewis featuring Wanz\");\n \t searchNext();\n}","title":""},{"docid":"14e97fa4e3c6e91b2db439324c98c2b2","score":"0.5307799","text":"function booksByTitle(searchTerm) { \n let encodedSearchTerm = encodeURIComponent(searchTerm);\n let searchUrl = 'https://infinite-river-85875.herokuapp.com/getbooks/byTitle/' + encodedSearchTerm; \n $.getJSON(searchUrl, function (response) {\n let searchedBooksInLibrary = response.map((item, response) => drawSearchRow(item));\n });\n}","title":""},{"docid":"38ccc01487449abf5f9eb43e9e0b9af8","score":"0.53055143","text":"function demoDiseasePage(disease_id) {\n\n var e = new bbop.monarch.Engine();\n var info = e.fetchDiseaseInfo(disease_id); \n\n var synBlock = '';\n if (info.has_exact_synonym != null) {\n synBlock = info.has_exact_synonym.map( function(s) {return
  • {s}
  • } ).join(\"\\n\");\n }\n\n textDescription = function() {\n var content = <>;\n if (info.comments != null && info.comments[0] != null) {\n content += {info.comments[0]};\n }\n return content; \n };\n\n liSynonyms = function() {\n var content = <>;\n if (info.has_exact_synonym != null) {\n for each (var s in info.has_exact_synonym) {\n content +=
  • {s}
  • ;\n }\n }\n return content; \n };\n\n trPhenotypes = function() {\n var content = <>;\n if (info.phenotype_associations != null) {\n content += spanJSON(info.ohenotype_associations);\n for each (var a in info.phenotype_associations) {\n content += \n \n {a.disease.id}\n {a.disease.label}\n {a.onset}\n {a.frequency}\n {a.phenotype.id}\n {a.phenotype.label}\n SOURCE: {a.source}\n ;\n }\n }\n return content; \n };\n\n trGenes = function() {\n var content = <>;\n if (info.gene_associations != null) {\n content += spanJSON(info.gene_associations);\n for each (var a in info.gene_associations) {\n content += \n \n {a.disease.id}\n {a.disease.label}\n {a.inheritance}\n {a.gene.id}\n {a.gene.label}\n SOURCE: {a.source}\n ;\n }\n }\n return content; \n };\n\n trAlleles = function() {\n var content = <>;\n if (info.alleles != null) {\n content += spanJSON(info.alleles);\n for each (var a in info.alleles) {\n content += \n \n {a.disease.id}\n {a.disease.label}\n {a.allele.id}\n {a.allele.link}\n {a.allele.mutation}\n {a.allele.label}\n SOURCE: {a.source}\n ;\n }\n }\n return content; \n };\n\n trModels = function() {\n var content = <>;\n if (info.models != null) {\n content += spanJSON(info.models);\n for each (var a in info.models) {\n content += \n \n {a.disease.id}\n {a.disease.label}\n {a.type.label}\n {a.model.id}\n {a.model.label}\n {a.model.type.label} / {a.model.type.parent}\n {a.model.taxon.label}\n SOURCE: {a.source}\n ;\n }\n }\n return content; \n };\n\n // add json blob for debugging purposes\n spanJSON = function(obj) {\n var s = JSON.stringify(obj);\n return {s};\n }\n\n \n var html =\n\n \n \n\n Monarch Disease: {info.label} \n \n \n

    {info.label}

    \n
    { textDescription() }
    \n\n
    \n Also known as...\n
    \n
    \n Synonyms\n
      {liSynonyms()}
    \n
    \n
    \n
    \n\n\n
    \n Phenotypes\n
    \n
    \n Human\n {trPhenotypes()}
    \n
    \n
    \n Non-Human (TODO)\n
    \n
    \n
    \n\n
    \n Genes\n
    \n
    \n Human\n {trGenes()}
    \n
    \n
    \n Non-Human (TODO)\n
    \n
    \n
    \n\n
    \n Alleles\n
    \n
    \n Human\n {trAlleles()}
    \n
    \n
    \n Non-Human (TODO)\n
    \n
    \n
    \n\n\n
    \n Models\n
    \n
    \n Human\n {trModels()}
    \n
    \n
    \n \n
    \n
    \n
    \n\n \n\n;\n\n return html;\n}","title":""},{"docid":"93064afd8dce79a74a92c7bcf842913f","score":"0.5296689","text":"function searchAPI(city) {\n let cityJSON = {\n \"city\" : city,\n \"mood\" : 0,\n \"positiveArticles\" : [],\n \"negativeArticles\" : [],\n };\n newsapi.v2.everything({\n sources: 'cnn, fox-news, the-washington-post, the-wall-street-journal, ' +\n 'business-insider, bloomberg, breitbart-news, buzzfeed, abc-news, cbs-news, cnbc, daily-mail,' +\n 'entertainment-weekly, fortune, independent, msnbc, mtv-news, nbc-news, reuters, newsweek, the-american-conservative, ' +\n 'the-hill, the-huffington-post, the-new-york-times, the-telegraph, the-washington-times, time, usa-today, vice-news',\n q: city,\n from: '2018-05-01',\n to: '2018-05-01',\n language: 'en',\n sortBy: 'relevancy',\n }).then(response => {\n for (let i = 0; i < 20; i++) {\n try {\n let score = 0;\n let titleWords = response.articles[i].title.toLowerCase().split(\" \");\n let descriptionWords = response.articles[i].description.toLowerCase().split(\" \");\n let words = titleWords.concat(descriptionWords);\n for (let j = 0; j < words.length; j++) {\n for (let k = 0; k < Data.PositiveWords.length; k++) {\n if (words[j] === Data.PositiveWords[k]) {\n score++;\n }\n }\n for (let k = 0; k < Data.NegativeWords.length; k++) {\n if (words[j] === Data.NegativeWords[k]) {\n score--;\n }\n }\n }\n if (score >= 0) {\n cityJSON.positiveArticles.push({\n \"title\": response.articles[i].title,\n \"description\": response.articles[i].description\n });\n } else {\n cityJSON.negativeArticles.push({\n \"title\": response.articles[i].title,\n \"description\": response.articles[i].description\n });\n }\n console.log(score);\n cityJSON.mood += score;\n } catch (e) {\n console.log('error');\n }\n }\n console.log(cityJSON);\n return cityJSON;\n });\n}","title":""},{"docid":"bd9e64347b0db1e1de07556298a9a360","score":"0.52961206","text":"function searchBookIsbn() {\n let apiQuery = {\n q: searchTerm,\n key: 'AIzaSyD7XwCHKgHcFqBw4S0EGu4RQi4lMcJjrrc'\n }\n $.getJSON(\"https://www.googleapis.com/books/v1/volumes\", apiQuery, function(data) {\n let getData = data.items;\n if (getData != undefined) {\n return getData.map(function(data) {\n bookTitle = data.volumeInfo.title;\n searchTerm = bookTitle;\n bookAuthor = data.volumeInfo.authors[0];\n searchIsbnByTitle();\n });\n } else {\n $('.js-danger').fadeIn('slow').delay(1000).fadeOut('slow');\n }\n });\n}","title":""},{"docid":"2be999812e6a594037ced7a59ddb8b8f","score":"0.5290413","text":"function searchFunctionality() {\n const resultsFound = getResults();\n const message = document.getElementById(\"sorry\");\n if (message) {\n pageDiv.removeChild(message);\n }\n if (resultsFound.length === 0) {\n const notFoundMessage = document.createElement(\"p\");\n notFoundMessage.textContent = \"Sorry, no results found.\";\n notFoundMessage.id = \"sorry\";\n pageDiv.appendChild(notFoundMessage);\n }\n pageDiv.removeChild(document.getElementsByClassName(\"pagination\")[0]);\n showPage(resultsFound, 1);\n appendPages(resultsFound);\n}","title":""},{"docid":"07ee7ae1d1008ba9d93124f9d2ef318d","score":"0.5276494","text":"function doSearch(url) {\n\t$.getJSON(url, function(data) {\n\t\tvar photos = data.photos;\n\t\tvar photolist = [];\n\n\t\t$.each(photos.photo, function(idx, photo) {\n\n\t\t\tvar purl = 'http://farm' + photo.farm + '.staticflickr.com/' + photo.server + '/' + photo.id + '_' + photo.secret + '_m.jpg';\n\n\t\t\tvar phtml = '';\n\t\t\tphtml += '\"'';\n\t\t\tphtml += '';\n\n\t\t\tphotolist.push(phtml);\n\t\t});\n\n\t\t$('#photos').html(photolist.join(''));\n\t\t$('#pcount').html(photos.total);\n\n\t\tgeneratePageIndex(photos.total, photos.pages, photos.page);\n\t});\n}","title":""},{"docid":"3251f3504801dc8fdbf95e0d5e96ae71","score":"0.5274219","text":"async searchByTitle( title ) {\n\n return films.find( { title } );\n \n }","title":""},{"docid":"8a2c9995f9c5b57d7ecc8fae56a249c2","score":"0.5271855","text":"async function keyGuardianPersonalityFetch(searchWord) {\n try {\n let searchValue = 'q=' + `${searchWord}`\n const response = await fetch(`${GuardianUrl}${searchValue}${GuardianFields}${GuardianApiKey}`)\n const data = await response.json()\n headlinesArray = data.response.results\n console.log('Guardian_perFacet: ', headlinesArray)\n allNewsCreateDOMnodes()\n } catch (error) {\n console.log(error.message) \n }\n}","title":""},{"docid":"5f6a9847c55f4a050abb794f0472966f","score":"0.52686703","text":"function search() {\t\t\t\t\n\t\t\tconsole.log(vm.apiDomain);\n\t\t\n\t\t\tpageScope.loadingStart();\n\t\t\t\n\t\t\tGOAnnotSearchAPI.search(vm.apiDomain, function(data) {\n\t\t\t\tvm.results = data;\n\t\t\t\tvm.selectedIndex = 0;\n\t\t\t\tif (vm.results.length > 0) {\n\t\t\t\t\tloadObject();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tclear();\n\t\t\t\t}\n\t\t\t\tpageScope.loadingEnd();\n\t\t\t\tsetFocus();\n\t\t\t}, function(err) {\n\t\t\t\tpageScope.handleError(vm, \"API ERROR: GOAnnotSearchAPI.search\");\n\t\t\t\tpageScope.loadingEnd();\n\t\t\t\tsetFocus();\n\t\t\t});\n\t\t}","title":""},{"docid":"47d783e5c708f277a58a1fb73d8906c3","score":"0.5268087","text":"function searchForItem(searchText) {\n console.log(\"Searching for: \" + searchText);\n var bundle = [];\n bundle = exactSearch(searchText); //[0]: plantReference, [1]: page reference\n\n if(bundle == undefined) {\n console.log(\"Exact search for query \" + searchText + \" unsuccessful. Starting approximate search\");\n bundle = approximateSearch(searchText);\n\n if(bundle != undefined) {\n if(bundle.length == 0) {\n console.log(\"There are no matches for search: \" + searchText);\n return [];\n } else {\n return bundle;\n }\n } else {\n console.log(\"ERROR: undefined bundle for search text: \" + searchText);\n }\n } else {\n return bundle;\n }\n}","title":""},{"docid":"b2919343b49b9c11283ef4ca130771a5","score":"0.5267221","text":"function searchShow() {\n\tconsole.log(\"Searching for show\");\n\ttv.findShow(searchQuery);\n}","title":""},{"docid":"657f36cef67787336b89122064315b49","score":"0.5266949","text":"function a(e){\n//initialize current chapter (bookmark button, figures, alerts)\nfunction t(){$(\"#search\").val(\"\").trigger(\"keyup\"),$(\"figure:not(.equation)\").each(function(){var e=$(this).attr(\"data-id\");if($(this).hasClass(\"video\")){$(this).prepend(\"Figure \"+e+\" &mdash; \"),$(this).wrapInner(\"
    \");var t,a=$('