1
0
mirror of https://github.com/pattern-lab/patternlab-php.git synced 2025-01-18 06:38:20 +01:00

fixing a bad loop

This commit is contained in:
Dave Olsen 2014-02-11 19:44:46 -05:00
parent 6de3450990
commit cd04a94dba

View File

@ -127,7 +127,9 @@ var urlHandler = {
pushPattern: function (pattern, givenPath) {
var data = { "pattern": pattern };
var fileName = urlHandler.getFileName(pattern);
var expectedPath = window.location.protocol+"//"+window.location.host+window.location.pathname.replace("public/index.html","public/")+fileName;
var path = window.location.pathname;
path = (window.location.protocol === "file") ? path.replace("/public/index.html","public/") : path.replace(/\/index\.html/,"/");
var expectedPath = window.location.protocol+"//"+window.location.host+path+fileName;
if (givenPath != expectedPath) {
// make sure to update the iframe because there was a click
document.getElementById("sg-viewport").contentWindow.postMessage( { "path": fileName }, urlHandler.targetOrigin);