1function citation_tool(url, cite_id) { 2 // Modal part 3 $('#citation_modal_table tbody').empty(); 4 var modal = document.getElementById('citation-tool'); 5 var span = document.getElementById("close-citation"); 6 modal.classList.add("modal"); 7 setTimeout(function(){ 8 modal.style.display = "block"; 9 }, 200) 10 11 span.onclick = function() { 12 modal.style.display = "none"; 13 $(".article_option").remove(); 14 $(".article").remove(); 15 $(".cite-submenu").remove(); 16 } 17 window.onclick = function(event) { 18 if (event.target == modal) { 19 modal.style.display = "none"; 20 $(".article_option").remove(); 21 $(".article").remove(); 22 $(".cite-submenu").remove(); 23 } 24 } 25 26 // Process location 27 var this_site = parse_url_long(url); 28 var highlight_main = false; 29 if (window.location.pathname==='/') { 30 highlight_main = true 31 } 32 33 // AJAX to create citation list 34 var dropdown_articles = document.getElementById("dropdown_articles"); 35 var article_list = document.getElementById("article_list"); 36 var env = url.split('//')[1].split('/')[0]; 37 var main_ref_id = []; 38 var cit_request = new XMLHttpRequest(); 39 var domains = ["gpcrdb.org", "gproteindb.org", "arrestindb.org", "biasedsignalingatlas.org"]; 40 var filter_for = false; 41 let cite_id_missing = typeof cite_id === "undefined"; 42 if ((cite_id_missing && env==="gpcrdb.org") || cite_id==="cite_gpcrdb") { 43 filter_for = "gpcrdb"; 44 } 45 if ((cite_id_missing && env==="gproteindb.org") || cite_id==="cite_gproteindb") { 46 filter_for = "gproteindb"; 47 } 48 if ((cite_id_missing && env==="arrestindb.org") || cite_id==="cite_arrestindb") { 49 filter_for = "arrestindb"; 50 } 51 if ((cite_id_missing && env==="biasedsignalingatlas.org") || cite_id==="cite_biasedsignalingatlas") { 52 filter_for = "biasedsignalingatlas"; 53 } 54 55 cit_request.open('GET', url.split('/')[0] + '/citations'); 56 cit_request.onload = function() { 57 var data = JSON.parse(cit_request.responseText) 58 for (let i = 0; i < data.length; i++) { 59 var link = ""; 60 if (!domains.includes(env)) { 61 link = "/" + data[i][0].split("//")[1].split("/").slice(1).join("/"); 62 } 63 else { 64 link = data[i][0]; 65 } 66 if (link[link.length-1]==='/') { 67 link = link.substring(0, link.length-1); 68 } 69 if (link==='/GPCR-Gprotein_Mutations.xlsx') { 70 link = 'https://files.gpcrdb.org/GPCR-Gprotein_Mutations.xlsx' 71 } 72 else if (link==='/mutations.html#mutation-data-submission') { 73 link = 'https://docs.gpcrdb.org/mutations.html#mutation-data-submission' 74 } 75 if ($('a[href="'+link+'"]').first().parent().parent().parent().first().hasClass('dropdown-submenu')) { 76 data[i].push($('a[href="'+link+'"]').first().parent().parent().parent().parent().parent().first().find(">:first-child").text().trim()); 77 } 78 else { 79 if (link==="/protein/ste2_yeast") { 80 data[i].push("GPCRdb"); 81 } 82 else { 83 data[i].push($('a[href="'+link+'"]').first().parent().parent().parent().first().find(">:first-child").text().trim()); 84 } 85 } 86 } 87 // Create HTML once per call 88 var articles = {}; 89 var tags = []; 90 for (let i = 0; i < data.length; i++) { 91 if (data[i][11]==='') { 92 continue; 93 } 94 if (filter_for==="gpcrdb" && data[i][11]!=="GPCRdb") { 95 continue; 96 } 97 else if (filter_for==="gproteindb" && data[i][11]!=="GproteinDb" && data[i][7]===2022) { 98 continue; 99 } 100 else if (filter_for==="arrestindb" && data[i][11]!=="ArrestinDb") { 101 continue; 102 } 103 else if (filter_for==="biasedsignalingatlas" && data[i][11]!=="Biased Signaling Atlas") { 104 continue; 105 } 106 else if (filter_for==="arrestindb" && data[i][11]==="ArrestinDb") { 107 data[i][5] = "The arrestin database, ArrestinDb"; 108 data[i][6] = "Jimmy Caroli, Gáspár Pándy-Szekeres, Alexander S. Hauser, György M. Keserű, Albert J. Kooistra and David E. Gloriam"; 109 data[i][7] = 2022; 110 data[i][8] = ""; 111 data[i][9] = "Manuscript"; 112 data[i][10] = ""; 113 } 114 else if (filter_for==="biasedsignalingatlas" && data[i][11]==="Biased Signaling Atlas") { 115 data[i][5] = "A community Biased Signaling Atlas"; 116 data[i][6] = "Jimmy Caroli, Alibek Mamyrbekov, Kasper Harpsøe, Sahar Gardizi, Linda Dörries, Eshan Ghosh, Alexander S. Hauser, Albert J. Kooistra, and David E. Gloriam"; 117 data[i][7] = 2023; 118 data[i][8] = "19, 531â535"; 119 data[i][9] = "Nature Chemical Biology"; 120 data[i][10] = "https://doi.org/10.1038/s41589-023-01292-8"; 121 } 122 var site = parse_url_long(data[i][0]); 123 tags.push(site); 124 // Dropdown menus 125 var a_sub, submenu, submenu_ul; 126 if (document.getElementById(data[i][11])===null) { 127 submenu = document.createElement("li"); 128 submenu.setAttribute("id", data[i][11]); 129 submenu.classList.add("dropdown-submenu"); 130 submenu.classList.add("cite-submenu"); 131 a_sub = document.createElement("a"); 132 a_sub.innerHTML = data[i][11]; 133 a_sub.setAttribute('tabindex', '0'); 134 submenu.appendChild(a_sub); 135 submenu_ul = document.createElement("ul"); 136 submenu_ul.classList.add('dropdown-menu'); 137 submenu_ul.classList.add('dropdown-auto-overflow') 138 submenu.appendChild(submenu_ul); 139 } 140 else { 141 submenu = document.getElementById(data[i][11]) 142 submenu_ul = submenu.getElementsByTagName('ul')[0]; 143 } 144 145 // Dropdown options 146 var option = document.createElement("li"); 147 var option_link = document.createElement("a"); 148 option_link.innerHTML = data[i][4]; 149 option_link.classList.add("article_option"); 150 option.appendChild(option_link); 151 option.setAttribute("id", site.replace('#', '_').replace('.', '_')); 152 option.setAttribute("role", "button"); 153 154 if (site===this_site) { 155 option.setAttribute("selected", "selected"); 156 $('#page_select_button').html(data[i][4]); 157 } 158 159 submenu_ul.appendChild(option); 160 dropdown_articles.appendChild(submenu); 161 162 // Reformat data 163 if (!(data[i][5] in articles)) { 164 articles[data[i][5]] = {'tools':{}}; 165 articles[data[i][5]]['tools'][site] = option.innerHTML; 166 articles[data[i][5]]['main'] = data[i][3]; 167 articles[data[i][5]]['authors'] = data[i][6]; 168 articles[data[i][5]]['year'] = data[i][7]; 169 articles[data[i][5]]['reference'] = data[i][8]; 170 articles[data[i][5]]['journal'] = data[i][9]; 171 articles[data[i][5]]['doi'] = data[i][10]; 172 articles[data[i][5]]['menu'] = data[i][11]; 173 if (data[i][3] === "GPCRdb" || data[i][3] === "GproteinDb") { 174 main_ref_id.push(site); 175 } 176 } 177 else { 178 articles[data[i][5]]['tools'][site] = option.innerHTML; 179 if (data[i][3]=="GPCRdb" || data[i][3]=="GproteinDb") { 180 main_ref_id.push(site); 181 } 182 } 183 } 184 185 // Create HTML 186 for (var key in articles) { 187 var main_ref = false 188 var entry = document.createElement("ul"); 189 entry.setAttribute("id", articles[key]['doi']); 190 var entry_holder = document.createElement("div"); 191 var tools_list = document.createElement("div"); 192 // Loop through tools list to add them with ID 193 var selected = false;
194 for (var tool_key in articles[key]['tools']) { 195 if (tool_key===this_site) { 196 selected = true; 197 } 198 var tool = document.createElement("div"); 199 tool.innerHTML = articles[key]['tools'][tool_key].bold(); 200 tool.setAttribute("id", tool_key.replace('#', '_').replace('.', '_')+'_tag'); 201 tool.style.display = 'none'; 202 tools_list.appendChild(tool); 203 // var separator = document.createElement("div"); 204 // separator.innerHTML = '\u00A0•\u00A0'; 205 // separator.style.display = 'inline-block'; 206 // tools_list.appendChild(separator); 207 if (main_ref_id.includes(tool_key)) { 208 main_ref = true; 209 } 210 } 211 // tools_list.removeChild(tools_list.lastChild); 212 tools_list.style.display = 'block'; 213 214 var ref = document.createElement("div"); 215 var p = document.createElement("p"); 216 var d1 = document.createElement("div"); 217 var d2 = document.createElement("div"); 218 var d3 = document.createElement("div"); 219 d1.innerHTML = key; 220 d2.innerHTML = articles[key]['authors']; 221 222 // Link 223 var a = document.createElement("a"); 224 a.innerHTML = articles[key]['journal'].italics() + ", " + articles[key]['year'] + ", " + articles[key]['reference']; 225 a.title = key; 226 a.href = "https://doi.org/"+articles[key]['doi']; 227 a.target = "_blank"; 228 d3.appendChild(a); 229 p.appendChild(d1); 230 p.appendChild(d2); 231 p.appendChild(d3); 232 ref.appendChild(p); 233 ref.style.display = 'block'; 234 235 entry_holder.appendChild(tools_list); 236 entry_holder.appendChild(ref); 237 entry.appendChild(entry_holder); 238 entry.classList.add('article'); 239 if (selected) { 240 entry.classList.add('highlight_reference'); 241 } 242 if (main_ref) { 243 var main_ref_list = document.getElementById("main_reference"); 244 245 main_ref_list.appendChild(entry); 246 } 247 else { 248 article_list.appendChild(entry); 249 } 250 } 251 if (env=="gproteindb.org") { 252 main_ref_id = main_ref_id[0]; 253 } 254 else { 255 main_ref_id = main_ref_id[1]; 256 } 257 /*var color = "#BE00BE"; 258 if (filter_for==="gproteindb") { 259 color = "#F46615"; 260 } 261 else if (filter_for==="arrestindb") { 262 color = "#55AE35"; 263 } 264 $(".article").first().css("border-top","4px solid "+color);*/ 265 // $(".article").eq(1).css("border-top","4px solid #BE00BE"); 266 if (highlight_main || $('.highlight_reference').length==0) { 267 highlight_article(main_ref_id); 268 $('#dropdown_articles option#'+main_ref_id).attr('selected', 'selected'); 269 } 270 }; 271 cit_request.send(); 272} 273 274function highlight_article(key) { 275 $('.highlight_reference').removeClass('highlight_reference'); 276 $('#'+key+'_tag').parent().parent().parent().addClass('highlight_reference'); 277} 278 279function parse_url(url) { 280 var url_split = url.split('/'); 281 if (url_split[url_split.length-1]==="") { 282 var this_site = url_split[url_split.length-2]; 283 if (this_site==='targetselection') { 284 this_site = url_split[url_split.length-3]+'-'+this_site; 285 } 286 } 287 else { 288 var this_site = url_split[url_split.length-1]; 289 if (this_site==='targetselection') { 290 this_site = url_split[url_split.length-2]+'-'+this_site; 291 } 292 } 293 return this_site 294} 295 296function parse_url_long(url) { 297 var url_split = url.split('/'); 298 if (url_split[url_split.length-1]==="") { 299 if (url_split.length>5) { 300 return url_split[3]+"-"+url_split[4]; 301 } 302 else { 303 return url_split[3]; 304 } 305 } 306 else if (url_split.length===4) { 307 return url_split[3]; 308 } 309 else { 310 return url_split[3]+"-"+url_split[4]; 311 } 312} 313 314function toggle_widget() { 315 $("#ref_widget").animate({width: "toggle"}); 316 if ($("#widget_chevron").hasClass("glyphicon glyphicon-chevron-left")) { 317 $("#widget_chevron").removeClass("glyphicon glyphicon-chevron-left"); 318 $("#widget_chevron").addClass("glyphicon glyphicon-chevron-right"); 319 $("#widget_infosign").show(); 320 } 321 else { 322 $("#widget_chevron").removeClass("glyphicon glyphicon-chevron-right"); 323 $("#widget_chevron").addClass("glyphicon glyphicon-chevron-left"); 324 $("#widget_infosign").hide(); 325 setTimeout(function() { 326 $("#ref_widget").animate({width: "toggle"}); 327 $("#widget_chevron").removeClass("glyphicon glyphicon-chevron-left"); 328 $("#widget_chevron").addClass("glyphicon glyphicon-chevron-right"); 329 $("#widget_infosign").show(); 330 }, 8000) 331 } 332} 333 334async function check_for_video(url) { 335 var this_site = parse_url_long(url); 336 var cit_request = new XMLHttpRequest(); 337 cit_request.open('GET', url.split('/')[0] + '/citations'); 338 cit_request.onload = function() { 339 var data = JSON.parse(cit_request.responseText) 340 var video = false;
341 for (i = 0; i < data.length; i++) { 342 var site = parse_url_long(data[i][0]); 343 if (site===this_site && data[i][1]!=null) { 344 video = data[i][1]; 345 $('#icon_video').attr('href', video); 346 $('#icon_video').css('display','inline'); 347 } 348 } 349 } 350 cit_request.send(); 351}
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.