Commit 3077122ca885f04b7515e125124c2114e1c46bd1
- Diff rendering mode:
- inline
- side by side
server/alipi.py
(16 / 16)
  | |||
49 | 49 | script_edit = root.makeelement('script') | |
50 | 50 | root.body.append(script_test) | |
51 | 51 | root.body.append(script_edit) | |
52 | script_test.set("src", "http://localhost:60/alipi/server/ui.js") | ||
52 | script_test.set("src", "http://localhost/Github/alipi/server/ui.js") | ||
53 | 53 | script_test.set("type", "text/javascript") | |
54 | script_edit.set("src", "http://localhost:60/alipi/server/wsgi/pageEditor.js") | ||
54 | script_edit.set("src", "http://localhost/Github/alipi/server/wsgi/pageEditor.js") | ||
55 | 55 | script_edit.set("type","text/javascript") | |
56 | 56 | ||
57 | 57 | script_jq_mini = root.makeelement('script') | |
… | … | ||
63 | 63 | root.body.append(style) | |
64 | 64 | style.set("rel","stylesheet") | |
65 | 65 | style.set("type", "text/css") | |
66 | style.set("href", "http://localhost:60/alipi/server/stylesheet.css") | ||
66 | style.set("href", "http://localhost/Github/alipi/server/stylesheet.css") | ||
67 | 67 | ||
68 | 68 | jit_script = root.makeelement('script') | |
69 | 69 | root.body.append(jit_script) | |
70 | jit_script.set("src", "http://localhost:60/alipi/server/jit.js") | ||
70 | jit_script.set("src", "http://localhost/Github/alipi/server/jit.js") | ||
71 | 71 | jit_script.set("type", "text/javascript") | |
72 | 72 | ||
73 | 73 | tree_script = root.makeelement('script') | |
74 | 74 | root.body.append(tree_script) | |
75 | tree_script.set("src", "http://localhost:60/alipi/server/tree.js") | ||
75 | tree_script.set("src", "http://localhost/Github/alipi/server/tree.js") | ||
76 | 76 | tree_script.set("type", "text/javascript") | |
77 | 77 | ||
78 | 78 | script_jq_cust = root.makeelement('script') | |
… | … | ||
101 | 101 | script_jq_mini.set("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js") | |
102 | 102 | script_jq_mini.set("type", "text/javascript") | |
103 | 103 | ||
104 | script_test.set("src", "http://localhost:60/alipi/server/ui.js") | ||
104 | script_test.set("src", "http://localhost/Github/alipi/server/ui.js") | ||
105 | 105 | script_test.set("type", "text/javascript") | |
106 | script_edit.set("src", "http://localhost:60/alipi/server/wsgi/page_edit.js") | ||
106 | script_edit.set("src", "http://localhost/Github/alipi/server/wsgi/page_edit.js") | ||
107 | 107 | script_edit.set("type","text/javascript") | |
108 | 108 | script_jqui = root.makeelement('script') | |
109 | 109 | script_jqui.set("type","text/javascript") | |
… | … | ||
180 | 180 | d['lang'] = request.args['lang'] | |
181 | 181 | script_test = root.makeelement('script') | |
182 | 182 | root.body.append(script_test) | |
183 | script_test.set("src", "http://localhost:60/alipi/server/ui.js") | ||
183 | script_test.set("src", "http://localhost/Github/alipi/server/ui.js") | ||
184 | 184 | script_test.set("type", "text/javascript") | |
185 | 185 | root.body.set("onload","a11ypi.ren()"); | |
186 | 186 | root.make_links_absolute(d['foruri'], resolve_base_href = True) | |
… | … | ||
190 | 190 | script_jqui = root.makeelement('script') | |
191 | 191 | ||
192 | 192 | script_test = root.makeelement('script') | |
193 | script_test.set("src", "http://localhost:60/alipi/server/ui.js") | ||
193 | script_test.set("src", "http://localhost/Github/alipi/server/ui.js") | ||
194 | 194 | script_test.set("type", "text/javascript") | |
195 | 195 | root.body.append(script_test) | |
196 | 196 | ||
… | … | ||
200 | 200 | root.body.append(script_jq_mini) | |
201 | 201 | ||
202 | 202 | script_edit = root.makeelement('script') | |
203 | script_edit.set("src", "http://localhost:60/alipi/server/wsgi/page_edit.js") | ||
203 | script_edit.set("src", "http://localhost/Github/alipi/server/wsgi/page_edit.js") | ||
204 | 204 | script_edit.set("type","text/javascript") | |
205 | 205 | root.body.append(script_edit) | |
206 | 206 | ||
… | … | ||
231 | 231 | tweet.set("class", "twitter-share-button") | |
232 | 232 | tweet.set("data-via", "a11ypi") | |
233 | 233 | tweet.set("data-lang", "en") | |
234 | tweet.set("data-url", "http://localhost:60/alipi/web?foruri={0}&lang={1}&interactive=1".format(quote_plus(d['foruri']),request.args['lang'])) | ||
234 | tweet.set("data-url", "http://localhost/Github/alipi/web?foruri={0}&lang={1}&interactive=1".format(quote_plus(d['foruri']),request.args['lang'])) | ||
235 | 235 | tweet.textContent = "Tweet" | |
236 | 236 | ren_overlay.append(tweet) | |
237 | 237 | ||
… | … | ||
241 | 241 | ||
242 | 242 | fblike = root.makeelement("div") | |
243 | 243 | fblike.set("class", "fb-like") | |
244 | fblike.set("data-href", "http://localhost:60/alipi/web?foruri={0}&lang={1}&interactive=1".format(quote_plus(d['foruri']),request.args['lang'])) | ||
244 | fblike.set("data-href", "http://localhost/Github/alipi/web?foruri={0}&lang={1}&interactive=1".format(quote_plus(d['foruri']),request.args['lang'])) | ||
245 | 245 | fblike.set("data-send", "true") | |
246 | 246 | fblike.set("data-layout", "button_count") | |
247 | 247 | fblike.set("data-width", "50") | |
… | … | ||
254 | 254 | root.body.append(style) | |
255 | 255 | style.set("rel","stylesheet") | |
256 | 256 | style.set("type", "text/css") | |
257 | style.set("href", "http://localhost:60/alipi/server/stylesheet.css") | ||
257 | style.set("href", "http://localhost/Github/alipi/server/stylesheet.css") | ||
258 | 258 | ||
259 | 259 | overlay2 = root.makeelement('div') | |
260 | 260 | root.body.append(overlay2) | |
… | … | ||
269 | 269 | ||
270 | 270 | script_test = root.makeelement('script') | |
271 | 271 | root.body.append(script_test) | |
272 | script_test.set("src", "http://localhost:60/alipi/server/ui.js") | ||
272 | script_test.set("src", "http://localhost/Github/alipi/server/ui.js") | ||
273 | 273 | script_test.set("type", "text/javascript") | |
274 | 274 | root.body.set("onload","a11ypi.filter(); a11ypi.tweet(); a11ypi.facebook();"); | |
275 | 275 | root.make_links_absolute(d['foruri'], resolve_base_href = True) | |
… | … | ||
278 | 278 | elif request.args.has_key('interactive') == False and request.args.has_key('blog') == True: | |
279 | 279 | script_test = root.makeelement('script') | |
280 | 280 | root.body.append(script_test) | |
281 | script_test.set("src", "http://localhost:60/alipi/server/ui.js") | ||
281 | script_test.set("src", "http://localhost/Github/alipi/server/ui.js") | ||
282 | 282 | script_test.set("type", "text/javascript") | |
283 | 283 | ||
284 | 284 | script_jq_mini = root.makeelement('script') | |
… | … | ||
301 | 301 | root.body.append(style) | |
302 | 302 | style.set("rel","stylesheet") | |
303 | 303 | style.set("type", "text/css") | |
304 | style.set("href", "http://localhost:60/alipi/server/stylesheet.css") | ||
304 | style.set("href", "http://localhost/Github/alipi/server/stylesheet.css") | ||
305 | 305 | ||
306 | 306 | collection = g.db['post'] | |
307 | 307 | if collection.find_one({"about" : request.args['foruri']}) is not None: |
server/stylesheet.css
(116 / 45)
  | |||
69 | 69 | } | |
70 | 70 | ||
71 | 71 | #editoroverlay { | |
72 | display: none; | ||
72 | display: none; | ||
73 | 73 | } | |
74 | 74 | #editoroverlay label { | |
75 | position: absolute; | ||
76 | top: 5%; | ||
77 | color: #000; | ||
78 | font-size: 25px; | ||
75 | position: absolute; | ||
76 | top: 5%; | ||
77 | color: #000; | ||
78 | font-size: 25px; | ||
79 | 79 | } | |
80 | 80 | ||
81 | 81 | #reference { | |
82 | position: absolute; | ||
83 | top: 15%; | ||
84 | left:4%; | ||
85 | min-width:450px; | ||
86 | max-width:450px; | ||
87 | min-height:370px; | ||
88 | max-height:370px; | ||
89 | text-align:justify; | ||
90 | color:#000; | ||
91 | font-weight:normal; | ||
82 | position: absolute; | ||
83 | top: 15%; | ||
84 | left:4%; | ||
85 | min-width:450px; | ||
86 | max-width:450px; | ||
87 | min-height:370px; | ||
88 | max-height:370px; | ||
89 | text-align:justify; | ||
90 | color:#000; | ||
91 | font-weight:normal; | ||
92 | 92 | } | |
93 | 93 | #editor { | |
94 | position:absolute; | ||
95 | top:15%; | ||
96 | left:51%; | ||
97 | min-width:450px; | ||
98 | max-width:450px; | ||
99 | min-height:370px; | ||
100 | max-height:370px; | ||
101 | font-size:15; | ||
102 | text-align:justify; | ||
103 | color:#000; | ||
104 | font-weight:normal; | ||
94 | position:absolute; | ||
95 | top:15%; | ||
96 | left:51%; | ||
97 | min-width:450px; | ||
98 | max-width:450px; | ||
99 | min-height:370px; | ||
100 | max-height:370px; | ||
101 | font-size:15; | ||
102 | text-align:justify; | ||
103 | color:#000; | ||
104 | font-weight:normal; | ||
105 | 105 | } | |
106 | 106 | #forprevData { | |
107 | display:none; | ||
108 | height:1px; | ||
109 | width:1px; | ||
107 | display:none; | ||
108 | height:1px; | ||
109 | width:1px; | ||
110 | 110 | } | |
111 | 111 | ||
112 | 112 | #renarrated_overlay { | |
113 | position:fixed; | ||
114 | top:0; | ||
115 | width:80%; | ||
116 | align:center; | ||
117 | text-align:center; | ||
118 | left:10%; | ||
119 | z-index:2147483645; | ||
113 | position:fixed; | ||
114 | top:0; | ||
115 | width:80%; | ||
116 | align:center; | ||
117 | text-align:center; | ||
118 | left:10%; | ||
119 | z-index:2147483645; | ||
120 | 120 | } | |
121 | 121 | ||
122 | #icon_on_overlay { | ||
123 | display:none; | ||
124 | position:fixed; | ||
125 | top:0; | ||
126 | width:5%; | ||
127 | height:5%; | ||
128 | /* align:center; */ | ||
129 | text-align:center; | ||
130 | left:1%; | ||
131 | z-index:2147483645; | ||
132 | } | ||
133 | |||
122 | 134 | #pub_overlay { | |
123 | display:none; | ||
124 | position:fixed; | ||
125 | top:0; | ||
126 | width:80%; | ||
127 | align:center; | ||
128 | text-align:center; | ||
129 | left:10%; | ||
130 | z-index:2147483645; | ||
135 | display:none; | ||
136 | position:fixed; | ||
137 | top:0; | ||
138 | width:40%; | ||
139 | /* align:center; */ | ||
140 | text-align:center; | ||
141 | left:12%; | ||
142 | z-index:2147483645; | ||
131 | 143 | } | |
132 | 144 | ||
145 | #element_edit_overlay { | ||
146 | display:none; | ||
147 | position:fixed; | ||
148 | top:0; | ||
149 | width:40%; | ||
150 | /* align:center; */ | ||
151 | text-align:center; | ||
152 | right:05%; | ||
153 | z-index:2147483645; | ||
154 | } | ||
155 | |||
133 | 156 | #blog-filter { | |
134 | min-width:200px;max-width:200px; | ||
157 | min-width:200px;max-width:200px; | ||
158 | } | ||
159 | |||
160 | #infovis { | ||
161 | position:relative; | ||
162 | top:6%; | ||
163 | left:0%; | ||
164 | width:60%; | ||
165 | height:90%; | ||
166 | overflow:hidden; | ||
167 | } | ||
168 | |||
169 | #infonar { | ||
170 | position:relative; | ||
171 | top:2%; | ||
172 | left:0; | ||
173 | width:35%; | ||
174 | height:90%; | ||
175 | overflow:show; | ||
176 | /* color:#000; */ | ||
177 | /* background-color: rgba(0,0,0,0.5); */ | ||
178 | } | ||
179 | |||
180 | #narrations-div { | ||
181 | position:fixed; | ||
182 | top:5%; | ||
183 | bottom:2% | ||
184 | right:0.1%; | ||
185 | width:30%; | ||
186 | height:93%; | ||
187 | overflow:show; | ||
188 | background-color: rgba(0,0,0,0.5); | ||
189 | z-index:999999999; | ||
190 | } | ||
191 | /*TOOLTIPS*/ | ||
192 | .tip { | ||
193 | color: #fff; | ||
194 | width: 140px; | ||
195 | background-color: rgba(0,0,0,1); | ||
196 | border:1px solid #ccc; | ||
197 | -moz-box-shadow:#555 2px 2px 8px; | ||
198 | -webkit-box-shadow:#555 2px 2px 8px; | ||
199 | -o-box-shadow:#555 2px 2px 8px; | ||
200 | box-shadow:#555 2px 2px 8px; | ||
201 | opacity:1; | ||
202 | /* filter:alpha(opacity=90); */ | ||
203 | font-size:12px; | ||
204 | font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; | ||
205 | padding:7px; | ||
135 | 206 | } |
server/ui.js
(246 / 166)
  | |||
