| OLD | NEW | 
|---|
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 194       if (title) | 194       if (title) | 
| 195         element.setAttribute("data-search", title.toLowerCase()); | 195         element.setAttribute("data-search", title.toLowerCase()); | 
| 196       var control = element.querySelector(".control[role='checkbox']"); | 196       var control = element.querySelector(".control[role='checkbox']"); | 
| 197       if (control) | 197       if (control) | 
| 198       { | 198       { | 
| 199         control.setAttribute("aria-checked", item.disabled == false); | 199         control.setAttribute("aria-checked", item.disabled == false); | 
| 200         if (this._isControlDisabled(item, i)) | 200         if (this._isControlDisabled(item, i)) | 
| 201           control.setAttribute("disabled", true); | 201           control.setAttribute("disabled", true); | 
| 202       } | 202       } | 
| 203 | 203 | 
| 204       var downloadStatus = item.downloadStatus; |  | 
| 205       var dateElement = element.querySelector(".date"); | 204       var dateElement = element.querySelector(".date"); | 
| 206       var timeElement = element.querySelector(".time"); | 205       var timeElement = element.querySelector(".time"); | 
| 207       if(dateElement && timeElement) | 206       if (dateElement && timeElement) | 
| 208       { | 207       { | 
| 209         var message = element.querySelector(".message"); | 208         var message = element.querySelector(".message"); | 
| 210         ext.backgroundPage.sendMessage( | 209         if (item.isDownloading) | 
| 211         { | 210         { | 
| 212           type: "subscriptions.isDownloading", | 211           var text = getMessage("options_filterList_lastDownload_inProgress"); | 
| 213           url: item.url | 212           message.textContent = text; | 
| 214         }, | 213           element.classList.add("show-message"); | 
| 215         function(isDownloading) | 214         } | 
|  | 215         else if (item.downloadStatus != "synchronize_ok") | 
| 216         { | 216         { | 
| 217           if (isDownloading) | 217           var error = filterErrors[item.downloadStatus]; | 
| 218           { | 218           if (error) | 
| 219             var text = getMessage("options_filterList_lastDownload_inProgress"); | 219             message.textContent = getMessage(error); | 
| 220             message.textContent = text; | 220           else | 
| 221             element.classList.add("show-message"); | 221             message.textContent = item.downloadStatus; | 
| 222           } | 222           element.classList.add("show-message"); | 
| 223           else if (downloadStatus && downloadStatus != "synchronize_ok") | 223         } | 
| 224           { | 224         else if (item.lastDownload > 0) | 
| 225             if (downloadStatus in filterErrors) | 225         { | 
| 226               message.textContent = getMessage(filterErrors[downloadStatus]); | 226           var dateTime = i18n_formatDateTime(item.lastDownload * 1000); | 
| 227             else | 227           dateElement.textContent = dateTime[0]; | 
| 228               message.textContent = item.downloadStatus; | 228           timeElement.textContent = dateTime[1]; | 
| 229             element.classList.add("show-message"); | 229           element.classList.remove("show-message"); | 
| 230           } | 230         } | 
| 231           else if (item.lastDownload > 0) |  | 
| 232           { |  | 
| 233             var dateTime = i18n_formatDateTime(item.lastDownload * 1000); |  | 
| 234             dateElement.textContent = dateTime[0]; |  | 
| 235             timeElement.textContent = dateTime[1]; |  | 
| 236             element.classList.remove("show-message"); |  | 
| 237           } |  | 
| 238         }); |  | 
| 239       } | 231       } | 
|  | 232 | 
| 240       var websiteElement = element.querySelector(".context-menu .website"); | 233       var websiteElement = element.querySelector(".context-menu .website"); | 
| 241       var sourceElement = element.querySelector(".context-menu .source"); | 234       var sourceElement = element.querySelector(".context-menu .source"); | 
| 242       if (websiteElement && item.homepage) | 235       if (websiteElement && item.homepage) | 
| 243         websiteElement.setAttribute("href", item.homepage); | 236         websiteElement.setAttribute("href", item.homepage); | 
| 244       if (sourceElement) | 237       if (sourceElement) | 
| 245         sourceElement.setAttribute("href", item.url); | 238         sourceElement.setAttribute("href", item.url); | 
| 246     } | 239     } | 
| 247   }; | 240   }; | 
| 248 | 241 | 
| 249   Collection.prototype.clearAll = function() | 242   Collection.prototype.clearAll = function() | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 411             } | 404             } | 
| 412           } | 405           } | 
| 413         } | 406         } | 
| 414         for (var i in collections) | 407         for (var i in collections) | 
| 415           collections[i].updateItem(subscription); | 408           collections[i].updateItem(subscription); | 
| 416       } | 409       } | 
| 417     } | 410     } | 
| 418 | 411 | 
| 419     if (!Object.observe) | 412     if (!Object.observe) | 
| 420     { | 413     { | 
| 421       ["disabled", "lastDownload"].forEach(function(property) | 414       Object.keys(subscription).forEach(function(property) | 
| 422       { | 415       { | 
| 423         subscription["$" + property] = subscription[property]; | 416         var value = subscription[property]; | 
| 424         Object.defineProperty(subscription, property, | 417         Object.defineProperty(subscription, property, | 
| 425         { | 418         { | 
| 426           get: function() | 419           get: function() | 
| 427           { | 420           { | 
| 428             return this["$" + property]; | 421             return value; | 
| 429           }, | 422           }, | 
| 430           set: function(newValue) | 423           set: function(newValue) | 
| 431           { | 424           { | 
| 432             var oldValue = this["$" + property]; | 425             if (value != newValue) | 
| 433             if (oldValue != newValue) |  | 
| 434             { | 426             { | 
| 435               this["$" + property] = newValue; | 427               value = newValue; | 
| 436               var change = Object.create(null); | 428               onObjectChanged([{name: property}]); | 
| 437               change.name = property; |  | 
| 438               onObjectChanged([change]); |  | 
| 439             } | 429             } | 
| 440           } | 430           } | 
| 441         }); | 431         }); | 
| 442       }); | 432       }); | 
| 443     } | 433     } | 
| 444     else | 434     else | 
| 445     { | 435     { | 
| 446       Object.observe(subscription, onObjectChanged); | 436       Object.observe(subscription, onObjectChanged); | 
| 447     } | 437     } | 
| 448   } | 438   } | 
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 914   { | 904   { | 
| 915     var customFilterItems = collections.customFilters.items; | 905     var customFilterItems = collections.customFilters.items; | 
| 916     var filterTexts = []; | 906     var filterTexts = []; | 
| 917     for (var i = 0; i < customFilterItems.length; i++) | 907     for (var i = 0; i < customFilterItems.length; i++) | 
| 918       filterTexts.push(customFilterItems[i].text); | 908       filterTexts.push(customFilterItems[i].text); | 
| 919     E("custom-filters-raw").value = filterTexts.join("\n"); | 909     E("custom-filters-raw").value = filterTexts.join("\n"); | 
| 920   } | 910   } | 
| 921 | 911 | 
| 922   function getAcceptableAdsURL(callback) | 912   function getAcceptableAdsURL(callback) | 
| 923   { | 913   { | 
| 924     getPref("subscriptions_exceptionsurl", function(value) | 914     getPref("subscriptions_exceptionsurl", function(value) | 
| 925     { | 915     { | 
| 926       getAcceptableAdsURL = function(callback) | 916       getAcceptableAdsURL = function(callback) | 
| 927       { | 917       { | 
| 928         callback(value); | 918         callback(value); | 
| 929       }; | 919       }; | 
| 930       getAcceptableAdsURL(callback); | 920       getAcceptableAdsURL(callback); | 
| 931     }); | 921     }); | 
| 932   } | 922   } | 
| 933 | 923 | 
| 934   function addEnableSubscription(url, title, homepage) | 924   function addEnableSubscription(url, title, homepage) | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 985         if (knownSubscription) | 975         if (knownSubscription) | 
| 986           collections.filterLists.addItems(knownSubscription); | 976           collections.filterLists.addItems(knownSubscription); | 
| 987         else | 977         else | 
| 988           collections.filterLists.addItems(subscription); | 978           collections.filterLists.addItems(subscription); | 
| 989         break; | 979         break; | 
| 990       case "disabled": | 980       case "disabled": | 
| 991         updateSubscription(subscription); | 981         updateSubscription(subscription); | 
| 992         updateShareLink(); | 982         updateShareLink(); | 
| 993         break; | 983         break; | 
| 994       case "lastDownload": | 984       case "lastDownload": | 
|  | 985       case "downloadStatus": | 
|  | 986       case "downloading": | 
| 995         updateSubscription(subscription); | 987         updateSubscription(subscription); | 
| 996         break; | 988         break; | 
| 997       case "homepage": | 989       case "homepage": | 
| 998         // TODO: NYI | 990         // TODO: NYI | 
| 999         break; | 991         break; | 
| 1000       case "removed": | 992       case "removed": | 
| 1001         var knownSubscription = subscriptionsMap[subscription.url]; | 993         var knownSubscription = subscriptionsMap[subscription.url]; | 
| 1002         getAcceptableAdsURL(function(acceptableAdsUrl) | 994         getAcceptableAdsURL(function(acceptableAdsUrl) | 
| 1003         { | 995         { | 
| 1004           if (subscription.url == acceptableAdsUrl) | 996           if (subscription.url == acceptableAdsUrl) | 
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1173   { | 1165   { | 
| 1174     type: "prefs.listen", | 1166     type: "prefs.listen", | 
| 1175     filter: ["notifications_ignoredcategories", "notifications_showui", | 1167     filter: ["notifications_ignoredcategories", "notifications_showui", | 
| 1176         "safari_contentblocker", "show_devtools_panel", | 1168         "safari_contentblocker", "show_devtools_panel", | 
| 1177         "shouldShowBlockElementMenu"] | 1169         "shouldShowBlockElementMenu"] | 
| 1178   }); | 1170   }); | 
| 1179   ext.backgroundPage.sendMessage( | 1171   ext.backgroundPage.sendMessage( | 
| 1180   { | 1172   { | 
| 1181     type: "subscriptions.listen", | 1173     type: "subscriptions.listen", | 
| 1182     filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1174     filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 
| 1183         "title"] | 1175         "title", "downloadStatus", "downloading"] | 
| 1184   }); | 1176   }); | 
| 1185 | 1177 | 
| 1186   window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1178   window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 
| 1187 })(); | 1179 })(); | 
| OLD | NEW | 
|---|