Changeset 18640 for trunk/MobileIndico


Ignore:
Timestamp:
09/25/16 17:19:41 (8 years ago)
Author:
tbretz
Message:
Allow to specify the Indico URL on the command line
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MobileIndico/indico.js

    r18639 r18640  
    1 var indico_url = "https://indico.scc.kit.edu/indico/";
     1var default_url = "https://indico.scc.kit.edu/indico/";
    22var default_event = 215;
    33
     
    77        $('#debug').append("<pre>"+JSON.stringify(result,null,2)+"</pre>");
    88
    9     $("#indico-link").attr("href", indico_url+"/event/"+ID)
     9    $("#indico-link").attr("href", default_url+"/event/"+ID)
    1010
    1111    var conf = result['results'][ID];
     
    231231     ----------------------------------------------------------------------------------------------*/
    232232
    233     var ID = window.location.href.split("?")[1];
     233    var cmd = window.location.href.split("?")[1];
     234
     235    var ID  = cmd ? cmd.split("&").find(function(str){ return str.split("=")[0]=="id"; })  : null;
     236    var URL = cmd ? cmd.split("&").find(function(str){ return str.split("=")[0]=="url"; }) : null;
    234237
    235238    if (ID)
    236         ID = ID.split("&").find(function(str){ return str.split("=")[0]=="id"; });
    237 
    238     ID = !ID ? default_event : ID.split("=")[1];
    239 
    240     $.getJSON(indico_url+"/export/timetable/"+ID+".jsonp?callback=?");
     239        default_event = ID.split("=")[1];
     240    if (URL)
     241        default_url = URL.split("=")[1];
     242
     243    $.getJSON(default_url+"/export/timetable/"+default_event+".jsonp?callback=?");
     244    //$.getJSON(indico_url+"/export/event/"+ID+".jsonp?callback=?");
     245    // json.results[0].title
    241246}
    242247
Note: See TracChangeset for help on using the changeset viewer.