| OLD | NEW |
| 1 /* |
| 2 * This file is part of the Adblock Plus build tools, |
| 3 * Copyright (C) 2006-2013 Eyeo GmbH |
| 4 * |
| 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 |
| 7 * published by the Free Software Foundation. |
| 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ |
| 17 |
| 1 (function() | 18 (function() |
| 2 { | 19 { |
| 3 var basename = {{metadata.get("general", "basename")|json}}; | 20 var basename = {{metadata.get("general", "basename")|json}}; |
| 4 | 21 |
| 5 function doPoll() | 22 function doPoll() |
| 6 { | 23 { |
| 7 var request = new XMLHttpRequest(); | 24 var request = new XMLHttpRequest(); |
| 8 request.open("GET", "http://localhost:43816/"); | 25 request.open("GET", "http://localhost:43816/"); |
| 9 request.addEventListener("load", function() | 26 request.addEventListener("load", function() |
| 10 { | 27 { |
| 11 if (request.responseText != basename) | 28 if (request.responseText != basename) |
| 12 return; | 29 return; |
| 13 | 30 |
| 14 var views = chrome.extension.getViews(); | 31 var views = chrome.extension.getViews(); |
| 15 for (var i = 0; i < views.length; i++) | 32 for (var i = 0; i < views.length; i++) |
| 16 if (views[i] != window) | 33 if (views[i] != window) |
| 17 views[i].close(); | 34 views[i].close(); |
| 18 window.location.reload(); | 35 window.location.reload(); |
| 19 }, false); | 36 }, false); |
| 20 request.send(null); | 37 request.send(null); |
| 21 | 38 |
| 22 window.setTimeout(doPoll, 5000); | 39 window.setTimeout(doPoll, 5000); |
| 23 } | 40 } |
| 24 | 41 |
| 25 // Delay first poll to prevent reloading again immediately after a reload | 42 // Delay first poll to prevent reloading again immediately after a reload |
| 26 window.setTimeout(doPoll, 10000); | 43 window.setTimeout(doPoll, 10000); |
| 27 })(); | 44 })(); |
| OLD | NEW |