diff options
Diffstat (limited to 'tools/addon-sdk-1.12/examples/library-detector/data/widget.html')
-rwxr-xr-x | tools/addon-sdk-1.12/examples/library-detector/data/widget.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tools/addon-sdk-1.12/examples/library-detector/data/widget.html b/tools/addon-sdk-1.12/examples/library-detector/data/widget.html new file mode 100755 index 0000000..4ca5b50 --- /dev/null +++ b/tools/addon-sdk-1.12/examples/library-detector/data/widget.html @@ -0,0 +1,50 @@ +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<html> +<head> + <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> + <title>Library detector</title> + <style type="text/css" media="all"> + img { + display: inline; + width: 16px; + height: 16px; + } + </style> + <script type="text/javascript"> + var icons = { + 'jQuery' : 'jquery.ico', + 'jQuery UI' : 'jquery_ui.ico', + 'MooTools' : 'mootools.png', + 'YUI' : 'yui.ico', + 'Closure' : 'closure.ico', + 'Modernizr': 'modernizr.ico', + }; + + // Listen for mouse events over icons, in order to send a message up to + // the panel and update its content with library name and version + window.addEventListener('mouseover', function (event) { + if (event.target.tagName == 'IMG') { + addon.port.emit('setLibraryInfo', event.target.title); + } + }, false); + + addon.port.on('update', function (libraries) { + // Cleanup previous content + document.body.innerHTML = ''; + + // Create new updated list of icons + libraries.forEach(function(library) { + var img = document.createElement('img'); + img.setAttribute('src', 'icons/' + icons[library.name]); + img.setAttribute('title', library.name + "<br>Version: " + + library.version); + document.body.appendChild(img); + }); + }); + </script> +</head> +<body></body> +</html> |