From 58d22350d837b28178dca7bd78a2825ed1b2dabb Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sat, 14 Nov 2015 11:17:25 -0700 Subject: [PATCH] New template that removes Bootstrap and jQuery from code snippet --- config/examples/strapless.html | 81 ++++++++++++++++++++++++++++++++++ examples/resources/common.js | 27 ++++++------ 2 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 config/examples/strapless.html diff --git a/config/examples/strapless.html b/config/examples/strapless.html new file mode 100644 index 0000000000..7f326efbe1 --- /dev/null +++ b/config/examples/strapless.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + {{{ extraHead.local }}} + {{{ css.tag }}} + + {{ title }} + + + + + +
+ +
+
+ {{{ contents }}} +
+
+ +
+
+

{{ title }}

+

{{ shortdesc }}

+
{{ md docs }}
+ +
+
+ +
+
+ Copy + Edit +
+
+ + + + + +
+
<!DOCTYPE html>
+<html>
+<head>
+<title>{{ title }}</title>
+<link rel="stylesheet" href="http://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css">
+<script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"></script>
+{{ extraHead.remote }}
+{{#if css.source}}
+<style>
+{{ css.source }}
+</style>
+{{/if}}
+</head>
+<body>
+{{ contents }}
+<script>
+{{ js.source }}
+</script>
+</body>
+</html>
+
+
+ + + + {{{ js.tag }}} + + diff --git a/examples/resources/common.js b/examples/resources/common.js index 799e607283..00105c61c9 100644 --- a/examples/resources/common.js +++ b/examples/resources/common.js @@ -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';