Commit 137dbb2d345c7720466ad351aa9b1e7ed8ba1e5a

  • avatar
  • Ajay <ajay @serv…ots.com>
  • Fri Jan 20 23:22:32 IST 2012
Client changes
server/ui.js
(242 / 241)
  
44 elementTagName: " ",
55 elementId: " ",
66 flag : 0,
7 showlinks : 0,
8 showbox : 0,
9 blog_flag : false,
710 testContext : function()
811 {
912
10 $(document).ready(function(){$('body *').contents().filter(function()
11 {
12 //console.log(this.nodeName);
13 try{
14 if(this.nodeType == 3)
15 {
16 return (this.nodeType == 3) && this.nodeValue.match(/\S/);}}
17 catch(err)
18 {
19// console.log(err.message);
20// console.log(this);
21 }}).wrap('<span m4pageedittype=text/>')});
13 $(document).ready(function(){$('body *').contents().filter(function()
14{
15 try{
16 if(this.nodeType == 3)
17 {
18 return (this.nodeType == 3) && this.nodeValue.match(/\S/);}}
19 catch(err)
20 {
21 }}).wrap('<span m4pageedittype=text/>')});
2222
2323
2424 vimg = document.getElementsByTagName('img');
2525 for(i=0; i<vimg.length; i++)
26 {
27 vimg[i].setAttribute('m4pageedittype','image');
28 }
29
30 var v = document.getElementsByTagName("body");
31// var a = document.createElement("script");
32// a.setAttribute("src","http://dev.a11y.in/alipi/wsgi/page_edit.js");
33// // a.setAttribute("src","http://localhost/alipi-1/server/wsgi/page_edit.js");
34// a.setAttribute("type","text/javascript");
35// v[0].appendChild(a);
36 var alltags = document.getElementsByTagName('*');
37 for (x=0; x<alltags.length; x++) {
38 if (alltags[x].id == 'ren_overlay' || alltags[x].id == 'overlay1' ) {
39 v[0].removeChild(document.getElementById('ren_overlay'));
40 v[0].removeChild(document.getElementById('overlay1'));
26 {
27 vimg[i].setAttribute('m4pageedittype','image');
4128 }
42 }
43 v[0].removeChild(document.getElementById('overlay2'));
29
4430 },
4531
4632 createMenu: function(menu_list) {
47 var xyz = document.getElementById("menu-button");
33 var xyz = document.getElementById("show-box");
34 xyz.innerHTML = "";
4835 for(var i=0;i<menu_list.length;i++)
49 {
50 var newel = document.createElement("option");
51 newel.textContent = menu_list[i];
52 newel.setAttribute("value",menu_list[i]);
53 newel.setAttribute("onclick","a11ypi.getURL(event.target);");
54 xyz.appendChild(newel);
55 }
56 },
57 clearMenu: function() {
58 var xyz = document.getElementById("menu-button");
59 while(null!= xyz.firstChild)
60 {
61 xyz.removeChild(xyz.firstChild);
62 }
63 },
64 ajax: function() {
65 if(a11ypi.flag == '0')
66 {
67 a11ypi.flag = 1;
68 var xhr = new XMLHttpRequest();
69 xhr.onreadystatechange = function()
7036 {
71 if(xhr.readyState == 4)
72 {
73 if(xhr.responseText == "empty")
74 {
75 a11ypi.clearMenu();
76 }
77 else
78 {
79 a11ypi.createMenu(JSON.parse(xhr.responseText));
80 }
81 }
37 var para = document.createElement("p");
38 var newel = document.createElement("a");
39 newel.textContent = menu_list[i];
40 newel.setAttribute("href", "http://y.a11y.in/web?foruri="+encodeURIComponent(window.location.href)+"&lang="+menu_list[i]+"&interactive=1");
41 para.appendChild(newel);
42 xyz.appendChild(para);
8243 }
83 xhr.open("POST","http://localhost/menu",true);
84 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
85 d = window.location.search.split('?')[1];
86 var a =[];
87 for (var i = 0;i<d.split('&').length;i++){
88 a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1];
89 }
90 var url = a['foruri'];
91 xhr.send('url='+url);
92 }
9344 },
9445 ajax1: function() {
95 if(a11ypi.flag == '0')
46 var xhr = new XMLHttpRequest();
47 xhr.onreadystatechange = function()
9648 {
97 a11ypi.flag = 1;
98 var xhr = new XMLHttpRequest();
99 xhr.onreadystatechange = function()
100 {
101 if(xhr.readyState == 4)
49 if(xhr.readyState == 4)
10250 {
10351 if(xhr.responseText == "empty")
104 {
105 a11ypi.clearMenu();
106 }
52 { }
10753 else
108 {
109 a11ypi.createMenuFilter(JSON.parse(xhr.responseText));
110 }
54 {
55 document.getElementById("see-narration").disabled = false;
56 document.getElementById("blog-filter").disabled = false;
57 document.getElementById("go").disabled = false;
58 a11ypi.showbox = JSON.parse(xhr.responseText);
59 }
11160 }
112 }
113 xhr.open("POST","http://localhost/menu",true);
114 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
115 d = window.location.search.split('?')[1];
116 var a =[];
117 for (var i = 0;i<d.split('&').length;i++){
118 a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1];
119 }
120 var url = a['foruri'];
121 var option = a['blog'];
122 data = 'url='+url+'&option='+option;
123 xhr.send(data) ;
12461 }
62 xhr.open("POST","http://y.a11y.in/menu",true);
63 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
64 xhr.send('url='+encodeURIComponent(window.location.href)) ;
12565 },
126
127 getURL: function(e) {
128 window.location = window.location.href + "&lang=" + e.value;
129 window.reload();
66 createDomainMenu: function() {
67 var xyz = document.getElementById("show-links");
68 xyz.innerHTML = "";
69 menu_list = a11ypi.showlinks;
70 for(var i=0; i<menu_list.length;i++)
71 {
72 var para = document.createElement("p");
73 var newel = document.createElement("a");
74 newel.textContent = menu_list[i];
75 newel.setAttribute("href", menu_list[i]);
76 para.appendChild(newel);
77 xyz.appendChild(para);
78 }
79 $('a').hover(
80 function() {
81 var xhr = new XMLHttpRequest();
82 xhr.onreadystatechange = function()
83 {
84 if(xhr.readyState == 4)
85 {
86 if(xhr.responseText == "empty")
87 { }
88 else
89 {
90 menu_list = JSON.parse(xhr.responseText);
91 for(i=0; i<menu_list.length; i++) {
92 x = document.createElement('span');
93 x.setAttribute('style', 'padding:15px;');
94 x.textContent = menu_list[i];
95 document.getElementById('show-links').appendChild(x);
96 }
97 $('span').tooltip();
98 }
99 }
100 }
101 xhr.open("POST","http://y.a11y.in/menu",true);
102 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
103 xhr.send('url='+encodeURIComponent($(this).attr('href'))) ;
104 },
105 function () {$('#show-links').find("span").remove();}
106 );
130107 },
131 ren: function()
132 {
108
109 ajaxLinks1: function() {
133110 var xhr = new XMLHttpRequest();
134111 xhr.onreadystatechange = function()
135112 {
136113 if(xhr.readyState == 4)
137 {
138 if(xhr.responseText =='empty')
139114 {
140 a11ypi.clearMenu();
141 alert("An internal server error occured, please try later.");
142 }
143 else
144 {
145
146 d ={};
147 var response=xhr.responseText.substring(3).split('###');
148 for (var j= 0; j< response.length ; j++){
149 chunk = response[j].substring(1).split('&');
150
151 for (var i= 0; i< chunk.length ; i++){
152 pair =chunk[i].split("::");
153 key = pair[0];
154 value = pair[1];
155 d[key] = value;
115 if(xhr.responseText == "empty")
116 { }
117 else
118 {
119 document.getElementById("see-links").disabled = false;
120 a11ypi.showlinks = JSON.parse(xhr.responseText);
156121 }
157 path = d['xpath'];
158 newContent = d['data'];
159 elementType = d['elementtype'];
160 a11ypi.evaluate(path,newContent,elementType);
161 }
162122 }
163 }
164123 }
165 d = window.location.search.split('?')[1];
166 var a =[];
167 for (var i = 0;i<d.split('&').length;i++){
168 a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1];
169 }
170 var url = a['foruri'];
171 var lang= a['lang'];
172 var data="url="+url+"&lang="+encodeURIComponent(lang);
173
174 xhr.open("POST","http://localhost/replace",true);
124 xhr.open("POST","http://y.a11y.in/domain",true);
175125 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
176 xhr.send(data);//
126 xhr.send('url='+encodeURIComponent(window.location.hostname));
177127 },
178 evaluate: function()
179 {
180 try{
181 var nodes = document.evaluate(path, document, null, XPathResult.ANY_TYPE,null);
182 }
183 catch(e)
184 {
185 console.log(e);
186 }
187 try{
188 var result = nodes.iterateNext();
189 while (result)
190 {
191 if (elementType == 'image')
192 {
193 result.setAttribute('src',newContent.split(',')[1]); //A hack to display images properly, the size has been saved in the database.
194 width = newContent.split(',')[0].split('x')[0];
195 height = newContent.split(',')[0].split('x')[1];
196 result.setAttribute('width',width);
197 result.setAttribute('height', height);
198 }
199 else if(elementType =='audio/ogg')
200 {
201 newContent = decodeURIComponent(newContent);
202 audio = '<audio controls="controls" src="'+newContent+'"></audio>';
203 $(result).before(audio);
204 }
205 else{
206 result.textContent = newContent;
207 }
208 result=nodes.iterateNext();
209 }
210 }
211 catch (e)
212 {
213 dump( 'error: Document tree modified during iteration ' + e );
214 }
128
129
130
131
132 editPage: function() {
133 a11ypi.testContext(); page_edit_nele('4seiz', '4l85060vb9', '336e2nootv6nxjsvyjov', 'VISUAL', 'false', '');
134 document.getElementById("renarrated_overlay").style.display = "none";
215135 },
216 close: function() {
217 document.getElementById('ren_overlay').style.display = 'none';
136
137 showBox: function() {
138 $(function() {
139 $( "#show-box" ).dialog( "destroy" );
140
141 $( "#show-box" ).dialog({
142 width: 300,
143 height: 300,
144 modal: true
145 });
146 });
147 a11ypi.createMenu(a11ypi.showbox);
218148 },
219 filter: function()
220 {
149
150 showBox1: function() {
151 $(function() {
152 $( "#show-links" ).dialog( "destroy" );
153
154 $( "#show-links" ).dialog({
155 width: 500,
156 height: 300,
157 modal: true
158 });
159 });
160 a11ypi.createDomainMenu();
161 },
162
163 blogFilter: function() {
164 if (a11ypi.blog_flag == false) {
165 a11ypi.blog_flag = true;
221166 var xhr = new XMLHttpRequest();
222167 xhr.onreadystatechange = function()
223168 {
224169 if(xhr.readyState == 4)
225 {
226 if(xhr.responseText =='empty')
227170 {
228 a11ypi.clearMenu();
229 alert("An internal server error occured, please try later.");
230 }
171 if(xhr.responseText == "empty")
172 { }
231173 else
232 {
233
234 d ={};
235 var response=xhr.responseText.substring(3).split('###');
236 for (var j= 0; j< response.length ; j++){
237 chunk = response[j].substring(1).split('&');
238
239 for (var i= 0; i< chunk.length ; i++){
240 pair =chunk[i].split("::");
241 key = pair[0];
242 value = pair[1];
243 d[key] = value;
174 {
175 var sel = document.getElementById("blog-filter");
176 var menu_list = JSON.parse(xhr.responseText);
177 blogArray = [];
178 for (var i=0; i< menu_list.length; i++)
179 {
180 blogArray[i] = menu_list[i].split("http://")[1].split(".com")[0] + ".com";
181 }
182 blogArray.sort();
183 for (var i=0; i < blogArray.length; i++)
184 {
185 if ( i == 0 )
186 {
187 opt = document.createElement("option");
188 opt.textContent = blogArray[0];
189 sel.appendChild(opt);
190 }
191 else if(blogArray[i] == blogArray[i-1])
192 { }
193 else
194 {
195 opt = document.createElement("option");
196 opt.textContent = blogArray[i];
197 sel.appendChild(opt);
198 }
199 }
244200 }
245 path = d['xpath'];
246 newContent = d['data'];
247 a11ypi.evaluate(path,newContent);
248 }
249201 }
250 }
251202 }
252 d = window.location.search.split('?')[1];
253 var a =[];
254 for (var i = 0;i<d.split('&').length;i++){
255 a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1];
256 }
257 var url = a['foruri'];
258 var lang= a['lang'];
259 var blog= a['blog'];
260 var data="url="+encodeURIComponent(url)+"&lang="+encodeURIComponent(lang)+"&blog="+encodeURIComponent(blog);
261
262 xhr.open("POST","http://localhost/filter",true);
203 xhr.open("POST","http://y.a11y.in/blog",true);
263204 xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
264 xhr.send(data);//
265 },
266 createMenuFilter: function(menu_list) {
267 var xyz = document.getElementById("menu-button");
268 for(var i in menu_list)
269 {
270 var newel = document.createElement("option");
271 newel.textContent = menu_list[i];
272 newel.setAttribute("value",menu_list[i]);
273 newel.setAttribute("onclick","a11ypi.getURLFilter(event.target);");
274 xyz.appendChild(newel);
205 xhr.send('url='+encodeURIComponent(window.location.href));
275206 }
276207 },
277 clearMenuFilter: function() {
278 var xyz = document.getElementById("menu-button");
279 while(null!= xyz.firstChild)
280 {
281 xyz.removeChild(xyz.firstChild);
208 go: function() {
209 if (document.getElementById("blog-filter").value == "Choose a blog name")
210 { }
211 else {
212 window.open("http://y.a11y.in/web?foruri=" + encodeURIComponent(window.location.href) + "&blog=" + document.getElementById("blog-filter").value);
282213 }
283214 },
284 getURLFilter: function(e) {
285 window.location = window.location.href + "&lang=" + e.value+"&interactive=1";
286 window.reload();
287 },
288215
289 checkbox: function() {
290 // alert("hi");
291 if(document.getElementById("our-check").checked == false) {
292 document.getElementById("our-check").checked = true;
293 document.getElementById("your-check").checked = false;
294 } else {
295 document.getElementById("our-check").checked = false;
296 document.getElementById("your-check").checked = true;
297 }
298 },
216 loadOverlay: function() {
217
218 body = document.body;
219
220 jq = document.createElement("script");
221 jq.setAttribute("type", "text/javascript");
222 jq.setAttribute("src", "http://code.jquery.com/jquery-1.7.min.js");
223 body.appendChild(jq);
224
225 jqlink = document.createElement("link");
226 jqlink.setAttribute("rel", "stylesheet");
227 jqlink.setAttribute("type", "text/css");
228 jqlink.setAttribute("href", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css");
229 body.appendChild(jqlink);
230
231 jscript = document.createElement("script");
232 jscript.setAttribute("type", "text/javascript");
233 jscript.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js");
234 body.appendChild(jscript);
235
236 overlay = document.createElement("div");
237 overlay.setAttribute("id", "renarrated_overlay");
238 overlay.setAttribute("class", "ui-widget-header ui-corner-all");
239 overlay.setAttribute("style", "position:fixed;top:0;width:80%;align:center;text-align:center;");
240 body.appendChild(overlay);
241
242 show_box = document.createElement("div");
243 show_box.setAttribute("id", "show-box");
244 show_box.title = "Please choose one of the languages";
245 body.appendChild(show_box);
246
247 show_links = document.createElement("div");
248 show_links.setAttribute("id", "show-links");
249 show_links.title = "Please choose one of the links";
250 body.appendChild(show_links);
251
252 edit_current = document.createElement("input");
253 edit_current.setAttribute("id", "edit-current");
254 edit_current.setAttribute("type", "submit");
255 edit_current.setAttribute("onclick", "a11ypi.editPage();");
256 edit_current.setAttribute("value", "Re-narrate this page");
257 overlay.appendChild(edit_current);
258
259 see_narration = document.createElement("input");
260 see_narration.setAttribute("id", "see-narration");
261 see_narration.setAttribute("type", "submit");
262 see_narration.setAttribute("onclick", "a11ypi.showBox();");
263 see_narration.setAttribute("value", "See other narrations");
264 see_narration.disabled = true;
265 overlay.appendChild(see_narration);
266 a11ypi.ajax1();
267
268 see_links = document.createElement("input");
269 see_links.setAttribute("id", "see-links");
270 see_links.setAttribute("type", "submit");
271 see_links.setAttribute("onclick", "a11ypi.showBox1();");
272 see_links.setAttribute("value", "Directory of narrations");
273 see_links.disabled = true;
274 overlay.appendChild(see_links);
275 a11ypi.ajaxLinks1();
276
277 blog_filter = document.createElement("select");
278 blog_filter.setAttribute("id", "blog-filter");
279 blog_filter.setAttribute("style", "min-width:200px;max-width:200px;");
280 blog_filter.setAttribute("onclick", "a11ypi.blogFilter();");
281 blog_option = document.createElement("option");
282 blog_option.textContent = "Choose a blog name";
283 blog_filter.appendChild(blog_option);
284 blog_filter.disabled = true;
285 overlay.appendChild(blog_filter);
286
287 go = document.createElement("input");
288 go.setAttribute("id", "go");
289 go.setAttribute("type", "submit");
290 go.setAttribute("onclick", "a11ypi.go();");
291 go.setAttribute("value", "Go");
292 go.disabled = true;
293 overlay.appendChild(go);
294},
295
299296};
297
298if (window.location.hostname != "y.a11y.in") {
299 $(document).load(a11ypi.loadOverlay());
300}
  
11function page_edit( boltSlug, pageSlug, uploadSlug, editMode, hasEditPermission, successUrl)
22{
33
4 var console, PopupControl, M4ImageElement,locName='',langName = '',styleName='',authorValue;
4 var console, PopupControl, M4ImageElement,locName='',langName = '',styleName='',authorValue,locSel='',langSel='';
55 var editAttributes, elementAttributes, fontTypeAttributes, normalFontAttributes, popupContainerAttributes, editButtonAttributes, editTextInputAttributes, editSubmitAttributes, editTitleAttributes, panelButtonAttributes, buttonPanelAttributes, actionPanelAttributes, closeButtonAttributes, actionButtonAttributes, redButtonAttributes, leftBorderStyle, rightBorderStyle, titleButtonImageAttributes, titleButtonDisplayTextAttributes, actionButtonImageAttributes, actionButtonDisplayTextAttributes,greyArrowAttributes, pageEditor, splashWindow, loadingTimerId, keepOriginal = false;
66
77 /**
4747 buffer.push(string);
4848 return this;
4949 };
50
50 console.log("inside buffer");
51 console.log(buffer);
5152 this.toString = function toString() {
5253 return buffer.join('');
5354 };
18081808 overlayBar.blogpost();
18091809 }
18101810 },
1811 close: function() {
1811 close: function() {
18121812 $( "#targetoverlay" ).hide();
18131813 },
18141814 });
1815 //$('.ui-dialog').hover(function() {
1816 // $(this).animate({
1817 // width: '700px'
1818 // }, 300);
1819 // },function() {
1820 // $(this).animate({
1821 // width: '500px'
1822 // }, 300);
1823 // });
18241815 });
1825
1816
18261817 $("#loc-bt").click(function () {
18271818 if(document.getElementById('loc-bt').value == '+'){
18281819 //remove input field and create a combo box
18291820 $('#loc-select').hide();
1830 //var suggst = ['Srilanka','su','sa'];
1821 var def_loc = ['Srilanka','Colombo','Moratuwa'];
18311822 locSel= document.createElement("select");
18321823 locSel.setAttribute("id","loct-select");
18331824 locSel.setAttribute("type","text");
18341825 locSel.setAttribute("alipielements", "alipi");
18351826 locSel.setAttribute("style","position:absolute;top:5%;left:40%;width:250px;");
1836 for(i=0;i<client_json.def_loc.length;i++){
1827 for(i=0;i<def_loc.length;i++){
18371828 locopt = document.createElement("option");
1838 theText=document.createTextNode(suggst[i]);
1829 theText=document.createTextNode(def_loc[i]);
18391830 locopt.appendChild(theText);
18401831 locSel.appendChild(locopt);
18411832 }
18491849 if(document.getElementById('lang-bt').value == '+'){
18501850 //remove input field and create a combo box
18511851 $('#lang-select').hide();
1852 //var suggst = ['Srilanka','su','sa'];
1852 var def_lang = ['Sinhala','Tamil','English'];
18531853 langSel= document.createElement("select");
18541854 langSel.setAttribute("id","langs-select");
18551855 langSel.setAttribute("type","text");
18561856 langSel.setAttribute("alipielements", "alipi");
18571857 langSel.setAttribute("style","position:absolute;top:25%;left:40%;width:250px;");
1858 for(i=0;i<client_json.def_lang.length;i++){
1858 for(i=0;i<def_lang.length;i++){
18591859 langopt = document.createElement("option");
1860 theText=document.createTextNode(client_json.def_lang[i]);
1860 theText=document.createTextNode(def_lang[i]);
18611861 langopt.appendChild(theText);
18621862 langSel.appendChild(langopt);
18631863 }
29602960 overlayDiv = document.createElement("div");
29612961 overlayDiv.setAttribute("id", "overlay-div");
29622962 overlayDiv.setAttribute("alipielements", "alipi");
2963 overlayDiv.setAttribute("style", "overflow:inherit; overflow-x:visible; position:fixed; z-index:2147483645; left:0; top:0; min-width:800px; width:100%; height:30px; background-color:rgba(0, 0, 0, 0.5);");
2963 overlayDiv.setAttribute("style", "position:fixed; z-index:1001; left:0; top:0; min-width:800px; width:100%; height:30px; background-color:rgba(0, 0, 0, 0.5);");
29642964 document.body.appendChild(overlayDiv);
29652965
29662966
29682968 image.setAttribute("id", "close-image");
29692969 image.setAttribute("alipielements", "alipi");
29702970 image.setAttribute("src", "http://dev.a11y.in/alipi/images/close_button.png");
2971 image.setAttribute("style", "position:relative;width:25px;height:28px;");
2971 image.setAttribute("style", "position:fixed;left:1px;width:25px;height:28px;");
29722972 overlayDiv.appendChild(image);
29732973 image.onclick=function(){
29742974 answer = confirm("Do you really want to exit the editor?")
29822982 messageDiv = document.createElement("div");
29832983 messageDiv.setAttribute("id", "message-div");
29842984 messageDiv.setAttribute("alipielements", "alipi");
2985 messageDiv.setAttribute("style", "position:relative;left:150px;bottom:26px;font-size:23px;font-weight:bold;color:#ffe;");
2985 messageDiv.setAttribute("style", "position:fixed;left:10%;top:0;font-size:23px;font-weight:bold;color:#ffe;");
29862986 overlayDiv.appendChild(messageDiv);
29872987
29882988 helpLink = document.createElement("input");
29902990 helpLink.setAttribute("alipielements", "alipi");
29912991 helpLink.setAttribute("type", "submit");
29922992 helpLink.setAttribute("Value", "Help");
2993 helpLink.setAttribute("style", "position:relative;top:-55px;left:750px;font-size:18px;font-weight:bold;width:100px;height:30px;");
2993 helpLink.setAttribute("style", "position:fixed;top:0;right:35%;font-size:18px;font-weight:bold;width:100px;height:30px;");
29942994 overlayDiv.appendChild(helpLink);
29952995 helpLink.onclick = function helpLinkOnClick() {
29962996 helpWindow = new HelpWindow(pageEditor);
30053005 undoButton.setAttribute("alipielements", "alipi");
30063006 undoButton.setAttribute("type", "submit");
30073007 undoButton.setAttribute("Value", "Undo");
3008 undoButton.setAttribute("style", "position:relative;top:-55px;left:825px;font-size:18px;font-weight:bold;width:100px;height:30px;");
3008 undoButton.setAttribute("style", "position:fixed;top:0;right:20%;font-size:18px;font-weight:bold;width:100px;height:30px;");
30093009 overlayDiv.appendChild(undoButton);
30103010 undoButton.onclick = function undoButtonOnClick() {
30113011 pageEditor.commandUndo();
30183018 publishButton.setAttribute("alipielements", "alipi");
30193019 publishButton.setAttribute("type", "submit");
30203020 publishButton.setAttribute("Value", "Publish");
3021 publishButton.setAttribute("style", "position:relative;top:-55px;left:900px;font-size:18px;font-weight:bold;width:100px;height:30px;");
3021 publishButton.setAttribute("style", "position:fixed;top:0;right:5%;font-size:18px;font-weight:bold;width:100px;height:30px;");
30223022 overlayDiv.appendChild(publishButton);
30233023 var dialog = 0;
30243024 publishButton.onclick = function publishButtonOnClick() {
30373037
30383038
30393039 this.blogpost = function blogpost() {
3040 if (locName.value == "" || langName.value == "" || styleSelect.value == "" || author.value == "" || (ourcheck.checked == false && yourcheck.checked == false)) {
3040 console.log("locSel.value");
3041 console.log(locSel.value);
3042 console.log("langSel.value");
3043 console.log(langSel.value);
3044 if (styleSelect.value == "" || author.value == "" ||(ourcheck.checked == false && yourcheck.checked == false) || locName.value == "" && document.getElementById('loct-select') === null || langName.value == "" && document.getElementById('langs-select') === null){
30413045 alert("Please give all the details, it will be used further");
3042 } else {
3046 } else {
30433047 pageEditor.commandPublish();
30443048 pageEditor.showMessage("... Please wait, your blog is being posted");
30453049 $('#targetoverlay').remove();
30523052 // End of okButton function
30533053
30543054 this.show = function show(activate) {
3055 // overlayDiv.style.display = 'block';
30563055 var disabled = true;
30573056 var opacity = '0.4';
30583057 if (activate) {
31563156 switch (event.keyCode) {
31573157 case 27:
31583158 // ESC
3159 event.preventDefault();
3160 event.stopPropagation();
3161 pageEditor.close();
3162 return false;
3159 // event.preventDefault();
3160 // event.stopPropagation();
3161 // pageEditor.close();
3162 // return false;
31633163 // case 77:
31643164 // // "m"
31653165 // if (pageEditor.hasFocus()) {
33543354
33553355 this.publish = function publish() {
33563356 var result;
3357 if(document.getElementById('our-check').checked)
3357 if(document.getElementById('your-check').checked && window.location.hostname !='y.a11y.in')
33583358 {
33593359 localStorage.myContent = buildDataString();
33603360 window.location.href = "http://localhost/test.html";
34183418 buffer.append('about='); //url=about //removed '&' on purpose
34193419 buffer.append(window.location.search.split('=')[1]);
34203420 buffer.append('&lang=');//lang
3421 buffer.append(encodeURIComponent(langName.value));
3421 if (langName.value != "")
3422 buffer.append(encodeURIComponent(langName.value));
3423 else
3424 buffer.append(encodeURIComponent(langSel.value));
34223425 buffer.append('&location=');//location
3423 buffer.append(encodeURIComponent(locName.value));
3426 if (locName.value != "")
3427 buffer.append(encodeURIComponent(locName.value));
3428 else
3429 buffer.append(encodeURIComponent(locSel.value));
34243430 buffer.append('&style=');//style
34253431 buffer.append(encodeURIComponent(styleSelect.value));
34263432 buffer.append('&blog='); //blog where to post
35273527 // passthrough
35283528 } else if (event.target.getAttribute('m4pageedittype')) {
35293529 // passthrough
3530 } else if (event.target.id == "lang-select" || event.target.id == "loc-select" || alipiElements) {
3530 } else if (event.target.id == "lang-select" || event.target.id == "loc-select" || event.target.id == "loc-bt" || event.target.id == "lang-bt" || alipiElements) {
35313531 // passthrough
35323532 } else if (event.clientX > document.body.clientWidth || event.clientY > document.body.clientHeight) {
35333533 // passthrough if this click was outside of the html page, meaning on a scrollbar