From e8fb3fc792cfaaf25eeb92b888d9a62eb364cc32 Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Thu, 3 Mar 2011 11:08:00 +0100 Subject: [PATCH] Move facet container set-up to onload To save some CPU cycles when the callback is raised --- mkdru.client.js | 11 ++++++----- mkdru.theme.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mkdru.client.js b/mkdru.client.js index 0044663..47e5da9 100644 --- a/mkdru.client.js +++ b/mkdru.client.js @@ -137,11 +137,6 @@ mkdru.contains = function (hash, key, value) { } mkdru.pz2Term = function (data) { - // if signaled, prepare container client-side - if (mkdru.facetContainerSelector) { - $(mkdru.facetContainerSelector).html(Drupal.theme('mkdruFacetContainer', - data, mkdru.facets)); - } // map all facets against selected, for simple rendering var hash = $.deparam.fragment(); for (var key in hash) { @@ -401,6 +396,12 @@ $(document).ready(function () { mkdru.defaultState['limit_' + key] = null; } + // if signaled, prepare facet container client-side + if (mkdru.facetContainerSelector) { + $(mkdru.facetContainerSelector).html(Drupal.theme('mkdruFacetContainer', + mkdru.facets)); + } + mkdru.pz2 = new pz2( { "onshow": mkdru.pz2Show, "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way "pazpar2path": mkdru.pazpar2Path, diff --git a/mkdru.theme.js b/mkdru.theme.js index ebbc45b..13886d9 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -134,6 +134,6 @@ Drupal.theme.prototype.mkdruFacet = function (terms, facet, max, selections) { return html; }; -Drupal.theme.prototype.mkdruFacetContainer = function (facets, facetCfg) { +Drupal.theme.prototype.mkdruFacetContainer = function (facetCfg) { return ""; }; -- 1.7.10.4