353 | 353 | }, | |
354 | 354 | loadOverlay: function() | |
355 | 355 | { | |
356 | var icon_template = '<div id="icon_on_overlay" class="ui-widget-header ui-corner-all" '+ | ||
357 | 'onClick="a11ypi.hide_overlays();"> <input type="image" <img style="width:100%;height:100%;" '+ | ||
358 | 'src="http://y.a11y.in/alipi.gif" /></input></div>'; | ||
359 | |||
356 | 360 | var overlay_template = '<div id="renarrated_overlay" class="ui-widget-header ui-corner-all">'+ | |
357 | 361 | '<input id="edit-current" type="submit" onclick="a11ypi.editPage();" value="Renarrate this page">'+ | |
358 | 362 | '<input id="see-narration" type="submit" onclick="a11ypi.showBox();" value="See Narrations">'+ | |
… | … | ||
366 | 366 | '</div><div id="show-box"></div><div id="show-links"></div>'; | |
367 | 367 | ||
368 | 368 | var pub_overlay_template = '<div id="pub_overlay" class="ui-widget-header ui-corner-all">'+ | |
369 | '<input id="back" type="submit" onclick="a11ypi.back;" value="Back">'+ | ||
369 | '<input id="exit-mode" type="submit" onclick="a11ypi.exitMode();" value="EXIT">'+ | ||
370 | 370 | '<input id="edit-current" type="submit" onclick="a11ypi.help_window();" value="Help">'+ | |
371 | '<input id="see-narration" type="submit" onclick="a11ypi.showBox();" value="Undo">'+ | ||
371 | '<input id="see-narration" type="submit" onclick="a11ypi." value="Undo">'+ | ||
372 | 372 | '<input id="see-links" type="submit" onclick="a11ypi.publish();" value="Publish">'; | |
373 | |||
373 | |||
374 | var element_edit_overlay_template = '<div id="element_edit_overlay" class="ui-widget-header ui-corner-all">'+ | ||
375 | '<input id="edit-text" type="submit" onclick="a11ypi.displayEditor();" value="Edit Text" disabled=true>'+ | ||
376 | '<input id="add-audio" type="submit" onclick="a11ypi.help_window();" value="Add Audio" disabled=true>'+ | ||
377 | '<input id="add-link" type="submit" onclick="a11ypi.showBox();" value="Add Link" disabled=true>'+ | ||
378 | '<input id="replace-image" type="submit" onclick="a11ypi.imageReplacer();" value="Replace Image" disabled=true>'; | ||
379 | |||
380 | $('body').append(icon_template); | ||
374 | 381 | $('body').append(overlay_template); | |
375 | 382 | $('body').append(pub_overlay_template); | |
383 | $('body').append(element_edit_overlay_template); | ||
376 | 384 | a11ypi.ajax(); | |
377 | 385 | a11ypi.ajaxLinks1(); | |
378 | 386 | go.disabled = true; | |
… | … | ||
391 | 391 | '<label id="txtlab" style="color:#000;font-weight:normal;">TEXT :- It will popup a window and allow you to'+ | |
392 | 392 | 'modify/replace text of select element on editor(right) box.'+ | |
393 | 393 | '<p>To delete - Empty the editor(right) box and press "OK".'+ | |
394 | '</p><p style="margin-left:50px";>See narrations - If the selected element has other narrations then it will list, on click.'+ | ||
395 | '</p><p style="margin-left:50px";>Audio - It allows you to enter audio URL.</p>'+ | ||
394 | '</p><p style="margin-left:50px";>See narrations - If the selected element has other narrations '+ | ||
395 | 'then it will list, on click.</p><p style="margin-left:50px";>Audio - It allows you to enter audio URL.</p>'+ | ||
396 | 396 | 'IMAGE:- <p style="margin-left:50px";> Replace - It allows you to enter image URL.'+ | |
397 | '</p><p style="margin-left:50px";> See narrations - If the selected element has other image narration then it will show, on click.</p>'+ | ||
398 | 'UNDO:- Use it when you want to revert back to previous change.<p style="margin-left:50px";>'+ | ||
399 | 'Revert deleted - Press \'Undo\' button twice. </p>'+ | ||
397 | '</p><p style="margin-left:50px";> See narrations - If the selected element has other '+ | ||
398 | 'image narration then it will show, on click.</p> UNDO:- Use it when you want to revert back to '+ | ||
399 | 'previous change.<p style="margin-left:50px";> Revert deleted - Press \'Undo\' button twice. </p>'+ | ||
400 | 400 | 'PUBLISH:- To publish your crafted changes to database and blog (our/your).'+ | |
401 | 401 | '<p style="margin-left:50px";>States - To the place you are targetting.</p><p style="margin-left:50px";>'+ | |
402 | 402 | 'Languages - In language you publishing.</p><p style="margin-left:50px";>Style - In what style you crafted?'+ | |
403 | 403 | '</p><p style="margin-left:50px";> Author - Who is a crafter?</p><p style="margin-left:50px";>'+ | |
404 | 'Our blog - If you don\'t have blogspot ID then check this to post it to our blog.</p>'; | ||
404 | 'Our blog - If you don\'t have blogspot ID then check this to post it to our blog.</p></div>'; | ||
405 | 405 | ||
406 | 406 | $('body').append(help_template); | |
407 | |||
407 | |||
408 | 408 | $(function() { | |
409 | 409 | $( "#helpwindow" ).dialog({ | |
410 | 410 | width:800, | |
… | … | ||
417 | 417 | }); | |
418 | 418 | }, | |
419 | 419 | ||
420 | exitMode: function() { | ||
421 | var exit = window.confirm("Do you really want to exit from edit mode?"); | ||
422 | if (exit == true) { | ||
423 | window.location.reload(); | ||
424 | } | ||
425 | }, | ||
426 | |||
427 | hide_overlays: function() { | ||
428 | $('#pub_overlay').slideToggle(); | ||
429 | $('#element_edit_overlay').slideToggle(); | ||
430 | }, | ||
420 | 431 | publish: function() { | |
421 | 432 | ||
422 | 433 | var publish_template = '<div id="targetoverlay" class="ui-widget-header ui-corner-all">Target'+ | |
423 | '<span id="infovis"></span><label style="position:absolute;top:12%;left:72%;color:#000;">TARGET</label> '+ | ||
434 | '<div id="infovis"></div><label style="position:absolute;top:12%;left:72%;color:#000;">TARGET</label> '+ | ||
424 | 435 | '<label style="position:absolute;top:25%;left:62%;color:#000;">Location :</label> '+ | |
425 | '<label id="location" style="position:absolute;top:25%;left:75%;color:#000;"</label>'+ | ||
436 | '<label id="loc-select" style="position:absolute;top:25%;left:75%;color:#000;"></label>'+ | ||
426 | 437 | '<label style="position:absolute;top:40%;left:62%;color:#000;">Language :</label> '+ | |
427 | '<label id="language" style="position:absolute;top:40%;left:75%;color:#000;"</label>'+ | ||
438 | '<label id="lang-select" style="position:absolute;top:40%;left:75%;color:#000;"></label>'+ | ||
428 | 439 | '<label style="position:absolute;top:55%;left:62%;color:#000;">Style :</label> '+ | |
429 | '<label id="style" style="position:absolute;top:55%;left:75%;color:#000;'+ | ||
430 | '<label style="position:absolute;top:70%;left:62%;color:#000;">Style :</label> '+ | ||
440 | '<label id="style-select" style="position:absolute;top:55%;left:75%;color:#000;"></label>'+ | ||
441 | '<label style="position:absolute;top:70%;left:62%;color:#000;">Author :</label> '+ | ||
431 | 442 | '<input id="auth-select" type="text" style="position:absolute;top:70%;left:75%;width:160px;"></input>'+ | |
432 | '<input id="our-check" type="radio" name="blog" style="position:absolute;top:85%;left:61%;width:160px;"></input>'+ | ||
443 | '<input id="our-check" type="radio"name="blog"style="position:absolute;top:85%;left:52%;width:160px;"></input>'+ | ||
433 | 444 | '<label style="position:absolute;top:85%;left:64%;color:#000;">Our Blog</label>'+ | |
434 | 445 | '<input id="your-check" type="radio" name="blog" style="position:absolute;top:85%;left:75%;"></input>'+ | |
435 | 446 | '<label style="position:absolute;top:85%;left:78%;color:#000;">Your Blog</label>'+ | |
… | … | ||
449 | 449 | $('body').append(publish_template); | |
450 | 450 | document.addEventListener("DOMActivate", init, false); | |
451 | 451 | ||
452 | $(function() { | ||
453 | $( "#targetoverlay" ).dialog({ | ||
454 | height:500, | ||
455 | width:800, | ||
456 | modal: true, | ||
457 | buttons: { | ||
458 | OK: function() { | ||
459 | overlayBar = new OverlayBar(pageEditor); | ||
460 | overlayBar.blogpost(); | ||
461 | } | ||
462 | }, | ||
463 | close: function() { | ||
464 | $( "#targetoverlay" ).hide(); | ||
465 | document.removeEventListener("DOMActivate", init, false); | ||
466 | } | ||
467 | }); | ||
452 | $(function() { | ||
453 | $( "#targetoverlay" ).dialog({ | ||
454 | height:500, | ||
455 | width:800, | ||
456 | modal: true, | ||
457 | buttons: { | ||
458 | OK: function() { | ||
459 | overlayBar = new OverlayBar(pageEditor); | ||
460 | overlayBar.blogpost(); | ||
461 | } | ||
462 | }, | ||
463 | close: function() { | ||
464 | $( "#targetoverlay" ).hide(); | ||
465 | document.removeEventListener("DOMActivate", init, false); | ||
466 | } | ||
468 | 467 | }); | |
468 | }); | ||
469 | 469 | }, | |
470 | 470 | ||
471 | 471 | showBox: function() { | |
472 | 472 | $(function() { | |
473 | 473 | $( "#show-box" ).dialog( "destroy" ); | |
474 | 474 | ||
475 | $( "#show-box" ).dialog({ | ||
476 | width: 300, | ||
477 | height: 300, | ||
478 | modal: true | ||
475 | $( "#show-box" ).dialog({ | ||
476 | width: 300, | ||
477 | height: 300, | ||
478 | modal: true | ||
479 | }); | ||
479 | 480 | }); | |
480 | }); | ||
481 | a11ypi.createMenu(a11ypi.showbox); | ||
482 | }, | ||
483 | ajaxLinks1: function() { | ||
484 | var xhr = new XMLHttpRequest(); | ||
485 | xhr.onreadystatechange = function() | ||
486 | { | ||
487 | if(xhr.readyState == 4) | ||
481 | a11ypi.createMenu(a11ypi.showbox); | ||
482 | }, | ||
483 | ajaxLinks1: function() { | ||
484 | var xhr = new XMLHttpRequest(); | ||
485 | xhr.onreadystatechange = function() | ||
488 | 486 | { | |
489 | if(xhr.responseText == "empty") | ||
490 | { } | ||
491 | else | ||
487 | if(xhr.readyState == 4) | ||
492 | 488 | { | |
493 | document.getElementById("see-links").disabled = false; | ||
494 | a11ypi.showlinks = JSON.parse(xhr.responseText); | ||
489 | if(xhr.responseText == "empty") | ||
490 | { } | ||
491 | else | ||
492 | { | ||
493 | document.getElementById("see-links").disabled = false; | ||
494 | a11ypi.showlinks = JSON.parse(xhr.responseText); | ||
495 | } | ||
495 | 496 | } | |
496 | 497 | } | |
497 | } | ||
498 | xhr.open("POST","http://dev.a11y.in/domain",true); | ||
499 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | ||
500 | d = window.location.search.split('?')[1]; | ||
501 | var a =[]; | ||
502 | for (var i = 0;i<d.split('&').length;i++){ | ||
503 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
504 | } | ||
505 | xhr.send('url='+a['foruri']) | ||
506 | }, | ||
507 | showBox1: function() { | ||
508 | $(function() { | ||
509 | $( "#show-links" ).dialog( "destroy" ); | ||
510 | |||
511 | $( "#show-links" ).dialog({ | ||
512 | width: 500, | ||
513 | height: 300, | ||
514 | modal: true | ||
498 | xhr.open("POST","http://dev.a11y.in/domain",true); | ||
499 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | ||
500 | d = window.location.search.split('?')[1]; | ||
501 | var a =[]; | ||
502 | for (var i = 0;i<d.split('&').length;i++){ | ||
503 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
504 | } | ||
505 | xhr.send('url='+a['foruri']) | ||
506 | }, | ||
507 | showBox1: function() { | ||
508 | $(function() { | ||
509 | $( "#show-links" ).dialog( "destroy" ); | ||
510 | |||
511 | $( "#show-links" ).dialog({ | ||
512 | width: 500, | ||
513 | height: 300, | ||
514 | modal: true | ||
515 | }); | ||
515 | 516 | }); | |
516 | }); | ||
517 | a11ypi.createDomainMenu(); | ||
518 | }, | ||
519 | createDomainMenu: function() { | ||
520 | var xyz = document.getElementById("show-links"); | ||
521 | xyz.innerHTML = ""; | ||
522 | menu_list = a11ypi.showlinks; | ||
523 | for(var i=0; i<menu_list.length;i++) | ||
524 | { | ||
525 | var para = document.createElement("p"); | ||
526 | var newel = document.createElement("a"); | ||
527 | newel.textContent = menu_list[i]; | ||
528 | newel.setAttribute("href", "http://dev.a11y.in/web?foruri="+encodeURIComponent(menu_list[i])); | ||
529 | newel.setAttribute("class","alipiShowLink"); | ||
530 | para.appendChild(newel); | ||
531 | xyz.appendChild(para); | ||
532 | } | ||
533 | $('.alipiShowLink').hover( | ||
534 | function() { | ||
517 | a11ypi.createDomainMenu(); | ||
518 | }, | ||
519 | createDomainMenu: function() { | ||
520 | var xyz = document.getElementById("show-links"); | ||
521 | xyz.innerHTML = ""; | ||
522 | menu_list = a11ypi.showlinks; | ||
523 | for(var i=0; i<menu_list.length;i++) | ||
524 | { | ||
525 | var para = document.createElement("p"); | ||
526 | var newel = document.createElement("a"); | ||
527 | newel.textContent = menu_list[i]; | ||
528 | newel.setAttribute("href", "http://dev.a11y.in/web?foruri="+encodeURIComponent(menu_list[i])); | ||
529 | newel.setAttribute("class","alipiShowLink"); | ||
530 | para.appendChild(newel); | ||
531 | xyz.appendChild(para); | ||
532 | } | ||
533 | $('.alipiShowLink').hover( | ||
534 | function() { | ||
535 | var xhr = new XMLHttpRequest(); | ||
536 | xhr.onreadystatechange = function() | ||
537 | { | ||
538 | if(xhr.readyState == 4) | ||
539 | { | ||
540 | if(xhr.responseText == "empty") | ||
541 | { } | ||
542 | else | ||
543 | { | ||
544 | menu_list = JSON.parse(xhr.responseText); | ||
545 | x = ''; | ||
546 | for(i=0; i<menu_list.length; i++) { | ||
547 | if (i == menu_list.length-1) { | ||
548 | x += menu_list[i]; | ||
549 | } else { | ||
550 | x += menu_list[i] + ", "; | ||
551 | } | ||
552 | } | ||
553 | document.getElementById('show-links').title = x; | ||
554 | } | ||
555 | } | ||
556 | } | ||
557 | xhr.open("POST","http://dev.a11y.in/menu",true); | ||
558 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | ||
559 | xhr.send('url='+encodeURIComponent($(this).attr('href'))) ; | ||
560 | }, | ||
561 | function () {document.getElementById('show-links').title= '';} | ||
562 | ); | ||
563 | }, | ||
564 | blogFilter: function() { | ||
565 | if (a11ypi.blog_flag == false) { | ||
566 | a11ypi.blog_flag = true; | ||
535 | 567 | var xhr = new XMLHttpRequest(); | |
536 | 568 | xhr.onreadystatechange = function() | |
537 | 569 | { | |
… | … | ||
573 | 573 | { } | |
574 | 574 | else | |
575 | 575 | { | |
576 | menu_list = JSON.parse(xhr.responseText); | ||
577 | x = ''; | ||
578 | for(i=0; i<menu_list.length; i++) { | ||
579 | if (i == menu_list.length-1) { | ||
580 | x += menu_list[i]; | ||
581 | } else { | ||
582 | x += menu_list[i] + ", "; | ||
583 | } | ||
576 | var sel = document.getElementById("blog-filter"); | ||
577 | var menu_list = JSON.parse(xhr.responseText); | ||
578 | // blogArray = []; | ||
579 | // for (var i=0; i< menu_list.length; i++) | ||
580 | // { | ||
581 | // blogArray[i] = menu_list[i].split("http://")[1].split(".com")[0] + ".com"; | ||
582 | // } | ||
583 | // blogArray.sort(); | ||
584 | for (var i=0; i < menu_list.length; i++) | ||
585 | { | ||
586 | // if ( i == 0 ) | ||
587 | // { | ||
588 | opt = document.createElement("option"); | ||
589 | opt.textContent = menu_list[i]; | ||
590 | sel.appendChild(opt); | ||
584 | 591 | } | |
585 | document.getElementById('show-links').title = x; | ||
592 | // else if(blogArray[i] == blogArray[i-1]) | ||
593 | // { } | ||
594 | // else | ||
595 | // { | ||
596 | // opt = document.createElement("option"); | ||
597 | // opt.textContent = blogArray[i]; | ||
598 | // sel.appendChild(opt); | ||
599 | // } | ||
600 | |||
586 | 601 | } | |
587 | 602 | } | |
588 | 603 | } | |
589 | xhr.open("POST","http://dev.a11y.in/menu",true); | ||
604 | xhr.open("POST","http://dev.a11y.in/blog",true); | ||
590 | 605 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
591 | xhr.send('url='+encodeURIComponent($(this).attr('href'))) ; | ||
592 | }, | ||
593 | function () {document.getElementById('show-links').title= '';} | ||
594 | ); | ||
595 | }, | ||
596 | blogFilter: function() { | ||
597 | if (a11ypi.blog_flag == false) { | ||
598 | a11ypi.blog_flag = true; | ||
599 | var xhr = new XMLHttpRequest(); | ||
600 | xhr.onreadystatechange = function() | ||
601 | { | ||
602 | if(xhr.readyState == 4) | ||
603 | { | ||
604 | if(xhr.responseText == "empty") | ||
605 | { } | ||
606 | else | ||
607 | { | ||
608 | var sel = document.getElementById("blog-filter"); | ||
609 | var menu_list = JSON.parse(xhr.responseText); | ||
610 | // blogArray = []; | ||
611 | // for (var i=0; i< menu_list.length; i++) | ||
612 | // { | ||
613 | // blogArray[i] = menu_list[i].split("http://")[1].split(".com")[0] + ".com"; | ||
614 | // } | ||
615 | // blogArray.sort(); | ||
616 | for (var i=0; i < menu_list.length; i++) | ||
617 | { | ||
618 | // if ( i == 0 ) | ||
619 | // { | ||
620 | opt = document.createElement("option"); | ||
621 | opt.textContent = menu_list[i]; | ||
622 | sel.appendChild(opt); | ||
623 | } | ||
624 | // else if(blogArray[i] == blogArray[i-1]) | ||
625 | // { } | ||
626 | // else | ||
627 | // { | ||
628 | // opt = document.createElement("option"); | ||
629 | // opt.textContent = blogArray[i]; | ||
630 | // sel.appendChild(opt); | ||
631 | // } | ||
632 | |||
633 | } | ||
606 | d = window.location.search.split('?')[1]; | ||
607 | var a =[]; | ||
608 | for (var i = 0;i<d.split('&').length;i++){ | ||
609 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
634 | 610 | } | |
611 | xhr.send('url='+a['foruri']); | ||
635 | 612 | } | |
636 | xhr.open("POST","http://dev.a11y.in/blog",true); | ||
637 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | ||
638 | d = window.location.search.split('?')[1]; | ||
613 | }, | ||
614 | go: function() { | ||
639 | 615 | var a =[]; | |
640 | 616 | for (var i = 0;i<d.split('&').length;i++){ | |
641 | 617 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | |
642 | 618 | } | |
643 | xhr.send('url='+a['foruri']); | ||
619 | if (document.getElementById("blog-filter").value == "Choose a blog name") | ||
620 | { } | ||
621 | else { | ||
622 | window.open("http://dev.a11y.in/web?foruri=" + a['foruri'] + "&blog=" + document.getElementById("blog-filter").value); | ||
623 | }}, | ||
624 | editPage: function() { | ||
625 | a11ypi.testContext(); | ||
626 | $('#renarrated_overlay').hide(); | ||
627 | $('#icon_on_overlay').show(); | ||
628 | $('#pub_overlay').show(); | ||
629 | $('#element_edit_overlay').show(); | ||
630 | // document.addEventListener('click',pageEditor.startEdit, false); | ||
631 | $(document).click(pageEditor.startEdit); | ||
632 | //page_edit('4seiz', '4l85060vb9', '336e2nootv6nxjsvyjov', 'VISUAL', 'false', ''); | ||
633 | // document.getElementById("renarrated_overlay").style.display = "none"; | ||
634 | }, | ||
635 | |||
636 | displayEditor: function() { | ||
637 | $( "#editoroverlay" ).dialog({ | ||
638 | width:1000, | ||
639 | height:550, | ||
640 | modal: true, | ||
641 | buttons: { | ||
642 | "+": function() { | ||
643 | |||
644 | if($('#editor').css('font-size') >= '30px') { | ||
645 | // passthrough | ||
646 | } | ||
647 | else { | ||
648 | |||
649 | var font = parseFloat($('#editor').css('font-size')) + 1; | ||
650 | $('#editor').css('font-size', font+'px'); | ||
651 | font = parseFloat($('#reference').css('font-size')) + 1; | ||
652 | $('#reference').css('font-size', font+'px'); | ||
653 | } | ||
654 | }, | ||
655 | "-": function() { | ||
656 | |||
657 | if($('#editor').css('font-size') <= '10px') { | ||
658 | } | ||
659 | else { | ||
660 | |||
661 | var font = parseFloat($('#editor').css('font-size')) - 1; | ||
662 | $('#editor').css('font-size', font+'px'); | ||
663 | font = parseFloat($('#reference').css('font-size')) - 1; | ||
664 | $('#reference').css('font-size', font+'px'); | ||
665 | |||
666 | } | ||
667 | }, | ||
668 | OK: function() { | ||
669 | event.target.innerHTML = document.getElementById('editor').innerHTML; | ||
670 | $(event.target).html($('#editor').html()); | ||
671 | $(event.target).attr('m4pageedittype','text'); | ||
672 | $(event.target).children().attr('m4pageedittype','text'); | ||
673 | $( "#editoroverlay" ).remove(); | ||
674 | } | ||
675 | }, | ||
676 | close: function() { | ||
677 | $("#editoroverlay" ).remove(); | ||
678 | } | ||
679 | }); | ||
680 | |||
681 | }, | ||
682 | |||
683 | imageReplacer: function() { | ||
684 | var src = prompt("Enter the url"); | ||
685 | $(event.target).attr('src',src); | ||
686 | console.log(DOM.getXpath(event.target)); | ||
687 | |||
688 | }, | ||
689 | |||
690 | showTopBar: function() { | ||
691 | |||
644 | 692 | } | |
645 | }, | ||
646 | go: function() { | ||
647 | var a =[]; | ||
648 | for (var i = 0;i<d.split('&').length;i++){ | ||
649 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
650 | } | ||
651 | if (document.getElementById("blog-filter").value == "Choose a blog name") | ||
652 | { } | ||
653 | else { | ||
654 | window.open("http://dev.a11y.in/web?foruri=" + a['foruri'] + "&blog=" + document.getElementById("blog-filter").value); | ||
655 | }}, | ||
656 | editPage: function() { | ||
657 | a11ypi.testContext(); | ||
658 | $('#renarrated_overlay').hide(); | ||
659 | $('#pub_overlay').show(); | ||
660 | // document.addEventListener('click',pageEditor.startEdit, false); | ||
661 | $(document).click(pageEditor.startEdit); | ||
662 | //page_edit('4seiz', '4l85060vb9', '336e2nootv6nxjsvyjov', 'VISUAL', 'false', ''); | ||
663 | document.getElementById("renarrated_overlay").style.display = "none"; | ||
664 | }, | ||
665 | showTopBar: function() { | ||
666 | |||
667 | } | ||
668 | 693 | }; | |
669 | 694 | ||
670 | 695 | // $('html').bind('keypress', function(e) |
server/wsgi/pageEditor.js
(15 / 48)
  | |||
10 | 10 | { | |
11 | 11 | if($(event.target).attr('m4pageedittype') == 'text') | |
12 | 12 | { | |
13 | $('#pub_overlay').slideDown(); | ||
14 | $('#element_edit_overlay').slideDown(); | ||
15 | |||
13 | 16 | _this = pageEditor; | |
14 | 17 | $(event.target).removeAttr('m4pageedittype'); | |
15 | 18 | $(event.target).children().removeAttr('m4pageedittype'); | |
16 | $(body).append(_this.template); | ||
19 | $('body').append(_this.template); | ||
17 | 20 | var tag = event.target.nodeName; | |
21 | // $(event.target).css('border-style', 'dotted'); | ||
22 | |||
18 | 23 | $('#reference').text('<'+tag+'>'+$(event.target).html()+'</'+tag+'>'); | |
19 | 24 | ||
20 | 25 | $('#editor').html($(event.target).html()); | |
21 | |||
22 | $( "#editoroverlay" ).dialog({ | ||
23 | width:1000, | ||
24 | height:550, | ||
25 | modal: true, | ||
26 | buttons: { | ||
27 | "+": function() { | ||
28 | |||
29 | if($('#editor').css('font-size') >= '30px') { | ||
30 | // passthrough | ||
31 | } | ||
32 | else { | ||
33 | |||
34 | var font = parseFloat($('#editor').css('font-size')) + 1; | ||
35 | $('#editor').css('font-size', font+'px'); | ||
36 | font = parseFloat($('#reference').css('font-size')) + 1; | ||
37 | $('#reference').css('font-size', font+'px'); | ||
38 | } | ||
39 | }, | ||
40 | "-": function() { | ||
41 | |||
42 | if($('#editor').css('font-size') <= '10px') { | ||
43 | } | ||
44 | else { | ||
45 | |||
46 | var font = parseFloat($('#editor').css('font-size')) - 1; | ||
47 | $('#editor').css('font-size', font+'px'); | ||
48 | font = parseFloat($('#reference').css('font-size')) - 1; | ||
49 | $('#reference').css('font-size', font+'px'); | ||
50 | |||
51 | } | ||
52 | }, | ||
53 | OK: function() { | ||
54 | event.target.innerHTML = document.getElementById('editor').innerHTML; | ||
55 | $(event.target).html($('#editor').html()); | ||
56 | $(event.target).attr('m4pageedittype','text'); | ||
57 | $(event.target).children().attr('m4pageedittype','text'); | ||
58 | $( "#editoroverlay" ).remove(); | ||
59 | } | ||
60 | }, | ||
61 | close: function() { | ||
62 | $("#editoroverlay" ).remove(); | ||
63 | } | ||
64 | }); | ||
26 | |||
27 | $('#edit-text').attr('disabled', false); | ||
28 | $('#add-audio').attr('disabled', false); | ||
29 | $('#add-link').attr('disabled', false); | ||
30 | $('#replace-image').attr('disabled', true); | ||
65 | 31 | } | |
66 | 32 | else if($(event.target).attr('m4pageedittype') == 'image') | |
67 | 33 | { | |
68 | var src = prompt("Enter the url"); | ||
69 | $(event.target).attr('src',src); | ||
70 | console.log(DOM.getXpath(event.target)); | ||
34 | $('#replace-image').attr('disabled', false); | ||
35 | $('#add-audio').attr('disabled', false); | ||
36 | $('#add-link').attr('disabled', false); | ||
37 | $('#edit-text').attr('disabled', true); | ||
71 | 38 | } | |
72 | 39 | ||
73 | 40 | }, |