aliparser

sample goods

  1. // ==UserScript==
  2. // @name aliparser
  3. // @namespace Violentmonkey Scripts
  4. // @grant none
  5. // @description:en sample goods
  6. // @include http://*aliexpress.com/*
  7. // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
  8. // @version 0.0.1.20160913080900
  9. // @description sample goods
  10. // ==/UserScript==
  11.  
  12. setButton()
  13.  
  14. addEnentClick()
  15.  
  16. setIframe()
  17.  
  18. function setIframe(){
  19. // var iframe = '<iframe src="http://wshost.iam.by/" id="iframe"></iframe>';
  20. //var iframe = '<iframe src="http://tdom.in/www/ali/" id="iframe"></iframe>';
  21. //var src = 'http://wshost.iam.by/'
  22. var src = 'http://tdom.in/www/ali/'
  23. $('<iframe>').css({'width':'100%','height':'410px','z-index':1000}).prependTo('body').attr('src',src).attr('id','iframe')
  24. }
  25. function addEnentClick(){
  26. $('.addButton').click(function(){
  27. var images = $('.image-nav-item img').length ?
  28. $('.image-nav-item img') : ($('.img-thumb-item img').length ?
  29. $('.img-thumb-item img') : $('.ui-image-viewer-thumb-frame img'));
  30. var imgs = new Array();
  31. for(var i=0;i<images.length;i++){
  32. imgs[i] = images[i].src.replace('.jpg_50x50','')
  33. }
  34. if($(this).attr('data-it')=='1'){
  35. var object = {
  36. price: $('[itemprop=highPrice]').text() || $('[itemprop=price]').text(),
  37. href:location.href,
  38. image:$('.ui-image-viewer-thumb-wrap img').attr('src'),
  39. id:$('#hid-product-id').val(),
  40. images: imgs
  41. }
  42. object.price += ' '+$('[itemprop=priceCurrency]').text();
  43. }else{
  44. var item = $(this).closest('li')
  45. var object = {
  46. price:item.find('.info [itemprop=price]').html(),
  47. href:item.find('a.picRind').attr('href'),
  48. image:item.find('.picCore').attr('src'),
  49. id:item.find('.atc-product-id').val(),
  50. images: imgs
  51. }
  52. }
  53. win = document.getElementById('iframe').contentWindow
  54. win.postMessage(object,'*')
  55.  
  56. })
  57. }
  58.  
  59. function setButton(){
  60.  
  61. var button = '<input type="button" value="ДОБАВИТЬ" class="addButton">'
  62. var appendTo ='.product-name'
  63. //var appendTo = $('.list-item').length?'.list-item':'.product-name'
  64. //if(!appendTo.length) appendTo = '.list-item'
  65. //alert(appendTo)
  66. $(button).css({'position': 'absolute','top':'0px','left':'45px','z-index':'100','background':'#EA7B7B',
  67. 'padding':'5px 20px','border':'none','margin':'4px'}).appendTo(appendTo).attr('data-it','0')
  68. if(appendTo=='.product-name')
  69. $('.addButton').css('position','static').attr('data-it','1')
  70. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址