From 663cb0fdbee55cf0c9526b7486a1daa7b1e137e1 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 21 May 2013 11:17:46 -0700 Subject: [PATCH] Fix background hash param logic --- js/id/id.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/id/id.js b/js/id/id.js index f43f44d1e..f68a81b7f 100644 --- a/js/id/id.js +++ b/js/id/id.js @@ -182,18 +182,21 @@ window.iD = function () { return context; }; - var q = iD.util.stringQs(location.hash.substring(1)), detected = false; - if (q.layer && q.layer.indexOf('custom:') === 0) { + var q = iD.util.stringQs(location.hash.substring(1)), + detected = false, + background = q.background || q.layer; + + if (background && background.indexOf('custom:') === 0) { context.layers()[0] .source(iD.BackgroundSource.template({ - template: q.layer.replace(/^custom:/, ''), + template: background.replace(/^custom:/, ''), name: 'Custom' })); detected = true; - } else if (q.layer) { + } else if (background) { context.layers()[0] .source(_.find(backgroundSources, function(l) { - if (l.data.sourcetag === q.layer) { + if (l.data.sourcetag === background) { detected = true; return true; }