X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1a2ba641f553db5582303a52329c345d0d437f35..449281d64b3c908fdb3622923a0d42f3942da3de:/redakcja/static/js/wiki_img/wikiapi.js?ds=sidebyside diff --git a/redakcja/static/js/wiki_img/wikiapi.js b/redakcja/static/js/wiki_img/wikiapi.js index 33af1766..cac7e485 100644 --- a/redakcja/static/js/wiki_img/wikiapi.js +++ b/redakcja/static/js/wiki_img/wikiapi.js @@ -49,6 +49,18 @@ this.revision = $("*[data-key='revision']", meta).text(); this.readonly = !!$("*[data-key='readonly']", meta).text(); + var diff = $("*[data-key='diff']", meta).text(); + if (diff) { + diff = diff.split(','); + if (diff.length == 2 && diff[0] < diff[1]) + this.diff = diff; + else if (diff.length == 1) { + diff = parseInt(diff); + if (diff != NaN) + this.diff = [diff - 1, diff]; + } + } + this.text = null; this.has_local_changes = false; this._lock = -1; @@ -76,7 +88,7 @@ if (self.text === null || self.commit !== data.commit) { self.text = data.text; if (self.text === '') { - self.text = ''; + self.text = ''; } self.revision = data.revision; self.commit = data.commit; @@ -319,7 +331,7 @@ $e.find('div').each(function(i, div) { var $div = $(div); switch ($div.attr('type')) { - case 'area': + case 'rect': a.push([ value, $div.attr('x1'), @@ -361,7 +373,7 @@ $sem.attr(tag, e[0]); $div = $(doc.createElement("div")); if (e[1]) { - $div.attr('type', 'area'); + $div.attr('type', 'rect'); $div.attr('x1', e[1]); $div.attr('y1', e[2]); $div.attr('x2', e[3]); @@ -373,7 +385,7 @@ $sem.append($div); $root.append($sem); }); - self.setText(XML(serializer.serializeToString(doc)).toXMLString()); + self.setText(serializer.serializeToString(doc)); }