/*******************************************************************************
* Copyright (c) 2017 Kumar Rishabh and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution, and is available at
* http://www.apache.org/licenses/LICENSE-2.0
*******************************************************************************/
$(document).ready( function() {
var search_result_string_1 = `
grade
PenguinScore: 42
Tags:
`;
var search_result_string_2 = `
`;
var search_result_string_3 = `
more
`;
//var replace_search_result_string = function(search_result_string,
var search_result = function(string1, string3, result) {
var string_replacement = {};
//alert(JSON.stringify(result));
for (var k in result) {
if (result.hasOwnProperty(k)) {
string_replacement['%' + k + '%'] = result[k];
if(!string_replacement['%' + k + '%']) {
string_replacement['%' + k + '%'] = -1;
}
}
}
//alert(JSON.stringify(string_replacement));
string1 = string1.replace(/%\w+%/g, function(all) {
return string_replacement[all] || all;
});
for(index in string_replacement['%tags%']) {
string1 += '';
}
string3 = string3.replace(/%\w+%/g, function(all) {
return string_replacement[all] || all;
});
return string1 + string3;
};
var QueryString = function () {
// This function is anonymous, is executed immediately and
// the return value is assigned to QueryString!
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i