%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. (function linkClickerBackgroundScript() { // time in ms. let minInterval = 1*1000; let maxInterval = 20*1000; let pattern = /.*/; let enabled = false; let animateIconIntervalId; // =========================================================================== chrome.runtime.onMessage.addListener(function(msg, sender, response) { let result; if (msg.type == 'update') result = updateFromMessage(msg); if (msg.type == 'get') result = getValues(); response(result); }); // =========================================================================== function updateFromMessage(msg) { console.log(msg); minInterval = Number(msg.minInterval) maxInterval = Number(msg.maxInterval); if (maxInterval < minInterval) { let tmpMin = Math.min(minInterval, maxInterval); maxInterval = Math.max(minInterval, maxInterval); minInterval = tmpMin; } pattern = new RegExp(msg.pattern); enabled = Boolean(msg.enabled); updateTabs(); scheduleIconAnimation(); return getValues(); } function getValues() { return { type: 'update', minInterval: minInterval, maxInterval: maxInterval, pattern: pattern.source, enabled: enabled } } function updateTabs() { chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { let message = getValues(); for (let i = 0; i < tabs.length; ++i) { chrome.tabs.sendMessage(tabs[i].id, message); } }); } let animationIndex = 0; function animateIcon() { animationIndex = (animationIndex + 1) % 4; chrome.browserAction.setBadgeText( { text: ".".repeat(animationIndex) } ); } function scheduleIconAnimation() { chrome.browserAction.setBadgeText( { text: "" } ); clearInterval(animateIconIntervalId); if (enabled) { animateIconIntervalId = setInterval(animateIcon, 500); } } })();