|  | @@ -3,6 +3,8 @@
 | 
	
		
			
				|  |  |  function Versioner(){
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      this.version_prefix = "v/";
 | 
	
		
			
				|  |  | +    this.default_version = "latest";
 | 
	
		
			
				|  |  | +    this.default_path = "/index.html"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      this.main = ()=>{
 | 
	
		
			
				|  |  |          this.main_frame = document.getElementById("Versioner_mainframe");
 | 
	
	
		
			
				|  | @@ -12,7 +14,8 @@ function Versioner(){
 | 
	
		
			
				|  |  |          this.data_script.addEventListener("load", this.loadData.bind(this));
 | 
	
		
			
				|  |  |          document.body.append(this.data_script)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        this.main_frame.addEventListener("load", this.updateMainFrame.bind(this));
 | 
	
		
			
				|  |  | +        this.main_frame.addEventListener("load", this.updateMainFrame);
 | 
	
		
			
				|  |  | +        window.addEventListener("message", console.log);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          this.selector.addEventListener("change", ((e)=>{
 | 
	
		
			
				|  |  |              this.version = this.selector.selectedOptions[0].value;
 | 
	
	
		
			
				|  | @@ -30,13 +33,17 @@ function Versioner(){
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    this.updateMainFrame = (e)=>{
 | 
	
		
			
				|  |  | -        var subp = e.target.contentWindow.location.pathname;
 | 
	
		
			
				|  |  | +    this.updateMainFrame = (loc)=>{
 | 
	
		
			
				|  |  | +        // var subp = e.target.contentWindow.location.pathname;
 | 
	
		
			
				|  |  | +        var subp = this.main_frame.contentWindow.location.pathname;
 | 
	
		
			
				|  |  | +        console.log(subp)
 | 
	
		
			
				|  |  |          if(subp.search(location.pathname)==0){
 | 
	
		
			
				|  |  |              var sub_relpath = subp.slice(location.pathname.length);
 | 
	
		
			
				|  |  |              this.path = sub_relpath.slice(this.version.length);
 | 
	
		
			
				|  |  |              this.path = this.path.slice(this.version_prefix.length)
 | 
	
		
			
				|  |  |              this.updateUri(false);
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            window.location.href = this.main_frame.contentWindow.location.href;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -55,7 +62,7 @@ function Versioner(){
 | 
	
		
			
				|  |  |              this.path = path;
 | 
	
		
			
				|  |  |          } 
 | 
	
		
			
				|  |  |          if (!this.path){
 | 
	
		
			
				|  |  | -            this.path = "";
 | 
	
		
			
				|  |  | +            this.path = this.default_path;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          var query = "?v="+ this.version +"&p=" + this.path;
 | 
	
		
			
				|  |  |          window.history.replaceState("","",query);
 |