');
@@ -345,9 +356,9 @@ function team($, teamName) {
if (!pzIndex) {
// Special case: target selection
acc.push('target_id='+data[i].id+' ');
- action = 'mkws.limitTarget(this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
+ action = 'mkws.limitTarget(\'' + m_teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
} else {
- action = 'mkws.limitQuery(\'' + pzIndex + '\', this.firstChild.nodeValue)';
+ action = 'mkws.limitQuery(\'' + m_teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
}
acc.push('onclick="' + action + ';return false;">' + data[i].name + ''
+ '
' + data[i].freq + '');
@@ -414,8 +425,8 @@ function team($, teamName) {
});
});
- document.mkwsSearchForm.mkwsQuery.value = '';
if (document.mkwsSelect) {
+ debug("messing with mkwsSelect");
if (document.mkwsSelect.mkwsSort)
document.mkwsSelect.mkwsSort.onchange = onSelectDdChange;
if (document.mkwsSelect.mkwsPerpage)
@@ -446,7 +457,7 @@ function team($, teamName) {
}
m_filters = []
- redraw_navi(); // ### should use windowid
+ redraw_navi();
resetPage(); // ### the globals it resents should be indexed by windowid
loadSelect(); // ### should use windowid
triggerSearch(query, sort, targets, windowid);
@@ -531,11 +542,11 @@ function team($, teamName) {
}
- // limit the query after clicking the facet
- mkws.limitQuery = function (field, value)
+ // limit by target functions
+ that.limitTarget = function (id, name)
{
- debug("limitQuery(field=" + field + ", value=" + value + ")");
- m_filters.push({ field: field, value: value });
+ debug("limitTarget(id=" + id + ", name=" + name + ")");
+ m_filters.push({ id: id, name: name });
redraw_navi();
resetPage();
loadSelect();
@@ -544,11 +555,11 @@ function team($, teamName) {
}
- // limit by target functions
- mkws.limitTarget = function (id, name)
+ // limit the query after clicking the facet
+ that.limitQuery = function (field, value)
{
- debug("limitTarget(id=" + id + ", name=" + name + ")");
- m_filters.push({ id: id, name: name });
+ debug("limitQuery(field=" + field + ", value=" + value + ")");
+ m_filters.push({ field: field, value: value });
redraw_navi();
resetPage();
loadSelect();
@@ -557,7 +568,7 @@ function team($, teamName) {
}
- mkws.delimitQuery = function (field, value)
+ that.delimitQuery = function (field, value)
{
debug("delimitQuery(field=" + field + ", value=" + value + ")");
var newFilters = [];
@@ -566,9 +577,9 @@ function team($, teamName) {
if (filter.field &&
field == filter.field &&
value == filter.value) {
- debug("delimitTarget() removing filter " + $.toJSON(filter));
+ debug("delimitQuery() removing filter " + $.toJSON(filter));
} else {
- debug("delimitTarget() keeping filter " + $.toJSON(filter));
+ debug("delimitQuery() keeping filter " + $.toJSON(filter));
newFilters.push(filter);
}
}
@@ -582,7 +593,7 @@ function team($, teamName) {
}
- mkws.delimitTarget = function (id)
+ that.delimitTarget = function (id)
{
debug("delimitTarget(id=" + id + ")");
var newFilters = [];
@@ -607,7 +618,7 @@ function team($, teamName) {
function redraw_navi ()
{
- var navi = document.getElementById('mkwsNavi');
+ var navi = $('.mkwsNavi.mkwsTeam_' + m_teamName);
if (!navi) return;
var text = "";
@@ -617,16 +628,16 @@ function team($, teamName) {
}
var filter = m_filters[i];
if (filter.id) {
- text += 'Source:
' + filter.name + '';
+ text += M('source') + ':
' + filter.name + '';
} else {
- text += filter.field + ':
' + filter.value + '';
}
}
- navi.innerHTML = text;
+ navi.html(text);
}
@@ -705,8 +716,8 @@ function team($, teamName) {
var targets = $('.mkwsTargets.mkwsTeam_' + tname);
var results = $('.mkwsResults.mkwsTeam_' + tname + ',.mkwsRecords.mkwsTeam_' + tname);
- var blanket = $('#mkwsBlanket');
- var motd = $('#mkwsMOTD');
+ var blanket = $('.mkwsBlanket.mkwsTeam_' + tname);
+ var motd = $('.mkwsMOTD.mkwsTeam_' + tname);
switch(view) {
case 'targets':
@@ -905,7 +916,7 @@ function team($, teamName) {
\
\
| \
-
\
+ | \
\
\
\
@@ -944,16 +955,18 @@ function team($, teamName) {
$(document).ready(function() { mkws.resize_page() });
}
+ debug("before domReady()");
domReady();
+ debug("after domReady()");
// on first page, hide the termlist
- $(document).ready(function() { $("#mkwsTermlists").hide(); });
- var motd = document.getElementById("mkwsMOTD");
- var container = document.getElementById("mkwsMOTDContainer");
- if (motd && container) {
+ $(document).ready(function() { $(".mkwsTermlists.mkwsTeam_" + m_teamName).hide(); });
+ var motd = $(".mkwsMOTD.mkwsTeam_" + m_teamName);
+ var container = $(".mkwsMOTDContainer.mkwsTeam_" + m_teamName);
+ debug("for team '" + m_teamName + "', motd=" + motd + "(" + motd.length + "), container=" + container + "(" + container.length + ")");
+ if (motd.length && container.length) {
// Move the MOTD from the provided element down into the container
- motd.parentNode.removeChild(motd);
- container.appendChild(motd);
+ motd.appendTo(container);
}
}
@@ -1290,17 +1303,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,11 +1350,10 @@ function _mkws_jquery_plugin ($) {
mkws.resize_page = function () {
- var list = ["mkwsSwitch"];
+ var list = ["mkwsSwitch", "mkwsLang"];
var width = mkws_config.responsive_design_width;
var parent = $(".mkwsTermlists").parent();
- log("parent = " + parent + ", length = " + parent.length);
if ($(window).width() <= width &&
parent.hasClass("mkwsTermlistContainer1")) {
@@ -1370,10 +1381,25 @@ function _mkws_jquery_plugin ($) {
};
- mkws.showDetails = function (prefixRecId, tname) {
+ mkws.showDetails = function (tname, prefixRecId) {
mkws.teams[tname].showDetails(prefixRecId);
}
+ mkws.limitTarget = function (tname, id, name) {
+ mkws.teams[tname].limitTarget(id, name);
+ }
+
+ mkws.limitQuery = function (tname, field, value) {
+ mkws.teams[tname].limitQuery(field, value);
+ }
+
+ mkws.delimitTarget = function (tname, id) {
+ mkws.teams[tname].delimitTarget(id);
+ }
+
+ mkws.delimitQuery = function (tname, field, value) {
+ mkws.teams[tname].delimitQuery(field, value);
+ }
function default_mkws_config() {
/* default mkws config */
@@ -1391,7 +1417,7 @@ function _mkws_jquery_plugin ($) {
show_sort: true, /* show/hide sort menu */
show_perpage: true, /* show/hide perpage menu */
lang_options: [], /* display languages links for given languages, [] for all */
- facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */
+ facets: ["xtargets", "subject", "author"], /* display facets, in this order, [] for none */
responsive_design_width: undefined, /* a page with less pixel width considered as narrow */
debug_level: 1, /* debug level for development: 0..2 */
|