| | | | 1 | function page_edit( boltSlug, pageSlug, uploadSlug, editMode, hasEditPermission, successUrl) | | function page_edit( boltSlug, pageSlug, uploadSlug, editMode, hasEditPermission, successUrl) |
---|
| | 1 | function page_edit_client( boltSlug, pageSlug, uploadSlug, editMode, hasEditPermission, successUrl) | 2 | { | 2 | { |
---|
3 | | 3 | |
---|
4 | var console, PopupControl, M4ImageElement,locName='',langName = '',styleName='',authorValue; | 4 | var console, PopupControl, M4ImageElement,locName='',langName = '',styleName='',authorValue; |
---|
… | | … | |
---|
1120 | path = "/" + xname + path; | 1120 | path = "/" + xname + path; |
---|
1121 | } | 1121 | } |
---|
1122 | } | 1122 | } |
---|
| | 1123 | console.log(path); |
---|
1123 | return path; | 1124 | return path; |
---|
1124 | }; | 1125 | }; |
---|
1125 | | 1126 | |
---|
… | | … | |
---|
1176 | path = DOM.makePath(currentNode.parentNode); | 1176 | path = DOM.makePath(currentNode.parentNode); |
---|
1177 | } | 1177 | } |
---|
1178 | | 1178 | |
---|
1179 | | | |
---|
| | 1179 | console.log(path); | 1180 | return path; | 1180 | return path; |
---|
1181 | }; | 1181 | }; |
---|
1182 | | 1182 | |
---|
… | | … | |
---|
1749 | author.setAttribute("style","position:absolute;top:65%;left:40%;width:250px;"); | 1749 | author.setAttribute("style","position:absolute;top:65%;left:40%;width:250px;"); |
---|
1750 | target.appendChild(author); | 1750 | target.appendChild(author); |
---|
1751 | | 1751 | |
---|
1752 | ourcheck = document.createElement("input"); | | ourcheck = document.createElement("input"); |
---|
1753 | ourcheck.setAttribute("id","your-check"); | | ourcheck.setAttribute("id","your-check"); |
---|
1754 | ourcheck.setAttribute("type","radio"); | | ourcheck.setAttribute("type","radio"); |
---|
1755 | ourcheck.setAttribute("name", "blog"); | | ourcheck.setAttribute("name", "blog"); |
---|
1756 | ourcheck.setAttribute("alipielements", "alipi"); | | ourcheck.setAttribute("alipielements", "alipi"); |
---|
1757 | ourcheck.setAttribute("style","position:absolute;top:85%;left:40%;"); | | ourcheck.setAttribute("style","position:absolute;top:85%;left:40%;"); |
---|
1758 | target.appendChild(ourcheck); | | target.appendChild(ourcheck); |
---|
1759 | | | |
---|
1760 | yourcheck = document.createElement("input"); | 1752 | yourcheck = document.createElement("input"); |
---|
1761 | yourcheck.setAttribute("id","our-check"); | | yourcheck.setAttribute("id","our-check"); |
---|
| | 1753 | yourcheck.setAttribute("id","your-check"); | 1762 | yourcheck.setAttribute("type","radio"); | 1754 | yourcheck.setAttribute("type","radio"); |
---|
1763 | yourcheck.setAttribute("name", "blog"); | 1755 | yourcheck.setAttribute("name", "blog"); |
---|
1764 | yourcheck.setAttribute("alipielements", "alipi"); | 1756 | yourcheck.setAttribute("alipielements", "alipi"); |
---|
1765 | yourcheck.setAttribute("style","position:absolute;top:85%;left:70%;"); | | yourcheck.setAttribute("style","position:absolute;top:85%;left:70%;"); |
---|
| | 1757 | yourcheck.setAttribute("style","position:absolute;top:85%;left:40%;"); | 1766 | target.appendChild(yourcheck); | 1758 | target.appendChild(yourcheck); |
---|
| | 1759 | yourcheck.disabled = true; |
---|
| | 1760 | |
---|
| | 1761 | ourcheck = document.createElement("input"); |
---|
| | 1762 | ourcheck.setAttribute("id","our-check"); |
---|
| | 1763 | ourcheck.setAttribute("type","radio"); |
---|
| | 1764 | ourcheck.setAttribute("name", "blog"); |
---|
| | 1765 | ourcheck.setAttribute("alipielements", "alipi"); |
---|
| | 1766 | ourcheck.setAttribute("style","position:absolute;top:85%;left:70%;"); |
---|
| | 1767 | target.appendChild(ourcheck); |
---|
1767 | | 1768 | |
---|
1768 | yourLabel = document.createElement('label'); | 1769 | yourLabel = document.createElement('label'); |
---|
1769 | yourLabel.textContent = "Your blog"; | 1770 | yourLabel.textContent = "Your blog"; |
---|
… | | … | |
---|
1781 | locButton.setAttribute("title","Set your preferred location"); | 1781 | locButton.setAttribute("title","Set your preferred location"); |
---|
1782 | locButton.value="+"; | 1782 | locButton.value="+"; |
---|
1783 | locButton.setAttribute("type","button"); | 1783 | locButton.setAttribute("type","button"); |
---|
1784 | locButton.setAttribute("style","position:absolute;top:5%;left:90%;width:20px;"); | | locButton.setAttribute("style","position:absolute;top:5%;left:90%;width:20px;"); |
---|
| | 1784 | locButton.setAttribute("style","position:absolute;top:6%;right:4%;width:20px;"); | 1785 | locButton.setAttribute("alipielements", "alipi"); | 1785 | locButton.setAttribute("alipielements", "alipi"); |
---|
1786 | //locButton.setAttribute("type","button"); | 1786 | //locButton.setAttribute("type","button"); |
---|
1787 | if (window.location.hostname != '127.0.0.1') { | 1787 | if (window.location.hostname != '127.0.0.1') { |
---|
… | | … | |
---|
1793 | langButton.setAttribute("title","Set your preferred location"); | 1793 | langButton.setAttribute("title","Set your preferred location"); |
---|
1794 | langButton.value="+"; | 1794 | langButton.value="+"; |
---|
1795 | langButton.setAttribute("type","button"); | 1795 | langButton.setAttribute("type","button"); |
---|
1796 | langButton.setAttribute("style","position:absolute;top:25%;left:90%;width:20px;"); | | langButton.setAttribute("style","position:absolute;top:25%;left:90%;width:20px;"); |
---|
| | 1796 | langButton.setAttribute("style","position:absolute;top:26%;right:4%;width:20px;"); | 1797 | langButton.setAttribute("alipielements", "alipi"); | 1797 | langButton.setAttribute("alipielements", "alipi"); |
---|
1798 | //locButton.setAttribute("type","button"); | 1798 | //locButton.setAttribute("type","button"); |
---|
1799 | if (window.location.hostname != '127.0.0.1') { | 1799 | if (window.location.hostname != '127.0.0.1') { |
---|
… | | … | |
---|
1823 | if(document.getElementById('loc-bt').value == '+'){ | 1823 | if(document.getElementById('loc-bt').value == '+'){ |
---|
1824 | //remove input field and create a combo box | 1824 | //remove input field and create a combo box |
---|
1825 | $('#loc-select').hide(); | 1825 | $('#loc-select').hide(); |
---|
1826 | var def_loc = ['Srilanka','su','sa']; | | var def_loc = ['Srilanka','su','sa']; |
---|
1827 | locSel = document.createElement("select"); | | locSel = document.createElement("select"); |
---|
| | 1826 | locSel = document.createElement("select"); | 1828 | locSel.setAttribute("id","loct-select"); | 1827 | locSel.setAttribute("id","loct-select"); |
---|
1829 | locSel.setAttribute("type","text"); | 1828 | locSel.setAttribute("type","text"); |
---|
1830 | locSel.setAttribute("alipielements", "alipi"); | 1829 | locSel.setAttribute("alipielements", "alipi"); |
---|
1831 | locSel.setAttribute("style","position:absolute;top:5%;left:40%;width:250px;"); | 1830 | locSel.setAttribute("style","position:absolute;top:5%;left:40%;width:250px;"); |
---|
1832 | for(i=0;i<def_loc.length;i++){ | | for(i=0;i<def_loc.length;i++){ |
---|
| | 1831 | for(i=0;i<client_json.def_loc.length;i++){ | 1833 | locopt = document.createElement("option"); | 1832 | locopt = document.createElement("option"); |
---|
1834 | theText=document.createTextNode(def_loc[i]); | | theText=document.createTextNode(def_loc[i]); |
---|
| | 1833 | theText=document.createTextNode(client_json.def_loc[i]); | 1835 | locopt.appendChild(theText); | 1834 | locopt.appendChild(theText); |
---|
1836 | locSel.appendChild(locopt); | 1835 | locSel.appendChild(locopt); |
---|
1837 | } | 1836 | } |
---|
… | | … | |
---|
1851 | if(document.getElementById('lang-bt').value == '+'){ | 1851 | if(document.getElementById('lang-bt').value == '+'){ |
---|
1852 | //remove input field and create a combo box | 1852 | //remove input field and create a combo box |
---|
1853 | $('#lang-select').hide(); | 1853 | $('#lang-select').hide(); |
---|
1854 | var def_lang = ['Srilanka','su','sa']; | | var def_lang = ['Srilanka','su','sa']; |
---|
1855 | langSel= document.createElement("select"); | 1854 | langSel= document.createElement("select"); |
---|
1856 | langSel.setAttribute("id","langs-select"); | 1855 | langSel.setAttribute("id","langs-select"); |
---|
1857 | langSel.setAttribute("type","text"); | 1856 | langSel.setAttribute("type","text"); |
---|
1858 | langSel.setAttribute("alipielements", "alipi"); | 1857 | langSel.setAttribute("alipielements", "alipi"); |
---|
1859 | langSel.setAttribute("style","position:absolute;top:25%;left:40%;width:250px;"); | 1858 | langSel.setAttribute("style","position:absolute;top:25%;left:40%;width:250px;"); |
---|
1860 | for(i=0;i<def_lang.length;i++){ | | for(i=0;i<def_lang.length;i++){ |
---|
| | 1859 | for(i=0;i<client_json.def_lang.length;i++){ | 1861 | langopt = document.createElement("option"); | 1860 | langopt = document.createElement("option"); |
---|
1862 | theText=document.createTextNode(def_lang[i]); | | theText=document.createTextNode(def_lang[i]); |
---|
| | 1861 | theText=document.createTextNode(client_json.def_lang[i]); | 1863 | langopt.appendChild(theText); | 1862 | langopt.appendChild(theText); |
---|
1864 | langSel.appendChild(langopt); | 1863 | langSel.appendChild(langopt); |
---|
1865 | } | 1864 | } |
---|
… | | … | |
---|
1878 | | 1878 | |
---|
1879 | | 1879 | |
---|
1880 | $( "#loc-select" ).autocomplete({ | 1880 | $( "#loc-select" ).autocomplete({ |
---|
1881 | source: function(req, add){ | | source: function(req, add){ |
---|
| | 1881 | source: function(req, add){ | 1882 | | 1882 | |
---|
1883 | //pass request to server | | //pass request to server |
---|
1884 | $.getJSON("http://localhost/getData?", req, function(data) { | | $.getJSON("http://localhost/getData?", req, function(data) { |
---|
1885 | //create array for response objects | | //create array for response objects |
---|
1886 | var suggestions = []; | | var suggestions = []; |
---|
| | 1883 | //pass request to server | | | 1884 | $.getJSON("http://y.a11y.in/loc?", req, function(data) { |
---|
| | 1885 | //create array for response objects |
---|
| | 1886 | var suggestions = []; |
---|
1887 | | 1887 | |
---|
1888 | //process response | | //process response |
---|
1889 | $.each(data, function(i, val){ | | $.each(data, function(i, val){ |
---|
1890 | //suggestions.push(val.country); | | //suggestions.push(val.country); |
---|
1891 | for(i=0;i<val.length;i++){ | | for(i=0;i<val.length;i++){ |
---|
1892 | suggestions.push(val[i]+', '+val[i+1]+', '+val[i+2]); | | suggestions.push(val[i]+', '+val[i+1]+', '+val[i+2]); |
---|
1893 | i +=2; | | i +=2; |
---|
1894 | } | | } |
---|
1895 | }); | | }); |
---|
| | 1888 | //process response | | | 1889 | $.each(data, function(i, val){ |
---|
| | 1890 | for(i=0;i<val.length;i++){ |
---|
| | 1891 | suggestions.push(val[i]); |
---|
| | 1892 | } |
---|
| | 1893 | }); |
---|
1896 | | 1894 | |
---|
1897 | //pass array to callback | | //pass array to callback |
---|
1898 | add(suggestions); | | add(suggestions); |
---|
1899 | }); | | }); |
---|
1900 | }, | | }, |
---|
1901 | }); | | }); |
---|
| | 1895 | //pass array to callback | | | 1896 | add(suggestions); |
---|
| | 1897 | }); |
---|
| | 1898 | }, |
---|
| | 1899 | }); |
---|
1902 | | 1900 | |
---|
1903 | $( "#lang-select" ).autocomplete({ | 1901 | $( "#lang-select" ).autocomplete({ |
---|
1904 | source: function(req, add){ | | source: function(req, add){ |
---|
| | 1902 | source: function(req, add){ | 1905 | | 1903 | |
---|
1906 | //pass request to server | | //pass request to server |
---|
1907 | $.getJSON("http://localhost/getLang?", req, function(data) { | | $.getJSON("http://localhost/getLang?", req, function(data) { |
---|
| | 1904 | //pass request to server | | | 1905 | $.getJSON("http://y.a11y.in/lang?", req, function(data) { |
---|
1908 | | 1906 | |
---|
1909 | //create array for response objects | | //create array for response objects |
---|
1910 | var suggestions = []; | | var suggestions = []; |
---|
| | 1907 | //create array for response objects | | | 1908 | var suggestions = []; |
---|
1911 | | 1909 | |
---|
1912 | //process response | | //process response |
---|
1913 | $.each(data, function(i, val){ | | $.each(data, function(i, val){ |
---|
1914 | //suggestions.push(val.country); | | //suggestions.push(val.country); |
---|
1915 | for(i=0;i<val.length;i++){ | | for(i=0;i<val.length;i++){ |
---|
1916 | suggestions.push(val[i]); | | suggestions.push(val[i]); |
---|
1917 | } | | } |
---|
1918 | }); | | }); |
---|
| | 1910 | //process response | | | 1911 | $.each(data, function(i, val){ |
---|
| | 1912 | //suggestions.push(val.country); |
---|
| | 1913 | for(i=0;i<val.length;i++){ |
---|
| | 1914 | suggestions.push(val[i]); |
---|
| | 1915 | } |
---|
| | 1916 | }); |
---|
1919 | | 1917 | |
---|
1920 | //pass array to callback | | //pass array to callback |
---|
1921 | add(suggestions); | | add(suggestions); |
---|
1922 | }); | | }); |
---|
1923 | }, | | }, |
---|
1924 | }); | | }); |
---|
| | 1918 | //pass array to callback | | | 1919 | add(suggestions); |
---|
| | 1920 | }); |
---|
| | 1921 | }, |
---|
| | 1922 | }); |
---|
1925 | | 1923 | |
---|
1926 | | 1924 | |
---|
1927 | | 1925 | |
---|
… | | … | |
---|
2263 | } | 2263 | } |
---|
2264 | } | 2264 | } |
---|
2265 | } | 2265 | } |
---|
2266 | xmlhttp.open("POST","http://localhost/narration",true); | | xmlhttp.open("POST","http://localhost/narration",true); |
---|
| | 2266 | xmlhttp.open("POST","http://y.a11y.in/narration",true); | 2267 | xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | 2267 | xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); |
---|
2268 | xmlhttp.send(data); | 2268 | xmlhttp.send(data); |
---|
2269 | | 2269 | |
---|
… | | … | |
---|
3346 | | 3346 | |
---|
3347 | this.publish = function publish() { | 3347 | this.publish = function publish() { |
---|
3348 | var result; | 3348 | var result; |
---|
3349 | if(document.getElementById('our-check').checked) | | if(document.getElementById('our-check').checked) |
---|
| | 3349 | if(document.getElementById('your-check').checked) | 3350 | { | 3350 | { |
---|
3351 | localStorage.myContent = buildDataString(); | 3351 | localStorage.myContent = buildDataString(); |
---|
3352 | window.location.href = "http://localhost/test.html"; | | window.location.href = "http://localhost/test.html"; |
---|
| | 3352 | window.location.href = "http://y.a11y.in/test.html"; | 3353 | window.reload(); | 3353 | window.reload(); |
---|
3354 | } | 3354 | } |
---|
3355 | else | 3355 | else |
---|
3356 | { | 3356 | { |
---|
3357 | AJAX.post('http://localhost/test', buildDataString(), function(result) { | | AJAX.post('http://localhost/test', buildDataString(), function(result) { |
---|
| | 3357 | AJAX.post('http://y.a11y.in/test', buildDataString(), function(result) { | 3358 | ajaxResultProcessor.processPublishedResponse(result); | 3358 | ajaxResultProcessor.processPublishedResponse(result); |
---|
3359 | }); | 3359 | }); |
---|
3360 | } | 3360 | } |
---|
… | | … | |
---|
3408 | UTIL.forEach(history, function(index, command) { | 3408 | UTIL.forEach(history, function(index, command) { |
---|
3409 | buffer.append('###'); //separates the commands | 3409 | buffer.append('###'); //separates the commands |
---|
3410 | buffer.append('about='); //url=about //removed '&' on purpose | 3410 | buffer.append('about='); //url=about //removed '&' on purpose |
---|
3411 | buffer.append(window.location.search.split('=')[1]); | | buffer.append(window.location.search.split('=')[1]); |
---|
| | 3411 | buffer.append(window.location.href); | 3412 | buffer.append('&lang=');//lang | 3412 | buffer.append('&lang=');//lang |
---|
3413 | if (langName.value != "" ) | 3413 | if (langName.value != "" ) |
---|
3414 | buffer.append(encodeURIComponent(langName.value)); | 3414 | buffer.append(encodeURIComponent(langName.value)); |
---|