mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-10 09:24:49 +00:00
misc updates WIP
This commit is contained in:
parent
74673b5449
commit
b72d7934dd
2 changed files with 55 additions and 43 deletions
|
@ -320,6 +320,13 @@ function generateRandomTag(tagLen) {
|
|||
return text;
|
||||
}
|
||||
|
||||
function generateRandomNumber(bigNr) {
|
||||
if (bigNr) {
|
||||
return Math.floor(Math.random()*1000000*Math.random()*1000000)
|
||||
}
|
||||
return Math.floor(Math.random()*1000000)
|
||||
}
|
||||
|
||||
function removeSpecialChars(text) {
|
||||
// FIXME remove white spaces ?
|
||||
return text.replace(/\//g, '-')
|
||||
|
@ -350,4 +357,19 @@ function getPageTitle(title) {
|
|||
return 'ebook';
|
||||
}
|
||||
return title;
|
||||
}
|
||||
|
||||
function jsonToCss(jsonObj) {
|
||||
var keys = Object.keys(jsonObj);
|
||||
var result = '';
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var tmpJsonObj = jsonObj[keys[i]];
|
||||
var tmpKeys = Object.keys(tmpJsonObj);
|
||||
result += '.' + keys[i] + ' {';
|
||||
for (var j = 0; j < tmpKeys.length; j++) {
|
||||
result += tmpKeys[j] + ':' + tmpJsonObj[tmpKeys[j]] + ';';
|
||||
}
|
||||
result += '} ';
|
||||
}
|
||||
return result;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue