Blame view

assets/pages/scripts/remsum/sumTmp.js 1.76 KB
10646c94   Andy   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  
  var urlarr = JSON.parse(sessionStorage.getItem("threemenulist"));
  console.log(urlarr)
  var _html = '';
  for(var i=0;i<urlarr.length;i++){
      if(i==0){
          _html  += '<li data-url="'+urlarr[i].url+'" id="button-'+urlarr[i].url+'" class="ITD-topbar-clickactive"><a href="#/'+urlarr[i].url+'"><div >'+urlarr[i].name+'</div></a></li>'
      }else{
          _html  += '<li data-url="'+urlarr[i].url+'" id="button-'+urlarr[i].url+'" ><a href="#/'+urlarr[i].url+'"><div >'+urlarr[i].name+'</div></a></li>'
      }
  }
  $('#button-btn').html(_html);
  function Router(){
      this.routes = {};
      this.curUrl = '';
  
      this.route = function(path, callback){
          this.routes[path] = callback || function(){};
      };
  
      this.refresh = function(){
          this.curUrl = location.hash.slice(1) || '/'+urlarr[0].url;
          console.log(this.curUrl)
          this.routes[this.curUrl]();
      };
  
      this.init = function(){
          window.addEventListener('load', this.refresh.bind(this), false);
          window.addEventListener('hashchange', this.refresh.bind(this), false);
      }
  }
  var R = new Router();
  R.init();
  var res = $('#main-con');
  R.route('/remsum', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/remsum/appmenuFile/remsum.css');
      res.load('../../assets/pages/scripts/remsum/appmenuFile/remsum.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-remsum').addClass('ITD-topbar-clickactive');
  });
  R.route('/apprefund', function() {
      $("#pageCssLink").attr("href",'../../assets/pages/scripts/remsum/apprefund/apprefund.css');
      res.load('../../assets/pages/scripts/remsum/apprefund/apprefund.html');
      $('.ITD-topbar-wrap li').removeClass('ITD-topbar-clickactive');
      $('#button-apprefund').addClass('ITD-topbar-clickactive');
  });