projects
/
mkws-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
bedeb81
)
Only init if there are widgets MKWS-166
author
Jason Skomorowski
<jason@indexdata.com>
Fri, 16 May 2014 03:46:33 +0000
(23:46 -0400)
committer
Jason Skomorowski
<jason@indexdata.com>
Fri, 16 May 2014 03:46:33 +0000
(23:46 -0400)
src/mkws-core.js
patch
|
blob
|
history
diff --git
a/src/mkws-core.js
b/src/mkws-core.js
index
6eb53bd
..
c7c2863
100644
(file)
--- a/
src/mkws-core.js
+++ b/
src/mkws-core.js
@@
-429,7
+429,7
@@
mkws.pagerNext = function(tname) {
function selectorForAllWidgets() {
function selectorForAllWidgets() {
- if (mkws.config.scan_all_nodes) {
+ if (mkws.config && mkws.config.scan_all_nodes) {
// This is the old version, which works by telling jQuery to
// find every node that has a class beginning with "mkws". In
// theory it should be slower than the class-based selector; but
// This is the old version, which works by telling jQuery to
// find every node that has a class beginning with "mkws". In
// theory it should be slower than the class-based selector; but
@@
-476,7
+476,8
@@
mkws.pagerNext = function(tname) {
}
}
- $(document).ready(function() {
+ function init(rootsel) {
+ if (!rootsel) var rootsel = ':root';
var saved_config;
if (typeof mkws_config === 'undefined') {
log("setting empty config");
var saved_config;
if (typeof mkws_config === 'undefined') {
log("setting empty config");
@@
-541,7
+542,7
@@
mkws.pagerNext = function(tname) {
}
var then = $.now();
}
var then = $.now();
- makeWidgetsWithin(1, $(':root'));
+ makeWidgetsWithin(1, $(rootsel));
var now = $.now();
log("Walking MKWS nodes took " + (now-then) + " ms");
var now = $.now();
log("Walking MKWS nodes took " + (now-then) + " ms");
@@
-564,5
+565,9
@@
mkws.pagerNext = function(tname) {
// raw pp2
runAutoSearches();
}
// raw pp2
runAutoSearches();
}
+ };
+ $(document).ready(function() {
+ var widgetSelector = selectorForAllWidgets();
+ if (widgetSelector && $(widgetSelector).length !== 0) init();
});
})(jQuery);
});
})(jQuery);