Last active
June 8, 2016 05:00
-
-
Save delphinpro/40060d6979fa418e2d3c1addaed8924c 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 () { | |
| if (location.hash == '#dev') { | |
| $('body').addClass('dev').attr('id', 'dev'); | |
| $btn = $('<button/>', { | |
| text: 'Toggle' | |
| }).css({ | |
| position: 'fixed', | |
| right : 0, | |
| bottom : 0, | |
| zIndex : 2147483647, | |
| fontSize: '30px' | |
| }); | |
| $btn.appendTo('body'); | |
| var old = true; | |
| var $link = $('head').find('link[href="assets/templates/101/style.css"]'); | |
| var toggleStyles = function() { | |
| if (old) { | |
| var time = new Date(); | |
| v = time.getTime(); | |
| $link.attr('href', 'assets/templates/101/style2.css' + '?v=' + v); | |
| } else { | |
| $link.attr('href', 'assets/templates/101/style.css'); | |
| } | |
| old = !old; | |
| } | |
| toggleStyles(); | |
| $btn.on('click', toggleStyles); | |
| $('a[href]').each(function () { | |
| var href = $(this).attr('href'); | |
| if (href.substr(0, 1) != '#') { | |
| $(this).attr('href', href + '#dev'); | |
| } | |
| }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment