From dad095b7f02422e98c16f9895024fef43b4d8a40 Mon Sep 17 00:00:00 2001 From: Arvind Date: Tue, 21 Jan 2014 11:49:56 +0530 Subject: [PATCH] Bug fixes and library update - Updating the code to jquery UI 1.10.3 version. - Removing pageEditor.js and adding code to ui.js --- alipi/ui.js | 2873 ++++++++++++++++++++++++++++++++++++----------------------- assets.yaml | 1 - 2 files changed, 1738 insertions(+), 1136 deletions(-) diff --git a/alipi/ui.js b/alipi/ui.js index 9680eab..7f1656e 100644 --- a/alipi/ui.js +++ b/alipi/ui.js @@ -1,1140 +1,1743 @@ //-*-coding: utf-8 -*- -var a11ypi = { - auth : " ", - loc:" ", - elementTagName: " ", - elementId: " ", - flag : 0, - fflag : 0, - showbox : 0, - showlinks : 0, - blog_flag: false, - target : false, - pageHtml:'', - d: {}, - responseJSON:'', - testContext : function() - { - if(document.getElementById('social_overlay') != null) - document.body.removeChild(document.getElementById('social_overlay')); - $(document).ready(function(){ - try{ - $('body *').not('iframe').contents().filter(function(){ - try{ - - if(this.nodeType == 3 && !($(this).hasClass('alipi'))){ - return (this.nodeType == 3) && this.nodeValue.match(/\S/);}} - catch(err){ - console.log(err); - } - }).parent().attr('m4pageedittype','text'); - } - catch(e){ - console.log(this); - } - }); - - vimg = document.getElementsByTagName('img'); - for(i=0; i'; - $(result).before(audio); - result.setAttribute('class','blink'); - } - else{ - result.innerHTML = a['data']; - result.setAttribute('class','blink'); - } - result=nodes.iterateNext(); - } - } - catch (e) - { - // dump( 'error: Document tree modified during iteration ' + e ); - } - } - else if(a['type']=='5el') - { - - try{ - var result = nodes.iterateNext(); - while (result) - { - $(result).html($(result).html()+a['data']); - $(result).get(0).scrollIntoView(); - result=nodes.iterateNext(); - } - } - catch (e) - { - //dump( 'error: Document tree modified during iteration ' + e ); - } - } - }, - filter: function() - { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() - { - if(xhr.readyState == 4) - { - if(xhr.responseText =='empty') - { - // a11ypi.clearMenu(); - // alert("An internal server error occured, please try later."); - } - else - { - - d ={}; - var response=xhr.responseText.substring(3).split('###'); - for (var j= 0; j< response.length ; j++){ - chunk = response[j].substring(1).split('&'); - - for (var i= 0; i< chunk.length ; i++){ - pair =chunk[i].split("::"); - key = pair[0]; - value = pair[1]; - d[key] = value; - } - path = d['xpath']; - newContent = d['data']; - elementType = d['elementtype']; - a11ypi.evaluate(path,newContent,elementType); - } - } - } - } - a = a11ypi.getParams(); - var url = a['foruri']; - var lang= a['lang']; - var blog= a['blog']; - var data="url="+url+"&lang="+encodeURIComponent(lang)+"&blog="+encodeURIComponent(blog); - - xhr.open("POST",config.root+"/filter",true); - xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - xhr.send(data);// - }, - createMenuFilter: function(menu_list) { - var xyz = document.getElementById("show-box"); - xyz.innerHTML = ''; - d = window.location.search.split('?')[1]; - a = a11ypi.getParams(); - var page = a['foruri']; - var blog = a['blog']; - for(var i=0;iMove '+ - ' '+ - ' '+ - ''+ - // ''+ - ''+ - // ''+ - ''+ - '
'+ - '
'+ - ' '+ - '
'; - - var pub_overlay_template = '
'+ - ''+ //▲ - ''+ //▼ - ''+ - ''+ - ''+ - '
'; - - var element_edit_overlay_template = '
'+ - ''+ - ''+ - ''+ - ''+ - ''+ - ' '+ - '
'; - - $('body').append(overlay_template); - $('body').append(pub_overlay_template); - $('body').append(element_edit_overlay_template); - - $('#outter-up-button').show(); - $('#go').button({disabled : true}); - $('#undo-button').button({ disabled: true}); - $('#publish-button').button({ disabled: true}); - $('input[class="alipi"], select[class="alipi"]').button(); - - $("#outter-down-button").button({icons:{primary:"ui-icon-circle-arrow-n"},text:false}); $('#outter-down-button').children().addClass('alipi'); - $("#outter-up-button").button({icons:{primary:"ui-icon-circle-arrow-s"},text:false}); $('#outter-up-button').children().addClass('alipi'); - $("#edit-current").button({icons:{primary:"ui-icon-pencil"}}); $('#edit-current').children().addClass('alipi'); - $("#see-narration").button({icons:{primary:"ui-icon-document-b"}}); $('#see-narration').children().addClass('alipi'); - $("#see-comment").button({icons:{primary:"ui-icon-document-b"}}); $('#see-comment').children().addClass('alipi'); - $("#see-links").button({icons:{primary:"ui-icon-link"}}); $('#see-links').children().addClass('alipi'); - /*$("#blog-filter").button({icons:{secondary:"ui-icon-triangle-1-s"}}); */ $('#blog-filter').children().addClass('alipi'); - $("#go").button({icons:{primary:"ui-icon-arrowthick-1-e"},text:false}); $('#go').children().addClass('alipi'); - $("#share").button({icons:{primary:"ui-icon-signal-diag"}}); $('#share').children().addClass('alipi'); - $("#orig-button").button({icons:{primary:"ui-icon-extlink"}}); $('#orig-button').children().addClass('alipi'); - $("#info").button({icons:{primary:"ui-icon-info"}}); $('#info').children().addClass('alipi'); - - $("#icon-up").button({icons:{primary:"ui-icon-circle-arrow-n"},text:false}); $('#icon-up').children().addClass('alipi'); - $("#icon-down").button({icons:{primary:"ui-icon-circle-arrow-s"},text:false}); $('#icon-down').children().addClass('alipi'); - $("#exit-mode").button({icons:{primary:"ui-icon-power"}}); $('#exit-mode').children().addClass('alipi'); - $("#help-window").button({icons:{primary:"ui-icon-help"}}); $('#help-window').children().addClass('alipi'); - $("#undo-button").button({icons:{primary:"ui-icon-arrowreturnthick-1-w"}}); $('#undo-button').children().addClass('alipi'); - $("#publish-button").button({icons:{primary:"ui-icon-circle-check"}}); $('#publish-button').children().addClass('alipi'); - - $("#edit-text").button({icons:{primary:"ui-icon-pencil"}}); $('#edit-text').children().addClass('alipi'); - $("#add-audio").button({icons:{primary:"ui-icon-circle-plus"}}); $('#add-audio').children().addClass('alipi'); - $("#replace-image").button({icons:{primary:"ui-icon-transferthick-e-w"}}); $('#replace-image').children().addClass('alipi'); - $("#delete-image").button({icons:{primary:"ui-icon-trash"}}); $('#delete-image').children().addClass('alipi'); - $("#close-element").button({icons:{primary:"ui-icon-circle-close"},text:false}); $("#close-element").children().addClass('alipi'); - - $("#edit-current").button(); - $("#edit-current").on("click", a11ypi.editPage); - - $('#renarrated_overlay').addClass('barOnTop'); - a11ypi.ajax(); - a11ypi.ajaxLinks1(); - $('#edit-current').show(); - - d = window.location.search.split('?')[1]; - var a =[]; - for (var i = 0;iTEXT :- It will popup a '+ - 'window and allow you to modify/replace text of select element on editor(right) box.'+ - '

To delete - Empty the editor(right) box and press "Save changes".'+ - '

Add Audio - It allows you to '+ - 'enter audio URL.

IMAGE:-

Replace - It allows you to enter '+ - 'image URL.

UNDO:- Use it when you want to revert back to '+ - 'previous change.'+ - 'PUBLISH:- To publish your crafted changes to database and blog (Alipi/Personal).'+ - '

States - The place you are targetting to.

Languages - In language you publishing.

Style - In what style you crafted?

'+ - 'Author - Who is a crafter?

'+ - 'Alipi blog - If you don\'t have blogspot ID then check this to post it to our blog.

'; - - $('body').append(help_template); - $(document).unbind('mouseover'); // Unbind the css on mouseover - $(document).unbind('mouseout'); // Unbind the css on mouseout - - $(function() { - $( "#helpwindow" ).dialog({ - width:800, - height:550, - modal: true, - close: function() { - $("#helpwindow").remove(); - } - }); - }); - }, - - exitMode: function() { - var exit = window.confirm("Do you really want to exit from edit mode?"); - if (exit == true) { - window.location.reload(); - } - }, - - hide_overlays: function() { - if($('#icon-up').attr('down') == 'true') { - $('#icon-up').attr('down', 'false'); - $('#icon-up').show(); $('#icon-down').hide(); - $('#pub_overlay').addClass('barOnBottom'); $('#pub_overlay').removeClass('barOnTop'); - } else { - $('#icon-up').attr('down', 'true'); - $('#icon-down').show(); $('#icon-up').hide(); - $('#pub_overlay').addClass('barOnTop'); $('#pub_overlay').removeClass('barOnBottom'); - - } - }, - - outterToggle: function() { - if($('#outter-down-button').attr('up') == 'true' ) { - $('#outter-down-button').attr('up', 'false'); - $('#outter-up-button').hide(); $('#outter-down-button').show(); - $('#renarrated_overlay').addClass('barOnBottom'); $('#renarrated_overlay').removeClass('barOnTop'); - } else { - $('#outter-down-button').attr('up', 'true'); - $('#outter-up-button').show(); $('#outter-down-button').hide(); - $('#renarrated_overlay').addClass('barOnTop'); $('#renarrated_overlay').removeClass('barOnBottom'); - } - }, - - - getLoc: function() { - - $( "#loc-select" ).autocomplete({ - source: function(req, add){ - - //pass request to server - $.getJSON(config.deploy+"/getLoc?", req, function(data) { - $('#loc-img').hide(); - - //create array for response objects - var suggestions = []; - - //process response - $.each(data['return'], function(i,val){ - suggestions.push(val['name']+', '+val['country_name']); - }); - //pass array to callback - add(suggestions); - }); - $('#loc-img').show(); - }, - }); - }, - - getLang: function() { - $( "#lang-select" ).autocomplete({ - source: function(req, add){ - - //pass request to server - $.getJSON(config.deploy+"/getLang?", req, function(data) { - $('#lang-img').hide(); - - //create array for response objects - var suggestions = []; - - //process response - $.each(data['return'], function(i, val){ - //suggestions.push(val.country); - suggestions.push(val['name']); - }); - //pass array to callback - add(suggestions); - }); - $('#lang-img').show(); - }, - }); - - - }, - - loginToSwtStore: function() { - var login_template = ''; - - if($('#login-template').length == 0) { - $('body').append(login_template); - } - $(document).unbind('mouseover'); // Unbind the css on mouseover - $(document).unbind('mouseout'); // Unbind the css on mouseout - - $('#login-template').dialog({ - height: 400, - width: 400, - position: 'center', - modal: true, - buttons: [ - { - text: 'Login', - click: function() { - console.log('login'); - var uname = $('#tar-uname').val(); - var pass = $('#tar-pass').val(); - if(uname && pass) { - $('.login-button > .ui-button-text').text('Please wait..'); - sweet.authenticate(config.sweet + '/authenticate', uname, pass, a11ypi.publish, function() { - $('.login-button > .ui-button-text').text('Login'); +//window.jQuery = window.jQuery || {}; +window.onload = function() { + yepnope([{ + test: window.jQuery, + nope:['//code.jquery.com/jquery-1.10.2.min.js'], + load:['//code.jquery.com/ui/1.10.3/jquery-ui.js'], + complete:function(){ + jQuery.noConflict(); + (function($) { + + $(function() { + var a11ypi = { + auth : " ", + loc:" ", + elementTagName: " ", + elementId: " ", + flag : 0, + fflag : 0, + showbox : 0, + showlinks : 0, + blog_flag: false, + target : false, + pageHtml:'', + d: {}, + responseJSON:'', + testContext : function() + { + if(document.getElementById('social_overlay') != null) + document.body.removeChild(document.getElementById('social_overlay')); + $(document).ready(function(){ + try{ + $('body *').not('iframe').contents().filter(function(){ + try{ + + if(this.nodeType == 3 && !($(this).hasClass('alipi'))){ + return (this.nodeType == 3) && this.nodeValue.match(/\S/);}} + catch(err){ + console.log(err); + } + }).parent().attr('m4pageedittype','text'); + } + catch(e){ + console.log(this); + } }); + + vimg = document.getElementsByTagName('img'); + for(i=0; i'; + $(result).before(audio); + result.setAttribute('class','blink'); + } + else{ + result.innerHTML = a['data']; + result.setAttribute('class','blink'); + } + result=nodes.iterateNext(); + } + } + catch (e) + { + // dump( 'error: Document tree modified during iteration ' + e ); + } + } + else if(a['type']=='5el') + { + + try{ + var result = nodes.iterateNext(); + while (result) + { + $(result).html($(result).html()+a['data']); + $(result).get(0).scrollIntoView(); + result=nodes.iterateNext(); + } + } + catch (e) + { + //dump( 'error: Document tree modified during iteration ' + e ); + } + } + }, + filter: function() + { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() + { + if(xhr.readyState == 4) + { + if(xhr.responseText =='empty') + { + // a11ypi.clearMenu(); + // alert("An internal server error occured, please try later."); + } + else + { + + d ={}; + var response=xhr.responseText.substring(3).split('###'); + for (var j= 0; j< response.length ; j++){ + chunk = response[j].substring(1).split('&'); + + for (var i= 0; i< chunk.length ; i++){ + pair =chunk[i].split("::"); + key = pair[0]; + value = pair[1]; + d[key] = value; + } + path = d['xpath']; + newContent = d['data']; + elementType = d['elementtype']; + a11ypi.evaluate(path,newContent,elementType); + } + } + } + } + a = a11ypi.getParams(); + var url = a['foruri']; + var lang= a['lang']; + var blog= a['blog']; + var data="url="+url+"&lang="+encodeURIComponent(lang)+"&blog="+encodeURIComponent(blog); + + xhr.open("POST",config.root+"/filter",true); + xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); + xhr.send(data);// + }, + createMenuFilter: function(menu_list) { + var xyz = document.getElementById("show-box"); + xyz.innerHTML = ''; + d = window.location.search.split('?')[1]; + a = a11ypi.getParams(); + var page = a['foruri']; + var blog = a['blog']; + for(var i=0;iMove '+ + ' '+ + ' '+ + ''+ + // ''+ + ''+ + // ''+ + ''+ + '
'+ + '
'+ + ' '+ + '
'; + + var pub_overlay_template = '
'+ + ''+ //▲ + ''+ //▼ + ''+ + ''+ + ''+ + '
'; + + var element_edit_overlay_template = '
'+ + ''+ + ''+ + ''+ + ''+ + ''+ + ' '+ + '
'; + + $('body').append(overlay_template); + $('body').append(pub_overlay_template); + $('body').append(element_edit_overlay_template); + + $('#outter-up-button').show(); + $('#go').button({disabled : true}); + $('#undo-button').button({ disabled: true}); + $('#publish-button').button({ disabled: true}); + + + $("#outter-down-button").button({icons:{primary:"ui-icon-circle-arrow-n"},text:false}); $('#outter-down-button').children().addClass('alipi'); + $("#outter-up-button").button({icons:{primary:"ui-icon-circle-arrow-s"},text:false}); $('#outter-up-button').children().addClass('alipi'); + $("#edit-current").button({icons:{primary:"ui-icon-pencil"}}); $('#edit-current').children().addClass('alipi'); + $("#see-narration").button({icons:{primary:"ui-icon-document-b"}}); $('#see-narration').children().addClass('alipi'); + $("#see-comment").button({icons:{primary:"ui-icon-document-b"}}); $('#see-comment').children().addClass('alipi'); + $("#see-links").button({icons:{primary:"ui-icon-link"}}); $('#see-links').children().addClass('alipi'); + /*$("#blog-filter").button({icons:{secondary:"ui-icon-triangle-1-s"}}); */ $('#blog-filter').children().addClass('alipi'); + $("#go").button({icons:{primary:"ui-icon-arrowthick-1-e"},text:false}); $('#go').children().addClass('alipi'); + $("#share").button({icons:{primary:"ui-icon-signal-diag"}}); $('#share').children().addClass('alipi'); + $("#orig-button").button({icons:{primary:"ui-icon-extlink"}}); $('#orig-button').children().addClass('alipi'); + $("#info").button({icons:{primary:"ui-icon-info"}}); $('#info').children().addClass('alipi'); + + $("#icon-up").button({icons:{primary:"ui-icon-circle-arrow-n"},text:false}); $('#icon-up').children().addClass('alipi'); + $("#icon-down").button({icons:{primary:"ui-icon-circle-arrow-s"},text:false}); $('#icon-down').children().addClass('alipi'); + $("#exit-mode").button({icons:{primary:"ui-icon-power"}}); $('#exit-mode').children().addClass('alipi'); + $("#help-window").button({icons:{primary:"ui-icon-help"}}); $('#help-window').children().addClass('alipi'); + $("#undo-button").button({icons:{primary:"ui-icon-arrowreturnthick-1-w"}}); $('#undo-button').children().addClass('alipi'); + $("#publish-button").button({icons:{primary:"ui-icon-circle-check"}}); $('#publish-button').children().addClass('alipi'); + + $("#edit-text").button({icons:{primary:"ui-icon-pencil"}}); $('#edit-text').children().addClass('alipi'); + $("#add-audio").button({icons:{primary:"ui-icon-circle-plus"}}); $('#add-audio').children().addClass('alipi'); + $("#replace-image").button({icons:{primary:"ui-icon-transferthick-e-w"}}); $('#replace-image').children().addClass('alipi'); + $("#delete-image").button({icons:{primary:"ui-icon-trash"}}); $('#delete-image').children().addClass('alipi'); + $("#close-element").button({icons:{primary:"ui-icon-circle-close"},text:false}); $("#close-element").children().addClass('alipi'); + + $("#edit-current").button(); + $("#see-narration").button(); + $("#see-links").button(); + +// $('input[class="alipi"], select[class="alipi"]').button(); + $("#edit-current").on("click", a11ypi.editPage); + $("#see-narration").on("click",a11ypi.showBox); + $("#see-links").on("click",a11ypi.showBox1); + + $('#renarrated_overlay').addClass('barOnTop'); + a11ypi.ajax(); + a11ypi.ajaxLinks1(); + $('#edit-current').show(); + $("#see-narration").show(); + d = window.location.search.split('?')[1]; + var a =[]; + for (var i = 0;iTEXT :- It will popup a '+ + 'window and allow you to modify/replace text of select element on editor(right) box.'+ + '

To delete - Empty the editor(right) box and press "Save changes".'+ + '

Add Audio - It allows you to '+ + 'enter audio URL.

IMAGE:-

Replace - It allows you to enter '+ + 'image URL.

UNDO:- Use it when you want to revert back to '+ + 'previous change.'+ + 'PUBLISH:- To publish your crafted changes to database and blog (Alipi/Personal).'+ + '

States - The place you are targetting to.

Languages - In language you publishing.

Style - In what style you crafted?

'+ + 'Author - Who is a crafter?

'+ + 'Alipi blog - If you don\'t have blogspot ID then check this to post it to our blog.

'; + + $('body').append(help_template); + $(document).unbind('mouseover'); // Unbind the css on mouseover + $(document).unbind('mouseout'); // Unbind the css on mouseout + + $(function() { + $( "#helpwindow" ).dialog({ + width:800, + height:550, + modal: true, + close: function() { + $("#helpwindow").remove(); + } + }); + }); + }, + + exitMode: function() { + var exit = window.confirm("Do you really want to exit from edit mode?"); + if (exit == true) { + window.location.reload(); + } + }, + + hide_overlays: function() { + if($('#icon-up').attr('down') == 'true') { + $('#icon-up').attr('down', 'false'); + $('#icon-up').show(); $('#icon-down').hide(); + $('#pub_overlay').addClass('barOnBottom'); $('#pub_overlay').removeClass('barOnTop'); + } else { + $('#icon-up').attr('down', 'true'); + $('#icon-down').show(); $('#icon-up').hide(); + $('#pub_overlay').addClass('barOnTop'); $('#pub_overlay').removeClass('barOnBottom'); + + } + }, + + outterToggle: function() { + if($('#outter-down-button').attr('up') == 'true' ) { + $('#outter-down-button').attr('up', 'false'); + $('#outter-up-button').hide(); $('#outter-down-button').show(); + $('#renarrated_overlay').addClass('barOnBottom'); $('#renarrated_overlay').removeClass('barOnTop'); + } else { + $('#outter-down-button').attr('up', 'true'); + $('#outter-up-button').show(); $('#outter-down-button').hide(); + $('#renarrated_overlay').addClass('barOnTop'); $('#renarrated_overlay').removeClass('barOnBottom'); + } + }, + + + getLoc: function() { + + $( "#loc-select" ).autocomplete({ + source: function(req, add){ + + //pass request to server + $.getJSON(config.deploy+"/getLoc?", req, function(data) { + $('#loc-img').hide(); + + //create array for response objects + var suggestions = []; + + //process response + $.each(data['return'], function(i,val){ + suggestions.push(val['name']+', '+val['country_name']); + }); + //pass array to callback + add(suggestions); + }); + $('#loc-img').show(); + }, + }); + }, + + getLang: function() { + $( "#lang-select" ).autocomplete({ + source: function(req, add){ + + //pass request to server + $.getJSON(config.deploy+"/getLang?", req, function(data) { + $('#lang-img').hide(); + + //create array for response objects + var suggestions = []; + + //process response + $.each(data['return'], function(i, val){ + //suggestions.push(val.country); + suggestions.push(val['name']); + }); + //pass array to callback + add(suggestions); + }); + $('#lang-img').show(); + }, + }); + + + }, + + loginToSwtStore: function() { + var login_template = ''; + + if($('#login-template').length == 0) { + $('body').append(login_template); + } + $(document).unbind('mouseover'); // Unbind the css on mouseover + $(document).unbind('mouseout'); // Unbind the css on mouseout + + $('#login-template').dialog({ + height: 400, + width: 400, + position: 'center', + modal: true, + buttons: [ + { + text: 'Login', + click: function() { + console.log('login'); + var uname = $('#tar-uname').val(); + var pass = $('#tar-pass').val(); + if(uname && pass) { + $('.login-button > .ui-button-text').text('Please wait..'); + sweet.authenticate(config.sweet + '/authenticate', uname, pass, a11ypi.publish, function() { + $('.login-button > .ui-button-text').text('Login'); + }); + } + else { + //console.log('no username and password'); + //$('#login-error').show(); + //TODO: have a proper UI + alert('No username or password provided! Please enter both and then click Login'); + } + }, + 'class': 'login-button' + }, + { + text: 'Guest Login', + click: function() { + console.log('guest login'); + var name = $('#tar-name').val(); + if(name) { + $(this).dialog('close'); + a11ypi.publish(); + } + else { + //console.log('no guest name'); + //$('#guest-error').show(); + alert('Please provide a name for Guest Login'); + } + } + } + ], + close: function() { + console.log('close'); + } + }); + }, + + publish: function() { + $('#login-template').dialog('close'); + if(util.hasChangesPending()) + { + $('#pub_overlay').slideUp(); + $('#element_edit_overlay').slideUp(); + $('#icon_on_overlay').slideUp(); + if (a11ypi.target == false ) { + var publish_template = '
'+ + // '
'+ + ''+ + ' '+ + ' '+ + ' '+ + ' '+ + ''+ + ' '+ + ' '+ + ''+ + '
'+ + '
We are having issues with posting to a personal Google blog. Please use demo.swtr.us to publish.
'+ + '

