| Total Complexity | 9 |
| Complexity/F | 2.25 |
| Lines of Code | 58 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | tinyMCEPopup.requireLangPack(); |
||
| 2 | |||
| 3 | var iconMap = [ |
||
| 4 | "fa-dollar","fa-download","fa-ellipsis-h","fa-ellipsis-v","fa-envelope","fa-envelope-o","fa-exchange","fa-exclamation-circle","fa-external-link","fa-fa","fa-facebook","fa-file","fa-file-archive-o","fa-file-audio-o","fa-file-code-o","fa-file-code-o","fa-file-excel-o","fa-file-image-o","fa-file-o","fa-file-pdf-o","fa-file-powerpoint-o","fa-file-text","fa-file-video-o","fa-file-word-o","fa-filter","fa-folder","fa-folder-open","fa-font","fa-gear","fa-github","fa-google-plus","fa-heart","fa-home","fa-info","fa-language","fa-leaf","fa-lightbulb-o","fa-line-chart","fa-link","fa-linkedin","fa-location-arrow","fa-lock","fa-map-marker","fa-minus-square","fa-paperclip","fa-pause","fa-phone","fa-pie-chart","fa-play","fa-plus","fa-print","fa-qq","fa-question-circle-o","fa-recycle","fa-refresh","fa-refresh","fa-remove","fa-repeat","fa-rocket","fa-rss","fa-search","fa-share-alt","fa-share-alt","fa-shopping-cart","fa-sign-in","fa-sign-language","fa-sort","fa-sort-alpha-asc","fa-sort-alpha-desc","fa-sort-asc","fa-sort-desc","fa-spinner","fa-star","fa-star-half","fa-step-backward","fa-step-forward","fa-sun-o","fa-support","fa-tag","fa-tags","fa-thumb-tack","fa-thumbs-o-up","fa-thumbs-up","fa-times","fa-trash","fa-twitter","fa-unlock","fa-unlock-alt","fa-unsorted","fa-user","fa-user-plus","fa-users","fa-video-camera","fa-vimeo","fa-volume-off","fa-wheelchair","fa-wrench","fa-youtube-play" |
||
| 5 | ]; |
||
| 6 | |||
| 7 | tinyMCEPopup.onInit.add(function() { |
||
| 8 | tinyMCEPopup.dom.setHTML('iconMapView', renderIconMapHTML()); |
||
| 9 | }); |
||
| 10 | |||
| 11 | function renderIconMapHTML() { |
||
| 12 | var iconsPerRow = 14, tdWidth = 20, tdHeight = 20, i; |
||
| 13 | var html = ' <table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth * iconsPerRow) + '"><tr height="' + tdHeight + '">'; |
||
| 14 | var cols=0; |
||
| 15 | |||
| 16 | for (i = 0; i < iconMap.length; i++) { |
||
| 17 | |||
| 18 | cols++; |
||
| 19 | html += '' |
||
| 20 | + '<td class="charmap">' |
||
| 21 | + '<a onmouseover="previewIcon(\'' + iconMap[i] + '\');" onfocus="previewIcon(\'' + iconMap[i] + '\');" href="javascript:void(0)" onclick="insertIcon(\'' + iconMap[i] + '\');" onclick="return false;" onmousedown="return false;" title="">' |
||
| 22 | + '<i class="fa ' + iconMap[i] + '" aria-hidden="true"></i>' |
||
| 23 | + '</a></td>' |
||
| 24 | |||
| 25 | if ((cols) % iconsPerRow == 0) |
||
| 26 | html += '</tr><tr height="' + tdHeight + '">'; |
||
| 27 | |||
| 28 | } |
||
| 29 | |||
| 30 | if (cols % iconsPerRow > 0) { |
||
| 31 | var padd = iconsPerRow - (cols % iconsPerRow); |
||
| 32 | for (var i = 0; i < padd - 1; i++) |
||
| 33 | html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"> </td>'; |
||
| 34 | } |
||
| 35 | |||
| 36 | html += '</tr></table>'; |
||
| 37 | |||
| 38 | return html; |
||
| 39 | } |
||
| 40 | |||
| 41 | function insertIcon(chr) { |
||
| 42 | tinyMCEPopup.execCommand('mceInsertRawHTML', false, '<span class="fa ' + chr + ' " aria-hidden="true"> </span>'); |
||
| 43 | |||
| 44 | // Refocus in window |
||
| 45 | if (tinyMCEPopup.isWindow) |
||
| 46 | window.focus(); |
||
| 47 | |||
| 48 | tinyMCEPopup.editor.focus(); |
||
| 49 | tinyMCEPopup.close(); |
||
| 50 | } |
||
| 51 | |||
| 52 | function previewIcon(chr) { |
||
| 53 | var elmV = document.getElementById('codeV'); |
||
| 54 | var elmN = document.getElementById('codeN'); |
||
| 55 | |||
| 56 | elmV.innerHTML = "<i class='fa "+chr+"'></i>"; |
||
| 57 | elmN.innerHTML = chr.substring(3); |
||
| 58 | } |
||
| 59 |