X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=fe29a5eff399d0e1925208279e4c1a215f1b6968;hb=a69a66b88e3317022c375792df0b1c3689431496;hp=b5e9908d090b3b11d3a8bed64182269b33844d0a;hpb=34edef98d30a3445451981ffd029b8681729f734;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index b5e9908..fe29a5e 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 @@ -268,10 +258,8 @@ function team($, teamName) { function onBytarget(data, teamName) { debug("target"); - var targetDiv = findnode('.mkwsBytarget'); - if (!targetDiv) { - return; - } + var node = findnode('.mkwsBytarget'); + if (node.length === 0) return; var table ='' + '' + @@ -290,17 +278,16 @@ function team($, teamName) { } table += '
' + M('Target ID') + '
'; - targetDiv.html(table); + node.html(table); } function onStat(data, teamName) { debug("stat"); - var stat = findnode('.mkwsStat'); - if (stat.length === 0) - return; + var node = findnode('.mkwsStat'); + if (node.length === 0) return; - stat.html('' + M('Status info') + '' + + node.html('' + M('Status info') + '' + ' -- ' + '' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '' + ' -- ' + @@ -1432,6 +1419,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",