Created
September 8, 2014 12:10
-
-
Save weiland/b58dc5ab7de5a013a3f7 to your computer and use it in GitHub Desktop.
Chayns Debugger
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 (Chayns, window, undefined) { | |
| 'use strict'; | |
| var lh = window.location.href; | |
| function chooseOS(c) { | |
| var osList = [ | |
| new Chayns.SelectOption('Normal', '', false), | |
| new Chayns.SelectOption('Webshadow', 'webshadow', false), | |
| new Chayns.SelectOption('Webshadow mobile', 'webshadowmobile', false) | |
| ]; | |
| Chayns.Select(osList, false, function (os) { | |
| if(os === null) { | |
| return; | |
| } | |
| if(lh.indexOf('?') === -1) { | |
| lh = lh + '?os=' + os; | |
| } else if(lh.indexOf('os=') !== -1) { | |
| lh = lh.replace(/os=(.*)/i, 'os=' + os); | |
| } else { | |
| lh = lh + '&os=' + os; | |
| } | |
| window.location.href = lh; | |
| }); | |
| } | |
| function reload(appendTime) { | |
| if(typeof appendTime !== 'undefined' && appendTime) { | |
| lh = lh + (lh.indexOf('?') === -1 ? '?' : '&') + 't=' + (new Date()).getTime(); | |
| } | |
| window.location.href = lh; | |
| } | |
| function back() { | |
| window.history.back(); | |
| } | |
| Chayns.debugger = { | |
| chooseOS: chooseOS, | |
| refresh: reload.bind(null, true), | |
| reload: reload, | |
| back: back | |
| }; | |
| })(Chayns, window); | |
| Chayns.debugger.chooseOS(); // PROFIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment