Commit 3077122ca885f04b7515e125124c2114e1c46bd1

  • avatar
  • root <root @ar…n.(none)>
  • Mon Apr 02 00:22:55 IST 2012
Split overlay
  
4949 script_edit = root.makeelement('script')
5050 root.body.append(script_test)
5151 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")
5353 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")
5555 script_edit.set("type","text/javascript")
5656
5757 script_jq_mini = root.makeelement('script')
6363 root.body.append(style)
6464 style.set("rel","stylesheet")
6565 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")
6767
6868 jit_script = root.makeelement('script')
6969 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")
7171 jit_script.set("type", "text/javascript")
7272
7373 tree_script = root.makeelement('script')
7474 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")
7676 tree_script.set("type", "text/javascript")
7777
7878 script_jq_cust = root.makeelement('script')
101101 script_jq_mini.set("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js")
102102 script_jq_mini.set("type", "text/javascript")
103103
104 script_test.set("src", "http://localhost:60/alipi/server/ui.js")
104 script_test.set("src", "http://localhost/Github/alipi/server/ui.js")
105105 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")
107107 script_edit.set("type","text/javascript")
108108 script_jqui = root.makeelement('script')
109109 script_jqui.set("type","text/javascript")
180180 d['lang'] = request.args['lang']
181181 script_test = root.makeelement('script')
182182 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")
184184 script_test.set("type", "text/javascript")
185185 root.body.set("onload","a11ypi.ren()");
186186 root.make_links_absolute(d['foruri'], resolve_base_href = True)
190190 script_jqui = root.makeelement('script')
191191
192192 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")
194194 script_test.set("type", "text/javascript")
195195 root.body.append(script_test)
196196
200200 root.body.append(script_jq_mini)
201201
202202 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")
204204 script_edit.set("type","text/javascript")
205205 root.body.append(script_edit)
206206
231231 tweet.set("class", "twitter-share-button")
232232 tweet.set("data-via", "a11ypi")
233233 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']))
235235 tweet.textContent = "Tweet"
236236 ren_overlay.append(tweet)
237237
241241
242242 fblike = root.makeelement("div")
243243 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']))
245245 fblike.set("data-send", "true")
246246 fblike.set("data-layout", "button_count")
247247 fblike.set("data-width", "50")
254254 root.body.append(style)
255255 style.set("rel","stylesheet")
256256 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")
258258
259259 overlay2 = root.makeelement('div')
260260 root.body.append(overlay2)
269269
270270 script_test = root.makeelement('script')
271271 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")
273273 script_test.set("type", "text/javascript")
274274 root.body.set("onload","a11ypi.filter(); a11ypi.tweet(); a11ypi.facebook();");
275275 root.make_links_absolute(d['foruri'], resolve_base_href = True)
278278 elif request.args.has_key('interactive') == False and request.args.has_key('blog') == True:
279279 script_test = root.makeelement('script')
280280 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")
282282 script_test.set("type", "text/javascript")
283283
284284 script_jq_mini = root.makeelement('script')
301301 root.body.append(style)
302302 style.set("rel","stylesheet")
303303 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")
305305
306306 collection = g.db['post']
307307 if collection.find_one({"about" : request.args['foruri']}) is not None:
  
6969}
7070
7171#editoroverlay {
72 display: none;
72 display: none;
7373}
7474#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;
7979}
8080
8181#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;
9292}
9393#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;
105105}
106106#forprevData {
107 display:none;
108 height:1px;
109 width:1px;
107 display:none;
108 height:1px;
109 width:1px;
110110}
111111
112112#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;
120120}
121121
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
122134#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;
131143}
132144
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
133156#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;
135206}
server/ui.js
(246 / 166)
  