'+ + ' '+ + '

'; + + $('body').append(publish_template); + a11ypi.getLoc(); + a11ypi.getLang(); + a11ypi.target = true; + } + + $(document).unbind('mouseover'); // Unbind the css on mouseover + $(document).unbind('mouseout'); // Unbind the css on mouseout + + $('#pub_overlay').slideUp(); + $('#element_edit_overlay').slideUp(); + // $('#icon_on_overlay').slideUp(); + + $(function() { + $( "#targetoverlay" ).dialog({ + height:550, + width:700, + modal: true, + buttons: { + Publish: function() { + util.publish(); + }, + + }, + close: function() { + $('#pub_overlay').slideDown(); + // $('#element_edit_overlay').slideDown(); + // $('#icon_on_overlay').slideDown(); + $( "#targetoverlay" ).hide(); + } + }); + }); + } + }, + + hideAll: function() { + var boxes = '#show-links, #show-box, #show-comment'; + if($(boxes).dialog().dialog("isOpen")) + $(boxes).dialog().dialog('close'); + }, + + showBox: function() { + a11ypi.hideAll(); + $(document).unbind('mouseover'); // Unbind the css on mouseover + $(document).unbind('mouseout'); // Unbind the css on mouseout + + $(function() { + // $( "#show-box" ).dialog( "destroy" ); + + $( "#show-box" ).dialog({ + width: 300, + height: 300, + modal: true + }); + }); + d = window.location.search.split('?')[1]; + var a = a11ypi.getParams(); + if (a['blog'] === undefined ) { + a11ypi.createMenu('re-narration'); + } + else { + $('#show-box').attr('title', 'Choose a re-narration from the blog you specified.'); + a11ypi.ajax1(); + } + }, + showComment: function() { + a11ypi.hideAll(); + $(document).unbind('mouseover'); // Unbind the css on mouseover + $(document).unbind('mouseout'); // Unbind the css on mouseout + + $(function() { + $( "#show-comment" ).dialog( "destroy" ); + + $( "#show-comment" ).dialog({ + width: 300, + height: 300, + modal: true + }); + }); + a11ypi.createMenu('5el'); + }, + + ajaxLinks1: function() { + // var xhr = new XMLHttpRequest(); + // xhr.onreadystatechange = function() + // { + // if(xhr.readyState == 4) + // { + // if(xhr.responseText == "empty") + // { } + // else + // { + // $('#see-links').show(); + // a11ypi.showlinks = JSON.parse(xhr.responseText); + // } + // } + // } + // xhr.open("POST",config.deploy+"/domain",true); + // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); + // d = window.location.search.split('?')[1]; + // a = a11ypi.getParams(); + // xhr.send('url='+a['foruri']) + + $.get(config.deploy+"/domain", {"url":a['foruri']}, function(data){ + if(data[0] != 'empty') + { + a11ypi.showlinks = data; + $('#see-links').show(); + } + }); + }, + showBox1: function() { + a11ypi.hideAll(); + $(document).unbind('mouseover'); // Unbind the css on mouseover + $(document).unbind('mouseout'); // Unbind the css on mouseout + + $(function() { + // $( "#show-links" ).dialog( "destroy" ); + + $( "#show-links" ).dialog({ + width: 500, + height: 300, + modal: true + }); + }); + a11ypi.createDomainMenu(); + }, + createDomainMenu: function() { + var xyz = $("#show-links"); + xyz.html(''); + for(var i in a11ypi.showlinks) + { + var para = document.createElement("p"); + var newel = document.createElement("a"); + newel.textContent = a11ypi.showlinks[i]; + newel.setAttribute("href", config.deploy+"/?foruri="+encodeURIComponent(a11ypi.showlinks[i])); + newel.setAttribute("class","alipiShowLink"); + para.appendChild(newel); + xyz.append(para); + } + $('.alipiShowLink').hover( + function() { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() + { + if(xhr.readyState == 4) + { + if(xhr.responseText == "empty") + { } + else + { + menu_list = JSON.parse(xhr.responseText); + x = ''; + for(i=0; i '+ + 'Render source '+ + ' '+ + ''+ + '
'+ + ' '+ + ''+ + '
'; + $('body').append(template); + $('#pub_overlay').slideUp(); + $('#element_edit_overlay').hide(); + + var tag = pageEditor.event.target.nodeName; + $(pageEditor.event.target).removeAttr('m4pageedittype'); + $(pageEditor.event.target).children().removeAttr('m4pageedittype'); + + $('#adv-reference').text('<'+tag+'>'+$(pageEditor.event.target).html()+''); + $('#reference').html($(pageEditor.event.target).html()); + $('#editor').html($(pageEditor.event.target).html()); + $("#adv-ref").button({icons:{primary:"ui-icon-script"},text:true}); $('#adv-ref').children().addClass('alipi'); + $("#close-adv").button({icons:{primary:"ui-icon-bookmark"},text:true}); $('#close-adv').children().addClass('alipi'); + $('#close-adv').hide(); + $('#adv-ref').button(); + + $(document).unbind('mouseover'); // Unbind the css on mouseover + $(document).unbind('mouseout'); // Unbind the css on mouseout + + $( "#editoroverlay" ).dialog({ + position: 'center', + width:$(window).width()-10, + height:$(window).height()-50, + modal: true, + buttons: { + "+": function() { + if($('#editor').css('font-size') >= '30px') { + // passthrough + } + else { + var font = parseFloat($('#editor').css('font-size')) + 1; + $('#editor').css('font-size', font+'px'); + font = parseFloat($('#reference').css('font-size')) + 1; + $('#reference').css('font-size', font+'px'); + font = parseFloat($('#adv-reference').css('font-size')) + 1; + $('#adv-reference').css('font-size', font+'px'); + } + }, + "-": function() { + if($('#editor').css('font-size') <= '10px') { + //passthrough + } + else { + var font = parseFloat($('#editor').css('font-size')) - 1; + $('#editor').css('font-size', font+'px'); + font = parseFloat($('#reference').css('font-size')) - 1; + $('#reference').css('font-size', font+'px'); + font = parseFloat($('#adv-reference').css('font-size')) - 1; + $('#adv-reference').css('font-size', font+'px'); + } + }, + "Add Link": function() { + pageEditor.handler(); + }, + "Save changes": function() { + $('#pub_overlay').slideDown(); + $('#element_edit_overlay').slideDown(); + $('#icon_on_overlay').slideDown(); + manager.recordText(pageEditor.event.target); + pageEditor.cleanUp(pageEditor.event.target); + $( "#editoroverlay" ).remove(); + } + }, + close: function() { + pageEditor.cleanUp(pageEditor.event.target); + $("#editoroverlay" ).remove(); + } + }); + + $($($('
'+ - ''+ - ' '+ - ' '+ - ' '+ - ' '+ - ''+ - ' '+ - ' '+ - ''+ - '
'+ - '
We are having issues with posting to a personal Google blog. Please use demo.swtr.us to publish.
'+ - '

