element.data('images', []);
function changePage(pageNumber) {
- $('img', element).attr('src', element.data('images')[pageNumber - 1]);
+ $('.gallery-image img', element).attr('src', element.data('images')[pageNumber - 1]);
}
function normalizeNumber(pageNumber) {
});
- var image = $('img', element).attr('unselectable', 'on');
+ var image = $('.gallery-image img', element).attr('unselectable', 'on');
var origin = {};
var imageOrigin = {};
var zoomFactor = 1;
});
$('.change-gallery', element).click(function() {
$('.chosen-gallery').val($('#document-meta .gallery').html() || '/platforma/gallery/');
- $('.gallery-image').animate({top: 53}, 200);
+ $('.gallery-image').animate({top: 60}, 200);
$('.chosen-gallery').focus();
});
$('.change-gallery-ok', element).click(function() {
}
$('#document-meta .gallery').html($('.chosen-gallery').val());
updateGallery($('.chosen-gallery').val());
- $('.gallery-image').animate({top: 27}, 200);
+ $('.gallery-image').animate({top: 30}, 200);
});
$('.change-gallery-cancel', element).click(function() {
- $('.gallery-image').animate({top: 27}, 200);
+ $('.gallery-image').animate({top: 30}, 200);
});
- $('img', element).load(function() {
+ $('.gallery-image img', element).load(function() {
image.css({width: null, height: null});
imageDimensions = {
width: $(this).width() * zoomFactor,
};
if (!(imageDimensions.width && imageDimensions.height)) {
- setTimeout(function() { $('img', element).load(); }, 100);
+ setTimeout(function() { $('.gallery-image img', element).load(); }, 100);
}
var position = normalizePosition(
image.position().left,
element.data('images', data);
pn.val(1);
pn.change();
- $('img', element).show();
+ $('.gallery-image img', element).show();
},
error: function(data) {
element.data('images', []);
pn.val(1);
pn.change();
- $('img', element).hide();
+ $('.gallery-image img', element).hide();
}
});
}
callback();
}
}, error: function(text) {
- $('#html-view').html('<p class="error">Wystąpił błąd:</p><pre>' + text + '</pre>');
+ var message = $('<pre></pre>');
+ message.text(text);
+ $('#html-view').html('<p class="error">Wystąpił błąd:</p><pre>' +
+ message.html() + '</pre>');
+
$.unblockUI();
if (callback) {
callback();
return true;
}
+
+ var ANNOT_ALLOWED = ['wyroznienie'];
+
+ function html2plainText(fragment) {
+ var text = "";
+
+ $(fragment.childNodes).each(function() {
+ if(this.nodeType == 3) // textNode
+ text += this.nodeValue;
+ else if (this.nodeType == 1
+ && $.inArray($(this).attr('x-node'), ANNOT_ALLOWED) != -1 ){
+ text += html2plainText(this);
+ }
+ });
+
+ return text;
+ }
function addAnnotation()
{
return false;
}
- var text = range.toString();
+ // BUG #273 - selected text can contain themes, which should be omited from
+ // defining term
+ var text = html2plainText( range.cloneContents() );
+
var tag = $('<span></span>');
range.collapse(false);
range.insertNode(tag[0]);
// for now allow only 1 range
if(n > 1) {
- window.alert("Zaznacz jeden obszar");
+ window.alert("Zaznacz jeden obszar.");
return false;
}
+
// remember the selected range
var range = selection.getRangeAt(0);
+
+
+ if( $(range.startContainer).is('.html-editarea')
+ || $(range.endContainer).is('.html-editarea') ) {
+ window.alert("Motywy można oznaczać tylko na tekście nie otwartym do edycji. \n Zamknij edytowany fragment i spróbuj ponownie.");
+ return false;
+ }
// verify if the start/end points make even sense -
// they must be inside a x-node (otherwise they will be discarded)
etag.replaceWith(text);
xml2html({
xml: '<motyw id="m'+id+'"></motyw>',
- success: function(text) {
+ success: function(text) {
mtag = $('<span></span>');
spoint.insertNode(mtag[0]);
mtag.replaceWith(text);
function save(argument) {
var nodeName = $box.attr('x-node') || 'pe';
+ var insertedText = $('textarea', $overlay).val();
+
+ if ($origin.is('.motyw')) {
+ insertedText = insertedText.replace(/,\s*$/, '');
+ }
+
xml2html({
- xml: '<' + nodeName + '>' + $('textarea', $overlay).val() + '</' + nodeName + '>',
+ xml: '<' + nodeName + '>' + insertedText + '</' + nodeName + '>',
success: function(element) {
$box.html($(element).html());
$overlay.remove();
},
iframeClass: 'xml-iframe',
textWrapping: true,
+ lineNumbers: true,
tabMode: 'spaces',
indentUnit: 0,
initCallback: function(editor) {
name: $('#document-name').html(),
text: metaComment + editor.getCode(),
revision: $('#document-revision').html(),
- author: 'annonymous',
+ author: $('#username').html() || 'annonymous',
comment: $('#komentarz').val()
};
event.preventDefault();
var params = eval("(" + $(this).attr('ui:action-params') + ")");
scriptletCenter.scriptlets[$(this).attr('ui:action')](editor, params);
- });
+ });
$('.toolbar select').change(function() {
var slug = $(this).val();