Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* |
michael@0 | 2 | The code in this file is adapted from the original |
michael@0 | 3 | Library Detector add-on |
michael@0 | 4 | (https://addons.mozilla.org/en-US/firefox/addon/library-detector/) written by |
michael@0 | 5 | Paul Bakaus (http://paulbakaus.com/) and made available under the |
michael@0 | 6 | MIT License (http://www.opensource.org/licenses/mit-license.php). |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | var LD_tests = { |
michael@0 | 10 | |
michael@0 | 11 | 'jQuery': { |
michael@0 | 12 | test: function(win) { |
michael@0 | 13 | var jq = win.jQuery || win.$ || win.$jq || win.$j; |
michael@0 | 14 | if(jq && jq.fn && jq.fn.jquery) { |
michael@0 | 15 | return { version: jq.fn.jquery }; |
michael@0 | 16 | } else { |
michael@0 | 17 | return false; |
michael@0 | 18 | } |
michael@0 | 19 | } |
michael@0 | 20 | }, |
michael@0 | 21 | |
michael@0 | 22 | 'jQuery UI': { |
michael@0 | 23 | //phonehome: 'http://jqueryui.com/phone_home', |
michael@0 | 24 | test: function(win) { |
michael@0 | 25 | |
michael@0 | 26 | var jq = win.jQuery || win.$ || win.$jq || win.$j; |
michael@0 | 27 | if(jq && jq.fn && jq.fn.jquery && jq.ui) { |
michael@0 | 28 | |
michael@0 | 29 | var plugins = 'accordion,datepicker,dialog,draggable,droppable,progressbar,resizable,selectable,slider,menu,grid,tabs'.split(','), concat = []; |
michael@0 | 30 | for (var i=0; i < plugins.length; i++) { if(jq.ui[plugins[i]]) concat.push(plugins[i].substr(0,1).toUpperCase() + plugins[i].substr(1)); }; |
michael@0 | 31 | |
michael@0 | 32 | return { version: jq.ui.version, details: concat.length ? 'Plugins used: '+concat.join(',') : '' }; |
michael@0 | 33 | } else { |
michael@0 | 34 | return false; |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | } |
michael@0 | 38 | }, |
michael@0 | 39 | |
michael@0 | 40 | 'MooTools': { |
michael@0 | 41 | test: function(win) { |
michael@0 | 42 | if(win.MooTools && win.MooTools.version) { |
michael@0 | 43 | return { version: win.MooTools.version }; |
michael@0 | 44 | } else { |
michael@0 | 45 | return false; |
michael@0 | 46 | } |
michael@0 | 47 | } |
michael@0 | 48 | }, |
michael@0 | 49 | |
michael@0 | 50 | 'YUI': { |
michael@0 | 51 | test: function(win) { |
michael@0 | 52 | if(win.YAHOO && win.YAHOO.VERSION) { |
michael@0 | 53 | return { version: win.YAHOO.VERSION }; |
michael@0 | 54 | } else { |
michael@0 | 55 | return false; |
michael@0 | 56 | } |
michael@0 | 57 | } |
michael@0 | 58 | }, |
michael@0 | 59 | |
michael@0 | 60 | 'Closure': { |
michael@0 | 61 | test: function(win) { |
michael@0 | 62 | if(win.goog) { |
michael@0 | 63 | return { version: '2.0' }; |
michael@0 | 64 | } |
michael@0 | 65 | return false; |
michael@0 | 66 | } |
michael@0 | 67 | }, |
michael@0 | 68 | |
michael@0 | 69 | 'Modernizr': { |
michael@0 | 70 | test: function(win) { |
michael@0 | 71 | if(win.Modernizr) { |
michael@0 | 72 | return { version: win.Modernizr._version }; |
michael@0 | 73 | } |
michael@0 | 74 | return false; |
michael@0 | 75 | } |
michael@0 | 76 | }, |
michael@0 | 77 | |
michael@0 | 78 | |
michael@0 | 79 | }; |
michael@0 | 80 | |
michael@0 | 81 | function testLibraries() { |
michael@0 | 82 | var win = unsafeWindow; |
michael@0 | 83 | var libraryList = []; |
michael@0 | 84 | for(var i in LD_tests) { |
michael@0 | 85 | var passed = LD_tests[i].test(win); |
michael@0 | 86 | if (passed) { |
michael@0 | 87 | let libraryInfo = { |
michael@0 | 88 | name: i, |
michael@0 | 89 | version: passed.version |
michael@0 | 90 | }; |
michael@0 | 91 | libraryList.push(libraryInfo); |
michael@0 | 92 | } |
michael@0 | 93 | } |
michael@0 | 94 | self.postMessage(libraryList); |
michael@0 | 95 | } |
michael@0 | 96 | |
michael@0 | 97 | testLibraries(); |