Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getPhotos() {
- var photosNode = document.querySelectorAll('#n-gallery-product > div.n-gallery__thumbs-container > ul >li');
- for (var i = 0; i < photosNode.length; i++) {
- var input = photosNode[i];
- imgSrc = input.getElementsByClassName('image')[0].src.replace("1hq","9hq");
- photos.push(imgSrc);
- }
- return photos;
- };
- function getPrice() {
- var price = document.querySelector('#n-product-default-offer > div.n-product-default-offer__price > span > span').innerHTML.replace(/\D/g,'');
- return price
- };
- function goToFeatures(url) {
- var newURL = url.replace("?track=tabs","/spec?track=tabs");
- console.log(newURL);
- window.location.href = newURL;
- };
- function getFeatures() {
- var features = []
- featuresNode = (document.querySelectorAll('body > div.main > div:nth-child(6) > div > div.layout__col.layout__col_size_p75.n-product-spec-wrap > div.n-product-spec-wrap__body > dl'));
- for (var i = 0; i < featuresNode.length; i++) {
- var input = featuresNode[i];
- var name = input.getElementsByTagName("dt")[0].innerText.replace(/\n/ig, '');
- var value = input.getElementsByTagName("dd")[0].innerText.replace(/\n/ig, '');
- features.push([name,value]);
- };
- return features
- };
- function item() {
- var output = [];
- var photos = [];
- var price = 0
- price = getPrice();
- var featuresURL = document.location.href;
- goToFeatures(featuresURL);
- features = getFeatures();
- };
- item();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement