|
278 | 278 | return best_selector;
|
279 | 279 | };
|
280 | 280 |
|
281 |
| -var AllAnchorTags = document.getElementsByTagName("a"); |
282 |
| -for (var i = 0; i < AllAnchorTags.length; i++) { |
283 |
| - AllAnchorTags[i].addEventListener('click', function (event) { |
284 |
| - rec_mode = sessionStorage.getItem('recorder_mode'); |
285 |
| - if (rec_mode !== '2' && rec_mode !== '3') { |
286 |
| - if (this.origin && |
287 |
| - this.origin != 'null' && |
288 |
| - this.origin != document.location.origin && |
289 |
| - this.hasAttribute('href')) |
290 |
| - { |
291 |
| - event.preventDefault(); |
292 |
| - window.open(this.href, '_blank').focus(); |
293 |
| - } |
294 |
| - } else { event.preventDefault(); event.stopPropagation(); } |
295 |
| - }, |
296 |
| - false); |
297 |
| -} |
| 281 | +function new_tab_on_new_origin() { |
| 282 | + var AllAnchorTags = document.getElementsByTagName("a"); |
| 283 | + for (var i = 0; i < AllAnchorTags.length; i++) { |
| 284 | + if (!AllAnchorTags[i].sbset) { |
| 285 | + AllAnchorTags[i].sbset = true; |
| 286 | + AllAnchorTags[i].addEventListener('click', function (event) { |
| 287 | + rec_mode = sessionStorage.getItem('recorder_mode'); |
| 288 | + if (rec_mode !== '2' && rec_mode !== '3') { |
| 289 | + if (this.origin && |
| 290 | + this.origin != 'null' && |
| 291 | + this.origin != document.location.origin && |
| 292 | + this.hasAttribute('href')) |
| 293 | + { |
| 294 | + event.preventDefault(); |
| 295 | + window.open(this.href, '_blank').focus(); |
| 296 | + } |
| 297 | + } else { event.preventDefault(); event.stopPropagation(); } |
| 298 | + }, |
| 299 | + false); |
| 300 | + } |
| 301 | + } |
| 302 | +}; |
| 303 | +new_tab_on_new_origin(); |
298 | 304 | var AllInputTags = document.getElementsByTagName("input");
|
299 | 305 | var AllButtonTags = document.getElementsByTagName("button");
|
300 | 306 | var All_IB_Tags = [];
|
|
307 | 313 | },
|
308 | 314 | false);
|
309 | 315 | }
|
| 316 | +var SearchInputs = document.querySelectorAll('input[type="search"]'); |
| 317 | +for (var i = 0; i < SearchInputs.length; i++) { |
| 318 | + SearchInputs[i].addEventListener('change', function (event) { |
| 319 | + new_tab_on_new_origin(); |
| 320 | + }, |
| 321 | + false); |
| 322 | +} |
| 323 | +var AwayForms = document.querySelectorAll('form[action^="//"]'); |
| 324 | +for (var i = 0; i < AwayForms.length; i++) { |
| 325 | + AwayForms[i].target = '_blank'; |
| 326 | +} |
310 | 327 |
|
311 | 328 | var reset_recorder_state = function() {
|
312 | 329 | document.recorded_actions = [];
|
|
0 commit comments