Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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