1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/addon-sdk/source/examples/library-detector/data/widget.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +<!-- This Source Code Form is subject to the terms of the Mozilla Public 1.5 + - License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> 1.7 + 1.8 +<html> 1.9 +<head> 1.10 + <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> 1.11 + <title>Library detector</title> 1.12 + <style type="text/css" media="all"> 1.13 + img { 1.14 + display: inline; 1.15 + width: 16px; 1.16 + height: 16px; 1.17 + } 1.18 + </style> 1.19 + <script type="text/javascript"> 1.20 + var icons = { 1.21 + 'jQuery' : 'jquery.ico', 1.22 + 'jQuery UI' : 'jquery_ui.ico', 1.23 + 'MooTools' : 'mootools.png', 1.24 + 'YUI' : 'yui.ico', 1.25 + 'Closure' : 'closure.ico', 1.26 + 'Modernizr': 'modernizr.ico', 1.27 + }; 1.28 + 1.29 + // Listen for mouse events over icons, in order to send a message up to 1.30 + // the panel and update its content with library name and version 1.31 + window.addEventListener('mouseover', function (event) { 1.32 + if (event.target.tagName == 'IMG') { 1.33 + addon.port.emit('setLibraryInfo', event.target.title); 1.34 + } 1.35 + }, false); 1.36 + 1.37 + addon.port.on('update', function (libraries) { 1.38 + // Cleanup previous content 1.39 + document.body.innerHTML = ''; 1.40 + 1.41 + // Create new updated list of icons 1.42 + libraries.forEach(function(library) { 1.43 + var img = document.createElement('img'); 1.44 + img.setAttribute('src', 'icons/' + icons[library.name]); 1.45 + img.setAttribute('title', library.name + "<br>Version: " + 1.46 + library.version); 1.47 + document.body.appendChild(img); 1.48 + }); 1.49 + }); 1.50 + </script> 1.51 +</head> 1.52 +<body></body> 1.53 +</html>