From f7e74a732f711e2d3f885d513080ad90936ec976 Mon Sep 17 00:00:00 2001 From: Arvind Date: Thu, 27 Jun 2013 17:44:23 +0530 Subject: [PATCH] Removing choose blog option from the UI --- alipi/ui.js | 132 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 56 deletions(-) diff --git a/alipi/ui.js b/alipi/ui.js index da4d0f3..abc5d04 100644 --- a/alipi/ui.js +++ b/alipi/ui.js @@ -68,7 +68,7 @@ var a11ypi = { { a11ypi.showbox = data; $('#see-narration').show(); - $("#blog-filter").show(); a11ypi.blogFilter(); + // $("#blog-filter").show(); a11ypi.blogFilter(); $("#go").show(); }); @@ -85,28 +85,35 @@ var a11ypi = { if(a11ypi.fflag == '0') { a11ypi.fflag = 1; - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() - { - if(xhr.readyState == 4) - { - if(xhr.responseText == "empty") - { - // a11ypi.clearMenu(); - } - else - { - a11ypi.createMenuFilter(JSON.parse(xhr.responseText)); - } - } - } - xhr.open("POST",config.root+"/menu",true); - xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - a = a11ypi.getParams(); - data = 'url='+a['foruri']+'&option='+a['blog']; - xhr.send(data) ; + // var xhr = new XMLHttpRequest(); + // xhr.onreadystatechange = function() + // { + // if(xhr.readyState == 4) + // { + // if(xhr.responseText == "empty") + // { + // // a11ypi.clearMenu(); + // } + // else + // { + // a11ypi.createMenuFilter(JSON.parse(xhr.responseText)); + // } + // } + // } + // xhr.open("POST",config.deploy+"/menu",true); + // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); + // a = a11ypi.getParams(); + // data = 'url='+a['foruri']+'&option='+a['blog']; + // xhr.send(data) ; + // } + var request = {}; + request['url'] = a['foruri']; + request['option'] = a['blog']; + $.get(config.deploy+"/menu", {"url":a["foruri"], "option":a['blog']}, function(data){ + a11ypi.createMenuFilter(JSON.parse(data)); + + }); } - }, getURL: function(e) { @@ -322,8 +329,8 @@ var a11ypi = { // '5el'+ ''+ - ''+ - ''+ + // ''+ + // ''+ '
'+ '
'+ ' '+ @@ -727,38 +734,51 @@ var a11ypi = { function () {$('#show-links').title= '';} ); }, - blogFilter: function() { - if (a11ypi.blog_flag == false) { - a11ypi.blog_flag = true; - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() - { - if(xhr.readyState == 4) - { - if(xhr.responseText == "empty") - { } - else - { - var sel = $("#blog-filter"); - var menu_list = JSON.parse(xhr.responseText); - opt = document.createElement("option"); - opt.textContent = "Choose a blog"; - sel.append(opt); - for (var i=0; i < menu_list.length; i++) - { - opt = document.createElement("option"); - opt.textContent = menu_list[i]; - sel.append(opt); - } - } - } - } - xhr.open("POST",config.root+"/blog",true); - xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - a = a11ypi.getParams(); - xhr.send('url='+a['foruri']); - } - }, + // blogFilter: function() { + // if (a11ypi.blog_flag == false) { + // a11ypi.blog_flag = true; + // // var xhr = new XMLHttpRequest(); + // // xhr.onreadystatechange = function() + // // { + // // if(xhr.readyState == 4) + // // { + // // if(xhr.responseText == "empty") + // // { } + // // else + // // { + // // var sel = $("#blog-filter"); + // // var menu_list = JSON.parse(xhr.responseText); + // // opt = document.createElement("option"); + // // opt.textContent = "Choose a blog"; + // // sel.append(opt); + // // for (var i=0; i < menu_list.length; i++) + // // { + // // opt = document.createElement("option"); + // // opt.textContent = menu_list[i]; + // // sel.append(opt); + // // } + // // } + // // } + // // } + // // xhr.open("POST",config.deploy+"/blog",true); + // // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); + // // a = a11ypi.getParams(); + // // xhr.send('url='+a['foruri']); + // $.get(config.deploy+"/blog", {"url":a['foruri']}, function(data){ + // var sel = $("#blog-filter"); + // var menu_list = JSON.parse(data); + // opt = document.createElement("option"); + // opt.textContent = "Choose a blog"; + // sel.append(opt); + // for (var i=0; i < menu_list.length; i++) + // { + // opt = document.createElement("option"); + // opt.textContent = menu_list[i]; + // sel.append(opt); + // } + // }); + // } + // }, go: function() { var a =[]; for (var i = 0;i