Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: static/js/address-masking.js

Issue 29790573: Fixes #6 - Extend address masking to mask other attributes (Closed) Base URL: https://hg.adblockplus.org/website-defaults
Patch Set: Addressed NITs Created May 25, 2018, 9:01 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pages/address-masking.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: static/js/address-masking.js
===================================================================
--- a/static/js/address-masking.js
+++ b/static/js/address-masking.js
@@ -14,22 +14,26 @@
*
* You should have received a copy of the GNU General Public License
* along with website-defaults. If not, see <http://www.gnu.org/licenses/>.
*/
var ADDRESS_MASKING_DELAY = 250;
function unmaskAddress(target)
{
- target.href = atob(target.getAttribute("data-address"));
- target.removeAttribute("data-address");
+ var attributes = JSON.parse(target.getAttribute("data-mask"));
+
+ for (var attr in attributes)
+ target[attr] = atob(attributes[attr]);
+
+ target.removeAttribute("data-mask");
}
document.addEventListener("DOMContentLoaded", function()
{
var unmaskAfterTimeout = setTimeout.bind(
this,
unmaskAddress,
ADDRESS_MASKING_DELAY
);
- document.querySelectorAll("[data-address]").forEach(unmaskAddress);
+ document.querySelectorAll("[data-mask]").forEach(unmaskAddress);
});
« no previous file with comments | « pages/address-masking.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld