Skip to content

Instantly share code, notes, and snippets.

@bradfrost
Created October 3, 2017 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradfrost/1ab38c3ddf108d2bd7f7bd4731ac5db4 to your computer and use it in GitHub Desktop.
Save bradfrost/1ab38c3ddf108d2bd7f7bd4731ac5db4 to your computer and use it in GitHub Desktop.
// set up the defaults for the
var baseIframePath = window.location.protocol + "//" + window.location.host + window.location.pathname.replace("index.html", "");
var patternName = ((config.defaultPattern !== undefined) && (typeof config.defaultPattern === 'string') && (config.defaultPattern.trim().length > 0)) ? config.defaultPattern : 'all';
var iFramePath = baseIframePath + "styleguide/html/styleguide.html?" + Date.now();
if ((oGetVars.p !== undefined) || (oGetVars.pattern !== undefined)) {
patternName = (oGetVars.p !== undefined) ? oGetVars.p : oGetVars.pattern;
}
if (patternName !== "all") {
patternPath = urlHandler.getFileName(patternName);
iFramePath = (patternPath !== "") ? baseIframePath + patternPath + "?" + Date.now() : iFramePath;
document.getElementById("title").innerHTML = "Pattern Lab - " + patternName;
history.replaceState({
"pattern": patternName
}, null, null);
}
if (document.getElementById("sg-raw") !== undefined) {
document.getElementById("sg-raw").setAttribute("href", urlHandler.getFileName(patternName));
}
urlHandler.skipBack = true;
document.getElementById("sg-viewport").contentWindow.location.replace(iFramePath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment