- From: Anssi Kostiainen via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 22 Mar 2011 11:36:54 +0000
- To: public-dap-commits@w3.org
Update of /sources/public/2009/dap/docs/feat-perms In directory hutz:/tmp/cvs-serv4489 Modified Files: feat-perms.js Log Message: Simplify response, fix localStorage.removeItem() bug Index: feat-perms.js =================================================================== RCS file: /sources/public/2009/dap/docs/feat-perms/feat-perms.js,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- feat-perms.js 4 Mar 2011 06:54:52 -0000 1.2 +++ feat-perms.js 22 Mar 2011 11:36:52 -0000 1.3 @@ -277,11 +277,14 @@ settings_window = document.createElement('div'); settings_window.id = 'settings_window'; settings_window.className ='box_shadow_window'; + // workaround: setTimeout() to allow removeItem() finish before reload() kicks in settings_window.innerHTML = '<button id="close_settings" class="close_button">X</button>' + '<div id="settings_header">Feature Permission Settings</div>' + - '<button onclick="localStorage.removeItem(\'feature_permissions\');' + - 'document.location.reload(true);">Set to defaults</button>'; + '<button onclick="' + + 'setTimeout(function() { localStorage.removeItem(\'feature_permissions\');' + + 'document.location.reload(true);}, 0);' + + '">Set to defaults</button>'; document.body.appendChild(settings_window); _delegateEvents(settings_window); @@ -289,14 +292,11 @@ } function _getResponse(feature_permissions) { - var response = [], i, l; + var response = {}, i, l; for (i = 0, l = navigator.feature_permissions.length; i < l; i++) { if (navigator.feature_permissions[i].requested) { - response.push({ - feature: navigator.feature_permissions[i].feature, - permission_level: navigator.feature_permissions[i].permission_level - }); + response[navigator.feature_permissions[i].feature] = {permission_level: navigator.feature_permissions[i].permission_level}; } }
Received on Tuesday, 22 March 2011 11:36:55 UTC