Commit 5c80b835e27e5862a92fb49cefdf81423d968af1
- Diff rendering mode:
- inline
- side by side
.gitignore
(13 / 0)
  | |||
1 | *~ | ||
2 | *.pyc | ||
3 | *.swp | ||
4 | *.jpeg | ||
5 | *.png | ||
6 | *.gif | ||
7 | google3998b23cc94c0027.html | ||
8 | conf.py | ||
9 | apis/ | ||
10 | Sanchaya/ | ||
11 | .#* | ||
12 | logme | ||
13 | config.js |
server/alipi.py
(5 / 0)
  | |||
99 | 99 | script_test.set("type", "text/javascript") | |
100 | 100 | script_edit.set("src", conf.APPURL[0] + "/server/wsgi/pageEditor.js") | |
101 | 101 | script_edit.set("type","text/javascript") | |
102 | script_config = g.root.makeelement('script') | ||
103 | g.root.body.append(script_config) | ||
104 | script_config.set("src", conf.APPURL[0] + "/server/config.js") | ||
105 | script_config.set("type", "text/javascript") | ||
106 | |||
102 | 107 | ||
103 | 108 | script_jq_mini = g.root.makeelement('script') | |
104 | 109 | g.root.body.append(script_jq_mini) |
server/sampleConfig.js
(6 / 0)
  | |||
1 | //A sample configuration file for JS variables. Copy this file to "config.js" | ||
2 | var config = { | ||
3 | 'hostname': "127.0.0.1", | ||
4 | 'deploy': "http://127.0.0.1:5000", | ||
5 | 'root': "http://localhost" | ||
6 | } |
server/ui.js
(52 / 89)
  | |||
