cec-nuxt-lib 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-vue-lib",
3
3
  "configKey": "cec-vue-lib",
4
- "version": "0.0.1"
4
+ "version": "0.0.3"
5
5
  }
@@ -22,7 +22,7 @@ const toTitleCase = (str) => {
22
22
  .join(' ');
23
23
  };
24
24
 
25
- let hrefs = truePath.replace(/-/g, '_').split('/');
25
+ let hrefs = truePath.split('/');
26
26
  const links = hrefs.map((e, i) =>
27
27
  !e
28
28
  ? 'Home'
@@ -1,5 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import { onMounted } from 'vue';
3
+ import { useState } from '#app';
4
+
5
+ const searchTerm = useState('searchTerm', () => 'Enter keywords:');
6
+
3
7
  // Cookie control config.
4
8
  const config = {
5
9
  apiKey: 'c1a902dfad207b122cca32738e623af375e1d2ee',
@@ -85,6 +89,11 @@ const config = {
85
89
  },
86
90
  };
87
91
 
92
+ const getUrl = () => {
93
+ console.log('getutl');
94
+ return `/search-results?${encodeURI(searchTerm.value)}`;
95
+ };
96
+
88
97
  const updateToggleText = () => {
89
98
  const x = document.getElementById('baToggleText');
90
99
  if (x.innerText === 'Listen and translate') {
@@ -94,38 +103,19 @@ const updateToggleText = () => {
94
103
  }
95
104
  };
96
105
 
97
- const doSearch = () => {
98
- let search = searchTextBox.value;
99
- if (search !== 'Enter keywords') {
100
- window.location.href =
101
- '/search.aspx?search_keywords=' + encodeURIComponent(search);
106
+ // Set some things up once page has mounted.
107
+ onMounted(() => {
108
+ try {
109
+ CookieControl.load(config);
110
+ } catch (ignore) {
111
+ console.log('No cookie control');
102
112
  }
103
- };
104
-
105
- // Set some things up once page has mounted.
106
- onMounted(() => {
107
- const searchBtn = document.getElementById(
108
- 'SearchQueryControl_SearchButton',
109
- );
110
- const searchTextBox = document.getElementById('searchTextBox');
111
- searchBtn.addEventListener('click', doSearch);
112
- searchTextBox.addEventListener('focus', () => (searchTextBox.value = ''));
113
- searchTextBox.addEventListener('keydown', (event) => {
114
- if (event.key === 'Enter') {
115
- doSearch();
116
- }
117
- });
118
- try {
119
- CookieControl.load(config);
120
- } catch (ignore) {
121
- console.log('No cookie control');
122
- }
123
- try {
124
- BrowseAloud.disableBrowsealoudAnalytics();
125
- } catch (ignore) {
126
- console.log('No reachdeck.');
127
- }
128
- });
113
+ try {
114
+ BrowseAloud.disableBrowsealoudAnalytics();
115
+ } catch (ignore) {
116
+ console.log('No reachdeck.');
117
+ }
118
+ });
129
119
  </script>
130
120
 
131
121
  <template>
@@ -237,17 +227,22 @@ const doSearch = () => {
237
227
  >Search</label
238
228
  >
239
229
  <input
230
+ v-model="searchTerm"
231
+ @focus="searchTerm = ''"
240
232
  type="text"
241
- value="Enter keywords"
242
233
  id="searchTextBox"
243
234
  class="sys_searchbox"
244
235
  />
245
- <input
246
- type="button"
236
+ <a
247
237
  id="SearchQueryControl_SearchButton"
248
- value="Search"
249
238
  class="sys_button sys_searchbutton sys_search-button"
250
- />
239
+ :href="
240
+ searchTerm === 'Enter keywords:'
241
+ ? 'javascript:'
242
+ : `/search-results?search_keywords=${encodeURI(searchTerm)}`
243
+ "
244
+ >Search</a
245
+ >
251
246
  </div>
252
247
  </div>
253
248
  </div>
@@ -255,3 +250,7 @@ const doSearch = () => {
255
250
  </header>
256
251
  </div>
257
252
  </template>
253
+
254
+ <style scoped>
255
+ #SearchQueryControl_SearchButton,#SearchQueryControl_SearchButton:active,#SearchQueryControl_SearchButton:visited{background-color:#206c49;border-color:#206c49;border-radius:.25rem;color:#fff;cursor:pointer;font-size:1rem;font-weight:700;margin-left:.5rem!important;padding:.375rem .75rem;text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;vertical-align:middle;width:100px}#SearchQueryControl_SearchButton:hover{background-color:#1c5e41;border-color:#1c5e41}
256
+ </style>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.1",
2
+ "version": "0.0.3",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",