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