| Total Complexity | 4 |
| Complexity/F | 2 |
| Lines of Code | 19 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | if (self !== parent) { |
||
| 2 | /* |
||
| 3 | * we need to determine the correct widget_id prefix here, loading from the parent |
||
| 4 | * frame breaks when multiple choosers with creation support exist |
||
| 5 | */ |
||
| 6 | var widget_id = window.parent.jQuery('iframe[src^="' + window.location.pathname + '"]:visible').attr("id"); |
||
| 7 | widget_id = widget_id.replace(/_creation_dialog_content/, ''); |
||
| 8 | |||
| 9 | function add_item(data) { |
||
|
|
|||
| 10 | window.parent.midcom_helper_datamanager2_autocomplete.add_result_item(widget_id, data); |
||
| 11 | window.parent.jQuery('#' + widget_id + '_creation_dialog').remove(); |
||
| 12 | } |
||
| 13 | |||
| 14 | if (window.parent.$('#' + widget_id + '_creation_dialog').length > 0) { |
||
| 15 | window.addEventListener('DOMContentLoaded', function() { |
||
| 16 | attach_to_parent_dialog(window.parent.$('#' + widget_id + '_creation_dialog')); |
||
| 17 | }); |
||
| 18 | } |
||
| 19 | } |
||
| 20 |