Commit 8cd871183bfabc244ebf3c710aeb0bb2b9d464a8
- Diff rendering mode:
- inline
- side by side
alipi/alipi.py
(29 / 31)
  | |||
39 | 39 | def start_page() : | |
40 | 40 | d = {} | |
41 | 41 | d['foruri'] = request.args['foruri'] | |
42 | myhandler1 = urllib2.Request(d['foruri'],headers={'User-Agent':"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"}) #A fix to send user-agents, so that sites render properly. | ||
42 | myhandler1 = urllib2.Request(d['foruri'],headers={'User-Agent':"Mozilla/5.0 (X11; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0)"}) #A fix to send user-agents, so that sites render properly. | ||
43 | 43 | try: | |
44 | 44 | a = urllib2.urlopen(myhandler1) | |
45 | 45 | if a.geturl() != d['foruri']: | |
… | … | ||
119 | 119 | ||
120 | 120 | def setScripts(): | |
121 | 121 | script_test = g.root.makeelement('script') | |
122 | script_edit = g.root.makeelement('script') | ||
122 | # script_edit = g.root.makeelement('script') | ||
123 | 123 | script_auth = g.root.makeelement('script') | |
124 | 124 | g.root.body.append(script_test) | |
125 | g.root.body.append(script_edit) | ||
125 | # g.root.body.append(script_edit) | ||
126 | 126 | g.root.body.append(script_auth) | |
127 | script_test.set("src", conf.APPURL[0] + "/alipi/ui.js") | ||
127 | script_test.set("src", conf.APPURL[0] + "/alipi/pack.min.js") | ||
128 | 128 | script_test.set("type", "text/javascript") | |
129 | script_edit.set("src", conf.APPURL[0] + "/alipi/wsgi/pageEditor.js") | ||
130 | script_edit.set("type","text/javascript") | ||
131 | script_config = g.root.makeelement('script') | ||
132 | g.root.body.append(script_config) | ||
133 | script_config.set("src", conf.APPURL[0] + "/alipi/config.js") | ||
134 | script_config.set("type", "text/javascript") | ||
129 | # script_edit.set("src", conf.APPURL[0] + "/alipi/wsgi/pageEditor.js") | ||
130 | # script_edit.set("type","text/javascript") | ||
131 | # script_config = g.root.makeelement('script') | ||
132 | # g.root.body.append(script_config) | ||
133 | # script_config.set("src", conf.APPURL[0] + "/alipi/config.js") | ||
134 | # script_config.set("type", "text/javascript") | ||
135 | 135 | script_auth.set("src", conf.SWEETURL[0] + "/authenticate") | |
136 | 136 | script_auth.set("type","text/javascript") | |
137 | 137 | ||
138 | script_jq_mini = g.root.makeelement('script') | ||
139 | g.root.body.append(script_jq_mini) | ||
140 | script_jq_mini.set("src", conf.JQUERYURL[0] + "/jquery.min.js") | ||
141 | script_jq_mini.set("type", "text/javascript") | ||
138 | # script_jq_mini = g.root.makeelement('script') | ||
139 | # g.root.body.append(script_jq_mini) | ||
140 | # script_jq_mini.set("src", conf.JQUERYURL[0] + "/jquery.min.js") | ||
141 | # script_jq_mini.set("type", "text/javascript") | ||
142 | 142 | ||
143 | 143 | style = g.root.makeelement('link') | |
144 | 144 | g.root.body.append(style) | |
145 | 145 | style.set("rel","stylesheet") | |
146 | 146 | style.set("type", "text/css") | |
147 | style.set("href", conf.APPURL[0] + "/alipi/stylesheet.css") | ||
147 | style.set("href", conf.APPURL[0] + "/alipi/pack.min.css") | ||
148 | 148 | ||
149 | script_jq_cust = g.root.makeelement('script') | ||
150 | g.root.body.append(script_jq_cust) | ||
151 | script_jq_cust.set("src", conf.JQUERYUI[0] + "/jquery-ui.min.js") | ||
152 | script_jq_cust.set("type", "text/javascript") | ||
149 | # script_jq_cust = g.root.makeelement('script') | ||
150 | # g.root.body.append(script_jq_cust) | ||
151 | # script_jq_cust.set("src", conf.JQUERYUI[0] + "/jquery-ui.min.js") | ||
152 | # script_jq_cust.set("type", "text/javascript") | ||
153 | 153 | ||
154 | style_cust = g.root.makeelement('link') | ||
155 | style_cust.set("rel","stylesheet") | ||
156 | style_cust.set("type", "text/css") | ||
157 | style_cust.set("href", conf.JQUERYCSS[0] + "/jquery-ui.css") | ||
158 | g.root.body.append(style_cust) | ||
154 | # style_cust = g.root.makeelement('link') | ||
155 | # style_cust.set("rel","stylesheet") | ||
156 | # style_cust.set("type", "text/css") | ||
157 | # style_cust.set("href", conf.JQUERYCSS[0] + "/jquery-ui.css") | ||
158 | # g.root.body.append(style_cust) | ||
159 | 159 | ||
160 | 160 | def setSocialScript(): | |
161 | 161 | info_button = g.root.makeelement('button') | |
… | … | ||
401 | 401 | i['bxpath'] = '' | |
402 | 402 | collection.insert(i) | |
403 | 403 | ||
404 | print data | ||
405 | |||
406 | page['title'] = "Re-narration of " + content[0]['about'] | ||
407 | page['name'] = "About " + content[0]['about'] | ||
404 | page['title'] = "Re-narration of " + content[0]['attr']['about'] | ||
405 | page['name'] = "About " + content[0]['attr']['about'] | ||
408 | 406 | page['content'] = content | |
409 | 407 | ||
410 | requests.api.post(conf.CUSTOM_BLOG_POST_URL[0], json.dumps(page), headers={"content-type":"application/json"}) | ||
408 | g.response_from_blogger = requests.api.post(conf.CUSTOM_BLOG_POST_URL[0], json.dumps(page), headers={"content-type":"application/json"}) | ||
409 | print "response from blogger " + repr(g.response_from_blogger) | ||
411 | 410 | sweet(data) | |
412 | 411 | reply = make_response() | |
413 | 412 | return reply | |
… | … | ||
416 | 416 | """ A function to sweet the data that is inserted. Accepts a <list of dicts>. """ | |
417 | 417 | for i in data: | |
418 | 418 | if 'type' in i: | |
419 | print i | ||
420 | 419 | del(i['_id']) | |
421 | sweetmaker.sweet(conf.SWEET_STORE_ADD[0], [{"what":i['type'], "who":i['author'], "where":i['about']+i['xpath'], "how":i['data']+' {lang: '+i["lang"]+',loc: '+i["location"]+'}'}]) | ||
420 | sweetmaker.sweet(conf.SWEET_STORE_ADD[0], [{"what":i['type'], "who":i['author'], "where":i['about']+i['xpath'], "how":conf.CUSTOM_BLOG_URL[0]+"/#"+g.response_from_blogger.json()['name']+' {lang: '+i["lang"]+',loc: '+i["location"]+'}'}]) | ||
422 | 421 | return True | |
423 | 422 | # data = json.dumps(data) | |
424 | 423 | # req = requests.api.post(conf.SWEETURL[0]+"/add",{'data':data}) |
alipi/ui.js
(29 / 11)
  | |||
17 | 17 | { | |
18 | 18 | if(document.getElementById('social_overlay') != null) | |
19 | 19 | document.body.removeChild(document.getElementById('social_overlay')); | |
20 | $(document).ready(function(){$('body *').contents().filter(function(){ | ||
20 | $(document).ready(function(){ | ||
21 | try{ | ||
22 | $('body *').not('iframe').contents().filter(function(){ | ||
21 | 23 | try{ | |
22 | if(this.nodeType === 3 && !($(this).hasClass('alipi'))){ | ||
23 | return (this.nodeType === 3) && this.nodeValue.match(/\S/);}} | ||
24 | catch(err){ | ||
24 | |||
25 | if(this.nodeType == 3 && !($(this).hasClass('alipi'))){ | ||
26 | return (this.nodeType == 3) && this.nodeValue.match(/\S/);}} | ||
27 | catch(err){ | ||
28 | console.log(err); | ||
25 | 29 | } | |
26 | }).parent().attr('m4pageedittype','text')}); | ||
30 | }).parent().attr('m4pageedittype','text'); | ||
31 | } | ||
32 | catch(e){ | ||
33 | console.log(this); | ||
34 | } | ||
35 | }); | ||
27 | 36 | ||
28 | 37 | vimg = document.getElementsByTagName('img'); | |
29 | 38 | for(i=0; i<vimg.length; i++) | |
… | … | ||
326 | 326 | }, | |
327 | 327 | loadOverlay: function() | |
328 | 328 | { | |
329 | var overlay_template = '<div id="renarrated_overlay" class="alipi ui-widget-header ui-corner-all">'+ | ||
329 | yepnope([{ | ||
330 | test: window.jQuery, | ||
331 | nope:['//code.jquery.com/jquery-1.10.2.min.js'], | ||
332 | load:['//code.jquery.com/ui/1.10.3/jquery-ui.js'], | ||
333 | complete:function(){ | ||
334 | var overlay_template = '<div id="renarrated_overlay" class="alipi ui-widget-header ui-corner-all">'+ | ||
330 | 335 | '<button id="outter-down-button" class="alipi" onclick="a11ypi.outterToggle();" up="true" title="Move this bar to top">Move</button> '+ | |
331 | 336 | '<button id="outter-up-button" class="alipi" onclick="a11ypi.outterToggle();" title="Move this bar to bottom">Move</button> '+ | |
332 | '<button id="edit-current" class="alipi" onclick="a11ypi.editPage();" title="Allow to edit this page">Re-narrate</button> '+ | ||
337 | '<button id="edit-current" class="alipi" title="Allow to edit this page">Re-narrate</button> '+ | ||
333 | 338 | '<button id="see-narration" class="alipi" onclick="a11ypi.showBox();" title="See other renarrations, which are in same or other languages"> '+ | |
334 | 339 | 'Re-narrations</button>'+ | |
335 | 340 | // '<button id="see-comment" class="alipi" onclick="a11ypi.showComment();" title="5el"> '+ | |
… | … | ||
377 | 377 | $('#go').button({disabled : true}); | |
378 | 378 | $('#undo-button').button({ disabled: true}); | |
379 | 379 | $('#publish-button').button({ disabled: true}); | |
380 | $('input:.alipi, select:.alipi').button(); | ||
380 | $('input[class="alipi"], select[class="alipi"]').button(); | ||
381 | 381 | ||
382 | 382 | $("#outter-down-button").button({icons:{primary:"ui-icon-circle-arrow-n"},text:false}); $('#outter-down-button').children().addClass('alipi'); | |
383 | 383 | $("#outter-up-button").button({icons:{primary:"ui-icon-circle-arrow-s"},text:false}); $('#outter-up-button').children().addClass('alipi'); | |
… | … | ||
404 | 404 | $("#delete-image").button({icons:{primary:"ui-icon-trash"}}); $('#delete-image').children().addClass('alipi'); | |
405 | 405 | $("#close-element").button({icons:{primary:"ui-icon-circle-close"},text:false}); $("#close-element").children().addClass('alipi'); | |
406 | 406 | ||
407 | $("#edit-current").button(); | ||
408 | $("#edit-current").on("click", a11ypi.editPage); | ||
409 | |||
407 | 410 | $('#renarrated_overlay').addClass('barOnTop'); | |
408 | 411 | a11ypi.ajax(); | |
409 | 412 | a11ypi.ajaxLinks1(); | |
… | … | ||
429 | 429 | $('#orig-button').insertAfter($('#go')); $('#orig-button').show(); | |
430 | 430 | $('#share-box').append($('#fb-like')); $('#share-box').append($('#tweet-root')); | |
431 | 431 | } | |
432 | }}]); | ||
432 | 433 | }, | |
433 | 434 | checkSelect: function() | |
434 | 435 | { | |
… | … | ||
888 | 888 | }); | |
889 | 889 | }, | |
890 | 890 | editPage: function() { | |
891 | this.hideAll(); | ||
891 | //this.hideAll(); | ||
892 | 892 | a11ypi.testContext(); | |
893 | 893 | $('#pub_overlay').show(); $('#pub_overlay').addClass('barOnTop'); | |
894 | 894 | $('#icon-down').show(); | |
895 | 895 | $('#renarrated_overlay').hide(); | |
896 | $('body *').contents().filter(function(){ | ||
896 | $('body *').not('iframe').contents().filter(function(){ | ||
897 | 897 | { | |
898 | 898 | try{ | |
899 | 899 | if(!($(this).hasClass('alipi')) && $(this).attr('m4pageedittype') ) | |
… | … | ||
906 | 906 | } | |
907 | 907 | }).click(pageEditor.startEdit); | |
908 | 908 | ||
909 | $('body *').contents().filter(function(){ | ||
909 | $('body *').not('iframe').contents().filter(function(){ | ||
910 | 910 | { | |
911 | 911 | try{ | |
912 | 912 | if(!($(this).hasClass('alipi')) || $(this).attr('m4pageedittype')) |