/** * Estimated Delivery - Front Office Feature * * NOTICE OF LICENSE * * @author Pol Rué * @copyright Smart Modules 2015 * @license One time purchase Licence (You can modify or resell the product but just one time per licence) * @version 3.3.1 * @category Transport & Logistics * Registered Trademark & Property of Smart-Modules.prpo * * *************************************************** * * Estimated Delivery * * * http://www.smart-modules.com * * * V 3.3.1 * * *************************************************** */ $(document).ready(function() { ed_product_placement_init(10); }); function ed_product_placement_init(tries) { if (typeof ed_placement !== 'undefined') { // Update those two values to adapt it to any module. var position = ed_placement; var selector = '#estimateddelivery'; if (position > 0) { ed_product_placement(selector, position, 10); //, false); } /*$(document).on('click change select keydown', '#add-to-cart-or-refresh', function() { setTimeout(function() { ed_product_placement(selector, position, 10, true); }, 500); });*/ } else { if (tries > 0) { setTimeout(function() { ed_product_placement_init(tries-1); }, 200); } } } function ed_product_placement(selector, position, tries) // WAS , repopulate) { var main_position = Math.ceil(position / 2); // Move videos if the Side Position is not 0 var destination = ['', ['h1[itemprop=name]', 'h2[itemprop=name]', 'h1', 'h2'], ['[itemprop=description]', '.description'], '.product-prices', '.product-add-to-cart']; if (tries > 0) { var dest = ''; if ($(selector).length > 0) { for (var i = 0; i < destination[main_position].length; i++) { if (typeof destination[main_position] === 'object') { dest = destination[main_position][i]; } else { dest = destination[main_position]; } //console.log('Busco: '+key); //console.log('Mes precisament: "'+dest+'"'); if ($(dest).length > 0) { if (position % 2 === 0) { if (!$(dest).first().next().is(selector)) { $(selector).first().insertAfter($(dest+':eq(0)')); } } else { if (!$(dest).first().prev().is(selector)) { $(selector).first().insertBefore($(dest+':eq(0)')); } } $(selector).first().addClass('moved'); $(selector).first().removeClass('hide-default'); //break; return false; } } } else { setTimeout(function() { ed_product_placement(selector, position, tries-1); }, 150); } } }