Advertisement
overloop

tutu.ru.js

Jun 9th, 2014
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. var items = [];
  3. items.push("");
  4. $('#schedule_table tr th').each(function(i,item){
  5.     if (i % 2 == 1 && i != 5) {
  6.         items.push(strip(item).trim());
  7.     }
  8. });
  9.  
  10. $('#schedule_table tr td').each(function(i,item){
  11.     var j = (i-1) % 12;
  12.     if (j==1 || j==3) {
  13.         items.push(strip(item).trim().substr(0,5));
  14.     } else if (j==7 || j==9 || j==11) {
  15.         items.push(strip(item).trim());
  16.     } else if (j==0) {
  17.         items.push("\n");
  18.     }
  19. });
  20.  
  21. function strip(item) {
  22.     if ($(item).find('div a').length > 0) {
  23.         return $(item).find('div a').first().text();
  24.     } else if ($(item).children('a').length > 0) {
  25.         return $(item).children('a').text();
  26.     } else if ($(item).children('div').length > 0) {
  27.         return $(item).children('div').first().text();
  28.     } else {
  29.         return $(item).text();
  30.     }
  31. }
  32.  
  33. console.log(items.join("\t"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement