You will find only what you bring in.
[redakcja.git] / src / wiki / static / wiki / js / perspective.js
1 (function($) {
2
3         /*
4          * Basic perspective.
5          */
6         $.wiki.Perspective = function(options) {
7                 if(!options) return;
8
9                 this.doc = options.doc;
10                 if (options.id) {
11                         this.perspective_id = options.id;
12                 }
13                 else {
14                         this.perspective_id = '';
15                 }
16
17                 if(options.callback)
18                         options.callback.call(this);
19         };
20
21         $.wiki.Perspective.prototype.config = function() {
22                 return $.wiki.state.perspectives[this.perspective_id];
23         }
24
25         $.wiki.Perspective.prototype.toString = function() {
26             return this.perspective_id;
27         };
28
29         $.wiki.Perspective.prototype.dirty = function() {
30                 return true;
31         };
32
33         $.wiki.Perspective.prototype.onEnter = function () {
34                 // called when perspective in initialized
35                 if (!this.noupdate_hash_onenter) {
36                         document.location.hash = '#' + this.perspective_id;
37                 }
38         };
39
40         $.wiki.Perspective.prototype.onExit = function () {
41                 // called when user switches to another perspective
42                 if (!this.noupdate_hash_onenter) {
43                         document.location.hash = '';
44                 }
45         };
46
47         $.wiki.Perspective.prototype.destroy = function() {
48                 // pass
49         };
50
51         $.wiki.Perspective.prototype.freezeState = function () {
52                 // free UI state (don't store data here)
53         };
54
55         $.wiki.Perspective.prototype.unfreezeState = function (frozenState) {
56                 // restore UI state
57         };
58
59                 });
60
61                 $elem.show();
62                 return $elem;
63         };
64
65         /*