From: Mike Taylor Date: Mon, 20 Oct 2014 10:29:56 +0000 (+0100) Subject: Merge X-Git-Tag: 1.0.0~155^2~7 X-Git-Url: http://lists.indexdata.com/cgi-bin?a=commitdiff_plain;h=d7f7e11af10210fd9872cedc1489fe0b692ca589;p=mkws-moved-to-github.git Merge --- d7f7e11af10210fd9872cedc1489fe0b692ca589 diff --cc src/mkws-core.js index fc63469,3a4fa5b..12fbcf4 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@@ -286,25 -286,7 +286,24 @@@ mkws.log("Using window.name '" + window // wrapper to provide local copy of the jQuery object. (function($) { var log = mkws.log; + var _old2new = { // Maps old-style widget names to new-style + 'Authname': 'auth-name', + 'ConsoleBuilder': 'console-builder', + 'Coverart': 'cover-art', + 'GoogleImage': 'google-image', + 'MOTD': 'motd', + 'MOTDContainer': 'motd-container', + 'Perpage': 'per-page', + 'SearchForm': 'search-form', + }; + // Annoyingly, there is no built-in way to invert a hash + var _new2old = {}; + for (var key in _old2new) { + if(_old2new.hasOwnProperty(key)) { + _new2old[_old2new[key]] = key; + } + } - function handleNodeWithTeam(node, callback) { // First branch for DOM objects; second branch for jQuery objects var classes = node.className || node.attr('class'); @@@ -321,15 -303,10 +320,12 @@@ for (var i = 0; i < list.length; i++) { var cname = list[i]; - if (cname.match(/^mkws-team-/)) { - teamName = cname.replace(/^mkws-team-/, ''); - } else if (cname.match(/^mkws-/)) { - // New-style names of the form mkws-foo-bar - type = cname.replace(/^mkws-/, ''); + if (cname.match(/^mkwsTeam_/)) { + teamName = cname.replace(/^mkwsTeam_/, ''); } else if (cname.match(/^mkws/)) { - type = cname.replace(/^mkws/, ''); + // Old-style names of the form mkwsFooBar + var tmp = cname.replace(/^mkws/, ''); + type = _old2new[tmp] || tmp.toLowerCase(); } }