• Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Minor Minor
    • simple-theme-plugin
    • None

      There is no way to change the favicon of Jenkins when using CSS. Can you extend the plugin interface to allow that?

          [JENKINS-20058] Ability to change the favicon for Jenkins

          Mark Chance added a comment - - edited

          I have done this in the JavaScript:

          function myFunction() {
            head = document.getElementsByTagName('head');
            links = head[0].getElementsByTagName('link');
            for (var i in links) {
               link = links[i];
               if (link.getAttribute('rel') == 'shortcut icon') {
                  link.setAttribute('href', '/userContent/favicon.ico');
                  break;
               }
            }
          };
          var body = document.getElementsByTagName('body');
          if (window.addEventListener) {
            window.addEventListener('load', myFunction, false);
          }
          else if (window.attachEvent) {
            window.attachEvent('onload', myFunction );
          }
          

          Mark Chance added a comment - - edited I have done this in the JavaScript: function myFunction() { head = document.getElementsByTagName('head'); links = head[0].getElementsByTagName('link'); for (var i in links) { link = links[i]; if (link.getAttribute('rel') == 'shortcut icon') { link.setAttribute('href', '/userContent/favicon.ico'); break; } } }; var body = document.getElementsByTagName('body'); if (window.addEventListener) { window.addEventListener('load', myFunction, false); } else if (window.attachEvent) { window.attachEvent('onload', myFunction ); }

          Sorin Sbarnea added a comment - - edited

          How did you inject the JavaScript code into Jenkins? I really don't to end-up with GreaseMonkey -like client plugins.

          Having the same icon on all Jenkins instances is insane from the UX point of view.

          Sorin Sbarnea added a comment - - edited How did you inject the JavaScript code into Jenkins? I really don't to end-up with GreaseMonkey -like client plugins. Having the same icon on all Jenkins instances is insane from the UX point of view.

          Mark Chance added a comment -

          This was a while back, but what I recall and have reconstructed is this:

          • Using the SimpleTheme plugin, this config file org.codefirst.SimpleThemeDecorator.xml:
            {{<org.codefirst.SimpleThemeDecorator plugin="simple-theme-plugin@0.3">
            <cssUrl>/userContent/nucleator.css</cssUrl>
            <jsUrl>/userContent/decorate.js</jsUrl>
            </org.codefirst.SimpleThemeDecorator>
            }}

          Then, in the Jenkins installation directory:
          mkdir userContent
          put the above XML file in the install dir.
          put the Javascript from the earlier comment in userContent/decorate.js
          and I have a css file that looks something like this:
          {{

          #header .logo {
          height: 80px;
          }

          .logo {
          background-image: url("my_logo.png");
          display: block;
          width: 406px;
          background-size: 406px 80px;
          margin: 5px 0px 5px 10px;
          }

          .logo img

          { display: none; } }}

          HTH.

          Mark Chance added a comment - This was a while back, but what I recall and have reconstructed is this: Using the SimpleTheme plugin, this config file org.codefirst.SimpleThemeDecorator.xml: {{<org.codefirst.SimpleThemeDecorator plugin="simple-theme-plugin@0.3"> <cssUrl>/userContent/nucleator.css</cssUrl> <jsUrl>/userContent/decorate.js</jsUrl> </org.codefirst.SimpleThemeDecorator> }} Then, in the Jenkins installation directory: mkdir userContent put the above XML file in the install dir. put the Javascript from the earlier comment in userContent/decorate.js and I have a css file that looks something like this: {{ #header .logo { height: 80px; } .logo { background-image: url("my_logo.png"); display: block; width: 406px; background-size: 406px 80px; margin: 5px 0px 5px 10px; } .logo img { display: none; } }} HTH.

          Sasha Miroshnychenko added a comment - Custom plugin for this:  https://github.com/buzztaiki/jenkins-favicon-plugin

          Fixed with release 0.4

          Tobias Gruetzmacher added a comment - Fixed with release 0.4

            tgr Tobias Gruetzmacher
            designentropy Joris van der Pol
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: