New template that removes Bootstrap and jQuery from code snippet

This commit is contained in:
Tim Schaub
2015-11-14 11:17:25 -07:00
parent b69e453061
commit 58d22350d8
2 changed files with 94 additions and 14 deletions

View File

@@ -36,8 +36,19 @@
var urlMode = window.location.href.match(/mode=([a-z0-9\-]+)\&?/i);
var curMode = urlMode ? urlMode[1] : 'advanced';
var modeChangedMethod = function() {
var newMode = this.value;
for (var mode in possibleModes) {
if (possibleModes.hasOwnProperty(mode)) {
var option = document.createElement('option');
var modeTxt = possibleModes[mode];
option.value = mode;
option.innerHTML = modeTxt;
option.selected = curMode === mode;
select.appendChild(option);
}
}
select.onchange = function(event) {
var newMode = event.target.value;
var search = window.location.search.substring(1);
var baseUrl = window.location.href.split('?')[0];
var chunks = search ? search.split('&') : [];
@@ -61,18 +72,6 @@
location.href = baseUrl + '?' + pairs.join('&');
};
for (var mode in possibleModes) {
if (possibleModes.hasOwnProperty(mode)) {
var option = document.createElement('option');
var modeTxt = possibleModes[mode];
option.value = mode;
option.innerHTML = modeTxt;
option.selected = curMode === mode;
select.appendChild(option);
}
}
$(select).change(modeChangedMethod);
select.className = 'input-medium';
form.className = 'navbar-form pull-right';