1import BaseController from 'common/controllers/base_controller' 2import {FetchUtils} from "common/fetch_utils" 3 4export default class extends BaseController { 5 connect() { 6 this.markConnected() 7 } 8 9 toggle(e) { 10 e.preventDefault() 11 //this should be replaced with turbo code 12 const button = this.element.querySelector('.favourites-button-text') 13 button.classList.toggle('favourited') 14 const favourited = button.classList.contains('favourited') 15 if (favourited) { 16 fetch(this.element.dataset.linkFavouriteUrl, {method: 'post', headers: FetchUtils.csrfHeaders()}) 17 } else { 18 fetch(this.element.dataset.linkUnfavouriteUrl, {method: 'delete', headers: FetchUtils.csrfHeaders()}) 19 } 20 } 21}
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.