mirror of
https://github.com/webodf/WebODF.git
synced 2026-11-30 16:47:58 +01:00
Compile webodf.css into webodf.js and webodf-debug.js.
In this way, there is no need to separately add webodf.css when using WebODF. webodf.js is now all that is needed.
This commit is contained in:
+2
-2
@@ -93,9 +93,9 @@ if (NOT ANT)
|
||||
find_file(ANT NAMES ant ant.exe /usr/bin /usr/local/bin)
|
||||
endif(NOT ANT)
|
||||
|
||||
|
||||
|
||||
set(LIBJSFILES lib/packages.js lib/runtime.js lib/core/Base64.js
|
||||
webodf.css.js
|
||||
|
||||
lib/core/RawDeflate.js lib/core/ByteArray.js
|
||||
lib/core/ByteArrayWriter.js lib/core/RawInflate.js
|
||||
lib/core/Cursor.js lib/core/UnitTester.js
|
||||
|
||||
@@ -25,6 +25,13 @@ add_custom_target(jslintcheck ALL
|
||||
SOURCES ${LIBJSFILES} ${TESTJSFILES}
|
||||
)
|
||||
|
||||
add_custom_target(webodf.css.js ALL
|
||||
COMMAND ${NODE} lib/runtime.js tools/css2js.js webodf.css webodf.css.js
|
||||
DEPENDS NodeJS
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
SOURCES webodf.css
|
||||
)
|
||||
|
||||
if (Java_JAVA_EXECUTABLE)
|
||||
# nonStandardJsDocs is not used because we use @licstart @licend and @source
|
||||
set(SHARED_CLOSURE_ARGS --warning_level VERBOSE --jscomp_error accessControls --jscomp_error ambiguousFunctionDecl --jscomp_error checkRegExp --jscomp_error checkTypes --jscomp_error checkVars --jscomp_error constantProperty --jscomp_error deprecated --jscomp_error externsValidation --jscomp_error fileoverviewTags --jscomp_error globalThis --jscomp_error invalidCasts --jscomp_error missingProperties --jscomp_error strictModuleDepCheck --jscomp_error typeInvalidation --jscomp_error undefinedVars --jscomp_error unknownDefines --jscomp_error uselessCode --jscomp_error visibility --jscomp_off nonStandardJsDocs --summary_detail_level 3)
|
||||
@@ -73,7 +80,8 @@ if (Java_JAVA_EXECUTABLE)
|
||||
--formatting PRINT_INPUT_DELIMITER
|
||||
--externs ${CMAKE_CURRENT_SOURCE_DIR}/tools/externs.js
|
||||
--js_output_file ${CMAKE_CURRENT_BINARY_DIR}/webodf.js
|
||||
DEPENDS ClosureCompiler ${LIBJSFILES} tools/externs.js
|
||||
DEPENDS ClosureCompiler ${LIBJSFILES} tools/externs.js webodf.css
|
||||
tools/css2js.js
|
||||
)
|
||||
add_custom_target(webodf.js
|
||||
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/webodf.js
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
* @source: http://gitorious.org/odfkit/webodf/
|
||||
*/
|
||||
/*jslint sub: true*/
|
||||
/*global runtime, odf, xmldom */
|
||||
/*global runtime, odf, xmldom, webodf_css */
|
||||
runtime.loadClass("odf.OdfContainer");
|
||||
runtime.loadClass("odf.Formatting");
|
||||
runtime.loadClass("xmldom.XPath");
|
||||
@@ -611,14 +611,28 @@ odf.OdfCanvas = (function () {
|
||||
}
|
||||
// embedded video is stored in a draw:plugin element
|
||||
plugins = odffragment.getElementsByTagNameNS(drawns, 'plugin');
|
||||
runtime.log('Loading Videos:');
|
||||
|
||||
for (i = 0; i < plugins.length; i += 1) {
|
||||
runtime.log('...Found a video.');
|
||||
node = /**@type{!Element}*/(plugins.item(i));
|
||||
loadVideo('video' + String(i), container, node, stylesheet);
|
||||
}
|
||||
}
|
||||
function addWebODFStyleSheet(document) {
|
||||
var head = document.getElementsByTagName('head')[0],
|
||||
style;
|
||||
if (typeof (webodf_css) !== 'undefined') {
|
||||
style = document.createElementNS(head.namespaceURI, 'style');
|
||||
style.setAttribute('media', 'screen, print, handheld, projection');
|
||||
style.appendChild(document.createTextNode(webodf_css));
|
||||
} else {
|
||||
style = document.createElementNS(head.namespaceURI, 'link');
|
||||
style.setAttribute('href', 'webodf.css');
|
||||
style.setAttribute('rel', 'stylesheet');
|
||||
}
|
||||
style.setAttribute('type', 'text/css');
|
||||
head.appendChild(style);
|
||||
return style;
|
||||
}
|
||||
/**
|
||||
* @param {Document} document Put and ODF Canvas inside this element.
|
||||
*/
|
||||
@@ -626,9 +640,7 @@ odf.OdfCanvas = (function () {
|
||||
var head = document.getElementsByTagName('head')[0],
|
||||
style = document.createElementNS(head.namespaceURI, 'style'),
|
||||
text = '',
|
||||
prefix,
|
||||
a = "",
|
||||
b;
|
||||
prefix;
|
||||
style.setAttribute('type', 'text/css');
|
||||
style.setAttribute('media', 'screen, print, handheld, projection');
|
||||
for (prefix in namespaces) {
|
||||
@@ -652,11 +664,15 @@ odf.OdfCanvas = (function () {
|
||||
/**@type{!odf.Formatting}*/ formatting = new odf.Formatting(),
|
||||
selectionWatcher = new SelectionWatcher(element),
|
||||
slidecssindex = 0,
|
||||
pageSwitcher = new PageSwitcher(addStyleSheet(document)),
|
||||
stylesxmlcss = addStyleSheet(document),
|
||||
positioncss = addStyleSheet(document),
|
||||
pageSwitcher,
|
||||
stylesxmlcss,
|
||||
positioncss,
|
||||
editable = false,
|
||||
zoomLevel = 1;
|
||||
addWebODFStyleSheet(document);
|
||||
pageSwitcher = new PageSwitcher(addStyleSheet(document));
|
||||
stylesxmlcss = addStyleSheet(document);
|
||||
positioncss = addStyleSheet(document);
|
||||
|
||||
function fixContainerSize() {
|
||||
var sizer = element.firstChild,
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
background: black;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" href="webodf.css"/>
|
||||
<script src="lib/runtime.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
function init() {
|
||||
|
||||
Reference in New Issue
Block a user