mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-11 01:44:44 +00:00
link include styles to extract css
This commit is contained in:
parent
475ea4c158
commit
3c626ac2bc
1 changed files with 29 additions and 54 deletions
|
@ -325,37 +325,8 @@ function jsonToCss(jsonObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractCss(callback) {
|
function extractCss(callback) {
|
||||||
// getIncludeStyle(function (result) {
|
getIncludeStyle(function (result) {
|
||||||
// if (result) {
|
if (result) {
|
||||||
// $('body').find('*').each(function (i, pre) {
|
|
||||||
// if (!$(pre).is(':visible')) {
|
|
||||||
// $(pre).replaceWith('');
|
|
||||||
// } else {
|
|
||||||
// var classNames = pre.getAttribute('class');
|
|
||||||
// var tmpName = cssClassesToTmpIds[classNames];
|
|
||||||
// var tmpNewCss = tmpIdsToNewCss[tmpName];
|
|
||||||
// if (!tmpName) {
|
|
||||||
// tmpName = 'class-' + Math.floor(Math.random()*100000);
|
|
||||||
// cssClassesToTmpIds[classNames] = tmpName;
|
|
||||||
// tmpIdsToNewCss[tmpName] = {};
|
|
||||||
// }
|
|
||||||
// if (!tmpNewCss) {
|
|
||||||
// var style = window.getComputedStyle(pre);
|
|
||||||
// tmpNewCss = {};
|
|
||||||
// for (var cssTagName of supportedCss) {
|
|
||||||
// tmpNewCss[cssTagName] = style.getPropertyValue(cssTagName);
|
|
||||||
// }
|
|
||||||
// tmpIdsToNewCss[tmpName] = tmpNewCss;
|
|
||||||
// }
|
|
||||||
// pre.setAttribute('data-class', tmpName);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// callback(jsonToCss(tmpIdsToNewCss));
|
|
||||||
// } else {
|
|
||||||
// callback();
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
$('body').find('*').each(function (i, pre) {
|
$('body').find('*').each(function (i, pre) {
|
||||||
if (!$(pre).is(':visible')) {
|
if (!$(pre).is(':visible')) {
|
||||||
$(pre).replaceWith('');
|
$(pre).replaceWith('');
|
||||||
|
@ -382,6 +353,10 @@ function extractCss(callback) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
callback(jsonToCss(tmpIdsToNewCss));
|
callback(jsonToCss(tmpIdsToNewCss));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/////
|
/////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue