Created
October 3, 2017 16:29
-
-
Save bradfrost/1ab38c3ddf108d2bd7f7bd4731ac5db4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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