X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-core.js;h=893951cbacc001adb4066f1dd9da5800a6015a6e;hb=86f25a52eba4a79b06c614fee9279ea583b1d549;hp=e0d4e2fe82fbc0c4e31d6caa913eb9ecbba9ce80;hpb=5d8e7413a0b5321c314f5826d131f11c005dd911;p=mkws-moved-to-github.git diff --git a/src/mkws-core.js b/src/mkws-core.js index e0d4e2f..893951c 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -102,6 +102,16 @@ mkws.log = function(string) { }; +mkws.objectWithParent = function(parent) { + function thing() {} // Must be function so `prototype' works + + thing.prototype = parent; + var res = new thing(); + thing.prototype = null; + return res; +}; + + mkws.registerWidgetType = function(name, fn) { mkws.widgetType2function[name] = fn; mkws.log("registered widget-type '" + name + "'"); @@ -310,11 +320,6 @@ mkws.pagerNext = function(tname) { $(document).ready(function() { mkws.defaultMkwsConfig(); - if (mkws_config.query_width < 5 || mkws_config.query_width > 150) { - log("Reset query width: " + mkws_config.query_width); - mkws_config.query_width = 50; - } - for (var key in mkws_config) { if (mkws_config.hasOwnProperty(key)) { if (key.match(/^language_/)) { @@ -326,12 +331,9 @@ mkws.pagerNext = function(tname) { } } - if (mkws_config.responsive_design_width) { - // Responsive web design - change layout on the fly based on - // current screen width. Required for mobile devices. - $(window).resize(resizePage); - // initial check after page load - $(document).ready(resizePage); + if (mkws_config.query_width < 5 || mkws_config.query_width > 150) { + log("Reset query width: " + mkws_config.query_width); + mkws_config.query_width = 50; } // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp" @@ -340,6 +342,14 @@ mkws.pagerNext = function(tname) { log("adjust protocol independent links: " + mkws_config.pazpar2_url); } + if (mkws_config.responsive_design_width) { + // Responsive web design - change layout on the fly based on + // current screen width. Required for mobile devices. + $(window).resize(resizePage); + // initial check after page load + $(document).ready(resizePage); + } + // Backwards compatibility: set new magic class names on any // elements that have the old magic IDs. var ids = [ "Switch", "Lang", "Search", "Pager", "Navi",