Last active
March 9, 2018 13:16
-
-
Save sobchenyuk/f45c7bb1860d74404c278c8991dd97e4 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
// тестовая работа | |
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