custom.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. jQuery(document).ready(function ($) {
  2. var themeVersion = '2.6';
  3. // Check für JS-Installation entfernen
  4. $('#hdr').addClass('js-installed');
  5. // Add version to logo
  6. $('#logo').append(
  7. $('<span class="theme-version">' + themeVersion + '</span>')
  8. );
  9. // Clear spaces
  10. $('#content .devType, #menu .room a').each(function() {
  11. $(this).html($(this).html().replace(/&nbsp;/g, ''));
  12. });
  13. $('#content > br').remove();
  14. $('.makeSelect').parent().find('br').remove();
  15. // Add missing classes for elements
  16. $('.SVGplot').prevAll('a').addClass('plot-nav');
  17. // Icon selection
  18. $('button.dist').wrapAll('<div class="icons"/>');
  19. $('button.dist').css({width: '50px', height: '50px', margin: '5px', padding: '0'});
  20. $('button.dist > *').css({maxWidth: '40px', maxHeight: '40px', display: 'block', margin: '0px auto'});
  21. $('input[type=text][name=icon-filter]').keyup(function() {
  22. var val = $(this).val().toLowerCase();
  23. if (val.length === 0) {
  24. jQuery('button.dist').show();
  25. } else {
  26. jQuery('button.dist').hide().filter(function() {
  27. return $(this).attr('title').toLowerCase().indexOf(val) > -1;
  28. }).show();
  29. }
  30. });
  31. // Links in der Navigation hinzufügen
  32. var $navElement = jQuery('#menu .room').last().find('tbody');
  33. $navElement.append(
  34. $('<tr><td><div><a class="custom-menu-entry" href="https://github.com/klein0r/fhem-style-haus-automatisierung/issues/">Theme-Fehler melden (v' + themeVersion + ')</a></div></td></tr>')
  35. );
  36. // Automatische Breite für HDR Input
  37. $('#hdr input.maininput').css({width: $('#content').width() + 'px'});
  38. $(window).resize(function() {
  39. $('#hdr input.maininput').css({width: $('#content').width() + 'px'});
  40. });
  41. // Klick auf Error-Message blendet diese aus
  42. $('body').on('click', '#errmsg', function() {
  43. $(this).hide();
  44. });
  45. $('.roomoverview .col1, .makeTable .col1').each(function(index) {
  46. $(this).parent().addClass('first-table-column');
  47. });
  48. });