Skip to content

Instantly share code, notes, and snippets.

@dorukcan
Last active September 10, 2016 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dorukcan/3a7ee36db6bd6dff361e8dba19de4a59 to your computer and use it in GitHub Desktop.
Save dorukcan/3a7ee36db6bd6dff361e8dba19de4a59 to your computer and use it in GitHub Desktop.
for (i = 2; i <= 14; i++) {
$.get("https://www.ayrintiyayinlari.com.tr/ucuzlatilmis-kitaplar/s/" + i, function(data) {
var html = $.parseHTML(data);
$(html).find(".span9 .editor .box").appendTo(".span9 .editor>div:eq(0)");
});
}
//---------------------------------------------------------------------------------------------------------------------------
var arr = $(".box").get();
arr.sort(function(a, b) {
return a.getElementsByClassName("author")[0].textContent == b.getElementsByClassName("author")[0].textContent ?
0 :
(a.getElementsByClassName("author")[0].textContent > b.getElementsByClassName("author")[0].textContent ? 1 : -1);
});
$(".span9 .editor>div:eq(0)").html(arr);
//---------------------------------------------------------------------------------------------------------------------------
String.prototype.toNumber= function (){
return parseInt(this);
}
var arr = $(".box").get();
arr.sort(function(a, b) {
return $(a).find(".old-product-price span").text().replace(",00 TL").toNumber() == $(b).find(".old-product-price span").text().replace(",00 TL").toNumber() ?
0 :
($(a).find(".old-product-price span").text().replace(",00 TL").toNumber() > $(b).find(".old-product-price span").text().replace(",00 TL").toNumber() ? 1 : -1);
});
$(".span9 .editor>div:eq(0)").html(arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment