Skip to content

Commit

Permalink
fix getScriptInfo to specifically find vogue-client.js instead of ass…
Browse files Browse the repository at this point in the history
…uming it's the last entry in scripts array
  • Loading branch information
anentropic committed Nov 5, 2011
1 parent de5a05f commit 6427d31
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/client/vogue-client.js
Expand Up @@ -228,8 +228,10 @@
scripts, src, rootUrl, baseMatch;
if (typeof window.__vogue__ === "undefined") {
scripts = document.getElementsByTagName("script");
// The last parsed script will be our script.
src = scripts[scripts.length - 1].getAttribute("src");
for (var i=0; i < scripts.length; i++) {
src = scripts[i].getAttribute("src");
if (src.slice(-15) == 'vogue-client.js') break;
}
rootUrl = src.match(/^https?\:\/\/(.*?)\//)[0];
// There is an optional base argument, that can be used.
baseMatch = src.match(/\bbase=(.*)(&|$)/);
Expand Down

0 comments on commit 6427d31

Please sign in to comment.