353353 },
354354 loadOverlay: function()
355355 {
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
356360 var overlay_template = '<div id="renarrated_overlay" class="ui-widget-header ui-corner-all">'+
357361 '<input id="edit-current" type="submit" onclick="a11ypi.editPage();" value="Renarrate this page">'+
358362 '<input id="see-narration" type="submit" onclick="a11ypi.showBox();" value="See Narrations">'+
366366 '</div><div id="show-box"></div><div id="show-links"></div>';
367367
368368 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">'+
370370 '<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">'+
372372 '<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);
374381 $('body').append(overlay_template);
375382 $('body').append(pub_overlay_template);
383 $('body').append(element_edit_overlay_template);
376384 a11ypi.ajax();
377385 a11ypi.ajaxLinks1();
378386 go.disabled = true;
391391 '<label id="txtlab" style="color:#000;font-weight:normal;">TEXT :- It will popup a window and allow you to'+
392392 'modify/replace text of select element on editor(right) box.'+
393393 '<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>'+
396396 '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>'+
400400 'PUBLISH:- To publish your crafted changes to database and blog (our/your).'+
401401 '<p style="margin-left:50px";>States - To the place you are targetting.</p><p style="margin-left:50px";>'+
402402 'Languages - In language you publishing.</p><p style="margin-left:50px";>Style - In what style you crafted?'+
403403 '</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>';
405405
406406 $('body').append(help_template);
407
407
408408 $(function() {
409409 $( "#helpwindow" ).dialog({
410410 width:800,
417417 });
418418 },
419419
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 },
420431 publish: function() {
421432
422433 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> '+
424435 '<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>'+
426437 '<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>'+
428439 '<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> '+
431442 '<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>'+
433444 '<label style="position:absolute;top:85%;left:64%;color:#000;">Our Blog</label>'+
434445 '<input id="your-check" type="radio" name="blog" style="position:absolute;top:85%;left:75%;"></input>'+
435446 '<label style="position:absolute;top:85%;left:78%;color:#000;">Your Blog</label>'+
449449 $('body').append(publish_template);
450450 document.addEventListener("DOMActivate", init, false);
451451
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 }
468467 });
468 });
469469 },
470470
471471 showBox: function() {
472472 $(function() {
473473 $( "#show-box" ).dialog( "destroy" );
474474
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 });
479480 });
480 });
481 a11ypi.createMenu(a11ypi.showbox);
482},
483ajaxLinks1: 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()
488486 {
489 if(xhr.responseText == "empty")
490 { }
491 else
487 if(xhr.readyState == 4)
492488 {
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 }
495496 }
496497 }
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},
507showBox1: 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 });
515516 });
516 });
517 a11ypi.createDomainMenu();
518},
519createDomainMenu: 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;
535567 var xhr = new XMLHttpRequest();
536568 xhr.onreadystatechange = function()
537569 {
573573 { }
574574 else
575575 {
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);
584591 }
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
586601 }
587602 }
588603 }
589 xhr.open("POST","http://dev.a11y.in/menu",true);
604 xhr.open("POST","http://dev.a11y.in/blog",true);
590605 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},
596blogFilter: 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];
634610 }
611 xhr.send('url='+a['foruri']);
635612 }
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() {
639615 var a =[];
640616 for (var i = 0;i<d.split('&').length;i++){
641617 a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1];
642618 }
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
644692 }
645},
646go: 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 }},
656editPage: 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},
665showTopBar: function() {
666
667}
668693};
669694
670695// $('html').bind('keypress', function(e)
  
1010 {
1111 if($(event.target).attr('m4pageedittype') == 'text')
1212 {
13 $('#pub_overlay').slideDown();
14 $('#element_edit_overlay').slideDown();
15
1316 _this = pageEditor;
1417 $(event.target).removeAttr('m4pageedittype');
1518 $(event.target).children().removeAttr('m4pageedittype');
16 $(body).append(_this.template);
19 $('body').append(_this.template);
1720 var tag = event.target.nodeName;
21// $(event.target).css('border-style', 'dotted');
22
1823 $('#reference').text('<'+tag+'>'+$(event.target).html()+'</'+tag+'>');
1924
2025 $('#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);
6531 }
6632 else if($(event.target).attr('m4pageedittype') == 'image')
6733 {
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);
7138 }
7239
7340 },