'+ - ' '+ - '

'; - - $('body').append(publish_template); - a11ypi.getLoc(); - a11ypi.getLang(); - a11ypi.target = true; - } - - $(document).unbind('mouseover'); // Unbind the css on mouseover - $(document).unbind('mouseout'); // Unbind the css on mouseout - - $('#pub_overlay').slideUp(); - $('#element_edit_overlay').slideUp(); - // $('#icon_on_overlay').slideUp(); - - $(function() { - $( "#targetoverlay" ).dialog({ - height:550, - width:700, - modal: true, - buttons: { - Publish: function() { - util.publish(); - }, - - }, - close: function() { - $('#pub_overlay').slideDown(); - // $('#element_edit_overlay').slideDown(); - // $('#icon_on_overlay').slideDown(); - $( "#targetoverlay" ).hide(); - } - }); - }); - } - }, - - hideAll: function() { - var boxes = '#show-links, #show-box, #show-comment'; - $(boxes).dialog('close'); - }, - - showBox: function() { - this.hideAll(); - $(document).unbind('mouseover'); // Unbind the css on mouseover - $(document).unbind('mouseout'); // Unbind the css on mouseout - - $(function() { - $( "#show-box" ).dialog( "destroy" ); - - $( "#show-box" ).dialog({ - width: 300, - height: 300, - modal: true - }); - }); - d = window.location.search.split('?')[1]; - var a = a11ypi.getParams(); - if (a['blog'] === undefined ) { - a11ypi.createMenu('re-narration'); - } - else { - $('#show-box').attr('title', 'Choose a re-narration from the blog you specified.'); - a11ypi.ajax1(); - } - }, - showComment: function() { - this.hideAll(); - $(document).unbind('mouseover'); // Unbind the css on mouseover - $(document).unbind('mouseout'); // Unbind the css on mouseout - - $(function() { - $( "#show-comment" ).dialog( "destroy" ); - - $( "#show-comment" ).dialog({ - width: 300, - height: 300, - modal: true - }); - }); - a11ypi.createMenu('5el'); - }, - - ajaxLinks1: function() { - // var xhr = new XMLHttpRequest(); - // xhr.onreadystatechange = function() - // { - // if(xhr.readyState == 4) - // { - // if(xhr.responseText == "empty") - // { } - // else - // { - // $('#see-links').show(); - // a11ypi.showlinks = JSON.parse(xhr.responseText); - // } - // } - // } - // xhr.open("POST",config.deploy+"/domain",true); - // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); - // d = window.location.search.split('?')[1]; - // a = a11ypi.getParams(); - // xhr.send('url='+a['foruri']) - - $.get(config.deploy+"/domain", {"url":a['foruri']}, function(data){ - if(data[0] != 'empty') - { - a11ypi.showlinks = data; - $('#see-links').show(); - } - }); - }, - showBox1: function() { - this.hideAll(); - $(document).unbind('mouseover'); // Unbind the css on mouseover - $(document).unbind('mouseout'); // Unbind the css on mouseout - - $(function() { - $( "#show-links" ).dialog( "destroy" ); - - $( "#show-links" ).dialog({ - width: 500, - height: 300, - modal: true - }); - }); - a11ypi.createDomainMenu(); - }, - createDomainMenu: function() { - var xyz = $("#show-links"); - xyz.html(''); - for(var i in a11ypi.showlinks) - { - var para = document.createElement("p"); - var newel = document.createElement("a"); - newel.textContent = a11ypi.showlinks[i]; - newel.setAttribute("href", config.deploy+"/?foruri="+encodeURIComponent(a11ypi.showlinks[i])); - newel.setAttribute("class","alipiShowLink"); - para.appendChild(newel); - xyz.append(para); - } - $('.alipiShowLink').hover( - function() { - var xhr = new XMLHttpRequest(); - xhr.onreadystatechange = function() - { - if(xhr.readyState == 4) - { - if(xhr.responseText == "empty") - { } - else - { - menu_list = JSON.parse(xhr.responseText); - x = ''; - for(i=0; i '+ - 'Render source '+ - ' '+ - ''+ - '
'+ - ' '+ - ''+ - '
'; - $('body').append(template); - $('#pub_overlay').slideUp(); - $('#element_edit_overlay').hide(); - - var tag = pageEditor.event.target.nodeName; - $(pageEditor.event.target).removeAttr('m4pageedittype'); - $(pageEditor.event.target).children().removeAttr('m4pageedittype'); - - $('#adv-reference').text('<'+tag+'>'+$(pageEditor.event.target).html()+''); - $('#reference').html($(pageEditor.event.target).html()); - $('#editor').html($(pageEditor.event.target).html()); - $("#adv-ref").button({icons:{primary:"ui-icon-script"},text:true}); $('#adv-ref').children().addClass('alipi'); - $("#close-adv").button({icons:{primary:"ui-icon-bookmark"},text:true}); $('#close-adv').children().addClass('alipi'); - $('#close-adv').hide(); - $('#adv-ref').button(); - - $(document).unbind('mouseover'); // Unbind the css on mouseover - $(document).unbind('mouseout'); // Unbind the css on mouseout - - $( "#editoroverlay" ).dialog({ - position: 'center', - width:$(window).width()-10, - height:$(window).height()-50, - modal: true, - buttons: { - "+": function() { - if($('#editor').css('font-size') >= '30px') { - // passthrough - } - else { - var font = parseFloat($('#editor').css('font-size')) + 1; - $('#editor').css('font-size', font+'px'); - font = parseFloat($('#reference').css('font-size')) + 1; - $('#reference').css('font-size', font+'px'); - font = parseFloat($('#adv-reference').css('font-size')) + 1; - $('#adv-reference').css('font-size', font+'px'); - } - }, - "-": function() { - if($('#editor').css('font-size') <= '10px') { - //passthrough - } - else { - var font = parseFloat($('#editor').css('font-size')) - 1; - $('#editor').css('font-size', font+'px'); - font = parseFloat($('#reference').css('font-size')) - 1; - $('#reference').css('font-size', font+'px'); - font = parseFloat($('#adv-reference').css('font-size')) - 1; - $('#adv-reference').css('font-size', font+'px'); - } - }, - "Add Link": function() { - pageEditor.handler(); - }, - "Save changes": function() { - $('#pub_overlay').slideDown(); - $('#element_edit_overlay').slideDown(); - $('#icon_on_overlay').slideDown(); - manager.recordText(pageEditor.event.target); - pageEditor.cleanUp(pageEditor.event.target); - $( "#editoroverlay" ).remove(); - } - }, - close: function() { - pageEditor.cleanUp(pageEditor.event.target); - $("#editoroverlay" ).remove(); - } - }); - - $($($('