qwik2md 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/lib/qwik2md/version.rb +1 -1
  3. data/vendor/qwik/lib/qwik/act-christel.rb +1 -1
  4. data/vendor/qwik/lib/qwik/page-get.rb +4 -4
  5. data/vendor/qwik/lib/qwik/util-filename.rb +2 -5
  6. data/vendor/qwik/lib/qwik/util-string.rb +7 -7
  7. data/vendor/qwik/share/super/FrontPage.txt +17 -0
  8. data/vendor/qwik/share/super/QwikWebPlugin.txt +0 -0
  9. data/vendor/qwik/share/super/QwikWebStructure.txt +0 -0
  10. data/vendor/qwik/share/super/RecentList.txt +2 -0
  11. data/vendor/qwik/share/super/SandBox.txt +3 -0
  12. data/vendor/qwik/share/super/TextFormat.txt +186 -0
  13. data/vendor/qwik/share/super/TextFormatSimple.txt +23 -0
  14. data/vendor/qwik/share/super/TitleList.txt +2 -0
  15. data/vendor/qwik/share/super/_AdminMenu.txt +11 -0
  16. data/vendor/qwik/share/super/_BookSearch.txt +3 -0
  17. data/vendor/qwik/share/super/_EditorFooter.txt +9 -0
  18. data/vendor/qwik/share/super/_EditorHelp.txt +9 -0
  19. data/vendor/qwik/share/super/_InterWikiName.txt +17 -0
  20. data/vendor/qwik/share/super/_IsbnLink.txt +8 -0
  21. data/vendor/qwik/share/super/_MemberAdd.txt +4 -0
  22. data/vendor/qwik/share/super/_MemberList.txt +2 -0
  23. data/vendor/qwik/share/super/_MemberListCSV.txt +2 -0
  24. data/vendor/qwik/share/super/_PageAttribute.txt +7 -0
  25. data/vendor/qwik/share/super/_SideMenu.txt +15 -0
  26. data/vendor/qwik/share/super/_SiteConfig.txt +30 -0
  27. data/vendor/qwik/share/super/_SiteFooter.txt +3 -0
  28. data/vendor/qwik/share/super/_SiteLog.txt +0 -0
  29. data/vendor/qwik/share/super/_SiteLogView.txt +2 -0
  30. data/vendor/qwik/share/super/_SiteMember.txt +0 -0
  31. data/vendor/qwik/share/super/_SiteMenu.txt +2 -0
  32. data/vendor/qwik/share/super/_SiteSearch.txt +3 -0
  33. data/vendor/qwik/share/super/_SiteTheme.txt +9 -0
  34. data/vendor/qwik/share/super/_textformat.txt +2 -0
  35. data/vendor/qwik/share/template/Makefile +10 -0
  36. data/vendor/qwik/share/template/edit.html +22 -0
  37. data/vendor/qwik/share/template/edit.rb +40 -0
  38. data/vendor/qwik/share/template/editor.html +23 -0
  39. data/vendor/qwik/share/template/editor.rb +47 -0
  40. data/vendor/qwik/share/template/notice.html +21 -0
  41. data/vendor/qwik/share/template/notice.rb +43 -0
  42. data/vendor/qwik/share/template/plain.html +19 -0
  43. data/vendor/qwik/share/template/plain.rb +43 -0
  44. data/vendor/qwik/share/template/surface.html +22 -0
  45. data/vendor/qwik/share/template/surface.rb +50 -0
  46. data/vendor/qwik/share/template/system.html +30 -0
  47. data/vendor/qwik/share/template/system.rb +46 -0
  48. data/vendor/qwik/share/template/view.html +20 -0
  49. data/vendor/qwik/share/template/view.rb +40 -0
  50. data/vendor/qwik/share/theme/css/Makefile +10 -0
  51. data/vendor/qwik/share/theme/css/base.css +779 -0
  52. data/vendor/qwik/share/theme/css/delete.png +0 -0
  53. data/vendor/qwik/share/theme/css/menu.css +77 -0
  54. data/vendor/qwik/share/theme/css/wema.css +141 -0
  55. data/vendor/qwik/share/theme/i/a.gif +0 -0
  56. data/vendor/qwik/share/theme/i/binary.gif +0 -0
  57. data/vendor/qwik/share/theme/i/broken.gif +0 -0
  58. data/vendor/qwik/share/theme/i/compressed.gif +0 -0
  59. data/vendor/qwik/share/theme/i/external.png +0 -0
  60. data/vendor/qwik/share/theme/i/external_hover.png +0 -0
  61. data/vendor/qwik/share/theme/i/favicon.ico +0 -0
  62. data/vendor/qwik/share/theme/i/favicon.png +0 -0
  63. data/vendor/qwik/share/theme/i/generic.gif +0 -0
  64. data/vendor/qwik/share/theme/i/image2.gif +0 -0
  65. data/vendor/qwik/share/theme/i/login_bg.gif +0 -0
  66. data/vendor/qwik/share/theme/i/login_inputform_bg.gif +0 -0
  67. data/vendor/qwik/share/theme/i/login_inputform_bg_footer.gif +0 -0
  68. data/vendor/qwik/share/theme/i/login_inputform_bg_header.gif +0 -0
  69. data/vendor/qwik/share/theme/i/login_li.gif +0 -0
  70. data/vendor/qwik/share/theme/i/login_qwik_logo.gif +0 -0
  71. data/vendor/qwik/share/theme/i/movie.gif +0 -0
  72. data/vendor/qwik/share/theme/i/new.png +0 -0
  73. data/vendor/qwik/share/theme/i/pdf.gif +0 -0
  74. data/vendor/qwik/share/theme/i/ps.gif +0 -0
  75. data/vendor/qwik/share/theme/i/sound2.gif +0 -0
  76. data/vendor/qwik/share/theme/i/sphere2.gif +0 -0
  77. data/vendor/qwik/share/theme/i/tar.gif +0 -0
  78. data/vendor/qwik/share/theme/i/text.gif +0 -0
  79. data/vendor/qwik/share/theme/js/Makefile +23 -0
  80. data/vendor/qwik/share/theme/js/base.js +176 -0
  81. data/vendor/qwik/share/theme/js/builder.js +101 -0
  82. data/vendor/qwik/share/theme/js/controls.js +750 -0
  83. data/vendor/qwik/share/theme/js/debugwindow-test.html +60 -0
  84. data/vendor/qwik/share/theme/js/debugwindow.html +24 -0
  85. data/vendor/qwik/share/theme/js/debugwindow.js +476 -0
  86. data/vendor/qwik/share/theme/js/dragdrop.js +559 -0
  87. data/vendor/qwik/share/theme/js/effects.js +904 -0
  88. data/vendor/qwik/share/theme/js/event.js +98 -0
  89. data/vendor/qwik/share/theme/js/history.js +110 -0
  90. data/vendor/qwik/share/theme/js/menu.js +27 -0
  91. data/vendor/qwik/share/theme/js/monitor.js +96 -0
  92. data/vendor/qwik/share/theme/js/niftypp.js +272 -0
  93. data/vendor/qwik/share/theme/js/prototype.js +1758 -0
  94. data/vendor/qwik/share/theme/js/scriptaculous.js +48 -0
  95. data/vendor/qwik/share/theme/js/se_hilite_jp.js +234 -0
  96. data/vendor/qwik/share/theme/js/slider.js +275 -0
  97. data/vendor/qwik/share/theme/js/test-all.html +24 -0
  98. data/vendor/qwik/share/theme/js/test-debug.html +56 -0
  99. data/vendor/qwik/share/theme/js/test-wema.html +304 -0
  100. data/vendor/qwik/share/theme/js/test-xp.html +99 -0
  101. data/vendor/qwik/share/theme/js/unittest.js +363 -0
  102. data/vendor/qwik/share/theme/js/watch.js +109 -0
  103. data/vendor/qwik/share/theme/js/wema.js +580 -0
  104. data/vendor/qwik/share/theme/js/wysiwyg.js +143 -0
  105. data/vendor/qwik/share/theme/qwikborder/qwikborder.css +277 -0
  106. data/vendor/qwik/share/theme/qwikborder/qwikborder_ball.png +0 -0
  107. data/vendor/qwik/share/theme/qwikborder/qwikborder_h2.png +0 -0
  108. data/vendor/qwik/share/theme/qwikborder/qwikborder_li.png +0 -0
  109. data/vendor/qwik/share/theme/qwikcyan/qwikcyan.css +216 -0
  110. data/vendor/qwik/share/theme/qwikcyan/qwikcyan_li.png +0 -0
  111. data/vendor/qwik/share/theme/qwikeditor/command.gif +0 -0
  112. data/vendor/qwik/share/theme/qwikeditor/edit_form_bg.jpg +0 -0
  113. data/vendor/qwik/share/theme/qwikeditor/edit_qwik_logo.gif +0 -0
  114. data/vendor/qwik/share/theme/qwikeditor/edit_title_bg.jpg +0 -0
  115. data/vendor/qwik/share/theme/qwikeditor/login_bg.gif +0 -0
  116. data/vendor/qwik/share/theme/qwikeditor/login_qwik_logo.gif +0 -0
  117. data/vendor/qwik/share/theme/qwikeditor/qwikeditor.css +336 -0
  118. data/vendor/qwik/share/theme/qwikeditor/sidebar_bg.gif +0 -0
  119. data/vendor/qwik/share/theme/qwikgreen/qwikgreen.css +306 -0
  120. data/vendor/qwik/share/theme/qwiknotice/qwiknotice.css +246 -0
  121. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_body_bg.gif +0 -0
  122. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg.gif +0 -0
  123. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg_footer.gif +0 -0
  124. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_inputform_bg_header.gif +0 -0
  125. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_li.gif +0 -0
  126. data/vendor/qwik/share/theme/qwiknotice/qwiknotice_qwik_logo.gif +0 -0
  127. data/vendor/qwik/share/theme/qwikplain/command.gif +0 -0
  128. data/vendor/qwik/share/theme/qwikplain/edit_form_bg.jpg +0 -0
  129. data/vendor/qwik/share/theme/qwikplain/edit_qwik_logo.gif +0 -0
  130. data/vendor/qwik/share/theme/qwikplain/edit_title_bg.jpg +0 -0
  131. data/vendor/qwik/share/theme/qwikplain/login_bg.gif +0 -0
  132. data/vendor/qwik/share/theme/qwikplain/login_qwik_logo.gif +0 -0
  133. data/vendor/qwik/share/theme/qwikplain/qwikplain.css +223 -0
  134. data/vendor/qwik/share/theme/qwikplain/sidebar_bg.gif +0 -0
  135. data/vendor/qwik/share/theme/qwikskelton/qwikskelton.css +224 -0
  136. data/vendor/qwik/share/theme/qwiksystem/qwiksystem.css +323 -0
  137. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_bg.png +0 -0
  138. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_header.png +0 -0
  139. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_headerbar.png +0 -0
  140. data/vendor/qwik/share/theme/qwiksystem/qwiksystem_qwikweb.png +0 -0
  141. data/vendor/qwik/share/theme/qwikviridian/qwikviridian.css +413 -0
  142. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_adminmenu_bg.gif +0 -0
  143. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_bg.gif +0 -0
  144. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_bg_shade.gif +0 -0
  145. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_sidebar_a_bg.gif +0 -0
  146. data/vendor/qwik/share/theme/qwikviridian/qwikviridian_siderbar_li_a.gif +0 -0
  147. data/vendor/qwik/share/theme/s5/blue/bluebg.gif +0 -0
  148. data/vendor/qwik/share/theme/s5/blue/bluebottom.gif +0 -0
  149. data/vendor/qwik/share/theme/s5/blue/bluefooter.gif +0 -0
  150. data/vendor/qwik/share/theme/s5/blue/framing.css +25 -0
  151. data/vendor/qwik/share/theme/s5/blue/pretty.css +91 -0
  152. data/vendor/qwik/share/theme/s5/blue/s5-core.css +11 -0
  153. data/vendor/qwik/share/theme/s5/blue/slides.css +3 -0
  154. data/vendor/qwik/share/theme/s5/default/iepngfix.htc +42 -0
  155. data/vendor/qwik/share/theme/s5/default/opera.css +7 -0
  156. data/vendor/qwik/share/theme/s5/default/outline.css +15 -0
  157. data/vendor/qwik/share/theme/s5/default/print.css +24 -0
  158. data/vendor/qwik/share/theme/s5/default/slides.js +558 -0
  159. data/vendor/qwik/share/theme/s5/flower/blume.jpg +0 -0
  160. data/vendor/qwik/share/theme/s5/flower/blumerechts.jpg +0 -0
  161. data/vendor/qwik/share/theme/s5/flower/framing.css +25 -0
  162. data/vendor/qwik/share/theme/s5/flower/pretty.css +83 -0
  163. data/vendor/qwik/share/theme/s5/flower/s5-core.css +11 -0
  164. data/vendor/qwik/share/theme/s5/flower/slides.css +3 -0
  165. data/vendor/qwik/share/theme/s5/i18n/00_head.txt +8 -0
  166. data/vendor/qwik/share/theme/s5/i18n/bg-shade.png +0 -0
  167. data/vendor/qwik/share/theme/s5/i18n/bg-slide.jpg +0 -0
  168. data/vendor/qwik/share/theme/s5/i18n/framing.css +23 -0
  169. data/vendor/qwik/share/theme/s5/i18n/pretty.css +44 -0
  170. data/vendor/qwik/share/theme/s5/i18n/s5-core.css +9 -0
  171. data/vendor/qwik/share/theme/s5/i18n/slides.css +3 -0
  172. data/vendor/qwik/share/theme/s5/pixel/framing.css +25 -0
  173. data/vendor/qwik/share/theme/s5/pixel/pixelbg.gif +0 -0
  174. data/vendor/qwik/share/theme/s5/pixel/pixelheader.jpg +0 -0
  175. data/vendor/qwik/share/theme/s5/pixel/pixelslide0bg.gif +0 -0
  176. data/vendor/qwik/share/theme/s5/pixel/pretty.css +80 -0
  177. data/vendor/qwik/share/theme/s5/pixel/s5-core.css +11 -0
  178. data/vendor/qwik/share/theme/s5/pixel/slides.css +3 -0
  179. data/vendor/qwik/share/theme/s5/qwikblack/framing.css +23 -0
  180. data/vendor/qwik/share/theme/s5/qwikblack/pretty.css +245 -0
  181. data/vendor/qwik/share/theme/s5/qwikblack/s5-core.css +9 -0
  182. data/vendor/qwik/share/theme/s5/qwikblack/slides.css +3 -0
  183. data/vendor/qwik/share/theme/s5/qwikworld/bg-shade.png +0 -0
  184. data/vendor/qwik/share/theme/s5/qwikworld/bg-slide.jpg +0 -0
  185. data/vendor/qwik/share/theme/s5/qwikworld/framing.css +61 -0
  186. data/vendor/qwik/share/theme/s5/qwikworld/pretty.css +250 -0
  187. data/vendor/qwik/share/theme/s5/qwikworld/qwikcyan_li.png +0 -0
  188. data/vendor/qwik/share/theme/s5/qwikworld/s5-core.css +28 -0
  189. data/vendor/qwik/share/theme/s5/qwikworld/slides.css +3 -0
  190. data/vendor/qwik/share/theme/s5/shell/blank.gif +0 -0
  191. data/vendor/qwik/share/theme/s5/shell/bodybg.gif +0 -0
  192. data/vendor/qwik/share/theme/s5/shell/framing.css +23 -0
  193. data/vendor/qwik/share/theme/s5/shell/pretty.css +86 -0
  194. data/vendor/qwik/share/theme/s5/shell/s5-core.css +9 -0
  195. data/vendor/qwik/share/theme/s5/shell/slides.css +3 -0
  196. metadata +190 -1
