addon-sdk/source/examples/library-detector/data/widget.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rwxr-xr-x

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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/. -->
     5 <html>
     6 <head>
     7   <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
     8   <title>Library detector</title>
     9   <style type="text/css" media="all">
    10     img {
    11       display: inline;
    12       width: 16px;
    13       height: 16px;
    14     }
    15   </style>
    16   <script type="text/javascript">
    17     var icons = {
    18       'jQuery' : 'jquery.ico',
    19       'jQuery UI' : 'jquery_ui.ico',
    20       'MooTools' : 'mootools.png',
    21       'YUI' : 'yui.ico',
    22       'Closure' : 'closure.ico',
    23       'Modernizr': 'modernizr.ico',
    24     };
    26     // Listen for mouse events over icons, in order to send a message up to
    27     // the panel and update its content with library name and version
    28     window.addEventListener('mouseover', function (event) {
    29       if (event.target.tagName == 'IMG') {
    30         addon.port.emit('setLibraryInfo', event.target.title);
    31       }
    32     }, false);
    34     addon.port.on('update', function (libraries) {
    35       // Cleanup previous content
    36       document.body.innerHTML = '';
    38       // Create new updated list of icons
    39       libraries.forEach(function(library) {
    40         var img = document.createElement('img');
    41         img.setAttribute('src', 'icons/' + icons[library.name]);
    42         img.setAttribute('title', library.name + "<br>Version: " +
    43                                   library.version);
    44         document.body.appendChild(img);
    45       });
    46     });
    47   </script>
    48 </head>
    49 <body></body>
    50 </html>

mercurial