Skip to content

Commit 44721be

Browse files
author
Tim Berners-Lee
committed
working on style and icons
1 parent 8a0aa85 commit 44721be

6 files changed

Lines changed: 36 additions & 5 deletions

File tree

src/icons/noun_973694_expanded.svg

Lines changed: 5 additions & 0 deletions
Loading

src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const UI = {
5353
pad: require('./pad'),
5454
preferences: require('./preferences'),
5555
store: require('./store'),
56+
style: require('./style'),
5657
table: require('./table'),
5758
tabs: require('./tabs'),
5859
utils: require('./utils'),

src/style.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Common readable consistent stylesheet
2+
// to avoid using style sheets which are document-global
3+
// and make programmable style toggling with selection, drag over, etc easier
4+
5+
module.exports = {
6+
textInputStyle: 'background-color: #eef; padding: 0.5em; border: .5em solid white; font-size: 100%',
7+
buttonStyle: 'background-color: #eef; padding: 0.5em; border: .5em solid white; font-size: 100%'
8+
}

src/table.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ module.exports = function renderTableViewPane (doc, options) {
184184
function generateSparqlButton () {
185185
var image = doc.createElement('img')
186186
image.setAttribute('class', 'sparqlButton')
187-
image.setAttribute('src', tabulator.iconPrefix + 'icons/1pt5a.gif')
187+
image.setAttribute('src', UI.iconBase + 'icons/1pt5a.gif')
188188
image.setAttribute('alt', 'Edit SPARQL query')
189189
190190
image.addEventListener('click', sparqlButtonPressed, false)
@@ -1250,7 +1250,6 @@ module.exports = function renderTableViewPane (doc, options) {
12501250
var uri = target.getAttribute('href')
12511251
if (!uri) console.log('No href found \n')
12521252
linkFunction(uri)
1253-
// tabulator.outline.GotoSubject(UI.store.sym(uri), true, undefined, true, undefined)
12541253
}, true)
12551254
}
12561255
return result

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function syncTableToArray (table, things, createNewRow) {
138138
if (!foundOne) {
139139
let newRow = createNewRow(thing)
140140
// Insert new row in position g in the table to match array
141-
if (g >= things.length) {
141+
if (g >= table.children.length) {
142142
table.appendChild(newRow)
143143
} else {
144144
let ele = table.children[g]

src/widgets/index.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ var UI = {
3939
const error = require('./error')
4040
const utils = require('../utils')
4141

42+
const cancelIconURI = UI.icons.iconBase + 'noun_1180156.svg' // black X
43+
const checkIconURI = UI.icons.iconBase + 'noun_1180158.svg' // green checkmark; Continue
44+
// const greenPlusIconURI = UI.icons.iconBase + 'noun_34653_green.svg' // green checkmark; Continue
45+
4246
function complain (context, err) {
4347
var ele = context.statusArea || context.div
4448
console.log('Complaint: ' + err)
@@ -272,14 +276,19 @@ UI.widgets.deleteButtonWithCheck = function (dom, container, noun, deleteFunctio
272276
delButton.addEventListener('click', function (e) {
273277
container.removeChild(delButton) // Ask -- are you sure?
274278
var cancelButton = dom.createElement('button')
275-
cancelButton.textContent = 'cancel'
279+
// cancelButton.textContent = 'cancel'
280+
cancelButton.setAttribute('style', UI.style.buttonStyle)
281+
var img = cancelButton.appendChild(dom.createElement('img'))
282+
img.setAttribute('src', cancelIconURI)
283+
276284
container.appendChild(cancelButton).addEventListener('click', function (e) {
277285
container.removeChild(sureButton)
278286
container.removeChild(cancelButton)
279287
container.appendChild(delButton)
280288
}, false)
281289
var sureButton = dom.createElement('button')
282290
sureButton.textContent = 'Delete ' + noun
291+
sureButton.setAttribute('style', UI.style.buttonStyle)
283292
container.appendChild(sureButton).addEventListener('click', function (e) {
284293
container.removeChild(sureButton)
285294
container.removeChild(cancelButton)
@@ -305,6 +314,7 @@ UI.widgets.askName = function (dom, kb, container, predicate, klass) {
305314
namefield.setAttribute('type', 'text')
306315
namefield.setAttribute('size', '100')
307316
namefield.setAttribute('maxLength', '2048') // No arbitrary limits
317+
namefield.setAttribute('style', UI.style.textInputStyle)
308318
namefield.select() // focus next user input
309319
form.appendChild(namefield)
310320
container.appendChild(form)
@@ -326,15 +336,23 @@ UI.widgets.askName = function (dom, kb, container, predicate, klass) {
326336

327337
var cancel = form.appendChild(dom.createElement('button'))
328338
cancel.setAttribute('type', 'button')
339+
cancel.setAttribute('style', UI.style.buttonStyle)
329340
cancel.innerHTML = 'Cancel'
341+
var img = cancel.appendChild(dom.createElement('img'))
342+
img.setAttribute('src', cancelIconURI)
343+
330344
cancel.addEventListener('click', function (e) {
331345
form.parentNode.removeChild(form)
332346
resolve(null)
333347
}, false)
334348

335349
var b = form.appendChild(dom.createElement('button'))
336350
b.setAttribute('type', 'button')
337-
b.innerHTML = 'Continue'
351+
b.setAttribute('style', UI.style.buttonStyle)
352+
// b.innerHTML = 'Continue'
353+
var img2 = cancel.appendChild(dom.createElement('img'))
354+
img2.setAttribute('src', checkIconURI)
355+
338356
b.addEventListener('click', function (e) {
339357
gotName()
340358
}, false)

0 commit comments

Comments
 (0)