X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=0d5868eff1daf608cea30e2979119f66752568ce;hb=1cf7757402c2edd03643afe3c379e222e2d960e7;hp=bbd0b12815d656223fffadfd52a92a4c24747c32;hpb=6b14f700b44f78cad22a1292b6441b8e610497a1;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index bbd0b12..0d5868e 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1,4 +1,7 @@ -/*! MKWS, the MasterKey Widget Set. Copyright (C) 2013-2014, Index Data */ +/*! MKWS, the MasterKey Widget Set. + * Copyright (C) 2013-2014 Index Data + * See the file LICENSE for details + */ "use strict"; // HTML5: disable for debug_level >= 2 @@ -306,12 +309,12 @@ function team($, teamName) { debug("term for " + teamName); // no facets if (!mkws_config.facets || mkws_config.facets.length == 0) { - $("#mkwsTermlists").hide(); + $(".mkwsTermlists.mkwsTeam_" + teamName).hide(); return; } // display if we first got results - $("#mkwsTermlists").show(); + $(".mkwsTermlists.mkwsTeam_" + teamName).show(); var acc = []; acc.push('
' + M('Termlists') + '
'); @@ -329,7 +332,7 @@ function team($, teamName) { } } - var termlist = $("#mkwsTermlists"); + var termlist = $(".mkwsTermlists.mkwsTeam_" + teamName); if (termlist) termlist.html(acc.join('')); } @@ -902,19 +905,19 @@ function team($, teamName) { $(".mkwsResults.mkwsTeam_" + m_teamName).html('\ \ \ - \ \ \ \ \ \
\ -
\ +
\ +
\
\ -
\ -
\ -
\ -
\ +
\ +
\ +
\ +
\
\ -
\ +
\
'); @@ -1290,17 +1293,16 @@ function _mkws_jquery_plugin ($) { // For all MKWS-classed nodes that don't have a team // specified, set the team to AUTO. - $('div[class^="mkws"],div[class*=" mkws"]').each(function () { + $('[class^="mkws"],[class*=" mkws"]').each(function () { if (!this.className.match(/mkwsTeam_/)) { log("adding AUTO team to node with class '" + this.className + "'"); $(this).addClass('mkwsTeam_AUTO'); } }); - // Find all nodes with class (NOT id) mkwsRecords, and - // determine their team from the mkwsTeam_* class. So: - //
- $('.mkwsSearch, .mkwsResults, .mkwsRecords, .mkwsTermlists').each(function () { + // Find all nodes with an class, and determine their team from + // the mkwsTeam_* class. Make all team objects. + $('[class^="mkws"],[class*=" mkws"]').each(function () { var node = this; mkws.handle_node_with_team(node, function(tname) { if (mkws.teams[tname]) { @@ -1338,28 +1340,32 @@ function _mkws_jquery_plugin ($) { mkws.resize_page = function () { - var list = ["mkwsSwitch"]; + var list = ["mkwsSwitch", "mkwsLang"]; var width = mkws_config.responsive_design_width; - var parentId = $("#mkwsTermlists").parent().attr('id'); + var parent = $(".mkwsTermlists").parent(); if ($(window).width() <= width && - parentId === "mkwsTermlistContainer1") { + parent.hasClass("mkwsTermlistContainer1")) { log("changing from wide to narrow: " + $(window).width()); - $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer2")); - $("#mkwsTermlistContainer1").hide(); - $("#mkwsTermlistContainer2").show(); - for(var i = 0; i < list.length; i++) { - $("#" + list[i]).hide(); // ### make team-aware + $(".mkwsTermlistContainer1").hide(); + $(".mkwsTermlistContainer2").show(); + for (var tname in mkws.teams) { + $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer2.mkwsTeam_" + tname)); + for(var i = 0; i < list.length; i++) { + $("." + list[i] + ".mkwsTeam_" + tname).hide(); + } } } else if ($(window).width() > width && - parentId === "mkwsTermlistContainer2") { + parent.hasClass("mkwsTermlistContainer2")) { log("changing from narrow to wide: " + $(window).width()); - $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer1")); - $("#mkwsTermlistContainer1").show(); - $("#mkwsTermlistContainer2").hide(); - for(var i = 0; i < list.length; i++) { - $("#" + list[i]).show(); // ### make team-aware + $(".mkwsTermlistContainer1").show(); + $(".mkwsTermlistContainer2").hide(); + for (var tname in mkws.teams) { + $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer1.mkwsTeam_" + tname)); + for(var i = 0; i < list.length; i++) { + $("." + list[i] + ".mkwsTeam_" + tname).show(); + } } } };