]> git.wh0rd.org - tt-rss.git/blame - lib/dojo/hash.js
add dijit/dojo stuff; initial ui mockup
[tt-rss.git] / lib / dojo / hash.js
CommitLineData
2f01fe57
AD
1/*
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5*/
6
7
8if(!dojo._hasResource["dojo.hash"]){
9dojo._hasResource["dojo.hash"]=true;
10dojo.provide("dojo.hash");
11(function(){
12dojo.hash=function(_1,_2){
13if(!arguments.length){
14return _3();
15}
16if(_1.charAt(0)=="#"){
17_1=_1.substring(1);
18}
19if(_2){
20_4(_1);
21}else{
22location.href="#"+_1;
23}
24return _1;
25};
26var _5=null,_6=null,_7=dojo.config.hashPollFrequency||100;
27function _8(_9,_a){
28var i=_9.indexOf(_a);
29return (i>=0)?_9.substring(i+1):"";
30};
31function _3(){
32return _8(location.href,"#");
33};
34function _b(){
35dojo.publish("/dojo/hashchange",[_3()]);
36};
37function _c(){
38if(_3()===_5){
39return;
40}
41_5=_3();
42_b();
43};
44function _4(_d){
45if(_6){
46if(_6.isTransitioning()){
47setTimeout(dojo.hitch(null,_4,_d),_7);
48return;
49}
50var _e=_6.iframe.location.href;
51var _f=_e.indexOf("?");
52_6.iframe.location.replace(_e.substring(0,_f)+"?"+_d);
53return;
54}
55location.replace("#"+_d);
56_c();
57};
58function _10(){
59var ifr=document.createElement("iframe"),_11="dojo-hash-iframe",_12=dojo.config.dojoBlankHtmlUrl||dojo.moduleUrl("dojo","resources/blank.html");
60ifr.id=_11;
61ifr.src=_12+"?"+_3();
62ifr.style.display="none";
63document.body.appendChild(ifr);
64this.iframe=dojo.global[_11];
65var _13,_14,_15,_16,_17,_18=this.iframe.location;
66function _19(){
67_5=_3();
68_13=_17?_5:_8(_18.href,"?");
69_14=false;
70_15=null;
71};
72this.isTransitioning=function(){
73return _14;
74};
75this.pollLocation=function(){
76if(!_17){
77try{
78var _1a=_8(_18.href,"?");
79if(document.title!=_16){
80_16=this.iframe.document.title=document.title;
81}
82}
83catch(e){
84_17=true;
85console.error("dojo.hash: Error adding history entry. Server unreachable.");
86}
87}
88var _1b=_3();
89if(_14&&_5===_1b){
90if(_17||_1a===_15){
91_19();
92_b();
93}else{
94setTimeout(dojo.hitch(this,this.pollLocation),0);
95return;
96}
97}else{
98if(_5===_1b&&(_17||_13===_1a)){
99}else{
100if(_5!==_1b){
101_5=_1b;
102_14=true;
103_15=_1b;
104ifr.src=_12+"?"+_15;
105_17=false;
106setTimeout(dojo.hitch(this,this.pollLocation),0);
107return;
108}else{
109if(!_17){
110location.href="#"+_18.search.substring(1);
111_19();
112_b();
113}
114}
115}
116}
117setTimeout(dojo.hitch(this,this.pollLocation),_7);
118};
119_19();
120setTimeout(dojo.hitch(this,this.pollLocation),_7);
121};
122dojo.addOnLoad(function(){
123if("onhashchange" in dojo.global&&(!dojo.isIE||(dojo.isIE>=8&&document.compatMode!="BackCompat"))){
124dojo.connect(dojo.global,"onhashchange",_b);
125}else{
126if(document.addEventListener){
127_5=_3();
128setInterval(_c,_7);
129}else{
130if(document.attachEvent){
131_6=new _10();
132}
133}
134}
135});
136})();
137}