if (!xml2htmlStylesheet) {
$.blockUI({message: 'Ładowanie arkuszy stylów...'});
$.ajax({
- url: STATIC_URL + 'xsl/wl2html_client.xsl?20171106',
- dataType: 'xml',
- timeout: 10000,
- success: function(data) {
+ url: STATIC_URL + 'xsl/wl2html_client.xsl?210129',
+ dataType: 'xml',
+ timeout: 10000,
+ success: function(data) {
xml2htmlStylesheet = createXSLT(data);
$.unblockUI();
- code_block();
-
- },
- error: onError
- })
- }
- else {
code_block();
- }
-}
-
-
-// Wykonuje block z załadowanymi kanonicznymi motywami
-function withThemes(code_block, onError)
-{
- if (typeof withThemes.canon == 'undefined') {
- $.ajax({
- url: '/editor/themes',
- dataType: 'text',
- success: function(data) {
- withThemes.canon = data.split('\n');
- code_block(withThemes.canon);
},
- error: function() {
- withThemes.canon = null;
- code_block(withThemes.canon);
- }
+ error: onError
})
}
else {
- code_block(withThemes.canon);
+ code_block();
}
}
if (error.length == 0) {
doc = xml2htmlStylesheet.transformToFragment(doc, document);
- console.log(doc.firstChild);
if(doc.firstChild === null) {
options.error("Błąd w przetwarzaniu XML.");
source.text('');
options.error(error.text(), source_text);
} else {
+ let galleryUrl = new URL(
+ options.base,
+ window.location.href
+ );
+ $("img", $(doc.childNodes)).each(function() {
+ $(this).attr(
+ 'src',
+ new URL(
+ $(this).attr('src'),
+ galleryUrl
+ )
+ );
+ })
+
options.success(doc.childNodes);
- withThemes(function(canonThemes) {
+ $.themes.withCanon(function(canonThemes) {
if (canonThemes != null) {
$('.theme-text-list').addClass('canon').each(function(){
var themes = $(this).html().split(',');
}
HTMLSerializer.prototype._nodeIgnored = function(node) {
- return node.getAttribute('x-node') == 'wers';
+ return node.getAttribute('x-auto-node') == 'true';
}
HTMLSerializer.prototype._ignoredWithWhitespace = function(node) {