1/** 2 * Define Javascript function for refreshing attachments lists 3 * 4 * Copyright (C) 2010-2016 Jonathan M. Cameron, All Rights Reserved 5 * License: http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL 6 * 7 * By Jonathan Cameron 8 * 9 * @param siteURL string the site base URL for the request 10 * @param ptype string parent_type for the attachments list parent 11 * @param pentity string parent_entity for the attachments list parent 12 * @param pid integer parent_id for the attachments list parent 13 * @param lang the current language ('' if not specified) 14 * @param from string the 'from' clause to pass in the request 15 */ 16 17function refreshAttachments(siteUrl, ptype, pentity, pid, lang, from) { 18 let id = "attachmentsList_" + ptype + "_" + pentity + "_" + pid, 19 alist = document.getElementById(id), 20 url = `${siteUrl}/index.php?option=com_attachments&task=attachmentsList`; 21 url += `&parent_id=${pid}`; 22 url += `&parent_type=${ptype}&parent_entity=${pentity}`; 23 url += `&lang=${lang}`; 24 url += `&from=${from}&tmpl=component&format=raw`; 25 if (!alist) { 26 alist = window.parent.document.getElementById(id); 27 } 28 if (!alist) { 29 id = "attachmentsList_" + ptype + "_default_" + pid; 30 alist = window.parent.document.getElementById(id); 31 } 32 fetch(new Request(url, {method: "GET"})) 33 .then(function(response) { 34 if (response.status == 200) { 35 return response.text(); 36 } else { 37 return Promise.reject(response); 38 } 39 }) 40 .then(html => { 41 alist.innerHTML = html; 42 }) 43 .catch(reason => console.log(reason)); 44}; 45 46
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.