Advertisement
Punk_UnDeaD

перенос материала с сайта в форму ввода

Apr 15th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* proxy.php
  2. *<?= file_get_contents($_POST['address']);?>
  3. */
  4. (function ($) {
  5.  
  6. $(function () {
  7.     $('<input>', {type : 'text'}).insertBefore('#product-node-form')
  8.       .bind('change',function () {
  9.         $.ajax({
  10.           url     : '/proxy.php',
  11.           type    : 'POST',
  12.           data    : { address : $(this).val() },
  13.           success : function (response) {
  14.             var $r = $(response);
  15.             $('#edit-title').val($('#squeeze h2', $r).text());
  16.             $('#edit-field-product-und-form-sku').val($('.product-info.model', $r).text().replace('Артикул: ', ''));
  17.             $('#edit-body-und-0-value').val($('.product-body', $r).html());
  18.             $('#edit-body-und-0-format--2').val('full_html');
  19.             $('#edit-field-catalog-und').val(4);
  20.             $('#edit-field-product-und-form-commerce-price-und-0-amount').val($('.product-info.sell', $r).text().replace(' грн', ''));
  21.  
  22.             var k = 0;
  23.             $('.field-field-image-cache a', $r).each(function () {
  24.               var $this = $(this);
  25.               setTimeout(function () {
  26.                 $('#edit-field-img .filefield-sources-list .filefield-source-remote').last().trigger('click');
  27.                 $('#edit-field-img .image-widget-data .form-text').last().val($this.attr('href'));
  28.                 $('#edit-field-img .image-widget-data .form-submit').last().trigger('mousedown');
  29.               }, 8000 * k);
  30.               k++;
  31.             });
  32.             setTimeout(function () {
  33.               $('#edit-submit').trigger('click')
  34.             }, 8000 * k);
  35.           }
  36.         });
  37.       }).get(0).focus();
  38.  
  39.   });
  40. })(jQuery)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement