SummaryPerspective.prototype.showCharCount = function() {
var cc;
try {
+ $('#charcounts_text').show();
+ $('#charcounts_raw').hide();
+ cc = this.doc.getLength({noFootnotes: true, noThemes: true});
+ $('#charcount').html(cc);
+ $('#charcount_pages').html((Math.round(cc/18)/100).toLocaleString());
+
cc = this.doc.getLength();
- $('#charcount_untagged').hide();
+ $('#charcount_full').html(cc);
+ $('#charcount_full_pages').html((Math.round(cc/18)/100).toLocaleString());
}
catch (e) {
- $('#charcount_untagged').show();
+ $('#charcounts_text').hide();
+ $('#charcounts_raw').show();
cc = this.doc.text.replace(/\s{2,}/g, ' ').length;
+ $('#charcount_raw').html(cc);
+ $('#charcount_raw_pages').html((Math.round(cc/18)/100).toLocaleString());
}
- $('#charcount').html(cc);
- $('#charcount_pages').html((Math.round(cc/18)/100).toLocaleString());
}
SummaryPerspective.prototype.freezeState = function(){
WikiDocument.prototype.getLength = function(params) {
+ params = $.extend({}, noops, params);
var xml = this.text.replace(/\/(\s+)/g, '<br />$1');
var parser = new DOMParser();
var doc = parser.parseFromString(xml, 'text/xml');
throw "Not an XML document.";
}
$.xmlns["rdf"] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
- $('rdf|RDF, motyw, pa, pe, pr, pt', doc).remove();
+ $('rdf|RDF', doc).remove();
+ if (params.noFootnotes) {
+ $('pa, pe, pr, pt', doc).remove();
+ }
+ if (params.noThemes) {
+ $('motyw', doc).remove();
+ }
var text = $(doc).text();
text = $.trim(text.replace(/\s{2,}/g, ' '));
return text.length;
</p>
<p>
<label>{% trans "Characters in document" %}:</label>
- <span id="charcount"></span> (<span id="charcount_pages"></span> {% trans "pages" %}<span id="charcount_untagged">, {% trans "untagged" %}</span>)
+ <span id="charcounts_text">
+ <br><span id="charcount"></span> (<span id="charcount_pages"></span> {% trans "pages" %}, {% trans "without footnotes and themes" %})
+ <br><span id="charcount_full"></span> (<span id="charcount_full_pages"></span> {% trans "pages" %}, {% trans "with footnotes and themes" %})
+ </span>
+ <span id="charcounts_raw">
+ <br><span id="charcount_raw"></span> (<span id="charcount_raw_pages"></span> {% trans "pages" %}, {% trans "untagged" %})
+ </span>
</p>
</div>
</div>