Conditions | 4 |
Paths | 6 |
Total Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | window.magicMatcherUtil = window.magicMatcherUtil || {}; |
||
3 | window.magicMatcherUtil.showAjaxMessages = function showAjaxMessages(response) { |
||
4 | 'use strict'; |
||
5 | |||
6 | let $msgArea; |
||
7 | if (jQuery('body.tpl_sprintdoc').length) { |
||
8 | $msgArea = jQuery('#dokuwiki__content').find('.msg-area'); |
||
9 | } else { |
||
10 | $msgArea = jQuery('#dokuwiki__content').find('> div').first(); |
||
11 | } |
||
12 | if (!Object.prototype.hasOwnProperty.call(response, 'msg')) { |
||
13 | $msgArea.prepend(jQuery('<div>').addClass('error').html(response)); |
||
14 | return; |
||
15 | } |
||
16 | const messages = response.msg; |
||
17 | if (!messages) { |
||
18 | return; |
||
19 | } |
||
20 | messages.forEach(function printMessagesToMessageArea(msg) { |
||
21 | $msgArea.prepend(jQuery('<div>').addClass(msg.lvl).html(msg.msg)); |
||
22 | }); |
||
23 | }; |
||
24 | |||
35 |