Akron | 7524be1 | 2016-06-01 17:31:33 +0200 | [diff] [blame^] | 1 | /* |
| 2 | * TODO: Create lazy loading of objects including |
| 3 | * - obj.hint() |
| 4 | * - obj.alertify() |
| 5 | * - obj.session() |
| 6 | * - obj.tutorial() |
| 7 | * - obj.vc() // toggle |
| 8 | * - obj.matchCreate() (using webpack) |
| 9 | * - obj.koral() (show result, parse for errors ...) |
| 10 | * - obj.alignment() // toggle |
| 11 | */ |
| 12 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 13 | define([ |
| 14 | 'match', |
| 15 | 'hint', |
| 16 | 'vc', |
| 17 | 'tutorial', |
| 18 | 'lib/domReady', |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 19 | 'hint/array', |
Akron | 27ae9ec | 2015-06-23 00:43:21 +0200 | [diff] [blame] | 20 | 'vc/array', |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 21 | 'lib/alertify', |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 22 | 'session', |
Akron | be105b9 | 2016-01-04 14:13:20 +0100 | [diff] [blame] | 23 | 'tagger', |
Akron | 6bb7158 | 2016-06-10 20:41:08 +0200 | [diff] [blame] | 24 | 'selectMenu', |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 25 | 'api', |
Nils Diewald | c46003b | 2015-05-07 15:55:35 +0000 | [diff] [blame] | 26 | 'mailToChiffre', |
Nils Diewald | 845282c | 2015-05-14 07:53:03 +0000 | [diff] [blame] | 27 | 'lib/highlight/highlight.pack', |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 28 | 'util' |
| 29 | ], function (matchClass, |
| 30 | hintClass, |
| 31 | vcClass, |
| 32 | tutClass, |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 33 | domReady, |
Nils Diewald | 4347ee9 | 2015-05-04 20:32:48 +0000 | [diff] [blame] | 34 | hintArray, |
Akron | 27ae9ec | 2015-06-23 00:43:21 +0200 | [diff] [blame] | 35 | vcArray, |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 36 | alertifyClass, |
Akron | be105b9 | 2016-01-04 14:13:20 +0100 | [diff] [blame] | 37 | sessionClass, |
Akron | 6bb7158 | 2016-06-10 20:41:08 +0200 | [diff] [blame] | 38 | tagger, |
| 39 | selectMenuClass) { |
Nils Diewald | a0defc4 | 2015-05-07 23:54:17 +0000 | [diff] [blame] | 40 | |
| 41 | // Set hint array for hint helper |
| 42 | KorAP.hintArray = hintArray; |
| 43 | |
Akron | 9cc3eaf | 2015-06-10 22:15:52 +0200 | [diff] [blame] | 44 | // Localization values |
| 45 | var loc = KorAP.Locale; |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 46 | loc.VC_allCorpora = loc.VC_allCorpora || 'all Corpora'; |
| 47 | loc.VC_oneCollection = loc.VC_oneCollection || 'one Collection'; |
| 48 | loc.TOGGLE_ALIGN = loc.TOGGLE_ALIGN || 'toggle Alignment'; |
| 49 | loc.SHOW_KQ = loc.SHOW_KQ || 'show KoralQuery'; |
Akron | 9cc3eaf | 2015-06-10 22:15:52 +0200 | [diff] [blame] | 50 | |
Nils Diewald | a0defc4 | 2015-05-07 23:54:17 +0000 | [diff] [blame] | 51 | // Override KorAP.log |
| 52 | window.alertify = alertifyClass; |
Akron | f55504a | 2015-06-18 16:42:55 +0200 | [diff] [blame] | 53 | KorAP.log = function (code, msg) { |
Nils Diewald | a0defc4 | 2015-05-07 23:54:17 +0000 | [diff] [blame] | 54 | |
| 55 | // Use alertify to log errors |
| 56 | alertifyClass.log( |
Akron | f55504a | 2015-06-18 16:42:55 +0200 | [diff] [blame] | 57 | (code === 0 ? '' : code + ': ') + |
Nils Diewald | a0defc4 | 2015-05-07 23:54:17 +0000 | [diff] [blame] | 58 | msg, |
| 59 | 'error', |
Akron | f55504a | 2015-06-18 16:42:55 +0200 | [diff] [blame] | 60 | 10000 |
Nils Diewald | a0defc4 | 2015-05-07 23:54:17 +0000 | [diff] [blame] | 61 | ); |
| 62 | }; |
| 63 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 64 | domReady(function (event) { |
| 65 | var obj = {}; |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 66 | var session = sessionClass.create('KalamarJS'); |
| 67 | |
| 68 | // What should be visible? |
| 69 | var show = session.get('show') || {}; |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 70 | |
| 71 | /** |
Akron | f55504a | 2015-06-18 16:42:55 +0200 | [diff] [blame] | 72 | * Release notifications |
| 73 | */ |
| 74 | if (KorAP.Notifications !== undefined) { |
| 75 | var n = KorAP.Notifications; |
| 76 | for (var i = 0; i < n.length; i++) { |
| 77 | alertifyClass.log(n[i][1], n[i][0], 10000); |
| 78 | }; |
| 79 | }; |
| 80 | |
| 81 | /** |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 82 | * Replace Virtual Collection field |
| 83 | */ |
| 84 | var vcname; |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 85 | var input = document.getElementById('collection'); |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 86 | if (input) { |
| 87 | input.style.display = 'none'; |
| 88 | vcname = document.createElement('span'); |
| 89 | vcname.setAttribute('id', 'vc-choose'); |
Akron | 6bb7158 | 2016-06-10 20:41:08 +0200 | [diff] [blame] | 90 | vcname.classList.add('select'); |
Akron | 941551e | 2015-06-11 16:06:22 +0200 | [diff] [blame] | 91 | |
Akron | 27ae9ec | 2015-06-23 00:43:21 +0200 | [diff] [blame] | 92 | var currentVC = loc.VC_allCorpora; |
| 93 | if (KorAP.koralQuery !== undefined && KorAP.koralQuery["collection"]) { |
| 94 | currentVC = loc.VC_oneCollection; |
| 95 | }; |
| 96 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 97 | vcname.appendChild( |
| 98 | document.createTextNode( |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 99 | document.getElementById('collection-name').value || currentVC |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 100 | ) |
| 101 | ); |
Akron | 27ae9ec | 2015-06-23 00:43:21 +0200 | [diff] [blame] | 102 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 103 | input.parentNode.insertBefore(vcname, input); |
| 104 | }; |
| 105 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 106 | /** |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 107 | * Add actions to match entries |
| 108 | */ |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 109 | var inactiveLi = document.querySelectorAll( |
| 110 | '#search > ol > li:not(.active)' |
| 111 | ); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 112 | var i = 0; |
Akron | 6a535d4 | 2015-08-26 20:16:58 +0200 | [diff] [blame] | 113 | |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 114 | for (i = 0; i < inactiveLi.length; i++) { |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 115 | inactiveLi[i].addEventListener('click', function (e) { |
| 116 | if (this._match !== undefined) |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 117 | this._match.open(); |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 118 | else { |
Akron | 7524be1 | 2016-06-01 17:31:33 +0200 | [diff] [blame^] | 119 | // lazyLoad |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 120 | matchClass.create(this).open(); |
| 121 | }; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 122 | e.halt(); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 123 | }); |
Akron | 6a535d4 | 2015-08-26 20:16:58 +0200 | [diff] [blame] | 124 | inactiveLi[i].addEventListener('keydown', function (e) { |
| 125 | var code = _codeFromEvent(e); |
| 126 | |
| 127 | switch (code) { |
| 128 | case 32: |
| 129 | if (this._match !== undefined) |
| 130 | this._match.toggle(); |
| 131 | else { |
Akron | 7524be1 | 2016-06-01 17:31:33 +0200 | [diff] [blame^] | 132 | // lazyLoad |
Akron | 6a535d4 | 2015-08-26 20:16:58 +0200 | [diff] [blame] | 133 | matchClass.create(this).open(); |
| 134 | }; |
| 135 | e.halt(); |
| 136 | break; |
| 137 | }; |
| 138 | }); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 139 | }; |
| 140 | |
Akron | 6bb7158 | 2016-06-10 20:41:08 +0200 | [diff] [blame] | 141 | // Replace QL select menus with KorAP menus |
| 142 | selectMenuClass.create( |
| 143 | document.getElementById('ql-field').parentNode |
| 144 | ).limit(5); |
| 145 | |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 146 | var result = document.getElementById('resultinfo'); |
Akron | 6ed1399 | 2016-05-23 18:06:05 +0200 | [diff] [blame] | 147 | var resultButton = null; |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 148 | if (result != null) { |
| 149 | resultButton = result.appendChild(document.createElement('div')); |
| 150 | resultButton.classList.add('result', 'button'); |
| 151 | }; |
| 152 | |
| 153 | // There is a koralQuery |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 154 | if (KorAP.koralQuery !== undefined) { |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 155 | |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 156 | if (resultButton !== null) { |
| 157 | var kq; |
| 158 | var toggle = document.createElement('a'); |
| 159 | toggle.setAttribute('title', loc.SHOW_KQ) |
| 160 | toggle.classList.add('show-kq', 'button'); |
| 161 | toggle.appendChild(document.createElement('span')) |
| 162 | .appendChild(document.createTextNode(loc.SHOW_KQ)); |
| 163 | resultButton.appendChild(toggle); |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 164 | |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 165 | var showKQ = function () { |
| 166 | if (kq === undefined) { |
| 167 | kq = document.createElement('div'); |
| 168 | kq.setAttribute('id', 'koralquery'); |
| 169 | kq.style.display = 'none'; |
| 170 | var kqInner = document.createElement('div'); |
| 171 | kq.appendChild(kqInner); |
| 172 | kqInner.innerHTML = JSON.stringify(KorAP.koralQuery, null, ' '); |
| 173 | hljs.highlightBlock(kqInner); |
| 174 | var sb = document.getElementById('search'); |
| 175 | sb.insertBefore(kq, sb.firstChild); |
| 176 | }; |
| 177 | |
| 178 | if (kq.style.display === 'none') { |
| 179 | kq.style.display = 'block'; |
| 180 | show['kq'] = true; |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 181 | } |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 182 | else { |
| 183 | kq.style.display = 'none'; |
| 184 | delete show['kq']; |
| 185 | }; |
| 186 | }; |
| 187 | |
| 188 | if (toggle !== undefined) { |
| 189 | |
| 190 | // Show koralquery |
| 191 | toggle.addEventListener('click', showKQ); |
| 192 | }; |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 193 | }; |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 194 | |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 195 | if (KorAP.koralQuery["errors"]) { |
| 196 | var errors = KorAP.koralQuery["errors"]; |
| 197 | for (var i in errors) { |
| 198 | if (errors[i][0] === 302) { |
| 199 | obj.hint = hintClass.create(); |
| 200 | obj.hint.alert(errors[i][2], errors[i][1]); |
| 201 | break; |
| 202 | } |
| 203 | } |
| 204 | }; |
| 205 | |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 206 | // Session has KQ visibility stored |
| 207 | if (show["kq"]) |
| 208 | showKQ.apply(); |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 209 | }; |
| 210 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 211 | |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 212 | /** |
| 213 | * Toggle the alignment (left <=> right) |
| 214 | */ |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 215 | // querySelector('div.button.right'); |
| 216 | if (i > 0 && resultButton !== null) { |
| 217 | var toggle = document.createElement('a'); |
| 218 | toggle.setAttribute('title', loc.TOGGLE_ALIGN); |
| 219 | // Todo: Reuse old alignment from query |
| 220 | var cl = toggle.classList; |
| 221 | cl.add('align', 'right', 'button'); |
| 222 | toggle.addEventListener( |
| 223 | 'click', |
| 224 | function (e) { |
| 225 | var ol = document.querySelector('#search > ol'); |
| 226 | ol.toggleClass("align-left", "align-right"); |
| 227 | this.toggleClass("left", "right"); |
| 228 | }); |
| 229 | toggle.appendChild(document.createElement('span')) |
| 230 | .appendChild(document.createTextNode(loc.TOGGLE_ALIGN)); |
| 231 | resultButton.appendChild(toggle); |
Nils Diewald | a297f06 | 2015-04-02 00:23:46 +0000 | [diff] [blame] | 232 | }; |
Nils Diewald | 5c5a747 | 2015-04-02 22:13:38 +0000 | [diff] [blame] | 233 | |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 234 | |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 235 | /** |
| 236 | * Toggle the Virtual Collection builder |
| 237 | */ |
| 238 | if (vcname) { |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 239 | var vc; |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 240 | var vcclick = function () { |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 241 | var view = document.getElementById('vc-view'); |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 242 | |
| 243 | // The vc is visible |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 244 | if (vcname.classList.contains('active')) { |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 245 | view.removeChild(vc.element()); |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 246 | vcname.classList.remove('active'); |
| 247 | delete show['collection']; |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 248 | } |
| 249 | |
| 250 | // The vc is not visible |
| 251 | else { |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 252 | if (vc === undefined) |
Akron | 27ae9ec | 2015-06-23 00:43:21 +0200 | [diff] [blame] | 253 | vc = _getCurrentVC(vcClass, vcArray); |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 254 | view.appendChild(vc.element()); |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 255 | vcname.classList.add('active'); |
| 256 | show['collection'] = true; |
Nils Diewald | 6283d69 | 2015-04-23 20:32:53 +0000 | [diff] [blame] | 257 | }; |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 258 | }; |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 259 | vcname.onclick = vcclick; |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 260 | if (show['collection']) { |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 261 | vcclick.apply(); |
| 262 | }; |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 263 | }; |
| 264 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 265 | |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 266 | /** |
| 267 | * Init Tutorial view |
| 268 | */ |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 269 | if (document.getElementById('view-tutorial')) { |
| 270 | window.tutorial = tutClass.create( |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 271 | document.getElementById('view-tutorial'), |
| 272 | session |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 273 | ); |
| 274 | obj.tutorial = window.tutorial; |
| 275 | } |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 276 | |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 277 | // Tutorial is in parent |
| 278 | else if (window.parent) { |
| 279 | obj.tutorial = window.parent.tutorial; |
| 280 | }; |
| 281 | |
| 282 | // Initialize queries for document |
Akron | 6ed1399 | 2016-05-23 18:06:05 +0200 | [diff] [blame] | 283 | if (obj.tutorial) { |
Nils Diewald | 4347ee9 | 2015-05-04 20:32:48 +0000 | [diff] [blame] | 284 | obj.tutorial.initQueries(document); |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 285 | |
Akron | 6ed1399 | 2016-05-23 18:06:05 +0200 | [diff] [blame] | 286 | // Initialize documentation links |
| 287 | obj.tutorial.initDocLinks(document); |
| 288 | }; |
Nils Diewald | 61e6ff5 | 2015-05-07 17:26:50 +0000 | [diff] [blame] | 289 | |
Nils Diewald | 845282c | 2015-05-14 07:53:03 +0000 | [diff] [blame] | 290 | |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 291 | /** |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 292 | * Add VC creation on submission. |
| 293 | */ |
| 294 | var form = document.getElementById('searchform'); |
Akron | 792f58b | 2015-07-08 18:59:36 +0200 | [diff] [blame] | 295 | if (form !== null) { |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 296 | form.addEventListener('submit', function (e) { |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 297 | var qf = document.getElementById('q-field'); |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 298 | |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 299 | // No query was defined |
| 300 | if (qf.value === undefined || qf.value === '') { |
| 301 | qf.focus(); |
| 302 | e.halt(); |
| 303 | KorAP.log(700, "No query given"); |
| 304 | return; |
| 305 | }; |
| 306 | |
| 307 | // Store session information |
| 308 | session.set("show", show); |
| 309 | |
| 310 | // Set Virtual collection |
| 311 | if (vc === undefined) { |
| 312 | vc = _getCurrentVC(vcClass, vcArray); |
| 313 | }; |
| 314 | |
| 315 | if (vc !== undefined) { |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 316 | input.value = vc.toQuery(); |
Akron | 7716f01 | 2015-07-01 20:38:32 +0200 | [diff] [blame] | 317 | } |
| 318 | else { |
| 319 | delete input['value']; |
| 320 | }; |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 321 | }); |
| 322 | }; |
| 323 | |
| 324 | /** |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 325 | * Init hint helper |
| 326 | * has to be final because of |
| 327 | * reposition |
| 328 | */ |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 329 | // Todo: Pass an element, so this works with |
| 330 | // tutorial pages as well! |
Akron | 00cd4d1 | 2016-05-31 21:01:11 +0200 | [diff] [blame] | 331 | if (obj.hint === undefined) |
| 332 | obj.hint = hintClass.create(); |
Nils Diewald | 7148c6f | 2015-05-04 15:07:53 +0000 | [diff] [blame] | 333 | |
Nils Diewald | 5814133 | 2015-04-07 16:18:45 +0000 | [diff] [blame] | 334 | return obj; |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 335 | }); |
| 336 | }); |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 337 | |
| 338 | // Render Virtual collection |
Akron | 27ae9ec | 2015-06-23 00:43:21 +0200 | [diff] [blame] | 339 | function _getCurrentVC (vcClass, vcArray) { |
| 340 | var vc = vcClass.create(vcArray); |
| 341 | if (KorAP.koralQuery !== undefined && KorAP.koralQuery["collection"]) { |
| 342 | vc.fromJson(KorAP.koralQuery["collection"]); |
| 343 | }; |
Akron | c1457bf | 2015-06-11 19:24:00 +0200 | [diff] [blame] | 344 | return vc; |
| 345 | }; |