Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-20058

Ability to change the favicon for Jenkins

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

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

        Attachments

          Activity

          Hide
          java1guy 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 );
          }
          
          Show
          java1guy 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 ); }
          Hide
          ssbarnea 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.

          Show
          ssbarnea 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.
          Hide
          java1guy 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.

          Show
          java1guy 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.
          Hide
          bahdad Sasha Miroshnychenko added a comment -
          Show
          bahdad Sasha Miroshnychenko added a comment - Custom plugin for this:  https://github.com/buzztaiki/jenkins-favicon-plugin
          Hide
          tgr Tobias Gruetzmacher added a comment -

          Fixed with release 0.4

          Show
          tgr Tobias Gruetzmacher added a comment - Fixed with release 0.4

            People

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

              Dates

              • Created:
                Updated:
                Resolved: