summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/examples/api/infobars/sandwichbar/contentscript.js
blob: 6fa03ecc83c11ddc1cbd54f8ab9624e1cfa542ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * Copyright (c) 2010 The Chromium Authors. All rights reserved.  Use of this
 * source code is governed by a BSD-style license that can be found in the
 * LICENSE file.
 */
var regex = /sandwich/gi;
matches = document.body.innerText.match(regex);
if (matches) {
  var payload = {
    count: matches.length    // Pass the number of matches back.
  };
  chrome.extension.sendRequest(payload, function(response) {});
}