Compatibility fix
authorveltr
Tue, 30 Apr 2013 15:55:54 +0200
changeset 58 e0e72bb836aa
parent 57 b66bb808fb12
child 59 4d6f57d4571c
Compatibility fix
integ/iri-creation-cinecard.html
--- a/integ/iri-creation-cinecard.html	Tue Apr 30 15:36:42 2013 +0200
+++ b/integ/iri-creation-cinecard.html	Tue Apr 30 15:55:54 2013 +0200
@@ -159,15 +159,25 @@
 <!-- IRI -->
 
 <script type="text/javascript">
-	function getURLParameter(name) {
-	    return decodeURI(
-	        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||["",""])[1]
-	    );
-	}
+
+    var urlmatches = document.location.href.match(/[^?=&#]+=[^?=&#]+/g),
+        urlparams = {};
+    if (urlmatches) {
+        urlmatches.forEach(function(urlparam) {
+           var p = urlparam.split('=');
+           urlparams[p[0]] = p[1]; 
+        });
+    }
 
-	var programmeCode = getURLParameter("code") || "135082",
-	    programmeType = getURLParameter("type") || "movie",
-		partnerCode = 'B00015838755',
+	var programmeCode = "135082",
+	    programmeType = "movie";
+    ["movie","tvseries"].forEach(function(t) {
+        if (urlparams[t]) {
+            programmeType = t;
+            programmeCode = urlparams[t];
+        }
+    });
+	var partnerCode = 'B00015838755',
 		stickers_base = './iri/stickers/',
 		renkan_base = './renkan/';
 </script>