@@ -0,0 +1,580 @@
1
+ // -*- c++ -*-
2
+ // Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
3
+ // This is free software with ABSOLUTELY NO WARRANTY.
4
+ // You can redistribute it and/or modify it under the terms of the GNU GPL 2.
5
+
6
+ // Thanks to Mr. Kan Fushihara for his first implementation.
7
+
8
+ // ============================== Point class
9
+ function Point(x, y) {
10
+ if (typeof(x) == "number") {
11
+ this.x = x;
12
+ this.y = y;
13
+ return;
14
+ }
15
+ if (typeof(x) == "string") {
16
+ var xx = parseInt(x.replace("px", ""));
17
+ var yy = parseInt(y.replace("px", ""));
18
+ this.x = xx;
19
+ this.y = yy;
20
+ return;
21
+ }
22
+ this.x = 0;
23
+ this.y = 0;
24
+ }
25
+
26
+ Point.prototype = {
27
+ toString : function() {
28
+ return "Point(" + this.x + ", " + this.y + ")";
29
+ },
30
+
31
+ plus : function(b) {
32
+ return new Point(this.x + b.x, this.y + b.y);
33
+ },
34
+
35
+ minus : function(b) {
36
+ return new Point(this.x - b.x, this.y - b.y);
37
+ }
38
+ }
39
+
40
+ // ============================== XP (cross platform) class
41
+ function XP() {
42
+ this.checkBrowser();
43
+ }
44
+
45
+ XP.prototype = {
46
+ // Check browser type. Only for test.
47
+ checkBrowser : function() {
48
+ this.GK = 0;
49
+ this.IE = 0;
50
+ if (document.all) {
51
+ this.IE = 1;
52
+ } else if (document.getElementById) {
53
+ this.GK = 1;
54
+ }
55
+ },
56
+
57
+ ////////////////////////////// get
58
+ getDivList : function() {
59
+ if (document.getElementsByTagName) {
60
+ return document.getElementsByTagName("div");
61
+ }
62
+ return null;
63
+ },
64
+
65
+ getDivListByClass : function(cn) {
66
+ var div = document.getElementsByTagName("div");
67
+ var n = [];
68
+ for (var i=0; i < div.length; i++) {
69
+ if (div[i].className == cn) {
70
+ n.push(div[i]);
71
+ }
72
+ }
73
+ return n;
74
+ },
75
+
76
+ ////////////////////////////// div control methods
77
+ nu_setZIndex : function(e, z) {
78
+ e.style.zIndex = z;
79
+ },
80
+
81
+ getPos : function(o) {
82
+ if (!o) return;
83
+ var s = o.style;
84
+ var l = s.left;
85
+ var t = s.top;
86
+ if (!l || !t || l == "" || t == "") return new Point(0, 0); // no position
87
+ var x = parseInt(l.replace("px", ""));
88
+ var y = parseInt(t.replace("px", ""));
89
+ return new Point(x, y);
90
+ },
91
+
92
+ setPos : function(o, p) {
93
+ if (!o) return;
94
+ o.style.left = p.x+"px";
95
+ o.style.top = p.y+"px";
96
+ },
97
+
98
+ getSize : function(o) {
99
+ return new Point(o.offsetWidth, o.offsetHeight);
100
+ },
101
+
102
+ getCenter : function(o) {
103
+ var p = this.getPos(o);
104
+ var s = this.getSize(o);
105
+ var cx = Math.floor(p.x + s.x / 2);
106
+ var cy = Math.floor(p.y + s.y / 2);
107
+ return new Point(cx, cy);
108
+ },
109
+
110
+ ////////////////////////////// event capture
111
+ setMouseDown : function(e, ev) {
112
+ e.onmousedown = ev;
113
+ },
114
+
115
+ setMouseUpMove : function(e, ev1, ev2) {
116
+ e.onmouseup = ev1;
117
+ e.onmousemove = ev2;
118
+ },
119
+
120
+ ////////////////////////////// get event information
121
+ getOffset : function(e, o) {
122
+ var mp = this.getMousePos(e);
123
+ if (this.GK) {
124
+ var op = this.getPos(o);
125
+ } else { // IE
126
+ var op = new Point(o.style.posLeft, o.style.posTop);
127
+ }
128
+ return mp.minus(op);
129
+ },
130
+
131
+ getMousePos : function(e) {
132
+ if (this.GK) {
133
+ return new Point(e.pageX, e.pageY);
134
+ } else { // IE, window.event is global.
135
+ var x = window.event.clientX + document.body.scrollLeft;
136
+ var y = window.event.clientY + document.body.scrollTop;
137
+ return new Point(x, y);
138
+ }
139
+ },
140
+
141
+ ////////////////////////////// for test
142
+ showAllProperty : function(o) {
143
+ var str = "";
144
+ for (n in o) {
145
+ str += (""+n+" is "+o[n]+"\t");
146
+ }
147
+ alert(str);
148
+ }
149
+ }
150
+
151
+ // ============================== WEMA Editor
152
+ function WemaEditor(env) {
153
+ this.env = env;
154
+ this.xp = this.env.xp;
155
+ this.id = "editor";
156
+ this.win = document.getElementById(this.id);
157
+ this.form = document.getElementById("frm");
158
+ this.hide();
159
+ }
160
+
161
+ WemaEditor.prototype = {
162
+ getMode : function() {
163
+ if (this.win == null) return "hidden";
164
+ return this.win.style.visibility;
165
+ },
166
+
167
+ _show : function() {
168
+ this.env.showWindow("editor");
169
+ },
170
+
171
+ hide : function() {
172
+ this.env.hideWindow("editor");
173
+ },
174
+
175
+ _clear : function() {
176
+ this.form.id.value = ""
177
+ this.form.ln.value = ""
178
+ this.form.body.value = ""
179
+ },
180
+
181
+ _setPos : function(p) {
182
+ var x = p.x;
183
+ var y = p.y;
184
+ if (x<0) x = 0;
185
+ if (y<0) y = 0;
186
+ this.form.l.value = x+"px";
187
+ this.form.t.value = y+"px";
188
+ this.win.style.left = x+"px";
189
+ this.win.style.top = y+"px";
190
+ },
191
+
192
+ _setMousePos : function() {
193
+ this._setPos(this.env.mouse);
194
+ },
195
+
196
+ createNewWema : function() {
197
+ this._clear();
198
+ this._setMousePos();
199
+ this._show();
200
+ },
201
+
202
+ _setWemaPosition : function(id) {
203
+ var w = this.env.wemas.get(id);
204
+ if (!w) return; // get from wema
205
+ this._setPos(w.getPos());
206
+ },
207
+
208
+ setPos : function(id) {
209
+ this._setWemaPosition(id);
210
+ this.form.id.value = id;
211
+ this.form.mode.value = "setpos";
212
+ this.form.submit();
213
+ },
214
+
215
+ _setWemaValue : function(id) {
216
+ var w = this.env.wemas.get(id);
217
+ if (!w) return; // get from wema
218
+ this.form.body.value = w.text;
219
+ this.form.ln.value = w.lineid;
220
+ this.form.tc.value = w.color;
221
+ this.form.bg.value = w.background;
222
+ },
223
+
224
+ editWema : function(id) {
225
+ this._setWemaPosition(id);
226
+ this.form.id.value = id;
227
+ this.form.mode.value = "edit";
228
+ this._setWemaValue(id);
229
+ this._show();
230
+ },
231
+
232
+ createNewLinkedWema : function(id) {
233
+ this.createNewWema();
234
+ this._setWemaPosition(id);
235
+ this.form.ln.value = id;
236
+ },
237
+
238
+ setColor : function(id, color) {
239
+ var o = document.getElementById(id);
240
+ if (!o) return;
241
+ o.value = color;
242
+ }
243
+ }
244
+
245
+ // ============================== WEMA Line
246
+ function WemaLine(wema) {
247
+ this.wema = wema;
248
+ this.xp = this.wema.xp;
249
+ this.lineColor = "#000";
250
+ this.divmode = 1;
251
+ if (this.xp.IE) this.divmode = false;
252
+ }
253
+
254
+ WemaLine.prototype = {
255
+ toString : function() {
256
+ return "<WemaLine("+this.wema.id+")>";
257
+ },
258
+
259
+ create : function() {
260
+ if (this.divmode) {
261
+ this._createDiv();
262
+ } else {
263
+ this._createVml();
264
+ }
265
+ },
266
+
267
+ _createDiv : function() {
268
+ this.obj = document.createElement("div");
269
+ document.body.appendChild(this.obj);
270
+ this.obj.className = "wema_line";
271
+ this.line1 = document.createElement("div");
272
+ this.line2 = document.createElement("div");
273
+ this.obj.appendChild(this.line1);
274
+ this.obj.appendChild(this.line2);
275
+ },
276
+
277
+ _createVml : function() {
278
+ this.vline = document.createElement("v:line");
279
+ this.vline.id = this.wema.id+"vl";
280
+ document.body.appendChild(this.vline);
281
+ var o = this.vline;
282
+ o.style.visibility = "hidden";
283
+ o.setAttribute("strokeweight", "1");
284
+ o.setAttribute("strokecolor", "#000");
285
+ o.style.position = "absolute";
286
+ o.style.left = "0px";
287
+ o.style.top = "0px";
288
+ },
289
+
290
+ hide : function() {
291
+ if (this.divmode) {
292
+ this.line1.style.visibility = "hidden";
293
+ this.line2.style.visibility = "hidden";
294
+ } else {
295
+ this.vline.style.visibility = "hidden";
296
+ }
297
+ },
298
+
299
+ draw : function(to) {
300
+ var from = this.wema.id;
301
+ //var f = this.xp.getById(from);
302
+ var f = document.getElementById(from);
303
+ if (!f) return;
304
+ var t = document.getElementById(to);
305
+ if (!t) return;
306
+ var p1 = this.xp.getCenter(f);
307
+ var p2 = this.xp.getCenter(t);
308
+ if (this.divmode) {
309
+ this._relocateDiv(this.line1, p1.x, p1.y, p1.x, p2.y);
310
+ this._relocateDiv(this.line2, p1.x, p2.y, p2.x, p2.y);
311
+ } else {
312
+ this._relocateVml(p1, p2);
313
+ }
314
+ },
315
+
316
+ _relocateDiv : function(o, x1, y1, x2, y2) {
317
+ var s = o.style;
318
+ s.visibility = "visible";
319
+ s.backgroundColor = this.lineColor;
320
+ s.position = "absolute";
321
+ s.overflow = "hidden";
322
+ s.left = Math.min(x1,x2)+"px";
323
+ s.top = Math.min(y1,y2)+"px";
324
+ s.width = Math.abs(x2-x1+1)+"px";
325
+ s.height = Math.abs(y2-y1+1)+"px";
326
+ s.zIndex = "0";
327
+ },
328
+
329
+ _relocateVml : function(p1, p2) {
330
+ var o = this.vline;
331
+ o.style.visibility = "hidden";
332
+ o.setAttribute("from", ""+p1.x+","+p1.y);
333
+ o.setAttribute("to", ""+p2.x+","+p2.y);
334
+ o.style.visibility = "visible";
335
+ }
336
+ }
337
+
338
+ // ============================== WEMA
339
+ function Wema(wemas, id) {
340
+ this.wemas = wemas;
341
+ this.xp = this.wemas.xp;
342
+ this.id = id;
343
+ this.obj = document.getElementById(this.id);
344
+ this._getAttr();
345
+ }
346
+
347
+ Wema.prototype = {
348
+ _getAttr : function() {
349
+ this.text = this.obj.getAttribute("wema_d");
350
+ this.lineid = this.obj.getAttribute("wema_ln");
351
+ this.color = this.obj.getAttribute("wema_tc");
352
+ this.background = this.obj.getAttribute("wema_bg");
353
+ },
354
+
355
+ toString : function() {
356
+ return "<Wema("+this.id+")>";
357
+ },
358
+
359
+ setPos : function(p) {
360
+ this.xp.setPos(this.obj, p);
361
+ },
362
+
363
+ getPos : function() {
364
+ return new Point(this.obj.style.left, this.obj.style.top);
365
+ },
366
+
367
+ setZIndex : function(z) {
368
+ this.obj.style.zIndex = z;
369
+ },
370
+
371
+ getZIndex : function(z) {
372
+ return parseInt(this.obj.style.zIndex);
373
+ },
374
+
375
+ createLine : function() {
376
+ this.line = new WemaLine(this);
377
+ this.line.create();
378
+ },
379
+
380
+ drawLine : function() {
381
+ var to = this.lineid;
382
+ if (!to || to == "") {
383
+ this.line.hide();
384
+ return;
385
+ }
386
+ this.line.draw(to);
387
+ }
388
+ }
389
+
390
+ // ============================== WEMA Set
391
+ function WemaSet(env) {
392
+ this.env = env;
393
+ this.xp = env.xp;
394
+ this.wlist = this._getWemaList();
395
+ this.clearDragging();
396
+ }
397
+ WemaSet.prototype = {
398
+ get : function(id) {
399
+ return this.wlist[id];
400
+ },
401
+
402
+ clearDragging : function() {
403
+ this.dragging = null;
404
+ },
405
+
406
+ getCurDragging : function() {
407
+ return this.dragging; // current dragging wema object
408
+ },
409
+
410
+ startDragging : function(id) {
411
+ this.dragging = this.get(id);
412
+ },
413
+
414
+ _getWemaList : function() {
415
+ var wlist = this.xp.getDivListByClass("wema")
416
+ var h = {}; // Hash
417
+ for (var i=0; i < wlist.length; i++) {
418
+ var id = wlist[i].id;
419
+ if (id) {
420
+ h[id] = new Wema(this, id); // set to Hash
421
+ }
422
+ }
423
+ return h;
424
+ },
425
+
426
+ setZIndex : function(z) {
427
+ for (id in this.wlist) {
428
+ this.wlist[id].setZIndex(z);
429
+ }
430
+ },
431
+
432
+ setMouseEvent : function() { // no test yet
433
+ var ar = this.xp.getDivListByClass("menubar");
434
+ for (var i=0; i < ar.length; i++) {
435
+ this.xp.setMouseDown(ar[i], wema_mouse_down);
436
+ }
437
+ this.xp.setMouseUpMove(document, wema_mouse_up, wema_mouse_move);
438
+ },
439
+
440
+ createLines : function() {
441
+ for (id in this.wlist)
442
+ this.wlist[id].createLine();
443
+ },
444
+
445
+ drawLines : function() {
446
+ for (id in this.wlist)
447
+ this.wlist[id].drawLine();
448
+ }
449
+ }
450
+
451
+ // ============================== WEMA Environment
452
+ function WemaEnvironment(xp) {
453
+ this.xp = xp;
454
+ this.wemas = null;
455
+ this.editor = null;
456
+ this.offset = new Point(0, 0);
457
+ this.mouse = new Point(0, 0);
458
+ }
459
+ WemaEnvironment.prototype = {
460
+ init : function() { // called from onLoad event
461
+ this.wemas = new WemaSet(this);
462
+ this.editor = new WemaEditor(this);
463
+
464
+ this.wemas.setMouseEvent();
465
+ this.wemas.createLines();
466
+ this.wemas.drawLines();
467
+
468
+ var bodys = document.getElementsByTagName("body");
469
+ var body = bodys.firstChild;
470
+ if (!body) return;
471
+ return body.setAttribute("ondblclick", "wema_dblClick;");
472
+ },
473
+
474
+ mouseDown : function(e, o) {
475
+ while(1) {
476
+ if (o.className == "wema") break;
477
+ o = o.parentNode; // DOM
478
+ if (!o) return;
479
+ }
480
+
481
+ if (this.editor.getMode() == "visible") {
482
+ if (o.id != "editor") return;
483
+ } else { // wema mode
484
+ if (o.id == "editor") return;
485
+ }
486
+
487
+ this.offset = this.xp.getOffset(e, o);
488
+ this.wemas.startDragging(o.id);
489
+ this.wemas.setZIndex(1);
490
+ this.wemas.getCurDragging().setZIndex(2);
491
+ return false;
492
+ },
493
+
494
+ setCurMousePos : function(e) {
495
+ this.mouse = this.xp.getMousePos(e);
496
+ },
497
+
498
+ mouseMove : function(e) {
499
+ var w = this.wemas.getCurDragging();
500
+ if (!w) return;
501
+ this.setCurMousePos(e);
502
+ var p = this.mouse.minus(this.offset);
503
+ w.setPos(p);
504
+ this.wemas.drawLines();
505
+ if (typeof qwik_onmousemove != 'undefined') {
506
+ qwik_onmousemove(p);
507
+ }
508
+ return false;
509
+ },
510
+
511
+ mouseUp : function(e) {
512
+ this.wemas.clearDragging();
513
+ },
514
+
515
+ dblClick : function(e) {
516
+ if (this.editor.getMode() != "visible") {
517
+ this.setCurMousePos(e);
518
+ this.editor.createNewWema();
519
+ }
520
+ },
521
+
522
+ showHelp : function() {
523
+ this.showWindow("help");
524
+ },
525
+
526
+ hideHelp : function() {
527
+ this.hideWindow("help");
528
+ },
529
+
530
+ showWindow : function(id) {
531
+ var o = document.getElementById(id);
532
+ if (!o) return;
533
+ o.style.visibility = "visible";
534
+ o.style.zIndex = 2;
535
+ this.wemas.clearDragging();
536
+ },
537
+
538
+ hideWindow : function(id) {
539
+ var o = document.getElementById(id);
540
+ if (!o) return;
541
+ o.style.visibility = "hidden";
542
+ o.style.zIndex = 0;
543
+ this.wemas.clearDragging();
544
+ }
545
+ }
546
+
547
+ // ============================== WemaHelp
548
+ function wema_create_help_window() {
549
+ var str = '<div id="help" class="wema"><div class="menubar"><span class="handle">help</span><span class="close"><a href="javascript:wema_help_hide()">X</a></span></div><div class="cont"><h2>�tⳋ@�\�w���v</h2><h3>���j���[</h3><table><tr><td>new</td><td>�V�K�tⳂ��쐬</td></tr><tr><td>help</td><td>���̃E�B���h�E��\��</td></tr></table><p>�E��́~���N���b�N���ĕ‚��܂�</p><h3>�tⳃR���g���[��</h3><table><tr><td>set</td><td>�tⳂ���ʏ�œ������Ă���<br/>�uset�v�������āC���̏ꏊ�ɌŒ�</td></tr><tr><td>edit</td><td>�tⳂ̓��e��ҏW</td></tr><tr><td>link</td><td>���̕tⳂɐ��Ōq�������V�K�tⳂ��쐬</td></tr></table><h3>�ҏW���</h3><p>�e�L�X�g�G���A�ɕtⳂ̕��������͂��C<br/>�u�������݁v�{�^���������Ă��������D</p><p>�tⳂ���������ɂ́C�e�L�X�g�G���A��<br/>�S���������Ă���ۑ����Ă��������D</p></div></div>';
550
+ document.write(str);
551
+ }
552
+
553
+ // ============================== global
554
+ g_xp = new XP(); // global XP, used from test case
555
+ g_env = new WemaEnvironment(g_xp); // global Wema Environment
556
+
557
+ function wema_init() {
558
+ g_env.init();
559
+ }
560
+
561
+ //onload = wema_init;
562
+ function wema_mouse_down(e) { return g_env.mouseDown(e, this); }
563
+ function wema_mouse_move(e) { return g_env.mouseMove(e); }
564
+ function wema_mouse_up(e) { return g_env.mouseUp(e); }
565
+ function wema_setpos(a) { g_env.editor.setPos(a); }
566
+ function wema_edit(a) { g_env.editor.editWema(a); }
567
+ function wema_link(a) { g_env.editor.createNewLinkedWema(a); }
568
+ function wema_set_color(a,b){ g_env.editor.setColor(a, b); }
569
+ function wema_editor_show() { g_env.editor.createNewWema();}
570
+ function wema_editor_hide() { g_env.editor.hide(); }
571
+ function wema_dblClick(e) { g_env.dblClick(e);}
572
+
573
+ ondblclick = wema_dblClick;
574
+ function wema_help_show() { g_env.showHelp(); }
575
+ function wema_help_hide() { g_env.hideHelp(); }
576
+
577
+ //wema_init();
578
+ //wema_create_help_window();
579
+
580
+ // end
@@ -0,0 +1,143 @@
1
+ // -*- c++ -*-
2
+ //
3
+ // Copyright (C) 2003-2005 Kouichirou Eto
4
+ // All rights reserved.
5
+ // This is free software with ABSOLUTELY NO WARRANTY.
6
+ //
7
+ // You can redistribute it and/or modify it under the terms of
8
+ // the GNU General Public License version 2.
9
+ //
10
+
11
+ // reference: http://nais.to/~yto/tools/contenteditablewiki/
12
+
13
+ // ============================== xmlhttp
14
+ function createXmlHttp() {
15
+ var x;
16
+ try {
17
+ return new ActiveXObject("Msxml2.XMLHTTP");
18
+ } catch (e) {
19
+ try {
20
+ return new ActiveXObject("Microsoft.XMLHTTP");
21
+ } catch (E) {
22
+ try {
23
+ if (typeof XMLHttpRequest != 'undefined') {
24
+ return new XMLHttpRequest();
25
+ }
26
+ } catch (E) {
27
+ return false;
28
+ }
29
+ }
30
+ }
31
+ return false;
32
+ }
33
+
34
+ // ==================== class
35
+ function WEditor() {
36
+ }
37
+
38
+ WEditor.prototype = {
39
+ init : function(pagename, ext) {
40
+ this.pagename = pagename;
41
+ this.ext = ext;
42
+
43
+ this.wtext = document.getElementById("wtext");
44
+ this.weditor = document.getElementById("weditor");
45
+ this.wform = document.getElementById("wform");
46
+
47
+ this.initial_content = this.weditor.innerHTML;
48
+
49
+ this.alerted = null;
50
+
51
+ this.count = 0
52
+ this.count_start_content = null;
53
+
54
+ this.xmlhttp = null;
55
+ },
56
+
57
+ check : function() {
58
+ if (typeof(this.pagename) == "undef") return;
59
+
60
+ var interval = 1000;
61
+
62
+ var cur_content = this.weditor.innerHTML;
63
+
64
+ if (cur_content != this.initial_content) {
65
+ if (this.count == 0) {
66
+ this.count_start_content = cur_content;
67
+ }
68
+ this.count += 1;
69
+
70
+ if (this.count_start_content != cur_content) {
71
+ this.count = 0;
72
+ }
73
+
74
+ if (3 < this.count) {
75
+ if (! this.alerted) {
76
+ //alert("Do save!");
77
+ this.alerted = true;
78
+ }
79
+ }
80
+ }
81
+
82
+ setTimeout('g_weditor.check();', interval);
83
+ },
84
+
85
+ save : function() {
86
+ this.wtext.value = this.weditor.innerHTML;
87
+ this.wform.submit();
88
+
89
+ var xh = createXmlHttp();
90
+ this.xmlhttp = xh;
91
+
92
+ var url = this.pagename+".wysiwyg";
93
+
94
+ xh.open("POST", url, true);
95
+ xh.onreadystatechange = function() {
96
+ if (xh.readyState == 4 && xh.status == 200) {
97
+ var new_md5 = xh.responseText;
98
+ if (new_md5 != cur_md5) {
99
+ div.innerHTML = update_html;
100
+ } else {
101
+ setTimeout('g_watcher_env.start();', interval);
102
+ }
103
+ }
104
+ }
105
+ xh.send(null);
106
+
107
+ }
108
+
109
+ }
110
+
111
+ var g_weditor;
112
+ if (typeof g_weditor == 'undefined') {
113
+ g_weditor = new WEditor();
114
+ }
115
+
116
+ // ==================== function
117
+ function wysiwyg_save() {
118
+ var wtext = document.getElementById("wtext");
119
+ var weditor = document.getElementById("weditor");
120
+ var wform = document.getElementById("wform");
121
+ wtext.value = weditor.innerHTML;
122
+ wform.submit();
123
+ }
124
+
125
+ function wysiwyg_command(com) {
126
+ document.execCommand(com);
127
+ }
128
+
129
+ function wysiwyg_markup(tag) {
130
+ var range = document.selection.createRange();
131
+ range.pasteHTML("<"+tag+">"+range.text+"</"+tag+">");
132
+ }
133
+
134
+ function wysiwyg_image() {
135
+ document.execCommand("InsertImage", true);
136
+ }
137
+
138
+ function wysiwyg_deleteTags() {
139
+ var range = document.selection.createRange();
140
+ range.pasteHTML(range.text.replace("<[^>]+>", " "));
141
+ }
142
+
143
+ /* end */