X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8f0bfbd922b46c4d9e484343694aaa141de5b4fc..210e62452e0e9f26f3e006c874b66ac44005d492:/redakcja/static/js/wiki/view_annotations.js?ds=sidebyside diff --git a/redakcja/static/js/wiki/view_annotations.js b/redakcja/static/js/wiki/view_annotations.js index f62cd65c..5bac593c 100644 --- a/redakcja/static/js/wiki/view_annotations.js +++ b/redakcja/static/js/wiki/view_annotations.js @@ -23,7 +23,7 @@ self.$refresh.removeClass('active'); $this.addClass('active'); - atype = $this.text(); + atype = $this.attr('data-tag'); self.$annos.hide(); self.$error.hide(); @@ -77,8 +77,10 @@ else { self.$annos.html(''); var anno_list = new Array(); - var annos = doc.getElementsByTagName(atype); + var annos = $(atype, doc); var counter = annos.length; + var atype_rx = atype.replace(/,/g, '|'); + var ann_expr = new RegExp("^<("+atype_rx+")[^>]*>|$", "g") if (annos.length == 0) { @@ -86,10 +88,8 @@ self.$spinner.hide(); self.$annos.show(); } - for (var i=0; i]*>|$", "g") - xml_text = serializer.serializeToString(annos[i]).replace(ann_expr, ""); + annos.each(function (i, elem) { + xml_text = serializer.serializeToString(elem).replace(ann_expr, ""); xml2html({ xml: "" + xml_text + "", success: function(xml_text){ @@ -101,7 +101,8 @@ if (!counter) { anno_list.sort(function(a, b){return a.sortby.localeCompare(b.sortby);}); - self.$annos.append(anno_list); + for (i in anno_list) + self.$annos.append(anno_list[i]); self.$spinner.hide(); self.$annos.show(); } @@ -115,7 +116,7 @@ self.$error.show(); } }); - } + }); } }