aboutsummaryrefslogtreecommitdiffstats
path: root/test_harnesses/vomnibar.html
blob: 820210b0a719ad806e87438c1e8274e7805255ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!--
  This harness is used to show our vomnibar with some sample suggestions. It's a convenient way to restyle
  the Vomnibar without having to make changes, reload the extension, refresh the page, open it and type
  something.
 -->
<!DOCTYPE html>
<html>
<head>
  <title></title>
  <script type="text/javascript" src="../lib/utils.js"></script>
  <script type="text/javascript" src="../lib/keyboard_utils.js"></script>
  <script type="text/javascript" src="../lib/dom_utils.js"></script>
  <script src="https://github.com/ooyala/livecss/raw/master/livecss.js"></script>
  <script type="text/javascript" src="../pages/vomnibar.js"></script>
  <link rel="stylesheet" type="text/css" href="../vimium.css" />
  <script>
    function setup() {
      window.handlerStack = new HandlerStack();
      // This itemHtml was obtained just by copying and pasting what was generated when using it in practice.
      var itemHtml = '<span class="source">history</span> http://<span class="fuzzyMatch">n</span><span class="fuzzyMatch">i</span><span class="fuzzyMatch">n</span><span class="fuzzyMatch">j</span><span class="fuzzyMatch">a</span>words.com/info/about <span class="title">Ninjawords - a really fast dictionary</span>';
      var results = [{ html: itemHtml }, { html: itemHtml }];

      // Stub out the chrome extension APIs needed by the Vomnibar.
      window.chrome = { };
      var port = {
        onMessage: { addListener: function(callback) { } },
        postMessage: function() { }
      };
      window.chrome.runtime = {
        connect: function() { return port; },
        sendRequest: function() { },
      };

      Vomnibar.activate();
      var ui = Vomnibar.getUI();
      ui.populateUiWithCompletions(results)
    };

    document.addEventListener("DOMContentLoaded", setup, false);
  </script>

  <style type="text/css" media="screen">
    body {
      font-size: 19px;
      width: 800px;
      margin: 0 auto;
      color: #333;
      padding: 20px;
      background-color: #f0e5bc;
    }
  </style>

</head>

<body>
  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
  dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
  ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
  nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
  anim id est laborum.

  <br/><br/>

  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
  dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
  ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
  nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
  anim id est laborum.
</body>
</html>