| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 Collection.prototype.updateItem = function(item) | 153 Collection.prototype.updateItem = function(item) |
| 154 { | 154 { |
| 155 var access = (item.url || item.text).replace(/'/g, "\\'"); | 155 var access = (item.url || item.text).replace(/'/g, "\\'"); |
| 156 for (var i = 0; i < this.details.length; i++) | 156 for (var i = 0; i < this.details.length; i++) |
| 157 { | 157 { |
| 158 var table = E(this.details[i].id); | 158 var table = E(this.details[i].id); |
| 159 var element = table.querySelector("[data-access='" + access + "']"); | 159 var element = table.querySelector("[data-access='" + access + "']"); |
| 160 if (!element) | 160 if (!element) |
| 161 continue; | 161 continue; |
| 162 | 162 |
| 163 var text = item.title || item.url || item.text; | 163 var title = item.title || item.url || item.text; |
| 164 element.querySelector(".display").textContent = text; | 164 element.querySelector(".display").textContent = title; |
| 165 if (text) | 165 if (title) |
| 166 element.setAttribute("data-search", text.toLowerCase()); | 166 element.setAttribute("data-search", title.toLowerCase()); |
| 167 var control = element.querySelector(".control[role='checkbox']"); | 167 var control = element.querySelector(".control[role='checkbox']"); |
| 168 if (control) | 168 if (control) |
| 169 control.setAttribute("aria-checked", item.disabled == false); | 169 control.setAttribute("aria-checked", item.disabled == false); |
| 170 | 170 |
| 171 var downloadStatus = item.downloadStatus; | 171 var downloadStatus = item.downloadStatus; |
| 172 var dateElement = element.querySelector(".date"); | 172 var dateElement = element.querySelector(".date"); |
| 173 var timeElement = element.querySelector(".time"); | 173 var timeElement = element.querySelector(".time"); |
| 174 if(dateElement && timeElement) | 174 if(dateElement && timeElement) |
| 175 { | 175 { |
| 176 if (downloadStatus && downloadStatus != "synchronize_ok") | 176 var message = element.querySelector(".message"); |
| 177 { | 177 ext.backgroundPage.sendMessage( |
| 178 if (downloadStatus in filterErrors) | 178 { |
| 179 timeElement.textContent = getMessage(filterErrors[downloadStatus]); | 179 type: "subscriptions.isDownloading", |
| 180 else | 180 url: item.url |
| 181 timeElement.textContent = item.downloadStatus; | 181 }, |
| 182 } | 182 function(isDownloading) |
| 183 else if (item.lastDownload > 0) | 183 { |
| 184 { | 184 if (isDownloading) |
| 185 var dateTime = i18n_formatDateTime(item.lastDownload * 1000); | 185 { |
| 186 dateElement.textContent = dateTime[0]; | 186 var text = getMessage("options_filterList_lastDownload_inProgress"); |
| 187 timeElement.textContent = dateTime[1]; | 187 message.textContent = text; |
| 188 } | 188 element.classList.add("show-message"); |
| 189 else | 189 } |
| 190 { | 190 else if (downloadStatus && downloadStatus != "synchronize_ok") |
| 191 timeElement.textContent = getMessage("options_filterList_lastDownload_ inProgress"); | 191 { |
|
Thomas Greiner
2016/02/03 14:50:14
Whenever adding a subscription I see two issues:
saroyanm
2016/02/03 17:43:12
Done.
| |
| 192 } | 192 if (downloadStatus in filterErrors) |
| 193 message.textContent = getMessage(filterErrors[downloadStatus]); | |
| 194 else | |
| 195 message.textContent = item.downloadStatus; | |
| 196 element.classList.add("show-message"); | |
| 197 } | |
| 198 else if (item.lastDownload > 0) | |
| 199 { | |
| 200 var dateTime = i18n_formatDateTime(item.lastDownload * 1000); | |
| 201 dateElement.textContent = dateTime[0]; | |
| 202 timeElement.textContent = dateTime[1]; | |
| 203 element.classList.remove("show-message"); | |
| 204 } | |
| 205 }); | |
| 193 } | 206 } |
| 194 var websiteElement = element.querySelector(".context-menu .website"); | 207 var websiteElement = element.querySelector(".context-menu .website"); |
| 195 var sourceElement = element.querySelector(".context-menu .source"); | 208 var sourceElement = element.querySelector(".context-menu .source"); |
| 196 if (websiteElement && item.homepage) | 209 if (websiteElement && item.homepage) |
| 197 websiteElement.setAttribute("href", item.homepage); | 210 websiteElement.setAttribute("href", item.homepage); |
| 198 if (sourceElement) | 211 if (sourceElement) |
| 199 sourceElement.setAttribute("href", item.url); | 212 sourceElement.setAttribute("href", item.url); |
| 200 } | 213 } |
| 201 }; | 214 }; |
| 202 | 215 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 subscription["$" + property] = subscription[property]; | 389 subscription["$" + property] = subscription[property]; |
| 377 Object.defineProperty(subscription, property, | 390 Object.defineProperty(subscription, property, |
| 378 { | 391 { |
| 379 get: function() | 392 get: function() |
| 380 { | 393 { |
| 381 return this["$" + property]; | 394 return this["$" + property]; |
| 382 }, | 395 }, |
| 383 set: function(newValue) | 396 set: function(newValue) |
| 384 { | 397 { |
| 385 var oldValue = this["$" + property]; | 398 var oldValue = this["$" + property]; |
| 386 this["$" + property] = newValue; | |
|
Thomas Greiner
2016/02/03 14:50:14
Detail: Shouldn't this only be set whenever the va
saroyanm
2016/02/03 17:43:12
Done.
| |
| 387 if (oldValue != newValue) | 399 if (oldValue != newValue) |
| 388 { | 400 { |
| 401 this["$" + property] = newValue; | |
| 389 var change = Object.create(null); | 402 var change = Object.create(null); |
| 390 change.name = property; | 403 change.name = property; |
| 391 onObjectChanged([change]); | 404 onObjectChanged([change]); |
| 392 } | 405 } |
| 393 } | 406 } |
| 394 }); | 407 }); |
| 395 }); | 408 }); |
| 396 } | 409 } |
| 397 else | 410 else |
| 398 { | 411 { |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 filter: ["added", "loaded", "removed"] | 1018 filter: ["added", "loaded", "removed"] |
| 1006 }); | 1019 }); |
| 1007 ext.backgroundPage.sendMessage( | 1020 ext.backgroundPage.sendMessage( |
| 1008 { | 1021 { |
| 1009 type: "subscriptions.listen", | 1022 type: "subscriptions.listen", |
| 1010 filter: ["added", "disabled", "homepage", "lastDownload", "removed", "title" ] | 1023 filter: ["added", "disabled", "homepage", "lastDownload", "removed", "title" ] |
| 1011 }); | 1024 }); |
| 1012 | 1025 |
| 1013 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1026 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1014 })(); | 1027 })(); |
| LEFT | RIGHT |