X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=tools%2Fhtdocs%2Fmkws.js;h=bb96eac035787d5896331e3025a253d70f154130;hb=6a49d9b12dead08c0cc734afedb5975a6c58faaf;hp=b5e9908d090b3b11d3a8bed64182269b33844d0a;hpb=34edef98d30a3445451981ffd029b8681729f734;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index b5e9908..bb96eac 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -226,17 +226,7 @@ function team($, teamName) { debug("start running MKWS"); m_sort = mkws_config.sort_default; - debug("copied mkws_config.sort_default '" + mkws_config.sort_default + "' to m_sort"); - - if (!isNaN(parseInt(mkws_config.perpage_default))) { - m_perpage = parseInt(mkws_config.perpage_default); - } - - // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp" - if (mkws_config.pazpar2_url.match(/^\/\//)) { - mkws_config.pazpar2_url = document.location.protocol + mkws_config.pazpar2_url; - debug("adjust protocol independent links: " + mkws_config.pazpar2_url); - } + m_perpage = mkws_config.perpage_default; debug("Create main pz2 object"); // create a parameters array and pass it to the pz2's constructor @@ -269,7 +259,7 @@ function team($, teamName) { function onBytarget(data, teamName) { debug("target"); var targetDiv = findnode('.mkwsBytarget'); - if (!targetDiv) { + if (targetDiv.length === 0) { return; } @@ -296,11 +286,11 @@ function team($, teamName) { function onStat(data, teamName) { debug("stat"); - var stat = findnode('.mkwsStat'); - if (stat.length === 0) + var statDiv = findnode('.mkwsStat'); + if (statDiv.length === 0) return; - stat.html('' + M('Status info') + '' + + statDiv.html('' + M('Status info') + '' + ' -- ' + '' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '' + ' -- ' + @@ -1432,6 +1422,12 @@ function team($, teamName) { $(document).ready(function() { mkws.resizePage() }); } + // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp" + if (mkws_config.pazpar2_url.match(/^\/\//)) { + mkws_config.pazpar2_url = document.location.protocol + mkws_config.pazpar2_url; + debug("adjust protocol independent links: " + mkws_config.pazpar2_url); + } + // Backwards compatibility: set new magic class names on any // elements that have the old magic IDs. var ids = [ "Switch", "Lang", "Search", "Pager", "Navi",