Skip to content

Commit 85a0f51

Browse files
committed
support for defaultPattern
1 parent b8382b0 commit 85a0f51

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/js/styleguide.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,17 +502,17 @@
502502
updateViewportWidth(vpWidth);
503503
}
504504

505-
// load the iframe source
506-
var patternName = "all";
507-
var patternPath = "";
508-
var iFramePath = window.location.protocol+"//"+window.location.host+window.location.pathname.replace("index.html","")+"styleguide/html/styleguide.html?"+Date.now();
505+
// set up the defaults for the
506+
var baseIframePath = window.location.protocol+"//"+window.location.host+window.location.pathname.replace("index.html","");
507+
var patternName = ((config.defaultPattern !== undefined) && (typeof config.defaultPattern === 'string') && (config.defaultPattern.trim().length > 0)) ? config.defaultPattern : 'all';
508+
var iFramePath = baseIframePath+"styleguide/html/styleguide.html?"+Date.now();
509509
if ((oGetVars.p !== undefined) || (oGetVars.pattern !== undefined)) {
510510
patternName = (oGetVars.p !== undefined) ? oGetVars.p : oGetVars.pattern;
511-
patternPath = urlHandler.getFileName(patternName);
512-
iFramePath = (patternPath !== "") ? window.location.protocol+"//"+window.location.host+window.location.pathname.replace("index.html","")+patternPath+"?"+Date.now() : iFramePath;
513511
}
514512

515513
if (patternName !== "all") {
514+
patternPath = urlHandler.getFileName(patternName);
515+
iFramePath = (patternPath !== "") ? baseIframePath+patternPath+"?"+Date.now() : iFramePath;
516516
document.getElementById("title").innerHTML = "Pattern Lab - "+patternName;
517517
history.replaceState({ "pattern": patternName }, null, null);
518518
}

0 commit comments

Comments
 (0)