X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=experiments%2Fspclient%2Fmkws.js;h=30bf3b21d93fe2c6904b6cb07fda0602c8ae8f1a;hb=cc0a141ede859ae7729f682c6c547829628f85ad;hp=9e14bdb329f246898b48b2d530ce44fb819bca80;hpb=fcc0cd41a84c5669f6a74bc3836e8ea86eb855f1;p=mkws-moved-to-github.git diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 9e14bdb..30bf3b2 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -1,18 +1,29 @@ /* A very simple client that shows a basic usage of the pz2.js */ +"use strict"; // HTML5 + +if (!mkws_config) + var mkws_config = {}; // for the guys who forgot to define mkws_config... + +var pazpar2_url = mkws_config.pazpar2_url ? mkws_config.pazpar2_url : "/pazpar2/search.pz2"; +var service_proxy_url = mkws_config.service_proxy_url ? mkws_config.service_proxy_url : "/service-proxy/"; + +var pazpar2path = mkws_config.use_service_proxy ? service_proxy_url : pazpar2_url; +var usesessions = mkws_config.use_service_proxy ? false : true; + // create a parameters array and pass it to the pz2's constructor // then register the form submit event with the pz2.search function // autoInit is set to true on default var my_paz = new pz2( { "onshow": my_onshow, "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way - "pazpar2path": '/service-proxy/', + "pazpar2path": pazpar2path, "oninit": my_oninit, "onstat": my_onstat, "onterm": my_onterm, "termlist": "xtargets,subject,author", "onbytarget": my_onbytarget, - "usesessions" : false, + "usesessions" : usesessions, "showResponseType": '', // or "json" (for debugging?) "onrecord": my_onrecord } ); // some state vars @@ -384,7 +395,7 @@ function mkws_html_all(data) { sort_default: "relevance", perpage_default: 20, query_width: 50, - mkws_switch: true, /* show/hide Records|Targets menu */ + switch: true, /* show/hide Records|Targets menu */ dummy: "dummy" }; @@ -394,7 +405,44 @@ function mkws_html_all(data) { config[k] = data[k]; } + // For some reason, doing this programmatically results in + // document.search.query being undefined, hence the raw HTML. + $("#mkwsSearch").html('\ +
'); + $("#mkwsRecords").html('\ +\ + \ + | \ +\
+ \
+ \
+ \
+ \
+ \
+ \
+ | \
+
\ - \ - | \ -\
- \
- \
- \
- \
- \
- \
- | \
-