From dd1cb4c2f0dddf70094455e8b9a41c2a3c2e0a28 Mon Sep 17 00:00:00 2001 From: Willem Date: Fri, 22 Jan 2016 00:02:39 +0100 Subject: [PATCH] Cleanup ui css and added submit button text option --- README.md | 12 ++++-------- es5-ff-spa-loader.js | 20 +++++++++----------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index c6e5029..fb7298a 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,9 @@ A javascript library providing server defined loading of assets for a single pag * server.header.request = An key value object with the request headers. (default: {'X-FFSpaLoader': 'sync'}) * question.transport = The transport to prefix the server.url with. (default: 'http://') * question.title = The question ui title. (default: 'Server') + * question.submit = The start button text. (default: 'Start') * question.text = The question ui text. (default: 'Please provide the server name;') - * question.style = The question ui css style.(note: pending change) (default: green border box) + * question.style = The question ui css style. (default: green border box) * question.validate.min.value = The minimal hostname length, false is disabled (default: 3) * question.validate.min.message = The error message (default: 'Server name is to short.') * question.validate.max.value = The maximal hostname length, false is disabled (default: 255) @@ -157,7 +158,6 @@ A javascript library providing server defined loading of assets for a single pag * test in production * Server header check support - * Redo css(?divs) of server question * Add table+instance websql options so it can also be used in application code. * Add more tests * css: set tag.media = 'only you'; @@ -176,7 +176,8 @@ Add unit tests for any new or changed functionality. Lint and test your code. * Added question.validate.[min|max|regex].value|message options. * Strip question value to hostname+port before use and validating. * Allow user upgrade to https in question input from default of transport option. -* Added request headers setting. +* Added server request headers option. +* Updated css of question and error ui. ### 0.0.4 * Added auto cache clean code @@ -184,12 +185,7 @@ Add unit tests for any new or changed functionality. Lint and test your code. * Remove unused mobileAgent detect. * Fixed cached resources injection order. - ### 0.0.3 * Fixed example script path. - -### 0.0.2 * Fixed example size. - -### 0.0.1 * Initial release. diff --git a/es5-ff-spa-loader.js b/es5-ff-spa-loader.js index 2dffb28..e273fae 100644 --- a/es5-ff-spa-loader.js +++ b/es5-ff-spa-loader.js @@ -50,7 +50,7 @@ error: { handler: null, // auto filled title: 'Loader ', - style: '.ffError { margin: auto;width: 90%;border: 3px solid red;padding-left: 1em;padding-bottom: 1em;}' + style: '.ffError { margin: 1em auto;width: 90%;border: 0.4em solid red;border-radius: 2em;padding: 0em 1em 1em 1em;max-width: 80%;}' }, boot: { cordova: { @@ -79,8 +79,9 @@ question: { transport: 'http://', title: 'Server', - text: 'Please provide the server name;', // TODO: rename .ffAskUrl - style: '.ffAskUrl { font-size: 1em;margin: auto;width: 90%;border: 3px solid #73AD21;padding-left: 1em;padding-bottom: 1em;} .ffAskUrl > div {font-size: 0.8em;color: #ccc;} .ffAskUrl > div > * {} .ffAskUrl > div > input {} .ffAskUrlError{ color: red}', + submit: 'Start', + text: 'Please provide the server name;', + style: '.ffQuestion { margin: 1em auto;width: 90%;border: 0.4em solid green;border-radius: 2em;padding: 0em 1em 1em 1em;max-width: 80%;} .ffQuestion > div {color: #ccc;}.ffQuestion > div > input {margin: 0.2em;} .ffQuestionError{color: red;}', validate: { min: { value: 3, @@ -641,7 +642,7 @@ var resourcesUrl = options.server.url + options.server.assets; utilDebug('askUrlStart check assets '+resourcesUrl); - // TODO: add+check headers + // TODO: check headers utilHttpFetch(resourcesUrl,function(err, httpRequest) { if (err !== null) { inputErrorTag.appendChild(document.createTextNode('Error could not get data.')); @@ -674,7 +675,7 @@ utilDebug('askUrl create ui'); var rootTag = document.createElement('div'); - rootTag.setAttribute('class','ffAskUrl'); + rootTag.setAttribute('class','ffQuestion'); var cssTag = document.createElement('style'); cssTag.type = 'text/css'; @@ -693,7 +694,7 @@ rootTag.appendChild(formTag); var transportTag = document.createElement('label'); - rootTag.setAttribute('for','serverInput'); + transportTag.setAttribute('for','serverInput'); transportTag.appendChild(document.createTextNode(options.question.transport)); formTag.appendChild(transportTag); @@ -704,19 +705,16 @@ inputTag.setAttribute('onkeydown','if (event.keyCode == 13) {document.getElementById(\'serverSubmit\').click()}'); formTag.appendChild(inputTag); - var submitLineTag = document.createElement('br'); - formTag.appendChild(submitLineTag); - var submitTag = document.createElement('input'); submitTag.id = 'serverSubmit'; submitTag.type = 'submit'; - submitTag.value = 'Start'; + submitTag.value = options.question.submit; submitTag.onclick = function() {askUrlValidate(cb,rootTag);}; formTag.appendChild(submitTag); var serverErrorTag = document.createElement('div'); serverErrorTag.id = 'serverInputError'; - serverErrorTag.setAttribute('class','ffAskUrlError'); + serverErrorTag.setAttribute('class','ffQuestionError'); formTag.appendChild(serverErrorTag); document.getElementsByTagName('body')[0].appendChild(rootTag);