| OLD | NEW |
| 1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 unit = 'MB' | 180 unit = 'MB' |
| 181 if value > 1024: | 181 if value > 1024: |
| 182 value /= 1024 | 182 value /= 1024 |
| 183 unit = 'GB' | 183 unit = 'GB' |
| 184 return '%.2f %s' % (value, unit) | 184 return '%.2f %s' % (value, unit) |
| 185 | 185 |
| 186 | 186 |
| 187 def toJSON(value, **args): | 187 def toJSON(value, **args): |
| 188 return re.sub(r'</script>', r'<\/script>', json.dumps(value, **args)) | 188 return re.sub(r'</script>', r'<\/script>', json.dumps(value, **args)) |
| 189 | 189 |
| 190 |
| 190 filters = { | 191 filters = { |
| 191 'formattime': formattime, | 192 'formattime': formattime, |
| 192 'timerelative': formatrelativetime, | 193 'timerelative': formatrelativetime, |
| 193 'url': formaturl, | 194 'url': formaturl, |
| 194 'keepnewlines': formatnewlines, | 195 'keepnewlines': formatnewlines, |
| 195 'filtercount': formatfiltercount, | 196 'filtercount': formatfiltercount, |
| 196 'buglinks': formatBugLinks, | 197 'buglinks': formatBugLinks, |
| 197 'urlencode': urlencode, | 198 'urlencode': urlencode, |
| 198 'subscriptionSort': subscriptionSort, | 199 'subscriptionSort': subscriptionSort, |
| 199 'mime': formatmime, | 200 'mime': formatmime, |
| 200 'emailaddr': email.utils.formataddr, | 201 'emailaddr': email.utils.formataddr, |
| 201 'ljust': ljust, | 202 'ljust': ljust, |
| 202 'rjust': rjust, | 203 'rjust': rjust, |
| 203 'ltruncate': ltruncate, | 204 'ltruncate': ltruncate, |
| 204 'weekday': formatweekday, | 205 'weekday': formatweekday, |
| 205 'bytes': formatbytes, | 206 'bytes': formatbytes, |
| 206 'json': toJSON, | 207 'json': toJSON, |
| 207 } | 208 } |
| OLD | NEW |