36 | 36 | createMenu: function(menu_list) { | |
37 | 37 | var xyz = document.getElementById("show-box"); | |
38 | 38 | xyz.innerHTML = ''; | |
39 | d = window.location.search.split('?')[1]; | ||
40 | var a =[]; | ||
41 | for (var i = 0;i<d.split('&').length;i++){ | ||
42 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
43 | } | ||
44 | var page = a['foruri']; | ||
39 | a = a11ypi.getParams(); | ||
45 | 40 | for(var i=0;i<menu_list.length;i++) | |
46 | 41 | { | |
47 | 42 | var para = document.createElement("p"); | |
48 | 43 | var newel = document.createElement("a"); | |
49 | 44 | newel.textContent = menu_list[i]; | |
50 | $(newel).attr("href","http://127.0.0.1:5000/?foruri="+page+"&lang="+menu_list[i]+"&interactive=1"); | ||
45 | $(newel).attr("href",config.url+"/?foruri="+a['foruri']+"&lang="+menu_list[i]+"&interactive=1"); | ||
51 | 46 | para.appendChild(newel); | |
52 | 47 | xyz.appendChild(para); | |
53 | 48 | } | |
… | … | ||
59 | 59 | { | |
60 | 60 | if(xhr.responseText == "empty") | |
61 | 61 | { | |
62 | a11ypi.clearMenu(); | ||
62 | //a11ypi.clearMenu(); | ||
63 | 63 | } | |
64 | 64 | else | |
65 | 65 | { | |
… | … | ||
70 | 70 | } | |
71 | 71 | } | |
72 | 72 | } | |
73 | xhr.open("POST","http://dev.a11y.in/menu",true); | ||
73 | xhr.open("POST",config.root+"/menu",true); | ||
74 | 74 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
75 | d = window.location.search.split('?')[1]; | ||
76 | var a =[]; | ||
77 | for (var i = 0;i<d.split('&').length;i++){ | ||
78 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
79 | } | ||
80 | var url = a['foruri']; | ||
81 | xhr.send('url='+url); | ||
75 | a = a11ypi.getParams(); | ||
76 | xhr.send('url='+a['foruri']); | ||
82 | 77 | ||
83 | req = {"about":encodeURIComponent(decodeURIComponent(url)), "lang":a['lang']}; | ||
78 | req = {"about":decodeURIComponent(a['foruri']), "lang":a['lang']}; | ||
84 | 79 | $.getJSON('http://127.0.0.1:5000/info?', req, function(data) | |
85 | { | ||
86 | a11ypi.responseJSON = data; | ||
87 | }); | ||
80 | { | ||
81 | a11ypi.responseJSON = data; | ||
82 | }); | ||
88 | 83 | } | |
89 | 84 | }, | |
90 | 85 | ajax1: function() { | |
… | … | ||
93 | 93 | { | |
94 | 94 | if(xhr.responseText == "empty") | |
95 | 95 | { | |
96 | a11ypi.clearMenu(); | ||
96 | // a11ypi.clearMenu(); | ||
97 | 97 | } | |
98 | 98 | else | |
99 | 99 | { | |
… | … | ||
101 | 101 | } | |
102 | 102 | } | |
103 | 103 | } | |
104 | xhr.open("POST","http://dev.a11y.in/menu",true); | ||
104 | xhr.open("POST",config.root+"/menu",true); | ||
105 | 105 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
106 | d = window.location.search.split('?')[1]; | ||
107 | var a =[]; | ||
108 | for (var i = 0;i<d.split('&').length;i++){ | ||
109 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
110 | } | ||
111 | var url = a['foruri']; | ||
112 | var option = a['blog']; | ||
113 | data = 'url='+url+'&option='+option; | ||
106 | a = a11ypi.getParams(); | ||
107 | data = 'url='+a['foruri']+'&option='+a['blog']; | ||
114 | 108 | xhr.send(data) ; | |
115 | 109 | } | |
116 | 110 | }, | |
… | … | ||
115 | 115 | }, | |
116 | 116 | ren: function() | |
117 | 117 | { | |
118 | |||
119 | d = window.location.search.split('?')[1]; | ||
120 | var a =[]; | ||
121 | for (var i = 0;i<d.split('&').length;i++){ | ||
122 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
123 | } | ||
118 | a = a11ypi.getParams(); | ||
124 | 119 | var url = decodeURIComponent(a['foruri']); | |
125 | 120 | var lang = a['lang']; | |
126 | $.getJSON("http://dev.a11y.in/web/replace?",{"url":url,"lang":lang},function(data) | ||
121 | $.getJSON(config.deploy+"/replace?",{"url":url,"lang":lang},function(data) | ||
127 | 122 | { | |
128 | 123 | for(var i=0;i<data['r'].length;i++) | |
129 | 124 | { | |
… | … | ||
188 | 188 | { | |
189 | 189 | if(xhr.responseText =='empty') | |
190 | 190 | { | |
191 | a11ypi.clearMenu(); | ||
192 | alert("An internal server error occured, please try later."); | ||
191 | // a11ypi.clearMenu(); | ||
192 | // alert("An internal server error occured, please try later."); | ||
193 | 193 | } | |
194 | 194 | else | |
195 | 195 | { | |
… | … | ||
213 | 213 | } | |
214 | 214 | } | |
215 | 215 | } | |
216 | d = window.location.search.split('?')[1]; | ||
217 | var a =[]; | ||
218 | for (var i = 0;i<d.split('&').length;i++){ | ||
219 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
220 | } | ||
216 | a = a11ypi.getParams(); | ||
221 | 217 | var url = a['foruri']; | |
222 | 218 | var lang= a['lang']; | |
223 | 219 | var blog= a['blog']; | |
224 | 220 | var data="url="+url+"&lang="+encodeURIComponent(lang)+"&blog="+encodeURIComponent(blog); | |
225 | 221 | ||
226 | xhr.open("POST","http://dev.a11y.in/filter",true); | ||
222 | xhr.open("POST",config.root+"/filter",true); | ||
227 | 223 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
228 | 224 | xhr.send(data);// | |
229 | 225 | }, | |
… | … | ||
227 | 227 | var xyz = document.getElementById("show-box"); | |
228 | 228 | xyz.innerHTML = ''; | |
229 | 229 | d = window.location.search.split('?')[1]; | |
230 | var a =[]; | ||
231 | for (var i = 0;i<d.split('&').length;i++){ | ||
232 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
233 | } | ||
230 | a = a11ypi.getParams(); | ||
234 | 231 | var page = a['foruri']; | |
235 | 232 | var blog = a['blog']; | |
236 | 233 | for(var i=0;i<menu_list.length;i++) | |
… | … | ||
235 | 235 | var para = document.createElement("p"); | |
236 | 236 | var newel = document.createElement("a"); | |
237 | 237 | newel.textContent = menu_list[i]; | |
238 | $(newel).attr("href","http://dev.a11y.in/web/?foruri="+page+"&blog="+blog+"&lang="+menu_list[i]+"&interactive=1"); | ||
238 | $(newel).attr("href",config.deploy+"/?foruri="+page+"&blog="+blog+"&lang="+menu_list[i]+"&interactive=1"); | ||
239 | 239 | para.appendChild(newel); | |
240 | 240 | xyz.appendChild(para); | |
241 | 241 | } | |
… | … | ||
248 | 248 | } | |
249 | 249 | }, | |
250 | 250 | getURLFilter: function(e) { | |
251 | d = window.location.search.split('?')[1]; | ||
252 | var a =[]; | ||
253 | for (var i = 0;i<d.split('&').length;i++){ | ||
254 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
255 | } | ||
256 | |||
257 | window.location = "http://dev.a11y.in/web/?foruri="+a['foruri']+"&blog="+a['blog'] + "&lang=" + e.value+"&interactive=1"; | ||
251 | a= a11ypi.getParams(); | ||
252 | window.location = config.deploy+"/?foruri="+a['foruri']+"&blog="+a['blog'] + "&lang=" + e.value+"&interactive=1"; | ||
258 | 253 | window.reload(); | |
259 | 254 | }, | |
260 | 255 | showOriginal: function(){ | |
… | … | ||
424 | 424 | $('#icon-up').attr('down', 'false'); | |
425 | 425 | $('#icon-up').show(); $('#icon-down').hide(); | |
426 | 426 | $('#pub_overlay').addClass('barOnBottom'); $('#pub_overlay').removeClass('barOnTop'); | |
427 | // $('#element_edit_overlay').addClass('barOnBottom'); $('#element_edit_overlay').removeClass('barOnTop'); | ||
428 | // $('#icon_on_overlay').addClass('barOnBottom'); $('#icon_on_overlay').removeClass('barOnTop'); | ||
429 | 427 | } else { | |
430 | 428 | $('#icon-up').attr('down', 'true'); | |
431 | 429 | $('#icon-down').show(); $('#icon-up').hide(); | |
432 | 430 | $('#pub_overlay').addClass('barOnTop'); $('#pub_overlay').removeClass('barOnBottom'); | |
433 | // $('#element_edit_overlay').addClass('barOnTop'); $('#element_edit_overlay').removeClass('barOnBottom'); | ||
434 | // $('#icon_on_overlay').addClass('barOnTop'); $('#icon_on_overlay').removeClass('barOnBottom'); | ||
431 | |||
435 | 432 | } | |
436 | 433 | }, | |
437 | 434 | ||
… | … | ||
451 | 451 | source: function(req, add){ | |
452 | 452 | ||
453 | 453 | //pass request to server | |
454 | $.getJSON("http://dev.a11y.in/web//getLoc?", req, function(data) { | ||
454 | $.getJSON(config.deploy+"/getLoc?", req, function(data) { | ||
455 | 455 | $('#loc-img').hide(); | |
456 | 456 | ||
457 | 457 | //create array for response objects | |
… | … | ||
474 | 474 | source: function(req, add){ | |
475 | 475 | ||
476 | 476 | //pass request to server | |
477 | $.getJSON("http://dev.a11y.in/web//getLang?", req, function(data) { | ||
477 | $.getJSON(config.deploy+"/getLang?", req, function(data) { | ||
478 | 478 | $('#lang-img').hide(); | |
479 | 479 | ||
480 | 480 | //create array for response objects | |
… | … | ||
597 | 597 | } | |
598 | 598 | } | |
599 | 599 | } | |
600 | xhr.open("POST","http://dev.a11y.in/domain",true); | ||
600 | xhr.open("POST",config.root+"/domain",true); | ||
601 | 601 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
602 | 602 | d = window.location.search.split('?')[1]; | |
603 | var a =[]; | ||
604 | for (var i = 0;i<d.split('&').length;i++){ | ||
605 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
606 | } | ||
603 | a = a11ypi.getParams(); | ||
607 | 604 | xhr.send('url='+a['foruri']) | |
608 | 605 | }, | |
609 | 606 | showBox1: function() { | |
… | … | ||
627 | 627 | var para = document.createElement("p"); | |
628 | 628 | var newel = document.createElement("a"); | |
629 | 629 | newel.textContent = menu_list[i]; | |
630 | newel.setAttribute("href", "http://dev.a11y.in/web/?foruri="+encodeURIComponent(menu_list[i])); | ||
630 | newel.setAttribute("href", config.deploy+"/?foruri="+encodeURIComponent(menu_list[i])); | ||
631 | 631 | newel.setAttribute("class","alipiShowLink"); | |
632 | 632 | para.appendChild(newel); | |
633 | 633 | xyz.append(para); | |
… | … | ||
656 | 656 | } | |
657 | 657 | } | |
658 | 658 | } | |
659 | xhr.open("POST","http://dev.a11y.in/menu",true); | ||
659 | xhr.open("POST",config.root+"/menu",true); | ||
660 | 660 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
661 | 661 | xhr.send('url='+encodeURIComponent($(this).attr('href'))) ; | |
662 | 662 | }, | |
… | … | ||
689 | 689 | } | |
690 | 690 | } | |
691 | 691 | } | |
692 | xhr.open("POST","http://dev.a11y.in/blog",true); | ||
692 | xhr.open("POST",config.root+"/blog",true); | ||
693 | 693 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | |
694 | d = window.location.search.split('?')[1]; | ||
695 | var a =[]; | ||
696 | for (var i = 0;i<d.split('&').length;i++){ | ||
697 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
698 | } | ||
694 | a = a11ypi.getParams(); | ||
699 | 695 | xhr.send('url='+a['foruri']); | |
700 | 696 | } | |
701 | 697 | }, | |
… | … | ||
703 | 703 | if ($("#blog-filter").val() == null) | |
704 | 704 | { } | |
705 | 705 | else { | |
706 | window.open("http://dev.a11y.in/web/?foruri=" + a['foruri'] + "&blog=" + $("#blog-filter").val()); | ||
706 | window.open(config.deploy+"/?foruri=" + a['foruri'] + "&blog=" + $("#blog-filter").val()); | ||
707 | 707 | } | |
708 | 708 | }, | |
709 | 709 | share: function() { | |
… | … | ||
718 | 718 | }, | |
719 | 719 | editPage: function() { | |
720 | 720 | a11ypi.testContext(); | |
721 | // $('#icon_on_overlay').show(); $('#icon_on_overlay').addClass('barOnTop'); // When 1st time page entered in edit mode | ||
722 | 721 | $('#pub_overlay').show(); $('#pub_overlay').addClass('barOnTop'); | |
723 | 722 | $('#icon-down').show(); | |
724 | // $('#element_edit_overlay').addClass('barOnTop'); | ||
725 | 723 | $('#renarrated_overlay').hide(); | |
726 | // $(window).click(function(event){ | ||
727 | // console.log(event); | ||
728 | // event.stopPropagation(); | ||
729 | // event.preventDefault(); | ||
730 | // }); | ||
731 | 724 | $('body *').contents().filter(function(){ | |
732 | 725 | { | |
733 | 726 | try{ | |
… | … | ||
760 | 760 | '<div id="reference" class="alipi" readonly="yes"></div>'+ | |
761 | 761 | '<textarea id="adv-reference" class="alipi" readonly="yes"></textarea> '+ | |
762 | 762 | '<label id="edit-lab" class="alipi" style="left:53%;">Where you should edit (Editor)</label>'+ | |
763 | '<div id="editor" class="alipi" contenteditable="true" '+ // onkeyup="a11ypi.reflectInReference();"> | ||
764 | // '<div id="forPrevData" class="alipi"></div>'+ | ||
763 | '<div id="editor" class="alipi" contenteditable="true" '+ | ||
765 | 764 | '</div>'; | |
766 | 765 | $('body').append(template); | |
767 | 766 | $('#pub_overlay').slideUp(); | |
768 | 767 | $('#element_edit_overlay').hide(); | |
769 | // $('#icon_on_overlay').slideUp(); | ||
770 | 768 | ||
771 | 769 | var tag = pageEditor.event.target.nodeName; | |
772 | 770 | $(pageEditor.event.target).removeAttr('m4pageedittype'); | |
… | … | ||
775 | 775 | $('#editor').html($(pageEditor.event.target).html()); | |
776 | 776 | $("#adv-ref").button({icons:{primary:"ui-icon-script"},text:true}); $('#adv-ref').children().addClass('alipi'); | |
777 | 777 | $("#close-adv").button({icons:{primary:"ui-icon-bookmark"},text:true}); $('#close-adv').children().addClass('alipi'); | |
778 | // $('#close-adv').button(); | ||
779 | 778 | $('#close-adv').hide(); | |
780 | 779 | $('#adv-ref').button(); | |
781 | 780 | ||
… | … | ||
861 | 861 | ||
862 | 862 | reflectInReference: function() { | |
863 | 863 | var tag = pageEditor.event.target.nodeName; | |
864 | // $('#reference').text('<'+tag+'>'+$("#editor").html()+'</'+tag+'>'); | ||
865 | 864 | $("#reference").html() = $("#editor").html(); | |
866 | 865 | }, | |
867 | 866 | ||
… | … | ||
947 | 947 | win.infoFullJSON = a11ypi.responseJSON; | |
948 | 948 | win.onLoad(); | |
949 | 949 | }, | |
950 | getParams: function() | ||
951 | { | ||
952 | var a = []; | ||
953 | if(window.location.hostname == config.hostname) | ||
954 | { | ||
955 | d = window.location.search.split('?')[1]; | ||
956 | for (var i = 0;i<d.split('&').length;i++){ | ||
957 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
958 | } | ||
959 | return a; | ||
960 | } | ||
961 | else | ||
962 | { | ||
963 | a['foruri'] = window.location.href; | ||
964 | return a; | ||
965 | } | ||
966 | } | ||
950 | 967 | }; |