From 0cc040cf170384fba98690f79e5440971226d171 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 31 Aug 2014 10:14:15 +0100 Subject: [PATCH] Partially revert 5dac229eb87 --- js/crm.ajax.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 6fb3eba935..2dbcdb738f 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -9,15 +9,12 @@ * @param string|object params * @param string mode - optionally specify "front" or "back" */ - var tplURL = '/civicrm/example?placeholder'; - var urlInitted = false; + var tplURL; CRM.url = function (p, params, mode) { if (p == "init") { - tplURL = params; - urlInitted = true; - return; + return tplURL = params; } - if (!urlInitted) { + if (!tplURL) { console && console.log && console.log('Warning: CRM.url called before initialization'); } if (!mode) { @@ -25,7 +22,7 @@ } params = params || ''; var frag = p.split ('?'); - var url = tplURL.replace("civicrm/example", frag[0]); + var url = tplURL[mode].replace("civicrm/example", frag[0]); if (typeof(params) == 'string') { url = url.replace("placeholder", params); -- 2.25.1