Add note field to tester.html WRIS-3
[mkws-moved-to-github.git] / examples / htdocs / dict.html
1 <html>\r
2   <head>\r
3     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
4     <title>Dictionary lookup demo</title>\r
5     <script type="text/javascript">\r
6       var mkws_config = {\r
7         sp_auth_credentials: "mkwsdict/mkwsdict"\r
8       };\r
9     </script>\r
10     <link rel="stylesheet" type="text/css" href="//mkws.indexdata.com/mkws.css" />\r
11     <link rel="stylesheet" type="text/css" href="mkws-widget-reference.css" />\r
12     <script src="//mkws.indexdata.com/mkws-complete.js"></script>\r
13     <script>$ = jQuery = mkws.$; </script>\r
14   </head>\r
15   <body>\r
16 \r
17   <table height="100%" width="100%">\r
18     <tr valign="top" height="100%">\r
19       <td width="60%" valign="top">\r
20         <div id="intro" style="background:yellow; padding:0.1em 1em"\r
21            onclick="this.style.display = 'none'">\r
22           <p>\r
23             What follows is seed content for the dictionary-lookup\r
24             demo (taken from <a href="http://en.wikipedia.org/wiki/Computer"\r
25                                 >the Wikipedia page for "computer"</a>).\r
26             Select any region of text on this page (for example, by\r
27             double-clicking a word) and that word will be looked up,\r
28             with the results displayed in the sidebar on the right.\r
29           </p>\r
30           <p>\r
31             Click this introduction to dismiss it.\r
32           </p>\r
33         </div>\r
34         <p>A <b>computer</b> is a general purpose device that can be <a href="http://en.wikipedia.org/wiki/Computer_program" title="Computer program">programmed</a> to carry out a set of arithmetic or logical operations. Since a sequence of operations can be readily changed, the computer can solve more than one kind of problem.</p>\r
35         <p>Conventionally, a computer consists of at least one processing element, typically a <a href="http://en.wikipedia.org/wiki/Central_processing_unit" title="Central processing unit">central processing unit</a> (CPU) and some form of <a href="http://en.wikipedia.org/wiki/Memory_(computers)" title="Memory (computers)" class="mw-redirect">memory</a>. The processing element carries out arithmetic and logic operations, and a sequencing and control unit that can change the order of operations based on stored information. Peripheral devices allow information to be retrieved from an external source, and the result of operations saved and retrieved.</p>\r
36         <p>In <a href="http://en.wikipedia.org/wiki/World_War_II" title="World War II">World War II</a>, <a href="http://en.wikipedia.org/wiki/Mechanical_computer" title="Mechanical computer">mechanical</a> <a href="http://en.wikipedia.org/wiki/Analog_computers" title="Analog computers" class="mw-redirect">analog computers</a> were used for specialized military applications. During this time the first electronic <a href="http://en.wikipedia.org/wiki/Digital_data" title="Digital data">digital</a> computers were developed. Originally they were the size of a large room, consuming as much power as several hundred modern <a href="http://en.wikipedia.org/wiki/Personal_computer" title="Personal computer">personal computers</a> (PCs).<sup id="cite_ref-1" class="reference"><a href="http://en.wikipedia.org/wiki/Computer#cite_note-1"><span>[</span>1<span>]</span></a></sup></p>\r
37         <p>Modern computers based on <a href="http://en.wikipedia.org/wiki/Integrated_circuit" title="Integrated circuit">integrated circuits</a> are millions to billions of times more capable than the early machines, and occupy a fraction of the space.<sup id="cite_ref-2" class="reference"><a href="http://en.wikipedia.org/wiki/Computer#cite_note-2"><span>[</span>2<span>]</span></a></sup> Simple computers are small enough to fit into <a href="http://en.wikipedia.org/wiki/Mobile_device" title="Mobile device">mobile devices</a>, and <a href="http://en.wikipedia.org/wiki/Mobile_computing" title="Mobile computing">mobile computers</a> can be powered by small <a href="http://en.wikipedia.org/wiki/Battery_(electricity)" title="Battery (electricity)">batteries</a>. Personal computers in their various forms are <a href="http://en.wikipedia.org/wiki/Icon" title="Icon">icons</a> of the <a href="http://en.wikipedia.org/wiki/Information_Age" title="Information Age">Information Age</a> and are what most people think of as “computers.” However, the <a href="http://en.wikipedia.org/wiki/Embedded_system" title="Embedded system">embedded computers</a> found in many devices from <a href="http://en.wikipedia.org/wiki/Digital_audio_player" title="Digital audio player" class="mw-redirect">MP3 players</a> to <a href="http://en.wikipedia.org/wiki/Fighter_aircraft" title="Fighter aircraft">fighter aircraft</a> and from toys to <a href="http://en.wikipedia.org/wiki/Industrial_robot" title="Industrial robot">industrial robots</a> are the most numerous.</p>\r
38         </div>\r
39       </td>\r
40       <td width="40%" align="top">\r
41         <div class="mkws-search"></div>\r
42         <div class="mkws-reference"></div>\r
43         <div class="search-query"></div>\r
44       </td>\r
45     </tr>\r
46   </table>\r
47 \r
48   <script>\r
49     $(".mkws-search").hide();\r
50     $(".mkws-reference").hide();\r
51 \r
52     if(!window.indexdata){\r
53       indexdata = {};\r
54     }\r
55 \r
56     indexdata.Selector = { 'debug': false, 'clicking': false };\r
57 \r
58     indexdata.Selector.getSelected = function(){\r
59       var t = '';\r
60       if(window.getSelection){\r
61         t = window.getSelection();\r
62       }else if(document.getSelection){\r
63         t = document.getSelection();\r
64       }else if(document.selection){\r
65         t = document.selection.createRange().text;\r
66       }\r
67       return t;\r
68     };\r
69 \r
70     indexdata.Selector.mouseup = function(){\r
71       var text = indexdata.Selector.getSelected();\r
72       if(text != ''){\r
73         if (indexdata.Selector.debug) {\r
74           alert("You selected:\n" + text);\r
75         }\r
76         indexdata.Selector.mkws(text);\r
77       }\r
78     };\r
79 \r
80     indexdata.Selector.mkws = function(query) {\r
81       if ( query != "" && ! indexdata.Selector.clicking ) {\r
82         // no recursive calls\r
83         indexdata.Selector.clicking  = true;\r
84 \r
85         $(".mkws-reference").show();\r
86         $("input.mkws-query").val(query);\r
87         $(".search-query").text(query);\r
88         $("input.mkws-button").trigger("click");\r
89         indexdata.Selector.clicking = false;\r
90       }\r
91     };\r
92 \r
93     $(document).ready(function(){\r
94       $(document).bind("mouseup", indexdata.Selector.mouseup);\r
95     });\r
96 \r
97   </script>\r
98   </body>\r
99 </html>\r