source: branches/ray/examples/simple_example.html @ 761

Last change on this file since 761 was 761, checked in by ray, 13 years ago

updated branch

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy HeadURL Id
File size: 6.8 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5<title>Simple example of Xinha</title>
6<script type="text/javascript">
7/************************************************************************
8 * Please refer to http://xinha.python-hosting.com/wiki/NewbieGuide
9 ************************************************************************
10 * You must set _editor_url to the URL (including trailing slash) where
11 * where xinha is installed, it's highly recommended to use an absolute URL
12 *  eg: _editor_url = "/path/to/xinha/";
13 * You may try a relative URL if you wish]
14 *  eg: _editor_url = "../"; 
15 * in this example we do a little regular expression to find the absolute path.
16 ************************************************************************/
17var _editor_url  = document.location.href.replace(/examples\/simple_example\.html.*/, '')
18// And the language we need to use in the editor.
19var _editor_lang = "en";
20</script>
21<!-- Load up the actual editor core -->
22<script type="text/javascript" src="../XinhaCore.js"></script>
23<script type="text/javascript">
24/************************************************************************
25 * Plugins you will be using in the editors on this page.
26 * List all the plugins you will need, even if not all the editors will
27 * use all the plugins.
28 ************************************************************************
29 * Please refer to http://xinha.python-hosting.com/wiki/Plugins for the
30 * list of availables plugins
31 ************************************************************************/
32var xinha_plugins =
33[
34 'CharacterMap',
35 'ContextMenu',
36 'FullScreen',
37 'ListType',
38 'SpellChecker',
39 'Stylist',
40 'SuperClean',
41 'TableOperations'
42];
43/************************************************************************
44 * Names of the textareas you will be turning into editors
45 ************************************************************************/
46var xinha_editors =
47[
48  'myTextArea',
49  'anotherOne'
50];
51/************************************************************************
52 * Initialisation function
53 ************************************************************************/
54function xinha_init()
55{
56  // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  :)
57  if(!Xinha.loadPlugins(xinha_plugins, xinha_init)) return;
58  /*************************************************************************
59   * We create a default configuration to be used by all the editors.
60   * If you wish to configure some of the editors differently this will be
61   * done later after editors are initiated.
62   ************************************************************************
63   * Please refer to http://xinha.python-hosting.com/wiki/Documentation/Customise
64   * for the configuration parameters
65   ************************************************************************/
66  var xinha_config = new Xinha.Config();
67  /************************************************************************
68   * We first create editors for the textareas.
69   * You can do this in two ways, either
70   *
71   *   xinha_editors   = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
72   *
73   * if you want all the editor objects to use the same set of plugins, OR;
74   *
75   *   xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config);
76   *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
77   *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
78   *
79   * if you want to use a different set of plugins for one or more of the
80   * editors.
81   ************************************************************************/
82  xinha_editors = Xinha.makeEditors(xinha_editors, xinha_config, xinha_plugins);
83  /************************************************************************
84   * If you want to change the configuration variables of any of the
85   * editors,  this is the place to do that, for example you might want to
86   * change the width and height of one of the editors, like this...
87   ************************************************************************/
88  xinha_editors.myTextArea.config.width = '640px';
89  xinha_editors.myTextArea.config.height = '480px';
90  /************************************************************************
91   * Or remove the statusbar on the other one, like this...
92   * For every possible configuration, please refer to
93   * http://xinha.python-hosting.com/wiki/Documentation/ConfigVariablesList
94   ************************************************************************/
95  xinha_editors.anotherOne.config.statusBar = false;
96  /************************************************************************
97   * Finally we "start" the editors, this turns the textareas into
98   * Xinha editors.
99   ************************************************************************/
100  Xinha.startEditors(xinha_editors);
101}
102window.onload = xinha_init;
103</script>
104<link type="text/css" rel="stylesheet" title="blue-look" href="../skins/blue-look/skin.css">
105<link type="text/css" rel="alternate stylesheet" title="green-look" href="../skins/green-look/skin.css">
106<link type="text/css" rel="alternate stylesheet" title="xp-blue" href="../skins/xp-blue/skin.css">
107<link type="text/css" rel="alternate stylesheet" title="xp-green" href="../skins/xp-green/skin.css">
108<link type="text/css" rel="alternate stylesheet" title="inditreuse" href="../skins/inditreuse/skin.css">
109<link type="text/css" rel="alternate stylesheet" title="blue-metallic" href="../skins/blue-metallic/skin.css">
110</head>
111
112<body>
113
114<form onsubmit="alert(this.myTextArea.value); alert(this.anotherOne.value); return false;">
115<textarea id="myTextArea" name="myTextArea" rows="10" cols="80" style="width:100%">
116&lt;p&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
117Aliquam et tellus vitae justo varius placerat. Suspendisse iaculis
118velit semper dolor. Donec gravida tincidunt mi. Curabitur tristique
119ante elementum turpis. Aliquam nisl. Nulla posuere neque non
120tellus. Morbi vel nibh. Cum sociis natoque penatibus et magnis dis
121parturient montes, nascetur ridiculus mus. Nam nec wisi. In wisi.
122Curabitur pharetra bibendum lectus.&lt;/p&gt;
123</textarea>
124<textarea id="anotherOne" name="anotherOne" rows="10" cols="80" style="width:100%">
125&lt;ul&gt;
126&lt;li&gt; Phasellus et massa sed diam viverra semper.  &lt;/li&gt;
127&lt;li&gt; Mauris tincidunt felis in odio.              &lt;/li&gt;
128&lt;li&gt; Nulla placerat nunc ut pede.                 &lt;/li&gt;
129&lt;li&gt; Vivamus ultrices mi sit amet urna.           &lt;/li&gt;
130&lt;li&gt; Quisque sed augue quis nunc laoreet volutpat.&lt;/li&gt;
131&lt;li&gt; Nunc sit amet metus in tortor semper mattis. &lt;/li&gt;
132&lt;/ul&gt;
133</textarea>
134<input type="submit">
135</form>
136
137</body>
138</html>
Note: See TracBrowser for help on using the repository browser.