contactsPane.js
function (uris) {
        uris.map(function (u) {
          var thing = $rdf.sym(u) // Attachment needs text label to disinguish I think not icon.
          console.log('Dropped on mugshot thing ' + thing) // icon was: UI.icons.iconBase + 'noun_25830.svg'
          if (u.startsWith('http') && u.indexOf('#') < 0) { // Plain document
            // Take a copy of a photo on the web:
            kb.fetcher.webOperation('GET', thing.uri).then(result => {
              let contentType = result.headers.get('Content-Type')
              // let data = result.responseText
              let pathEnd = thing.uri.split('/').slice(-1)[0] // last segment as putative filename
              pathEnd = pathEnd.split('?')[0] // chop off any query params
              result.arrayBuffer().then(function (data) { // read text stream
                if (!result.ok) {
                  complain('Error downloading ' + thing + ':' + result.status)
                  return
                }
                uploadFileToContact(pathEnd, contentType, data)
              })
            })
            return
          } else {
            console.log('Not a web document URI, cannot copy as picture: ' + thing)
          }
          handleDroppedThing(thing)
        })
      }
function (uris) {
        uris.map(function (u) {
          var thing = $rdf.sym(u) // Attachment needs text label to disinguish I think not icon.
          console.log('Dropped on mugshot thing ' + thing) // icon was: UI.icons.iconBase + 'noun_25830.svg'
          if (u.startsWith('http') && u.indexOf('#') < 0) { // Plain document
            // Take a copy of a photo on the web:
            kb.fetcher.webOperation('GET', thing.uri).then(result => {
              let contentType = result.headers.get('Content-Type')
              // let data = result.responseText
              let pathEnd = thing.uri.split('/').slice(-1)[0] // last segment as putative filename
              pathEnd = pathEnd.split('?')[0] // chop off any query params
              result.arrayBuffer().then(function (data) { // read text stream
                if (!result.ok) {
                  complain('Error downloading ' + thing + ':' + result.status)
                  return
                }
                uploadFileToContact(pathEnd, contentType, data)
              })
            })
            return
          } else {
            console.log('Not a web document URI, cannot copy as picture: ' + thing)
          }
          handleDroppedThing(thing)
        })
      }
function ( uris ) { uris . map ( function ( u ) { var thing = $rdf . sym ( u ) // Attachment needs text label to disinguish I think not icon. console . log ( 'Dropped on mugshot thing ' + thing ) // icon was: UI.icons.iconBase + 'noun_25830.svg' if ( u . startsWith ( 'http' ) && u . indexOf ( '#' ) < 0 ) { // Plain document // Take a copy of a photo on the web: kb . fetcher . webOperation ( 'GET' , thing . uri ) . then ( result => { let contentType = result . headers . get ( 'Content-Type' ) // let data = result.responseText let pathEnd = thing . uri . split ( '/' ) . slice ( - 1 ) [ 0 ] // last segment as putative filename pathEnd = pathEnd . split ( '?' ) [ 0 ] // chop off any query params result . arrayBuffer ( ) . then ( function ( data ) { // read text stream if ( ! result . ok ) { complain ( 'Error downloading ' + thing + ':' + result . status ) return } uploadFileToContact ( pathEnd , contentType , data ) } ) } ) return } else { console . log ( 'Not a web document URI, cannot copy as picture: ' + thing ) } handleDroppedThing ( thing ) } ) }
When a set of URIs are dropped on
When a set of URIs are dropped on