X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=7a260f237a79e077dd81ae72315a2f03ff31eb16;hb=c2b2c85103cd0ff40d8c121af9abdc7da2cb28ec;hp=a485f34c351fa6bd067467e990fc5e8b421c0cdb;hpb=acc4c917f360440927547e958ebd32b1d2aca711;p=mkws-moved-to-github.git diff --git a/src/mkws-core.js b/src/mkws-core.js index a485f34..7a260f2 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -84,35 +84,37 @@ if (mkws_config == null || typeof mkws_config != 'object') { } -// wrapper to call team() after page load -(function (j) { - function log(string) { - if (!mkws.log_level) - return; +mkws.log = function(string) { + if (!mkws.log_level) + return; - if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */ - return; - } + if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */ + return; + } - // you need to disable use strict at the top of the file!!! - if (mkws.log_level >= 3) { - console.log(arguments.callee.caller); - } else if (mkws.log_level >= 2) { - console.log(">>> called from function " + arguments.callee.caller.name + ' <<<'); - } - console.log(string); + // you need to disable use strict at the top of the file!!! + if (mkws.log_level >= 3) { + console.log(arguments.callee.caller); + } else if (mkws.log_level >= 2) { + console.log(">>> called from function " + arguments.callee.caller.name + ' <<<'); } - mkws.log = log; + console.log(string); +}; + +// wrapper to call team() after page load +(function(j) { + var log = mkws.log; + mkws.registerWidgetType = function(name, fn) { mkws.widgetType2function[name] = fn; log("registered widget-type '" + name + "'"); - } + }; mkws.promotionFunction = function(name) { return mkws.widgetType2function[name]; - } + }; function handleNodeWithTeam(node, callback) { @@ -179,39 +181,39 @@ if (mkws_config == null || typeof mkws_config != 'object') { // this module. mkws.switchView = function(tname, view) { mkws.teams[tname].switchView(view); - } + }; - mkws.showDetails = function (tname, prefixRecId) { + mkws.showDetails = function(tname, prefixRecId) { mkws.teams[tname].showDetails(prefixRecId); - } + }; - mkws.limitTarget = function (tname, id, name) { + mkws.limitTarget = function(tname, id, name) { mkws.teams[tname].limitTarget(id, name); - } + }; - mkws.limitQuery = function (tname, field, value) { + mkws.limitQuery = function(tname, field, value) { mkws.teams[tname].limitQuery(field, value); - } + }; - mkws.delimitTarget = function (tname, id) { + mkws.delimitTarget = function(tname, id) { mkws.teams[tname].delimitTarget(id); - } + }; - mkws.delimitQuery = function (tname, field, value) { + mkws.delimitQuery = function(tname, field, value) { mkws.teams[tname].delimitQuery(field, value); - } + }; - mkws.showPage = function (tname, pageNum) { + mkws.showPage = function(tname, pageNum) { mkws.teams[tname].showPage(pageNum); - } + }; - mkws.pagerPrev = function (tname) { + mkws.pagerPrev = function(tname) { mkws.teams[tname].pagerPrev(); - } + }; - mkws.pagerNext = function (tname) { + mkws.pagerNext = function(tname) { mkws.teams[tname].pagerNext(); - } + }; function defaultMkwsConfig() { @@ -362,7 +364,7 @@ if (mkws_config == null || typeof mkws_config != 'object') { // For all MKWS-classed nodes that don't have a team // specified, set the team to AUTO. - $('[class^="mkws"],[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'); @@ -372,7 +374,7 @@ if (mkws_config == null || typeof mkws_config != 'object') { // Find all nodes with an MKWS class, and determine their team from // the mkwsTeam_* class. Make all team objects. var then = $.now(); - $('[class^="mkws"],[class*=" mkws"]').each(function () { + $('[class^="mkws"],[class*=" mkws"]').each(function() { handleNodeWithTeam(this, function(tname, type) { if (!mkws.teams[tname]) { mkws.teams[tname] = team(j, tname); @@ -384,7 +386,7 @@ if (mkws_config == null || typeof mkws_config != 'object') { // to be done separately, and after the team-creation, since // that sometimes makes new widget nodes (e.g. creating // mkwsTermlists inside mkwsResults. - $('[class^="mkws"],[class*=" mkws"]').each(function () { + $('[class^="mkws"],[class*=" mkws"]').each(function() { handleNodeWithTeam(this, function(tname, type) { var myTeam = mkws.teams[tname]; var myWidget = widget(j, myTeam, type, this);