Last active
April 11, 2017 22:16
-
-
Save daylik/ef1b8dd5704c6db65a8e9e01e9729c1e to your computer and use it in GitHub Desktop.
This file contains 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 each_table_td( selector, td_num, find_regexp, replace_regexp, replace_mask, _e){ | |
_e = {}; | |
$( selector ).each(function(index_1, el) { | |
_e.num = 0; | |
$(el).find('tr td').each(function(index_2, el_2) { | |
_e.num++; | |
if ( (_e.num % td_num) === 0) { | |
_e.td = $(this).html(); | |
//$(this).addClass('this_test'); | |
if (find_regexp.test(_e.td)){ | |
_e.td = _e.td.replace(replace_regexp, replace_mask); | |
$(this).html(_e.td); | |
} | |
} | |
}); | |
}); | |
} | |
setTimeout(function(){ | |
each_table_td( '.new_table table', 3, /(от)?[\s-]*[\d]+/, /([\d]+[-\s\d]*)/, '<span class="num">$1</span>'); | |
}, 500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment