| LEFT | RIGHT | 
|---|
| 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   target.href = atob(target.getAttribute("data-address")); | 22   var attributes = JSON.parse(target.getAttribute("data-mask")); | 
| 23   target.removeAttribute("data-address"); |  | 
| 24 | 23 | 
| 25   if (target.hasAttribute("data-replace-text")) | 24   for (var attr in attributes) | 
| 26   { | 25     target[attr] = atob(attributes[attr]); | 
| 27     target.textContent = atob(target.getAttribute("data-replace-text")); | 26 | 
| 28     target.removeAttribute("data-replace-text"); | 27   target.removeAttribute("data-mask"); | 
| 29   } |  | 
| 30 } | 28 } | 
| 31 | 29 | 
| 32 document.addEventListener("DOMContentLoaded", function() | 30 document.addEventListener("DOMContentLoaded", function() | 
| 33 { | 31 { | 
| 34   var unmaskAfterTimeout = setTimeout.bind( | 32   var unmaskAfterTimeout = setTimeout.bind( | 
| 35     this, | 33     this, | 
| 36     unmaskAddress, | 34     unmaskAddress, | 
| 37     ADDRESS_MASKING_DELAY | 35     ADDRESS_MASKING_DELAY | 
| 38   ); | 36   ); | 
| 39 | 37 | 
| 40   document.querySelectorAll("[data-address]").forEach(unmaskAddress); | 38   document.querySelectorAll("[data-mask]").forEach(unmaskAddress); | 
| 41 }); | 39 }); | 
| LEFT | RIGHT | 
|---|