use librarian 1.4
[redakcja.git] / redakcja / static / js / wiki / view_summary.js
1 (function($){
2
3         function SummaryPerspective(options) {
4                 $.wiki.Perspective.call(this, options);
5     };
6
7     SummaryPerspective.prototype = new $.wiki.Perspective();
8
9     SummaryPerspective.prototype.showCharCount = function() {
10         var cc;
11         try {
12             cc = this.doc.getLength();
13             $('#charcount_untagged').hide();
14         }
15         catch (e) {
16             $('#charcount_untagged').show();
17             cc = this.doc.text.replace(/\s{2,}/g, ' ').length;
18         }
19         $('#charcount').html(cc);
20         $('#charcount_pages').html((Math.round(cc/18)/100).toLocaleString());
21     }
22
23     SummaryPerspective.prototype.freezeState = function(){
24         // must
25     };
26
27         SummaryPerspective.prototype.onEnter = function(success, failure){
28                 $.wiki.Perspective.prototype.onEnter.call(this);
29                 
30                 this.showCharCount();
31
32                 console.log("Entered summery view");
33         };
34
35         $.wiki.SummaryPerspective = SummaryPerspective;
36
37 })(jQuery);
38