ad js file

0


var script = document.createElement("script");
script.src = "ad.js";
document.getElementsByTagName("body")[0].appendChild(script);

var js_lib = document.getElementById('picturetising_script');
var js_url = js_lib.src;
var js_url_pieces = js_url.split('?');
var head = document.getElementsByTagName('head')[0];

var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js";
script.onreadystatechange = loader;
script.onload = loader;
head.appendChild(script);

var scripts = document.createElement('script');
scripts.type = 'text/javascript';
scripts.src = "https://cdnjs.cloudflare.com/ajax/libs/simplecartjs/3.0.5/simplecart.min.js";
//scripts.onreadystatechange = handler;
//scripts.onload = handler;
head.appendChild(scripts);

var scripts = document.createElement('script');
scripts.type = 'text/javascript';
scripts.src = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js";
scripts.onreadystatechange = handler;
scripts.onload = handler;
head.appendChild(scripts);

function loader() {
var $ = jQuery;
function toggleIcon(e) {
$(e.target)
.prev('.panel-heading')
.find(".more-less")
.toggleClass('glyphicon-plus glyphicon-minus');
}
$('.panel-group').on('hidden.bs.collapse', toggleIcon);
$('.panel-group').on('shown.bs.collapse', toggleIcon);
};

function handler() {
var $ = jQuery;
var url = document.location.origin;
$.getJSON('http://dev.com:8080/api/companySalesPlatform?' + js_url_pieces[1] + '&host=' + url, function(resp) {
var htmlText = '';
for (var key in resp) {
console.log(resp[0].element_name);
htmlText += 'Android Mobile';
if (resp[0].element_name.indexOf('div_id') > -1) {
$('#' + resp[0].element_value).append(htmlText);
}
if (resp[0].element_name.indexOf('div_class') > -1) {
$('.' + resp[0].element_value).append(htmlText);
}
if (resp[0].element_name.indexOf('image_id') > -1) {
console.log('there is no image id found');
$('#' + resp[0].element_value).append(htmlText);
}
if (resp[0].element_name.indexOf('image_class') > -1) {
console.log('there is no image classs found');
$('.' + resp[0].element_value).append(htmlText);
}
}
});
$(document).on('click', ".shop_popup", function() {
var prod_id = $(this).children("img").attr('prod_id');
var sec_id = $(this).children("img").attr('sec_id');
check(prod_id); // Function call
$("#mydiv").remove();
setTimeout(function() {
related(sec_id, prod_id);
}, 1000); // Function call
});
$('head').append('');
$('head').append('');
}

function check(prod_id) {
$.getJSON('http://dev.com:8080/api/products?', 'p_id=' + prod_id, function(res) {
console.log(res);
//var dynamicText = "

";
var dynamicText = "