X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/f938afb8ab4cb091d12e0ef0311eaea14b774798..add48c78bc4b08dfda50b0c0ccb6be188c7d56f4:/redakcja/static/js/wiki/view_summary.js?ds=inline diff --git a/redakcja/static/js/wiki/view_summary.js b/redakcja/static/js/wiki/view_summary.js index 811096dd..b16c288f 100644 --- a/redakcja/static/js/wiki/view_summary.js +++ b/redakcja/static/js/wiki/view_summary.js @@ -29,12 +29,28 @@ SummaryPerspective.prototype = new $.wiki.Perspective(); + SummaryPerspective.prototype.showCharCount = function() { + var cc; + try { + cc = this.doc.getLength(); + $('#charcount_untagged').hide(); + } + catch (e) { + $('#charcount_untagged').show(); + cc = this.doc.text.replace(/\s{2,}/g, ' ').length; + } + $('#charcount').html(cc); + $('#charcount_pages').html((Math.round(cc/18)/100).toLocaleString()); + } + SummaryPerspective.prototype.freezeState = function(){ // must }; SummaryPerspective.prototype.onEnter = function(success, failure){ $.wiki.Perspective.prototype.onEnter.call(this); + + this.showCharCount(); console.log("Entered summery view"); };