Skip to content

Commit 46f087f

Browse files
author
Tim Berners-Lee
committed
standard compliant. Small tweak to chat to allow Enter to send message
1 parent f578db9 commit 46f087f

18 files changed

Lines changed: 1152 additions & 1263 deletions

src/acl-control.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
123123
list += y[i]
124124
}
125125
}
126+
return list
126127
}
127128

128129
var removeAgentFromCombos = function (uri) {
@@ -367,7 +368,6 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
367368
}
368369
}
369370
})
370-
return
371371
} else {
372372
saveAndRestoreUI()
373373
}
@@ -396,7 +396,7 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
396396
return byCombo
397397
} // ACLControlEditable
398398

399-
var renderBox = function() {
399+
var renderBox = function () {
400400
box.innerHTML = ''
401401
UI.acl.getACLorDefault(doc, function (ok, p2, targetDoc, targetACLDoc, defaultHolder, defaultACLDoc) {
402402
var defa = !p2

src/acl.js

Lines changed: 67 additions & 90 deletions
Large diffs are not rendered by default.

src/create.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/* create.js UI to craete new objects in the solid-app-set world
22
**
33
*/
4-
5-
//const SolidTls = require('solid-auth-tls')
6-
const $rdf = require('rdflib')
74
// const error = require('./widgets/error')
8-
const widgets = require('./widgets/index')
5+
// const widgets = require('./widgets/index')
96
// const utils = require('./utils')
107

118
const UI = {
@@ -31,10 +28,10 @@ module.exports = {
3128
** (suppresses asking for a full URI or workspace)
3229
**
3330
*/
34-
function newThingUI(context, panes) {
31+
function newThingUI (context, panes) {
3532
const dom = context.dom
3633
const div = context.div
37-
if (context.me && !context.me.uri) throw new Error ('newThingUI: Invalid userid ' + me)
34+
if (context.me && !context.me.uri) throw new Error('newThingUI: Invalid userid: ' + context.me)
3835

3936
var iconStyle = 'padding: 0.7em; width: 2em; height: 2em;' // was: 'padding: 1em; width: 3em; height: 3em;'
4037
var star = div.appendChild(dom.createElement('img'))
@@ -56,33 +53,35 @@ function newThingUI(context, panes) {
5653
star.setAttribute('style', iconStyle + (visible ? 'background-color: yellow;' : ''))
5754
styleTheIcons(visible ? '' : 'display: none;')
5855
}
59-
var resetIconBar = function(){
60-
visibile = false
56+
/*
57+
var resetIconBar = function () {
58+
var visibile = false
6159
star.setAttribute('style', iconStyle + (visible ? 'background-color: yellow;' : ''))
6260
styleTheIcons('display: none;')
6361
}
62+
*/
6463
star.addEventListener('click', selectNewTool)
6564
var makeNewAppInstance = function (options) {
6665
return new Promise(function (resolve, reject) {
6766
var selectUI, selectUIParent
6867
var callbackWS = function (ws, newBase) {
6968
var newPaneOptions = {
7069
newBase: newBase,
71-
workspace: ws,
70+
workspace: ws
7271
}
7372
for (var opt in options) { // get div, dom, me, folder, pane, refreshTable
7473
newPaneOptions[opt] = options[opt]
7574
}
76-
console.log("newThingUI: Minting new " + newPaneOptions.pane.name + " at " + newPaneOptions.newBase)
75+
console.log('newThingUI: Minting new ' + newPaneOptions.pane.name + ' at ' + newPaneOptions.newBase)
7776
options.pane.mintNew(newPaneOptions)
7877
.then(function (newPaneOptions) {
7978
if (!newPaneOptions || !newPaneOptions.newInstance) {
8079
throw new Error('Cannot mint new - missing newInstance')
8180
}
82-
if (newPaneOptions.folder){
81+
if (newPaneOptions.folder) {
8382
kb.add(newPaneOptions.folder, UI.ns.ldp('contains'), kb.sym(newPaneOptions.newBase),
8483
newPaneOptions.folder.doc()) // Ping the patch system?
85-
if (newPaneOptions.refreshTarget){
84+
if (newPaneOptions.refreshTarget) {
8685
newPaneOptions.refreshTarget.refresh() // Refresh the cntaining display
8786
}
8887
selectUI.parentNode.removeChild(selectUI)
@@ -93,8 +92,8 @@ function newThingUI(context, panes) {
9392
p.innerHTML =
9493
"Your <a target='_blank' href='" + newPaneOptions.newInstance.uri + "'><b>new " + options.noun + '</b></a> is ready to be set up. ' +
9594
"<br/><br/><a target='_blank' href='" + newPaneOptions.newInstance.uri + "'>Go to your new " + options.noun + '.</a>'
96-
//selectUI.parentNode.removeChild(selectUI) // Clean up
97-
selectUIParent.removeChild(selectUI) // Clean up
95+
// selectUI.parentNode.removeChild(selectUI) // Clean up
96+
selectUIParent.removeChild(selectUI) // Clean up
9897
}
9998
selectNewTool() // toggle star to plain and menu vanish again
10099
})
@@ -108,18 +107,18 @@ function newThingUI(context, panes) {
108107
options.appPathSegment = 'edu.mit.solid.pane.' + pa.name
109108
options.noun = pa.mintClass ? UI.utils.label(pa.mintClass) : pa.name
110109

111-
if (!options.folder){ // No folder given? Ask user for full URI
110+
if (!options.folder) { // No folder given? Ask user for full URI
112111
selectUI = UI.authn.selectWorkspace(dom, options, callbackWS)
113112
options.div.appendChild(selectUI)
114113
selectUIParent = options.div
115114
} else {
116-
var gotName = function(ok, name){
117-
if (!ok){
115+
var gotName = function (ok, name) {
116+
if (!ok) {
118117
// selectUIParent.removeChild(selectUI) itremves itself if cancelled
119118
selectNewTool() // toggle star to plain and menu vanish again
120119
} else {
121120
var uri = options.folder.uri
122-
if (!uri.endsWith('/')){
121+
if (!uri.endsWith('/')) {
123122
uri = uri + '/'
124123
}
125124
uri = uri + encodeURIComponent(name) + '/'
@@ -129,7 +128,6 @@ function newThingUI(context, panes) {
129128
selectUI = getNameForm(dom, UI.store, options.noun, gotName)
130129
options.div.appendChild(selectUI)
131130
selectUIParent = options.div
132-
133131
}
134132
})
135133
} // makeNewAppInstance
@@ -190,7 +188,7 @@ function newThingUI(context, panes) {
190188
//
191189
// Used in contacts for new groups, individuals.
192190
//
193-
function getNameForm(dom, kb, classLabel, gotNameCallback) {
191+
function getNameForm (dom, kb, classLabel, gotNameCallback) {
194192
var form = dom.createElement('div') // form is broken as HTML behaviour can resurface on js error
195193
form.innerHTML = '<p>Name of new ' + classLabel + ':</p>'
196194
var namefield = dom.createElement('input')
@@ -213,7 +211,7 @@ function getNameForm(dom, kb, classLabel, gotNameCallback) {
213211
}, false)
214212
form.appendChild(namefield)
215213

216-
var br = form.appendChild(dom.createElement('br'))
214+
form.appendChild(dom.createElement('br'))
217215

218216
var cancel = form.appendChild(dom.createElement('button'))
219217
cancel.setAttribute('type', 'button')

src/iconBase.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Works in FF extension - what about browserify??
33

44
if (module.scriptURI) { // FF extension
5-
module.exports.iconBase = '' +
5+
module.exports.iconBase = '' +
66
module.scriptURI.slice(0, module.scriptURI.lastIndexOf('/')) + '/icons/'
7-
module.exports.originalIconBase = '' +
7+
module.exports.originalIconBase = '' +
88
module.scriptURI.slice(0, module.scriptURI.lastIndexOf('/')) + '/originalIcons/'
99
} else { // Node or browserify
10-
var iconsOnGithub = 'https://linkeddata.github.io/solid-ui/src'
10+
var iconsOnGithub = 'https://linkeddata.github.io/solid-ui/src'
1111

12-
if (typeof $SolidTestEnvironment !== 'undefined' && $SolidTestEnvironment.iconBase ){
12+
if (typeof $SolidTestEnvironment !== 'undefined' && $SolidTestEnvironment.iconBase) {
1313
module.exports.iconBase = $SolidTestEnvironment.iconBase
1414
module.exports.originalIconBase = $SolidTestEnvironment.originalIconBase
1515
} else {

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2121
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
SOFTWARE.
2323
24-
2524
If you would like to know more about the solid Solid project, please see
2625
https://github.com/solid/solid
2726
*/

src/log.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Log of diagnostics -- node module version
22

3+
/* global alert */
34
var wrapper = function () {
45
var logger = {}
56

67
// /////////////////////// Logging
78
//
89
// bitmask levels
9-
var TNONE = 0
10+
// var TNONE = 0
1011
var TERROR = 1
1112
var TWARN = 2
1213
var TMESG = 4
@@ -49,10 +50,12 @@ var wrapper = function () {
4950
}
5051
} else if (typeof console !== 'undefined') { // node.js
5152
console.log(str)
53+
/*
5254
} else {
5355
var f = dump // || print
5456
if (!f) throw new Error('log: No way to output message: ' + str)
5557
f('Log: ' + str + '\n')
58+
*/
5659
}
5760
} // logger.msg
5861

src/matrix.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ module.exports.matrixForQuery = function (dom, query, vx, vy, vvalue, options, w
3737
var header = dom.createElement('tr')
3838
var corner = header.appendChild(dom.createElement('td'))
3939
corner.setAttribute('class', 'MatrixCorner')
40-
// corner.textContent = '*'; // @@ test only
4140
matrix.appendChild(header) // just one for now
4241
matrix.lastHeader = header // Element before data
43-
var headerRows = 1
44-
var headerColumns = 1
4542
var columns = [] // Vector
4643
var rows = [] // Associative array
4744

4845
var setCell = function (cell, x, y, value) {
49-
while(cell.firstChild) { // Empty any previous
46+
while (cell.firstChild) { // Empty any previous
5047
cell.removeChild(cell.firstChild)
5148
}
5249
cell.setAttribute('style', '')
@@ -68,7 +65,7 @@ module.exports.matrixForQuery = function (dom, query, vx, vy, vvalue, options, w
6865
var header = tr.appendChild(dom.createElement('td'))
6966
header.setAttribute('style', 'padding: 0.3em;')
7067
header.textContent = utils.label(y1) // first approximation
71-
if (y1.termType = 'NamedNode') {
68+
if (y1.termType === 'NamedNode') {
7269
kb.fetcher.nowOrWhenFetched(y1.uri.split('#')[0], undefined, function (ok, body, response) {
7370
if (ok) header.textContent = utils.label(y1)
7471
})
@@ -157,9 +154,9 @@ module.exports.matrixForQuery = function (dom, query, vx, vy, vvalue, options, w
157154
}
158155
}
159156

160-
for (var i = 1; i < matrix.children.length; i++) {
157+
for (let i = 1; i < matrix.children.length; i++) {
161158
row = matrix.children[i]
162-
for (var j = 1; j < row.children.length; j++) {
159+
for (let j = 1; j < row.children.length; j++) {
163160
cell = row.children[j]
164161
if (cell.old) {
165162
var y = $rdf.fromNT(row.dataValueNT)
@@ -172,22 +169,22 @@ module.exports.matrixForQuery = function (dom, query, vx, vy, vvalue, options, w
172169
}
173170
}
174171

175-
for (var i = 0; i < matrix.children.length; i++) {
172+
for (let i = 0; i < matrix.children.length; i++) {
176173
row = matrix.children[i]
177174
if (i > 0 && !rowsUsed[row.dataValueNT]) {
178175
delete rows[row.dataValueNT]
179176
matrix.removeChild(row)
180177
} else {
181-
for (var j = row.children.length - 1; j > 0; j--) { // backwards
182-
var cell = row.children[j]
178+
for (var j = row.children.length - 1; j > 0; j--) { // backwards
179+
let cell = row.children[j]
183180
if (!colsUsed[j]) {
184181
row.removeChild(cell)
185182
}
186183
}
187184
}
188185
}
189186
var newcolumns = []
190-
for (var j = 0; j < columns.length; j++) {
187+
for (let j = 0; j < columns.length; j++) {
191188
if (colsUsed[j + 1]) {
192189
newcolumns.push(columns[j])
193190
}
@@ -201,7 +198,9 @@ module.exports.matrixForQuery = function (dom, query, vx, vy, vvalue, options, w
201198
}
202199

203200
var addCellFromBindings = function (bindings) {
204-
var x = bindings[vx], y = bindings[vy], value = bindings[vvalue]
201+
var x = bindings[vx]
202+
var y = bindings[vy]
203+
var value = bindings[vvalue]
205204
var row = rowFor(y)
206205
var colNo = columnNumberFor(x)
207206
var cell = row.children[colNo + 1] // number of Y axis headings
@@ -221,5 +220,4 @@ module.exports.matrixForQuery = function (dom, query, vx, vy, vvalue, options, w
221220

222221
kb.query(query, addCellFromBindings, undefined, whenDone) // Populate the matrix
223222
return matrix
224-
225223
}

src/media-capture.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
////////////////////////////////////////////////
2+
/// /////////////////////////////////////////////
33
//
44
// Media input widget
55
//
@@ -14,6 +14,7 @@
1414
// or access cemra roll (etc) OR to access solid cloud storage of favorite photo almbums.
1515
// (Especially latest taken ones)
1616
//
17+
/* global alert */
1718
var $rdf = require('rdflib')
1819
var media = module.exports = {}
1920

@@ -32,35 +33,35 @@ var UI = {
3233
// Put up a video stream and take a picture
3334
// In: context.div, dom
3435

35-
UI.media.camera = function(context, gotBlob){
36-
37-
function takeSnapshot() {
36+
UI.media.camera = function (context, gotBlob) {
37+
function takeSnapshot () {
38+
var dom = context.dom
3839
var img = dom.createElement('img')
39-
var ctx;
40+
var ctx
4041
var width = video.offsetWidth
41-
, height = video.offsetHeight;
42+
var height = video.offsetHeight
4243

43-
canvas = canvas || document.createElement('canvas');
44-
canvas.width = width;
45-
canvas.height = height;
44+
var canvas = context.canvas || document.createElement('canvas')
45+
canvas.width = width
46+
canvas.height = height
4647

47-
ctx = canvas.getContext('2d');
48-
ctx.drawImage(video, 0, 0, width, height);
48+
ctx = canvas.getContext('2d')
49+
ctx.drawImage(video, 0, 0, width, height)
4950

50-
img.src = canvas.toDataURL('image/png'); // @@@
51-
context.div.appendChild(img);
51+
img.src = canvas.toDataURL('image/png') // @@@
52+
context.div.appendChild(img)
5253
}
5354

5455
var video = context.dom.createElement('video')
5556
context.div.appendChild(video)
5657
// https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
5758
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
58-
navigator.mediaDevices.getUserMedia({video: true })
59-
.then(function(stream){
60-
video.src = window.URL.createObjectURL(stream);
61-
video.addEventListener('click', takeSnapshot);
59+
navigator.mediaDevices.getUserMedia({video: true})
60+
.then(function (stream) {
61+
video.src = window.URL.createObjectURL(stream)
62+
video.addEventListener('click', takeSnapshot)
6263
})
63-
.catch(function(error){
64+
.catch(function (error) {
6465
alert('Could not access the camera. Error: ' + error.name)
6566
})
6667
return video

0 commit comments

Comments
 (0)