Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* proxy.php
- *<?= file_get_contents($_POST['address']);?>
- */
- (function ($) {
- $(function () {
- $('<input>', {type : 'text'}).insertBefore('#product-node-form')
- .bind('change',function () {
- $.ajax({
- url : '/proxy.php',
- type : 'POST',
- data : { address : $(this).val() },
- success : function (response) {
- var $r = $(response);
- $('#edit-title').val($('#squeeze h2', $r).text());
- $('#edit-field-product-und-form-sku').val($('.product-info.model', $r).text().replace('Артикул: ', ''));
- $('#edit-body-und-0-value').val($('.product-body', $r).html());
- $('#edit-body-und-0-format--2').val('full_html');
- $('#edit-field-catalog-und').val(4);
- $('#edit-field-product-und-form-commerce-price-und-0-amount').val($('.product-info.sell', $r).text().replace(' грн', ''));
- var k = 0;
- $('.field-field-image-cache a', $r).each(function () {
- var $this = $(this);
- setTimeout(function () {
- $('#edit-field-img .filefield-sources-list .filefield-source-remote').last().trigger('click');
- $('#edit-field-img .image-widget-data .form-text').last().val($this.attr('href'));
- $('#edit-field-img .image-widget-data .form-submit').last().trigger('mousedown');
- }, 8000 * k);
- k++;
- });
- setTimeout(function () {
- $('#edit-submit').trigger('click')
- }, 8000 * k);
- }
- });
- }).get(0).focus();
- });
- })(jQuery)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement