widget.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <!-- This Source Code Form is subject to the terms of the Mozilla Public
  2. - License, v. 2.0. If a copy of the MPL was not distributed with this
  3. - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  7. <title>Library detector</title>
  8. <style type="text/css" media="all">
  9. img {
  10. display: inline;
  11. width: 16px;
  12. height: 16px;
  13. }
  14. </style>
  15. <script type="text/javascript">
  16. var icons = {
  17. 'jQuery' : 'jquery.ico',
  18. 'jQuery UI' : 'jquery_ui.ico',
  19. 'MooTools' : 'mootools.png',
  20. 'YUI' : 'yui.ico',
  21. 'Closure' : 'closure.ico',
  22. 'Modernizr': 'modernizr.ico',
  23. };
  24. // Listen for mouse events over icons, in order to send a message up to
  25. // the panel and update its content with library name and version
  26. window.addEventListener('mouseover', function (event) {
  27. if (event.target.tagName == 'IMG') {
  28. addon.port.emit('setLibraryInfo', event.target.title);
  29. }
  30. }, false);
  31. addon.port.on('update', function (libraries) {
  32. // Cleanup previous content
  33. document.body.innerHTML = '';
  34. // Create new updated list of icons
  35. libraries.forEach(function(library) {
  36. var img = document.createElement('img');
  37. img.setAttribute('src', 'icons/' + icons[library.name]);
  38. img.setAttribute('title', library.name + "<br>Version: " +
  39. library.version);
  40. document.body.appendChild(img);
  41. });
  42. });
  43. </script>
  44. </head>
  45. <body></body>
  46. </html>