Last active
August 29, 2017 09:10
-
-
Save jhuriez/1d47ed515dd29e0d9bce2fd120f02a6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| var listP = $('<div></div>').attr('id', 'listP'); | |
| listP.insertBefore($('#lpBloc')); | |
| var totalPage = $('#pager #PaginationForm_TotalPage').attr('value'); | |
| totalPage = parseInt(totalPage); | |
| var currentPage = 1; | |
| var timer = 10000; | |
| var countNoDiscount = 0; | |
| function filterDiscount() | |
| { | |
| var hasDiscount = false; | |
| $('#lpBloc li .prdtBloc').each(function() { | |
| var el = $(this); | |
| var opImg = $(this).find('.opImg img'); | |
| if (opImg) { | |
| if (opImg.attr('alt') == "100ok") | |
| { | |
| hasDiscount = true; | |
| el.attr('style', 'width:300px; float: left;'); | |
| el.appendTo(listP); | |
| } | |
| } | |
| }); | |
| if (hasDiscount == false) | |
| { | |
| countNoDiscount++; | |
| } | |
| } | |
| function clickPage() | |
| { | |
| setTimeout(function () { | |
| currentPage++; | |
| if (currentPage <= totalPage) | |
| { | |
| console.log('CLICK PAGE ' + currentPage); | |
| $('#pager a.jsNxtPage').click(); | |
| clickPage(); | |
| } | |
| filterDiscount(); | |
| }, 6000); | |
| } | |
| function doFilterDiscount() | |
| { | |
| setTimeout(function () { | |
| filterDiscount(); | |
| if (countNoDiscount < 70) | |
| { | |
| doFilterDiscount(); | |
| } | |
| else | |
| { | |
| console.log('STOP FILTER DISCOUNT'); | |
| } | |
| }, 1000); | |
| } | |
| clickPage(); | |
| doFilterDiscount(); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment