From 5c80b835e27e5862a92fb49cefdf81423d968af1 Mon Sep 17 00:00:00 2001 From: Arvind Date: Fri, 22 Jun 2012 11:50:49 +0530 Subject: [PATCH] Adding .gitignore, config file for js. Implemented a function for extracting params --- .gitignore | 13 +++++ server/alipi.py | 5 ++ server/sampleConfig.js | 6 +++ server/ui.js | 141 ++++++++++++++++++------------------------------ 4 files changed, 76 insertions(+), 89 deletions(-) create mode 100644 .gitignore create mode 100644 server/sampleConfig.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5bb1684 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*~ +*.pyc +*.swp +*.jpeg +*.png +*.gif +google3998b23cc94c0027.html +conf.py +apis/ +Sanchaya/ +.#* +logme +config.js \ No newline at end of file diff --git a/server/alipi.py b/server/alipi.py index 9f1cb27..a057866 100755 --- a/server/alipi.py +++ b/server/alipi.py @@ -99,6 +99,11 @@ def setScripts(): script_test.set("type", "text/javascript") script_edit.set("src", conf.APPURL[0] + "/server/wsgi/pageEditor.js") script_edit.set("type","text/javascript") + script_config = g.root.makeelement('script') + g.root.body.append(script_config) + script_config.set("src", conf.APPURL[0] + "/server/config.js") + script_config.set("type", "text/javascript") + script_jq_mini = g.root.makeelement('script') g.root.body.append(script_jq_mini) diff --git a/server/sampleConfig.js b/server/sampleConfig.js new file mode 100644 index 0000000..f17e40f --- /dev/null +++ b/server/sampleConfig.js @@ -0,0 +1,6 @@ +//A sample configuration file for JS variables. Copy this file to "config.js" +var config = { + 'hostname': "127.0.0.1", + 'deploy': "http://127.0.0.1:5000", + 'root': "http://localhost" +} \ No newline at end of file diff --git a/server/ui.js b/server/ui.js index 0a4fb8d..8525e06 100644 --- a/server/ui.js +++ b/server/ui.js @@ -36,18 +36,13 @@ var a11ypi = { createMenu: function(menu_list) { var xyz = document.getElementById("show-box"); xyz.innerHTML = ''; - d = window.location.search.split('?')[1]; - var a =[]; - for (var i = 0;i'+ ' '+ ''+ - '
-// '
'+ + '
'; $('body').append(template); $('#pub_overlay').slideUp(); $('#element_edit_overlay').hide(); -// $('#icon_on_overlay').slideUp(); var tag = pageEditor.event.target.nodeName; $(pageEditor.event.target).removeAttr('m4pageedittype'); @@ -827,7 +775,6 @@ var a11ypi = { $('#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').button(); $('#close-adv').hide(); $('#adv-ref').button(); @@ -914,7 +861,6 @@ var a11ypi = { reflectInReference: function() { var tag = pageEditor.event.target.nodeName; -// $('#reference').text('<'+tag+'>'+$("#editor").html()+''); $("#reference").html() = $("#editor").html(); }, @@ -1001,5 +947,22 @@ var a11ypi = { win.infoFullJSON = a11ypi.responseJSON; win.onLoad(); }, + getParams: function() + { + var a = []; + if(window.location.hostname == config.hostname) + { + d = window.location.search.split('?')[1]; + for (var i = 0;i