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

Delta Between Two Patch Sets: static/js/address-masking.js

Issue 29773577: Fixes #68 - Implemented address masking script (Closed) Base URL: https://hg.adblockplus.org/website-defaults
Left Patch Set: Created May 7, 2018, 5:49 p.m.
Right Patch Set: Addressed #3 Created May 7, 2018, 11:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « pages/index.html ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /*! 1 /*!
2 * This file is part of website-defaults 2 * This file is part of website-defaults
3 * Copyright (C) 2016-present eyeo GmbH 3 * Copyright (C) 2016-present eyeo GmbH
4 * 4 *
5 * website-defaults is free software: you can redistribute it and/or 5 * website-defaults is free software: you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as published by 6 * modify it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or 7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * website-defaults is distributed in the hope that it will be useful, 10 * website-defaults is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with website-defaults. If not, see <http://www.gnu.org/licenses/>. 16 * along with website-defaults. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 var ADDRESS_MASKING_DELAY = 250; 18 var ADDRESS_MASKING_DELAY = 250;
19 19
20 function unmaskAddress(target) 20 function unmaskAddress(target)
21 { 21 {
22 var href = target.getAttribute("data-address"); 22 target.href = atob(target.getAttribute("data-address"));
23 target.href = atob(href); 23 target.removeAttribute("data-address");
ire 2018/05/07 23:02:23 Suggest: Remove the data-address since it's no lon
juliandoucette 2018/05/07 23:51:39 Done.
24 } 24 }
25 25
26 document.addEventListener("DOMContentLoaded", function() 26 document.addEventListener("DOMContentLoaded", function()
27 { 27 {
28 var unmaskAfterTimeout = setTimeout.bind( 28 var unmaskAfterTimeout = setTimeout.bind(
29 this, 29 this,
30 unmaskAddress, 30 unmaskAddress,
31 ADDRESS_MASKING_DELAY 31 ADDRESS_MASKING_DELAY
32 ); 32 );
33 33
34 document.querySelectorAll("[data-address]").forEach(unmaskAddress); 34 document.querySelectorAll("[data-address]").forEach(unmaskAddress);
35 }); 35 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld