Skip to content

Instantly share code, notes, and snippets.

@sobchenyuk
Last active March 9, 2018 13:16
Show Gist options
  • Save sobchenyuk/f45c7bb1860d74404c278c8991dd97e4 to your computer and use it in GitHub Desktop.
Save sobchenyuk/f45c7bb1860d74404c278c8991dd97e4 to your computer and use it in GitHub Desktop.
// тестовая работа
window.addEventListener('load', function () {
var test = function (bool) {
if(bool){
var styles = document.querySelectorAll('link');
var js = document.querySelectorAll('script');
styles.forEach(function(item, i) {
if(!/\?v=/.test(item.href)){
if(/.css/.test(item.href)) {
styles[i].href += '?v=' + Math.ceil(parseFloat(Math.random() * (1000 - i) + i)).toFixed(0);
}
}
});
js.forEach(function(item, i) {
if(!/\?v=/.test(item.src)){
if(/.js/.test(item.src)) {
js[i].src += '?v=' + Math.ceil(parseFloat(Math.random() * (1000 - i) + i)).toFixed(0);
}
}
});
}
};
test(true);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment